|
|
|
@ -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); |
|
|
|
|