From f0c73d72fe7f939be2d3fdf5fc90889971a67fe5 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期二, 11 六月 2024 17:18:25 +0800
Subject: [PATCH] #

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

diff --git a/src/main/java/com/zy/asrs/controller/OrderController.java b/src/main/java/com/zy/asrs/controller/OrderController.java
index 2808a62..fefdf51 100644
--- a/src/main/java/com/zy/asrs/controller/OrderController.java
+++ b/src/main/java/com/zy/asrs/controller/OrderController.java
@@ -625,6 +625,7 @@
         Date now = new Date();
         DataFormatter dataFormatter = new DataFormatter();
         for (int i = 1; i < totalRows; i++) {
+            Integer proSts = 0;
             Row row = sheet.getRow(i);
             //鍗曟嵁绫诲瀷
             String docName =  dataFormatter.formatCellValue(row.getCell(0));
@@ -641,6 +642,7 @@
                 continue;
             }
             Double anfme = Double.parseDouble(dataFormatter.formatCellValue(row.getCell(5)));
+
             Mat mat = matService.selectByMatnr(matnr);
             if (null == mat) {
                 throw new CoolException(matnr + "鍟嗗搧缂栫爜鐨勫晢鍝佷笉瀛樺湪锛岃閲嶆柊瀵煎叆锛�");
@@ -649,6 +651,26 @@
             //String timeStr = DateUtils.convert(new Date());
 
             DocType docType = docTypeService.selectOne(new EntityWrapper<DocType>().eq("doc_name", docName));
+
+            // 鍗曟嵁绫诲瀷涓� 鍗婃垚鍝佸叆搴撳崟鎵嶆湁宸ュ簭
+            if (docType.getDocId().intValue() == 32) {
+                //宸ュ簭
+                if (Cools.isEmpty(dataFormatter.formatCellValue(row.getCell(6)))) {
+                    // 宸ュ簭涓虹┖锛岄粯璁や负鏃犻渶鍔犲伐
+                    proSts = 3;
+                } else {
+                    String processSts = dataFormatter.formatCellValue(row.getCell(6));
+                    //1: 寰呭姞宸� 2锛氬凡鍔犲伐 3锛氭棤闇�鍔犲伐
+                    if ("寰呭姞宸�".equals(processSts)) {
+                        proSts = 1;
+                    } else if ("宸插姞宸�".equals(processSts)) {
+                        proSts = 2;
+                    } else {
+                        proSts = 3;
+                    }
+                }
+            }
+
 
             if(docType.getPakin() == 1){
                 uuid += "_I";
@@ -719,6 +741,7 @@
                 orderDetl.setDeadTime(isocode);
                 orderDetl.setStatus(1);
                 orderDetl.setQty(0.0D);
+                orderDetl.setProcessSts(proSts);
                 if (!orderDetlService.insert(orderDetl)) {
                     throw new CoolException("鐢熸垚鍗曟嵁鏄庣粏澶辫触锛岃閲嶆柊瀵煎叆锛�");
                 }
@@ -727,6 +750,7 @@
                     throw new CoolException("鐢熸垚鍗曟嵁鏄庣粏澶辫触锛岃閲嶆柊瀵煎叆锛�");
                 }
             }
+            // 鐢熸垚璋冩嫧鍗�
             if (docType.getDocId().intValue() == 32) {
                 String dbUuid = "DB" + uuid;
                 Order order2 = orderService.selectByNo(dbUuid);
@@ -801,6 +825,85 @@
                     }
                 }
             }
