From c135b2adb55f470ca20b434ed71ae48d8874d6b0 Mon Sep 17 00:00:00 2001
From: zyx <zyx123456>
Date: 星期日, 07 四月 2024 11:05:06 +0800
Subject: [PATCH] 订单系统bug

---
 src/main/java/com/zy/asrs/controller/OrderController.java |   74 +++++++++++++++++++++++++------------
 1 files changed, 50 insertions(+), 24 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/OrderController.java b/src/main/java/com/zy/asrs/controller/OrderController.java
index 7db8719..3f53cf3 100644
--- a/src/main/java/com/zy/asrs/controller/OrderController.java
+++ b/src/main/java/com/zy/asrs/controller/OrderController.java
@@ -98,6 +98,30 @@
         return R.ok(orderService.selectPage(new Page<>(curr, limit), wrapper));
     }
 
+    //  鎵�鏈夊叆搴撹鍗�
+    @RequestMapping(value = "/order/detls/in/page/auth")
+    @ManagerAuth
+    public R orderDetls(@RequestParam(defaultValue = "1")Integer curr,
+                  @RequestParam(defaultValue = "10000")Integer limit,
+                  @RequestParam(required = false)String orderByField,
+                  @RequestParam(required = false)String orderByType,
+                  @RequestParam Map<String, Object> param){
+        EntityWrapper<Order> wrapper = new EntityWrapper<>();
+        excludeTrash(param);
+        convert(param, wrapper);
+        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} else {
+            wrapper.orderBy("settle").orderBy("create_time", false);
+        }
+        wrapper.eq("status", 1);
+        List<DocType> pakins = docTypeService.selectList(new EntityWrapper<DocType>().eq("pakin", 1));
+        List<Long> docIds = new ArrayList<>();
+        for (DocType pakin : pakins) {
+            docIds.add(pakin.getDocId());
+        }
+        wrapper.in("doc_type",docIds);
+        return R.ok(orderService.selectPage(new Page<>(curr, limit), wrapper));
+    }
+
     @RequestMapping(value = "/order/detl/all/auth")
     @ManagerAuth
     public R head(@RequestParam Long orderId){
@@ -439,34 +463,34 @@
         DataFormatter dataFormatter = new DataFormatter();
         for (int i = 1; i < totalRows; i++) {
             Row row = sheet.getRow(i);
-            // 璁㈠崟缂栧彿
-            String uuid = dataFormatter.formatCellValue(row.getCell(0));
-            // 鐗╂枡鍙�
-            String maktx = dataFormatter.formatCellValue(row.getCell(1));
-            // 鐗╂枡鍙�
+            //鍗曟嵁绫诲瀷
+            String docName =  dataFormatter.formatCellValue(row.getCell(0));
+            //鍗曟嵁缂栧彿
+            String uuid = dataFormatter.formatCellValue(row.getCell(1));
+            //鐗╂枡鍙�
             String matnr = dataFormatter.formatCellValue(row.getCell(2));
+            //閿�鍞崟鍙�
+            String csocode = dataFormatter.formatCellValue(row.getCell(3));
+            //鑷敱椤�
+            String isocode = dataFormatter.formatCellValue(row.getCell(4));
             // 鏁伴噺
-            Double anfme = Double.parseDouble(dataFormatter.formatCellValue(row.getCell(3)));
-            // 涓嬪崟鏃堕棿
-            String timeStr = dataFormatter.formatCellValue(row.getCell(4));
-            // 閿�鍞鍗曞彿
-            String csocode = dataFormatter.formatCellValue(row.getCell(5));
-            // 閿�鍞鍗曡鍙�
-            String isocode = dataFormatter.formatCellValue(row.getCell(6));
-            Date time = null;
-            try {
-                time = DateUtils.convert(timeStr, DateUtils.yyyyMMddHHmmss_F);
-            } catch (Exception e) {
-                throw new CoolException("绗�" + i + "琛屼笅鐨勯偅鏃堕棿瑙f瀽澶辫触锛岃閲嶆柊瀵煎叆锛�");
+            if(Cools.isEmpty(dataFormatter.formatCellValue(row.getCell(5)))){
+                continue;
             }
-            // 鍟嗗搧绯诲垪
-            String tagName = dataFormatter.formatCellValue(row.getCell(5));
-            // 瑙勬牸
-            String specs = dataFormatter.formatCellValue(row.getCell(6));
-
+            Double anfme = Double.parseDouble(dataFormatter.formatCellValue(row.getCell(5)));
             Mat mat = matService.selectByMatnr(matnr);
             if (null == mat) {
                 throw new CoolException(matnr + "鍟嗗搧缂栫爜鐨勫晢鍝佷笉瀛樺湪锛岃閲嶆柊瀵煎叆锛�");
+            }
+
+            //String timeStr = DateUtils.convert(new Date());
+
+            DocType docType = docTypeService.selectOne(new EntityWrapper<DocType>().eq("doc_name", docName));
+
+            if(docType.getPakin() == 1){
+                uuid += "_I";
+            }else {
+                uuid += "_O";
             }
 
             Order order = orderService.selectByNo(uuid);
@@ -474,8 +498,8 @@
                 order = new Order(
                         String.valueOf(snowflakeIdWorker.nextId()),    // 缂栧彿[闈炵┖]
                         uuid,    // 璁㈠崟缂栧彿
-                        timeStr,    // 鍗曟嵁鏃ユ湡
-                        14L,    // 鍗曟嵁绫诲瀷
+                        null,    // 鍗曟嵁鏃ユ湡
+                        docType.getDocId(),    // 鍗曟嵁绫诲瀷
                         null,    // 椤圭洰缂栧彿
                         null,    //
                         null,    // 璋冩嫧椤圭洰缂栧彿
@@ -524,6 +548,8 @@
                 orderDetl.setCreateTime(now);
                 orderDetl.setUpdateBy(userId);
                 orderDetl.setUpdateTime(now);
+                orderDetl.setThreeCode(csocode);
+                orderDetl.setDeadTime(isocode);
                 orderDetl.setStatus(1);
                 orderDetl.setQty(0.0D);
                 if (!orderDetlService.insert(orderDetl)) {

--
Gitblit v1.9.1