From 0a56001e1b8e9ae7d2f39c982912cd6d10c22032 Mon Sep 17 00:00:00 2001
From: cwjbxqmz <1134865194@qq.com>
Date: 星期二, 06 二月 2024 11:35:20 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs |  453 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 439 insertions(+), 14 deletions(-)

diff --git a/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs b/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs
index 691c274..b139a93 100644
--- a/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs
+++ b/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs
@@ -18,6 +18,7 @@
         //鑾峰彇绯荤粺鍙傛暟
         Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
         public DBUtility.ClsPub.Enum_BillStatus BillStatus;
+        public DAL.ClsXs_SeOutStockBill BillOld = new DAL.ClsXs_SeOutStockBill();
 
         private json objJsonResult = new json();
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
@@ -35,7 +36,7 @@
             try
             {
 
-                ds = oCN.RunProcReturn("select * from h_v_IF_SeOutStockBillList where HitemID=" + HInterID, "h_v_IF_SeOutStockBillList");
+                ds = oCN.RunProcReturn("select * from h_v_IF_SeOutStockBillList where hmainid=" + HInterID, "h_v_IF_SeOutStockBillList");
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
@@ -233,7 +234,9 @@
                 long HCusID = mainList[0].HCusID; //瀹㈡埛
                 string HAddress = mainList[0].HAddress;//鍦板潃
                 long HSSID = mainList[0].HSSID;//缁撶畻鏂瑰紡
-
+                long HConveyTypeID = mainList[0].HConveyTypeID;//杩愯緭鏂瑰紡
+                long HConveyCompID = mainList[0].HConveyCompID;//杩愯緭鍏徃
+                long HConveyMoney = (long)mainList[0].HConveyMoney;//杩愯垂
                 long HDFflag = Convert.ToInt32(mainList[0].HDFflag); //鏄惁鍨粯
 
 
@@ -255,36 +258,94 @@
                 long HDELIVERYORGID = mainList[0].HDELIVERYORGID;
                 long HOWNERID = mainList[0].HOWNERID;
                 string HOWNERTYPEID = mainList[0].HOWNERTYPEID;
+                string HLinkMan = mainList[0].HLinkMan;
+                string HLinkPhone = mainList[0].HLinkPhone;
+                string HSeOrderBillNo_M = mainList[0].HSeOrderBillNo_M;
 
                 ds = oCN.RunProcReturn("select * from h_v_IF_SeOutStockBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_SeOutStockBillList");
 
+
+               
+
                 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;
+                    }
+                    //=========================================================
+
+
                     //涓昏〃
-                    oCN.RunProc(@"Insert Into Xs_SeOutStockBillMain   
+                    string sql = $@"Insert Into Xs_SeOutStockBillMain   
                         (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus
 	                    ,HCusID,HManagerID,HDeptID,HRemark,HMaker,HMakeDate
-	                    ,HAddress,HSSID,HCurID,HWHID,HExRate,HEmpID,HExplanation,HInnerBillNo
-	                    ,HSALEORGID,HDELIVERYORGID,HOWNERID,HOWNERTYPEID
+	                    ,HAddress,HSSID,HCurID,HWHID,HExRate,HEmpID,HExplanation,HInnerBillNo,HSeOrderBillNo_M
+	                    ,HConveyTypeID,HConveyCompID,HConveyMoney,HLinkMan,HLinkPhone 
+                        ,HSALEORGID,HDELIVERYORGID,HOWNERID,HOWNERTYPEID
 	                    ,HChecker,HCheckDate,HCloseMan,HCloseDate,HERPInterID,HERPBillType,HDFflag)
                         values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1402 + "','" +
                     1402 + "','" + HDate + "','" + HBillNo + "'," + HBillStatus + "," + HCusID +
                     "," + HManagerID + "," + HDeptID + ",'" + HRemark + "','" + HMaker + "','" + HMakeDate +
                     "','" + HAddress + "'," + HSSID + "," + HCurID + "," + HWHID + "," + HExRate + "," + HEmpID + ",'" +
-                    HExplanation + "','" + HInnerBillNo + "'," + HSALEORGID + "," + HDELIVERYORGID + "," + HOWNERID + ",'"
+                    HExplanation + "','" + HInnerBillNo + "','" + HSeOrderBillNo_M + "','" + HConveyTypeID + "','" + HConveyCompID + "','" + HConveyMoney + "','" + HLinkMan + "','" + HLinkPhone + "'," + HSALEORGID + "," + HDELIVERYORGID + "," + HOWNERID + ",'"
                     + HOWNERTYPEID + "','" + HChecker + "','" + HCheckDate + "','" + HCloseMan + "','" + HCloseDate + "'," + HERPInterID +
-                    ",'" + HERPBillType + "'," + HDFflag + ")");
+                    ",'" + HERPBillType + "'," + HDFflag + ")";
+
+                    oCN.RunProc(sql);
                 }
                 else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                 { //淇敼
-                    oCN.RunProc("update Xs_SeOutStockBillMain  set " +
-                                "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" + "' where HInterID=" + HInterID);
+                    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;
+                    oCN.RunProc(sql);
 
                     //鍒犻櫎瀛愯〃
                     oCN.RunProc("delete from Xs_SeOutStockBillSub where HInterID='" + HInterID + "'");
                 }
                 //淇濆瓨瀛愯〃
                 objJsonResult = AddBillSub(msg3, HInterID, OperationType);
