From 7429d6083344024d1f3f6c3b28a48064665412de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B8=B8=E7=86=9F=E5=90=B4=E5=BD=A6=E7=A5=96?= Date: Wed, 14 Jan 2026 13:06:43 +0800 Subject: [PATCH] =?UTF-8?q?feat(warehouse):=20=E6=B7=BB=E5=8A=A0=E5=9B=B4?= =?UTF-8?q?=E6=A1=86=E8=87=AA=E5=8A=A8=E5=88=86=E6=8B=A3=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增getLowerLayerLabelInfo方法查询指定层标签物料信息 - 扩展getExpiredDateWithSerialNo查询返回receive_date和part_no字段 - 集成partAttributeMapper实现机器人分拣属性校验 - 添加物料自动分拣支持校验逻辑(is_robot_pick字段检查) - 实现围框分拣同位置同物料同接收日期校验功能 - 增加下层标签信息获取和日期比较验证机制 --- .../mapper/WcsIntegrationMapper.java | 12 ++++ .../impl/WcsIntegrationServiceImpl.java | 62 +++++++++++++++---- .../WcsIntegrationMapper.xml | 14 ++++- 3 files changed, 74 insertions(+), 14 deletions(-) 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 d75017b..0f6193f 100644 --- a/src/main/java/com/gaotao/modules/automatedWarehouse/mapper/WcsIntegrationMapper.java +++ b/src/main/java/com/gaotao/modules/automatedWarehouse/mapper/WcsIntegrationMapper.java @@ -54,6 +54,18 @@ public interface WcsIntegrationMapper { HandlingUnit getExpiredDateWithSerialNo(@Param("site") String site, @Param("serialNo") String serialNo); List getPalletDetailsData(@Param("site") String site, @Param("palletId") String palletId); + + /** + * @Description 查询同位置指定层标签的物料信息(用于围框自动分拣校验同物料同接收日期)- rqrq + * @param site 工厂编码 + * @param palletId 栈板编码 + * @param position 位置编码 + * @param layer 层数 + * @return List 该位置该层的所有标签信息 + * @author rqrq + */ + List getLowerLayerLabelInfo(@Param("site") String site, @Param("palletId") String palletId, + @Param("position") String position, @Param("layer") Integer layer); /** * @Description 获取栈板上被预留的标签列表 - 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 ed0ff92..ec2fa5e 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 @@ -73,6 +73,9 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService { @Autowired private com.gaotao.modules.api.service.InterfaceCallLogService interfaceCallLogService; // rqrq - 接口调用日志服务 + + @Autowired + private com.gaotao.modules.factory.dao.PartAttributeMapper partAttributeMapper; // rqrq - 料件属性Mapper,用于校验is_robot_pick @org.springframework.beans.factory.annotation.Value("${custom.wcs-url}") private String wcsUrl; @@ -680,32 +683,65 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService { } } // 4. 根据maxLayer和wcsSoreType进行不同的校验 - rqrq + String partNo = (String) labelInfo.get("partNo"); + + // 4.1 如果wcsSoreType是1或2,需要校验物料是否支持自动分拣 - rqrq + if (wcsSoreType == 1 || wcsSoreType == 2) { + // 查询part_attribute表的is_robot_pick字段 - rqrq + com.gaotao.modules.factory.entity.PartAttribute partAttribute = partAttributeMapper.getPartAttributeByKey(site, partNo); + // 如果查询到记录且is_robot_pick为N,则报错 - rqrq + if (partAttribute != null && "N".equals(partAttribute.getIsRobotPick())) { + throw new Exception("该物料[" + partNo + "]不能自动分拣,无法放入自动分拣托盘"); + } + // 如果查不到记录,跳过校验(允许放入)- rqrq + } + if(wcsSoreType == 1) { // wcsSoreType = 1:气胀轴自动分拣(9宫格、4宫格),每个位置每层只能放一个东西 List> existingDetails = wcsIntegrationMapper.getPalletDetails(site, palletId, position, layer); if (!existingDetails.isEmpty()) { throw new Exception("该位置第" + layer + "层已有物料,气胀轴分拣托盘每层只能放一个物料"); } - // if(wcsBasePalletType==2){ - // //围框自动分拣,必须满足同一摞物料的接收日期要同一天 并且是同一个物料 - // List existingDetailsOther = wcsIntegrationMapper.getPalletDetailsPosition(site, palletId, position); - // if (!existingDetailsOther.isEmpty()) { - // PalletDetailData getFirst = existingDetailsOther.getFirst(); - // HandlingUnit handlingUnit = wcsIntegrationMapper.getExpiredDateWithSerialNo(site,serialNo); - // if(!getFirst.getPartNo().equals(partNo)){ - // throw new Exception("该位置第" + layer + "层已有物料,请勿重复扫描"); - // } - // } - // } + if(wcsBasePalletType==2){ + // 围框自动分拣校验:如果不是第1层,需要校验与下层物料相同且接收日期相同 - rqrq + if (layer > 1) { + // 获取当前标签的接收日期 - rqrq + HandlingUnit currentLabel = wcsIntegrationMapper.getExpiredDateWithSerialNo(site, serialNo); + Date currentReceiveDate = currentLabel != null ? currentLabel.getReceiveDate() : null; + + // 获取下层(layer-1)标签信息 - rqrq + List lowerLayerLabels = wcsIntegrationMapper.getLowerLayerLabelInfo(site, palletId, position, layer - 1); + if (!lowerLayerLabels.isEmpty()) { + PalletDetailData lowerLabel = lowerLayerLabels.get(0); + String lowerPartNo = lowerLabel.getPartNo(); + Date lowerReceiveDate = lowerLabel.getReceiveDate(); + + // 校验物料编号是否相同 - rqrq + if (!partNo.equals(lowerPartNo)) { + throw new Exception("该标签与下层不是同一个物料,围框自动分拣要求同位置必须是同一物料"); + } + + // 校验接收日期是否相同(只比较日期部分)- rqrq + if (currentReceiveDate != null && lowerReceiveDate != null) { + // 使用SimpleDateFormat只比较日期部分 - rqrq + java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd"); + String currentDateStr = sdf.format(currentReceiveDate); + String lowerDateStr = sdf.format(lowerReceiveDate); + if (!currentDateStr.equals(lowerDateStr)) { + throw new Exception("该标签与下层不是同一个接收日期,围框自动分拣要求同位置必须是同一接收日期"); + } + } + } + } + } } else if (wcsSoreType == 2) { // wcsSoreType = 2:抱箱自动分拣(底4箱+上3箱等),每层可以放多个东西 } else { // wcsSoreType = 0或其他:允许放多个 } - // 5. 保存栈板明细 + // 5. 保存栈板明细(partNo已在第4步获取)- rqrq String username = ((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUsername(); - String partNo = (String) labelInfo.get("partNo"); wcsIntegrationMapper.savePalletDetail(site, palletId, position, layer, serialNo, partNo, username); handlingUnitOperationLogService.logHandlingUnitOperation(site,serialNo,"扫入","组盘扫标签","所在栈板",oldPalletId,palletId,username,null); diff --git a/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml b/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml index 36c92b7..724c08f 100644 --- a/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml +++ b/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml @@ -195,11 +195,23 @@ + + +