| | |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.asrs.utils.NotifyUtils; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.entity.FindCrnNoResult; |
| | | import com.zy.common.model.StartupDto; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.utils.RedisUtil; |
| | |
| | | } |
| | | |
| | | Integer station = inStationObjModel.getDualCrnExecuteStation(); |
| | | if (station == 1) { |
| | | List<Integer> basList = basDualCrnp.getDisableStationOneBays$(); |
| | | if (basList.contains(Utils.getBay(wrkMast.getLocNo()))) { |
| | | //禁止放货列,申请重新分配 |
| | | reassignTaskLocNo(wrkMast, inStationObjModel); |
| | | return false; |
| | | } |
| | | }else { |
| | | List<Integer> basList = basDualCrnp.getDisableStationTwoBays$(); |
| | | if (basList.contains(Utils.getBay(wrkMast.getLocNo()))) { |
| | | //禁止放货列,申请重新分配 |
| | | reassignTaskLocNo(wrkMast, inStationObjModel); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | String sourceLocNo = Utils.getLocNo(inStationObjModel.getDeviceRow(), inStationObjModel.getDeviceBay(), inStationObjModel.getDeviceLev()); |
| | | |
| | | List<DualCrnCommand> commandList = new ArrayList<>(); |
| | |
| | | return 0; |
| | | } |
| | | |
| | | private boolean reassignTaskLocNo(WrkMast wrkMast, StationObjModel stationObjModel) { |
| | | StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, stationObjModel.getDeviceNo()); |
| | | if (stationThread == null) { |
| | | return false; |
| | | } |
| | | |
| | | Map<Integer, StationProtocol> stationProtocolMap = stationThread.getStatusMap(); |
| | | StationProtocol stationProtocol = stationProtocolMap.get(stationObjModel.getStationId()); |
| | | if (stationProtocol == null) { |
| | | return false; |
| | | } |
| | | |
| | | String response = wmsOperateUtils.applyReassignTaskLocNo(wrkMast.getWrkNo(), stationObjModel.getStationId()); |
| | | if (response == null) { |
| | | News.taskError(wrkMast.getWrkNo(), "请求WMS重新分配入库库位接口失败,接口未响应!!!response:{}", response); |
| | | return false; |
| | | } |
| | | |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | StartupDto dto = jsonObject.getObject("data", StartupDto.class); |
| | | |
| | | String sourceLocNo = wrkMast.getLocNo(); |
| | | String locNo = dto.getLocNo(); |
| | | |
| | | LocMast sourceLocMast = locMastService.queryByLoc(sourceLocNo); |
| | | if (sourceLocMast == null) { |
| | | News.taskInfo(wrkMast.getWrkNo(), "库位号:{} 源库位信息不存在", sourceLocNo); |
| | | return false; |
| | | } |
| | | |
| | | if (!sourceLocMast.getLocSts().equals("S")) { |
| | | News.taskInfo(wrkMast.getWrkNo(), "库位号:{} 源库位状态不处于入库预约", sourceLocNo); |
| | | return false; |
| | | } |
| | | |
| | | LocMast locMast = locMastService.queryByLoc(locNo); |
| | | if (locMast == null) { |
| | | News.taskInfo(wrkMast.getWrkNo(), "库位号:{} 目标库位信息不存在", locNo); |
| | | return false; |
| | | } |
| | | |
| | | if (!locMast.getLocSts().equals("O")) { |
| | | News.taskInfo(wrkMast.getWrkNo(), "库位号:{} 目标库位状态不处于空库位", locNo); |
| | | return false; |
| | | } |
| | | //更新源库位 |
| | | sourceLocMast.setLocSts("O"); |
| | | sourceLocMast.setModiTime(new Date()); |
| | | locMastService.updateById(sourceLocMast); |
| | | |
| | | //更新目标库位 |
| | | locMast.setLocSts("S"); |
| | | locMast.setModiTime(new Date()); |
| | | locMastService.updateById(locMast); |
| | | |
| | | //更新工作档数据 |
| | | wrkMast.setLocNo(locNo); |
| | | wrkMastService.updateById(wrkMast); |
| | | return true; |
| | | } else { |
| | | News.error("请求WMS更换双工位库位接口失败!!!response:{}", response); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | } |