From 7d192a9b10311d7d5437a320aa74a98dd8bd601e Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期一, 19 六月 2023 17:11:33 +0800
Subject: [PATCH] #单据增加重量字段、导出excel

---
 src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java |   39 +++++++++++++++++++++++++++++++++++----
 1 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java b/src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
index 62e76f1..79fb6e8 100644
--- a/src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
+++ b/src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
@@ -37,6 +37,8 @@
     private OrderDetlService orderDetlService;
     @Autowired
     private OrderService orderService;
+    @Autowired
+    private ManPakOutService manPakOutService;
 
     public ReturnT<String> start(WrkMast wrkMast) {
         // 4.鍏ュ簱瀹屾垚
@@ -180,6 +182,19 @@
                                 }
                             }
                         } catch (Exception ignore){}
+
+                        //鏇存柊鎷h揣鍗曞畬鎴愭暟閲�
+                        EntityWrapper<ManPakOut> manPakOutEntityWrapper = new EntityWrapper<>();
+                        manPakOutEntityWrapper.eq("doc_num",wrkDetl.getOrderNo());
+                        manPakOutEntityWrapper.eq("matnr",wrkDetl.getMatnr());
+                        ManPakOut manPakOut = manPakOutService.selectOne(manPakOutEntityWrapper);
+                        manPakOut.setCount(manPakOut.getCount() + wrkDetl.getAnfme());
+                        if (manPakOut.getCount() + wrkDetl.getAnfme() == manPakOut.getAnfme()){
+                            manPakOut.setStatus(1);
+                        }
+                        if (!manPakOutService.update(manPakOut,manPakOutEntityWrapper)){
+                            return FAIL.setMsg("鏇存柊鎷h揣鍗曞畬鎴愭暟閲忓け璐�");
+                        }
 
                     }
                     // 淇敼搴撲綅鐘舵�� Q ====>> F
@@ -367,15 +382,31 @@
                             return FAIL.setMsg("鍏ㄦ澘鍑哄簱 ===>> 淇敼婧愬簱浣嶇姸鎬佸け璐�; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getSourceLocNo() + "]");
                         }
                     }
+                    //鏇存柊璁㈠崟瀹屾垚鏁伴噺
                     EntityWrapper<OrderDetl> orderDetlEntityWrapper = new EntityWrapper<>();
                     orderDetlEntityWrapper.eq("order_no",wrkDetls101.get(0).getOrderNo());
                     orderDetlEntityWrapper.eq("matnr",wrkDetls101.get(0).getMatnr());
-                    OrderDetl orderDetl = new OrderDetl();
-                    orderDetl.setQty(wrkDetls101.get(0).getAnfme());
-                    orderDetl.setUpdateTime(now);
-                    if (!orderDetlService.update(orderDetl,orderDetlEntityWrapper)){
+
+                    OrderDetl orderDetl = orderDetlService.selectOne(orderDetlEntityWrapper);
+
+                    OrderDetl orderDetl1 = new OrderDetl();
+                    orderDetl1.setQty(orderDetl.getQty() + wrkDetls101.get(0).getAnfme());
+                    orderDetl1.setUpdateTime(now);
+                    if (!orderDetlService.update(orderDetl1,orderDetlEntityWrapper)){
                         return FAIL.setMsg("鏇存柊璁㈠崟瀹屾垚鏁伴噺澶辫触");
                     }
+                    //鏇存柊鎷h揣鍗曞畬鎴愭暟閲�
+                    EntityWrapper<ManPakOut> manPakOutEntityWrapper = new EntityWrapper<>();
+                    manPakOutEntityWrapper.eq("doc_num",wrkDetls101.get(0).getOrderNo());
+                    manPakOutEntityWrapper.eq("matnr",wrkDetls101.get(0).getMatnr());
+                    ManPakOut manPakOut = manPakOutService.selectOne(manPakOutEntityWrapper);
+                    manPakOut.setCount(manPakOut.getCount() + wrkDetls101.get(0).getAnfme());
+                    if (manPakOut.getCount() + wrkDetls101.get(0).getAnfme() == manPakOut.getAnfme()){
+                        manPakOut.setStatus(1);
+                    }
+                    if (!manPakOutService.update(manPakOut,manPakOutEntityWrapper)){
+                        return FAIL.setMsg("鏇存柊鎷h揣鍗曞畬鎴愭暟閲忓け璐�");
+                    }
 
 
                     Boolean finsihed = orderDetlService.checkAllDetlFinish(wrkDetls101.get(0).getOrderNo());

--
Gitblit v1.9.1