From 0f2bb0dc9045d2bcb0de7d48f7b9975feb6dec95 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期一, 08 四月 2024 10:46:10 +0800
Subject: [PATCH] 1.用户表里增加 检验员 字段, 2.首件检验单、巡检单、工序检验单  初始化界面时,根据用户 带入 默认检验员。)

---
 WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs |  159 ++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 128 insertions(+), 31 deletions(-)

diff --git a/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs b/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs
index 9b2efbf..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;
@@ -265,31 +314,33 @@
                 ds = oCN.RunProcReturn("select * from h_v_IF_SeOutStockBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_SeOutStockBillList");
 
 
-                //淇濆瓨鍓嶆帶鍒�=========================================
-                string HBillNote = "";
-                 ds = oCN.RunProcReturn("Exec h_p_Xs_SeOutStockBill_BeforeSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "','" + HBillNote + "',1 ", "h_p_Xs_SeOutStockBill_BeforeSaveCtrl");
-                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:淇濆瓨鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-
-                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); ;
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-                //=========================================================
-
+               
 
                 if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//鏂板
                 {
+                    //淇濆瓨鍓嶆帶鍒�=========================================
+                    string HBillNote = "";
+                    ds = oCN.RunProcReturn("Exec h_p_Xs_SeOutStockBill_BeforeSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "','" + HBillNote + "',1 ", "h_p_Xs_SeOutStockBill_BeforeSaveCtrl");
+                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:淇濆瓨鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //=========================================================
+
+
                     //涓昏〃
                     string sql = $@"Insert Into Xs_SeOutStockBillMain   
                         (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus
@@ -307,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);
 
 
                 //淇濆瓨鍚庢帶鍒�=========================================
@@ -370,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);
 
@@ -434,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";
@@ -887,7 +941,28 @@
                 //Type 1 瀹℃牳  2  鍙嶅鏍�
                 if (Type == 1)
                 {
-                    if (!BillOld.CheckBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    //瀹℃牳鍓嶆帶鍒�
+                    DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_Xs_SeOutStockBill_BeforeCheckCtrl  " + HInterID.ToString() + ",'" + user + "'", "h_p_Xs_SeOutStockBill_BeforeCheckCtrl");
+                    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;
+                        }
+                    }
+                    if (!BillOld.CheckBill(int.Parse(HInterID), BillOld.omodel.HBillNo, "h_p_Xs_SeOutStockBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 1;
@@ -898,7 +973,29 @@
                 }
                 else
                 {
-                    if (BillOld.AbandonCheck(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    //鍙嶅鏍稿墠鎺у埗
+                    DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_Xs_SeOutStockBill_BeforeUnCheckCtrl " + HInterID.ToString() + ",'" + user + "'", "h_p_Xs_SeOutStockBill_BeforeUnCheckCtrl");
+                    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;
+                        }
+                    }
+
+                    if (BillOld.AbandonCheck(int.Parse(HInterID), BillOld.omodel.HBillNo, "h_p_Xs_SeOutStockBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                     {
                         SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                         //DataSet DSet = oCn.RunProcReturn("exec h_p_Sc_ICMOBill_AbandonCheckCtrl " + int.Parse(HInterID), "h_p_Sc_ICMOBill_AbandonCheckCtrl");

--
Gitblit v1.9.1