From 4c4b488961660194d75e910e476ede81e6061b3d Mon Sep 17 00:00:00 2001
From: 王佳豪 <g675230687@126.com>
Date: 星期三, 05 五月 2021 12:58:10 +0800
Subject: [PATCH] 1.立库、平库入库修改功能调整,生产单号列前置 2.erp对接功能微调

---
 src/main/java/com/zy/asrs/service/impl/LocNormalServiceImpl.java |   34 ++++++++++
 src/main/java/com/zy/common/service/erp/ErpService.java          |    4 
 src/main/resources/mapper/LocNormalMapper.xml                    |    4 
 src/main/webapp/static/js/locNormal/locNormalIn.js               |   36 ++++++++++--
 src/main/webapp/static/js/pakStore/outStock.js                   |   18 +++---
 src/main/webapp/static/js/pakStore/pakStore.js                   |   44 ++++++++++++--
 src/main/webapp/views/locNormal/locNormalIn.html                 |    2 
 7 files changed, 113 insertions(+), 29 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/LocNormalServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/LocNormalServiceImpl.java
index 1d9ec03..ae26fdb 100644
--- a/src/main/java/com/zy/asrs/service/impl/LocNormalServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/LocNormalServiceImpl.java
@@ -64,11 +64,11 @@
                         CPICMO cpicmo = select.get(0);
                         boolean complete = false;
                         if (cpicmo.getFQty() > 0) {
-                            if (cpicmo.getFAuxCommitQty() >= cpicmo.getFQty()) {
+                            if (cpicmo.getFAuxCommitQty() == cpicmo.getFQty()) {
                                 complete = true;
                             }
                         } else {
-                            if (cpicmo.getFAuxCommitQty() >= cpicmo.getFAuxQty()) {
+                            if (cpicmo.getFAuxCommitQty() == cpicmo.getFAuxQty()) {
                                 complete = true;
                             }
                         }
@@ -96,6 +96,36 @@
 
     @Override
     public void pdaLocNormalIn(List<LocNormal> list) {
+        // 骞充粨鍏ュ簱鍚庢洿鏂颁腑闂磋〃鏁版嵁锛孎flag_finish鏀逛负1锛岃〃绀哄钩浠撳叆搴撴垚鍔�
+        if (list.size() > 0) {
+            for (Integer i = 0; i < list.size(); i++) {
+                if (!Cools.isEmpty(list.get(i).getSupplier())) { // 瀛樺湪鍏ュ簱鍗曞彿鐨勬墠杩涜erp鏇存柊
+                    String sql = "update CPICMO set FAuxCommitQty = (FAuxCommitQty + {0,number,#}) where 1=1 and Fnumber = ''{1}'' and FBillNo = ''{2}''";
+                    sql = MessageFormat.format(sql, list.get(i).getAnfme(), list.get(i).getMatnr(), list.get(i).getSupplier());
+                    if (erpSqlServer.update(sql) > 0) {
+                        sql = "select * from CPICMO where 1=1 and Fnumber = ''{0}'' and FBillNo = ''{1}''";
+                        sql = MessageFormat.format(sql, list.get(i).getMatnr(), list.get(i).getSupplier());
+                        List<CPICMO> select = erpSqlServer.select(sql, CPICMO.class);
+                        CPICMO cpicmo = select.get(0);
+                        boolean complete = false;
+                        if (cpicmo.getFQty() > 0) {
+                            if (cpicmo.getFAuxCommitQty() == cpicmo.getFQty()) {
+                                complete = true;
+                            }
+                        } else {
+                            if (cpicmo.getFAuxCommitQty() == cpicmo.getFAuxQty()) {
+                                complete = true;
+                            }
+                        }
+                        if (complete) {
+                            if (!completeCPakIn(list.get(i).getSupplier(), list.get(i).getMatnr())) {
+                                log.error("{}骞充粨鍏ュ簱鍗曟爣璁板畬鎴愬け璐�", list.get(i).getSupplier());
+                            }
+                        }
+                    }
+                }
+            }
+        }
         baseMapper.pdaLocNormalIn(list);
     }
 
diff --git a/src/main/java/com/zy/common/service/erp/ErpService.java b/src/main/java/com/zy/common/service/erp/ErpService.java
index c768af8..6997bb0 100644
--- a/src/main/java/com/zy/common/service/erp/ErpService.java
+++ b/src/main/java/com/zy/common/service/erp/ErpService.java
@@ -154,11 +154,11 @@
             CPICMO cpicmo = select.get(0);
             boolean complete = false;
             if (cpicmo.getFQty() > 0) {
-                if (cpicmo.getFAuxCommitQty() >= cpicmo.getFQty()) {
+                if (cpicmo.getFAuxCommitQty() == cpicmo.getFQty()) {
                     complete = true;
                 }
             } else {
-                if (cpicmo.getFAuxCommitQty() >= cpicmo.getFAuxQty()) {
+                if (cpicmo.getFAuxCommitQty() == cpicmo.getFAuxQty()) {
                     complete = true;
                 }
             }
diff --git a/src/main/resources/mapper/LocNormalMapper.xml b/src/main/resources/mapper/LocNormalMapper.xml
index ad6e775..32c52f4 100644
--- a/src/main/resources/mapper/LocNormalMapper.xml
+++ b/src/main/resources/mapper/LocNormalMapper.xml
@@ -47,11 +47,11 @@
     <insert id="locNormalIn">
         BEGIN
         <foreach collection="list" item="item" index="index">
-            INSERT INTO asr_loc_normal (matnr, maktx, anfme, altme, lgnum, type, supplier, brand, warehouse, state,
+            INSERT INTO asr_loc_normal (matnr, maktx, anfme, altme, lgnum, type, mnemonic, supplier, brand, warehouse, state,
             appe_user, appe_time)
             VALUES (#{item.matnr,jdbcType=VARCHAR}, #{item.maktx,jdbcType=VARCHAR}, #{item.anfme,jdbcType=DECIMAL},
             #{item.altme,jdbcType=VARCHAR},#{item.lgnum, jdbcType=VARCHAR}, #{item.type, jdbcType=VARCHAR},
-            #{item.supplier, jdbcType=VARCHAR},#{item.brand, jdbcType=VARCHAR},
+            #{item.mnemonic, jdbcType=VARCHAR} ,#{item.supplier, jdbcType=VARCHAR},#{item.brand, jdbcType=VARCHAR},
             #{item.warehouse,jdbcType=VARCHAR}, '1', #{item.appeUser,jdbcType=DECIMAL},
             #{item.appeTime,jdbcType=TIMESTAMP})
         </foreach>
diff --git a/src/main/webapp/static/js/locNormal/locNormalIn.js b/src/main/webapp/static/js/locNormal/locNormalIn.js
index 88d3563..36a3723 100644
--- a/src/main/webapp/static/js/locNormal/locNormalIn.js
+++ b/src/main/webapp/static/js/locNormal/locNormalIn.js
@@ -15,12 +15,17 @@
             style: 'color: blue;font-weight: bold'
         }
     ];
-    locNormalCols.map(function (item) {
-        if (item.field === 'supplier' || item.field === 'mnemonic') {
-            item.edit = 'text';
-        }
-    })
-    cols.push.apply(cols, locNormalCols);
+    var locNormalColsSelf = [
+        {field: 'mnemonic', align: 'center',title: '鐢熶骇鍗曞彿', edit: 'text'}
+        ,{field: 'matnr', align: 'center',title: '鐗╂枡缂栫爜'}
+        ,{field: 'maktx', align: 'center',title: '鐗╂枡鍚嶇О', width: 400}
+        ,{field: 'lgnum', align: 'center',title: '瑙勬牸'}
+        ,{field: 'type', align: 'center',title: '鐗╂枡绫诲埆'}
+        ,{field: 'supplier', align: 'center',title: '閫氱煡鍗曞彿', edit: 'text'}
+        ,{field: 'brand', align: 'center',title: '鍝佺墝', hide: true}
+        ,{field: 'altme', align: 'center',title: '鍗曚綅', hide: true}
+    ];
+    cols.push.apply(cols, locNormalColsSelf);
     // cols.push({field: 'matStatus', title: '鐗╂枡鐘舵��', align: 'center', width: 120, templet: '#matStatus'});
     cols.push({fixed: 'right', title: '鎿嶄綔', align: 'center', toolbar: '#operate', width: 80});
     return cols;
@@ -54,6 +59,9 @@
         if (obj.field === 'anfme') {
             updateMatCodeData(obj.data.matnr, Number(obj.value), obj.data.index);
         }
+        if (obj.field === 'supplier' || obj.field === 'mnemonic') {
+            updateMatCodeData2(obj.data.matnr, obj.value, obj.data.index, obj.field);
+        }
     });
 
     // 鐩戝惉澶村伐鍏锋爮浜嬩欢
@@ -75,6 +83,10 @@
                     }
                     if (matCodeData[i].anfme === 0) {
                         layer.msg("鏁伴噺涓嶈兘涓洪浂");
+                        return;
+                    }
+                    if (matCodeData[i].mnemonic == null || matCodeData[i].mnemonic == '' || matCodeData[i].mnemonic == undefined) {
+                        layer.msg("璇疯緭鍏ョ敓浜у崟鍙�");
                         return;
                     }
                 }
