From b4a8d50e3d97fc9e893b554a60134e4eceb012eb Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期一, 05 一月 2026 08:58:08 +0800
Subject: [PATCH] #

---
 src/main/resources/mapper/OutStockMapper.xml |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/main/resources/mapper/OutStockMapper.xml b/src/main/resources/mapper/OutStockMapper.xml
index 183ac69..7603842 100644
--- a/src/main/resources/mapper/OutStockMapper.xml
+++ b/src/main/resources/mapper/OutStockMapper.xml
@@ -61,7 +61,7 @@
         b.FAdd,b.Fflag_finish, a.Fname, a.Fmodel
         from OutStockBillEntry a left join OutStockBill b on a.FInterID = b.FInterID
         where 1=1
-        and b.Fflag_finish != 1
+        and b.Fflag_finish != 1 and a.FQty > a.FAmount
         <if test="FSourceBillNo!=null and FSourceBillNo!='' ">
             and a.FSourceBillNo = #{FSourceBillNo}
         </if>
@@ -77,6 +77,13 @@
         from OutStockBillEntry a
         left join OutStockBill b on a.FInterID = b.FInterID
         where 1=1
+        and b.Fflag_finish != 1 and a.FQty > a.FAmount
+        <if test="FSourceBillNo!=null and FSourceBillNo!='' ">
+            and a.FSourceBillNo = #{FSourceBillNo}
+        </if>
+        <if test="FBillNo != null and FBillNo != ''">
+            and b.FBillNo = #{FBillNo}
+        </if>
     </select>
 
     <select id="queryMatnrWithBillNo" resultMap="OutStockResultMap">
@@ -84,7 +91,7 @@
         a.FOrderInterID,a.FAuxQty,a.FCommitQty,a.FAuxPrice,a.FDate,a.FNote, a.Fnumber, a.FSourceBillNo, b.FBillNo,
         b.FAdd
         from OutStockBillEntry a left join OutStockBill b on a.FInterID = b.FInterID
-        where b.FBillNo = #{FBillNo}) t where 1 = 1
+        where b.FBillNo = #{FBillNo} and b.Fflag_finish != 1 and a.FQty > a.FAmount) t where 1 = 1
     </select>
 
     <select id="queryMatWithLoc" resultMap="BaseResultMap">
@@ -93,8 +100,8 @@
         and b.loc_sts = 'F'
         and a.matnr = #{matnr}
         order by
-        DATEPART(yyyy,a.modi_time),DATEPART(mm,a.modi_time),DATEPART(dd,a.modi_time)
-        desc,
+        DATEPART(yyyy,a.appe_time),DATEPART(mm,a.appe_time),DATEPART(dd,a.appe_time)
+        ASC,
         case
         when (left(a.loc_no, 2) = '01') then 0
         when (left(a.loc_no, 2) = '02') then 1

--
Gitblit v1.9.1