| | |
| | | return option?.uuid ?? ''; |
| | | }; |
| | | |
| | | const checkoutAgvNo = (agvId) => { |
| | | return "1" |
| | | } |
| | | |
| | | const getOptionId = (option) => { |
| | | return option?.id; |
| | | }; |
| | |
| | | options={agvOptions || []} |
| | | value={agvList || []} |
| | | getOptionLabel={getOptionLabel} |
| | | isOptionEqualToValue={(option, value) => getOptionId(option) === getOptionId(value)} |
| | | isOptionEqualToValue={(option, value) => { |
| | | return getOptionId(option) === value; |
| | | }} |
| | | onChange={(event, newValue) => { |
| | | setAgvList(newValue); |
| | | }} |
| | |
| | | value.map((option, index) => ( |
| | | <Chip |
| | | {...getTagProps({ index })} |
| | | key={getOptionId(option)} |
| | | label={getOptionLabel(option)} |
| | | key={index} |
| | | label={checkoutAgvNo(option)} |
| | | size="small" |
| | | sx={{ mr: 0.5, fontWeight: 'bold' }} |
| | | /> |
| | |
| | | import { getAreaInfo, fetchAgvListAll, updateAreaData, removeArea } from '../http'; |
| | | |
| | | const getAgvOptionId = (option) => { |
| | | // console.log(option); |
| | | |
| | | if (typeof option === 'string') { |
| | | return option; |
| | | } |
| | |
| | | |
| | | useEffect(() => { |
| | | if (curAreaInfo) { |
| | | console.log(curAreaInfo); |
| | | |
| | | setName(curAreaInfo.name || ''); |
| | | setCode(curAreaInfo.code || ''); |
| | | setMaxCount(curAreaInfo.maxCount ?? ''); |
| | |
| | | setPriority(curAreaInfo.priority ?? ''); |
| | | |
| | | const selected = curAreaInfo.agvList || []; |
| | | const normalizedSelection = mapSelectionToOptions(selected, agvOptions); |
| | | setAgvList(normalizedSelection); |
| | | // const normalizedSelection = mapSelectionToOptions(selected, agvOptions); |
| | | setAgvList(selected); |
| | | setInitialBasic({ |
| | | name: curAreaInfo.name || '', |
| | | agvIds: normalizedSelection.map(getAgvOptionId) |
| | | agvIds: selected |
| | | }); |
| | | |
| | | const codes = curAreaInfo.codeList || []; |
| | |
| | | name, |
| | | agvIds: agvList.map(getAgvOptionId), |
| | | }; |
| | | const success = await updateAreaData(payload); |
| | | if (success) { |
| | | setInitialBasic({ |
| | | name, |
| | | agvIds: payload.agvIds, |
| | | }); |
| | | fetchAreaInfo(id); |
| | | const data = await updateAreaData(payload); |
| | | if (data) { |
| | | console.log(data); |
| | | |
| | | setCurAreaInfo(data); |
| | | // setInitialBasic({ |
| | | // name, |
| | | // agvIds: payload.agvIds, |
| | | // }); |
| | | // fetchAreaInfo(id); |
| | | } |
| | | }; |
| | | |
| | |
| | | export const updateAreaData = async (payload = {}) => { |
| | | try { |
| | | const res = await request.post('/map/area/update', payload); |
| | | const { code, msg } = res.data; |
| | | const { code, msg, data } = res.data; |
| | | if (code === 200) { |
| | | notify.success?.(msg); |
| | | return true; |
| | | notify.success(msg); |
| | | return data; |
| | | } |
| | | notify?.error?.(msg); |
| | | notify.error(msg); |
| | | } catch (error) { |
| | | notify.error(error.message); |
| | | console.error(error.message); |
| | | } |
| | | return false; |
| | | return null; |
| | | }; |
| | | |
| | | export const removeArea = async (areaId) => { |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.acs.manager.manager.controller.param.MapAreaParam; |
| | | import com.zy.acs.manager.manager.controller.result.MapAreaResult; |
| | | import com.zy.acs.manager.manager.entity.Area; |
| | | |
| | | public interface AreaService extends IService<Area> { |
| | | |
| | | Area saveMapArea(MapAreaParam param, Long loginUserId); |
| | | |
| | | Area modifyMapArea(MapAreaParam param, Long loginUserId); |
| | | MapAreaResult modifyMapArea(MapAreaParam param, Long loginUserId); |
| | | |
| | | } |
| | |
| | | import com.zy.acs.manager.common.domain.AreaShapeDto; |
| | | import com.zy.acs.manager.core.service.AreaGovernService; |
| | | import com.zy.acs.manager.manager.controller.param.MapAreaParam; |
| | | import com.zy.acs.manager.manager.controller.result.MapAreaResult; |
| | | import com.zy.acs.manager.manager.entity.Area; |
| | | import com.zy.acs.manager.manager.entity.AreaAgv; |
| | | import com.zy.acs.manager.manager.enums.StatusType; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Area modifyMapArea(MapAreaParam param, Long loginUserId) { |
| | | public MapAreaResult modifyMapArea(MapAreaParam param, Long loginUserId) { |
| | | Long areaId = param.getId(); |
| | | Area area = this.getById(areaId); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | return area; |
| | | return new MapAreaResult().sync(area); |
| | | } |
| | | |
| | | } |