From 06292df75e9b9586a8f342b09045c69a06671234 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期六, 11 五月 2024 16:14:19 +0800
Subject: [PATCH] 单品过站优化

---
 WebAPI/Controllers/仓存管理/验收入库/Kf_ProductInBillController.cs |  621 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 572 insertions(+), 49 deletions(-)

diff --git "a/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\351\252\214\346\224\266\345\205\245\345\272\223/Kf_ProductInBillController.cs" "b/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\351\252\214\346\224\266\345\205\245\345\272\223/Kf_ProductInBillController.cs"
index e9d1972..a866df1 100644
--- "a/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\351\252\214\346\224\266\345\205\245\345\272\223/Kf_ProductInBillController.cs"
+++ "b/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\351\252\214\346\224\266\345\205\245\345\272\223/Kf_ProductInBillController.cs"
@@ -12,18 +12,541 @@
 
 namespace WebAPI.Controllers
 {
-    //鐢熶骇鍏ュ簱鍗旵ontroller
     public class Kf_ProductInBillController : ApiController
     {
-        //鑾峰彇绯荤粺鍙傛暟
-        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
-
         public DBUtility.ClsPub.Enum_BillStatus BillStatus;
-        public DAL.ClsKf_ProductInBill BillOld = new DAL.ClsKf_ProductInBill();
+        public const string ModName = "1202";                   //鍗曟嵁绫诲瀷
+        public const string ModCaption = "鐢熶骇鍏ュ簱鍗�";          //鍗曟嵁鍚嶇О
+        public const string ModRightName = "Kf_ProductInBill";
+        public const string ModRightNameList = ModRightName + "List";       //鍒楄〃
+        public const string ModRightNameEdit = ModRightName + "_Edit";      //缂栬緫
+        public const string ModRightNameCheck = ModRightName + "_Check";    //瀹℃牳
+        public const string ModRightNameClose = ModRightName + "_Close";    //鍏抽棴
+        public const string ModRightNameDelete = ModRightName + "_Delete";  //浣滃簾
+        public const string ModRightNameDrop = ModRightName + "_Drop";      //鍒犻櫎
+        public const string ModRightNameMoney = ModRightName + "_Money";    //閲戦
+        public const string ModRightNameQty = ModRightName + "_Qty";        //鏁伴噺
+        public DataSet ds = new DataSet();
         private json objJsonResult = new json();
-        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-        DataSet ds;
+        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+        public DAL.ClsKf_ProductInBill oBill = new DAL.ClsKf_ProductInBill();
+        public DAL.ClsKf_ProductInBill BillOld = new DAL.ClsKf_ProductInBill();
 
+
+        #region 鐢熶骇鍏ュ簱鍗曞垪琛�
+        /// <summary>
+        /// 鑾峰彇鐢熶骇鍏ュ簱鍗曞垪琛ㄤ俊鎭�
+        /// </summary>
+        /// <returns></returns>
+        [Route("Kf_ProductInBillController/GetKf_ProductInBillList_Json")]
+        [HttpGet]
+        public object GetKf_ProductInBillList_Json(string sWhere, string HMaker, string OperationType, string ViewName)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (OperationType == "1")
+                {
+                    //鍒ゆ柇鏉冮檺
+                    if (!DBUtility.ClsPub.Security_Log(ModRightNameList, 3, false, HMaker))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                //杩斿洖鍒楄〃淇℃伅
+                ds = oCn.RunProcReturn("select * from " + ViewName + " where 1=1 " + sWhere + " order by hmainid desc", ViewName);
+                List<object> columnNameList = new List<object>();
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));  //鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎴愬姛锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ鍒楄〃淇℃伅澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鐢熶骇鍏ュ簱鍗� 鍒犻櫎
+        /// <summary>
+        /// 鍒犻櫎鐢熶骇鍏ュ簱鍗�
+        /// </summary>
+        /// <returns></returns>
+        [Route("Kf_ProductInBillController/GetKf_ProductInBill_Delete_Json")]
+        [HttpGet]
+        public object GetKf_ProductInBill_Delete_Json(Int64 HInterID, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameDrop, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鍒犻櫎鍔熻兘鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒ゆ柇瀛樺湪鎬�
+                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    //鍒犻櫎鍓嶆帶鍒�
+                    DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Kf_ProductInBill_BeforeDelCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Kf_ProductInBill_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;
+                        }
+                    }
+                    //鍒犻櫎鍗曟嵁锛堝寘鍚垹闄ゅ悗鎺у埗銆佸啓鍏ユ棩蹇楋級
+                    if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_ProductInBill_AfterDelCtrl", HMaker, ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍒犻櫎鐢熶骇鍏ュ簱鍗曟垚鍔燂紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    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 鐢熶骇鍏ュ簱鍗� 瀹℃牳/鍙嶅鏍�
+        /// <summary>
+        /// 瀹℃牳/鍙嶅鏍哥敓浜у叆搴撳崟
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="Type">瀹℃牳(1),鍙嶅鏍�(2)</param>
+        /// <param name="HMaker">瀹℃牳浜�</param>
+        /// <returns></returns>
+        [Route("Kf_ProductInBillController/GetKf_ProductInBill_Check_Json")]
+        [HttpGet]
+        public object GetKf_ProductInBill_Check_Json(Int64 HInterID, int Type, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡瀹℃牳/鍙嶅鏍稿姛鑳芥潈闄�,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒ゆ柇瀛樺湪鎬�
+                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    //Type 1 瀹℃牳  2  鍙嶅鏍�
+                    if (Type == 1)
+                    {
+                        if (oBill.omodel.HChecker.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍革紝涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (oBill.omodel.HCloseMan.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂紝涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (oBill.omodel.HDeleteMan.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴燂紝涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //瀹℃牳鍓嶆帶鍒�
+                        DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Kf_ProductInBill_BeforeCheckCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Kf_ProductInBill_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 (!oBill.CheckBill(HInterID, oBill.omodel.HBillNo, "h_p_Kf_ProductInBill_AfterCheckCtrl", HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 瀹℃牳鎴愬姛锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                    else
+                    {
+                        if (oBill.omodel.HChecker.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍革紝涓嶉渶瑕佸弽瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶅鏍稿墠鎺у埗
+                        DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Kf_ProductInBill_BeforeUnCheckCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Kf_ProductInBill_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 (!oBill.AbandonCheck(HInterID, oBill.omodel.HBillNo, "h_p_Kf_ProductInBill_AfterUnCheckCtrl", HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍙嶅鏍告垚鍔燂紒";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    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 鐢熶骇鍏ュ簱鍗� 鍏抽棴/鍙嶅叧闂�
+        /// <summary>
+        /// 鍏抽棴/鍙嶅叧闂敓浜у叆搴撳崟
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="Type">鍏抽棴(1),鍙嶅叧闂�(2)</param>
+        /// <param name="HMaker">鍏抽棴浜�</param>
+        /// <returns></returns>
+        [Route("Kf_ProductInBillController/GetKf_ProductInBill_Close_Json")]
+        [HttpGet]
+        public object GetKf_ProductInBill_Close_Json(Int64 HInterID, int Type, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameClose, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鍏抽棴/鍙嶅叧闂姛鑳芥潈闄�,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒ゆ柇瀛樺湪鎬�
+                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    //Type 1 鍏抽棴  2  鍙嶅叧闂�
+                    if (Type == 1)
+                    {
+                        if (oBill.omodel.HCloseMan.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂紝涓嶈兘鍐嶆鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍏抽棴鍗曟嵁
+                        if (!oBill.CloseBill(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍏抽棴鎴愬姛锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                    else
+                    {
+                        if (oBill.omodel.HCloseMan.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈叧闂紝涓嶉渶瑕佸弽鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶅叧闂崟鎹�
+                        if (!oBill.CancelClose(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍙嶅叧闂垚鍔燂紒";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    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 鐢熶骇鍏ュ簱鍗� 浣滃簾/鍙嶄綔搴�
+        /// <summary>
+        /// 浣滃簾/鍙嶄綔搴熺敓浜у叆搴撳崟
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="Type">浣滃簾(1),鍙嶄綔搴�(2)</param>
+        /// <param name="HMaker">浣滃簾浜�</param>
+        /// <returns></returns>
+        [Route("Kf_ProductInBillController/GetKf_ProductInBill_Cancelltion_Json")]
+        [HttpGet]
+        public object GetKf_ProductInBill_Cancelltion_Json(Int64 HInterID, int Type, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡浣滃簾/鍙嶄綔搴熷姛鑳芥潈闄�,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒ゆ柇瀛樺湪鎬�
+                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    //Type 1 浣滃簾  2  鍙嶄綔搴�
+                    if (Type == 1)
+                    {
+                        if (oBill.omodel.HDeleteMan.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴燂紝涓嶈兘鍐嶆浣滃簾锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //浣滃簾鍗曟嵁
+                        if (!oBill.Cancelltion(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 浣滃簾鎴愬姛锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                    else
+                    {
+                        if (oBill.omodel.HDeleteMan.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈綔搴燂紝涓嶉渶瑕佸弽浣滃簾锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶄綔搴熷崟鎹�
+                        if (!oBill.AbandonCancelltion(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍙嶄綔搴熸垚鍔燂紒";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    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
+
+
+
+
+        //---------------------------------------------------------------------------------------------鏃ф柟娉�20240422鍓�
 
         #region 鐢熶骇鍏ュ簱鍗� 鏌ユ壘璁板綍鍔熻兘
         /// <summary>
@@ -38,7 +561,7 @@
             try
             {
 
-                ds = oCN.RunProcReturn("select * from h_v_IF_ProductInBillList where hmainid=" + HInterID, "h_v_IF_ProductInBillList");
+                ds = oCn.RunProcReturn("select * from h_v_IF_ProductInBillList where hmainid=" + HInterID, "h_v_IF_ProductInBillList");
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
@@ -91,12 +614,12 @@
 
                 if (sWhere == null || sWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn("select * from h_v_IF_ProductInBillList where 1=1  order by hmainid desc", "h_v_IF_ProductInBillList");
+                    ds = oCn.RunProcReturn("select * from h_v_IF_ProductInBillList where 1=1  order by hmainid desc", "h_v_IF_ProductInBillList");
                 }
                 else
                 {
                     string sql = "select * from h_v_IF_ProductInBillList where 1 = 1 " + sWhere + " order by hmainid desc";
-                    ds = oCN.RunProcReturn(sql, "h_v_IF_ProductInBillList");
+                    ds = oCn.RunProcReturn(sql, "h_v_IF_ProductInBillList");
                 }
 
 
@@ -133,7 +656,7 @@
                 string HBillNo = "";
                 //鍒犻櫎鍓嶆帶鍒�=========================================      
                 string sql1 = "exec h_p_Kf_ProductInBill_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
-                ds = oCN.RunProcReturn(sql1, "h_p_Kf_ProductInBill_BeforeDelCtrl");
+                ds = oCn.RunProcReturn(sql1, "h_p_Kf_ProductInBill_BeforeDelCtrl");
                 if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
@@ -154,14 +677,14 @@
                 //==================================================================================      
 
                 string sReturn = "";
-                oCN.BeginTran();
-                oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID);
-                oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID);
-                oCN.Commit();
+                oCn.BeginTran();
+                oCn.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID);
+                oCn.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID);
+                oCn.Commit();
 
                 //鍒犻櫎鍚庢帶鍒�==================================================================================      
                 string sql2 = "exec h_p_Kf_ProductInBill_AfterDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
-                ds = oCN.RunProcReturn(sql2, "h_p_Kf_ProductInBill_AfterDelCtrl");
+                ds = oCn.RunProcReturn(sql2, "h_p_Kf_ProductInBill_AfterDelCtrl");
                 if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                 {
                     sReturn = "鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
@@ -169,7 +692,7 @@
                     objJsonResult.count = 1;
                     objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + sReturn;
                     objJsonResult.data = null;
-                    oCN.RollBack();
+                    oCn.RollBack();
                     return objJsonResult;
                 }
                 if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
@@ -179,7 +702,7 @@
                     objJsonResult.count = 1;
                     objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + sReturn;
                     objJsonResult.data = null;
-                    oCN.RollBack();
+                    oCn.RollBack();
                     return objJsonResult;
                 }
                 //==============================================================================================
@@ -192,7 +715,7 @@
             }
             catch (Exception e)
             {
-                oCN.RollBack();
+                oCn.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = "Exception锛�" + e.ToString();
@@ -211,19 +734,19 @@
             {
                 var _value = sMainSub["sMainSub"].ToString();
                 string msg1 = _value.ToString();
-                oCN.BeginTran();
+                oCn.BeginTran();
                 //淇濆瓨涓昏〃
                 objJsonResult = AddBillMain(msg1);
                 if (objJsonResult.code == "0")
                 {
-                    oCN.RollBack();
+                    oCn.RollBack();
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = objJsonResult.Message;
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                oCN.Commit();
+                oCn.Commit();
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "鍗曟嵁淇濆瓨鎴愬姛锛�";
@@ -233,7 +756,7 @@
             }
             catch (Exception e)
             {
-                oCN.RollBack();
+                oCn.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
@@ -304,12 +827,12 @@
                 string HSUPPLYADDRESS = mainList2[0].HSUPPLYADDRESS == null ? "''" : mainList2[0].HSUPPLYADDRESS;
                 long HPROVIDERCONTACTID = mainList2[0].HPROVIDERCONTACTID == null ? 0 : mainList2[0].HPROVIDERCONTACTID;
 
-                ds = oCN.RunProcReturn("select * from h_v_IF_ProductInBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_ProductInBillList");
+                ds = oCn.RunProcReturn("select * from h_v_IF_ProductInBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_ProductInBillList");
                 if ((OperationType == 1 || OperationType == 2 || OperationType == 4) && ds.Tables[0].Rows.Count == 0)//鏂板
                 {
 
                     //淇濆瓨鍓嶆帶鍒�=========================================
-                    ds = oCN.RunProcReturn("exec h_p_Kf_ProductInBill_BeforeSaveCtrl " + HInterID, "h_p_Kf_ProductInBill_BeforeSaveCtrl");
+                    ds = oCn.RunProcReturn("exec h_p_Kf_ProductInBill_BeforeSaveCtrl " + HInterID, "h_p_Kf_ProductInBill_BeforeSaveCtrl");
 
                     if (ds == null || ds.Tables[0].Rows.Count == 0)
                     {
@@ -337,7 +860,7 @@
                     "," + HManagerID + "," + HEmpID + "," + HDeptID + "," + HSecManagerID + "," + HKeeperID + ",'" + HRemark + "','" + HMaker +
                     "',getdate()" + "," + HCurID + "," + HExRate + "," + HWHID + ",'" + HInnerBillNo + "','" + HExplanation + "')";
 
-                    oCN.RunProc(sql);
+                    oCn.RunProc(sql);
 
                 }
                 else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
@@ -348,20 +871,20 @@
                                  + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID
                                  + ",HInnerBillNo='" + HInnerBillNo + "' where HInterID=" + HInterID;
 
-                    oCN.RunProc(sql);
+                    oCn.RunProc(sql);
 
                     
                     //鍒犻櫎瀛愯〃
-                    oCN.RunProc("delete from Kf_ICStockBillSub where HInterID='" + HInterID + "'");
+                    oCn.RunProc("delete from Kf_ICStockBillSub where HInterID='" + HInterID + "'");
                 }
                 //淇濆瓨瀛愯〃
                 objJsonResult = AddBillSub(msg3, HInterID, OperationType, user);
 
                 //鐢熶骇鍏ュ簱鍗曟柊澧炲洖濉敓浜ц鍗曞叧鑱旀暟閲�
-                oCN.RunProc("exec h_p_Kf_UpDateRelation_ProductInToICMO_Add " + HInterID);
+                oCn.RunProc("exec h_p_Kf_UpDateRelation_ProductInToICMO_Add " + HInterID);
 
                 //鐢熶骇鍏ュ簱鍗曟柊澧炲洖濉敓浜ф眹鎶ュ崟鍏宠仈鏁伴噺
-                oCN.RunProc("exec h_p_Kf_UpDateRelation_ProductInToICMOReport_Add " + HInterID);
+                oCn.RunProc("exec h_p_Kf_UpDateRelation_ProductInToICMOReport_Add " + HInterID);
 
                 if (objJsonResult.code == "0")
                 {
@@ -445,7 +968,7 @@
 
                 DataSet Cs;
                 Int64 NewHEntryID = 1;
-                Cs = oCN.RunProcReturn("select MAX(HEntryID)HEntryID from Kf_ICStockBillSub", "Kf_ICStockBillSub");
+                Cs = oCn.RunProcReturn("select MAX(HEntryID)HEntryID from Kf_ICStockBillSub", "Kf_ICStockBillSub");
                 if (Cs.Tables[0].Rows.Count != 0 && ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()) != 0)
                 {
                     NewHEntryID = ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString());
@@ -453,7 +976,7 @@
                 }
                
 
-                oCN.RunProc($@"Insert into Kf_ICStockBillSub 
+                oCn.RunProc($@"Insert into Kf_ICStockBillSub 
                 (HInterID,HEntryID,HMaterID,HUnitID,HQtyMust,HQty,HPrice
 	            ,HMoney,HWHID,HSPID,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HPOOrderInterID
                 ,HPOOrderEntryID,HPOORderBillNo,HSecUnitID,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo,HRelationQty,HSecUnitRate,HPropertyID) 
@@ -463,7 +986,7 @@
 
             }
             //淇濆瓨鍚庢帶鍒�=========================================              
-            ds = oCN.RunProcReturn("exec h_p_Kf_ProductInBill_AfterSaveCtrl " + HInterID, "h_p_Kf_ProductInBill_AfterSaveCtrl");
+            ds = oCn.RunProcReturn("exec h_p_Kf_ProductInBill_AfterSaveCtrl " + HInterID, "h_p_Kf_ProductInBill_AfterSaveCtrl");
 
             if (ds == null || ds.Tables[0].Rows.Count == 0)
             {
@@ -496,14 +1019,14 @@
         [HttpGet]
         public ApiResult<DataTable> getMaterialByMaterID(Int64 HMaterID)
         {
-            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
 
             string sql = "select a.HItemID HMaterID,a.HNumber HMaterNumber,a.HName HMaterName,a.HMaterRuleType,a.HModel HMaterModel,a.HUnitID, b.HNumber HUnitNumber, b.HName HUnitName" +
                 " from Gy_Material AS a " +
                 " LEFT OUTER JOIN Gy_Unit AS b on a.HUnitID = b.HItemID " +
                 " where a.HItemID =" + HMaterID;
 
-            var dataSet = oCN.RunProcReturn(sql, "Gy_Material");
+            var dataSet = oCn.RunProcReturn(sql, "Gy_Material");
 
 
             if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
@@ -541,7 +1064,7 @@
 
                 ClsPub.CurUserName = user;
                 BillOld.MvarItemKey = "Kf_ICStockBillMain";
-                oCN.BeginTran();//寮�濮嬩簨鍔�
+                oCn.BeginTran();//寮�濮嬩簨鍔�
 
                 //Type 1 瀹℃牳  2  鍙嶅鏍�
                 if (Type == 1)
@@ -549,7 +1072,7 @@
                     //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳
                     DataSet ds;
                     string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
-                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+                    ds = oCn.RunProcReturn(sql, BillOld.MvarItemKey);
                     if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                     {
                         if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
@@ -576,7 +1099,7 @@
                     //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅鏍�
                     DataSet ds;
                     string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
-                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+                    ds = oCn.RunProcReturn(sql, BillOld.MvarItemKey);
                     if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                     {
                         if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
@@ -612,7 +1135,7 @@
                     }
                 }
 
-                oCN.Commit();//鎻愪氦浜嬪姟
+                oCn.Commit();//鎻愪氦浜嬪姟
 
                 objJsonResult.code = "0";
                 objJsonResult.count = 1;
@@ -729,7 +1252,7 @@
 
                     //瀹℃牳鍓嶆帶鍒�=========================================      
                     string sql1 = "exec h_p_Kf_ProductInBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
-                    ds = oCN.RunProcReturn(sql1, "h_p_Kf_ProductInBill_BeforeCheckCtrl");
+                    ds = oCn.RunProcReturn(sql1, "h_p_Kf_ProductInBill_BeforeCheckCtrl");
                     if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                     {
                         objJsonResult.code = "0";
@@ -770,7 +1293,7 @@
                 if (IsAudit == 1) //鍙嶅鏍告彁浜�
                 {
                     //鍙嶅鏍稿墠鎺у埗=========================================
-                    DataSet ds = oCN.RunProcReturn("Exec h_p_Kf_ProductInBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'", "h_p_Kf_ProductInBill_BeforeUnCheckCtrl");
+                    DataSet ds = oCn.RunProcReturn("Exec h_p_Kf_ProductInBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'", "h_p_Kf_ProductInBill_BeforeUnCheckCtrl");
                     if (ds == null)
                     {
                         objJsonResult.code = "0";
@@ -848,7 +1371,7 @@
 
                 ClsPub.CurUserName = user;
                 BillOld.MvarItemKey = "Kf_ICStockBillMain";
-                oCN.BeginTran();//寮�濮嬩簨鍔�
+                oCn.BeginTran();//寮�濮嬩簨鍔�
 
                 //Type 1 鍏抽棴  2  鍙嶅叧闂�
                 if (Type == 1)
@@ -856,7 +1379,7 @@
                     //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍏抽棴
                     DataSet ds;
                     string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
-                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+                    ds = oCn.RunProcReturn(sql, BillOld.MvarItemKey);
                     if (ds == null || ds.Tables[0].Rows.Count == 0)
                     {
                         objJsonResult.code = "0";
@@ -908,7 +1431,7 @@
                     //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅叧闂�
                     DataSet ds;
                     string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
-                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+                    ds = oCn.RunProcReturn(sql, BillOld.MvarItemKey);
                     if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                     {
                         if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
@@ -947,7 +1470,7 @@
                     }
                 }
 
-                oCN.Commit();//鎻愪氦浜嬪姟
+                oCn.Commit();//鎻愪氦浜嬪姟
 
                 objJsonResult.code = "0";
                 objJsonResult.count = 1;
@@ -995,7 +1518,7 @@
 
                 ClsPub.CurUserName = user;
                 BillOld.MvarItemKey = "Kf_ICStockBillMain";
-                oCN.BeginTran();//寮�濮嬩簨鍔�
+                oCn.BeginTran();//寮�濮嬩簨鍔�
 
                 //Type 1 浣滃簾  2  鍙嶄綔搴�
                 if (Type == 1)
@@ -1003,7 +1526,7 @@
                     //鍒ゆ柇鍗曟嵁鏄惁宸茬粡浣滃簾
                     DataSet ds;
                     string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
-                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+                    ds = oCn.RunProcReturn(sql, BillOld.MvarItemKey);
                     if (ds == null || ds.Tables[0].Rows.Count == 0)
                     {
                         objJsonResult.code = "0";
@@ -1046,7 +1569,7 @@
                     //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶄綔搴�
                     DataSet ds;
                     string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
-                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+                    ds = oCn.RunProcReturn(sql, BillOld.MvarItemKey);
                     if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                     {
                         if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
@@ -1077,7 +1600,7 @@
                     }
                 }
 
-                oCN.Commit();//鎻愪氦浜嬪姟
+                oCn.Commit();//鎻愪氦浜嬪姟
 
                 objJsonResult.code = "0";
                 objJsonResult.count = 1;

--
Gitblit v1.9.1