Browse Source

feat(warehouse): 添加围框自动分拣校验功能

- 新增getLowerLayerLabelInfo方法查询指定层标签物料信息
- 扩展getExpiredDateWithSerialNo查询返回receive_date和part_no字段
- 集成partAttributeMapper实现机器人分拣属性校验
- 添加物料自动分拣支持校验逻辑(is_robot_pick字段检查)
- 实现围框分拣同位置同物料同接收日期校验功能
- 增加下层标签信息获取和日期比较验证机制
master
常熟吴彦祖 2 months ago
parent
commit
7429d60833
  1. 12
      src/main/java/com/gaotao/modules/automatedWarehouse/mapper/WcsIntegrationMapper.java
  2. 62
      src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/WcsIntegrationServiceImpl.java
  3. 14
      src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml

12
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<PalletDetailData> getPalletDetailsData(@Param("site") String site, @Param("palletId") String palletId);
/**
* @Description 查询同位置指定层标签的物料信息用于围框自动分拣校验同物料同接收日期- rqrq
* @param site 工厂编码
* @param palletId 栈板编码
* @param position 位置编码
* @param layer 层数
* @return List<PalletDetailData> 该位置该层的所有标签信息
* @author rqrq
*/
List<PalletDetailData> getLowerLayerLabelInfo(@Param("site") String site, @Param("palletId") String palletId,
@Param("position") String position, @Param("layer") Integer layer);
/**
* @Description 获取栈板上被预留的标签列表 - rqrq

62
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<Map<String, Object>> existingDetails = wcsIntegrationMapper.getPalletDetails(site, palletId, position, layer);
if (!existingDetails.isEmpty()) {
throw new Exception("该位置第" + layer + "层已有物料,气胀轴分拣托盘每层只能放一个物料");
}
// if(wcsBasePalletType==2){
// //围框自动分拣,必须满足同一摞物料的接收日期要同一天 并且是同一个物料
// List<PalletDetailData> 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<PalletDetailData> 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);

14
src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml

@ -195,11 +195,23 @@
</select>
<select id="getExpiredDateWithSerialNo" resultType="HandlingUnit">
SELECT site, unit_id,expired_date from handling_unit
SELECT site, unit_id, expired_date, receive_date, part_no FROM handling_unit
WHERE site = #{site} AND unit_id = #{serialNo}
</select>
<!-- rqrq - 查询同位置指定层标签的物料信息(用于围框自动分拣校验同物料同接收日期)-->
<select id="getLowerLayerLabelInfo" resultType="PalletDetailData">
SELECT a.site, a.pallet_id as palletId, a.position, a.layer, a.serial_no as serialNo, a.part_no as partNo,
b.receive_date as receiveDate
FROM pallet_detail a
LEFT JOIN handling_unit b ON a.site = b.site AND a.serial_no = b.unit_id
WHERE a.site = #{site}
AND a.pallet_id = #{palletId}
AND a.position = #{position}
AND a.layer = #{layer}
</select>
<!-- 注意:不能用NOLOCK,结果用于校验后组盘操作,脏读可能导致数据不一致 - rqrq -->
<select id="getPalletDetailsData" resultType="PalletDetailData">
SELECT a.site, a.pallet_id as palletId, a.position, a.layer, a.serial_no as serialNo, a.part_no as partNo,

Loading…
Cancel
Save