From 80e1af24248a6b94951cef2910065c2f6ac0033c Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期一, 09 二月 2026 14:36:12 +0800
Subject: [PATCH] wip导入

---
 WebAPI/Controllers/LMESController.cs |   48 ++++++++++++++++++++++++++++++++----------------
 1 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/WebAPI/Controllers/LMESController.cs b/WebAPI/Controllers/LMESController.cs
index 287eaf4..288e6bd 100644
--- a/WebAPI/Controllers/LMESController.cs
+++ b/WebAPI/Controllers/LMESController.cs
@@ -871,13 +871,6 @@
                     {
                         continue;
                     }
-
-                    // 鎻掑叆鐢熶骇鐘舵�佷复鏃惰〃
-                    string SQL = $"exec h_p_Sc_ICMOBillStatus_Tmp_PGPL {hSourceInterID},{hSourceEntryID},{hSourceID},{hMoldID}";
-                    oCN.RunProc(SQL);
-                    //鎻掑叆宸ュ簭娴佽浆鍗℃淳宸ュ崟
-                    string SQL1 = $"exec h_p_Sc_ProcExchSendWorkBill_PG {hSourceInterID},{hSourceEntryID},{hSourceID},{hMoldID}";
-                    oCN.RunProc(SQL1);
                     string sReturn = "";
                     if (oSystemParameter.ShowBill(ref sReturn) == true)
                     {
@@ -889,7 +882,13 @@
                             oCN.RunProc("exec h_p_OA_WorkLinkBill_Create " + hSourceInterID + "," + 3772);
                         }
                     }
-                    
+                    oCN.RunProc("update Sc_ProcessExchangeBillSub set HSourceID=" + hSourceID + " where HInterID=" + hSourceInterID + " and HEntryID=" + hSourceEntryID);
+                    // 鎻掑叆鐢熶骇鐘舵�佷复鏃惰〃
+                    string SQL = $"exec h_p_Sc_ICMOBillStatus_Tmp_PGPL {hSourceInterID},{hSourceEntryID},{hSourceID},{hMoldID}";
+                    oCN.RunProc(SQL);
+                    //鎻掑叆宸ュ簭娴佽浆鍗℃淳宸ュ崟
+                    string SQL1 = $"exec h_p_Sc_ProcExchSendWorkBill_PG {hSourceInterID},{hSourceEntryID},{hSourceID},{hMoldID}";
+                    oCN.RunProc(SQL1);                    
                 }
 
                 // 7. 鎻愪氦浜嬪姟
@@ -915,7 +914,7 @@
         #region 鍙栨秷娲惧伐鍔熻兘(鍗庤垷)
         [Route("LEMS/ProcessExchangeArrangementDel_PGHZ")]
         [HttpGet]
-        public object ProcessExchangeArrangementDel_PGHZ(string HInterID_S, int HSourceID, int HMouldID, string user)
+        public object ProcessExchangeArrangementDel_PGHZ(string HInterID_S, string user)
         {
             DataSet ds;
             DataSet ds1;
@@ -939,8 +938,9 @@
 
                     long HInterID = long.Parse(HNum[j].Split('|')[0]);
                     long HEntryID = long.Parse(HNum[j].Split('|')[1]);
-                    ds = oCN.RunProcReturn(@"select a.HMaterID,b.HProcID,a.HBillNo from Sc_ProcessExchangeBillMain a inner join Sc_ProcessExchangeBillSub b on a.HInterID=b.HInterID 
-where a.HInterID=" + HInterID + " and b.HEntryID=" + HEntryID, "Sc_ProcessExchangeBillMain");
+                    long HSourceID = long.Parse(HNum[j].Split('|')[2]);
+                    ds = oCN.RunProcReturn(@"select a.HMaterID,b.HProcID,a.HBillNo from Sc_ProcessExchangeBillMain a inner join Sc_ProcessExchangeBillSub b on a.HInterID=b.HInterID  where a.HInterID=" + HInterID + " and b.HEntryID=" + HEntryID, "Sc_ProcessExchangeBillMain");
+                    LogService.Write(1);
                     if (ds.Tables[0].Rows.Count == 0)
                     {
                         objJsonResult.code = "0";
@@ -949,9 +949,9 @@
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
-                    //鏍规嵁涓诲瓙ID+浜х嚎+妯″叿鏌ヨ鏄惁娲惧伐
-                    ds = oCN.RunProcReturn("select * from Sc_ICMOBillStatus_Tmp where HSourceInterID=" + HInterID + " and HSourceEntryID=" + HEntryID + "  and HSourceID=" + HSourceID + " and HMouldID=" + HMouldID, "Sc_ICMOBillStatus_Tmp");
-
+                    //鏍规嵁涓诲瓙ID+浜х嚎鏌ヨ鏄惁娲惧伐
+                    ds = oCN.RunProcReturn("select * from Sc_ICMOBillStatus_Tmp where HSourceInterID=" + HInterID + " and HSourceEntryID=" + HEntryID + "  and HSourceID=" + HSourceID , "Sc_ICMOBillStatus_Tmp");
+                    LogService.Write(2);
                     if (ds.Tables[0].Rows.Count == 0)
                     {
                         objJsonResult.code = "0";
@@ -960,9 +960,25 @@
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
-
+                    LogService.Write(3);
                     oCN.RunProc("update Sc_ProcessExchangeBillSub set HSourceID=0 where HInterID=" + HInterID + " and HEntryID=" + HEntryID);
-                    oCN.RunProc("delete from Sc_ICMOBillStatus_Tmp where HSourceInterID=" + HInterID + " and HSourceEntryID=" + HEntryID + " and HMouldID="+ HMouldID);
+                    LogService.Write(4);
+                    //鏇存柊鎺夊凡娲惧伐瀛楁
+                    oCN.RunProc("update Sc_ProcessExchangeBillMain set HRemark3='' where HInterID=" + HInterID);
+                    LogService.Write(5);
+                    oCN.RunProc("delete from Sc_ICMOBillStatus_Tmp where HSourceInterID=" + HInterID + " and HSourceEntryID=" + HEntryID + " and HSourceID=" + HSourceID);
+                    LogService.Write(6);
+                    //鏌ヨ鏄惁鏈夊嚭绔欏崟杩欎釜宸ュ崟杩欎釜浜х嚎
+                    ds = oCN.RunProcReturn("select * from Sc_StationOutBillMain where HProcExchInterID=" + HInterID + " and HProcExchEntryID=" + HEntryID + " and HSourceID=" + HSourceID + "", "Sc_StationOutBillMain");
+                    LogService.Write(7);
+                    if (ds!=null && ds.Tables[0].Rows.Count == 0)
+                    {
+                        //娌℃湁鍑虹珯鍗曠殑杩涜鍒犻櫎宸ュ簭娴佽浆鍗℃淳宸ュ崟
+                        oCN.RunProc("delete from Sc_ProcExchSendWorkBillMain where HInterID=(select HInterID from Sc_ProcExchSendWorkBillSub where HSourceInterID=" + HInterID + " and HSourceEntryID=" + HEntryID + "  and HSourceID=" + HSourceID + " )");
+                        LogService.Write(8);
+                        oCN.RunProc("delete from Sc_ProcExchSendWorkBillSub where HSourceInterID=" + HInterID + " and HSourceEntryID=" + HEntryID + "  and HSourceID=" + HSourceID);
+                        LogService.Write(9);
+                    }
                 }
 
                 oCN.Commit();

--
Gitblit v1.9.1