diff --git a/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/AutoSortServiceImpl.java b/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/AutoSortServiceImpl.java index 6f3e659..9756950 100644 --- a/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/AutoSortServiceImpl.java +++ b/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/AutoSortServiceImpl.java @@ -151,7 +151,21 @@ public class AutoSortServiceImpl implements AutoSortService { if (incrementalDetails.isEmpty()) { log.info("无增量数据,无需扫进 - rqrq"); + Pallet pallet = wcsIntegrationMapper.getPalletByCode(callback.getSite(), callback.getPalletId()); + if (pallet == null) { + throw new RuntimeException("栈板不存在:" + callback.getPalletId()); + } wcsCallbackPalletScanMapper.updateProcessStatus(callback.getId(), "COMPLETED", "无增量数据"); + //碰到异常订单 如果没有明细 直接回库 --和左工沟通过 + ScheduleDeliveryTask scheduleDeliveryTask = new ScheduleDeliveryTask(); + scheduleDeliveryTask.setSite(callback.getSite()); + scheduleDeliveryTask.setPalletId(callback.getPalletId()); + scheduleDeliveryTask.setFromLocation(pallet.getLocationCode()); + scheduleDeliveryTask.setToArea("Z103"); + scheduleDeliveryTask.setUsername("SYS_WMS"); + + autoTaskService.scheduleDeliveryTask(scheduleDeliveryTask); + log.info("调用配送任务调度成功 - rqrq:palletId={}, toArea={}", callback.getPalletId(), "Z103"); return; } diff --git a/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/KitTransportServiceImpl.java b/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/KitTransportServiceImpl.java index 99c1188..df4d5f9 100644 --- a/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/KitTransportServiceImpl.java +++ b/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/KitTransportServiceImpl.java @@ -96,9 +96,9 @@ public class KitTransportServiceImpl implements KitTransportService { // 继续处理下一个订单 - rqrq } - // 每处理完一个订单后休息2s,释放锁资源,让其他事务有机会执行,减少死锁风险 - rqrq + // 每处理完一个订单后休息1s,释放锁资源,让其他事务有机会执行,减少死锁风险 - rqrq try { - Thread.sleep(2000); + Thread.sleep(1000); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); log.warn("齐套运输任务被中断 - rqrq"); diff --git a/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/WcsIntegrationServiceImpl.java b/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/WcsIntegrationServiceImpl.java index 3d69e12..35ff322 100644 --- a/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/WcsIntegrationServiceImpl.java +++ b/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/WcsIntegrationServiceImpl.java @@ -454,6 +454,19 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService { if (!"Y".equals(inStockFlag)) { throw new Exception("标签不在库状态:in_stock_flag不为Y"); } + // 校验栈板里已有物料的仓库库位与要扫入标签的仓库库位是否一致 - rqrq + List existingPalletDetails = wcsIntegrationMapper.getPalletDetailsData(site, palletId); + if (existingPalletDetails != null && !existingPalletDetails.isEmpty()) { + // 栈板有物料,获取第一条记录的仓库和库位 + PalletDetailData firstDetail = existingPalletDetails.get(0); + String existingWarehouseId = firstDetail.getWarehouseId(); + String existingLocationId = firstDetail.getLocationId(); + + // 比较仓库和库位是否一致 + if (!labelWarehouseId.equals(existingWarehouseId)) { + throw new Exception("扫入的标签和栈板里的标签仓库不同"); + } + } // 获取栈板当前所在站点 AgvStation nowStation = wcsIntegrationMapper.getNowStation(site, palletId); @@ -478,29 +491,17 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService { }else { throw new Exception("栈板不在运输点位,无法进行打托操作"); } - } - - // 校验栈板和物料的仓库是否一致(栈板的仓库通过location_code关联agv_station获取warehouse_code) - nowStation=wcsIntegrationMapper.getNowStation(site, palletId); - String palletWarehouseCode = nowStation.getWarehouseCode(); - if (!labelWarehouseId.equals(palletWarehouseCode)) { - throw new Exception("栈板和物料的仓库不同,无法进行打托操作"); - } + }else { - // 校验栈板里已有物料的仓库库位与要扫入标签的仓库库位是否一致 - rqrq - List existingPalletDetails = wcsIntegrationMapper.getPalletDetailsData(site, palletId); - if (existingPalletDetails != null && !existingPalletDetails.isEmpty()) { - // 栈板有物料,获取第一条记录的仓库和库位 - PalletDetailData firstDetail = existingPalletDetails.get(0); - String existingWarehouseId = firstDetail.getWarehouseId(); - String existingLocationId = firstDetail.getLocationId(); - - // 比较仓库和库位是否一致 - if (!labelWarehouseId.equals(existingWarehouseId)) { - throw new Exception("扫入的标签和栈板里的标签仓库不同"); + // 校验栈板和物料的仓库是否一致(栈板的仓库通过location_code关联agv_station获取warehouse_code) + nowStation = wcsIntegrationMapper.getNowStation(site, palletId); + String palletWarehouseCode = nowStation.getWarehouseCode(); + if (!labelWarehouseId.equals(palletWarehouseCode)) { + throw new Exception("栈板和物料的仓库不同,无法进行打托操作"); } } + String oldPalletId=""; // 2. 检查标签是否已在栈板中(当前栈板或其他栈板) diff --git a/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml b/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml index 0d04a27..c230ca3 100644 --- a/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml +++ b/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml @@ -269,8 +269,8 @@ @@ -354,7 +354,7 @@ - UPDATE pallet WITH (ROWLOCK) + UPDATE pallet SET location_code = #{newLocationCode}, updated_by = 'WMS_SYSTEM', updated_time = GETDATE() @@ -1802,7 +1802,7 @@ + SELECT position, layer, serial_no as serialNo - FROM pallet_detail WITH (NOLOCK) + FROM pallet_detail WHERE site = #{site} AND pallet_id = #{palletId} AND serial_no IN @@ -361,10 +362,11 @@ ORDER BY position, layer - + + @@ -383,7 +385,7 @@ out_wcs_flag AS outWcsFlag, issure_flag AS issureFlag, order_type AS orderType - FROM SOIssueNotifyOrderMaterialList_detail WITH (NOLOCK) + FROM SOIssueNotifyOrderMaterialList_detail WHERE site = #{site} AND notify_no = #{notifyNo} ORDER BY item_no, BOM_item_no, task_seq