|
|
|
@ -8,6 +8,7 @@ import com.gaotao.modules.api.service.InterfaceCallLogService; |
|
|
|
import com.gaotao.modules.api.service.WmsMessageService; |
|
|
|
import com.gaotao.modules.automatedWarehouse.entity.PalletDetailData; |
|
|
|
import com.gaotao.modules.automatedWarehouse.entity.WmsTransportTask; |
|
|
|
import com.gaotao.modules.automatedWarehouse.entity.WmsTransportTaskDetail; |
|
|
|
import com.gaotao.modules.automatedWarehouse.mapper.WcsIntegrationMapper; |
|
|
|
import com.gaotao.modules.warehouse.entity.Pallet; |
|
|
|
import com.gaotao.modules.warehouse.service.PalletService; |
|
|
|
@ -74,27 +75,44 @@ public class AgvMessageServiceImpl implements AgvMessageService { |
|
|
|
if (!StringUtils.hasText(palletId)) { |
|
|
|
throw new RuntimeException("运输任务中未找到栈板信息"); |
|
|
|
} |
|
|
|
|
|
|
|
// 5. 更新栈板calling_flag为N |
|
|
|
String username = "AGV_SYSTEM"; |
|
|
|
wcsIntegrationMapper.updatePalletCallingFlag(transportTask.getSite(), palletId, "N", username); |
|
|
|
log.info("栈板{}的calling_flag已更新为N", palletId); |
|
|
|
|
|
|
|
// 6. 更新运输任务状态为已完成 |
|
|
|
updateTransportTaskStatus(inData.getTaskId(), "已完成"); |
|
|
|
log.info("运输任务{}状态已更新为已完成", inData.getTaskId()); |
|
|
|
|
|
|
|
// 7. 检查栈板是否有明细,如果有则执行移库操作 |
|
|
|
List<PalletDetailData> palletDetails = getPalletDetailsByPalletId(transportTask.getSite(), palletId); |
|
|
|
if (palletDetails != null && !palletDetails.isEmpty()) { |
|
|
|
log.info("栈板{}存在明细,开始执行移库操作", palletId); |
|
|
|
executeWarehouseTransfer(transportTask); |
|
|
|
} else { |
|
|
|
log.info("栈板{}无明细,跳过移库操作,但需要更新栈板位置", palletId); |
|
|
|
// 即使没有明细,也要更新栈板位置到目标站点 |
|
|
|
updatePalletLocationOnly(transportTask, username); |
|
|
|
WmsTransportTask checkTask= wcsIntegrationMapper.getTransportTaskByTaskNo(inData.getTaskId()); |
|
|
|
if(checkTask==null){ |
|
|
|
throw new RuntimeException("运输任务不存在"); |
|
|
|
} |
|
|
|
|
|
|
|
String statusDesc=""; |
|
|
|
if(inData.getTargetPoint().equals(checkTask.getToLocation())){ |
|
|
|
// 5. 更新栈板calling_flag为N |
|
|
|
String username = "AGV_SYSTEM"; |
|
|
|
wcsIntegrationMapper.updatePalletCallingFlag(transportTask.getSite(), palletId, "N", username); |
|
|
|
log.info("栈板{}的calling_flag已更新为N", palletId); |
|
|
|
|
|
|
|
// 6. 更新运输任务状态为已完成 |
|
|
|
updateTransportTaskStatus(inData.getTaskId(), "已完成"); |
|
|
|
log.info("运输任务{}状态已更新为已完成", inData.getTaskId()); |
|
|
|
|
|
|
|
// 7. 检查栈板是否有明细,如果有则执行移库操作 |
|
|
|
List<PalletDetailData> palletDetails = getPalletDetailsByPalletId(transportTask.getSite(), palletId); |
|
|
|
if (palletDetails != null && !palletDetails.isEmpty()) { |
|
|
|
log.info("栈板{}存在明细,开始执行移库操作", palletId); |
|
|
|
executeWarehouseTransfer(transportTask); |
|
|
|
} else { |
|
|
|
log.info("栈板{}无明细,跳过移库操作,但需要更新栈板位置", palletId); |
|
|
|
// 即使没有明细,也要更新栈板位置到目标站点 |
|
|
|
updatePalletLocationOnly(transportTask, username); |
|
|
|
} |
|
|
|
statusDesc="取货完成"; |
|
|
|
}else { |
|
|
|
statusDesc="送货完成"; |
|
|
|
} |
|
|
|
WmsTransportTaskDetail detail = new WmsTransportTaskDetail(); |
|
|
|
detail.setSite("55"); |
|
|
|
detail.setTaskNo(inData.getTaskId()); |
|
|
|
detail.setItemNo(1); |
|
|
|
detail.setSeqNo(wcsIntegrationMapper.getMaxSeqNoForTaskDetail("55",inData.getTaskId())); |
|
|
|
detail.setActionType(statusDesc); |
|
|
|
detail.setStatus("成功"); |
|
|
|
wcsIntegrationMapper.insertWmsTransportTaskDetail(detail); |
|
|
|
|
|
|
|
// 8. 更新接口日志为成功 |
|
|
|
if (logId != null) { |
|
|
|
interfaceCallLogService.updateCallResult(logId, "处理成功", "SUCCESS", null, null); |
|
|
|
|