From 01f39fcb06b8713901975153d0a893e86eca6a88 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期一, 07 七月 2025 19:42:26 +0800
Subject: [PATCH] 33.订单历史管理里面增加单据类型选项按钮、单据类型选项按钮 34.单据管理里面增加单据状态选项按钮 35.入库订单全部都入好了,单据状态还是作业中,现在作业中的单据是可以删除的,我不小心把这个单据删除了,怎么恢复? 36.每个界面点下一页都没反应,点第二页是有变化的,之后点任何页面都没反应 37.订单明细点开后的界面改大一点 38.新增出库订单的时候可以输入客户信息(客户名称、收件人、地址、电话等),现在拣货完成后连发给谁都不知道 39.大屏播种界面对应的数量和开单数量不一致

---
 zy-asrs-wms/src/main/java/com/zy/asrs/wms/utils/OrderUtils.java |  145 ++++++++++++++++++++++++++++--------------------
 1 files changed, 84 insertions(+), 61 deletions(-)

diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/utils/OrderUtils.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/utils/OrderUtils.java
index 5845506..569281a 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/utils/OrderUtils.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/utils/OrderUtils.java
@@ -1,61 +1,84 @@
-package com.zy.asrs.wms.utils;
-
-import com.zy.asrs.framework.exception.CoolException;
-import com.zy.asrs.wms.asrs.entity.Order;
-import com.zy.asrs.wms.asrs.entity.OrderDetl;
-import com.zy.asrs.wms.asrs.entity.enums.OrderSettleType;
-import com.zy.asrs.wms.asrs.service.OrderDetlService;
-import com.zy.asrs.wms.asrs.service.OrderService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.Date;
-
-@Component
-public class OrderUtils {
-
-    @Autowired
-    private OrderService orderService;
-    @Autowired
-    private OrderDetlService orderDetlService;
-
-    @Transactional
-    public void updateWorkQty(Long orderDetlId, Double qty) {
-        OrderDetl orderDetl = orderDetlService.getById(orderDetlId);
-        if(orderDetl == null) {
-            throw new CoolException("璁㈠崟鏄庣粏涓嶅瓨鍦�");
-        }
-
-        Order order = orderService.getById(orderDetl.getOrderId());
-        if(order == null) {
-            throw new CoolException("璁㈠崟涓嶅瓨鍦�");
-        }
-
-        if (order.getOrderSettle() == OrderSettleType.COMPLETE.val()
-                || order.getOrderSettle() == OrderSettleType.CANCEL.val()
-                || order.getOrderSettle() == OrderSettleType.WAIT_CANCEL.val()
-                || order.getOrderSettle() == OrderSettleType.REPORT_COMPLETE.val()) {
-            throw new CoolException("璁㈠崟褰撳墠鐘舵�佷笉鍙慨鏀�");
-        }
-
-        Double workQty = orderDetl.getWorkQty();
-        orderDetl.setWorkQty(workQty + qty);
-        orderDetl.setUpdateTime(new Date());
-        if (!orderDetlService.updateById(orderDetl)) {
-            throw new CoolException("璁㈠崟鏄庣粏鏇存柊澶辫触");
-        }
-
-
-        order.setOrderSettle(OrderSettleType.WORKING.val());
-        order.setUpdateTime(new Date());
-        if(!orderService.updateById(order)) {
-            throw new CoolException("璁㈠崟鏇存柊澶辫触");
-        }
-    }
-
-    public Integer getIoPri() {
-        return 11;
-    }
-
-}
+package com.zy.asrs.wms.utils;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.zy.asrs.framework.exception.CoolException;
+import com.zy.asrs.wms.asrs.entity.Order;
+import com.zy.asrs.wms.asrs.entity.OrderDetl;
+import com.zy.asrs.wms.asrs.entity.enums.OrderSettleType;
+import com.zy.asrs.wms.asrs.service.OrderDetlService;
+import com.zy.asrs.wms.asrs.service.OrderService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.List;
+
+@Component
+public class OrderUtils {
+
+    @Autowired
+    private OrderService orderService;
+    @Autowired
+    private OrderDetlService orderDetlService;
+
+    @Transactional
+    public void updateWorkQty(Long orderDetlId, Double qty) {
+        updateWorkQty(orderDetlId, qty, true);
+    }
+
+    @Transactional
+    public void updateWorkQty(Long orderDetlId, Double qty, boolean increase) {
+        OrderDetl orderDetl = orderDetlService.getById(orderDetlId);
+        if (orderDetl == null) {
+            throw new CoolException("璁㈠崟鏄庣粏涓嶅瓨鍦�");
+        }
+
+        Order order = orderService.getById(orderDetl.getOrderId());
+        if (order == null) {
+            throw new CoolException("璁㈠崟涓嶅瓨鍦�");
+        }
+
+        if (order.getOrderSettle() == OrderSettleType.COMPLETE.val()
+                || order.getOrderSettle() == OrderSettleType.CANCEL.val()
+                || order.getOrderSettle() == OrderSettleType.WAIT_CANCEL.val()
+                || order.getOrderSettle() == OrderSettleType.REPORT_COMPLETE.val()) {
+            throw new CoolException("璁㈠崟褰撳墠鐘舵�佷笉鍙慨鏀�");
+        }
+
+        Double workQty = orderDetl.getWorkQty();
+        if (increase) {
+            orderDetl.setWorkQty(workQty + qty);
+        }else {
+            orderDetl.setWorkQty(workQty - qty);
+        }
+        orderDetl.setUpdateTime(new Date());
+        if (!orderDetlService.updateById(orderDetl)) {
+            throw new CoolException("璁㈠崟鏄庣粏鏇存柊澶辫触");
+        }
+
+        List<OrderDetl> orderDetls = orderDetlService.list(new LambdaQueryWrapper<OrderDetl>().eq(OrderDetl::getOrderId, order.getId()));
+        boolean flag = false;
+        for (OrderDetl detl : orderDetls) {
+            if ((detl.getQty() + detl.getWorkQty()) > 0) {
+                flag = true;
+                break;
+            }
+        }
+
+        if (flag) {
+            order.setOrderSettle(OrderSettleType.WORKING.val());
+        } else {
+            order.setOrderSettle(OrderSettleType.WAIT.val());
+        }
+        order.setUpdateTime(new Date());
+        if (!orderService.updateById(order)) {
+            throw new CoolException("璁㈠崟鏇存柊澶辫触");
+        }
+    }
+
+    public Integer getIoPri() {
+        return 11;
+    }
+
+}

--
Gitblit v1.9.1