From f21530d33ca23aeeba2ef073ac6b64422e4e26ca Mon Sep 17 00:00:00 2001
From: cl <1442464845@qq.com>
Date: 星期四, 30 四月 2026 12:17:55 +0800
Subject: [PATCH] 库位编号规则和和CTU保持一致
---
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java | 360 ++++++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 269 insertions(+), 91 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
index a7197d7..8b6c53f 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -4,7 +4,6 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.cfg.CoercionAction;
import com.fasterxml.jackson.databind.cfg.CoercionInputShape;
@@ -13,6 +12,7 @@
import com.vincent.rsf.server.api.config.RemotesInfoProperties;
import com.vincent.rsf.server.api.controller.erp.params.InOutResultReportParam;
import com.vincent.rsf.server.api.controller.erp.params.TaskInParam;
+import com.vincent.rsf.server.api.service.RcsBusTaskNoticeService;
import com.vincent.rsf.server.api.entity.CommonResponse;
import com.vincent.rsf.server.api.entity.constant.RcsConstant;
import com.vincent.rsf.server.api.entity.dto.InTaskMsgDto;
@@ -55,8 +55,13 @@
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.support.TransactionSynchronization;
+import org.springframework.transaction.support.TransactionSynchronizationManager;
+import org.springframework.web.client.HttpStatusCodeException;
import org.springframework.web.client.RestTemplate;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
@@ -131,6 +136,8 @@
private CloudWmsNotifyLogService cloudWmsNotifyLogService;
@Autowired
private WarehouseService warehouseService;
+ @Autowired
+ private RcsBusTaskNoticeService rcsBusTaskNoticeService;
@Override
@Transactional(rollbackFor = Exception.class)
@@ -172,7 +179,9 @@
throw new CoolException("浠诲姟淇濆瓨澶辫触锛侊紒");
}
if (!locService.update(new LambdaUpdateWrapper<Loc>().eq(Loc::getCode, task.getTargLoc())
- .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type).set(Loc::getBarcode, pakin.getBarcode()))) {
+ .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type)
+ .set(Loc::getBarcode, pakin.getBarcode())
+ .set(Loc::getWeight, task.getWeight()))) {
throw new CoolException("搴撲綅棰勭害澶辫触锛侊紒");
}
/**鑾峰彇缁勬嫋鏄庣粏**/
@@ -204,6 +213,7 @@
throw new CoolException("缁勬墭鏄庣粏淇墽琛屾暟閲忎慨鏀瑰け璐ワ紒锛�");
}
});
+ syncAsnOrderItemBarcodeByPakin(waitPakinItems, pakin.getBarcode(), loginUserId);
});
if (!waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>()
@@ -261,7 +271,8 @@
.set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type)
.set(Loc::getUpdateBy, loginUserId)
.set(Loc::getUpdateTime, new Date())
- .set(Loc::getBarcode, pakin.getBarcode()))) {
+ .set(Loc::getBarcode, pakin.getBarcode())
+ .set(Loc::getWeight, task.getWeight()))) {
throw new CoolException("搴撲綅棰勭害澶辫触锛侊紒");
}
/**鑾峰彇缁勬嫋鏄庣粏**/
@@ -293,6 +304,7 @@
throw new CoolException("缁勬墭鏄庣粏淇墽琛屾暟閲忎慨鏀瑰け璐ワ紒锛�");
}
});
+ syncAsnOrderItemBarcodeByPakin(waitPakinItems, pakin.getBarcode(), loginUserId);
});
if (!waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>()
@@ -403,7 +415,9 @@
if (!locService.update(new LambdaUpdateWrapper<Loc>().eq(Loc::getCode, task.getTargLoc())
- .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type).set(Loc::getBarcode, pakin.getBarcode()))) {
+ .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type)
+ .set(Loc::getBarcode, pakin.getBarcode())
+ .set(Loc::getWeight, task.getWeight()))) {
throw new CoolException("搴撲綅棰勭害澶辫触锛侊紒");
}
/**鑾峰彇缁勬嫋鏄庣粏**/
@@ -443,6 +457,7 @@
throw new CoolException("缁勬墭鏄庣粏淇墽琛屾暟閲忎慨鏀瑰け璐ワ紒锛�");
}
});
+ syncAsnOrderItemBarcodeByPakin(waitPakinItems, pakin.getBarcode(), loginUserId);
});
if (!waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>()
@@ -453,6 +468,27 @@
throw new CoolException("缁勬嫋鐘舵�佷慨鏀瑰け璐ワ紒锛�");
}
return R.ok("浠诲姟鐢熸垚瀹屾瘯锛�");
+ }
+
+ /** 缁勬墭鍚庡皢閫氱煡鍗曟槑缁嗘潯鐮佸洖鍐欎负鏂欑鐮� */
+ private void syncAsnOrderItemBarcodeByPakin(List<WaitPakinItem> waitPakinItems, String pakinBarcode, Long loginUserId) {
+ if (waitPakinItems == null || waitPakinItems.isEmpty() || StringUtils.isBlank(pakinBarcode)) {
+ return;
+ }
+ Set<Long> asnItemIds = waitPakinItems.stream()
+ .map(WaitPakinItem::getAsnItemId)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toSet());
+ if (asnItemIds.isEmpty()) {
+ return;
+ }
+ if (!asnOrderItemService.update(new LambdaUpdateWrapper<WkOrderItem>()
+ .in(WkOrderItem::getId, asnItemIds)
+ .set(WkOrderItem::getBarcode, pakinBarcode)
+ .set(WkOrderItem::getUpdateBy, loginUserId)
+ .set(WkOrderItem::getUpdateTime, new Date()))) {
+ throw new CoolException("閫氱煡鍗曟槑缁嗘潯鐮佸洖鍐欏け璐ワ紒锛�");
+ }
}
/**
@@ -509,7 +545,7 @@
}
/**
- * 鎵嬪姩瀹屾垚浠诲姟
+ * 鎵嬪姩瀹屾垚浠诲姟锛氬叆搴撶被缃� 98銆佸嚭搴撶被缃� 198锛屽簱浣�/鍗曟嵁鎵e噺涓庝笂鎶ョ敱瀵瑰簲瀹氭椂浠诲姟鎵ц
*
* @param id
* @param loginUserId
@@ -549,13 +585,22 @@
}
modiftyTaskSort(task, loginUserId);
-
- // 濡傛灉浠诲姟鐘舵�佸凡缁忔槸AWAIT (196)锛屽啀娆$偣鍑诲畬缁撴椂锛岀洿鎺ュ畬鎴�
- if (task.getTaskStatus().equals(TaskStsType.AWAIT.id)) {
- // AWAIT鐘舵�佺殑浠诲姟鍐嶆瀹岀粨锛岀洿鎺ヨ缃负鍑哄簱瀹屾垚
+
+ // 鍏ュ簱锛�->98锛屽嚭搴擄細-> 198锛岀敱 complateOutStock 瀹氭椂浠诲姟 鏇存柊搴撳瓨
+ if (task.getTaskType() < 100) {
+ task.setTaskStatus(TaskStsType.COMPLETE_IN.id);
+ if (StringUtils.isNotBlank(task.getOrgSite())) {
+ BasStation station = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
+ .eq(BasStation::getStationName, task.getOrgSite()));
+ if (Objects.nonNull(station) && station.getType().equals(StationTypeEnum.STATION_TYPE_NORMAL.type)) {
+ station.setUseStatus(LocStsType.LOC_STS_TYPE_O.type);
+ if (!basStationService.updateById(station)) {
+ throw new CoolException("鍏ュ簱绔欑偣鐘舵�佷慨鏀瑰け璐ワ紒锛�");
+ }
+ }
+ }
+ } else {
task.setTaskStatus(TaskStsType.COMPLETE_OUT.id);
-
- // 鏇存柊鍑哄簱绔欑偣鐘舵�侊紙涓嶳CS閫氱煡瀹岀粨淇濇寔涓�鑷达級
if (task.getTaskType() >= TaskType.TASK_TYPE_OUT.type && StringUtils.isNotBlank(task.getTargSite())) {
BasStation station = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
.eq(BasStation::getStationName, task.getTargSite()));
@@ -566,42 +611,61 @@
}
}
}
- } else {
- // 鍏朵粬鎯呭喌鎸夊師鏈夐�昏緫澶勭悊
- // 鍏ュ簱浠诲姟锛坱askType < 100锛夛細璁剧疆涓哄叆搴撳畬鎴�
- // 鍑哄簱浠诲姟锛坱askType >= 100锛夛細璁剧疆涓虹瓑寰呯‘璁�
- Integer newStatus = task.getTaskType() < 100 ? TaskStsType.COMPLETE_IN.id : TaskStsType.AWAIT.id;
- task.setTaskStatus(newStatus);
-
- // 濡傛灉鏄叆搴撲换鍔″畬鎴愶紝鏇存柊鍏ュ簱绔欑偣鐘舵�侊紙涓嶳CS閫氱煡瀹岀粨淇濇寔涓�鑷达級
- if (newStatus.equals(TaskStsType.COMPLETE_IN.id) && StringUtils.isNotBlank(task.getOrgSite())) {
- BasStation station = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
- .eq(BasStation::getStationName, task.getOrgSite()));
- if (Objects.nonNull(station) && station.getType().equals(StationTypeEnum.STATION_TYPE_NORMAL.type)) {
- station.setUseStatus(LocStsType.LOC_STS_TYPE_O.type);
- if (!basStationService.updateById(station)) {
- throw new CoolException("鍏ュ簱绔欑偣鐘舵�佷慨鏀瑰け璐ワ紒锛�");
- }
- }
- }
}
+ // 鍘燂細196 鏃跺啀鐐逛竴娆℃墠缃� 198锛涘嚭搴撻娆$偣鍑绘浘缃� 196(AWAIT)
+ // if (task.getTaskStatus().equals(TaskStsType.AWAIT.id)) { task.setTaskStatus(TaskStsType.COMPLETE_OUT.id); ... }
+ // else { Integer newStatus = task.getTaskType() < 100 ? COMPLETE_IN.id : AWAIT.id; ... }
if (!this.updateById(task)) {
throw new CoolException("瀹屾垚浠诲姟澶辫触");
}
+ // 绠$悊鍚庡彴銆屽畬鎴愪换鍔°�嶉�氱煡 RCS
+ if (StringUtils.isNotBlank(task.getTaskCode())) {
+ rcsBusTaskNoticeService.notifyTaskStatus(task.getTaskCode(), task.getTaskStatus());
+ }
+ final Long taskIdForFinish = task.getId();
+ if (TransactionSynchronizationManager.isSynchronizationActive()) {
+ TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
+ @Override
+ public void afterCommit() {
+ taskService.runStockFinishAfterManualComplete(taskIdForFinish);
+ }
+ });
+ }
return task;
}
+ @Override
+ public void runStockFinishAfterManualComplete(Long taskId) {
+ if (taskId == null) {
+ return;
+ }
+ try {
+ Task t = taskService.getById(taskId);
+ if (t == null) {
+ return;
+ }
+ if (Objects.equals(t.getTaskStatus(), TaskStsType.COMPLETE_IN.id)) {
+ taskService.complateInTask(Collections.singletonList(t));
+ } else if (Objects.equals(t.getTaskStatus(), TaskStsType.COMPLETE_OUT.id)) {
+ taskService.completeTask(Collections.singletonList(t));
+ }
+ } catch (Exception e) {
+ log.warn("鎵嬪姩瀹岀粨鍚庣珛鍗冲簱瀛樻敹灏惧け璐ワ紝灏嗙敱瀹氭椂浠诲姟閲嶈瘯锛宼askId={}锛歿}", taskId, e.getMessage());
+ }
+ }
+
/**
- * 鍏ㄧ増鍑哄簱瀹岀粨锛氭墸闄ゅ簱浣嶆暟閲忥紝灏嗗簱浣嶇姸鎬佽涓虹┖
+ * 鍏ㄦ澘鍑哄簱瀹岀粨锛氭墸闄ゅ簱浣嶆暟閲忥紝灏嗗簱浣嶇姸鎬佽涓虹┖
*
* @param id 浠诲姟ID
* @param loginUserId 鐧诲綍鐢ㄦ埛ID
+ * @param notifyRcsFromAdmin 绠$悊鍚庡彴鍏ㄦ澘鍑哄簱瀹岀粨鎺ュ彛涓� true 鏃堕�氱煡 RCS锛涘畾鏃�/PDA 绛変负 false
* @return 浠诲姟瀵硅薄
*/
@Override
@Transactional(rollbackFor = Exception.class)
- public Task completeFullOutStock(Long id, Long loginUserId) {
+ public Task completeFullOutStock(Long id, Long loginUserId, boolean notifyRcsFromAdmin) {
// 鏌ヨ浠诲姟
Task task = taskService.getOne(new LambdaQueryWrapper<Task>()
.eq(Task::getId, id));
@@ -610,9 +674,9 @@
throw new CoolException("浠诲姟涓嶅瓨鍦紒锛�");
}
- // 妫�鏌ヤ换鍔$被鍨嬫槸鍚︿负鍏ㄧ増鍑哄簱
+ // 妫�鏌ヤ换鍔$被鍨嬫槸鍚︿负鍏ㄦ澘鍑哄簱
if (!task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)) {
- throw new CoolException("褰撳墠浠诲姟涓嶆槸鍏ㄧ増鍑哄簱浠诲姟锛屾棤娉曟墽琛屾鎿嶄綔锛侊紒");
+ throw new CoolException("褰撳墠浠诲姟涓嶆槸鍏ㄦ澘鍑哄簱浠诲姟锛屾棤娉曟墽琛屾鎿嶄綔锛侊紒");
}
// 妫�鏌ヤ换鍔$姸鎬侊細蹇呴』鏄�199锛圵AVE_SEED锛夌姸鎬佹墠鑳芥墜鍔ㄥ畬缁�
@@ -641,6 +705,7 @@
// 灏嗗簱浣嶇姸鎬佽涓虹┖锛圤鐘舵�侊級
if (!locService.update(new LambdaUpdateWrapper<Loc>()
.set(Loc::getBarcode, null)
+ .set(Loc::getWeight, null)
.set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
.set(Loc::getUpdateBy, loginUserId)
.set(Loc::getUpdateTime, new Date())
@@ -667,6 +732,9 @@
if (!this.updateById(task)) {
throw new CoolException("浠诲姟鐘舵�佹洿鏂板け璐ワ紒锛�");
+ }
+ if (notifyRcsFromAdmin && StringUtils.isNotBlank(task.getTaskCode())) {
+ rcsBusTaskNoticeService.notifyTaskStatus(task.getTaskCode(), TaskStsType.UPDATED_OUT.id);
}
return task;
@@ -797,6 +865,7 @@
/**淇敼搴撲綅鐘舵�佷负F.鍦ㄥ簱*/
if (!locService.update(new LambdaUpdateWrapper<Loc>()
.set(Loc::getBarcode, task.getBarcode())
+ .set(Loc::getWeight, task.getWeight())
.set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type)
.set(Loc::getUpdateBy, loginUserId)
.set(Loc::getUpdateTime, new Date())
@@ -806,6 +875,7 @@
if (!locService.update(new LambdaUpdateWrapper<Loc>()
.set(Loc::getBarcode, null)
+ .set(Loc::getWeight, null)
.set(Loc::getUpdateBy, loginUserId)
.set(Loc::getUpdateTime, new Date())
.set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
@@ -868,6 +938,7 @@
// }
loc.setUseStatus(LocStsType.LOC_STS_TYPE_F.type)
.setBarcode(task.getBarcode())
+ .setWeight(task.getWeight())
.setUpdateBy(loginUserId).setUpdateTime(new Date());
if (!locService.updateById(loc)) {
@@ -940,14 +1011,24 @@
List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_IN.type, TaskType.TASK_TYPE_OUT.type, TaskType.TASK_TYPE_PICK_AGAIN_OUT.type,
TaskType.TASK_TYPE_CHECK_OUT.type, TaskType.TASK_TYPE_EMPITY_IN.type, TaskType.TASK_TYPE_LOC_MOVE.type,
TaskType.TASK_TYPE_EMPITY_OUT.type, TaskType.TASK_TYPE_MERGE_OUT.type);
- List<Task> allTasks = this.list(new LambdaQueryWrapper<Task>()
- .in(Task::getTaskType, list)
- .in(Task::getId, (Object[]) ids));
-
- if (allTasks.isEmpty()) {
+ List<Task> tasksById = this.list(new LambdaQueryWrapper<Task>().in(Task::getId, (Object[]) ids));
+ if (tasksById.isEmpty()) {
throw new CoolException("浠诲姟涓嶅瓨鍦紒锛�");
}
-
+ // 鎷f枡鍑哄簱/鐩樼偣鍑哄簱杩涘叆鍐嶅叆搴撻樁娈靛悗绂佹鍙栨秷锛堜换鍔$被鍨嬪凡鐢� 103/107 鍙樹负鍐嶅叆搴擄級
+ for (Task t : tasksById) {
+ if (TaskType.TASK_TYPE_PICK_IN.type.equals(t.getTaskType())
+ || TaskType.TASK_TYPE_CHECK_IN.type.equals(t.getTaskType())) {
+ throw new CoolException("鎷f枡/鐩樼偣鍑哄簱宸茶繘鍏ュ啀鍏ュ簱闃舵锛岀姝㈠彇娑堬紒锛�");
+ }
+ }
+ List<Task> allTasks = tasksById.stream()
+ .filter(t -> list.contains(t.getTaskType()))
+ .collect(Collectors.toList());
+ if (allTasks.isEmpty()) {
+ throw new CoolException("褰撳墠浠诲姟绫诲瀷涓嶆敮鎸佸彇娑堬紒锛�");
+ }
+
// 鏀堕泦闇�瑕佸彇娑堢殑RCS浠诲姟缂栧彿鍜屾壒娆$紪鍙凤紙涓嶉檺鍒剁姸鎬侊紝鍙宸蹭笅鍙戝埌RCS灏遍渶瑕佸彇娑堬級
List<String> rcsTaskCodes = new ArrayList<>();
String batchNo = null;
@@ -984,59 +1065,60 @@
}
}
- // 濡傛灉鏈変换鍔″凡涓嬪彂鍒癛CS锛屽厛璋冪敤RCS鍙栨秷鎺ュ彛
+ // 宸蹭笅鍙� RCS 鐨勫伐浣滄。锛氬繀椤诲厛璋� RCS 鍙栨秷鎺ュ彛鎴愬姛锛屽惁鍒欎笉鍏佽鍙栨秷宸ヤ綔妗�
boolean rcsCancelSuccess = false;
if (!rcsTaskCodes.isEmpty()) {
- // 妫�鏌� RCS API 閰嶇疆鏄惁鏈夋晥
if (rcsApi == null || StringUtils.isBlank(rcsApi.getHost()) || StringUtils.isBlank(rcsApi.getPort())) {
- log.error("========== RCS浠诲姟鍙栨秷澶辫触 ==========");
- log.error("RCS API 閰嶇疆鏃犳晥锛乭ost: {}, port: {}",
- rcsApi != null ? rcsApi.getHost() : "null",
- rcsApi != null ? rcsApi.getPort() : "null");
- // 鍗充娇閰嶇疆鏃犳晥锛屼篃缁х画鎵ц浠诲姟鍒犻櫎鎿嶄綔
- } else {
- try {
- log.info("========== 寮�濮嬪彇娑圧CS浠诲姟 ==========");
- log.info("闇�瑕佸彇娑堢殑RCS浠诲姟缂栧彿锛歿}", rcsTaskCodes);
- String rcsUrl = rcsApi.getHost() + ":" + rcsApi.getPort() + RcsConstant.cancelTask;
- log.info("RCS鍙栨秷浠诲姟璇锋眰鍦板潃锛歿}", rcsUrl);
-
- // 濡傛灉娌℃湁鎵规缂栧彿锛屼娇鐢ㄧ涓�涓换鍔$紪鍙蜂綔涓烘壒娆$紪鍙�
- if (StringUtils.isBlank(batchNo) && !rcsTaskCodes.isEmpty()) {
+ throw new CoolException("浠诲姟宸蹭笅鍙慠CS锛屼絾鏈厤缃甊CS鍦板潃锛屾棤娉曞彇娑堬紒锛�");
+ }
+ if (restTemplate == null) {
+ throw new CoolException("浠诲姟宸蹭笅鍙慠CS锛屼絾鏃犳硶璋冪敤RCS鍙栨秷鎺ュ彛锛屾棤娉曞彇娑堬紒锛�");
+ }
+ try {
+ log.info("========== 寮�濮嬪彇娑圧CS浠诲姟 ==========");
+ log.info("闇�瑕佸彇娑堢殑RCS浠诲姟缂栧彿锛歿}", rcsTaskCodes);
+ String rcsUrl = rcsApi.getHost() + ":" + rcsApi.getPort() + RcsConstant.cancelTask;
+ log.info("RCS鍙栨秷浠诲姟璇锋眰鍦板潃锛歿}", rcsUrl);
+
+ if (StringUtils.isBlank(batchNo)) {
batchNo = rcsTaskCodes.get(0);
}
-
+
Map<String, Object> cancelParams = new HashMap<>();
cancelParams.put("tasks", rcsTaskCodes);
if (StringUtils.isNotBlank(batchNo)) {
cancelParams.put("batchNo", batchNo);
}
-
+
log.info("RCS鍙栨秷浠诲姟璇锋眰鍙傛暟锛歿}", JSONObject.toJSONString(cancelParams));
-
+
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json");
headers.add("api-version", "v2.0");
HttpEntity<Map<String, Object>> httpEntity = new HttpEntity<>(cancelParams, headers);
-
+
long startTime = System.currentTimeMillis();
ResponseEntity<String> exchange = restTemplate.exchange(rcsUrl, HttpMethod.POST, httpEntity, String.class);
long endTime = System.currentTimeMillis();
-
+
log.info("RCS鍙栨秷浠诲姟鍝嶅簲鑰楁椂锛歿}ms", (endTime - startTime));
log.info("RCS鍙栨秷浠诲姟鍝嶅簲鐘舵�佺爜锛歿}", exchange.getStatusCode());
log.info("RCS鍙栨秷浠诲姟鍝嶅簲浣擄細{}", exchange.getBody());
-
+
+ if (!exchange.getStatusCode().is2xxSuccessful()) {
+ throw new CoolException("RCS鍙栨秷浠诲姟澶辫触锛欻TTP " + exchange.getStatusCode().value());
+ }
+
if (Objects.isNull(exchange.getBody())) {
log.error("RCS鍙栨秷浠诲姟澶辫触锛氬搷搴斾綋涓虹┖");
throw new CoolException("RCS鍙栨秷浠诲姟澶辫触锛氬搷搴斾綋涓虹┖");
}
-
+
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.coercionConfigDefaults()
.setCoercion(CoercionInputShape.EmptyString, CoercionAction.AsEmpty);
CommonResponse result = objectMapper.readValue(exchange.getBody(), CommonResponse.class);
-
+
if (result.getCode() == 200) {
log.info("========== RCS浠诲姟鍙栨秷鎴愬姛 ==========");
log.info("鎴愬姛鍙栨秷鐨凴CS浠诲姟缂栧彿锛歿}", rcsTaskCodes);
@@ -1045,22 +1127,28 @@
log.error("RCS鍙栨秷浠诲姟澶辫触锛歿}", result.getMsg());
throw new CoolException("RCS鍙栨秷浠诲姟澶辫触锛�" + result.getMsg());
}
- } catch (JsonProcessingException e) {
- log.error("RCS鍙栨秷浠诲姟鍝嶅簲瑙f瀽澶辫触锛歿}", e.getMessage(), e);
- throw new CoolException("RCS鍙栨秷浠诲姟鍝嶅簲瑙f瀽澶辫触锛�" + e.getMessage());
- } catch (Exception e) {
- log.error("RCS鍙栨秷浠诲姟寮傚父锛歿}", e.getMessage(), e);
- throw new CoolException("RCS鍙栨秷浠诲姟寮傚父锛�" + e.getMessage());
- }
+ } catch (CoolException e) {
+ throw e;
+ } catch (JsonProcessingException e) {
+ log.error("RCS鍙栨秷浠诲姟鍝嶅簲瑙f瀽澶辫触锛歿}", e.getMessage(), e);
+ throw new CoolException("RCS鍙栨秷浠诲姟鍝嶅簲瑙f瀽澶辫触锛�" + e.getMessage());
+ } catch (Exception e) {
+ log.error("RCS鍙栨秷浠诲姟寮傚父锛歿}", e.getMessage(), e);
+ throw new CoolException("RCS鍙栨秷浠诲姟寮傚父锛�" + e.getMessage());
}
}
- // 鏌ヨ绗﹀悎鍙栨秷鏉′欢鐨勪换鍔★紙鐘舵�佷负1銆�101銆�199锛�
- List<Integer> allowedStatuses = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id, TaskStsType.WAVE_SEED.id);
+ // 鍙彇娑堢姸鎬侊細鍘� 1/101锛堜笉鍚� 199锛夛紱鎷f枡/鐩樼偣鍑哄簱 RCS 鎵ц涓�(<198)锛涘啀鍏ュ簱(53/57)鍦ㄦ柟娉曞叆鍙e凡绂佹鍙栨秷
List<Task> tasks = this.list(new LambdaQueryWrapper<Task>()
.in(Task::getTaskType, list)
.in(Task::getId, (Object[]) ids)
- .in(Task::getTaskStatus, allowedStatuses));
+ .and(w -> w
+ .in(Task::getTaskStatus, Arrays.asList(
+ TaskStsType.GENERATE_IN.id,
+ TaskStsType.GENERATE_OUT.id))
+ .or(w2 -> w2
+ .in(Task::getTaskType, TaskType.TASK_TYPE_PICK_AGAIN_OUT.type, TaskType.TASK_TYPE_CHECK_OUT.type)
+ .lt(Task::getTaskStatus, TaskStsType.COMPLETE_OUT.id))));
// 濡傛灉绗﹀悎鍙栨秷鏉′欢鐨勪换鍔′负绌猴紝浣哛CS鍙栨秷鎴愬姛锛屽厑璁哥户缁紙鍙兘鏄换鍔$姸鎬佸凡鍙樻洿锛�
if (tasks.isEmpty() && !rcsCancelSuccess) {
@@ -1082,7 +1170,9 @@
}
if (!locService.update(new LambdaUpdateWrapper<Loc>()
.eq(Loc::getCode, task.getTargLoc())
- .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type))) {
+ .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
+ .set(Loc::getBarcode, null)
+ .set(Loc::getWeight, null))) {
throw new CoolException("绉诲簱鐩爣搴撲綅鐘舵�佷慨鏀瑰け璐ワ紒锛�");
}
@@ -1134,6 +1224,14 @@
.set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type))) {
throw new CoolException("婧愬簱浣嶇姸鎬佷慨鏀瑰け璐ワ紒锛�");
}
+ } else if (task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type)) {
+ // 绌烘澘鍑哄簱锛氬缓鍗曟椂 D鈫扲锛屽彇娑堟仮澶嶄负绌烘澘 D
+ if (!locService.update(new LambdaUpdateWrapper<Loc>()
+ .eq(Loc::getCode, task.getOrgLoc())
+ .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_R.type)
+ .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_D.type))) {
+ throw new CoolException("绌烘澘鍑哄簱婧愬簱浣嶆仮澶嶇┖鏉垮け璐ワ紒锛�");
+ }
}
if (!Objects.isNull(task.getWarehType()) && task.getWarehType().equals(WarehType.WAREHOUSE_TYPE_AGV.val)) {
@@ -1170,13 +1268,14 @@
}
loc.setUseStatus(LocStsType.LOC_STS_TYPE_F.type)
.setBarcode(task.getBarcode())
+ .setWeight(task.getWeight())
.setUpdateBy(loginUserId)
.setUpdateTime(new Date());
if (!locService.updateById(loc)) {
throw new CoolException("搴撲綅淇℃伅淇敼澶辫触锛侊紒");
}
//鍑哄簱
- if (item.getWkType().equals(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_STOCK_OUT.type))) {
+ if (Objects.equals(item.getWkType(), OrderWorkType.ORDER_WORK_TYPE_STOCK_OUT.type)) {
//搴撳瓨鍑哄簱
} else if (task.getResource().equals(TaskResouceType.TASK_RESOUCE_WAVE_TYPE.val)) {
WaveItem waveItem = waveItemService.getById(item.getSource());
@@ -1198,7 +1297,7 @@
throw new CoolException("娉㈡鏇存柊澶辫触锛侊紒");
}
- } else if (item.getWkType().equals(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_OTHER.type))) {
+ } else if (Objects.equals(item.getWkType(), OrderWorkType.ORDER_WORK_TYPE_OTHER.type)) {
//鍏跺畠鍑哄簱
} else {
@@ -1244,7 +1343,9 @@
Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getTaskType() < TaskStsType.UPDATED_IN.id ? task.getTargLoc() : task.getOrgLoc()));
if (null != loc && (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type)
|| loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type))) {
- loc.setUseStatus(LocStsType.LOC_STS_TYPE_O.type);
+ loc.setUseStatus(LocStsType.LOC_STS_TYPE_O.type)
+ .setBarcode(null)
+ .setWeight(null);
if (!locService.updateById(loc)) {
throw new CoolException("鏇存柊搴撲綅鐘舵�佸け璐ワ紒锛�");
}
@@ -1483,7 +1584,8 @@
throw new CoolException("涓存椂搴撳瓨鏇存柊澶辫触锛侊紒");
}
}
- loc1.setUseStatus(LocStsType.LOC_STS_TYPE_S.type);
+ loc1.setUseStatus(LocStsType.LOC_STS_TYPE_S.type)
+ .setWeight(task.getWeight());
locService.updateById(loc1);
// if (!locService.updateById(loc1)) {
// throw new CoolException("搴撲綅棰勭害鍏ュ簱澶辫触锛侊紒");
@@ -1608,11 +1710,13 @@
if (!workings.isEmpty()) {
locItemWorkingService.saveBatch(workings);
}
- loc.setUseStatus(LocStsType.LOC_STS_TYPE_S.type);
+ loc.setUseStatus(LocStsType.LOC_STS_TYPE_S.type)
+ .setWeight(first.getWeight());
locService.updateById(loc);
} else {
loc.setUseStatus(LocStsType.LOC_STS_TYPE_O.type);
loc.setBarcode(null);
+ loc.setWeight(null);
loc.setUpdateBy(loginUserId);
loc.setUpdateTime(new Date());
locService.updateById(loc);
@@ -1651,6 +1755,7 @@
.eq(Loc::getId, loc.getId())
.set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
.set(Loc::getBarcode, null)
+ .set(Loc::getWeight, null)
.set(Loc::getUpdateBy, loginUserId)
.set(Loc::getUpdateTime, new Date()))) {
throw new CoolException("绌烘澘鍑哄簱搴撲綅鐘舵�佹洿鏂板け璐ワ紒锛�");
@@ -1717,7 +1822,7 @@
try {
// 鏍规嵁浠诲姟绫诲瀷鏇存柊搴撲綅鏄庣粏
if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)) {
- // 鍏ㄧ増鍑哄簱锛氫笉鍒犻櫎搴撲綅鏄庣粏锛岀瓑寰匬DA蹇�熸嫞璐х‘璁ゆ椂鍐嶅垹闄�
+ // 鍏ㄦ澘鍑哄簱锛氫笉鍒犻櫎搴撲綅鏄庣粏锛岀瓑寰匬DA蹇�熸嫞璐х‘璁ゆ椂鍐嶅垹闄�
// subtractLocItem(loc); // 宸茬Щ闄わ紝鏀逛负鍦╟ompleteFullOutStock涓垹闄�
} else if (!TaskType.TASK_TYPE_PICK_AGAIN_OUT.type.equals(task.getTaskType())) {
// 閮ㄥ垎鍑哄簱锛堝鐩樼偣鍑哄簱锛夛細鏍规嵁TaskItem鏁伴噺鎵e噺搴撲綅鏄庣粏锛涙嫞鏂欏嚭搴撳湪鐢熸垚鎷f枡鍏ュ簱鍗曟椂鎵e噺
@@ -1730,12 +1835,12 @@
}
//娣诲姞鍑哄叆搴撹褰曚俊鎭�
- Map<Short, List<TaskItem>> listMap = taskItems.stream().collect(Collectors.groupingBy(TaskItem::getWkType));
+ Map<String, List<TaskItem>> listMap = taskItems.stream().collect(Collectors.groupingBy(TaskItem::getWkType));
/***鑾峰彇搴撳瓨鍑哄簱鍊硷紝濡傛灉涓虹┖琛ㄧず姝e父鍗曟嵁鍑哄簱锛岄潪绌鸿〃鏄庢槸搴撳瓨鍑哄簱
* 1. 搴撳瓨鍑哄簱娌℃湁鍗曟嵁淇℃伅锛屽崟鎹俊鎭粯璁や负绌�
* 2. 鍗曟嵁搴撳瓨闇�閫氳繃娉㈡鏌ヨ鍘熷鍗曟嵁淇℃伅锛屽皢鍗曟嵁淇℃伅濉叆stock涓�
* */
- List<TaskItem> list = listMap.get(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_STOCK_OUT.type));
+ List<TaskItem> list = listMap.get(OrderWorkType.ORDER_WORK_TYPE_STOCK_OUT.type);
if (Objects.isNull(list) || list.isEmpty()) {
Map<Long, List<TaskItem>> maps = taskItems.stream().collect(Collectors.groupingBy(TaskItem::getSource));
maps.keySet().forEach(key -> {
@@ -1786,13 +1891,14 @@
// 鎷f枡鍑哄簱/鐩樼偣鍑哄簱锛氬湪鏈敓鎴愭嫞鏂欏叆搴撳崟涔嬪墠淇濇寔 R.棰勭害鍑哄簱锛屽惁鍒欎笅鍙戜换鍔℃椂鏌ヤ笉鍒拌搴撲綅锛堝彧鏌� F+R锛夊鑷粹�滃簱瀛樹笉瓒斥��
// 绛� PDA 纭骞剁敓鎴愭嫞鏂欏叆搴撲换鍔℃椂锛屽啀鍦� pickOrCheckTask 涓皢鐩爣搴撲綅鏀逛负 S.棰勭害鍏ュ簱
} else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)) {
- // 鍏ㄧ増鍑哄簱锛氫笉鏇存柊搴撲綅鐘舵�佷负O锛岀瓑寰匬DA蹇�熸嫞璐х‘璁ゆ椂鍐嶆洿鏂�
+ // 鍏ㄦ澘鍑哄簱锛氫笉鏇存柊搴撲綅鐘舵�佷负O锛岀瓑寰匬DA蹇�熸嫞璐х‘璁ゆ椂鍐嶆洿鏂�
// 搴撲綅鐘舵�佷繚鎸佸師鏍凤紙R.鍑哄簱棰勭害鐘舵�侊級
} else {
/**淇敼涓哄簱浣嶇姸鎬佷负O.绌哄簱*/
if (!locService.update(new LambdaUpdateWrapper<Loc>()
.set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
.set(Loc::getBarcode, null)
+ .set(Loc::getWeight, null)
.set(Loc::getUpdateBy, loginUserId)
.set(Loc::getUpdateTime, new Date())
.eq(Loc::getId, loc.getId()))) {
@@ -1906,13 +2012,13 @@
if (!asnOrderService.updateById(wkOrder)) {
throw new CoolException("鍑哄簱鍗曟洿鏂板け璐ワ紒锛�");
}
- stock.setWkType(Short.parseShort(wkOrder.getWkType()))
+ stock.setWkType(wkOrder.getWkType())
.setType(OrderType.ORDER_OUT.type);
} else if (!Objects.isNull(diffItem)) {
- stock.setWkType(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_STOCK_CHECK.type))
+ stock.setWkType(OrderWorkType.ORDER_WORK_TYPE_STOCK_CHECK.type)
.setType(OrderType.ORDER_CHECK.type);
} else {
- stock.setWkType(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_STOCK_OUT.type))
+ stock.setWkType(OrderWorkType.ORDER_WORK_TYPE_STOCK_OUT.type)
.setMemo("搴撳瓨鍑哄簱锛屾棤鍗曟嵁淇℃伅锛侊紒")
.setType(OrderType.ORDER_OUT.type);
}
@@ -2038,6 +2144,15 @@
log.error("========== RCS浠诲姟涓嬪彂澶辫触 ==========");
log.error("绔欑偣涓嶅瓨鍦紒锛佷换鍔$紪鐮侊細{}锛岀洰鏍囩珯鐐癸細{}", task.getTaskCode(), task.getTargSite());
continue;
+ }
+ // 鍑哄簱涓嬪彂鍓嶆牎楠岀珯鐐圭姸鎬佷笌鍑哄簱鑳藉姏
+ if (task.getTaskType() >= TaskType.TASK_TYPE_OUT.type) {
+ if (!Integer.valueOf(1).equals(station.getStatus()) || !Integer.valueOf(1).equals(station.getOutAble())) {
+ log.error("========== RCS浠诲姟涓嬪彂澶辫触 ==========");
+ log.error("绔欑偣涓嶅彲鍑哄簱涓嬪彂锛侊紒浠诲姟缂栫爜锛歿}锛岀洰鏍囩珯鐐癸細{}锛岀珯鐐圭姸鎬�(status)锛歿}锛岃兘鍑�(outAble)锛歿}",
+ task.getTaskCode(), task.getTargSite(), station.getStatus(), station.getOutAble());
+ continue;
+ }
}
}
@@ -2211,6 +2326,13 @@
log.error("RCS璧勬簮璁块棶寮傚父锛屼换鍔′笅鍙戝け璐ワ紒浠诲姟缂栫爜锛歿}锛岄敊璇俊鎭細{}", task.getTaskCode(), errorMsg);
}
continue;
+ } catch (HttpStatusCodeException e) {
+ long endTime = System.currentTimeMillis();
+ log.error("========== RCS浠诲姟涓嬪彂寮傚父 ==========");
+ log.error("璇锋眰RCS-HTTP鐘舵�佸紓甯革紝鑰楁椂锛歿}ms锛屼换鍔$紪鐮侊細{}锛宻tatus锛歿}锛宐ody锛歿}", (endTime - startTime), task.getTaskCode(), e.getRawStatusCode(), e.getResponseBodyAsString(), e);
+ log.error("璇锋眰RCS-鍦板潃锛歿}", pubTakUrl);
+ log.error("璇锋眰RCS-鍙傛暟锛歿}", JSONObject.toJSONString(taskParams));
+ continue;
} catch (Exception e) {
long endTime = System.currentTimeMillis();
log.error("========== RCS浠诲姟涓嬪彂寮傚父 ==========");
@@ -2336,7 +2458,7 @@
/**
* @author Ryan
* @date 2025/5/20
- * @description: 鎵e噺搴撳瓨鏄庣粏锛堝叏鐗堝嚭搴擄細鍒犻櫎鎵�鏈夊簱浣嶆槑缁嗭級
+ * @description: 鎵e噺搴撳瓨鏄庣粏锛堝叏鏉垮嚭搴擄細鍒犻櫎鎵�鏈夊簱浣嶆槑缁嗭級
* @version 1.0
*/
@Transactional(rollbackFor = Exception.class)
@@ -2430,6 +2552,7 @@
if (TaskType.TASK_TYPE_EMPITY_IN.type.equals(task.getTaskType())) {
if (!locService.update(new LambdaUpdateWrapper<Loc>().eq(Loc::getCode, task.getTargLoc())
.set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_D.type)
+ .set(Loc::getWeight, task.getWeight())
.set(Loc::getUpdateBy, loginUserId)
.set(Loc::getUpdateTime, new Date()))) {
throw new CoolException("绌烘澘鍏ュ簱搴撲綅鐘舵�佷慨鏀瑰け璐ワ紒锛�");
@@ -2498,6 +2621,10 @@
WkOrder o = asnOrderService.getById(e.getKey());
if (o != null) {
Double newQty = QuantityUtils.roundToScale(QuantityUtils.add(o.getQty() != null ? o.getQty() : 0.0, e.getValue()));
+ Double planQty = QuantityUtils.roundToScale(o.getAnfme() != null ? o.getAnfme() : 0.0);
+ if (QuantityUtils.compare(newQty, planQty) > 0) {
+ newQty = planQty;
+ }
o.setQty(newQty);
if (!asnOrderService.updateById(o)) {
throw new CoolException("鍏ュ簱鍗曞畬鎴愭暟閲忔洿鏂板け璐ワ紒锛�");
@@ -2508,6 +2635,10 @@
WkOrderItem oi = asnOrderItemService.getById(e.getKey());
if (oi != null) {
Double newQty = QuantityUtils.roundToScale(QuantityUtils.add(oi.getQty() != null ? oi.getQty() : 0.0, e.getValue()));
+ Double planQty = QuantityUtils.roundToScale(oi.getAnfme() != null ? oi.getAnfme() : 0.0);
+ if (QuantityUtils.compare(newQty, planQty) > 0) {
+ newQty = planQty;
+ }
oi.setQty(newQty);
if (!asnOrderItemService.updateById(oi)) {
throw new CoolException("鍏ュ簱鍗曟槑缁嗗畬鎴愭暟閲忔洿鏂板け璐ワ紒锛�");
@@ -2516,7 +2647,10 @@
}
/**淇敼搴撲綅鐘舵�佷负F.鍦ㄥ簱*/
- if (!locService.update(new LambdaUpdateWrapper<Loc>().set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type).eq(Loc::getCode, task.getTargLoc()))) {
+ if (!locService.update(new LambdaUpdateWrapper<Loc>()
+ .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type)
+ .set(Loc::getWeight, task.getWeight())
+ .eq(Loc::getCode, task.getTargLoc()))) {
throw new CoolException("搴撲綅鐘舵�佷慨鏀瑰け璐ワ紒锛�");
}
if (!this.update(new LambdaUpdateWrapper<Task>().eq(Task::getId, task.getId()).set(Task::getTaskStatus, TaskStsType.UPDATED_IN.id))) {
@@ -2637,7 +2771,7 @@
* @return
*/
@Transactional(rollbackFor = Exception.class)
- public synchronized void saveStockItems(List<TaskItem> items, Task task, Long id, String code, Short wkType, String type, Long loginUserId) {
+ public synchronized void saveStockItems(List<TaskItem> items, Task task, Long id, String code, String wkType, String type, Long loginUserId) {
Stock stock = new Stock();
String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_STOCK_CODE, null);
if (StringUtils.isBlank(ruleCode)) {
@@ -2661,12 +2795,27 @@
} else {
stock.setLocCode(task.getOrgLoc());
}
+ BigDecimal trayWeight = task.getWeight();
+ BigDecimal groupWeight = null;
+ if (trayWeight != null && sum > 0) {
+ List<TaskItem> allLines = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId()));
+ double totalQty = allLines.stream().mapToDouble(t -> t.getAnfme() != null ? t.getAnfme() : 0.0).sum();
+ if (totalQty > 0) {
+ groupWeight = trayWeight.multiply(BigDecimal.valueOf(sum)).divide(BigDecimal.valueOf(totalQty), 4, RoundingMode.HALF_UP);
+ } else {
+ groupWeight = trayWeight;
+ }
+ stock.setWeight(groupWeight);
+ }
if (!stockService.save(stock)) {
throw new CoolException("搴撳瓨淇濆瓨澶辫触锛侊紒");
}
List<StockItem> stockItems = new ArrayList<>();
- for (TaskItem item : items) {
+ BigDecimal allocatedWeight = BigDecimal.ZERO;
+ BigDecimal sumBd = sum > 0 ? BigDecimal.valueOf(sum) : null;
+ for (int i = 0; i < items.size(); i++) {
+ TaskItem item = items.get(i);
/**閫氳繃浠诲姟鏄庣粏涓殑taskId鏌ヨ,鑾峰彇TASK鐨勭洰鏍囧簱浣嶄俊鎭�*/
StockItem stockItem = new StockItem();
BeanUtils.copyProperties(item, stockItem);
@@ -2677,6 +2826,16 @@
.setUpdateBy(loginUserId)
.setId(null)
.setStockId(stock.getId());
+ if (groupWeight != null && sumBd != null) {
+ if (i == items.size() - 1) {
+ stockItem.setWeight(groupWeight.subtract(allocatedWeight));
+ } else {
+ double lineQty = item.getAnfme() != null ? item.getAnfme() : 0.0;
+ BigDecimal lineW = groupWeight.multiply(BigDecimal.valueOf(lineQty)).divide(sumBd, 4, RoundingMode.HALF_UP);
+ stockItem.setWeight(lineW);
+ allocatedWeight = allocatedWeight.add(lineW);
+ }
+ }
stockItems.add(stockItem);
}
if (!stockItemService.saveBatch(stockItems)) {
@@ -2721,9 +2880,18 @@
}
}
}
+ // 鍏�/鍑哄簱鍧囦粎浜戜粨鏉ユ簮鍗曟嵁鍙備笌涓婃姤锛堟槑缁嗛渶甯� platOrderCode 鎴� platWorkCode锛�
+ boolean hasCloudSource = taskItems.stream().anyMatch(this::hasCloudOrderRef);
+ if (!hasCloudSource) {
+ log.info("鍏�/鍑哄簱缁撴灉涓婃姤寰呭姙璺宠繃锛氭棤浜戜粨鏉ユ簮鍗曟嵁锛宼askId={}", task.getId());
+ return;
+ }
ObjectMapper om = new ObjectMapper();
Date now = new Date();
for (TaskItem item : taskItems) {
+ if (!hasCloudOrderRef(item)) {
+ continue;
+ }
String orderNo = isInbound ? sourceToOrderNo.get(item.getSource()) : (item.getPlatOrderCode() != null ? item.getPlatOrderCode() : item.getPlatWorkCode());
if (orderNo == null && isInbound) {
orderNo = item.getPlatOrderCode() != null ? item.getPlatOrderCode() : item.getPlatWorkCode();
@@ -2739,7 +2907,9 @@
.setLocId(locId)
.setMatNr(item.getMatnrCode())
.setQty(item.getAnfme() != null ? String.valueOf(item.getAnfme()) : "0")
- .setBatch(item.getBatch());
+ .setBatch(item.getBatch())
+ .setInbound(isInbound)
+ .setBarcode(task.getBarcode());
try {
String requestBody = om.writeValueAsString(param);
CloudWmsNotifyLog notifyLog = new CloudWmsNotifyLog()
@@ -2760,4 +2930,12 @@
log.warn("鍏�/鍑哄簱缁撴灉涓婃姤寰呭姙澶辫触锛宼askId={}锛宨sInbound={}锛歿}", task.getId(), isInbound, e.getMessage());
}
}
+
+ private boolean hasCloudOrderRef(TaskItem item) {
+ if (item == null) {
+ return false;
+ }
+ return StringUtils.isNotBlank(item.getPlatOrderCode())
+ || StringUtils.isNotBlank(item.getPlatWorkCode());
+ }
}
--
Gitblit v1.9.1