From 82065a03737fa1370eb9f4f01ab5332933baf08a Mon Sep 17 00:00:00 2001
From: chen.lin <1442464845@qq.com>
Date: 星期四, 05 三月 2026 09:23:37 +0800
Subject: [PATCH] 云仓WMS+RCS+自动入库临时方法配置
---
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/MobileServiceImpl.java | 248 ++++++++++++++++++++++++++++++++++---------------
1 files changed, 171 insertions(+), 77 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/MobileServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/MobileServiceImpl.java
index ee5af53..81635dd 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/MobileServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/MobileServiceImpl.java
@@ -14,6 +14,7 @@
import com.vincent.rsf.server.common.security.JwtSubject;
import com.vincent.rsf.server.common.utils.FieldsUtils;
import com.vincent.rsf.server.common.utils.JwtUtil;
+import com.vincent.rsf.server.common.utils.QuantityUtils;
import com.vincent.rsf.server.manager.controller.params.GenerateTaskParams;
import com.vincent.rsf.server.manager.controller.params.IsptItemsParams;
import com.vincent.rsf.server.manager.controller.params.WaitPakinParam;
@@ -29,6 +30,7 @@
import com.vincent.rsf.server.system.entity.*;
import com.vincent.rsf.server.system.mapper.FieldsMapper;
import com.vincent.rsf.server.system.mapper.TenantMapper;
+import com.vincent.rsf.server.system.entity.Config;
import com.vincent.rsf.server.system.service.ConfigService;
import com.vincent.rsf.server.system.service.FieldsItemService;
import com.vincent.rsf.server.system.service.UserLoginService;
@@ -258,8 +260,11 @@
throw new CoolException("鏁版嵁閿欒锛氫富鍗曚笉瀛樺湪锛侊紒");
}
//TODO /**鏀惰揣鏁伴噺绱姞锛�1. 浼氬嚭瓒呮敹鎯呭喌 2. 浼氭湁鏀惰揣涓嶈冻鎯呭喌*/
- Double rcptedQty = Math.round((wkOrder.getQty() + receiptQty) * 1000000) / 1000000.0;
- wkOrder.setQty(rcptedQty).setExceStatus(AsnExceStatus.ASN_EXCE_STATUS_EXCE_ING.val);
+ Double rcptedQty = QuantityUtils.add(wkOrder.getQty(), receiptQty);
+ wkOrder.setQty(rcptedQty);
+ if (AsnExceStatus.ASN_EXCE_STATUS_UN_EXCE.val.equals(wkOrder.getExceStatus())) {
+ wkOrder.setExceStatus(AsnExceStatus.ASN_EXCE_STATUS_EXCE_ING.val);
+ }
if (!asnOrderMapper.updateById(wkOrder)) {
throw new CoolException("宸叉敹璐ф暟閲忎慨鏀瑰け璐ワ紒锛�");
}
@@ -306,14 +311,14 @@
throw new CoolException("璇疯緭鍏ユ纭殑鏃堕棿鏍煎紡锛侊紒");
}
- Double itemRcptQty = Math.round((dto.getReceiptQty() + orderItem.getQty()) * 1000000) / 1000000.0;
+ Double itemRcptQty = QuantityUtils.add(dto.getReceiptQty(), orderItem.getQty());
Boolean allowOver = false;
if (!Objects.isNull(config)) {
if (Boolean.parseBoolean(config.getVal())) {
allowOver = true;
}
}
- if (itemRcptQty.compareTo(orderItem.getAnfme()) > 0 && !allowOver) {
+ if (QuantityUtils.compare(itemRcptQty, orderItem.getAnfme()) > 0 && !allowOver) {
throw new CoolException("鏀惰揣鏁伴噺涓嶈兘澶т簬璁″垝鏁伴噺锛侊紒");
}
@@ -350,13 +355,16 @@
if (asnOrderItemMapper.updateById(orderItem) < 1) {
throw new CoolException("閫氱煡鍗曟槑缁嗘暟閲忎慨鏀瑰け璐ワ紒锛�");
}
- /**淇濆瓨鏄庣粏鑷虫敹璐у尯**/
- extracted(loginUserId, dto, areasItem, orderItem, wkOrder, matnr);
-
+ // DirectWaitPakin 鍚敤鏃朵繚瀛樿嚦鏀惰揣鍖猴紝褰㈡垚闂幆锛涙湭鍚敤鏃朵笉鍐欐敹璐у尯
+ Config directPakinConfig = configService.getOne(new LambdaQueryWrapper<Config>().eq(Config::getFlag, GlobalConfigCode.DIRECT_WAIT_PAKIN));
+ if (directPakinConfig != null && Boolean.parseBoolean(directPakinConfig.getVal())) {
+ extracted(loginUserId, dto, areasItem, orderItem, wkOrder, matnr);
+ }
}
+ // 宸叉敹鏁伴噺 >= 璁″垝鏁伴噺鏃剁疆涓烘敹璐у畬鎴�(2)
WkOrder order = asnOrderMapper.getOne(new LambdaQueryWrapper<WkOrder>().eq(WkOrder::getCode, asnCode));
- if (order.getQty().compareTo(order.getAnfme()) >= 0.00) {
+ if (order != null && order.getAnfme() != null && QuantityUtils.compare(order.getQty(), order.getAnfme()) >= 0) {
order.setExceStatus(AsnExceStatus.ASN_EXCE_STATUS_RECEIPT_DONE.val).setRleStatus(Short.valueOf("1"));
if (!asnOrderMapper.updateById(order)) {
throw new CoolException("璁㈠崟鐘舵�佷慨鏀瑰け璐ワ紒锛�");
@@ -390,7 +398,7 @@
.setUnit(orderItem.getStockUnit())
.setStockUnit(orderItem.getStockUnit())
.setBatch(StringUtils.isBlank(orderItem.getBatch()) ? SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_RECEIPT_BATCH, dto) : orderItem.getBatch())
- .setAnfme(dto.getReceiptQty())
+ .setAnfme(QuantityUtils.roundToScale(dto.getReceiptQty()))
.setSplrBatch(dto.getSplrBatch())
.setMatnrCode(matnr.getCode())
.setUpdateBy(loginUserId)
@@ -419,8 +427,7 @@
if (!Objects.isNull(serviceOne)) {
item.setId(serviceOne.getId());
- Double anfme = Math.round((item.getAnfme() + serviceOne.getAnfme()) * 1000000) / 1000000.0;
- item.setAnfme(anfme);
+ item.setAnfme(QuantityUtils.add(item.getAnfme(), serviceOne.getAnfme()));
}
//鏈川妫�
@@ -511,8 +518,13 @@
* @description 鑾峰彇鏀惰揣鍖�
* @time 2025/3/11 10:12
*/
+ /** DirectWaitPakin 鍚敤鏃惰繑鍥炴敹璐у尯鍒楄〃锛屾湭鍚敤鏃惰繑鍥炵┖鍒楄〃锛堜笉褰卞搷缁勬墭涓庝簯浠撳叆搴撴祦绋嬶級 */
@Override
public R getReceiptAreas() {
+ Config directPakinConfig = configService.getOne(new LambdaQueryWrapper<Config>().eq(Config::getFlag, GlobalConfigCode.DIRECT_WAIT_PAKIN));
+ if (directPakinConfig == null || !Boolean.parseBoolean(directPakinConfig.getVal())) {
+ return R.ok(Collections.emptyList());
+ }
List<WarehouseAreas> areas = warehouseAreasService.list(new LambdaQueryWrapper<WarehouseAreas>()
.eq(WarehouseAreas::getType, WarehouseAreaType.WAREHOUSE_AREA_RECEIPT.type));
return R.ok(areas);
@@ -552,7 +564,7 @@
// throw new CoolException("绁ㄥ彿涓嶈兘涓虹┖锛侊紒");
// }
// if (Objects.isNull(code)) {
-// throw new CoolException("瀹瑰櫒鍙蜂笉鑳戒负绌猴紒锛�");
+// throw new CoolException("鏂欑鐮佷笉鑳戒负绌猴紒锛�");
// }
// BasContainer container = basContainerService.getOne(new LambdaQueryWrapper<BasContainer>().eq(BasContainer::getCode, barcode));
// if (Objects.isNull(container)) {
@@ -579,7 +591,7 @@
|| !Objects.isNull(fieldIndex) || !Cools.isEmpty(matnrCode) || !Cools.isEmpty(asnCode);
if (!hasValidCondition) {
- throw new CoolException("璇疯嚦灏戣緭鍏ヤ竴涓煡璇㈡潯浠讹細鐗╂枡缂栫爜銆丄SN鍗曞彿銆佽窡韪爜銆佹壒娆℃垨绁ㄥ彿");
+ throw new CoolException("璇疯嚦灏戣緭鍏ヤ竴涓煡璇㈡潯浠讹細鐗╂枡缂栫爜銆乄MS鍗曞彿銆佹壒鍙�");/*銆佽窡韪爜銆佹壒娆℃垨绁ㄥ彿*/
}
// 濡傛灉鎵弿鐗╂枡缂栫爜涓擜SN鍗曞彿涓虹┖锛岀洿鎺ヤ粠鐗╂枡淇℃伅琛ㄨ幏鍙栵紝涓嶆煡璇㈡敹璐у尯
@@ -620,60 +632,138 @@
return R.ok(resultList);
}
- //TODO 鍚庣画闇�鏍规嵁绛栫暐閰嶇疆锛岃幏鍙栫粍鎷栨暟鎹�傚锛氭贩瑁咃紝鎸夋壒娆℃贩瑁呯瓑
- LambdaQueryWrapper<WarehouseAreasItem> queryWrapper = new LambdaQueryWrapper<>();
-
- // 鏋勫缓OR鏌ヨ鏉′欢缁�
- // 缁熻鏈夋晥鏉′欢鏁伴噺
- int conditionCount = 0;
- if (!Cools.isEmpty(code)) conditionCount++;
- if (!Cools.isEmpty(batch)) conditionCount++;
- if (!Objects.isNull(fieldIndex)) conditionCount++;
- if (!Cools.isEmpty(matnrCode)) conditionCount++;
- if (!Cools.isEmpty(asnCode)) conditionCount++;
-
- // 濡傛灉鍙湁涓�涓潯浠讹紝鐩存帴浣跨敤eq锛涘鏋滄湁澶氫釜鏉′欢锛屼娇鐢╝nd鍖呰9or鏉′欢缁�
- if (conditionCount == 1) {
- // 鍗曚釜鏉′欢锛岀洿鎺ユ煡璇�
- if (!Cools.isEmpty(code)) {
- queryWrapper.eq(WarehouseAreasItem::getTrackCode, code);
- } else if (!Cools.isEmpty(batch)) {
- queryWrapper.eq(WarehouseAreasItem::getSplrBatch, batch);
- } else if (!Objects.isNull(fieldIndex)) {
- queryWrapper.eq(WarehouseAreasItem::getFieldsIndex, fieldIndex);
- } else if (!Cools.isEmpty(matnrCode)) {
- queryWrapper.eq(WarehouseAreasItem::getMatnrCode, matnrCode);
- } else if (!Cools.isEmpty(asnCode)) {
- queryWrapper.eq(WarehouseAreasItem::getAsnCode, asnCode);
+ // 鏈堿SN鍗曞彿鏃讹細DirectWaitPakin 鍚敤鍒欎粠鏀惰揣鍖烘煡鍙粍鎵樼墿鏂欙紝鏈惎鐢ㄥ垯浠庤鍗曟槑缁嗘煡锛堝彲缁勭洏鏁伴噺 = 璁″垝 - 宸茬粍鎵� - 宸蹭笂鏋讹級
+ if (!Cools.isEmpty(asnCode)) {
+ Config directPakinConfig = configService.getOne(new LambdaQueryWrapper<Config>().eq(Config::getFlag, GlobalConfigCode.DIRECT_WAIT_PAKIN));
+ if (directPakinConfig != null && Boolean.parseBoolean(directPakinConfig.getVal())) {
+ LambdaQueryWrapper<WarehouseAreasItem> receiptWrapper = new LambdaQueryWrapper<WarehouseAreasItem>().eq(WarehouseAreasItem::getAsnCode, asnCode);
+ if (!Cools.isEmpty(matnrCode)) receiptWrapper.eq(WarehouseAreasItem::getMatnrCode, matnrCode);
+ if (!Cools.isEmpty(batch)) receiptWrapper.eq(WarehouseAreasItem::getSplrBatch, batch);
+ if (!Objects.isNull(fieldIndex)) receiptWrapper.eq(WarehouseAreasItem::getFieldsIndex, fieldIndex);
+ if (!Cools.isEmpty(code)) receiptWrapper.eq(WarehouseAreasItem::getTrackCode, code);
+ List<WarehouseAreasItem> receiptList = warehouseAreasItemService.list(receiptWrapper);
+ // 缁勬墭閫氱煡妗o紙WaitPakinItem锛夌殑宸茬粍鎵樻暟閲忎篃瑕佹墸鍑忥細鏀惰揣鍖� workQty 浠呭弽鏄犱粠鏀惰揣鍖虹粍鎵樼殑閮ㄥ垎锛屼粠璁㈠崟鐩存帴缁勬墭鐨勫湪姝ゆ眹鎬�
+ Map<Long, Double> waitPakinSumByItemId = new java.util.HashMap<>();
+ if (!receiptList.isEmpty() && receiptList.stream().anyMatch(e -> e.getAsnId() != null && e.getAsnItemId() != null)) {
+ List<Long> asnItemIds = receiptList.stream().map(WarehouseAreasItem::getAsnItemId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
+ Long asnId = receiptList.get(0).getAsnId();
+ if (asnId != null && !asnItemIds.isEmpty()) {
+ List<WaitPakinItem> wpItems = waitPakinItemService.list(
+ new LambdaQueryWrapper<WaitPakinItem>().eq(WaitPakinItem::getAsnId, asnId).in(WaitPakinItem::getAsnItemId, asnItemIds).eq(WaitPakinItem::getDeleted, 0));
+ wpItems.forEach(w -> waitPakinSumByItemId.merge(w.getAsnItemId(), w.getAnfme() != null ? w.getAnfme() : 0.0, (a, b) -> (a != null ? a : 0.0) + (b != null ? b : 0.0)));
+ waitPakinSumByItemId.replaceAll((k, v) -> QuantityUtils.roundToScale(v));
+ }
+ }
+ // 鍙粍鎵� = 璁″垝(anfme) - 宸茬粍鎵�(waitPakinSumByItemId)锛屼笉鍙犲姞 areaWorkQty 閬垮厤涓庣粍鎵樻。姹囨�婚噸澶嶈绠�
+ receiptList.removeIf(e -> {
+ Double anfme = e.getAnfme() != null ? e.getAnfme() : 0.0;
+ Double qty = e.getQty() != null ? e.getQty() : 0.0;
+ Double alreadyInWaitPakin = e.getAsnItemId() != null ? waitPakinSumByItemId.getOrDefault(e.getAsnItemId(), 0.0) : 0.0;
+ Double totalAlready = QuantityUtils.roundToScale(alreadyInWaitPakin);
+ Double available = QuantityUtils.roundToScale(QuantityUtils.subtract(QuantityUtils.subtract(anfme, totalAlready), qty));
+ e.setWorkQty(totalAlready);
+ e.setAvailablePalletQty(available);
+ return QuantityUtils.compare(available, 0.0) <= 0;
+ });
+ logger.info("=== 浠庢敹璐у尯鏌ヨ鍙粍鎵樼墿鏂欙紙DirectWaitPakin锛塧snCode: {} 杩斿洖 {} 鏉�", asnCode, receiptList.size());
+ return R.ok(receiptList);
}
- } else {
- // 澶氫釜鏉′欢锛屼娇鐢∣R杩炴帴
- queryWrapper.and(wrapper -> {
- boolean first = true;
+ WkOrder order = asnOrderMapper.getOne(new LambdaQueryWrapper<WkOrder>().eq(WkOrder::getCode, asnCode));
+ if (order == null) {
+ logger.info("鏈壘鍒癆SN鍗曞彿: {}", asnCode);
+ return R.ok(Collections.emptyList());
+ }
+ List<WaitPakinItem> pakinItems = waitPakinItemService.list(new LambdaQueryWrapper<WaitPakinItem>().eq(WaitPakinItem::getAsnId, order.getId()).eq(WaitPakinItem::getDeleted, 0));
+ Map<Long, Double> palletizedByItemId = pakinItems.stream()
+ .collect(Collectors.groupingBy(WaitPakinItem::getAsnItemId, Collectors.summingDouble(w -> w.getAnfme() != null ? w.getAnfme() : 0.0)));
+ palletizedByItemId.replaceAll((k, v) -> QuantityUtils.roundToScale(v));
+ LambdaQueryWrapper<WkOrderItem> itemWrapper = new LambdaQueryWrapper<WkOrderItem>().eq(WkOrderItem::getOrderId, order.getId());
+ if (!Cools.isEmpty(matnrCode)) itemWrapper.eq(WkOrderItem::getMatnrCode, matnrCode);
+ if (!Cools.isEmpty(batch)) itemWrapper.eq(WkOrderItem::getSplrBatch, batch);
+ if (!Objects.isNull(fieldIndex)) itemWrapper.eq(WkOrderItem::getFieldsIndex, fieldIndex);
+ if (!Cools.isEmpty(code)) itemWrapper.eq(WkOrderItem::getTrackCode, code);
+ List<WkOrderItem> orderItems = asnOrderItemMapper.selectList(itemWrapper);
+ List<WarehouseAreasItem> list = new ArrayList<>();
+ for (WkOrderItem oi : orderItems) {
+ Double anfme = QuantityUtils.roundToScale(oi.getAnfme() != null ? oi.getAnfme() : 0.0);
+ Double qty = QuantityUtils.roundToScale(oi.getQty() != null ? oi.getQty() : 0.0);
+ Double workQty = palletizedByItemId.getOrDefault(oi.getId(), 0.0);
+ // 鍙粍鐩樻暟閲� = 璁″垝 - 宸茬粍鎵橈紙涓嶆墸鍑忔槑缁嗗畬鎴愭暟閲� qty锛岄伩鍏嶄簯浠撳悓姝ュ畬鎴愭暟閲�=璁″垝鍚庡鑷村彲缁勬墭琚畻鎴� 0锛�
+ Double availablePalletQty = QuantityUtils.roundToScale(QuantityUtils.subtract(anfme, workQty));
+ if (QuantityUtils.compare(availablePalletQty, 0.0) <= 0) continue;
+ WarehouseAreasItem v = new WarehouseAreasItem();
+ v.setId(oi.getId());
+ v.setAsnItemId(oi.getId());
+ v.setAsnId(order.getId());
+ v.setAsnCode(order.getCode());
+ v.setAnfme(anfme);
+ v.setQty(qty);
+ v.setWorkQty(QuantityUtils.roundToScale(workQty));
+ v.setAvailablePalletQty(availablePalletQty);
+ v.setMatnrCode(oi.getMatnrCode());
+ v.setMaktx(oi.getMaktx());
+ v.setSplrBatch(oi.getSplrBatch());
+ v.setPlatItemId(oi.getPlatItemId());
+ v.setStockUnit(oi.getStockUnit());
+ v.setUnit(oi.getStockUnit());
+ v.setMatnrId(oi.getMatnrId());
+ v.setFieldsIndex(oi.getFieldsIndex());
+ v.setTrackCode(oi.getTrackCode());
+ if (oi.getFieldsIndex() != null) {
+ v.setExtendFields(FieldsUtils.getFields(oi.getFieldsIndex()));
+ }
+ list.add(v);
+ }
+ logger.info("=== 浠庤鍗曟槑缁嗘煡璇㈠彲缁勬墭鐗╂枡 asnCode: {} 杩斿洖 {} 鏉�", asnCode, list.size());
+ return R.ok(list);
+ }
+
+ // 鏃燗SN鍗曞彿鏃舵寜鍏朵粬鏉′欢鏌ワ紙鏀惰揣鍖哄凡鍋滅敤锛屾澶勪粎淇濈暀鍏煎锛岄�氬父鏃犳暟鎹級
+ LambdaQueryWrapper<WarehouseAreasItem> queryWrapper = new LambdaQueryWrapper<>();
+ {
+ // 娌℃湁ASN鍗曞彿鏃讹紝鍙互鎵弿浠绘剰鐗╂枡缁勬墭锛屼娇鐢∣R杩炴帴澶氫釜鏉′欢
+ // 缁熻鏈夋晥鏉′欢鏁伴噺
+ int conditionCount = 0;
+ if (!Cools.isEmpty(code)) conditionCount++;
+ if (!Cools.isEmpty(batch)) conditionCount++;
+ if (!Objects.isNull(fieldIndex)) conditionCount++;
+ if (!Cools.isEmpty(matnrCode)) conditionCount++;
+
+ // 濡傛灉鍙湁涓�涓潯浠讹紝鐩存帴浣跨敤eq
+ if (conditionCount == 1) {
if (!Cools.isEmpty(code)) {
- wrapper.eq(WarehouseAreasItem::getTrackCode, code);
- first = false;
+ queryWrapper.eq(WarehouseAreasItem::getTrackCode, code);
+ } else if (!Cools.isEmpty(batch)) {
+ queryWrapper.eq(WarehouseAreasItem::getSplrBatch, batch);
+ } else if (!Objects.isNull(fieldIndex)) {
+ queryWrapper.eq(WarehouseAreasItem::getFieldsIndex, fieldIndex);
+ } else if (!Cools.isEmpty(matnrCode)) {
+ queryWrapper.eq(WarehouseAreasItem::getMatnrCode, matnrCode);
}
- if (!Cools.isEmpty(batch)) {
- if (!first) wrapper.or();
- wrapper.eq(WarehouseAreasItem::getSplrBatch, batch);
- first = false;
- }
- if (!Objects.isNull(fieldIndex)) {
- if (!first) wrapper.or();
- wrapper.eq(WarehouseAreasItem::getFieldsIndex, fieldIndex);
- first = false;
- }
- if (!Cools.isEmpty(matnrCode)) {
- if (!first) wrapper.or();
- wrapper.eq(WarehouseAreasItem::getMatnrCode, matnrCode);
- first = false;
- }
- if (!Cools.isEmpty(asnCode)) {
- if (!first) wrapper.or();
- wrapper.eq(WarehouseAreasItem::getAsnCode, asnCode);
- }
- });
+ } else if (conditionCount > 1) {
+ // 澶氫釜鏉′欢锛屼娇鐢∣R杩炴帴
+ queryWrapper.and(wrapper -> {
+ boolean first = true;
+ if (!Cools.isEmpty(code)) {
+ wrapper.eq(WarehouseAreasItem::getTrackCode, code);
+ first = false;
+ }
+ if (!Cools.isEmpty(batch)) {
+ if (!first) wrapper.or();
+ wrapper.eq(WarehouseAreasItem::getSplrBatch, batch);
+ first = false;
+ }
+ if (!Objects.isNull(fieldIndex)) {
+ if (!first) wrapper.or();
+ wrapper.eq(WarehouseAreasItem::getFieldsIndex, fieldIndex);
+ first = false;
+ }
+ if (!Cools.isEmpty(matnrCode)) {
+ if (!first) wrapper.or();
+ wrapper.eq(WarehouseAreasItem::getMatnrCode, matnrCode);
+ }
+ });
+ }
}
// 鎵撳嵃鏌ヨ鍙傛暟鍒版帶鍒跺彴
@@ -945,7 +1035,7 @@
@Override
public R operateToStock(OpStockParams params) {
if (org.apache.commons.lang3.StringUtils.isBlank(params.getBarcode())) {
- throw new CoolException("鎵樼洏鐮佷笉鑳戒负绌猴紒锛�");
+ throw new CoolException("鏂欑鐮佷笉鑳戒负绌猴紒锛�");
}
WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>()
.eq(WaitPakin::getBarcode, params.getBarcode())
@@ -1000,7 +1090,7 @@
throw new CoolException("褰撳墠涓氬姟锛�" + SerialRuleCode.SYS_STOCK_CODE + "锛岀紪鐮佽鍒欎笉瀛樺湪锛侊紒");
}
List<WkOrderItem> itemList = params.getItemList();
- double sum = itemList.stream().mapToDouble(WkOrderItem::getAnfme).sum();
+ Double sum = QuantityUtils.roundToScale(itemList.stream().mapToDouble(WkOrderItem::getAnfme).sum());
stock.setAnfme(sum)
.setSourceId(order.getId())
.setType(order.getType())
@@ -1154,15 +1244,15 @@
.eq(WaitPakin::getFlagDefect, flagDefect)
.in(WaitPakin::getIoStatus, asList));
// if (!Cools.isEmpty(waitPakin)) {
-// throw new CoolException("鎵樼洏涓嶅彲鐢�,鍦ㄧ粍鎵樹腑宸插瓨鍦�");
+// throw new CoolException("鏂欑涓嶅彲鐢�,鍦ㄧ粍鎵樹腑宸插瓨鍦�");
// }
List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, params.get("barcode").toString()));
if (!tasks.isEmpty()) {
- throw new CoolException("鎵樼洏鐮佸凡鍦ㄤ换鍔℃。鎵ц锛侊紒");
+ throw new CoolException("鏂欑鐮佸凡鍦ㄤ换鍔℃。鎵ц锛侊紒");
}
List<Loc> locs = locService.list(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, params.get("barcode").toString()));
if (!Cools.isEmpty(locs)) {
- throw new CoolException("鎵樼洏涓嶅彲鐢紝鍦ㄥ簱浣嶄腑宸插瓨鍦�");
+ throw new CoolException("鏂欑涓嶅彲鐢紝鍦ㄥ簱浣嶄腑宸插瓨鍦�");
}
// List<WaitPakinItem> items = waitPakinItemService.list(new LambdaQueryWrapper<WaitPakinItem>().eq(WaitPakinItem::getPakinId, waitPakin.getId()));
// items.forEach(item -> {
@@ -1185,14 +1275,14 @@
@Override
public R getUnItemByContainer(Map<String, Object> params) {
if (Cools.isEmpty(params.get("barcode")) && Cools.isEmpty(params.get("code"))) {
- throw new CoolException("瀹瑰櫒鍙蜂笌缁勬墭妗g紪鐮佷笉鑳藉叏涓虹┖");
+ throw new CoolException("鏂欑鐮佷笌缁勬墭妗g紪鐮佷笉鑳藉叏涓虹┖");
}
WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>()
.eq(!Cools.isEmpty(params.get("barcode")), WaitPakin::getBarcode, params.get("barcode"))
.eq(!Cools.isEmpty(params.get("code")), WaitPakin::getCode, params.get("code"))
.eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val));
if (Objects.isNull(waitPakin)) {
- return R.error("鏈壘鍒拌瀹瑰櫒鐮佺殑缁勬墭鏄庣粏锛岃妫�鏌ョ粍鎵樼姸鎬�");
+ return R.error("鏈壘鍒拌鏂欑鐮佺殑缁勬墭鏄庣粏锛岃妫�鏌ョ粍鎵樼姸鎬�");
}
List<WaitPakinItem> pakinItems = waitPakinItemService.list(new LambdaQueryWrapper<WaitPakinItem>()
.eq(WaitPakinItem::getPakinId, waitPakin.getId()));
@@ -1252,10 +1342,14 @@
*/
@Override
public R getDeviceSites() {
- List<DeviceSite> sites = deviceSiteMapper.selectList(new LambdaQueryWrapper<DeviceSite>()
+ // 鍏堟煡鍏ㄩ儴鍐嶆寜 site 鍘婚噸锛岄伩鍏� GROUP BY 涓� only_full_group_by 鍐茬獊
+ List<DeviceSite> all = deviceSiteMapper.selectList(new LambdaQueryWrapper<DeviceSite>()
.select(DeviceSite::getId, DeviceSite::getSite, DeviceSite::getName)
- .eq(DeviceSite::getStatus, 1)
- .groupBy(DeviceSite::getSite, DeviceSite::getId, DeviceSite::getName));
+ .eq(DeviceSite::getStatus, 1));
+ List<DeviceSite> sites = all.stream()
+ .collect(Collectors.toMap(DeviceSite::getSite, d -> d, (a, b) -> a))
+ .values().stream()
+ .collect(Collectors.toList());
return R.ok(sites);
}
@@ -1304,11 +1398,11 @@
.setMaktx(asnOrderItem.getMaktx())
.setFieldsIndex(asnOrderItem.getFieldsIndex())
.setBarcode(asnOrderItem.getTrackCode())
- .setQty(asnOrderItem.getQty())
+ .setQty(QuantityUtils.roundToScale(asnOrderItem.getQty()))
.setStockUnit(asnOrderItem.getStockUnit())
.setPurUnit(asnOrderItem.getPurUnit())
.setPoCode(asnOrderItem.getPoCode())
- .setAnfme(asnOrderItem.getAnfme())
+ .setAnfme(QuantityUtils.roundToScale(asnOrderItem.getAnfme()))
.setPurQty(asnOrderItem.getPurQty())
.setSplrBatch(asnOrderItem.getSplrBatch())
.setExtendFields(asnOrderItem.getExtendFields())
@@ -1339,7 +1433,7 @@
if (Objects.isNull(stockItem)) {
detlsDto.setStockQty(0.0);
} else {
- Double anfme = Math.round((stockItem.getAnfme() + stockItem.getWorkQty()) * 1000000) / 1000000.0;
+ Double anfme = QuantityUtils.add(stockItem.getAnfme(), stockItem.getWorkQty());
detlsDto.setStockQty(anfme);
}
--
Gitblit v1.9.1