From 6c3cc6842009f3897c3fb18bef8a6634fe653818 Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期三, 04 三月 2026 19:59:11 +0800
Subject: [PATCH] lsh#
---
rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java | 150 ++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 140 insertions(+), 10 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java
index 1861750..64c43bd 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java
@@ -11,6 +11,7 @@
import com.fasterxml.jackson.databind.cfg.CoercionInputShape;
import com.vincent.rsf.framework.common.Cools;
import com.vincent.rsf.framework.common.R;
+import com.vincent.rsf.framework.common.SpringUtils;
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.server.api.config.RemotesInfoProperties;
import com.vincent.rsf.server.api.entity.CommonResponse;
@@ -109,6 +110,8 @@
private SubsystemFlowTemplateServiceImpl subsystemFlowTemplateService;
@Autowired
private FlowStepTemplateServiceImpl flowStepTemplateService;
+ @Autowired
+ private WarehouseAreasService warehouseAreasService;
/**
@@ -131,7 +134,7 @@
taskInstanceNode.setStatus(flowInstance.getStatus());
TaskInstance taskInstance = taskInstanceService.getById(flowInstance.getTaskId());
if (Cools.isEmpty(taskInstance)) { continue;}
- Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getTaskCode, taskInstance.getTaskNo()));
+ Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getTaskCode, taskInstance.getTaskNo()).last("limit 1"),false);
if (Cools.isEmpty(task)) { continue;}
if (!task.getTaskStatus().equals(flowStepInstance.getWmsNowTaskStatus())) {
log.error("浠诲姟鍙凤細"+task.getTaskCode()+"鐨勪换鍔$姸鎬佷笌鎵ц妗f浠诲姟鐘舵�侊細"+flowStepInstance.getWmsNowTaskStatus()+"涓嶄竴鑷达紒锛侊紒");
@@ -153,7 +156,7 @@
.eq(FlowStepInstance::getStatus, (short)0)
.eq(FlowStepInstance::getTaskNo, flowStepInstance.getTaskNo())
.eq(FlowStepInstance::getStepOrder, flowStepInstance.getStepOrder() + 1)
- .eq(FlowStepInstance::getWmsNowTaskStatus, flowStepInstance.getWmsNextTaskStatus()));
+ .eq(FlowStepInstance::getWmsNowTaskStatus, flowStepInstance.getWmsNextTaskStatus()).last("limit 1"));
if (Cools.isEmpty(nextFlowStepInstance)) {
throw new CoolException("浠诲姟鍙�"+task.getTaskCode()+"浠诲姟姝ラ涓㈠け锛侊紒锛�");
}
@@ -176,9 +179,136 @@
MissionTaskIssueParam missionTaskIssueParam = new MissionTaskIssueParam(flowStepInstance,subsystemFlowTemplate,flowStepTemplate);
missionTaskIssueParam.setType(RcsTaskType.getTypeDesc(task.getTaskType()));
+ boolean souSign = taskInstance.getSourceCode().matches("\\d+");
+ if (souSign){
+ WarehouseAreas warehouseAreas = warehouseAreasService.getById(Long.parseLong(taskInstance.getSourceCode()));
+ if (Cools.isEmpty(warehouseAreas)){
+ BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, taskInstance.getSourceCode()).last("limit 1"));
+ if (Cools.isEmpty(basStation)){
+ basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
+ .apply("station_alias != '[]'") // 涓嶆槸绌烘暟缁�
+ .apply("JSON_CONTAINS(station_alias, '\"{0}\"') = 1", taskInstance.getSourceCode())
+ .eq(BasStation::getDeleted, 0) // 閫氬父闇�瑕佸姞涓婃湭鍒犻櫎鏉′欢
+ .last("LIMIT 1"));
+ }
+ if (Cools.isEmpty(basStation)){
+ flowStepInstance.setRetryTimes(flowStepInstance.getRetryTimes() + 1);
+ if (flowStepInstance.getRetryTimes()>5){
+ flowStepInstance.setStatus((short)4);
+ flowStepInstanceService.updateById(flowStepInstance);
+ log.error("浠诲姟涓嬪彂澶辫触,婧愮偣鏈煡璇㈠埌锛岄噸璇曟鏁板ぇ浜庣瓑浜庝簲娆★紝鏍囪涓哄け璐ワ紒锛侊紒");
+ } else {
+ flowStepInstanceService.updateById(flowStepInstance);
+ log.error("浠诲姟涓嬪彂澶辫触,婧愮偣鏈煡璇㈠埌鐩爣鐐规湭鏌ヨ鍒帮紝绛夊緟閲嶈瘯....");
+ }
+ return;
+ } else {
+ missionTaskIssueParam.setSourceCode(basStation.getStationName());
+ }
+ } else {
+ missionTaskIssueParam.setSourceCode(taskInstance.getSourceCode());
+ }
+ } else {
+ BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, taskInstance.getSourceCode()).last("limit 1"));
+ if (Cools.isEmpty(basStation)){
+ basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
+ .apply("station_alias != '[]'") // 涓嶆槸绌烘暟缁�
+ .apply("JSON_CONTAINS(station_alias, '\"{0}\"') = 1", taskInstance.getSourceCode())
+ .eq(BasStation::getDeleted, 0) // 閫氬父闇�瑕佸姞涓婃湭鍒犻櫎鏉′欢
+ .last("LIMIT 1")); }
+ if (Cools.isEmpty(basStation)){
+ flowStepInstance.setRetryTimes(flowStepInstance.getRetryTimes() + 1);
+ if (flowStepInstance.getRetryTimes()>5){
+ flowStepInstance.setStatus((short)4);
+ flowStepInstanceService.updateById(flowStepInstance);
+ log.error("浠诲姟涓嬪彂澶辫触,婧愮偣鏈煡璇㈠埌锛岄噸璇曟鏁板ぇ浜庣瓑浜庝簲娆★紝鏍囪涓哄け璐ワ紒锛侊紒");
+ } else {
+ flowStepInstanceService.updateById(flowStepInstance);
+ log.error("浠诲姟涓嬪彂澶辫触,婧愮偣鏈煡璇㈠埌鐩爣鐐规湭鏌ヨ鍒帮紝绛夊緟閲嶈瘯....");
+ }
+ return;
+ } else {
+ missionTaskIssueParam.setSourceCode(basStation.getStationName());
+ }
+ }
+ boolean endSign = taskInstance.getTargetCode().matches("\\d+");
+ if (endSign){
+ WarehouseAreas warehouseAreas = warehouseAreasService.getById(Long.parseLong(taskInstance.getTargetCode()));
+ if (Cools.isEmpty(warehouseAreas)){
+ BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, taskInstance.getTargetCode()).last("limit 1"));
+ if (Cools.isEmpty(basStation)){
+ basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
+ .apply("station_alias != '[]'") // 涓嶆槸绌烘暟缁�
+ .apply("JSON_CONTAINS(station_alias, '\"{0}\"') = 1", taskInstance.getTargetCode())
+ .eq(BasStation::getDeleted, 0) // 閫氬父闇�瑕佸姞涓婃湭鍒犻櫎鏉′欢
+ .last("LIMIT 1")); }
+ if (Cools.isEmpty(basStation)){
+ flowStepInstance.setRetryTimes(flowStepInstance.getRetryTimes() + 1);
+ if (flowStepInstance.getRetryTimes()>5){
+ flowStepInstance.setStatus((short)4);
+ flowStepInstanceService.updateById(flowStepInstance);
+ log.error("浠诲姟涓嬪彂澶辫触,鐩爣鐐规湭鏌ヨ鍒帮紝閲嶈瘯娆℃暟澶т簬绛変簬浜旀锛屾爣璁颁负澶辫触锛侊紒锛�");
+ } else {
+ flowStepInstanceService.updateById(flowStepInstance);
+ log.error("浠诲姟涓嬪彂澶辫触,鐩爣鐐规湭鏌ヨ鍒帮紝绛夊緟閲嶈瘯....");
+ }
+ return;
+ } else {
+ missionTaskIssueParam.setTargetCode(basStation.getStationName());
+ }
- missionTaskIssueParam.setSourceCode(taskInstance.getSourceCode());
- missionTaskIssueParam.setTargetCode(taskInstance.getTargetCode());
+ } else {
+ missionTaskIssueParam.setTargetCode(taskInstance.getTargetCode());
+ }
+ } else {
+ BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, taskInstance.getTargetCode()).last("limit 1"));
+ if (Cools.isEmpty(basStation)){
+ basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
+ .apply("station_alias != '[]'") // 涓嶆槸绌烘暟缁�
+ .apply("JSON_CONTAINS(station_alias, '\"{0}\"') = 1", taskInstance.getTargetCode())
+ .eq(BasStation::getDeleted, 0) // 閫氬父闇�瑕佸姞涓婃湭鍒犻櫎鏉′欢
+ .last("LIMIT 1")); }
+ if (Cools.isEmpty(basStation)){
+ flowStepInstance.setRetryTimes(flowStepInstance.getRetryTimes() + 1);
+ if (flowStepInstance.getRetryTimes()>5){
+ flowStepInstance.setStatus((short)4);
+ flowStepInstanceService.updateById(flowStepInstance);
+ log.error("浠诲姟涓嬪彂澶辫触,鐩爣鐐规湭鏌ヨ鍒帮紝閲嶈瘯娆℃暟澶т簬绛変簬浜旀锛屾爣璁颁负澶辫触锛侊紒锛�");
+ } else {
+ flowStepInstanceService.updateById(flowStepInstance);
+ log.error("浠诲姟涓嬪彂澶辫触,鐩爣鐐规湭鏌ヨ鍒帮紝绛夊緟閲嶈瘯....");
+ }
+ return;
+ } else {
+ missionTaskIssueParam.setTargetCode(basStation.getStationName());
+ }
+ }
+ missionTaskIssueParam.setTaskPri(task.getSort());
+ missionTaskIssueParam.setBarcode(task.getBarcode());
+ missionTaskIssueParam.setTaskNo(task.getTaskCode());
+ if (missionTaskIssueParam.getType().equals(RcsTaskType.RCS_TASK_TYPE_ENUM_IN.type) && endSign){
+ missionTaskIssueParam.setLocNo(task.getTargLoc());
+ missionTaskIssueParam.setSourcestaNo(missionTaskIssueParam.getSourcestaNo());
+ } else if (missionTaskIssueParam.getType().equals(RcsTaskType.RCS_TASK_TYPE_ENUM_OUT.type) && souSign){
+ missionTaskIssueParam.setSourcelocNo(task.getOrgLoc());
+ missionTaskIssueParam.setStaNo(missionTaskIssueParam.getTargetCode());
+ } else if (missionTaskIssueParam.getType().equals(RcsTaskType.RCS_TASK_TYPE_ENUM_TRANSFER.type) && souSign && endSign){
+ missionTaskIssueParam.setSourcelocNo(task.getOrgLoc());
+ missionTaskIssueParam.setLocNo(task.getTargLoc());
+ } else if (missionTaskIssueParam.getType().equals(RcsTaskType.RCS_TASK_TYPE_ENUM_TRANSFER.type) && souSign && !endSign){
+ missionTaskIssueParam.setType(RcsTaskType.RCS_TASK_TYPE_ENUM_TRANSFER.type);
+ missionTaskIssueParam.setSourcelocNo(task.getOrgLoc());
+ missionTaskIssueParam.setStaNo(missionTaskIssueParam.getTargetCode());
+ } else if (missionTaskIssueParam.getType().equals(RcsTaskType.RCS_TASK_TYPE_ENUM_TRANSFER.type) && !souSign && endSign){
+ missionTaskIssueParam.setType(RcsTaskType.RCS_TASK_TYPE_ENUM_IN.type);
+ missionTaskIssueParam.setSourcestaNo(missionTaskIssueParam.getSourcestaNo());
+ missionTaskIssueParam.setLocNo(task.getTargLoc());
+ } else if (missionTaskIssueParam.getType().equals(RcsTaskType.RCS_TASK_TYPE_ENUM_STA.type) || (!souSign && !endSign)){
+ missionTaskIssueParam.setType(RcsTaskType.RCS_TASK_TYPE_ENUM_STA.type);
+ missionTaskIssueParam.setSourcestaNo(missionTaskIssueParam.getSourcestaNo());
+ missionTaskIssueParam.setStaNo(missionTaskIssueParam.getTargetCode());
+ }
+
/**浠诲姟涓嬪彂鎺ュ彛*/
String pubTakUrl = wmsOpenApi.getHost() + ":" + wmsOpenApi.getPort() + RcsConstant.MISSION_TRANSFER_STATION;
@@ -215,7 +345,7 @@
.eq(FlowStepInstance::getStatus, (short)0)
.eq(FlowStepInstance::getTaskNo, flowStepInstance.getTaskNo())
.eq(FlowStepInstance::getStepOrder, flowStepInstance.getStepOrder() + 1)
- .eq(FlowStepInstance::getWmsNowTaskStatus, flowStepInstance.getWmsNextTaskStatus()));
+ .eq(FlowStepInstance::getWmsNowTaskStatus, flowStepInstance.getWmsNextTaskStatus()).last("limit 1"));
if (Cools.isEmpty(nextFlowStepInstance)) {
throw new CoolException("浠诲姟鍙�"+task.getTaskCode()+"浠诲姟姝ラ涓㈠け锛侊紒锛�");
}
@@ -630,7 +760,7 @@
BasStation station = null;
if (!task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) {
- station = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, task.getTargSite()));
+ station = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, task.getTargSite()).last("limit 1"));
if (Objects.isNull(station)) {
throw new CoolException("绔欑偣涓嶅瓨鍦紒锛�");
}
@@ -641,7 +771,7 @@
Loc locStart = null;
if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type) ||
task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_EMPTY_OUT.type)) {
- locStart = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getOrgLoc()));
+ locStart = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getOrgLoc()).last("limit 1"));
if (Objects.isNull(locStart)) {
throw new CoolException("婧愬簱浣嶄笉瀛樺湪锛侊紒");
}
@@ -660,7 +790,7 @@
task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type) ||
task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)
) {
- BasStation stationS = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, task.getOrgSite()));
+ BasStation stationS = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, task.getOrgSite()).last("limit 1"));
if (Objects.isNull(stationS)) {
throw new CoolException("婧愬簱浣嶄笉瀛樺湪锛侊紒");
}
@@ -668,7 +798,7 @@
if (stationS.getType().equals(StationTypeEnum.STATION_TYPE_MUTI.type)) {
taskParams.setSign(LocStsWcsOrOtherType.LOC_STS_TYPE_WCS.type);
} else {
- Loc locEnd = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getTargLoc()));
+ Loc locEnd = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getTargLoc()).last("limit 1"));
if (Objects.isNull(locEnd)) {
throw new CoolException("婧愬簱浣嶄笉瀛樺湪锛侊紒");
}
@@ -728,7 +858,7 @@
/**绔欑偣闂寸Щ搴撳弬鏁�*/
itemParam.setOriSta(task.getOrgSite()).setDestSta(task.getTargSite());
- BasStation curSta = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, task.getOrgSite()));
+ BasStation curSta = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, task.getOrgSite()).last("limit 1"));
if (Objects.isNull(curSta)) {
throw new CoolException("绔欑偣涓嶅瓨鍦紒锛�");
}
--
Gitblit v1.9.1