From 225f9914090016cbe0836a06fbb852da05333504 Mon Sep 17 00:00:00 2001
From: cl <1442464845@qq.com>
Date: 星期六, 09 五月 2026 22:51:16 +0800
Subject: [PATCH] 日志优化
---
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocItemServiceImpl.java | 277 +++++++++++++++++++++++++++++++++++++------------------
1 files changed, 185 insertions(+), 92 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocItemServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocItemServiceImpl.java
index cb3c483..34d50cb 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocItemServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocItemServiceImpl.java
@@ -8,6 +8,7 @@
import com.vincent.rsf.server.api.service.WcsService;
import com.vincent.rsf.server.api.utils.LocUtils;
import com.vincent.rsf.server.common.constant.Constants;
+import com.vincent.rsf.server.common.utils.QuantityUtils;
import com.vincent.rsf.server.manager.controller.params.CheckLocQueryParams;
import com.vincent.rsf.server.manager.controller.params.LocToTaskParams;
import com.vincent.rsf.server.manager.entity.*;
@@ -15,7 +16,9 @@
import com.vincent.rsf.server.manager.mapper.LocItemMapper;
import com.vincent.rsf.server.manager.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.vincent.rsf.server.system.constant.GlobalConfigCode;
import com.vincent.rsf.server.system.constant.SerialRuleCode;
+import com.vincent.rsf.server.system.service.ConfigService;
import com.vincent.rsf.server.system.utils.SerialRuleUtils;
import lombok.Synchronized;
import org.apache.commons.lang3.StringUtils;
@@ -35,6 +38,14 @@
public class LocItemServiceImpl extends ServiceImpl<LocItemMapper, LocItem> implements LocItemService {
private static final BigDecimal FULL_OUT_QTY_TOLERANCE = new BigDecimal("0.000001");
+
+ /** 鍙笌 {@link TaskStsType#GENERATE_OUT}锝瀧@link TaskStsType#WAVE_SEED} 琛旀帴杩藉姞鏄庣粏鐨勫嚭搴撲换鍔$被鍨� */
+ private static final List<Integer> OUTBOUND_TASK_TYPES_FOR_APPEND = Arrays.asList(
+ TaskType.TASK_TYPE_OUT.type,
+ TaskType.TASK_TYPE_PICK_AGAIN_OUT.type,
+ TaskType.TASK_TYPE_MERGE_OUT.type,
+ TaskType.TASK_TYPE_CHECK_OUT.type
+ );
Logger logger = LoggerFactory.getLogger(LocItemServiceImpl.class);
@@ -58,7 +69,10 @@
private BasStationService basStationService;
@Autowired
private MatnrService matnrService;
-
+ @Autowired
+ private AsnOrderItemService asnOrderItemService;
+ @Autowired
+ private ConfigService configService;
/** 鍏ュ簱/鍑哄簱淇濆瓨鍓嶏細鑻ヨ鏍兼垨鍨嬪彿涓虹┖鍒欎粠鐗╂枡甯﹀嚭 */
private void fillSpecModelFromMatnr(LocItem item) {
if (item == null || item.getMatnrId() == null) {
@@ -169,45 +183,73 @@
order = new WkOrder();
}
+ final boolean appendSameLocEnabled = isOutAppendSameLocTaskEnabled();
+
listMap.keySet().forEach(key -> {
- Task task = new Task();
Loc loc = locService.getById(key);
logger.info("搴撲綅锛�>{}", loc.getCode());
if (Objects.isNull(loc)) {
throw new CoolException("鏁版嵁閿欒锛氭墍閫夊簱瀛樹俊鎭笉瀛樺湪锛侊紒");
}
- // 鏀寔 F.鍦ㄥ簱 鎴� R.鍑哄簱棰勭害/鎷h揣涓� 鐘舵�佷笅鍒嗛厤锛堟嫞璐т腑鍙拷鍔犲悓搴撲綅璁㈠崟锛屽垎閰嶉噺涓嶈秴杩囧凡鍒嗛厤鍓╀綑锛�
- if (!loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)
- && !loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type)) {
- throw new CoolException("搴撲綅:" + loc.getCode() + ",涓嶅浜嶧.鍦ㄥ簱鎴朢.鍑哄簱棰勭害鐘舵�侊紝涓嶅彲鎵ц鍑哄簱鍒嗛厤锛侊紒");
+ if (appendSameLocEnabled) {
+ if (LocStsType.LOC_STS_TYPE_S.type.equals(loc.getUseStatus())) {
+ throw new CoolException("搴撲綅:" + loc.getCode() + " 澶勪簬S.鍏ュ簱棰勭害锛岄』寰呮嫞鏂�/鐩樼偣鍏ュ簱鍥炲簱鑷矲.鍦ㄥ簱鍚庡啀涓嬪彂鍑哄簱浠诲姟锛侊紒");
+ }
+ if (!LocStsType.LOC_STS_TYPE_F.type.equals(loc.getUseStatus())
+ && !LocStsType.LOC_STS_TYPE_R.type.equals(loc.getUseStatus())) {
+ throw new CoolException("搴撲綅:" + loc.getCode() + ",涓嶅浜嶧.鍦ㄥ簱鎴朢.鍑哄簱棰勭害鐘舵�侊紝涓嶅彲鎵ц鍑哄簱鍒嗛厤锛侊紒");
+ }
+ } else {
+ if (!LocStsType.LOC_STS_TYPE_F.type.equals(loc.getUseStatus())) {
+ throw new CoolException("搴撲綅:" + loc.getCode() + " 涓嶅浜嶧.鍦ㄥ簱鐘舵�侊紝涓嶅彲鎵ц鍑哄簱鍒嗛厤锛侊紒");
+ }
}
- if (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)) {
+
+ final boolean startedAsReserved = LocStsType.LOC_STS_TYPE_R.type.equals(loc.getUseStatus());
+ if (LocStsType.LOC_STS_TYPE_F.type.equals(loc.getUseStatus())) {
loc.setUseStatus(LocStsType.LOC_STS_TYPE_R.type);
if (!locService.updateById(loc)) {
throw new CoolException("搴撲綅鐘舵�佹洿鏂板け璐ワ紒锛�");
}
}
- // 搴撲綅宸蹭负 R 鏃讹細璁$畻璇ュ簱浣嶅綋鍓嶄换鍔″凡鍒嗛厤閲忥紝鏂板垎閰嶄笉鑳借秴杩� (搴撲綅鏁伴噺 - 宸插垎閰�)
- Map<String, Double> allocatedByKey = new HashMap<>();
- List<Task> existTasks = new ArrayList<>();
- if (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type)) {
- existTasks = taskService.list(new LambdaQueryWrapper<Task>()
- .eq(Task::getOrgLoc, loc.getCode())
- .in(Task::getTaskStatus, Arrays.asList(TaskStsType.GENERATE_OUT.id, TaskStsType.WAVE_SEED.id)));
- for (Task t : existTasks) {
- List<TaskItem> existItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, t.getId()));
- for (TaskItem ti : existItems) {
- String k = buildAllocKey(ti.getMatnrId(), ti.getBatch(), ti.getFieldsIndex());
- allocatedByKey.put(k, allocatedByKey.getOrDefault(k, 0.0) + (ti.getAnfme() != null ? ti.getAnfme() : 0.0));
- }
+
+ List<Task> openOutboundOnLoc = taskService.list(new LambdaQueryWrapper<Task>()
+ .eq(Task::getOrgLoc, loc.getCode())
+ .in(Task::getTaskType, OUTBOUND_TASK_TYPES_FOR_APPEND)
+ .ge(Task::getTaskStatus, TaskStsType.GENERATE_OUT.id)
+ .le(Task::getTaskStatus, TaskStsType.WAVE_SEED.id));
+
+ boolean reuseExistingTask = false;
+ Task task = null;
+ if (appendSameLocEnabled && startedAsReserved) {
+ if (openOutboundOnLoc.size() > 1) {
+ throw new CoolException("搴撲綅:" + loc.getCode() + " 鍑哄簱棰勭害涓嬪瓨鍦ㄥ绗旀湭瀹岀粨鍑哄簱浠诲姟锛屼笉鍏佽鍐嶇敓鎴愪换鍔★紝璇峰緟鎷f枡鍥炲簱鑷矲鍚庡啀鍒嗛厤锛侊紒");
+ }
+ if (openOutboundOnLoc.isEmpty()) {
+ throw new CoolException("搴撲綅:" + loc.getCode() + " 涓篟.鍑哄簱棰勭害浣嗘湭鎵惧埌鏈畬缁撳嚭搴撲换鍔★紝搴撲綅鏁版嵁寮傚父锛屼笉鍙笅鍙戝嚭搴撴垨娉㈡锛侊紒");
+ }
+ task = openOutboundOnLoc.get(0);
+ reuseExistingTask = true;
+ if (StringUtils.isNotBlank(task.getTargSite())
+ && !StringUtils.equals(StringUtils.trimToEmpty(siteNo), StringUtils.trimToEmpty(task.getTargSite()))) {
+ throw new CoolException("搴撲綅:" + loc.getCode() + " 宸叉湁鍑哄簱浠诲姟鐩爣绔欑偣涓�" + task.getTargSite() + "锛屼笌鏈绔欑偣涓嶄竴鑷达紝涓嶅彲杩藉姞鏄庣粏锛侊紒");
}
}
- // 鏂欑鐮侊細浼樺厛鐢ㄥ簱浣嶏紱棰勭害鍑哄簱(R) 鏃惰嫢搴撲綅鏈粦瀹氬垯浠庡悓搴撲綅宸叉湁浠诲姟甯﹀嚭骞跺洖鍐欏簱浣嶏紱鍐嶅惁鍒欎粠鏈鍒嗛厤鏄庣粏甯﹀嚭
+
+ Map<String, Double> allocatedByKey = new HashMap<>();
+ for (Task t : openOutboundOnLoc) {
+ List<TaskItem> existItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, t.getId()));
+ for (TaskItem ti : existItems) {
+ String k = buildAllocKey(ti.getMatnrId(), ti.getBatch(), ti.getFieldsIndex());
+ allocatedByKey.put(k, allocatedByKey.getOrDefault(k, 0.0) + (ti.getAnfme() != null ? ti.getAnfme() : 0.0));
+ }
+ }
+
String barcodeToUse = StringUtils.isNotBlank(loc.getBarcode()) ? loc.getBarcode() : null;
- if (barcodeToUse == null && !existTasks.isEmpty()) {
- barcodeToUse = existTasks.get(0).getBarcode();
+ if (barcodeToUse == null && !openOutboundOnLoc.isEmpty()) {
+ barcodeToUse = openOutboundOnLoc.get(0).getBarcode();
if (StringUtils.isNotBlank(barcodeToUse)) {
- Task refTask = existTasks.get(0);
+ Task refTask = openOutboundOnLoc.get(0);
LambdaUpdateWrapper<Loc> locUw = new LambdaUpdateWrapper<Loc>().eq(Loc::getId, loc.getId())
.set(Loc::getBarcode, barcodeToUse)
.set(Loc::getUpdateBy, loginUserId)
@@ -231,71 +273,87 @@
if (barcodeToUse == null) {
barcodeToUse = loc.getBarcode();
}
+
Task moveTask = new Task();
- String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_TASK_CODE, null);
- task.setOrgLoc(loc.getCode())
- .setTaskCode(ruleCode)
- .setResource(resouce)
- .setTargSite(siteNo)
- .setSort(Constants.TASK_SORT_DEFAULT_VALUE)
- .setUpdateBy(loginUserId)
- .setCreateBy(loginUserId)
- .setCreateTime(new Date())
- .setUpdateTime(new Date())
- .setTaskStatus(TaskStsType.GENERATE_OUT.id)
- .setBarcode(barcodeToUse)
- .setMemo(map.getMemo());
+ if (!reuseExistingTask) {
+ task = new Task();
+ String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_TASK_CODE, null);
+ task.setOrgLoc(loc.getCode())
+ .setTaskCode(ruleCode)
+ .setResource(resouce)
+ .setTargSite(siteNo)
+ .setSort(Constants.TASK_SORT_DEFAULT_VALUE)
+ .setUpdateBy(loginUserId)
+ .setCreateBy(loginUserId)
+ .setCreateTime(new Date())
+ .setUpdateTime(new Date())
+ .setTaskStatus(TaskStsType.GENERATE_OUT.id)
+ .setBarcode(barcodeToUse)
+ .setMemo(map.getMemo());
- List<LocItem> locItems = this.list(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocId, key));
- if (locItems.isEmpty()) {
- throw new CoolException("鏁版嵁閿欒锛氭墍閫夊簱瀛樻槑缁嗕笉瀛樺湪锛侊紒");
- }
+ List<LocItem> locItems = this.list(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocId, key));
+ if (locItems.isEmpty()) {
+ throw new CoolException("鏁版嵁閿欒锛氭墍閫夊簱瀛樻槑缁嗕笉瀛樺湪锛侊紒");
+ }
- Double orgQty = locItems.stream().mapToDouble(LocItem::getAnfme).sum();
- List<LocItem> locItemList = listMap.get(key);
- Double outQty = locItemList.stream().mapToDouble(LocItem::getOutQty).sum();
- BigDecimal orgQtyBd = BigDecimal.valueOf(orgQty).setScale(6, RoundingMode.HALF_UP);
- BigDecimal outQtyBd = BigDecimal.valueOf(outQty).setScale(6, RoundingMode.HALF_UP);
+ Double orgQty = locItems.stream().mapToDouble(LocItem::getAnfme).sum();
+ List<LocItem> locItemList = listMap.get(key);
+ Double outQty = locItemList.stream().mapToDouble(LocItem::getOutQty).sum();
+ BigDecimal orgQtyBd = BigDecimal.valueOf(orgQty).setScale(6, RoundingMode.HALF_UP);
+ BigDecimal outQtyBd = BigDecimal.valueOf(outQty).setScale(6, RoundingMode.HALF_UP);
- if (map.getType().equals(Constants.TASK_TYPE_OUT_STOCK)
- || map.getType().equals(Constants.TASK_TYPE_ORDER_OUT_STOCK)
- || map.getType().equals(Constants.TASK_TYPE_WAVE_OUT_STOCK)) {
- // 鍑哄簱閲忚揪鍒板簱浣嶅簱瀛橈紙鍚宸級瑙嗕负鍏ㄧ増鍑哄簱锛岄伩鍏嶆诞鐐硅宸鑷磋鍒や负鎷f枡/閮ㄥ垎鍑哄簱
- if (orgQtyBd.subtract(outQtyBd).compareTo(FULL_OUT_QTY_TOLERANCE) > 0) {
- // 鎷f枡鍑哄簱锛堥儴鍒嗗嚭搴擄級
- DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
- .eq(DeviceSite::getSite, siteNo)
- .eq(!Objects.isNull(loc.getChannel()),DeviceSite::getChannel, loc.getChannel())
- .eq(DeviceSite::getType, TaskType.TASK_TYPE_PICK_AGAIN_OUT.type));
- if (Objects.isNull(deviceSite)) {
- throw new CoolException("绔欑偣涓嶆敮鎸佹嫞鏂欏嚭搴擄紒锛�");
+ if (map.getType().equals(Constants.TASK_TYPE_OUT_STOCK)
+ || map.getType().equals(Constants.TASK_TYPE_ORDER_OUT_STOCK)
+ || map.getType().equals(Constants.TASK_TYPE_WAVE_OUT_STOCK)) {
+ if (orgQtyBd.subtract(outQtyBd).compareTo(FULL_OUT_QTY_TOLERANCE) > 0) {
+ DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
+ .eq(DeviceSite::getSite, siteNo)
+ .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel())
+ .eq(DeviceSite::getType, TaskType.TASK_TYPE_PICK_AGAIN_OUT.type));
+ if (Objects.isNull(deviceSite)) {
+ throw new CoolException("绔欑偣涓嶆敮鎸佹嫞鏂欏嚭搴擄紒锛�");
+ }
+ task.setTaskType(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type).setWarehType(deviceSite.getDevice());
+ } else {
+ DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
+ .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel())
+ .eq(DeviceSite::getSite, siteNo).eq(DeviceSite::getType, TaskType.TASK_TYPE_OUT.type));
+ if (Objects.isNull(deviceSite)) {
+ throw new CoolException("绔欑偣涓嶆敮鎸佸叏鏉垮嚭搴擄紒锛�");
+ }
+ task.setTaskType(TaskType.TASK_TYPE_OUT.type).setWarehType(deviceSite.getDevice());
+
}
- task.setTaskType(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type).setWarehType(deviceSite.getDevice());
- } else {
- //鍏ㄦ澘鍑哄簱
+ } else if (map.getType().equals(Constants.TASK_TYPE_OUT_CHECK)) {
DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
.eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel())
- .eq(DeviceSite::getSite, siteNo).eq(DeviceSite::getType, TaskType.TASK_TYPE_OUT.type));
+ .eq(DeviceSite::getSite, siteNo)
+ .eq(DeviceSite::getType, TaskType.TASK_TYPE_CHECK_OUT.type));
if (Objects.isNull(deviceSite)) {
- throw new CoolException("绔欑偣涓嶆敮鎸佸叏鏉垮嚭搴擄紒锛�");
+ throw new CoolException("褰撳墠绔欑偣涓嶆敮鎸佺洏鐐瑰嚭搴擄紒锛�");
}
- task.setTaskType(TaskType.TASK_TYPE_OUT.type).setWarehType(deviceSite.getDevice());
-
+ task.setTaskType(TaskType.TASK_TYPE_CHECK_OUT.type).setWarehType(deviceSite.getDevice());
}
- } else if (map.getType().equals(Constants.TASK_TYPE_OUT_CHECK)) {
- //鐩樼偣鍑哄簱
- DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
- .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel())
- .eq(DeviceSite::getSite, siteNo)
- .eq(DeviceSite::getType, TaskType.TASK_TYPE_CHECK_OUT.type));
- if (Objects.isNull(deviceSite)) {
- throw new CoolException("褰撳墠绔欑偣涓嶆敮鎸佺洏鐐瑰嚭搴擄紒锛�");
- }
- task.setTaskType(TaskType.TASK_TYPE_CHECK_OUT.type).setWarehType(deviceSite.getDevice());
- }
- if (!taskService.save(task)) {
- throw new CoolException("浠诲姟鍒涘缓澶辫触锛侊紒");
+ if (!taskService.save(task)) {
+ throw new CoolException("浠诲姟鍒涘缓澶辫触锛侊紒");
+ }
+ } else {
+ if (StringUtils.isNotBlank(task.getBarcode()) && StringUtils.isBlank(barcodeToUse)) {
+ barcodeToUse = task.getBarcode();
+ LambdaUpdateWrapper<Loc> locUw = new LambdaUpdateWrapper<Loc>().eq(Loc::getId, loc.getId())
+ .set(Loc::getBarcode, barcodeToUse)
+ .set(Loc::getUpdateBy, loginUserId)
+ .set(Loc::getUpdateTime, new Date());
+ if (task.getWeight() != null) {
+ locUw.set(Loc::getWeight, task.getWeight());
+ }
+ locService.update(locUw);
+ }
+ List<LocItem> locItemsVerify = this.list(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocId, key));
+ if (locItemsVerify.isEmpty()) {
+ throw new CoolException("鏁版嵁閿欒锛氭墍閫夊簱瀛樻槑缁嗕笉瀛樺湪锛侊紒");
+ }
}
// if (!LocUtils.isShallowLoc(loc.getCode())) {
@@ -331,6 +389,11 @@
}
}
+ final Task outTask = task;
+ if (outTask == null) {
+ throw new CoolException("浠诲姟鏁版嵁寮傚父锛侊紒");
+ }
+
List<TaskItem> taskItems = new ArrayList<>();
listMap.get(key).forEach(item -> {
LocItem locItem = locItemService.getById(item.getId());
@@ -340,25 +403,22 @@
if (item.getOutQty().compareTo(0.0) < 0) {
throw new CoolException("鍑哄簱鏁伴噷涓嶈兘灏忎簬0锛侊紒");
}
- // 棰勭害鍑哄簱/鎷h揣涓拷鍔狅細鏂板垎閰嶉噺涓嶈兘瓒呰繃 (搴撲綅鏁伴噺 - 璇ョ墿鏂欏凡鍒嗛厤閲�)
Double allocQty = item.getOutQty();
- if (!allocatedByKey.isEmpty()) {
- String allocKey = buildAllocKey(locItem.getMatnrId(), locItem.getBatch(), locItem.getFieldsIndex());
- Double already = allocatedByKey.getOrDefault(allocKey, 0.0);
- Double available = Math.round((locItem.getAnfme() - already) * 1000000) / 1000000.0;
- if (available.compareTo(0.0) <= 0) {
- throw new CoolException("搴撲綅:" + loc.getCode() + " 璇ョ墿鏂欏凡鏃犲墿浣欏彲鍒嗛厤鏁伴噺锛屼笉鍙啀杩藉姞璁㈠崟锛�");
- }
- if (allocQty.compareTo(available) > 0) {
- allocQty = available;
- item.setOutQty(allocQty);
- }
- allocatedByKey.put(allocKey, already + allocQty);
+ String allocKey = buildAllocKey(locItem.getMatnrId(), locItem.getBatch(), locItem.getFieldsIndex());
+ Double already = allocatedByKey.getOrDefault(allocKey, 0.0);
+ Double available = Math.round((locItem.getAnfme() - already) * 1000000) / 1000000.0;
+ if (available.compareTo(0.0) <= 0) {
+ throw new CoolException("搴撲綅:" + loc.getCode() + " 璇ョ墿鏂欏凡鏃犲墿浣欏彲鍒嗛厤鏁伴噺锛屼笉鍙啀杩藉姞璁㈠崟锛�");
}
+ if (allocQty.compareTo(available) > 0) {
+ allocQty = available;
+ item.setOutQty(allocQty);
+ }
+ allocatedByKey.put(allocKey, already + allocQty);
TaskItem taskItem = new TaskItem();
BeanUtils.copyProperties(item, taskItem);
- taskItem.setTaskId(task.getId())
+ taskItem.setTaskId(outTask.getId())
.setAnfme(allocQty)
.setBatch(item.getBatch())
.setUpdateBy(loginUserId)
@@ -370,7 +430,29 @@
taskItem.setWkType(order.getWkType())
.setSourceCode(order.getCode())
.setSourceId(order.getId())
+ .setOrderId(order.getId())
.setOrderItemId(item.getOrderItemId());
+ String poOrCode = StringUtils.isNotBlank(order.getPoCode()) ? order.getPoCode() : order.getCode();
+ if (StringUtils.isBlank(taskItem.getPlatOrderCode()) && StringUtils.isNotBlank(poOrCode)) {
+ taskItem.setPlatOrderCode(poOrCode);
+ }
+ if (item.getOrderItemId() != null) {
+ WkOrderItem oi = asnOrderItemService.getById(item.getOrderItemId());
+ if (oi != null) {
+ if (StringUtils.isBlank(taskItem.getPlatItemId()) && StringUtils.isNotBlank(oi.getPlatItemId())) {
+ taskItem.setPlatItemId(oi.getPlatItemId());
+ }
+ if (StringUtils.isBlank(taskItem.getPlatWorkCode()) && StringUtils.isNotBlank(oi.getPlatWorkCode())) {
+ taskItem.setPlatWorkCode(oi.getPlatWorkCode());
+ }
+ if (StringUtils.isBlank(taskItem.getPlatOrderCode())) {
+ String p = StringUtils.isNotBlank(oi.getPlatOrderCode()) ? oi.getPlatOrderCode() : poOrCode;
+ if (StringUtils.isNotBlank(p)) {
+ taskItem.setPlatOrderCode(p);
+ }
+ }
+ }
+ }
} else if (map.getType().equals(Constants.TASK_TYPE_WAVE_OUT_STOCK)) {
taskItem.setSourceId(wave.getId())
.setWkType(OrderWorkType.ORDER_WORK_TYPE_OTHER.type)
@@ -400,6 +482,12 @@
if (!taskItemService.saveBatch(taskItems)) {
throw new CoolException("浠诲姟鏄庣粏鐢熸垚澶辫触锛侊紒");
+ }
+ for (TaskItem ti : taskItems) {
+ if (ti.getAnfme() == null) {
+ throw new CoolException("浠诲姟鏄庣粏鏁伴噺寮傚父");
+ }
+ taskService.enqueueCloudWmsOutNotifyLogEarly(outTask, ti, QuantityUtils.toScaledBigDecimal(ti.getAnfme()));
}
});
}
@@ -591,4 +679,9 @@
private static String buildAllocKey(Long matnrId, String batch, String fieldsIndex) {
return (matnrId != null ? matnrId : "") + "|" + (batch != null ? batch : "") + "|" + (fieldsIndex != null ? fieldsIndex : "");
}
+
+ private boolean isOutAppendSameLocTaskEnabled() {
+ Boolean v = configService.getVal(GlobalConfigCode.OUT_APPEND_SAME_LOC_TASK_ENABLED, Boolean.class);
+ return Boolean.TRUE.equals(v);
+ }
}
--
Gitblit v1.9.1