+
+
+                //淇濆瓨鍚庢帶鍒�=========================================
+                 ds = oCN.RunProcReturn("Exec h_p_Xs_SeOutStockBill_AfterSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "',1 ", "h_p_Xs_SeOutStockBill_AfterSaveCtrl");
+                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 (objJsonResult.code == "0")
                 {
@@ -316,6 +377,7 @@
             List<ClsXs_SeOutStockBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsXs_SeOutStockBillSub>>(msg3);
 
             int i = 0;
+            IList list = DetailColl;
             foreach (ClsXs_SeOutStockBillSub oSub in DetailColl)
             {
                 i++;
@@ -364,14 +426,16 @@
                     NewHEntryID += 1;
                 }
 
-                oCN.RunProc($@"Insert into Xs_SeOutStockBillSub 
+                string sql=$@"Insert into Xs_SeOutStockBillSub 
                 (HInterID,HEntryID,HMaterID,HUnitID,HQty,HPrice,HMoney,HWHID,HSPID,HRemark
 	            ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HSeOrderInterID,HSeOrderEntryID,HSeORderBillNo
-	            ,HOWNERID,HOWNERTYPEID,HSETTLEORGID,HMoveStockQty
+	            ,HOWNERID,HOWNERTYPEID,HMoveStockQty
 	            ,HRelationQty,HAuxPropID,HBatchNO,HMTONo,HERPInterID,HERPEntryID) 
                  values({HInterID},{NewHEntryID},{oSub.HMaterID},{oSub.HUnitID},{oSub.HQty}
-                ,{oSub.HPrice},{oSub.HMoney},{oSub.HWHID},{oSub.HSPID},'{oSub.HRemark}',{oSub.HSourceInterID},{oSub.HSourceEntryID},'{oSub.HSourceBillNo}','{oSub.HSourceBillType}',{oSub.HSeOrderInterID},{oSub.HSeOrderEntryID},'{oSub.HSeORderBillNo}',{oSub.HOWNERID},'{oSub.HOWNERTYPEID}',{oSub.HSETTLEORGID},{oSub.HMoveStockQty},{oSub.HRelationQty}
-                ,{oSub.HAuxPropID},'{oSub.HBatchNO}','{oSub.HMTONo}',{oSub.HERPInterID},{oSub.HERPEntryID})");
+                ,{oSub.HPrice},{oSub.HMoney},{oSub.HWHID},{oSub.HSPID},'{oSub.HRemark}',{oSub.HSourceInterID},{oSub.HSourceEntryID},'{oSub.HSourceBillNo}','{oSub.HSourceBillType}',{oSub.HSeOrderInterID},{oSub.HSeOrderEntryID},'{oSub.HSeORderBillNo}',{oSub.HOWNERID},'{oSub.HOWNERTYPEID}',{oSub.HMoveStockQty},{oSub.HRelationQty}
+                ,{oSub.HAuxPropID},'{oSub.HBatchNO}','{oSub.HMTONo}',{oSub.HERPInterID},{oSub.HERPEntryID})";
+
+                oCN.RunProc(sql);
             }
 
             objJsonResult.code = "1";
@@ -381,6 +445,90 @@
             return objJsonResult;
         }
 
