From d7355ce983c2bddcc5b95e4d84283f6631fb176a Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期四, 27 十一月 2025 13:38:46 +0800
Subject: [PATCH] 修改入出库历史的拣料类型,不上传ERP
---
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/ReceiveMsgServiceImpl.java | 138 +++++++++++++++++++++++++++-------------------
1 files changed, 81 insertions(+), 57 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/ReceiveMsgServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/ReceiveMsgServiceImpl.java
index 4dcf672..dcf690b 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/ReceiveMsgServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/ReceiveMsgServiceImpl.java
@@ -68,6 +68,8 @@
@Autowired
private AsnOrderService asnOrderService;
@Autowired
+ private AsnOrderLogService asnOrderLogService;
+ @Autowired
private AsnOrderItemService asnOrderItemService;
@Autowired
private DeliveryService deliveryService;
@@ -225,11 +227,20 @@
@Override
public R queryOrderStatus(QueryOrderParam queryParams) {
WkOrder wkOrders = asnOrderService.getOne(new LambdaQueryWrapper<WkOrder>()
- .eq(WkOrder::getCode, queryParams.getOrderNo())
- .eq(StringUtils.isNotBlank(queryParams.getType()), WkOrder::getType, queryParams.getType()));
+ .eq(WkOrder::getPoCode, queryParams.getOrderNo()));
if (Objects.isNull(wkOrders)) {
- throw new CoolException("鍗曟嵁涓嶅瓨鍦紒锛�");
+ Map<String, Object> map = new HashMap<>();
+ map.put("exceStatus", "-1");
+ return R.ok("鍗曟嵁涓嶅瓨鍦� 锛侊紒").add(map);
}
+
+ AsnOrderLog orderLog = asnOrderLogService.getOne(new LambdaQueryWrapper<AsnOrderLog>().eq(AsnOrderLog::getCode, queryParams.getOrderNo()));
+ if (!Objects.isNull(orderLog)) {
+ Map<String, Object> map = new HashMap<>();
+ map.put("exceStatus", "4");
+ return R.ok("鍗曟嵁宸插畬鎴� 锛侊紒").add(map);
+ }
+
List<WkOrderItem> orderItems = asnOrderItemService.list(new LambdaQueryWrapper<WkOrderItem>().eq(WkOrderItem::getOrderId, wkOrders.getId()));
WkOrderDto wkorderDto = new WkOrderDto();
@@ -400,62 +411,75 @@
if (Objects.isNull(one)) {
throw new CoolException("鍗曟嵁锛�" + syncOrder.getOrderNo() + ", 涓氬姟绫诲瀷涓嶅瓨鍦紒锛�");
}
- WkOrder order = asnOrderService.getOne(new LambdaQueryWrapper<WkOrder>()
- .eq(!Objects.isNull(syncOrder.getOrderId()), WkOrder::getPoId, syncOrder.getOrderId())
- .eq(WkOrder::getPoCode, syncOrder.getOrderNo()));
- if (!Objects.isNull(order)) {
- if (order.getExceStatus().equals(AsnExceStatus.ASN_EXCE_STATUS_UN_EXCE.val) ||
- order.getExceStatus().equals(AsnExceStatus.OUT_STOCK_STATUS_TASK_INIT.val)) {
- /**鍒犻櫎鍗曟嵁鏄庣粏*/
- asnOrderItemService.remove(new LambdaQueryWrapper<WkOrderItem>().eq(WkOrderItem::getOrderId, order.getId()));
- /**鍒犻櫎涓诲崟*/
- asnOrderService.removeById(order.getId());
- } else {
- throw new CoolException("鍗曟嵁宸叉坊鍔狅紝涓嶅彲鎵ц淇敼鎴栨坊鍔犳搷浣滐紒锛�");
+ Loc serviceOne = null;
+ if (!Objects.isNull(syncOrder.getOrgLoc())) {
+ serviceOne = locService.getOne(new LambdaQueryWrapper<Loc>().eq(!Objects.isNull(syncOrder.getOrgLoc()), Loc::getCode, syncOrder.getOrgLoc()));
+ }
+ if (!Objects.isNull(serviceOne)) {
+ //TODO 娣诲姞璋冩嫈绉诲簱鍗曞姛鑳�
+ } else {
+ WkOrder order = asnOrderService.getOne(new LambdaQueryWrapper<WkOrder>()
+ .eq(!Objects.isNull(syncOrder.getOrderId()), WkOrder::getPoId, syncOrder.getOrderId())
+ .eq(WkOrder::getPoCode, syncOrder.getOrderNo()));
+ if (!Objects.isNull(order)) {
+ if (order.getExceStatus().equals(AsnExceStatus.ASN_EXCE_STATUS_UN_EXCE.val) ||
+ order.getExceStatus().equals(AsnExceStatus.OUT_STOCK_STATUS_TASK_INIT.val)) {
+ /**鍒犻櫎鍗曟嵁鏄庣粏*/
+ asnOrderItemService.remove(new LambdaQueryWrapper<WkOrderItem>().eq(WkOrderItem::getOrderId, order.getId()));
+ /**鍒犻櫎涓诲崟*/
+ asnOrderService.removeById(order.getId());
+ } else {
+ throw new CoolException("鍗曟嵁宸叉坊鍔狅紝涓嶅彲鎵ц淇敼鎴栨坊鍔犳搷浣滐紒锛�");
+ }
}
- }
- String rule = SerialRuleCode.SYS_ASN_ORDER;
- if (syncOrder.getType().equals(OrderType.ORDER_OUT.type)) {
- rule = SerialRuleCode.SYS_OUT_STOCK_CODE;
- }
-
- String ruleCode = SerialRuleUtils.generateRuleCode(rule, null);
- wkOrder.setType(syncOrder.getType())
- .setWkType(one.getValue())
- .setAnfme(syncOrder.getAnfme())
- .setPoCode(syncOrder.getOrderNo())
- .setWorkQty(0.0)
- .setQty(0.0)
- .setPoId(syncOrder.getOrderId())
- .setCode(ruleCode)
- .setArrTime(syncOrder.getArrTime())
- .setId(null)
- .setCreateTime(new Date())
- .setUpdateTime(new Date())
- .setCreateBy(loginUserId)
- .setUpdateBy(loginUserId);
- if (!asnOrderService.save(wkOrder)) {
- throw new CoolException("鍗曟嵁淇濆瓨澶辫触锛侊紒");
- }
-
- syncOrder.getOrderItems().forEach(orderItem -> {
- Map<String, Object> map = new ObjectMapper().convertValue(orderItem, Map.class);
- map.put("orderId", wkOrder.getId());
- map.put("poId", wkOrder.getPoId());
- map.put("poCode", wkOrder.getPoCode());
- map.put("order_code", wkOrder.getCode());
- map.put("matnrCode", orderItem.getMatnr());
-
- if (!asnOrderItemService.fieldsSave(map, loginUserId)) {
- throw new CoolException("鏄庣粏淇濆瓨澶辫触锛侊紒");
+ String rule = SerialRuleCode.SYS_ASN_ORDER;
+ if (syncOrder.getType().equals(OrderType.ORDER_OUT.type)) {
+ rule = SerialRuleCode.SYS_OUT_STOCK_CODE;
}
- });
- List<WkOrderItem> orderItems = asnOrderItemService.list(new LambdaQueryWrapper<WkOrderItem>()
- .eq(WkOrderItem::getOrderId, wkOrder.getId()));
- double sum = orderItems.stream().mapToDouble(WkOrderItem::getAnfme).sum();
- wkOrder.setAnfme(sum);
- if (!asnOrderService.updateById(wkOrder)) {
- throw new CoolException("璁″垝鏀惰揣鏁伴噺淇敼澶辫触锛侊紒");
+
+ String ruleCode = SerialRuleUtils.generateRuleCode(rule, null);
+ wkOrder.setType(syncOrder.getType())
+ .setWkType(one.getValue())
+ .setAnfme(syncOrder.getAnfme())
+ .setPoCode(syncOrder.getOrderNo())
+ .setWorkQty(0.0)
+ .setQty(0.0)
+ .setPoId(syncOrder.getOrderId())
+ .setCode(ruleCode)
+ .setArrTime(syncOrder.getArrTime())
+ .setId(null)
+ .setCreateTime(new Date())
+ .setUpdateTime(new Date())
+ .setCreateBy(loginUserId)
+ .setUpdateBy(loginUserId);
+
+ if (syncOrder.getType().equals(OrderType.ORDER_OUT.type)){
+ wkOrder.setExceStatus(AsnExceStatus.OUT_STOCK_STATUS_TASK_INIT.val);
+ }
+
+ if (!asnOrderService.save(wkOrder)) {
+ throw new CoolException("鍗曟嵁淇濆瓨澶辫触锛侊紒");
+ }
+
+ syncOrder.getOrderItems().forEach(orderItem -> {
+ Map<String, Object> map = new ObjectMapper().convertValue(orderItem, Map.class);
+ map.put("orderId", wkOrder.getId());
+ map.put("poId", wkOrder.getPoId());
+ map.put("poCode", wkOrder.getPoCode());
+ map.put("order_code", wkOrder.getCode());
+ map.put("matnrCode", orderItem.getMatnr());
+
+ if (!asnOrderItemService.fieldsSave(map, loginUserId)) {
+ throw new CoolException("鏄庣粏淇濆瓨澶辫触锛侊紒");
+ }
+ });
+ List<WkOrderItem> orderItems = asnOrderItemService.list(new LambdaQueryWrapper<WkOrderItem>()
+ .eq(WkOrderItem::getOrderId, wkOrder.getId()));
+ double sum = orderItems.stream().mapToDouble(WkOrderItem::getAnfme).sum();
+ wkOrder.setAnfme(sum);
+ if (!asnOrderService.updateById(wkOrder)) {
+ throw new CoolException("璁″垝鏀惰揣鏁伴噺淇敼澶辫触锛侊紒");
+ }
}
});
}
--
Gitblit v1.9.1