@@ -163,6 +175,18 @@
         });
     }
 
+    function updateMatCodeData2(matnr, value, index, field) {
+        for (var i = 0; i < matCodeData.length; i++) {
+            if (matCodeData[i]["matnr"] === matnr && matCodeData[i]["index"] === index) {
+                matCodeData[i][field] = value;
+            }
+        }
+
+        tableIns.reload({
+            data: matCodeData,
+        });
+    }
+
     // 鑾峰彇鍙敤鍏ュ簱绔欑偣
     function getInBound() {
         // 鑾峰彇浠撳簱涓嬫媺
diff --git a/src/main/webapp/static/js/pakStore/outStock.js b/src/main/webapp/static/js/pakStore/outStock.js
index 2e70dac..ece596f 100644
--- a/src/main/webapp/static/js/pakStore/outStock.js
+++ b/src/main/webapp/static/js/pakStore/outStock.js
@@ -6,20 +6,20 @@
 function getCol() {
     var cols = [];
     cols.push(
-        {field: 'fbillNo', merge: true, align: 'center', title: '鍗曟嵁缂栧彿'}
-        , {field: 'fsourceBillNo', align: 'center', title: '璁㈠崟鍗曞彿' }
-        , {field: 'fnumber', align: 'center', title: '鐗╂枡缂栧彿'}
+        {field: 'fbillNo', merge: true, align: 'center', title: '鍗曟嵁缂栧彿', width: 150}
+        , {field: 'fsourceBillNo', align: 'center', title: '璁㈠崟鍗曞彿', width: 100}
+        , {field: 'fnumber', align: 'center', title: '鐗╂枡缂栧彿', width: 140}
         , {field: 'fname', align: 'center', title: '鐗╂枡鍚嶇О'}
-        , {field: 'fmodel', align: 'center', title: '瑙勬牸'}
-        , {field: 'fentryID', align: 'center', title: '鍒嗗綍鍙�'}
+        , {field: 'fmodel', align: 'center', title: '瑙勬牸', width: 200}
+        , {field: 'fentryID', align: 'center', title: '鍒嗗綍鍙�', width: 80}
         , {field: 'forderInterID', align: 'center', title: '鍗曟嵁缂栧彿', hide: true}
-        , {field: 'fauxQty', align: 'center', title: '鏁伴噺'}
-        , {field: 'fcommitQty', align: 'center', title: '鍙戣揣鏁伴噺'}
-        , {field: 'fauxPrice', align: 'center', title: '鍗曚环'}
+        , {field: 'fauxQty', align: 'center', title: '鏁伴噺', width: 100}
+        // , {field: 'fcommitQty', align: 'center', title: '鍙戣揣鏁伴噺'}
+        , {field: 'fauxPrice', align: 'center', title: '鍗曚环', width: 100}
         , {field: 'fdate', align: 'center', title: '鏃ユ湡', hide: true}
         , {field: 'fnote', align: 'center', title: '澶囨敞', hide: true}
         , {field: 'fadd', align: 'center', title: '鍦板潃', hide: true}
-        , {merge: ['fbillNo'], title: '鎿嶄綔', align: 'center', toolbar: '#operate', width: 140}
+        , {merge: ['fbillNo'], title: '鎿嶄綔', align: 'center', toolbar: '#operate', width: 160}
     );
     return cols;
 }
diff --git a/src/main/webapp/static/js/pakStore/pakStore.js b/src/main/webapp/static/js/pakStore/pakStore.js
index b9d27f0..8ba81be 100644
--- a/src/main/webapp/static/js/pakStore/pakStore.js
+++ b/src/main/webapp/static/js/pakStore/pakStore.js
@@ -14,13 +14,24 @@
             style: 'color: blue;font-weight: bold'
         }
     ];
