From d26a4d0fe65398e478390e6013f48ec818ec8cc0 Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期五, 12 四月 2024 17:43:12 +0800
Subject: [PATCH] PDA异常反馈单

---
 WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs |   66 +++++++++++++++++++++++++++++---
 1 files changed, 59 insertions(+), 7 deletions(-)

diff --git a/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs b/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs
index b139a93..92ff4de 100644
--- a/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs
+++ b/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs
@@ -128,7 +128,7 @@
         /// <returns></returns>
         [Route("Xs_SeOutStockBill/DeltetSeOutStockBill")]
         [HttpGet]
-        public object DeltetSeOutStockBill(string HInterID,string user)
+        public object DeltetSeOutStockBill(string HInterID, string HsupId, string HQty, string HSourceInterID, string HSourceEntryID, string user)
         {
             try
             {
@@ -143,8 +143,57 @@
                 }
 
                 oCN.BeginTran();
+                var ds = oCN.RunProcReturn("select * from Xs_SeOutStockBillMain where HInterID=" + HInterID, "Xs_SeOutStockBillMain");
+                
+                var dss = oCN.RunProcReturn("exec h_p_Xs_SeOutStockBillMain_Delete " + HQty + ", '" + HSourceInterID + "', '" + HSourceEntryID + "','" + user + " '", "h_p_Xs_SeOutStockBillMain_Delete");
+                //鍒犻櫎鍓嶆帶鍒�
+                DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_Xs_SeOutStockBill_BeforeDelCtrl  " + HInterID.ToString() + ",'" + user + "'", "h_p_Xs_SeOutStockBill_BeforeDelCtrl");
+                if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍒犻櫎鍓嶅垽鏂け璐ワ紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触锛�" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
                 oCN.RunProc("Delete From Xs_SeOutStockBillMain where HInterID = " + HInterID);
                 oCN.RunProc("Delete From Xs_SeOutStockBillSub where HInterID = " + HInterID);
+
+                //鍒犻櫎鍚庢帶鍒�
+                DataSet EndDs = oCN.RunProcReturn("Exec  h_p_Xs_SeOutStockBill_AfterDelCtrl  " + HInterID.ToString() + ",'" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','" + user + "'", " h_p_Xs_SeOutStockBill_AfterDelCtrl");
+                if (EndDs == null || EndDs.Tables.Count == 0 || EndDs.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍒犻櫎鍚庡垽鏂け璐ワ紒";
+                    objJsonResult.data = null;
+                    oCN.RollBack();
+                    return objJsonResult;
+                }
+                else
+                {
+                    if (DBUtility.ClsPub.isLong(EndDs.Tables[0].Rows[0]["HBack"]) == 1)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触锛�" + DBUtility.ClsPub.isStrNull(EndDs.Tables[0].Rows[0]["HRemark"]);
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
                 oCN.Commit();
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
@@ -309,21 +358,22 @@
                     ",'" + HERPBillType + "'," + HDFflag + ")";
 
                     oCN.RunProc(sql);
+
                 }
                 else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                 { //淇敼
                     string sql = $@"update Xs_SeOutStockBillMain  set " +
-                                "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" +
-                                 ",HCurID=" + HCurID + ", HWHID = " + HWHID
-                                 + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HSeOrderBillNo_M=" + HSeOrderBillNo_M + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID + ",HOWNERID=" + HOWNERID
-                                 + ",HAddress='" + HAddress + "'where HInterID=" + HInterID;
+                                "HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" +
+                                 ",HCusID='" + HCusID + "', HCurID='" + HCurID + "', HWHID = '" + HWHID
+                                 + "',HExRate='" + HExRate + "',HEmpID='" + HEmpID + "',HSeOrderBillNo_M='" + HSeOrderBillNo_M + "',HManagerID='" + HManagerID + "',HDeptID='" + HDeptID + "',HOWNERID='" + HOWNERID
+                                 + "',HAddress='" + HAddress + "' where HInterID=" + HInterID;
                     oCN.RunProc(sql);
 
                     //鍒犻櫎瀛愯〃
                     oCN.RunProc("delete from Xs_SeOutStockBillSub where HInterID='" + HInterID + "'");
                 }
                 //淇濆瓨瀛愯〃
-                objJsonResult = AddBillSub(msg3, HInterID, OperationType);
+                objJsonResult = AddBillSub(msg3, HInterID, OperationType,user);
 
 
                 //淇濆瓨鍚庢帶鍒�=========================================
@@ -372,7 +422,7 @@
             }
         }
 
-        public json AddBillSub(string msg3, long HInterID, int OperationType)
+        public json AddBillSub(string msg3, long HInterID, int OperationType,string user)
         {
             List<ClsXs_SeOutStockBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsXs_SeOutStockBillSub>>(msg3);
 
@@ -436,6 +486,8 @@
                 ,{oSub.HAuxPropID},'{oSub.HBatchNO}','{oSub.HMTONo}',{oSub.HERPInterID},{oSub.HERPEntryID})";
 
                 oCN.RunProc(sql);
+
+                ds = oCN.RunProcReturn("exec h_p_Xs_SeOutStockBillMain " + oSub.HQty + ", '" + oSub.HSourceInterID + "', '" + oSub.HSourceEntryID + "','" + user + " '", "h_p_Xs_SeOutStockBillMain");
             }
 
             objJsonResult.code = "1";

--
Gitblit v1.9.1