From 1a47d9eef4cfe9385ce66b791de84db54a5ba87c Mon Sep 17 00:00:00 2001
From: jiazx0107@163.com <jiazx0107@163.com>
Date: 星期日, 25 六月 2023 20:30:36 +0800
Subject: [PATCH] 出入库流程优化-入库详单优化

---
 igds-inout/src/main/resources/mapper/InoutRecordMapper.xml |   85 ++++++++++++++++++++++--------------------
 1 files changed, 44 insertions(+), 41 deletions(-)

diff --git a/igds-inout/src/main/resources/mapper/InoutRecordMapper.xml b/igds-inout/src/main/resources/mapper/InoutRecordMapper.xml
index dd5bfbe..36bb4a0 100644
--- a/igds-inout/src/main/resources/mapper/InoutRecordMapper.xml
+++ b/igds-inout/src/main/resources/mapper/InoutRecordMapper.xml
@@ -82,9 +82,7 @@
             <if test="param.intelCard != null and param.intelCard != '' ">AND INTEL_CARD_ = #{param.intelCard}</if>
             <if test="param.id != null and param.id != '' ">AND ID_ = #{param.id}</if>
             <if test="param.progress != null and param.progress != '' ">AND PROGRESS_ = #{param.progress}</if>
-
             AND PROGRESS_ != 'RECORD'
-            AND RECORD_STATUS_ != 'ERROR'
             AND RECORD_STATUS_ != 'DEL'
         </where>
     </select>
@@ -111,7 +109,6 @@
                 COMPLETE_TIME_ <![CDATA[ > ]]>#{param.start,jdbcType=TIMESTAMP}
             </if>
             AND PROGRESS_ = 'RECORD'
-            AND RECORD_STATUS_ != 'ERROR'
             AND RECORD_STATUS_ != 'DEL'
             ORDER BY COMPLETE_TIME_
         </where>
@@ -144,13 +141,19 @@
         <where>
             <if test="param.companyId != null and param.companyId != '' ">AND COMPANY_ID_ = #{param.companyId}</if>
             <if test="param.depotId != null and param.depotId != '' ">AND DEPOT_ID_ = #{param.depotId}</if>
+            <if test="param.type != null and param.type != '' ">AND TYPE_ = #{param.type}</if>
+            <if test="param.plateNum != null and param.plateNum != '' ">AND PLATE_NUM_ = #{param.plateNum}</if>
+            <if test="param.intelCard != null and param.intelCard != '' ">AND INTEL_CARD_ = #{param.intelCard}</if>
+            <if test="param.id != null and param.id != '' ">AND ID_ = #{param.id}</if>
+            <if test="param.userId != null and param.userId != '' ">AND USER_ID_ = #{param.userId}</if>
+            <if test="param.progress != null and param.progress != '' ">AND PROGRESS_ = #{param.progress}</if>
+            <if test="param.start != null">AND
+                REGISTER_TIME_ <![CDATA[ > ]]>#{param.start,jdbcType=TIMESTAMP}
+            </if>
             <if test="param.end != null">AND
                 COMPLETE_TIME_ <![CDATA[ < ]]>#{param.end,jdbcType=TIMESTAMP}
             </if>
-            <if test="param.curStorage > 0">AND CUR_STORAGE_ > 0</if>
         </where>
-        AND PROGRESS_ = 'RECORD'
-        AND RECORD_STATUS_ != 'ERROR'
         AND RECORD_STATUS_ != 'DEL'
         ORDER BY COMPLETE_TIME_ DESC
         LIMIT 1