-    matCols.map(function (item) {
-        if (item.field === 'str6' || item.field === 'str5') {
-            item.edit = 'text';
-            item.style = 'color: blue;font-weight: bold';
-        }
-    })
-    cols.push.apply(cols, matCols);
+    var matColsSelf = [
+        {field: 'str5', align: 'center',title: '鐢熶骇鍗曞彿', edit: 'text'}
+        ,{field: 'matNo', align: 'center',title: '鐗╂枡缂栫爜'}
+        ,{field: 'barcode', align: 'center',title: '鏉″舰鐮�', hide: true}
+        ,{field: 'matName', align: 'center',title: '鐗╂枡鍚嶇О', width: 500}
+        ,{field: 'str2', align: 'center',title: '鐗╂枡绫诲埆'}
+        ,{field: 'str3', align: 'center',title: '瑙勬牸鍨嬪彿'}
+        ,{field: 'str1', align: 'center',title: '鍩烘湰鍗曚綅', hide: true}
+        ,{field: 'str4', align: 'center',title: '鐘舵��', hide: true}
+        ,{field: 'str6', align: 'center',title: '閫氱煡鍗曞彿', edit: 'text'}
+        ,{field: 'str7', align: 'center',title: '榛樿浠撳簱', hide: true}
+        ,{field: 'str17', align: 'center',title: '鍙噰璐�', hide: true}
+        ,{field: 'str18', align: 'center',title: '鍙负瀛愪欢', hide: true}
+        ,{field: 'str21', align: 'center',title: '鎴愭湰璁$畻鏂规硶', hide: true}
+        ,{field: 'str22', align: 'center',title: '閲囪喘鍗曚綅', hide: true}
+        ,{field: 'str23', align: 'center',title: '閿�鍞崟浣�', hide: true}
+    ];
+    cols.push.apply(cols, matColsSelf);
     cols.push({field: 'matStatus', title: '鐗╂枡鐘舵��', align: 'center', width: 120, templet: '#matStatus'});
     cols.push({fixed: 'right', title: '鎿嶄綔', align: 'center', toolbar: '#operate', width: 80});
     return cols;
