From 7102e9faca7b1cc6da94be325831c13d0301d7f6 Mon Sep 17 00:00:00 2001
From: zwl <1051256694@qq.com>
Date: 星期一, 09 二月 2026 14:42:43 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/third/task/handler/OrderHandler.java | 68 +++++++++++++++++++++++++++++-----
1 files changed, 58 insertions(+), 10 deletions(-)
diff --git a/src/main/java/com/zy/third/task/handler/OrderHandler.java b/src/main/java/com/zy/third/task/handler/OrderHandler.java
index d5015da..cfcd8b7 100644
--- a/src/main/java/com/zy/third/task/handler/OrderHandler.java
+++ b/src/main/java/com/zy/third/task/handler/OrderHandler.java
@@ -117,7 +117,7 @@
//鐢熸垚瀛愬崟涓昏〃
Order1 order1 = new Order1(
- String.valueOf(snowflakeIdWorker.nextId()), // 缂栧彿[闈炵┖]
+ String.valueOf(order.getUuid()), // 缂栧彿[闈炵┖]
fbillno, // 璁㈠崟缂栧彿
DateUtils.convert(exdInstockSource.get(0).getFdate()), // 鍗曟嵁鏃ユ湡
docType.getDocId(), // 鍗曟嵁绫诲瀷
@@ -211,18 +211,41 @@
}
@Transactional
- public ReturnT<String> deletereadInOrder(List<ExdInstockSource> exdInstockSource) {
- String fbillno = exdInstockSource.get(0).getFbillno();
+ public ReturnT<String> deletereadInOrder(ExdInstockSource exdInstockSource) {
+ String fbillno = exdInstockSource.getFbillno();
Order order = orderService.selectByNo(fbillno);
- if (!Cools.isEmpty(order)&&order.getStatus()>1) {
+ if (!Cools.isEmpty(order)) {
if (order.getSettle() > 1L) {
throw new CoolException(fbillno + "鍗曟嵁姝e湪浣滀笟涓紝鏃犳硶鍒犻櫎");
}
- orderService.remove(order.getId());
+ Mat mat = matService.selectBySku(exdInstockSource.getFitemid() + "");
+ OrderDetl orderDetl = orderDetlService.selectOne(new EntityWrapper<OrderDetl>().eq("order_no", order.getOrderNo())
+ .eq("matnr", mat.getMatnr())
+ .eq("batch", exdInstockSource.getFbatchno())
+ .eq("anfme", exdInstockSource.getFqty()<0 ? -exdInstockSource.getFqty():exdInstockSource.getFqty()));
+ if (orderDetl != null) {
+ boolean delete = orderDetlService.deleteById(orderDetl.getId());
+ if (delete) {
+ log.info("鍒犻櫎璁㈠崟鏄庣粏鎴愬姛锛岃鍗曞彿={},鐗╂枡鍙�={}锛屾壒鍙�={}锛屾暟閲�={}鎴愬姛",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty());
+ }else {
+ log.error("鍒犻櫎璁㈠崟鏄庣粏澶辫触锛岃鍗曞彿={},鐗╂枡鍙�={}锛屾壒鍙�={}锛屾暟閲�={}",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty());
+ throw new CoolException(fbillno + "鍗曟嵁鏄庣粏鍒犻櫎澶辫触");
+ }
+ }else {
+ log.error("娌℃湁鏌ヨ鍒拌鍗曟槑缁嗭紝璁㈠崟鍙�={},鐗╂枡鍙�={}锛屾壒鍙�={}锛屾暟閲�={}",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty());
+ throw new CoolException(fbillno + "娌℃湁鏌ヨ鍒拌鍗曟槑缁�");
+ }
+
+ int orderNo = orderDetlService.selectCount(new EntityWrapper<OrderDetl>().eq("order_no", order.getOrderNo()));
+ if(orderNo==0){
+ orderService.remove(order.getId());
+ log.info("鍒犻櫎璁㈠崟涓昏〃鎴愬姛锛岃鍗�={}",order.getOrderNo());
+ }
+ }else if(Cools.isEmpty(order)){
+ throw new CoolException(fbillno + "鍗曟嵁涓哄湪WMS涓壘鍒�");
}
return SUCCESS;
}
-
@Transactional
public ReturnT<String> readOutOrder(List<ExdOutstockSource> exdOutstockSource) {
@@ -328,14 +351,39 @@
}
@Transactional
- public ReturnT<String> deletereadOutOrder(List<ExdOutstockSource> exdInstockSource) {
- String fbillno = exdInstockSource.get(0).getFbillno();
+ public ReturnT<String> deletereadOutOrder(ExdOutstockSource exdInstockSource) {
+ String fbillno = exdInstockSource.getFbillno();
Order order = orderService.selectByNo(fbillno);
- if (!Cools.isEmpty(order)&&order.getStatus()>1) {
+ if (!Cools.isEmpty(order)) {
if (order.getSettle() > 1L) {
throw new CoolException(fbillno + "鍗曟嵁姝e湪浣滀笟涓紝鏃犳硶鍒犻櫎");
}
- orderService.remove(order.getId());
+ Mat mat = matService.selectBySku(exdInstockSource.getFitemid() + "");
+ OrderDetl orderDetl = orderDetlService.selectOne(new EntityWrapper<OrderDetl>().eq("order_no", order.getOrderNo())
+ .eq("matnr", mat.getMatnr())
+ .eq("batch", exdInstockSource.getFbatchno())
+ .eq("anfme", exdInstockSource.getFqty()<0 ? -exdInstockSource.getFqty():exdInstockSource.getFqty()));
+ if (orderDetl != null) {
+ boolean delete = orderDetlService.deleteById(orderDetl.getId());
+ if (delete) {
+ log.info("鍒犻櫎璁㈠崟鏄庣粏鎴愬姛锛岃鍗曞彿={},鐗╂枡鍙�={}锛屾壒鍙�={}锛屾暟閲�={}鎴愬姛",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty());
+ }else {
+ log.error("鍒犻櫎璁㈠崟鏄庣粏澶辫触锛岃鍗曞彿={},鐗╂枡鍙�={}锛屾壒鍙�={}锛屾暟閲�={}",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty());
+ throw new CoolException(fbillno + "鍗曟嵁鏄庣粏鍒犻櫎澶辫触");
+ }
+ }else {
+ log.error("娌℃湁鏌ヨ鍒拌鍗曟槑缁嗭紝璁㈠崟鍙�={},鐗╂枡鍙�={}锛屾壒鍙�={}锛屾暟閲�={}",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty());
+ throw new CoolException(fbillno + "娌℃湁鏌ヨ鍒拌鍗曟槑缁�");
+ }
+ int orderNo = orderDetlService.selectCount(new EntityWrapper<OrderDetl>().eq("order_no", order.getOrderNo()));
+ if(orderNo==0){
+ orderService.remove(order.getId());
+ log.info("鍒犻櫎璁㈠崟涓昏〃鎴愬姛锛岃鍗�={}",order.getOrderNo());
+ }
+
+
+ }else if (Cools.isEmpty(order)) {
+ throw new CoolException(fbillno + "鍗曟嵁鏈湪WMS涓壘鍒�");
}
return SUCCESS;
}
--
Gitblit v1.9.1