From c866b8a4cccdfe330ae2da833c62577d6a902a03 Mon Sep 17 00:00:00 2001
From: 18516761980 <4761516tqsxp>
Date: 星期二, 19 四月 2022 10:14:27 +0800
Subject: [PATCH] #

---
 src/main/resources/mapper/LocDetlMapper.xml                               |   52 ++++++++++++++++---------
 src/main/java/com/zy/common/utils/excel/matcode/MatCodeExcelListener.java |   15 ++++++-
 src/main/webapp/static/js/locStatis/locStatis.js                          |    5 +-
 3 files changed, 48 insertions(+), 24 deletions(-)

diff --git a/src/main/java/com/zy/common/utils/excel/matcode/MatCodeExcelListener.java b/src/main/java/com/zy/common/utils/excel/matcode/MatCodeExcelListener.java
index a93ce19..786d9d3 100644
--- a/src/main/java/com/zy/common/utils/excel/matcode/MatCodeExcelListener.java
+++ b/src/main/java/com/zy/common/utils/excel/matcode/MatCodeExcelListener.java
@@ -52,14 +52,23 @@
     @Override
     public void invoke(MatCodeExcel data, AnalysisContext ctx) {
         MatCodeService matCodeService = SpringUtils.getBean(MatCodeService.class);
-        if (matCodeService.selectById(data.getMatNo()) == null) {
-            MatCode matCode = new MatCode();
+        MatCode matCode = matCodeService.selectById(data.getMatNo());
+        if (matCode == null) {
+            matCode = new MatCode();
             VersionUtils.setMatCode(matCode, data);
             matCode.setModiTime(new Date());
             matCode.setModiUser(this.userId);
             matCode.setAppeTime(new Date());
             matCode.setAppeUser(this.userId);
             if (!matCodeService.insert(matCode)) {
+                throw new CoolException("瀵煎叆鏁版嵁寮傚父");
+            }
+            total ++;
+        } else {
+            VersionUtils.setMatCode(matCode, data);
+            matCode.setModiTime(new Date());
+            matCode.setModiUser(this.userId);
+            if (!matCodeService.updateById(matCode)) {
                 throw new CoolException("瀵煎叆鏁版嵁寮傚父");
             }
             total ++;
@@ -78,7 +87,7 @@
      */
     @Override
     public void doAfterAllAnalysed(AnalysisContext ctx) {
-        LOGGER.info("鏂板{}鏉′骇鍝佷俊鎭紒", total);
+        LOGGER.info("鏂板/淇敼{}鏉′骇鍝佷俊鎭紒", total);
     }
 
     public int getTotal() {
diff --git a/src/main/resources/mapper/LocDetlMapper.xml b/src/main/resources/mapper/LocDetlMapper.xml
index 3137705..277482a 100644
--- a/src/main/resources/mapper/LocDetlMapper.xml
+++ b/src/main/resources/mapper/LocDetlMapper.xml
@@ -197,52 +197,66 @@
         where loc_no=#{locNo}
     </select>
     <select id="getStockStatis" resultMap="BaseResultMap">
-<!--        select a.mat_name,a.mat_no,a.supplier,a.str3,sum(a.qty) qty  from-->
-<!--        (-->
-<!--        select-->
-<!--        ROW_NUMBER() over (order by c.appe_time,c.mat_no,c.loc_no) as row,-->
-<!--        c.*-->
-<!--        from asr_loc_detl c-->
-<!--        ) a where a.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})-->
-<!--         <include refid="stockOutCondition"></include>-->
-<!--        group by a.mat_no,a.mat_name,a.supplier,a.str3-->
-
         select * from
         (
         select ROW_NUMBER() over (order by a.mat_no) as row,
-        a.mat_name,a.mat_no,a.supplier,a.str3,sum(a.qty) qty,specs,unit,color,qty_box,weight,str4,str5  from
+        a.mat_name,a.mat_no,a.str3,sum(a.qty) qty,sum(all_qty) allQty, specs,unit,color,qty_box,weight,str4,str5  from
         (
         select
-        mat_name,mat_no,supplier,str3,qty,specs,unit,color,qty_box,weight,str4,str5
+        mat_name,mat_no,str3,qty,all_qty,specs,unit,color,qty_box,weight,str4,str5
         from asr_loc_detl c
         where 1=1
         <include refid="stockOutCondition1"></include>
         ) a
-        group by a.mat_no,a.mat_name,a.supplier,a.str3,a.specs,a.unit,a.color,a.qty_box,a.weight,a.str4,a.str5
+        group by a.mat_no,a.mat_name,a.str3,a.specs,a.unit,a.color,a.qty_box,a.weight,a.str4,a.str5
         ) d
         where 1=1
         and row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
+        order by mat_no,specs
+<!--        select * from-->
+<!--        (-->
+<!--        select ROW_NUMBER() over (order by a.mat_no) as row,-->
+<!--        a.mat_name,a.mat_no,a.supplier,a.str3,sum(a.qty) qty,specs,unit,color,qty_box,weight,str4,str5  from-->
+<!--        (-->
+<!--        select-->
+<!--        mat_name,mat_no,supplier,str3,qty,specs,unit,color,qty_box,weight,str4,str5-->
+<!--        from asr_loc_detl c-->
+<!--        where 1=1-->
+<!--        <include refid="stockOutCondition1"></include>-->
+<!--        ) a-->
+<!--        group by a.mat_no,a.mat_name,a.supplier,a.str3,a.specs,a.unit,a.color,a.qty_box,a.weight,a.str4,a.str5-->
+<!--        ) d-->
+<!--        where 1=1-->
+<!--        and row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})-->
+<!--        order by a.mat_no,a.supplier-->
     </select>
     <select id="getStockStatisCount" resultType="integer">
         select count(1) from
         (
         select ROW_NUMBER() over (order by a.mat_no) as row,
-        a.mat_name,a.mat_no,a.supplier,a.str3,sum(a.qty) qty,specs,unit,color,qty_box,weight,str4,str5  from
+        a.mat_name,a.mat_no,a.str3,sum(a.qty) qty,specs,unit,color,qty_box,weight,str4,str5  from
         (
         select
-        mat_name,mat_no,supplier,str3,qty,specs,unit,color,qty_box,weight,str4,str5
+        mat_name,mat_no,str3,qty,specs,unit,color,qty_box,weight,str4,str5
         from asr_loc_detl c
         where 1=1
         <include refid="stockOutCondition1"></include>
         ) a
-        group by a.mat_no,a.mat_name,a.supplier,a.str3,a.specs,a.unit,a.color,a.qty_box,a.weight,a.str4,a.str5
+        group by a.mat_no,a.mat_name,a.str3,a.specs,a.unit,a.color,a.qty_box,a.weight,a.str4,a.str5
         ) d
