rsf-admin/src/page/basicInfo/basStation/BasStationCreate.jsx
@@ -17,6 +17,7 @@ useNotify, Form, useCreateController, SelectArrayInput, } from 'react-admin'; import { Dialog, @@ -30,6 +31,7 @@ import DialogCloseButton from "../../components/DialogCloseButton"; import StatusSelectInput from "../../components/StatusSelectInput"; import MemoInput from "../../components/MemoInput"; import DictionarySelect from "../../components/DictionarySelect"; const BasStationCreate = (props) => { const { open, setOpen } = props; @@ -93,79 +95,97 @@ /> </Grid> <Grid item xs={6} display="flex" gap={1}> <NumberInput <SelectInput label="table.field.basStation.inAble" source="inAble" choices={[ { id: 0, name: '否' }, { id: 1, name: '是' }, ]} /> </Grid> <Grid item xs={6} display="flex" gap={1}> <NumberInput <SelectInput label="table.field.basStation.outAble" source="outAble" choices={[ { id: 0, name: '否' }, { id: 1, name: '是' }, ]} /> </Grid> <Grid item xs={6} display="flex" gap={1}> <TextInput label="table.field.basStation.useStatus" source="useStatus" parse={v => v} <DictionarySelect label={translate("table.field.basStation.useStatus")} name="useStatus" size="small" validate={[required()]} dictTypeCode="sys_sta_use_stas" /> </Grid> <Grid item xs={6} display="flex" gap={1}> <NumberInput label="table.field.basStation.area" source="area" /> <ReferenceInput source="area" reference="warehouseAreas"> <SelectInput label="table.field.basStation.area" optionText="name" optionValue="id" fullWidth validate={[required()]} /> </ReferenceInput> </Grid> <Grid item xs={6} display="flex" gap={1}> <NumberInput label="table.field.basStation.isCrossZone" source="isCrossZone" /> <SelectInput label="table.field.basStation.isCrossZone" source="isCrossZone" choices={[ { id: 0, name: '否' }, { id: 1, name: '是' }, ]} validate={[required()]} /> </Grid> <Grid item xs={6} display="flex" gap={1}> <TextInput label="table.field.basStation.crossZoneArea" source="crossZoneArea" parse={v => v} /> <ReferenceArrayInput source="areaIds" reference="warehouseAreas"> <SelectArrayInput label="table.field.basStation.crossZoneArea" optionText="name" optionValue="id" fullWidth /> </ReferenceArrayInput> </Grid> <Grid item xs={6} display="flex" gap={1}> <NumberInput label="table.field.basStation.isWcs" source="isWcs" /> </Grid> <SelectInput label="table.field.basStation.isWcs" source="isWcs" choices={[ { id: 0, name: '否' }, { id: 1, name: '是' }, ]} validate={[required()]} /> </Grid> <Grid item xs={6} display="flex" gap={1}> <TextInput label="table.field.basStation.wcsData" source="wcsData" parse={v => v} /> </Grid> <DictionarySelect label={translate("table.field.basStation.containerType")} name="containerType" size="small" validate={[required()]} dictTypeCode="sys_container_type" /> </Grid> <Grid item xs={6} display="flex" gap={1}> <NumberInput label="table.field.basStation.containerType" source="containerType" /> </Grid> <Grid item xs={6} display="flex" gap={1}> <TextInput label="table.field.basStation.barcode" source="barcode" parse={v => v} /> </Grid> <Grid item xs={6} display="flex" gap={1}> <NumberInput label="table.field.basStation.autoTransfer" source="autoTransfer" /> <SelectInput label="table.field.basStation.autoTransfer" source="autoTransfer" choices={[ { id: 0, name: '否' }, { id: 1, name: '是' }, ]} /> </Grid> <Grid item xs={6} display="flex" gap={1}> <StatusSelectInput /> </Grid> <Grid item xs={12} display="flex" gap={1}> <Stack direction="column" spacing={1} width={'100%'}> <MemoInput /> rsf-server/src/main/java/com/vincent/rsf/server/api/controller/pda/AgvController.java
@@ -25,7 +25,7 @@ private AgvService agvService; @ApiOperation("站点绑定查询") @PreAuthorize("hasAuthority('manager:qlyInspect:list')") @PreAuthorize("hasAuthority('manager:basStation:list')") @PostMapping("/staBind/list") public R getStaBindList(@RequestBody Map<String, Object> params) { if (Objects.isNull(params)) { @@ -44,7 +44,7 @@ return agvService.getAGVStaBind(params); } @PreAuthorize("hasAuthority('manager:asnOrderItem:list')") @PreAuthorize("hasAuthority('manager:basStation:list')") @ApiOperation("站点解绑") @PostMapping("/AGV/staUnBind") public R getAGVStaUnBind(@RequestBody Map<String, Object> params) { @@ -53,4 +53,14 @@ } return agvService.AGVStaUnBind(params); } @PreAuthorize("hasAuthority('manager:basStation:list')") @ApiOperation("AGV启动入库") @PostMapping("/AGV/task/start") public R AGVInTaskStart(@RequestBody Map<String, Object> params) { if (Objects.isNull(params)) { return R.error("参数不能为空!!"); } return agvService.AGVInTaskStart(params, getLoginUserId()); } } rsf-server/src/main/java/com/vincent/rsf/server/api/service/AgvService.java
@@ -10,4 +10,6 @@ R getStaBindList(Map<String, Object> params); R AGVStaUnBind(Map<String, Object> params); R AGVInTaskStart(Map<String, Object> params ,Long loginUserId); } rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/AgvServiceImpl.java
@@ -8,15 +8,16 @@ import com.vincent.rsf.server.manager.entity.BasStation; import com.vincent.rsf.server.manager.entity.WaitPakin; import com.vincent.rsf.server.manager.entity.WaitPakinItem; import com.vincent.rsf.server.manager.entity.WarehouseAreas; import com.vincent.rsf.server.manager.enums.PakinIOStatus; import com.vincent.rsf.server.manager.enums.StaUseStatusType; import com.vincent.rsf.server.manager.service.BasStationService; import com.vincent.rsf.server.manager.service.WaitPakinItemService; import com.vincent.rsf.server.manager.service.WaitPakinService; import com.vincent.rsf.server.manager.service.*; import com.vincent.rsf.server.manager.utils.LocManageUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -29,6 +30,45 @@ private BasStationService basStationService; @Autowired private WaitPakinItemService waitPakinItemService; @Autowired private WarehouseAreasService warehouseAreasService; @Autowired private TaskService taskService; @Override public R AGVInTaskStart(Map<String, Object> params,Long loginUserId ) { String sta = params.get("sta").toString(); String area = params.get("area").toString(); if (Cools.isEmpty(sta)){ throw new CoolException("接驳位条码不能为空"); } if (Cools.isEmpty(area)){ throw new CoolException("目标库区不能为空"); } BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>() .eq(BasStation::getStationName, sta) .eq(BasStation::getUseStatus,StaUseStatusType.TYPE_F.type) ); if (Cools.isEmpty(basStation)){ throw new CoolException("未找到接驳站点信息,请检查站点状态"); } if (Cools.isEmpty(basStation.getBarcode())){ throw new CoolException("数据错误,接驳站无条码信息"); } WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>() .eq(WaitPakin::getBarcode, basStation.getBarcode()) .eq(WaitPakin::getIoStatus,PakinIOStatus.PAKIN_IO_STATUS_DONE.val) ); if (Cools.isEmpty(waitPakin)){ throw new CoolException("未找到组托数据,请检查状态"); } String targetLoc = LocManageUtil.getTargetLoc(Long.parseLong(area)); taskService.generateAGVTasks(waitPakin,targetLoc,sta,loginUserId); return R.ok(); } @Override public R AGVStaUnBind(Map<String, Object> params) { @@ -61,6 +101,8 @@ return R.ok("解绑成功"); } @Override public R getStaBindList(Map<String, Object> params) { String sta = params.get("sta").toString(); @@ -88,12 +130,24 @@ if (Cools.isEmpty(waitPakinItems)){ throw new CoolException("数据错误,未找到组托明细"); } List<Long> ids = new ArrayList<>(); ids.add(basStation.getArea()); if (basStation.getIsCrossZone() == 1){ String content = basStation.getCrossZoneArea().substring(1, basStation.getCrossZoneArea().length() - 1); String[] parts = content.split(","); for (int i = 0; i < parts.length; i++) { ids.add(Long.parseLong(parts[i].trim())); } } List<WarehouseAreas> warehouseAreasList = warehouseAreasService.list(new LambdaQueryWrapper<WarehouseAreas>() .in(WarehouseAreas::getId, ids) ); return R.ok(Cools .add("barcode", basStation.getBarcode()) .add("list", waitPakinItems) .add("warehouseAreasList", warehouseAreasList) .add("area", basStation.getArea()) ); } rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/BasStationController.java
@@ -10,6 +10,7 @@ import com.vincent.rsf.server.common.domain.KeyValVo; import com.vincent.rsf.server.common.domain.PageParam; import com.vincent.rsf.server.manager.entity.BasStation; import com.vincent.rsf.server.manager.enums.StaUseStatusType; import com.vincent.rsf.server.manager.service.BasStationService; import com.vincent.rsf.server.system.controller.BaseController; import org.springframework.beans.factory.annotation.Autowired; @@ -99,6 +100,9 @@ if (null !=basStation.getAreaIds()){ basStation.setCrossZoneArea(Arrays.toString(basStation.getAreaIds())); } if (null !=basStation.getUseStatus() && basStation.getUseStatus().equals(StaUseStatusType.TYPE_O.type)){ basStation.setBarcode(null); } if (!basStationService.updateById(basStation)) { return R.error("更新失败"); } rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/BasStation.java
@@ -66,7 +66,7 @@ * 所属库区id */ @ApiModelProperty(value= "所属库区id") private Integer area; private Long area; /** * 是否可跨区 @@ -102,6 +102,7 @@ * 条码 */ @ApiModelProperty(value= "条码") @TableField(updateStrategy = FieldStrategy.IGNORED) private String barcode; /** rsf-server/src/main/java/com/vincent/rsf/server/manager/service/TaskService.java
@@ -14,6 +14,8 @@ R generateFlatWarehouseTasks(WaitPakin waitPakins,String locCode, Long loginUserId); R generateAGVTasks(WaitPakin waitPakins,String locCode,String orgSta, Long loginUserId); // R completeTask(String id); void completeTask(List<Task> task) throws Exception; rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -64,6 +64,90 @@ @Autowired private WarehouseAreasItemService warehouseAreasItemService; @Override @Transactional(rollbackFor = Exception.class) public synchronized R generateAGVTasks(WaitPakin pakins,String locCode,String orgSta, Long loginUserId) { if (Cools.isEmpty(pakins) || Cools.isEmpty(locCode)) { throw new CoolException("参数不能为空!!"); } /**获取组拖*/ // List<Long> ids = pakins.stream().map(WaitPakin::getId).collect(Collectors.toList()); List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>() .in(WaitPakin::getId, pakins.getId()) .eq(WaitPakin::getIoStatus, Short.parseShort(PakinIOStatus.PAKIN_IO_STATUS_DONE.val))); if (waitPakins.isEmpty()) { throw new CoolException("请检查组托状态是否完成!!"); } waitPakins.forEach(pakin -> { /**获取库位*/ String targetLoc = locCode; if (Cools.isEmpty(targetLoc)) { throw new CoolException("该站点对应库区未找到库位"); } List<TaskItem> taskItems = new ArrayList<>(); String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_TASK_CODE, null); if (StringUtils.isBlank(ruleCode)) { throw new CoolException("编码错误:请确认编码「SYS_TASK_CODE」是否已生成!!"); } Task task = new Task(); task.setTaskCode(ruleCode) .setTaskStatus(TaskStsType.GENERATE_IN.id.shortValue()) .setTaskType(TaskType.TASK_TYPE_AGV_IN.type.shortValue()) .setTargLoc(targetLoc) .setOrgSite(orgSta) .setBarcode(pakin.getBarcode()) .setCreateBy(loginUserId) .setUpdateBy(loginUserId); if (!this.save(task)) { throw new CoolException("任务保存失败!!"); } if (!locService.update(new LambdaUpdateWrapper<Loc>().eq(Loc::getCode, task.getTargLoc()) .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type).set(Loc::getBarcode, pakin.getBarcode()))) { throw new CoolException("库位预约失败!!"); } /**获取组拖明细**/ List<WaitPakinItem> waitPakinItems = waitPakinItemService.list(new LambdaQueryWrapper<WaitPakinItem>().eq(WaitPakinItem::getPakinId, pakin.getId())); if (waitPakinItems.isEmpty()) { throw new CoolException("数据错误:组拖明细不存在"); } waitPakinItems.forEach(item -> { TaskItem taskItem = new TaskItem(); BeanUtils.copyProperties(item, taskItem); taskItem.setTaskId(task.getId()) .setOrderType(OrderType.ORDER_IN.type) .setSource(item.getId()) .setTrackCode(item.getTrackCode()) .setCreateBy(loginUserId) .setUpdateBy(loginUserId) .setExtendFields(item.getExtendFields()) .setOrderId(item.getAsnId()) .setOrderItemId(item.getAsnItemId()); taskItems.add(taskItem); }); if (!taskItemService.saveBatch(taskItems)) { throw new CoolException("任务明细保存失败!!"); } waitPakinItems.forEach(item -> { if (! waitPakinItemService.update(new LambdaUpdateWrapper<WaitPakinItem>() .set(WaitPakinItem::getWorkQty, item.getAnfme()) .eq(WaitPakinItem::getId, item.getId()))) { throw new CoolException("组托明细修执行数量修改失败!!"); } }); }); if (!waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>() .in(WaitPakin::getId, pakins.getId()) .set(WaitPakin::getUpdateBy, loginUserId) .set(WaitPakin::getCreateBy, loginUserId) .set(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_TASK_EXCE.val))) { throw new CoolException("组托状态修改失败!!"); } return R.ok("任务生成完毕!"); } @Override @Transactional(rollbackFor = Exception.class)