|
|
|
@ -1523,7 +1523,7 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService { |
|
|
|
// ==================== 栈板换站相关方法实现 - rqrq ==================== |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Object> checkPalletForChangeStation(Map<String, Object> params) { |
|
|
|
public CheckPalletResult checkPalletForChangeStation(Map<String, Object> params) { |
|
|
|
System.out.println("开始检查栈板换站条件 - rqrq"); |
|
|
|
|
|
|
|
String site = (String) params.get("site"); |
|
|
|
@ -1538,13 +1538,13 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService { |
|
|
|
} |
|
|
|
|
|
|
|
// 查询栈板信息 - rqrq |
|
|
|
Map<String, Object> palletInfo = wcsIntegrationMapper.checkPalletForChangeStation(site, palletId); |
|
|
|
CheckPalletResult palletInfo = wcsIntegrationMapper.checkPalletForChangeStation(site, palletId); |
|
|
|
|
|
|
|
if (palletInfo == null || palletInfo.isEmpty()) { |
|
|
|
if (palletInfo == null) { |
|
|
|
throw new RuntimeException("栈板不存在:" + palletId); |
|
|
|
} |
|
|
|
|
|
|
|
System.out.println("检查栈板换站条件完成 - rqrq,callingFlag=" + palletInfo.get("callingFlag")); |
|
|
|
System.out.println("检查栈板换站条件完成 - rqrq,callingFlag=" + palletInfo.getCallingFlag()); |
|
|
|
return palletInfo; |
|
|
|
} |
|
|
|
|
|
|
|
@ -1578,7 +1578,7 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService { |
|
|
|
// ==================== 手工移动托盘相关方法实现 - rqrq ==================== |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Object> checkPalletForManualMove(Map<String, Object> params) { |
|
|
|
public CheckPalletResult checkPalletForManualMove(Map<String, Object> params) { |
|
|
|
System.out.println("开始检查托盘是否可以手工移动 - rqrq"); |
|
|
|
|
|
|
|
String site = (String) params.get("site"); |
|
|
|
@ -1593,7 +1593,7 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService { |
|
|
|
} |
|
|
|
|
|
|
|
// 查询托盘信息 - rqrq |
|
|
|
Map<String, Object> palletInfo = wcsIntegrationMapper.checkPalletForManualMove(site, palletId); |
|
|
|
CheckPalletResult palletInfo = wcsIntegrationMapper.checkPalletForManualMove(site, palletId); |
|
|
|
if (palletInfo == null) { |
|
|
|
throw new RuntimeException("托盘不存在"); |
|
|
|
} |
|
|
|
@ -1623,20 +1623,18 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService { |
|
|
|
} |
|
|
|
|
|
|
|
// 检查托盘是否存在 - rqrq |
|
|
|
Map<String, Object> palletInfo = wcsIntegrationMapper.checkPalletForManualMove(site, palletId); |
|
|
|
CheckPalletResult palletInfo = wcsIntegrationMapper.checkPalletForManualMove(site, palletId); |
|
|
|
if (palletInfo == null) { |
|
|
|
throw new RuntimeException("托盘不存在"); |
|
|
|
} |
|
|
|
|
|
|
|
// 检查托盘是否被调用 - rqrq |
|
|
|
String callingFlag = (String) palletInfo.get("callingFlag"); |
|
|
|
if ("Y".equals(callingFlag)) { |
|
|
|
if ("Y".equals(palletInfo.getCallingFlag())) { |
|
|
|
throw new RuntimeException("托盘正在被调用中,无法移出站点"); |
|
|
|
} |
|
|
|
|
|
|
|
// 检查是否可操作(必须是正式站点)- rqrq |
|
|
|
String canOperate = (String) palletInfo.get("canOperate"); |
|
|
|
if (!"Y".equals(canOperate)) { |
|
|
|
if (!"Y".equals(palletInfo.getCanOperate())) { |
|
|
|
throw new RuntimeException("当前站点位置不可变更"); |
|
|
|
} |
|
|
|
|
|
|
|
@ -1670,21 +1668,19 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService { |
|
|
|
} |
|
|
|
|
|
|
|
// 检查托盘是否存在 - rqrq |
|
|
|
Map<String, Object> palletInfo = wcsIntegrationMapper.checkPalletForManualMove(site, palletId); |
|
|
|
CheckPalletResult palletInfo = wcsIntegrationMapper.checkPalletForManualMove(site, palletId); |
|
|
|
if (palletInfo == null) { |
|
|
|
throw new RuntimeException("托盘不存在"); |
|
|
|
} |
|
|
|
|
|
|
|
// 检查托盘是否被调用 - rqrq |
|
|
|
String callingFlag = (String) palletInfo.get("callingFlag"); |
|
|
|
if ("Y".equals(callingFlag)) { |
|
|
|
if ("Y".equals(palletInfo.getCallingFlag())) { |
|
|
|
throw new RuntimeException("托盘正在被调用中,无法绑定站点"); |
|
|
|
} |
|
|
|
|
|
|
|
// 检查托盘当前是否已有站点 - rqrq |
|
|
|
String currentStationCode = (String) palletInfo.get("currentStationCode"); |
|
|
|
if (StringUtils.hasText(currentStationCode)) { |
|
|
|
throw new RuntimeException("托盘已绑定站点【" + currentStationCode + "】,请先移出站点"); |
|
|
|
if (StringUtils.hasText(palletInfo.getCurrentStationCode())) { |
|
|
|
throw new RuntimeException("托盘已绑定站点【" + palletInfo.getCurrentStationCode() + "】,请先移出站点"); |
|
|
|
} |
|
|
|
|
|
|
|
// 检查站点是否存在且可用 - rqrq |
|
|
|
@ -1719,4 +1715,188 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService { |
|
|
|
System.out.println("绑定托盘到站点完成 - rqrq"); |
|
|
|
} |
|
|
|
|
|
|
|
// ==================== 空托盘组盘相关方法实现 - rqrq ==================== |
|
|
|
|
|
|
|
@Override |
|
|
|
public CheckPalletResult checkEmptyPallet(Map<String, Object> params) { |
|
|
|
System.out.println("开始检查空托盘 - rqrq"); |
|
|
|
|
|
|
|
String site = (String) params.get("site"); |
|
|
|
String palletId = (String) params.get("palletId"); |
|
|
|
|
|
|
|
// 参数校验 - rqrq |
|
|
|
if (!StringUtils.hasText(site)) { |
|
|
|
throw new RuntimeException("站点不能为空"); |
|
|
|
} |
|
|
|
if (!StringUtils.hasText(palletId)) { |
|
|
|
throw new RuntimeException("托盘编码不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
// 查询托盘信息 - rqrq |
|
|
|
CheckPalletResult palletInfo = wcsIntegrationMapper.checkEmptyPallet(site, palletId); |
|
|
|
if (palletInfo == null) { |
|
|
|
throw new RuntimeException("托盘不存在"); |
|
|
|
} |
|
|
|
|
|
|
|
// 判断是否为空托盘 - rqrq |
|
|
|
if (!"Y".equals(palletInfo.getIsEmpty())) { |
|
|
|
throw new RuntimeException("该托盘不是空托盘,无法进行空托盘组盘操作"); |
|
|
|
} |
|
|
|
|
|
|
|
System.out.println("检查空托盘完成 - rqrq,托盘信息:" + palletInfo); |
|
|
|
return palletInfo; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<PalletType> getPalletTypes(Map<String, Object> params) { |
|
|
|
System.out.println("开始获取托盘类型列表 - rqrq"); |
|
|
|
|
|
|
|
String site = (String) params.get("site"); |
|
|
|
String palletFamily = (String) params.get("palletFamily"); |
|
|
|
|
|
|
|
// 参数校验 - rqrq |
|
|
|
if (!StringUtils.hasText(site)) { |
|
|
|
throw new RuntimeException("站点不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
// 查询托盘类型列表(根据pallet_family过滤)- rqrq |
|
|
|
List<PalletType> list = wcsIntegrationMapper.getPalletTypes(site, palletFamily); |
|
|
|
|
|
|
|
System.out.println("获取托盘类型列表完成,共" + list.size() + "条记录 - rqrq,palletFamily=" + palletFamily); |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void notifyEmptyPalletInbound(Map<String, Object> params) { |
|
|
|
System.out.println("开始空托盘通知入库 - rqrq"); |
|
|
|
|
|
|
|
SysUserEntity currentUser = (SysUserEntity) SecurityUtils.getSubject().getPrincipal(); |
|
|
|
|
|
|
|
String site = (String) params.get("site"); |
|
|
|
String palletId = (String) params.get("palletId"); |
|
|
|
String transportFlag = (String) params.get("transportFlag"); |
|
|
|
|
|
|
|
// 参数校验 - rqrq |
|
|
|
if (!StringUtils.hasText(site)) { |
|
|
|
throw new RuntimeException("工厂编码不能为空"); |
|
|
|
} |
|
|
|
if (!StringUtils.hasText(palletId)) { |
|
|
|
throw new RuntimeException("栈板编码不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
// 校验栈板是否存在 - rqrq |
|
|
|
Map<String, Object> palletInfo = wcsIntegrationMapper.getPalletInfo(site, palletId); |
|
|
|
if (palletInfo == null) { |
|
|
|
throw new RuntimeException("栈板不存在"); |
|
|
|
} |
|
|
|
|
|
|
|
// 生成入库任务编号 - rqrq |
|
|
|
TransNoControl transData = transNoService.getTransNo(site, "WOT", 10); |
|
|
|
Date currentTime = new Date(); |
|
|
|
|
|
|
|
// 创建入库任务记录 - rqrq |
|
|
|
WmsOrderTask orderTask = new WmsOrderTask(); |
|
|
|
orderTask.setSite(site); |
|
|
|
orderTask.setTaskNo(transData.getNewTransNo()); |
|
|
|
orderTask.setItemNo(1); |
|
|
|
orderTask.setSourceType("空托盘入库"); // 设置为空托盘入库 - rqrq |
|
|
|
orderTask.setSourceBillNo(""); |
|
|
|
orderTask.setSourceLineId(0L); |
|
|
|
orderTask.setPartNo(""); |
|
|
|
orderTask.setQty(BigDecimal.ZERO); |
|
|
|
orderTask.setBatchNo(""); |
|
|
|
orderTask.setSerialNo(""); |
|
|
|
orderTask.setFromLocation("无"); |
|
|
|
orderTask.setToLocation("无"); |
|
|
|
orderTask.setPalletId(palletId); |
|
|
|
orderTask.setAgvCode(""); |
|
|
|
orderTask.setPriority(1); |
|
|
|
orderTask.setStatus("已创建"); |
|
|
|
orderTask.setWmsSendTime(currentTime); |
|
|
|
orderTask.setCreatedBy(currentUser.getUsername()); |
|
|
|
orderTask.setCreatedTime(currentTime); |
|
|
|
orderTask.setUpdatedTime(currentTime); |
|
|
|
orderTask.setFinishQty(BigDecimal.ZERO); |
|
|
|
|
|
|
|
// 保存任务记录 - rqrq |
|
|
|
wcsIntegrationMapper.insertOrderTask(orderTask); |
|
|
|
|
|
|
|
System.out.println("空托盘入库任务已创建 - rqrq,taskNo=" + orderTask.getTaskNo()); |
|
|
|
|
|
|
|
// 调用空托盘推送方法(只推送托盘数据,cargoInfos为null)- rqrq |
|
|
|
pushEmptyPalletDetail(site, palletId, orderTask.getTaskNo(), orderTask.getItemNo()); |
|
|
|
|
|
|
|
// 如果是入库并运输,在这里新增逻辑(暂时留空)- rqrq |
|
|
|
if ("Y".equals(transportFlag)) { |
|
|
|
System.out.println("入库并运输标志为Y,后续将在此处新增运输逻辑 - rqrq"); |
|
|
|
// TODO: 新增运输相关逻辑 - rqrq |
|
|
|
} |
|
|
|
|
|
|
|
System.out.println("空托盘通知入库完成 - rqrq"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 推送空托盘数据到WCS(只传托盘数据,cargoInfos为null)- rqrq |
|
|
|
* @param site 工厂编码 |
|
|
|
* @param palletId 托盘编码 |
|
|
|
* @param taskNo 任务编号 |
|
|
|
* @param itemNo 项次 |
|
|
|
* @author rqrq |
|
|
|
* @date 2025/10/16 |
|
|
|
*/ |
|
|
|
private void pushEmptyPalletDetail(String site, String palletId, String taskNo, Integer itemNo) { |
|
|
|
System.out.println("开始推送空托盘数据到WCS - rqrq,palletId=" + palletId + ", taskNo=" + taskNo); |
|
|
|
|
|
|
|
// 获取栈板信息(包含pallet_type表关联数据)- rqrq |
|
|
|
com.gaotao.modules.warehouse.entity.PalletData palletInfo = wcsIntegrationMapper.getPalletInfoWithTypeDetails(site, palletId); |
|
|
|
String locationCode = palletInfo.getLocationCode(); |
|
|
|
|
|
|
|
// 从pallet表关联pallet_type获取WCS相关字段 - rqrq |
|
|
|
Integer wcsPalletType = palletInfo.getWcsPalletType() != null ? palletInfo.getWcsPalletType() : 1; |
|
|
|
Integer wcsBasePalletType = palletInfo.getWcsBasePalletType() != null ? palletInfo.getWcsBasePalletType() : 1; |
|
|
|
Integer soreType = palletInfo.getWcsSoreType(); |
|
|
|
if (palletInfo.getSoreType() != null) { |
|
|
|
soreType = palletInfo.getSoreType(); |
|
|
|
} |
|
|
|
String autoSort = palletInfo.getAutoSort(); |
|
|
|
boolean isAutoSort = "Y".equals(autoSort); |
|
|
|
|
|
|
|
// 更新栈板calling_flag为Y - rqrq |
|
|
|
String username = ((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUsername(); |
|
|
|
wcsIntegrationMapper.updatePalletCallingFlag(site, palletId, "Y", username); |
|
|
|
|
|
|
|
// 构建推送数据 - rqrq |
|
|
|
PushPalletDetailDto inData = new PushPalletDetailDto(); |
|
|
|
|
|
|
|
// 设置物料类型 - rqrq |
|
|
|
if ("A01".equals(palletInfo.getPalletFamily())) { |
|
|
|
inData.setPartType(PartTypeEnum.fromCode(2)); |
|
|
|
} else if ("A02".equals(palletInfo.getPalletFamily())) { |
|
|
|
inData.setPartType(PartTypeEnum.fromCode(1)); |
|
|
|
} else if ("A03".equals(palletInfo.getPalletFamily())) { |
|
|
|
inData.setPartType(PartTypeEnum.fromCode(0)); |
|
|
|
} else { |
|
|
|
inData.setPartType(PartTypeEnum.fromCode(3)); |
|
|
|
} |
|
|
|
|
|
|
|
inData.setSite(site); |
|
|
|
inData.setTaskNo(taskNo); |
|
|
|
inData.setItemNo(itemNo); |
|
|
|
inData.setPalletBarcode(palletId); |
|
|
|
inData.setPalletType(wcsPalletType); |
|
|
|
inData.setBasePalletType(wcsBasePalletType); |
|
|
|
inData.setCommonUsed(false); // 空托盘没有常用料标记 - rqrq |
|
|
|
inData.setAutoSort(isAutoSort); |
|
|
|
inData.setSoreType(soreType); |
|
|
|
inData.setAssemblyPosition(locationCode); |
|
|
|
inData.setEndFlag(true); // 空托盘直接结束组盘 - rqrq |
|
|
|
inData.setCargoInfos(null); // 空托盘没有货物信息,传null - rqrq |
|
|
|
|
|
|
|
// 调用WCS推送接口(不修改此方法)- rqrq |
|
|
|
wcsApiService.pushZuPanApi(inData); |
|
|
|
|
|
|
|
System.out.println("推送空托盘数据到WCS完成 - rqrq"); |
|
|
|
} |
|
|
|
|
|
|
|
} |