From e72d75462010729913d1127bd3c1418726b41992 Mon Sep 17 00:00:00 2001
From: 王佳豪 <g675230687@126.com>
Date: 星期三, 05 五月 2021 14:16:38 +0800
Subject: [PATCH] 1.平仓入库erp单号对应功能实现

---
 src/main/java/com/zy/asrs/service/impl/LocNormalServiceImpl.java |   52 +++++++++++++++++++++++++++++++---------------------
 src/main/webapp/static/js/locNormal/locNormalIn.js               |    6 +++++-
 2 files changed, 36 insertions(+), 22 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 ae26fdb..da76c25 100644
--- a/src/main/java/com/zy/asrs/service/impl/LocNormalServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/LocNormalServiceImpl.java
@@ -4,6 +4,7 @@
 import com.baomidou.mybatisplus.plugins.Page;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import com.core.common.Cools;
+import com.core.exception.CoolException;
 import com.zy.asrs.entity.LocNormal;
 import com.zy.asrs.mapper.LocNormalMapper;
 import com.zy.asrs.mapper.OutStockMapper;
@@ -55,34 +56,43 @@
         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;
+                    String sqlSelect = "select * from CPICMO where 1=1 and Fnumber = ''{0}'' and FBillNo = ''{1}''";
+                    sqlSelect = MessageFormat.format(sqlSelect, list.get(i).getMatnr(), list.get(i).getSupplier());
+                    List<CPICMO> CPICMOList = erpSqlServer.select(sqlSelect,CPICMO.class);
+                    if (CPICMOList.size() > 0) { //  璇存槑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;
+                                }
                             }
-                        } 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());
+                                }
                             }
                         }
-                        if (complete) {
-                            if (!completeCPakIn(list.get(i).getSupplier(), list.get(i).getMatnr())) {
-                                log.error("{}骞充粨鍏ュ簱鍗曟爣璁板畬鎴愬け璐�", list.get(i).getSupplier());
-                            }
-                        }
+                    } else {
+                        throw new CoolException("ERP鏌ヨ涓嶅埌瀵瑰簲閫氱煡鍗�");
                     }
+                } else {
+                    throw new CoolException("閫氱煡鍗曞彿涓嶅彲涓虹┖");
                 }
             }
+            // 骞充粨鍏ュ簱閫昏緫
+            baseMapper.locNormalIn(list);
         }
-        // 骞充粨鍏ュ簱閫昏緫
-        baseMapper.locNormalIn(list);
     }
 
     /**
diff --git a/src/main/webapp/static/js/locNormal/locNormalIn.js b/src/main/webapp/static/js/locNormal/locNormalIn.js
index 36a3723..239b4ec 100644
--- a/src/main/webapp/static/js/locNormal/locNormalIn.js
+++ b/src/main/webapp/static/js/locNormal/locNormalIn.js
@@ -17,11 +17,11 @@
     ];
     var locNormalColsSelf = [
         {field: 'mnemonic', align: 'center',title: '鐢熶骇鍗曞彿', edit: 'text'}
+        ,{field: 'supplier', 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}
     ];
@@ -89,6 +89,10 @@
                         layer.msg("璇疯緭鍏ョ敓浜у崟鍙�");
                         return;
                     }
+                    if (matCodeData[i].supplier == null || matCodeData[i].supplier == '' || matCodeData[i].supplier == undefined) {
+                        layer.msg("璇疯緭鍏ラ�氱煡鍗曞彿");
+                        return;
+                    }
                 }
                 // 鍒ゆ柇搴撳尯鏄惁涓虹┖
                 var warehouse = $('#putSiteSelect').val();

--
Gitblit v1.9.1