-
+<!--        select count(1) from-->
+<!--        (-->
+<!--        select ROW_NUMBER() over (order by a.mat_no) as row,-->
+<!--        a.mat_name,a.mat_no,a.supplier,a.str3,sum(a.qty) qty,specs,unit,color,qty_box,weight,str4,str5  from-->
+<!--        (-->
 <!--        select-->
-<!--        count(1)-->
-<!--        from asr_loc_detl a-->
+<!--        mat_name,mat_no,supplier,str3,qty,specs,unit,color,qty_box,weight,str4,str5-->
+<!--        from asr_loc_detl c-->
 <!--        where 1=1-->
 <!--        <include refid="stockOutCondition1"></include>-->
+<!--        ) a-->
+<!--        group by a.mat_no,a.mat_name,a.supplier,a.str3,a.specs,a.unit,a.color,a.qty_box,a.weight,a.str4,a.str5-->
+<!--        ) d-->
     </select>
 <!--    <select id="getStockStatisExcel" resultType="com.zy.asrs.entity.LocDetl">-->
     <select id="getStockStatisExcel" resultMap="BaseResultMap">
diff --git a/src/main/webapp/static/js/locStatis/locStatis.js b/src/main/webapp/static/js/locStatis/locStatis.js
index f775d0b..45911ea 100644
--- a/src/main/webapp/static/js/locStatis/locStatis.js
+++ b/src/main/webapp/static/js/locStatis/locStatis.js
@@ -60,18 +60,19 @@
         even: true,
         toolbar: '#toolbar',
         cellMinWidth: 50,
-        cols: [[{field: 'qty', align: 'center', title: '鏁伴噺', width: 120}
+        cols: [[{field: 'qty', align: 'center', title: '鍦ㄥ簱绠辨暟', width: 120}
             , {field: 'matNo', align: 'center', title: '浜у搧缂栫爜'}
             , {field: 'matName', align: 'center', title: '浜у搧鍚嶇О'}
             , {field: 'specs', align: 'center',title: '瑙勬牸'}
             , {field: 'unit', align: 'center',title: '鍗曚綅', width:80}
             , {field: 'color', align: 'center',title: '棰滆壊'}
             , {field: 'qtyBox', align: 'center',title: '姣忕鏁伴噺(PCS)'}
+            , {field: 'allQty', align: 'center',title: '鎬绘暟閲�(PCS)'}
             , {field: 'weight', align: 'center',title: '姣忕閲嶉噺(KG)'}
             , {field: 'str3', align: 'center',title: '瀹㈡埛鍚嶇О'}
             , {field: 'str4', align: 'center',title: '椤圭洰淇℃伅'}
             , {field: 'str5$', align: 'center',title: '绫诲埆'}
-            , {field: 'supplier', align: 'center', title: '鎵瑰彿'}
+            // , {field: 'supplier', align: 'center', title: '鎵瑰彿'}
             ]],
         request: {
             pageName: 'curr',

--
Gitblit v1.9.1