| | |
| | | import com.vincent.rsf.server.manager.enums.*; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.vincent.rsf.server.manager.utils.LocManageUtil; |
| | | import com.vincent.rsf.server.manager.utils.WarehouseLocationRetrievalUtil; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | // throw new CoolException("未找到所属库区信息"); |
| | | } |
| | | |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(DeviceSite::getSite, station.getStationName()) |
| | | .eq(DeviceSite::getAreaIdEnd, warehouseArea.getId()) |
| | | .eq(DeviceSite::getType, TaskType.TASK_TYPE_EMPTY_IN.type).last("limit 1")); |
| | | if (Cools.isEmpty(deviceSite)) { |
| | | boolean isItAvailable = new WarehouseLocationRetrievalUtil().queryPathIsItAvailableInArea(station.getStationName(), warehouseArea.getId(), param.getContainerNo(), TaskType.TASK_TYPE_EMPTY_IN.type); |
| | | // DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | // .eq(DeviceSite::getSite, ) |
| | | // .eq(DeviceSite::getAreaIdEnd,) |
| | | // .eq(DeviceSite::getType, TaskType.TASK_TYPE_EMPTY_IN.type).last("limit 1")); |
| | | // if (Cools.isEmpty(deviceSite)) { |
| | | // errorBuilder.append("无可用路径"); |
| | | // continue; |
| | | // throw new CoolException("无可用路径!!"); |
| | | // } |
| | | if (!isItAvailable){ |
| | | errorBuilder.append("无可用路径"); |
| | | continue; |
| | | // throw new CoolException("无可用路径!!"); |
| | | |
| | | } |
| | | |
| | | // BasContainer container = basContainerService.getOne(new LambdaUpdateWrapper<BasContainer>() |
| | |
| | | if (StringUtils.isBlank(ruleCode)) { |
| | | throw new CoolException("编码错误:请确认编码「SYS_TASK_CODE」是否已生成!!"); |
| | | } |
| | | String stationName = null; |
| | | if (Cools.isEmpty(deviceSite.getDeviceCode())) { |
| | | stationName = station.getStationName(); |
| | | } else { |
| | | BasStation stationCode = basStationService.getById(deviceSite.getDeviceCode()); |
| | | stationName = stationCode.getStationName(); |
| | | if (Cools.isEmpty(stationCode)) { |
| | | stationName = station.getStationName(); |
| | | } |
| | | } |
| | | String stationName = station.getStationName(); |
| | | Task task = new Task(); |
| | | task.setTaskCode(ruleCode) |
| | | .setTaskStatus(TaskStsType.MISSION_INITIAL.id) |
| | |
| | | if (!basStationService.updateById(station)) { |
| | | 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, param.getContainerNo()))) { |
| | | Loc taskLoc = locService.getOne(new LambdaQueryWrapper<Loc>() |
| | | .eq(Loc::getCode, task.getTargLoc()) |
| | | .last("limit 1"), false); |
| | | if (Objects.isNull(taskLoc)) { |
| | | throw new CoolException("库位预约失败!!"); |
| | | } |
| | | taskLoc.setUseStatus(LocStsType.LOC_STS_TYPE_S.type) |
| | | .setBarcode(param.getContainerNo()) |
| | | .setUpdateBy(loginUserId) |
| | | .setUpdateTime(new Date()); |
| | | if (!locService.updateById(taskLoc)) { |
| | | throw new CoolException("库位预约失败!!"); |
| | | } |
| | | return R.ok("任务生成完毕!"); |