@@ -54,6 +65,9 @@
         if (obj.field === 'count') {
             updateMatCodeData(obj.data.matNo, Number(obj.value));
         }
+        if (obj.field === 'str5' || obj.field === 'str6') {
+            updateMatCodeData2(obj.data.matnr, obj.value, obj.data.index, obj.field);
+        }
     });
 
     // 鐩戝惉澶村伐鍏锋爮浜嬩欢
@@ -75,6 +89,10 @@
                     }
                     if (matCodeData[i].count === 0) {
                         layer.msg("鏁伴噺涓嶈兘涓洪浂");
+                        return;
+                    }
+                    if (matCodeData[i].str5 == null || matCodeData[i].str5 == '' || matCodeData[i].str5 == undefined) {
+                        layer.msg("璇疯緭鍏ョ敓浜у崟鍙�");
                         return;
                     }
                 }
@@ -161,6 +179,18 @@
         });
     }
 
+    function updateMatCodeData2(matnr, value, index, field) {
+        for (var i = 0; i < matCodeData.length; i++) {
+            if (matCodeData[i]["matnr"] === matnr && matCodeData[i]["index"] === index) {
+                matCodeData[i][field] = value;
+            }
+        }
+
+        tableIns.reload({
+            data: matCodeData,
+        });
+    }
+
     // 鑾峰彇鍙敤鍏ュ簱绔欑偣
     function getInBound() {
         $.ajax({
diff --git a/src/main/webapp/views/locNormal/locNormalIn.html b/src/main/webapp/views/locNormal/locNormalIn.html
index 65c0c15..2c0f375 100644
--- a/src/main/webapp/views/locNormal/locNormalIn.html
+++ b/src/main/webapp/views/locNormal/locNormalIn.html
@@ -95,7 +95,7 @@
                 <select id="putSiteSelect" lay-verify="required">
                     <option value="">璇烽�夋嫨搴撳尯</option>
                 </select>
-                <!-- 2.鍚姩鍑哄簱 -->
+                <!-- 2.鍚姩鍏ュ簱 -->
                 <button class="layui-btn layui-btn-normal layui-btn-lg" id="btn-locIn" lay-event="comb">鍚姩鍏ュ簱</button>
             </div>
         </div>

--
Gitblit v1.9.1