+
+            // 宸ュ簭涓�1锛氬緟鍔犲伐 鐢熸垚鍔犲伐鍗�
+            if (proSts == 1) {
+                if (docType.getDocId().intValue() == 32) {
+                    String dbUuid = "JG" + uuid;
+                    Order order3 = orderService.selectByNo(dbUuid);
+                    if (null == order3) {
+                        order3 = new Order(
+                                String.valueOf(snowflakeIdWorker.nextId()),    // 缂栧彿[闈炵┖]
+                                dbUuid,    // 璁㈠崟缂栧彿
+                                null,    // 鍗曟嵁鏃ユ湡
+                                35L,    // 鍗曟嵁绫诲瀷
+                                null,    // 椤圭洰缂栧彿
+                                null,    //
+                                null,    // 璋冩嫧椤圭洰缂栧彿
+                                null,    // 鍒濆绁ㄦ嵁鍙�
+                                null,    // 绁ㄦ嵁鍙�
+                                null,    // 瀹㈡埛缂栧彿
+                                null,    // 瀹㈡埛
+                                null,    // 鑱旂郴鏂瑰紡
+                                null,    // 鎿嶄綔浜哄憳
+                                null,    // 鍚堣閲戦
+                                null,    // 浼樻儬鐜�
+                                null,    // 浼樻儬閲戦
+                                null,    // 閿�鍞垨閲囪喘璐圭敤鍚堣
+                                null,    // 瀹炰粯閲戦
+                                null,    // 浠樻绫诲瀷
+                                null,    // 涓氬姟鍛�
+                                null,    // 缁撶畻澶╂暟
+                                null,    // 閭垂鏀粯绫诲瀷
+                                null,    // 閭垂
+                                null,    // 浠樻鏃堕棿
+                                null,    // 鍙戣揣鏃堕棿
+                                null,    // 鐗╂祦鍚嶇О
+                                null,    // 鐗╂祦鍗曞彿
+                                1L,    // 璁㈠崟鐘舵��
+                                1,    // 鐘舵��
+                                userId,    // 娣诲姞浜哄憳
+                                now,    // 娣诲姞鏃堕棿
+                                userId,    // 淇敼浜哄憳
+                                now,    // 淇敼鏃堕棿
+                                null    // 澶囨敞
+                        );
+                        if (!orderService.insert(order3)) {
+                            throw new CoolException("鐢熸垚鍗曟嵁涓绘。澶辫触锛岃閲嶆柊瀵煎叆锛�");
+                        }
+                    }else {
+                        order3.setSettle(order.getSettle() == 1L ? 1L : 2L );
+                        orderService.updateById(order3);
+                    }
+
+                    OrderDetl orderDetl3 = orderDetlService.selectItem(order3.getId(), matnr, null,csocode,isocode);
+                    if (orderDetl3 == null) {
+                        orderDetl3 = new OrderDetl();
+                        orderDetl3.sync(mat);
+                        orderDetl3.setSource(35);
+                        orderDetl3.setBatch(null);
+                        orderDetl3.setAnfme(anfme);
+                        orderDetl3.setOrderId(order3.getId());
+                        orderDetl3.setOrderNo(order3.getOrderNo());
+                        orderDetl3.setCreateBy(userId);
+                        orderDetl3.setCreateTime(now);
+                        orderDetl3.setUpdateBy(userId);
+                        orderDetl3.setUpdateTime(now);
+                        orderDetl3.setThreeCode(csocode);
+                        orderDetl3.setDeadTime(isocode);
+                        orderDetl3.setStatus(1);
+                        orderDetl3.setQty(0.0D);
+                        if (!orderDetlService.insert(orderDetl3)) {
+                            throw new CoolException("鐢熸垚鍗曟嵁鏄庣粏澶辫触锛岃閲嶆柊瀵煎叆锛�");
+                        }
+                    } else {
+                        if(!orderDetlService.increaseAnfme(order3.getId(), matnr, null, anfme,csocode,isocode)) {
+                            throw new CoolException("鐢熸垚鍗曟嵁鏄庣粏澶辫触锛岃閲嶆柊瀵煎叆锛�");
+                        }
+                    }
+                }
+            }
+
         }
         return R.ok("瀵煎叆鎴愬姛");
     }

--
Gitblit v1.9.1