diff --git a/src/main/java/com/gaotao/modules/automatedWarehouse/mapper/WcsIntegrationMapper.java b/src/main/java/com/gaotao/modules/automatedWarehouse/mapper/WcsIntegrationMapper.java index f10a3c0..9223d7f 100644 --- a/src/main/java/com/gaotao/modules/automatedWarehouse/mapper/WcsIntegrationMapper.java +++ b/src/main/java/com/gaotao/modules/automatedWarehouse/mapper/WcsIntegrationMapper.java @@ -89,4 +89,15 @@ public interface WcsIntegrationMapper { */ void deletePalletDetail(@Param("site") String site, @Param("palletId") String palletId, @Param("serialNo") String serialNo); + + /** + * 更新栈板调用状态 - AI制作 + */ + void updatePalletCallingFlag(@Param("site") String site, @Param("palletId") String palletId, + @Param("callingFlag") String callingFlag, @Param("updatedBy") String updatedBy); + + /** + * 检查栈板是否正在被调用 - AI制作 + */ + String checkPalletCallingFlag(@Param("site") String site, @Param("palletId") String palletId); } 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 4a582f8..260410e 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 @@ -45,12 +45,18 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService { Date currentTime = new Date(); - //查询下这些栈板有没有不是结束 取消 失败状态的运输单 + //查询下这些栈板有没有不是结束 取消 失败状态的运输单,以及是否正在被调用 for (int i = 0; i < data.size(); i++) { List checkPalletTask = wcsIntegrationMapper.checkPalletTask(data.get(i).getSite(),data.get(i).getPalletId()); if(checkPalletTask != null && !checkPalletTask.isEmpty()){ throw new RuntimeException(checkPalletTask.getFirst().getPalletId()+ "栈板已有未完成的运输任务,请选择其他栈板"); } + + // 再次检查栈板是否已经被调用(双重保险) + String callingFlag = wcsIntegrationMapper.checkPalletCallingFlag(data.get(i).getSite(), data.get(i).getPalletId()); + if ("Y".equals(callingFlag)) { + throw new RuntimeException(data.get(i).getPalletId() + "栈板正在被调用中,请选择其他栈板"); + } } // 生成任务编号 TransNoControl transData = transNoService.getTransNo(data.getFirst().getSite(), "WTT", 10); @@ -92,6 +98,11 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService { // 批量插入运输任务 wcsIntegrationMapper.batchSaveTransportTask(saveList); + // 更新栈板调用状态为Y + for (WmsLabelAndPalletData item : data) { + wcsIntegrationMapper.updatePalletCallingFlag(item.getSite(), item.getPalletId(), "Y", username); + } + // TODO: 这里可以调用WCS接口通知立库执行运输任务 wcsApiService.pushAgvTaskApi(saveList); } @@ -113,6 +124,12 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService { throw new Exception("栈板不存在"); } + // 检查栈板是否正在被调用 + String callingFlag = (String) palletInfo.get("calling_flag"); + if ("Y".equals(callingFlag)) { + throw new Exception("栈板正在被调用中,无法进行打托操作"); + } + // 获取栈板类型的位置信息 String palletType = (String) palletInfo.get("pallet_type"); List positions = wcsIntegrationMapper.getPalletTypePositions(site, palletType); @@ -169,6 +186,12 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService { throw new Exception("参数不能为空"); } + // 检查栈板是否正在被调用 + String callingFlag = wcsIntegrationMapper.checkPalletCallingFlag(site, palletId); + if ("Y".equals(callingFlag)) { + throw new Exception("栈板正在被调用中,无法进行打托操作"); + } + // 1. 验证标签 Map labelInfo = wcsIntegrationMapper.validateLabel(site, serialNo); if (labelInfo == null) { @@ -250,6 +273,12 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService { throw new Exception("参数不能为空"); } + // 检查栈板是否正在被调用 + String callingFlag = wcsIntegrationMapper.checkPalletCallingFlag(site, palletId); + if ("Y".equals(callingFlag)) { + throw new Exception("栈板正在被调用中,无法进行扫出操作"); + } + // 检查标签是否在本栈板中 Map existingPalletInfo = wcsIntegrationMapper.findPalletByLabel(site, serialNo); if (existingPalletInfo == null) { @@ -325,6 +354,12 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService { throw new Exception("参数不能为空"); } + // 检查栈板是否正在被调用 + String callingFlag = wcsIntegrationMapper.checkPalletCallingFlag(site, palletId); + if ("Y".equals(callingFlag)) { + throw new Exception("栈板正在被调用中,无法进行位置调整"); + } + // 验证标签是否在当前栈板中 Map currentDetail = wcsIntegrationMapper.findPalletByLabel(site, serialNo); if (currentDetail == null || !palletId.equals(currentDetail.get("palletId"))) { diff --git a/src/main/java/com/gaotao/modules/warehouse/entity/Pallet.java b/src/main/java/com/gaotao/modules/warehouse/entity/Pallet.java index 25fa102..fc55505 100644 --- a/src/main/java/com/gaotao/modules/warehouse/entity/Pallet.java +++ b/src/main/java/com/gaotao/modules/warehouse/entity/Pallet.java @@ -39,6 +39,9 @@ public class Pallet { private String updatedBy; // 最后修改人 private String warehouseId; + + private String callingFlag; // 调用标志:Y=正在被调用, N=未被调用 + @TableField(fill = FieldFill.INSERT_UPDATE) private Date updatedTime; // 最后修改时间 diff --git a/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml b/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml index 23f365b..87fdcb9 100644 --- a/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml +++ b/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml @@ -5,10 +5,14 @@ - SELECT pallet_id, pallet_type, status, location_code, site, warehouse_id + SELECT pallet_id, pallet_type, status, location_code, site, warehouse_id, calling_flag FROM pallet WHERE site = #{site} AND pallet_id = #{palletId} AND is_deleted = '0' @@ -77,17 +81,17 @@ @@ -100,11 +104,11 @@ @@ -163,4 +167,21 @@ AND serial_no = #{serialNo} + + + UPDATE pallet + SET calling_flag = #{callingFlag}, + updated_by = #{updatedBy}, + updated_time = GETDATE() + WHERE site = #{site} + AND pallet_id = #{palletId} + + + + + \ No newline at end of file