@@ -165,7 +168,7 @@
             <if test="param.intelCard != null and param.plateNum != null">
                 AND ( INTEL_CARD_ = #{param.intelCard} OR PLATE_NUM_ = #{param.plateNum} )
             </if>
-            and PROGRESS_ &lt;&gt; 'RECORD' and RECORD_STATUS_ != 'DEL' and RECORD_STATUS_ != 'ERROR'
+            and PROGRESS_ &lt;&gt; 'RECORD' and RECORD_STATUS_ != 'DEL'
         </where>
     </select>
 
@@ -183,16 +186,16 @@
     <update id="inoutStop" parameterType="com.ld.igds.inout.dto.InoutParam">
         update D_INOUT_RECORD
         <set>
-            RECORD_STATUS_ ='ERROR',
             PROGRESS_ = 'RECORD',
+            <if test="param.recordStatus != null and param.recordStatus != '' ">RECORD_STATUS_ = #{param.recordStatus},</if>
             <if test="param.checkStatus != null and param.checkStatus != '' ">CHECK_STATUS_ = #{param.checkStatus},</if>
             <if test="param.msg != null and param.msg != '' ">REMARKS_ = concat(REMARKS_,#{param.msg})</if>
         </set>
-        <where>
-            <if test="param.companyId != null and param.companyId != '' ">COMPANY_ID_ = #{param.companyId}</if>
-            <if test="param.id != null and param.id != '' ">AND ID_ = #{param.id}</if>
-        </where>
 
+        <where>
+            COMPANY_ID_ = #{param.companyId},
+           AND ID_ = #{param.id}
+        </where>
     </update>
 
 
@@ -226,20 +229,13 @@
         <if test="data.intelCard != null">INTEL_CARD_ = #{data.intelCard},</if>
         <if test="data.plateNum != null">PLATE_NUM_ = #{data.plateNum},</if>
         <if test="data.transType != null">TRANS_TYPE_ = #{data.transType},</if>
-        <if test="data.specType != null">SPEC_TYPE_ = #{data.specType},</if>
-        <if test="data.customerId != null">CUSTOMER_ID_ = #{data.customerId},</if>
         <if test="data.customerName != null">CUSTOMER_NAME_ = #{data.customerName},</if>
         <if test="data.foodVariety != null">FOOD_VARIETY_ = #{data.foodVariety},</if>
         <if test="data.foodLevel != null">FOOD_LEVEL_ = #{data.foodLevel},</if>
         <if test="data.foodLocation != null">FOOD_LOCATION_ = #{data.foodLocation},</if>
         <if test="data.foodYear != null">FOOD_YEAR_ = #{data.foodYear},</if>
-        <if test="data.impurity != null">IMPURITY_ = #{data.impurity},</if>
-        <if test="data.deImpurity != null">DE_IMPURITY_ = #{data.deImpurity},</if>
-        <if test="data.wet != null">WET_ = #{data.wet},</if>
-        <if test="data.deWet != null">DE_WET_ = #{data.deWet},</if>
         <if test="data.deHandle != null">DE_HANDLE_ = #{data.deHandle},</if>
         <if test="data.deOther != null">DE_OTHER_ = #{data.deOther},</if>
-        <if test="data.deSum != null">DE_SUM_ = #{data.deSum},</if>
         <if test="data.fullWeight != null">FULL_WEIGHT_ = #{data.fullWeight},</if>
         <if test="data.fullWeightTime != null">FULL_WEIGHT_TIME_ = #{data.fullWeightTime},</if>
         <if test="data.fullWeightUser != null">FULL_WEIGHT_USER_ = #{data.fullWeightUser},</if>
@@ -249,17 +245,31 @@
         <if test="data.netWeight != null">NET_WEIGHT_ = #{data.netWeight},</if>
         <if test="data.settleWeight != null">SETTLE_WEIGHT_ = #{data.settleWeight},</if>
         <if test="data.recordWeight != null">RECORD_WEIGHT_ = #{data.recordWeight},</if>
-        <if test="data.handleStart != null">HANDLE_START_ = #{data.handleStart},</if>
-        <if test="data.handleEnd != null">HANDLE_END_ = #{data.handleEnd},</if>
         <if test="data.handleUser != null">HANDLE_USER_ = #{data.handleUser},</if>
         <if test="data.completeTime != null">COMPLETE_TIME_ = #{data.completeTime},</if>
         <if test="data.completeUser != null">COMPLETE_USER_ = #{data.completeUser},</if>
         <if test="data.remarks != null">REMARKS_ = #{data.remarks},</if>
-        <if test="data.curStorage != null">CUR_STORAGE_ = #{data.curStorage},</if>
         <if test="data.foodType != null">FOOD_TYPE_ = #{data.foodType},</if>
         <if test="data.price != null">PRICE_ = #{data.price},</if>
         <if test="data.settleMoney != null">SETTLE_MONEY_ = #{data.settleMoney},</if>
         PROGRESS_ = #{data.progress}
+        where
+        company_id_ =#{data.companyId}
+        and id_=#{data.id}
+    </update>
+
+    <update id="updateDataByHandle" parameterType="com.ld.igds.inout.dto.InoutData">
+        update D_INOUT_RECORD set
+        <if test="data.deHandle != null">DE_HANDLE_ = #{data.deHandle},</if>
+        <if test="data.handleUser != null">HANDLE_USER_ = #{data.handleUser},</if>
+        <if test="data.deOther != null">DE_OTHER_ = #{data.deOther},</if>
+        <if test="data.deOtherInfo != null">DE_OTHER_INFO_ = #{data.deOtherInfo},</if>
+        <if test="data.dePackage != null">DE_PACKAGE_ = #{data.package},</if>
+        <if test="data.bzw != null">bzw = #{data.bzw},</if>
+        <if test="data.dbz != null">dbz = #{data.dbz},</if>
+        <if test="data.bzbjs != null">bzbjs = #{data.bzbjs},</if>
+        <if test="data.remarks != null">REMARKS_ = #{data.remarks},</if>
+        UPDATE_TIME_  = #{data.updateTime}
         where
         company_id_ =#{data.companyId}
         and id_=#{data.id}
@@ -437,7 +447,16 @@
             <if test="param.checkStatus != null and param.checkStatus == 'NONE' ">AND CHECK_STATUS_ = 'NONE'</if>
 
         </where>
-        AND RECORD_STATUS_ != 'DEL'
+
+        <choose>
+            <when test="param.recordStatus != null and param.recordStatus == 'DEL' ">
+                AND RECORD_STATUS_ = 'DEL'
+            </when>
+            <otherwise>
+                AND RECORD_STATUS_ != 'DEL'
+            </otherwise>
+        </choose>
+
 
         <choose>
             <when test="param.orderTag != null and param.orderTag == 'ASC' ">
@@ -457,25 +476,12 @@
         update D_INOUT_RECORD
         set PROGRESS_ = #{param.progress},
         COMPLETE_TIME_ =#{param.completeTime},
-        <if test="param.fullWeight != null and param.fullWeight > 0">FULL_WEIGHT_ = #{param.fullWeight},</if>
-        <if test="param.fullWeightUser != null">FULL_WEIGHT_USER_ = #{param.fullWeightUser},</if>
-        <if test="param.fullWeightTime != null">FULL_WEIGHT_TIME_ = #{param.fullWeightTime},</if>
-        <if test="param.emptyWeight != null and param.fullWeight > 0">EMPTY_WEIGHT_ = #{param.emptyWeight},</if>
-        <if test="param.emptyWeightTime != null">EMPTY_WEIGHT_TIME_ = #{param.emptyWeightTime},</if>
-        <if test="param.emptyWeightUser != null">EMPTY_WEIGHT_USER_ = #{param.emptyWeightUser},</if>
-        <if test="param.netWeight != null and param.fullWeight > 0">NET_WEIGHT_ = #{param.netWeight},</if>
-        <if test="param.settleWeight != null and param.settleWeight > 0">SETTLE_WEIGHT_ = #{param.settleWeight},</if>
-        <if test="param.recordWeight != null and param.recordWeight > 0">RECORD_WEIGHT_ = #{param.recordWeight},</if>
-        <if test="param.de != null and param.de > 0">DE_SUM_ = #{param.de},</if>
-        <if test="param.depotId != null and param.depotId != ''">DEPOT_ID_ = #{param.depotId},</if>
-        <if test="param.price != null and param.price > 0">PRICE_ = #{param.price},</if>
-        <if test="param.settleMoney != null and param.settleMoney > 0">SETTLE_MONEY_ = #{param.settleMoney},</if>
-        COMPLETE_USER_ = #{param.userId}
+        COMPLETE_USER_ = #{param.userId},
+        UPDATE_TIME_ = #{param.updateTime}
         where ID_ = #{param.id}
         and TYPE_ = #{param.type}
         and COMPANY_ID_ = #{param.companyId}
         and RECORD_STATUS_ != 'DEL'
-        and RECORD_STATUS_ != 'ERROR'
     </update>
 
     <!-- 鏌ヨ娴佺▼鏈畬鎴愮殑娴佹按淇℃伅 -->
@@ -504,7 +510,6 @@
         AND RECORD_STATUS_ != 'DEL'
         AND PROGRESS_ != 'RECORD'
         AND PROGRESS_ != 'PAY'
-        AND RECORD_STATUS_ != 'ERROR'
     </select>
 
 
@@ -516,7 +521,6 @@
         where
         PROGRESS_ = 'RECORD'
         AND RECORD_STATUS_ != 'DEL'
-        AND RECORD_STATUS_ != 'ERROR'
         <if test="param.type != null and param.type != ''">AND TYPE_ = #{param.type}</if>
         <if test="param.companyId != null and param.companyId != ''">AND COMPANY_ID_ = #{param.companyId}</if>
         <if test="param.deptId != null and param.deptId != ''">AND DEPT_ID_ = #{param.deptId}</if>
@@ -541,7 +545,6 @@
         AND TYPE_ = #{param.type}
         AND (PLATE_NUM_ = #{param.plateNum} or INTEL_CARD_ = #{param.intelCard})
         AND PROGRESS_ != 'RECORD'
-        AND RECORD_STATUS_ != 'ERROR'
         AND RECORD_STATUS_ != 'DEL'
         <if test="param.start != null">
             AND REGISTER_TIME_  <![CDATA[ > ]]> #{param.start,jdbcType=TIMESTAMP}

--
Gitblit v1.9.3