From 1ae7a525919be78160f2d061c8adb41d1aef3335 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期三, 07 八月 2024 14:58:03 +0800
Subject: [PATCH] 修复出站单带出模具赋值

---
 WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs |   29 +++++++++++++++--------------
 1 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
index bf61a5a..95f0e3c 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -3683,28 +3683,29 @@
         {
             try
             {
-                string sql = @"SELECT  b.HMouldID,c.HMouldNo 妯″叿缂栫爜,c.HName 妯″叿鍚嶇О,c.HModel 妯″叿鍨嬪彿 FROM Sc_ICMOBillStatus_Tmp a
-                            LEFT JOIN(
+                string sql = @"SELECT  b.HMouldID,c.HMouldNo 妯″叿缂栫爜,c.HName 妯″叿鍚嶇О,c.HModel 妯″叿鍨嬪彿 FROM Sc_ICMOBillStatus_Tmp a  LEFT JOIN(
                             SELECT *, ROW_NUMBER() OVER(PARTITION BY HSourceID ORDER BY HScanDate DESC) AS RowNum FROM Sc_MouldUpperBillSub
-                            ) b ON a.HSourceID = b.HSourceID AND b.RowNum = 1
-                            left join Gy_MouldFileMain c on b.HMouldID = c.HInterID
-                            where a.HSourceInterID ='" + HInterID + "' and  a.HSourceEntryID ='" + HEntryID + "' and  a.HSourceBillNo ='" + HBillNo + "'";
+                            ) b ON a.HSourceID = b.HSourceID AND b.RowNum = 1 left join Gy_MouldFileMain c on b.HMouldID = c.HInterID
+                            where b.HMouldID is not null and a.HSourceInterID ='" + HInterID + "' and  a.HSourceEntryID ='" + HEntryID + "' and  a.HSourceBillNo ='" + HBillNo + "'";
                 ds = oCN.RunProcReturn(sql, "Sc_ICMOBillStatus_Tmp");
 
-                if (ds.Tables[0].Rows.Count == 0)
+                if (ds.Tables[0].Rows.Count != 0 && ds != null)
                 {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "褰撳墠璁惧娌℃湁妯″叿杩涜缁戝畾!";
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "";
                     objJsonResult.data = ds.Tables[0];
                     return objJsonResult;
                 }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "";
+                    return objJsonResult;
+                }
 
-                objJsonResult.code = "1";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "";
-                objJsonResult.data = ds.Tables[0];
-                return objJsonResult;
+                
             }
             catch (Exception e)
             {

--
Gitblit v1.9.1