From f7a99b8d50c3cad18038c88985e8932d0f6a130b Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期四, 13 六月 2024 11:04:55 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs |   57 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 50 insertions(+), 7 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
index fc1942e..43a78b6 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -2358,8 +2358,17 @@
 
                     oCn.BeginTran();
 
+                    ds = oCn.RunProcReturn($"select * from Sc_AssemblyBillMain  where HMainSourceInterID={oBill.omodel.HProcExchInterID} and HMainSourceEntryID={oBill.omodel.HProcExchEntryID} and HBarCode_P='{HBardcode}'", "Sc_AssemblyBillMain");
+
+                    if (ds.Tables[0].Rows.Count > 0)
+                    {
+                        oCn.RunProc($"delete from Sc_AssemblyBillMain  where HMainSourceInterID={oBill.omodel.HProcExchInterID} and HMainSourceEntryID={oBill.omodel.HProcExchEntryID} and HBarCode_P='{HBardcode}'");
+                        oCn.RunProc($"delete from Sc_AssemblyBillMain  where HInterID={ds.Tables[0].Rows[0]["HInterID"].ToString()} and HBarCode_P='{HBardcode}'");
+                    }
+
                     oCn.RunProc("delete from Sc_StationOutBillSub_SN where HInterID=" + HInterID + " and HBarCode='" + HBardcode + "'");
                     oCn.RunProc("update  Sc_StationOutBillMain set HQty-=1 where HInterID=" + HInterID);
+                  
 
                     oCn.Commit();
 
@@ -3226,19 +3235,30 @@
         #region  褰撳墠宸ュ崟(鎵爜姹囨姤) 鏉$爜鏌ヨ
         [Route("Cj_StationOutBill_CurrentWork/SNHBardCodeList")]
         [HttpGet]
-        public object SNHBardCodeList(string HBarCode, string user, int HOrgID)
+        public object SNHBardCodeList(string HBarCode, string HProcID, int HOrgID)
         {
             try
             {
+                DataSet dataSet = null;
+                var num = 0;
                 ds = oCN.RunProcReturn(@"select HSourceInterID,HSourceBillNo from Gy_BarCodeBill WITH(NOLOCK) where HBarCode='" + HBarCode + "'", "Gy_BarCodeBill");
-              
                 if (ds.Tables[0].Rows.Count > 0)
                 {
-                    string HSourceInterID = ds.Tables[0].Rows[0]["HSourceInterID"].ToString();
-                    string HSourceBillNo = ds.Tables[0].Rows[0]["HSourceBillNo"].ToString();
+                    num = 1;
+                    dataSet = ds;
+                }
 
-                    ds = oCN.RunProcReturn("select * from gy_czygl WITH(NOLOCK) where czymc='" + user + "'", "gy_czygl");
-                    string HProcID = ds.Tables[0].Rows[0]["HProcID"].ToString();
+                ds = oCN.RunProcReturn(@"select HInterID,HBillNo from Sc_ProcessExchangeBillMain WITH(NOLOCK) where HBillNo='" + HBarCode + "'", "Sc_ProcessExchangeBillMain");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    num = 2;
+                    dataSet = ds;
+                }
+
+                if (num == 1)
+                {
+                    string HSourceInterID = dataSet.Tables[0].Rows[0]["HSourceInterID"].ToString();
+                    string HSourceBillNo = dataSet.Tables[0].Rows[0]["HSourceBillNo"].ToString();
 
                     ds = oCN.RunProcReturn("select  * from h_v_Sc_ProcessExchangeBillList where hmainid=" + HSourceInterID + " and 鍗曟嵁鍙�='" + HSourceBillNo + "' and HProcID=" + HProcID, "h_v_Sc_ProcessExchangeBillList");
 
@@ -3255,7 +3275,30 @@
                     objJsonResult.data = ds.Tables[0];
                     return objJsonResult;
                 }
-                else {
+                else if (num == 2)
+                {
+                    string HSourceInterID = dataSet.Tables[0].Rows[0]["HInterID"].ToString();
+                    string HSourceBillNo = dataSet.Tables[0].Rows[0]["HBillNo"].ToString();
+
+                    ds = oCN.RunProcReturn("select  * from h_v_Sc_ProcessExchangeBillList where hmainid=" + HSourceInterID + " and 鍗曟嵁鍙�='" + HSourceBillNo + "' and HProcID=" + HProcID, "h_v_Sc_ProcessExchangeBillList");
+
+                    if (ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鏉$爜:" + HBarCode + ",娴佽浆鍗�:" + HSourceBillNo + ",涓庡綋鍓嶆祦杞崱,鎵�瀵瑰簲鐨勫伐搴忎笉瀛樺湪!";
+                        objJsonResult.data = ds.Tables[0];
+                        return objJsonResult;
+                    }
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+                else 
+                {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = "鏉$爜鏌ユ棤鏁版嵁!";

--
Gitblit v1.9.1