+        #endregion
+
+        #region [鍚屾鎻掍欢]
+        [Route("Xs_SeOutStockBill/Xs_SeOutStockBillSaveApi")]
+        [HttpPost]
+        public object Xs_SeOutStockBillSaveApi([FromBody] JObject sMainSub)
+        {
+            try
+            {
+                //LogService.Write("鍙戣揣閫氱煡鍗曞悓姝�,淇濆瓨鏂规硶鎵ц瀹屾垚寮傚父锛�" + sMainSub.ToString());
+                var model = sMainSub["model"].ToString();
+                var entry = sMainSub["model"]["HENTRY"].ToString();
+
+                LogService.Write("鍙戣揣閫氱煡鍗曞悓姝� sMainSub:" + sMainSub);
+                model = "[" + model.ToString() + "]";
+                List<ClsXs_SeOutStockBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsXs_SeOutStockBillMain>>(model);
+                List<ClsXs_SeOutStockBillSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsXs_SeOutStockBillSub>>(entry);
+                string sql = string.Empty;
+                oCN.BeginTran();
+                sql = $"delete Xs_SeOutStockBillMain where HinterID = {mainList[0].HInterID}";
+                oCN.RunProc(sql);
+                sql = $"delete Xs_SeOutStockBillSub where HinterID = {mainList[0].HInterID}";
+                oCN.RunProc(sql);
+                //涓昏〃
+                oCN.RunProc(@"Insert Into Xs_SeOutStockBillMain   
+                        (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus
+                        ,HCusID,HManagerID,HDeptID,HRemark,HAddress,HSSID,HCurID,HWHID,HExRate
+                        ,HEmpID,HExplanation,HInnerBillNo,HSALEORGID,HDELIVERYORGID,HOWNERID
+                        ,HOWNERTYPEID,HERPInterID,HERPBillType,HMaker,HMakeDate,HChecker,HCheckDate
+                        ,HCloseMan,HCloseDate,HSTOCKERGROUPID,HSALEGROUPID,HSALEDEPTID,HBUSINESSTYPE
+                        ,HCARRIERID,HRECEIVERID,HSETTLEID,HPAYERID,HHEADLOCID,HRECCONTACTID
+                        ,HRECEIPTCONDITIONID,HCORRESPONDORGID,HCARRIAGENO)
+                        values(" + mainList[0].HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1402 + "','" +
+                    mainList[0].HBillSubType + "','" + mainList[0].HDate + "','" + mainList[0].HBillNo + "','" + mainList[0].HBillStatus + "'," + mainList[0].HCusID +
+                    "," + mainList[0].HManagerID + "," + mainList[0].HDeptID + ",'" + mainList[0].HRemark + "','" + mainList[0].HAddress + "'," + mainList[0].HSSID +
+                    "," + mainList[0].HCurID + "," + mainList[0].HWHID + "," + mainList[0].HExRate + "," + mainList[0].HEmpID + ",'" + mainList[0].HExplanation + "','"  + mainList[0].HInnerBillNo + "'," + mainList[0].HSALEORGID + "," + mainList[0].HDELIVERYORGID + "," + mainList[0].HOWNERID + ",'" +
+                    mainList[0].HOWNERTYPEID + "'," + mainList[0].HERPInterID + ",'" + mainList[0].HERPBillType + "','" + mainList[0].HMaker + "','" + mainList[0].HMakeDate + "','"
+                    + mainList[0].HChecker + "','" + mainList[0].HCheckDate + "','" + mainList[0].HCloseMan + "','" + mainList[0].HCloseDate + "'," + mainList[0].HSTOCKERGROUPID + ","
+                    + mainList[0].HSALEGROUPID + "," + mainList[0].HSALEDEPTID + ",'" + mainList[0].HBUSINESSTYPE + "'," + mainList[0].HCARRIERID + "," + mainList[0].HRECEIVERID + "," + mainList[0].HSETTLEID + "," + mainList[0].HPAYERID + "," + mainList[0].HHEADLOCID + "," + mainList[0].HRECCONTACTID + "," + mainList[0].HRECEIPTCONDITIONID + "," + mainList[0].HCORRESPONDORGID + ",'" + mainList[0].HCARRIAGENO + "'" + ")");
+                //淇濆瓨涓昏〃
+                foreach (var oSub in subList)
+                {
+                    sql = $@"
+Insert into Xs_SeOutStockBillSub 
+(HInterID,HEntryID,HMaterID,HUnitID,HQty,HPrice,HMoney,HWHID,HSPID,HRemark,
+HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HSeOrderInterID,
+HSeOrderEntryID,HSeORderBillNo,HOWNERID,HOWNERTYPEID,HSETTLEORGID,HMoveStockQty,
+HRelationQty,HAuxPropID,HBatchNO,HMTONo,HERPInterID,HERPEntryID,HCUSTMATID,
+HBASEUNITID,HBFLOWID,HOUTCONTROL,HSTOCKUNITID,HROWTYPE,HROWID,HPARENTROWID,
+HPARENTMATID,HTAXCOMBINATION,HPRICECOEFFICIENT,HSYSPRICE,HLIMITDOWNPRICE,
+HPRICEUNITID,HTAXPRICE,HTAXRATE,HTAXNETPRICE,HDISCOUNTRATE,HISFREE,HLOCALCURRID,
+HSETTLECURRID,HEXCHANGETYPEID,HSETTLETYPEID,HRECEIPTCONDITIONID,HEXCHANGERATE,
+HISINCLUDEDTAX,HISPRICEEXCLUDETAX,HTAXRATEID,HTaxRate_TAX,HCOSTPERCENT,HVAT,
+HSELLERWITHHOLDING,HBUYERWITHHOLDING) 
+values('{oSub.HInterID}','{oSub.HEntryID}','{oSub.HMaterID}','{oSub.HUnitID}','{oSub.HQty}','{oSub.HPrice}','{oSub.HMoney}','{oSub.HWHID}','{oSub.HSPID}','{oSub.HRemark}','{oSub.HSourceInterID}',
+'{oSub.HSourceEntryID}','{oSub.HSourceBillNo}','{oSub.HSourceBillType}','{oSub.HSeOrderInterID}','{oSub.HSeOrderEntryID}','{oSub.HSeORderBillNo}','{oSub.HOWNERID}','{oSub.HOWNERTYPEID}','{oSub.HSETTLEORGID}','{oSub.HMoveStockQty}',
+'{oSub.HRelationQty}','{oSub.HAuxPropID}','{oSub.HBatchNO}','{oSub.HMTONo}','{oSub.HERPInterID}',
+'{oSub.HERPEntryID}','{oSub.HCUSTMATID}','{oSub.HBASEUNITID}','{oSub.HBFLOWID}','{oSub.HOUTCONTROL}','{oSub.HSTOCKUNITID}','{oSub.HROWTYPE}',
+'{oSub.HROWID}','{oSub.HPARENTROWID}',
+'{oSub.HPARENTMATID}','{oSub.HTAXCOMBINATION}','{oSub.HPRICECOEFFICIENT}','{oSub.HSYSPRICE}','{oSub.HLIMITDOWNPRICE}','{oSub.HPRICEUNITID}','{oSub.HTAXPRICE}','{oSub.HTAXRATE}','{oSub.HTAXNETPRICE}','{oSub.HDISCOUNTRATE}','{oSub.HISFREE}',
+'{oSub.HLOCALCURRID}','{oSub.HSETTLECURRID}','{oSub.HEXCHANGETYPEID}','{oSub.HSETTLETYPEID}','{oSub.HRECEIPTCONDITIONID}','{oSub.HEXCHANGERATE}','{oSub.HISINCLUDEDTAX}','{oSub.HISPRICEEXCLUDETAX}','{oSub.HTAXRATEID}',
+'{oSub.HTaxRate_TAX}','{oSub.HCOSTPERCENT}','{oSub.HVAT}','{oSub.HSELLERWITHHOLDING}','{oSub.HBUYERWITHHOLDING}')";
+                    oCN.RunProc(sql);
+                }
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍗曟嵁淇濆瓨鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+
+            }
+            catch (Exception e)
+            {
+                LogService.Write("鍙戣揣閫氱煡鍗曞悓姝ュ紓甯�,淇濆瓨鏂规硶鎵ц瀹屾垚寮傚父锛�" + e.Message.ToString());
+
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
         #endregion
 
         #region [鍚屾鍗曟嵁]
@@ -470,7 +618,7 @@
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
-                        objJsonResult.Message = "閲戣澏鏀舵枡閫氱煡鍗曞悓姝ュけ璐sonRoot锛�" + _result;
+                        objJsonResult.Message = "閲戣澏鍙戣揣閫氱煡鍗曞悓姝ュけ璐sonRoot锛�" + _result;
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
@@ -709,5 +857,282 @@
         }
         #endregion
 
+        #region 鍙戣揣閫氱煡鍗曞鏍�/鍙嶅鏍稿姛鑳�
+        [Route("Xs_SeOutStockBill/CheckXs_SeOutStockBill")]
+        [HttpGet]
+        public object CheckXs_SeOutStockBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Xs_SeOutStockBill_Check", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愬鏍�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (string.IsNullOrWhiteSpace(HInterID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ClsPub.CurUserName = user;
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 瀹℃牳  2  鍙嶅鏍�
+                if (Type == 1)
+                {
+                    //瀹℃牳鍓嶆帶鍒�
+                    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;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    //鍙嶅鏍稿墠鎺у埗
+                    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");
+                        //if (DBUtility.ClsPub.isInt(DSet.Tables[0].Rows[0]["Hback"]) != 0)
+                        //{
+                        //    objJsonResult.code = "0";
+                        //    objJsonResult.count = 1;
+                        //    objJsonResult.Message = "璇ヤ换鍔″崟宸蹭笅鎺ㄦ祦杞崱锛屼笉鍏佽鍙嶅鏍�" + DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[0]["HBackRemark"]);
+                        //    objJsonResult.data = null;
+                        //    return objJsonResult;
+                        //}
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                oCN.Commit();//鎻愪氦浜嬪姟
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎵ц鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鍙戣揣閫氱煡鍗曞叧闂�/鍙嶅叧闂姛鑳�
+        [Route("Xs_SeOutStockBill/CloseXs_SeOutStockBill")]
+        [HttpGet]
+        public object CloseXs_SeOutStockBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Xs_SeOutStockBill_Close", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愬叧闂�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (string.IsNullOrWhiteSpace(HInterID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ClsPub.CurUserName = user;
+
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 鍏抽棴  2  鍙嶅叧闂�
+                if (Type == 1)
+                {
+                    if (!BillOld.CloseBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    if (!BillOld.CancelClose(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                oCN.Commit();//鎻愪氦浜嬪姟
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎵ц鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鍙戣揣閫氱煡鍗曚綔搴�/鍙嶄綔搴熷姛鑳�
+        [Route("Xs_SeOutStockBill/CancellXs_SeOutStockBill")]
+        [HttpGet]
+        public object CancellXs_SeOutStockBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Xs_SeOutStockBill_Delete", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愪綔搴�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (string.IsNullOrWhiteSpace(HInterID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ClsPub.CurUserName = user;
+
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 浣滃簾  2  鍙嶄綔搴�
+                if (Type == 1)
+                {
+                    if (!BillOld.Cancelltion(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    if (!BillOld.AbandonCancelltion(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                oCN.Commit();//鎻愪氦浜嬪姟
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎵ц鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1