From efa57c53b1b4c94e188a52f5a35d0a4ca8a82cb5 Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期四, 29 六月 2023 14:55:30 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/Sc_ProcessMangementController.cs |   48 ++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 38 insertions(+), 10 deletions(-)

diff --git a/WebAPI/Controllers/Sc_ProcessMangementController.cs b/WebAPI/Controllers/Sc_ProcessMangementController.cs
index 2d82cff..9460c4a 100644
--- a/WebAPI/Controllers/Sc_ProcessMangementController.cs
+++ b/WebAPI/Controllers/Sc_ProcessMangementController.cs
@@ -686,6 +686,16 @@
                 //
                 //DataSet ds1 = oCN.RunProcReturn("select * from  h_v_TOERPProcduct_LastProc where HLastProc = '鏄�' and  hbillno='" + BillNo.ToString() + "'", "h_v_TOERPProcduct_LastProc");
                 DataSet ds1 = oCN.RunProcReturn("exec h_p_TOERPProcduct_LastProc '" + BillNo + "'", "h_p_TOERPProcduct_LastProc");
+
+                if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈壘鍒板搴旂殑鏈湴鎴栭噾铦朵簯鐢熶骇姹囨姤鍗曡褰�;1.鏈煡璇㈠埌瀵瑰簲鐨勭敓浜ф眹鎶ュ崟锛�2.璇风‘淇濆綋鍓嶅伐搴忔槸鏈亾宸ュ簭3.姹囨姤鍗曞搴旂殑鍏ュ簱鏁伴噺宸叉弧 璇峰湪閲戣澏浜戞煡鐪嬪叆搴撹褰曪紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
                 DataRow dr1 = ds1.Tables[0].Rows[0];
                 if (double.Parse(dr1[0].ToString()) <= 0)
                 {
@@ -702,23 +712,40 @@
                 {
                     if (oSystemParameter.omodel.WMS_CampanyName == "鐟炰笌绁�")
                     {
+
+                        //鍒ゆ柇閲戣澏浜戞槸鍚﹀凡缁忔湁鍏ュ簱鐨勬暟鎹�
+                        ds = oCN.RunProcReturn($@"select * from AIS20220308151944..T_PRD_INSTOCK where FBILLNO='{BillNo}'", "T_PRD_INSTOCK");
+
+                        if (ds.Tables[0].Rows.Count > 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "褰撳墠鍑虹珯鍗曞彿宸插叆搴�,璇蜂笉瑕侀噸鏂板叆搴�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+
                         //鍒ゆ柇閲戣澏浜戠敓浜ф眹鎶ュ崟 鏁伴噺 鏄惁 澶т簬 鏈亾鍑虹珯鏁伴噺
-                        ds = oCN.RunProcReturn($@"select sum(FFinishQty)-(select HQty from Sc_StationOutBillMain where HBillNo='{BillNo}') 
+                        ds = oCN.RunProcReturn($@"select sum(FFinishQty)-sum(FSTOCKINQUASELQTY)-(select HQty from Sc_StationOutBillMain where HBillNo='{BillNo}') 
                         from  AIS20220308151944..T_PRD_MORPT rpt3 
                         left join AIS20220308151944..T_PRD_MORPTENTRY  rpt2 on rpt3.FID = rpt2.FID
+                        left join AIS20220308151944..T_PRD_MORPTENTRY_A  rpt1 on rpt2.FID = rpt1.FID
                         where F_bsv_Text=(select HProcExchBillNo from Sc_StationOutBillMain where HBillNo='{BillNo}')", "SumCount");
+
+                        if (double.Parse(ds.Tables[0].Rows[0][0].ToString()) < 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "閲戣澏浜戞眹鎶ユ暟閲忓皬浜庢湰鍦板嚭绔欐暟閲�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
                     }
                 }
 
 
 
-                if (double.Parse(ds.Tables[0].Rows[0][0].ToString()) < 0) {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "閲戣澏浜戞眹鎶ユ暟閲忓皬浜庢湰鍦板嚭绔欐暟閲�!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
+
 
 
                 JObject model = new JObject();
@@ -1188,7 +1215,7 @@
             Int64 HSourceEntryID, string HSourceBillNo, string user,
             Int64 HWHID, Int64 HSPID, Int64 HSupID, Int64 HKeeperID,
             Int64 HMaterID, string HSourceBillType, Int64 HSLInterID,
-            Int64 HSLEntryID, string HSLBillNo, Int64 HSLSeQ, string HBillNo, Int64 HInterID)
+            Int64 HSLEntryID, string HSLBillNo, Int64 HSLSeQ, string HBillNo, Int64 HInterID, string HBatchNo)
         {
             try
             {
@@ -1283,6 +1310,7 @@
                 FentityModel.Add("FBaseAcceptQty", HRightQty.ToString());//鍩烘湰鍗曚綅鎺ユ敹鏁�
                 FentityModel.Add("FCurrency", new JObject() { ["Fnumber"] = "PRE001" });//甯佸埆
                 FentityModel.Add("FIsSplitRow ", false);// 鏄惁鎷嗗垎琛�
+                FentityModel.Add("FLot", new JObject() { ["Fnumber"] = HBatchNo.ToString() });//鎵瑰彿
 
                 JArray Fentity2 = new JArray();
                 JObject FentityModel2 = new JObject();
@@ -1418,7 +1446,7 @@
                 return objJsonResult;
             }
         }
-    
+
 
 
 

--
Gitblit v1.9.1