|
|
|
@ -403,4 +403,102 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService { |
|
|
|
String username = ((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUsername(); |
|
|
|
wcsIntegrationMapper.updatePalletDetailPosition(site, palletId, serialNo, newPosition, newLayer, username); |
|
|
|
} |
|
|
|
|
|
|
|
// ==================== 运输任务相关方法实现 - AI制作 ==================== |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<Map<String, Object>> getAgvStations(Map<String, Object> params) throws Exception { |
|
|
|
return wcsIntegrationMapper.getAgvStations(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<Map<String, Object>> getTargetStations(Map<String, Object> params) throws Exception { |
|
|
|
String startStation = (String) params.get("startStation"); |
|
|
|
if (!StringUtils.hasText(startStation)) { |
|
|
|
throw new Exception("起点站点不能为空"); |
|
|
|
} |
|
|
|
return wcsIntegrationMapper.getTargetStationsByStart(startStation); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public void createPalletTransportTask(Map<String, Object> params) throws Exception { |
|
|
|
String site = (String) params.get("site"); |
|
|
|
String palletId = (String) params.get("palletId"); |
|
|
|
String startStation = (String) params.get("startStation"); |
|
|
|
String endStation = (String) params.get("endStation"); |
|
|
|
|
|
|
|
if (!StringUtils.hasText(site) || !StringUtils.hasText(palletId) || |
|
|
|
!StringUtils.hasText(startStation) || !StringUtils.hasText(endStation)) { |
|
|
|
throw new Exception("参数不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
String username = ((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUsername(); |
|
|
|
Date currentTime = new Date(); |
|
|
|
|
|
|
|
// 检查栈板calling_flag状态 |
|
|
|
String callingFlag = wcsIntegrationMapper.checkPalletCallingFlag(site, palletId); |
|
|
|
if ("Y".equals(callingFlag)) { |
|
|
|
throw new Exception("栈板正在被调用中,无法创建运输任务"); |
|
|
|
} |
|
|
|
|
|
|
|
// 生成任务编号 |
|
|
|
TransNoControl transData = transNoService.getTransNo(site, "WTT", 10); |
|
|
|
|
|
|
|
// 创建运输任务 |
|
|
|
WmsTransportTask task = new WmsTransportTask(); |
|
|
|
task.setSite(site); |
|
|
|
task.setTaskNo(transData.getNewTransNo()); |
|
|
|
task.setItemNo(1); |
|
|
|
task.setSourceType("运输栈板"); |
|
|
|
task.setSourceBillNo(""); |
|
|
|
task.setSourceLineId(0L); |
|
|
|
task.setPartNo(""); // 栈板运输不需要物料信息 |
|
|
|
task.setQty(BigDecimal.ZERO); |
|
|
|
task.setBatchNo(""); |
|
|
|
task.setSerialNo(""); |
|
|
|
task.setFromLocation(startStation); |
|
|
|
task.setToLocation(endStation); |
|
|
|
task.setPalletId(palletId); |
|
|
|
task.setAgvCode(""); |
|
|
|
task.setPriority(0); |
|
|
|
task.setStatus("CREATED"); |
|
|
|
task.setWmsSendTime(currentTime); |
|
|
|
task.setCreatedBy(username); |
|
|
|
task.setCreatedTime(currentTime); |
|
|
|
task.setUpdatedTime(currentTime); |
|
|
|
task.setFinishQty(BigDecimal.ZERO); |
|
|
|
|
|
|
|
// 插入运输任务 |
|
|
|
wcsIntegrationMapper.insertTransportTask(task); |
|
|
|
|
|
|
|
// 更新栈板calling_flag为Y |
|
|
|
wcsIntegrationMapper.updatePalletCallingFlag(site, palletId, "Y", username); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public void callPalletToStation(Map<String, Object> params) throws Exception { |
|
|
|
String site = (String) params.get("site"); |
|
|
|
String palletId = (String) params.get("palletId"); |
|
|
|
String station = (String) params.get("station"); |
|
|
|
|
|
|
|
if (!StringUtils.hasText(site) || !StringUtils.hasText(palletId) || !StringUtils.hasText(station)) { |
|
|
|
throw new Exception("参数不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
// 检查栈板calling_flag状态 |
|
|
|
String callingFlag = wcsIntegrationMapper.checkPalletCallingFlag(site, palletId); |
|
|
|
if ("Y".equals(callingFlag)) { |
|
|
|
throw new Exception("栈板正在被调用中,无法执行Call操作"); |
|
|
|
} |
|
|
|
|
|
|
|
String username = ((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUsername(); |
|
|
|
|
|
|
|
// TODO: 后期在这里调用WCS接口实现Call栈板功能 |
|
|
|
// 示例:wcsApiService.callPalletToStation(site, palletId, station); |
|
|
|
|
|
|
|
// 更新栈板calling_flag为Y |
|
|
|
// wcsIntegrationMapper.updatePalletCallingFlag(site, palletId, "Y", username); |
|
|
|
} |
|
|
|
} |