From 2b97561b724f3ded56463a1e4c2d59c922ed8aef Mon Sep 17 00:00:00 2001
From: pzy <2829717936@qq.com>
Date: 星期二, 13 八月 2024 09:05:46 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/仓存管理/领料发货/Kf_MateOutBillController.cs |  762 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 754 insertions(+), 8 deletions(-)

diff --git "a/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\351\242\206\346\226\231\345\217\221\350\264\247/Kf_MateOutBillController.cs" "b/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\351\242\206\346\226\231\345\217\221\350\264\247/Kf_MateOutBillController.cs"
index cba29cf..b861fd2 100644
--- "a/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\351\242\206\346\226\231\345\217\221\350\264\247/Kf_MateOutBillController.cs"
+++ "b/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\351\242\206\346\226\231\345\217\221\350\264\247/Kf_MateOutBillController.cs"
@@ -1,4 +1,5 @@
 锘縰sing DBUtility;
+using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using System;
 using System.Collections.Generic;
@@ -17,17 +18,19 @@
         private json objJsonResult = new json();
         public DataSet ds = new DataSet();
         public SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
         public DLL.ClsKf_MateOutBill BillNew0 = new DLL.ClsKf_MateOutBill();   //妯″叿鎶ュ簾鍏ュ簱瀵瑰簲鍗曟嵁绫�
         public DLL.ClsKf_MateOutBill BillOld0 = new DLL.ClsKf_MateOutBill();   //妯″叿鎶ュ簾鍏ュ簱瀵瑰簲鍗曟嵁绫�
 
         #region 鐢熶骇棰嗘枡鍗曞垪琛�
-
+       
         [Route("Kf_MateOutBill/GetMateOutBillList")]
         [HttpGet]
         public object GetMateOutBillList(string sWhere,string user)
         {
             try
             {
+                List<object> columnNameList = new List<object>();  //瀹氫箟澹版槑鍙橀噺 锛屾妸閫氳繃 new List<object>()鍒涘缓鐨� 瀹炰緥锛岃祴鍊肩粰鍙橀噺
                 //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
                 if (!DBUtility.ClsPub.Security_Log("Kf_MateOutBillQuery", 1, false, user))
                 {
@@ -38,14 +41,20 @@
                     return objJsonResult;
                 }
 
-                ds = oCn.RunProcReturn("select * from h_v_IF_MateOutBillList " + sWhere + " order by hmainid desc", "h_v_IF_MateOutBillList");
-
+                ds = oCn.RunProcReturn("select * from h_v_IF_MateOutBillList_Search " + sWhere + " order by 鏃ユ湡 desc, hmainid desc", "h_v_IF_MateOutBillList_Search");
+                foreach (DataColumn col in ds.Tables[0].Columns)//閬嶅巻ds涓涓�涓〃锛圱ables[0]锛夌殑鎵�鏈夊垪锛圕olumns锛夋瘡娆″惊鐜腑锛宑ol鍙橀噺浼氭寔鏈夊綋鍓嶅垪鐨勫紩鐢�
+                {
+                    Type dataType = col.DataType; //鑾峰彇褰撳墠鏁版嵁绫诲瀷浼犲叆 鑷畾涔夊彉閲廳atadataType
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //瀛楃涓叉嫾鎺�         // 灏嗗垪鍚嶅拰鏁版嵁绫诲瀷淇℃伅鎷兼帴鎴愪竴涓狫SON鏍煎紡鐨勫瓧绗︿覆
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
                 //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                 //{
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
                 objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
                 return objJsonResult;
                 //}
                 //else
@@ -126,6 +135,17 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
+
+                //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗
+                int sYear = 0;
+                int sPeriod = 0;
+                DateTime HDate = DateTime.Now;
+                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false)
+                {
+                    objJsonResult.Message = s;
+                    return objJsonResult;
+                }
+
                 bool IsDete = oBill.DeleteBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo);
                 if (IsDete)
                 {
@@ -403,7 +423,7 @@
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                 if (sqlWhere == null || sqlWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn(string.Format(@"select HMaterID ,鐗╂枡浠g爜 HMaterCode ,鐗╂枡鍚嶇О HMaterName,鐗╂枡鍒嗙被 HMaterRuleType,瑙勬牸鍨嬪彿 HMaterSpec,鐢ㄩ噺 HRate,HUnitID,璁¢噺鍗曚綅浠g爜 HUnitCode,璁¢噺鍗曚綅 HUnitName,搴旀敹鏁伴噺 HQtyMust,瀹炴敹鏁伴噺 HQty,鍗曚环 HPrice,閲戦 HMoney,HWHID,棰嗘枡浠撳簱浠g爜 HWHCode,棰嗘枡浠撳簱 HWHName,琛ㄤ綋澶囨敞 HRemark
+                    ds = oCN.RunProcReturn(string.Format(@"select HMaterID ,鐗╂枡浠g爜 HMaterCode ,鐗╂枡鍚嶇О HMaterName,鐗╂枡鍏紡 HMaterRuleType,瑙勬牸鍨嬪彿 HMaterSpec,鐢ㄩ噺 HRate,HUnitID,璁¢噺鍗曚綅浠g爜 HUnitCode,璁¢噺鍗曚綅 HUnitName,搴旀敹鏁伴噺 HQtyMust,瀹炴敹鏁伴噺 HQty,鍗曚环 HPrice,閲戦 HMoney,HWHID,棰嗘枡浠撳簱浠g爜 HWHCode,棰嗘枡浠撳簱 HWHName,琛ㄤ綋澶囨敞 HRemark,瀹為檯绉伴噸 HWeight
 from h_v_IF_MateOutBillList"), "H_V_IF_MATEOUTBILLLIST");
 
                 }
@@ -411,9 +431,9 @@
                 {
 
                     //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark  from Sc_MouldRepairCheckBillSub where 1 = 1 ";
-                    string sql1 = string.Format(@"select HMaterID ,鐗╂枡浠g爜 HMaterCode ,鐗╂枡鍚嶇О HMaterName,鐗╂枡鍒嗙被 HMaterRuleType,瑙勬牸鍨嬪彿 HMaterSpec,鐢ㄩ噺 HRate, HUnitID,璁¢噺鍗曚綅浠g爜 HUnitCode,璁¢噺鍗曚綅 HUnitName,搴旀敹鏁伴噺 HQtyMust,瀹炴敹鏁伴噺 HQty,鍗曚环 HPrice,閲戦 HMoney,HWHID,棰嗘枡浠撳簱浠g爜 HWHCode,棰嗘枡浠撳簱 HWHName,琛ㄤ綋澶囨敞 HRemark
+                    string sql1 = string.Format(@"select HMaterID ,鐗╂枡浠g爜 HMaterCode ,鐗╂枡鍚嶇О HMaterName,鐗╂枡鍏紡 HMaterRuleType,瑙勬牸鍨嬪彿 HMaterSpec,鐢ㄩ噺 HRate, HUnitID,璁¢噺鍗曚綅浠g爜 HUnitCode,璁¢噺鍗曚綅 HUnitName,搴旀敹鏁伴噺 HQtyMust,瀹炴敹鏁伴噺 HQty,鍗曚环 HPrice,閲戦 HMoney,HWHID,棰嗘枡浠撳簱浠g爜 HWHCode,棰嗘枡浠撳簱 HWHName,琛ㄤ綋澶囨敞 HRemark, 瀹為檯绉伴噸 HWeight
 from h_v_IF_MateOutBillList WHERE 1=1");
-                    string sql = sql1 + sqlWhere;
+                    string sql = sql1 + sqlWhere + " order by HSubID asc";
                     ds = oCN.RunProcReturn(sql, "H_V_IF_MATEOUTBILLLIST");
                 }
                 //鏌ユ眹鎬�
@@ -597,17 +617,31 @@
                     oBill.DetailColl.Add(oItemSub);
 
                 }
+                //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗
+                int sYear = 0;
+                int sPeriod = 0;
+                DateTime HDate = DateTime.Now;
+                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false)
+                {
+                    objJsonResult.Message = s;
+                    return objJsonResult;
+                }
+
                 //淇濆瓨
                 //淇濆瓨瀹屾瘯鍚庡鐞�
                 bool bResult;
-                if (oBill.omodel.HInterID == 0)
+                if (refSav == "Add")
                 {
                     // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                     bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                 }
-                else
+                else if(refSav=="Update")
                 {
                     bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                else
+                {
+                    bResult = false;
                 }
                 if (bResult)
                 {
@@ -769,5 +803,717 @@
             }
         }
         #endregion
+
+        #region 鐢熶骇棰嗘枡鍗� 瀹℃牳/鍙嶅鏍�
+        /// <summary>
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param>
+        /// <param name="CurUserName">瀹℃牳浜�</param>
+        /// <returns></returns>
+        [Route("Kf_MateOutBill/AuditKf_MateOutBill")]
+        [HttpGet]
+        public object AuditKf_MateOutBill(int HInterID, int IsAudit, string CurUserName)
+        {
+            string ModRightNameCheck = "Kf_MateOutBill_Check";
+            DBUtility.ClsPub.CurUserName = CurUserName;
+            try
+            {
+                //瀹℃牳鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //HInterID鏁版嵁鍒ゆ柇
+                if (HInterID <= 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID灏忎簬0锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                Int64 lngBillKey = 0;
+                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹�
+                DAL.ClsKf_MateOutBill oBill = new DAL.ClsKf_MateOutBill();                              //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+                //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁
+                {
+                    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;
+                    }
+                    if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
+                    {
+                        if (oBill.omodel.HChecker.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                    {
+                        if (oBill.omodel.HChecker.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗
+                string s = "";
+                int sYear = 0;
+                int sPeriod = 0;
+                DateTime HDate = DateTime.Now;
+                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false)
+                {
+                    objJsonResult.Message = s;
+                    return objJsonResult;
+                }
+
+                //杩涜闇�瑕佽繘琛岀殑瀹℃牳/鍙嶅鏍告搷浣�
+                if (IsAudit == 0) //瀹℃牳鎻愪氦
+                {                  
+                    //瀹℃牳鎻愪氦
+                    if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳鎴愬姛";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                if (IsAudit == 1) //鍙嶅鏍告彁浜�
+                {                   
+                    //鍙嶅鏍告彁浜bandonCheck
+                    if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅鏍告垚鍔�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                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="IsAudit">鍏抽棴(0),鍙嶅叧闂�(1)</param>
+        /// <param name="CurUserName">鍏抽棴浜�</param>
+        /// <returns></returns>
+        [Route("Kf_MateOutBill/CloseKf_MateOutBill")]
+        [HttpGet]
+        public object CloseKf_MateOutBill(int HInterID, int IsAudit, string CurUserName)
+        {
+            string ModRightNameCheck = "Kf_MateOutBill_Close";
+            DBUtility.ClsPub.CurUserName = CurUserName;
+            try
+            {
+                //妫�鏌ユ潈闄�
+                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍏抽棴澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //HInterID鏁版嵁鍒ゆ柇
+                if (HInterID <= 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID灏忎簬0锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                Int64 lngBillKey = 0;
+                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹�
+                DAL.ClsKf_MateOutBill oBill = new DAL.ClsKf_MateOutBill();              //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+                //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁
+                {
+                    if (oBill.omodel.HDeleteMan.Trim() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (oBill.omodel.HChecker.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (IsAudit == 0)  //鍏抽棴鍒ゆ柇
+                    {
+                        if (oBill.omodel.HCloseMan.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    if (IsAudit == 1) //鍙嶅叧闂垽鏂�
+                    {
+                        if (oBill.omodel.HCloseMan.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈叧闂�!涓嶉渶瑕佸弽鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                //杩涜闇�瑕佽繘琛岀殑鍏抽棴/鍙嶅叧闂搷浣�
+                if (IsAudit == 0) //鍏抽棴鎻愪氦
+                {
+                    //鍏抽棴鎻愪氦
+                    if (oBill.CloseBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍏抽棴鎴愬姛";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                if (IsAudit == 1) //鍙嶅叧闂彁浜�
+                {
+                    //鍙嶅叧闂彁浜�
+                    if (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅叧闂垚鍔�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                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="IsAudit">浣滃簾(0),鍙嶄綔搴�(1)</param>
+        /// <param name="CurUserName">浣滃簾浜�</param>
+        /// <returns></returns>
+        [Route("Kf_MateOutBill/DeleteKf_MateOutBill")]
+        [HttpGet]
+        public object DeleteKf_MateOutBill(int HInterID, int IsAudit, string CurUserName)
+        {
+            string ModRightNameCheck = "Kf_MateOutBill_Delete";
+            DBUtility.ClsPub.CurUserName = CurUserName;
+            try
+            {
+                //妫�鏌ユ潈闄�
+                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "浣滃簾澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //HInterID鏁版嵁鍒ゆ柇
+                if (HInterID <= 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID灏忎簬0锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                Int64 lngBillKey = 0;
+                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹�
+                DAL.ClsKf_MateOutBill oBill = new DAL.ClsKf_MateOutBill();              //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+                //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁
+                {
+                    if (oBill.omodel.HChecker.Trim() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (IsAudit == 0)  //浣滃簾鍒ゆ柇
+                    {
+                        if (oBill.omodel.HDeleteMan.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶄綔搴燂紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    if (IsAudit == 1) //鍙嶄綔搴熷垽鏂�
+                    {
+                        if (oBill.omodel.HDeleteMan.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈綔搴�!涓嶉渶瑕佸弽浣滃簾锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                //杩涜闇�瑕佽繘琛岀殑浣滃簾/鍙嶄綔搴熸搷浣�
+                if (IsAudit == 0) //浣滃簾鎻愪氦
+                {
+                    //浣滃簾鎻愪氦
+                    if (oBill.Cancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "浣滃簾鎴愬姛";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                if (IsAudit == 1) //鍙嶅叧闂彁浜�
+                {
+                    //鍙嶅叧闂彁浜�
+                    if (oBill.AbandonCancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶄綔搴熸垚鍔�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "浣滃簾澶辫触鎴栬�呭弽浣滃簾澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鏍规嵁鍗曟嵁鍙凤紝鍚屾鐢熶骇棰嗘枡鍗�
+        [Route("Kf_MateOutBillController/GetKf_MateOutBill_Sync_Json")]
+        [HttpGet]
+        public json GetKf_MateOutBill_Sync_Json(string HBillNo, string HBillType)
+        {
+            try
+            {
+                //鑾峰彇绯荤粺鍙傛暟
+                string sql = string.Empty;
+                string sErrMsg = "";
+                if (oSystemParameter.ShowBill(ref sErrMsg) == true)
+                {
+                    //绯荤粺鍙傛暟鏄惁涓虹鏈変簯妯″紡,N涓哄叕鏈変簯妯″紡锛孻涓虹鏈変簯妯″紡
+                    //绉佹湁浜戞ā寮忥紝閫氳繃璋冪敤瀛樺偍杩囩▼杩涜鍚屾
+                    if (oSystemParameter.omodel.WMS_CloudMode.ToUpper() == "Y")
+                    {
+                        ds = oCn.RunProcReturn("exec h_p_IFCLD_ERPSourceBillToLocal_MateOut '" + HBillNo + "'", "h_p_IFCLD_ERPSourceBillToLocal_MateOut");
+                        if (ds == null || ds.Tables[0].Rows.Count == 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鍚屾鍙戠敓閿欒锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 2)
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                            else
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 1;
+                                objJsonResult.Message = "鍗曟嵁鍚屾鎴愬姛锛�";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                        }
+                    }
+                    //鍏湁浜戞ā寮忥紝閫氳繃璋冪敤WEBAPI鏂瑰紡杩涜鍚屾
+                    else if (oSystemParameter.omodel.WMS_CloudMode.ToUpper() == "N")
+                    {
+                        //鍒ゆ柇閲戣澏浜戞槸鍚︾櫥褰曟垚鍔�
+                        var loginRet = InvokeHelper.Login();
+                        var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>();
+                        //鍒ゆ柇鏄惁鐧诲綍鎴愬姛
+                        if (isSuccess <= 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍚屾澶辫触锛岄噾铦朵簯鐧诲叆涓嶆垚鍔燂紝璇风‘璁鐩橀厤缃枃浠舵墍璁剧疆閲戣澏浜戝搴旂綉鍧�銆佽处濂椼�佺櫥褰曠敤鎴枫�佺櫥褰曞瘑鐮佹槸鍚︽纭紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+
+                        var json = new
+                        {
+                            CreateOrgId = 0,
+                            Number = HBillNo,
+                            Id = ""
+                        };
+                        //鏌ョ湅 鑾峰彇鏁版嵁                    
+                        var _result = InvokeHelper.View("PRD_PickMtrl", JsonConvert.SerializeObject(json));
+                        var _saveObj = JObject.Parse(_result);
+                        //鍒ゆ柇閲戣澏浜戞暟鎹槸鍚﹁幏鍙栨垚鍔�
+                        if (_saveObj["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "閲戣澏浜戠敓浜ч鏂欏崟鑾峰彇澶辫触锛�" + _result;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+
+                        oCn.BeginTran();
+                        //鏌ユ壘鏈湴鐢熶骇棰嗘枡鍗曡〃涓槸鍚﹀瓨鍦ㄨ鍗曟嵁锛屽瓨鍦ㄨ幏鍙栨湰鍗曞崟鎹甀D锛屼笉瀛樺湪鍒欒幏鍙栨渶澶у崟鎹甀D
+                        Int64 HNewInterID = 0;
+                        ds = oCn.RunProcReturn("select HInterID from Kf_ICStockBillMain with(nolock) where HBillNo = '" + HBillNo + "' and HBillType='1204'", "Kf_ICStockBillMain");
+                        if (ds == null || ds.Tables[0].Rows.Count == 0)
+                        {
+                            HNewInterID = DBUtility.ClsPub.CreateBillID_Prod(HBillType, ref sErrMsg);
+                        }
+                        else
+                        {
+                            HNewInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HInterID"]);
+                        }
+
+                        //鏍规嵁鍗曟嵁鍙峰垹闄ゆ湰鍦扮敓浜ч鏂欏崟涓搴斿崟鎹�
+                        oCn.RunProc("Delete b from Kf_ICStockBillMain a inner join Kf_ICStockBillSub b on a.HInterID=b.HInterID where a.HBillNo = '" + HBillNo + "' and a.HBillType='1204'", ref DBUtility.ClsPub.sExeReturnInfo);
+                        oCn.RunProc("Delete from Kf_ICStockBillMain where HBillNo = '" + HBillNo + "' and HBillType='1204'", ref DBUtility.ClsPub.sExeReturnInfo);
+
+                        //涓昏〃鏁版嵁璧嬪��
+                        var MainData = new
+                        {
+                            HInterID = HNewInterID,
+                            HBillNo = DBUtility.ClsPub.isStrNull(_saveObj["Result"]["Result"]["BillNo"]),
+                            HBillType = "1204",
+                            HBillSubType = "1204",
+                            HMainSourceBillType = "",
+                            HDate = DBUtility.ClsPub.isDate(_saveObj["Result"]["Result"]["Date"]),
+                            HSupID = 0,
+                            HWHID = 0,
+                            HSCWHID = 0,
+                            HEmpID = 0,
+                            HManagerID = 0,
+                            HSecManagerID = DBUtility.ClsPub.isLong(_saveObj["Result"]["Result"]["PickerId_Id"]),
+                            HKeeperID = DBUtility.ClsPub.isLong(_saveObj["Result"]["Result"]["FSTOCKERID_Id"]),
+                            HDeptID = 0,
+                            HCurID = DBUtility.ClsPub.isLong(_saveObj["Result"]["Result"]["CurrId_Id"]),
+                            HSeOrderBillNo = "",
+                            HExplanation = "CLD瀵煎叆",
+                            HRemark = "",
+                            HInnerBillNo = "",
+                            HRedBlueFlag = 0,
+                            HBillStatus = DBUtility.ClsPub.isLong(_saveObj["Result"]["Result"]["ApproverId_Id"]) == 0 ? 1 : 2,
+                            HMaker = DBUtility.ClsPub.isStrNull(_saveObj["Result"]["Result"]["CreatorId"]["Name"]),
+                            HMakeDate = DBUtility.ClsPub.isDate(_saveObj["Result"]["Result"]["CreateDate"]),
+                            HChecker = DBUtility.ClsPub.isLong(_saveObj["Result"]["Result"]["ApproverId_Id"]) == 0 ? "" : DBUtility.ClsPub.isStrNull(_saveObj["Result"]["Result"]["ApproverId"]["Name"]),
+                            HCheckDate = DBUtility.ClsPub.isDate(_saveObj["Result"]["Result"]["ApproveDate"]),
+                            HUpDater = DBUtility.ClsPub.isLong(_saveObj["Result"]["Result"]["ModifierId_Id"]) == 0 ? "" : DBUtility.ClsPub.isStrNull(_saveObj["Result"]["Result"]["ModifierId"]["Name"]),
+                            HUpDateDate = DBUtility.ClsPub.isDate(_saveObj["Result"]["Result"]["ModifyDate"]),
+                            HDeleteMan = DBUtility.ClsPub.isLong(_saveObj["Result"]["Result"]["CANCELER_Id"]) == 0 ? "" : DBUtility.ClsPub.isStrNull(_saveObj["Result"]["Result"]["CANCELER"]["Name"]),
+                            HDeleteDate = DBUtility.ClsPub.isDate(_saveObj["Result"]["Result"]["CancelDate"]),
+                            HOWNERID = DBUtility.ClsPub.isLong(_saveObj["Result"]["Result"]["OwnerId_Id"]),
+                            HOWNERTYPEID = DBUtility.ClsPub.isStrNull(_saveObj["Result"]["Result"]["OwnerTypeId"]),
+                            HERPInterID = DBUtility.ClsPub.isLong(_saveObj["Result"]["Result"]["Id"]),
+                            HERPBillType = DBUtility.ClsPub.isStrNull(_saveObj["Result"]["Result"]["BillType_Id"]),
+                            HERPBillNo = DBUtility.ClsPub.isStrNull(_saveObj["Result"]["Result"]["BillNo"]),
+                            HPRDORGID = DBUtility.ClsPub.isLong(_saveObj["Result"]["Result"]["PrdOrgId_Id"]),
+                            HSTOCKORGID = DBUtility.ClsPub.isLong(_saveObj["Result"]["Result"]["StockOrgId_Id"]),
+                        };
+                        //鍐欏叆涓昏〃
+                        sql = $@"Insert into Kf_ICStockBillMain
+                                    (HInterID,HYear,HPeriod,HBillNo,HBillType,HBillSubType,HMainSourceBillType,HDate
+                                    ,HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID,HKeeperID,HDeptID,HCurID
+                                    ,HSeOrderBillNo,HExplanation,HRemark,HInnerBillNo,HRedBlueFlag,HBillStatus
+                                    ,HMaker,HMakeDate
+                                    ,HChecker,HCheckDate
+                                    ,HUpDater,HUpDateDate
+                                    ,HDeleteMan,HDeleteDate
+                                    ,HOWNERID,HOWNERTYPEID,HERPInterID,HERPBillType,HERPBillNo
+                                    ,HPRDORGID,HSTOCKORGID)
+                                    Values({MainData.HInterID},year('{MainData.HDate}'),month('{MainData.HDate}'),'{MainData.HBillNo}','{MainData.HBillType}','{MainData.HBillSubType}','{MainData.HMainSourceBillType}','{MainData.HDate}'
+                                    , {MainData.HSupID},{MainData.HWHID},{MainData.HSCWHID},{MainData.HEmpID},{MainData.HManagerID},{MainData.HSecManagerID},{MainData.HKeeperID},{MainData.HDeptID},{MainData.HCurID}
+                                    ,'{MainData.HSeOrderBillNo}','{MainData.HExplanation}','{MainData.HRemark}','{MainData.HInnerBillNo}',{MainData.HRedBlueFlag},{MainData.HBillStatus}
+                                    ,'{MainData.HMaker}','{MainData.HMakeDate}'
+                                    ,'{MainData.HChecker}',case when '{MainData.HCheckDate}' = '1900/1/1 0:00:00' then NULL else '{MainData.HCheckDate}' end
+                                    ,'{MainData.HUpDater}',case when '{MainData.HUpDateDate}' = '1900/1/1 0:00:00' then NULL else '{MainData.HUpDateDate}' end
+                                    ,'{MainData.HDeleteMan}',case when '{MainData.HDeleteDate}' = '1900/1/1 0:00:00' then NULL else '{MainData.HDeleteDate}' end
+                                    , {MainData.HOWNERID},'{MainData.HOWNERTYPEID}',{MainData.HERPInterID},'{MainData.HERPBillType}','{MainData.HERPBillNo}'
+                                    , {MainData.HPRDORGID},{MainData.HSTOCKORGID})";
+                        oCn.RunProc(sql.Replace("\r\n", ""));
+
+                        //瀛愯〃鏁版嵁璧嬪��
+                        var dataArr = _saveObj["Result"]["Result"]["Entity"];
+                        foreach (var oSub in dataArr)
+                        {
+                            var subData = new
+                            {
+                                HInterID = HNewInterID,
+                                HEntryID = DBUtility.ClsPub.isLong(oSub["Id"]),
+                                HMTONo = DBUtility.ClsPub.isStrNull(oSub["MTONO"]),
+                                HPlanMode = 0,
+                                HRemark = "",
+                                HExpressNumber = "",
+                                HMaterID = DBUtility.ClsPub.isLong(oSub["MaterialId_Id"]),
+                                HUnitID = DBUtility.ClsPub.isLong(oSub["UnitId_Id"]),
+                                HBatchNo = DBUtility.ClsPub.isStrNull(oSub["Lot_Text"]),
+                                HPropertyID = DBUtility.ClsPub.isLong(oSub["AuxPropId_Id"]),
+                                HWHID = DBUtility.ClsPub.isLong(oSub["StockId_Id"]),
+                                HSPID = DBUtility.ClsPub.isLong(oSub["StockLocId_Id"]),
+                                HSCWHID = 0,
+                                HSCSPID = 0,
+                                HQtyMust = DBUtility.ClsPub.isDoule(oSub["AppQty"]),
+                                HQty = DBUtility.ClsPub.isDoule(oSub["ActualQty"]),
+                                HPrice = DBUtility.ClsPub.isDoule(oSub["FPrice"]),
+                                HMoney = DBUtility.ClsPub.isDoule(oSub["FAmount"]),
+                                HTaxPrice = DBUtility.ClsPub.isDoule(oSub["FPrice"]),
+                                HTaxRate = 1,
+                                HTaxMoney = DBUtility.ClsPub.isDoule(oSub["FAmount"]),
+                                HRelationQty = DBUtility.ClsPub.isDoule(oSub["SelPrcdReturnQty"]),
+                                HRelationMoney = 0,
+                                HSourceInterID = DBUtility.ClsPub.isLong(oSub["SrcInterId"]),
+                                HSourceEntryID = DBUtility.ClsPub.isLong(oSub["SrcEnteryId"]),
+                                HSourceBillNo = DBUtility.ClsPub.isStrNull(oSub["SrcBillNo"]),
+                                HSourceBillType = DBUtility.ClsPub.isStrNull(oSub["SrcBillType"]),
+                                HERPInterID = DBUtility.ClsPub.isLong(_saveObj["Result"]["Result"]["Id"]),
+                                HERPEntryID = DBUtility.ClsPub.isLong(oSub["Id"]),
+                                HERPBillNo_Sub = "",
+                                HPOOrderInterID = 0,
+                                HPOOrderEntryID = 0,
+                                HPOOrderBillNo = "",
+                                HSeOrderInterID = 0,
+                                HSeOrderEntryID = 0,
+                                HSeOrderBillNo = "",
+                                HICMOInterID = DBUtility.ClsPub.isLong(oSub["MoId"]),
+                                HICMOEntryID = DBUtility.ClsPub.isLong(oSub["MoEntryId"]),
+                                HICMOBillNo = DBUtility.ClsPub.isStrNull(oSub["MoBillNo"]),
+                                HWWOrderInterID = 0,
+                                HWWOrderEntryID = 0,
+                                HWWOrderBillNo = "",
+                                HProduceDate = DBUtility.ClsPub.isDate(oSub["ProduceDate"]),
+                                HExpiryDate = DBUtility.ClsPub.isDate(oSub["ExpiryDate"]),
+                                HOWNERID = DBUtility.ClsPub.isLong(oSub["OwnerId_Id"]),
+                                HOWNERTYPEID = DBUtility.ClsPub.isStrNull(oSub["OwnerTypeId"]),
+                                HKEEPERID = DBUtility.ClsPub.isLong(oSub["KeeperId_Id"]),
+                                HKEEPERTYPEID = DBUtility.ClsPub.isStrNull(oSub["KeeperTypeId"]),
+                            };
+
+                            //鍐欏叆瀛愯〃
+                            sql = $@"Insert into Kf_ICStockBillSub
+	                                    (HInterID,HEntryID,HMTONo,HPlanMode,HRemark,HExpressNumber
+	                                    ,HMaterID,HUnitID,HBatchNo,HPropertyID,HWHID,HSPID,HSCWHID,HSCSPID
+	                                    ,HQtyMust,HQty,HPrice,HMoney,HTaxPrice,HTaxRate,HTaxMoney,HRelationQty,HRelationMoney
+	                                    ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HERPInterID,HERPEntryID,HERPBillNo_Sub
+	                                    ,HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo
+	                                    ,HICMOInterID,HICMOEntryID,HICMOBillNo,HWWOrderInterID,HWWOrderEntryID,HWWOrderBillNo
+	                                    ,HProduceDate
+                                        ,HExpiryDate
+                                        ,HOWNERID,HOWNERTYPEID,HKEEPERID,HKEEPERTYPEID)
+                                        Values ({subData.HInterID},{subData.HEntryID},'{subData.HMTONo}',{subData.HPlanMode},'{subData.HRemark}','{subData.HExpressNumber}'
+                                        ,{subData.HMaterID},{subData.HUnitID},'{subData.HBatchNo}',{subData.HPropertyID},{subData.HWHID},{subData.HSPID},{subData.HSCWHID},{subData.HSCSPID}
+                                        ,{subData.HQtyMust},{subData.HQty},{subData.HPrice},{subData.HMoney},{subData.HTaxPrice},{subData.HTaxRate},{subData.HTaxMoney},{subData.HRelationQty},{subData.HRelationMoney}
+                                        ,{subData.HSourceInterID},{subData.HSourceEntryID},'{subData.HSourceBillNo}','{subData.HSourceBillType}',{subData.HERPInterID},{subData.HERPEntryID},'{subData.HERPBillNo_Sub}'
+                                        ,{subData.HPOOrderInterID},{subData.HPOOrderEntryID},'{subData.HPOOrderBillNo}',{subData.HSeOrderInterID},{subData.HSeOrderEntryID},'{subData.HSeOrderBillNo}'
+                                        ,{subData.HICMOInterID},{subData.HICMOEntryID},'{subData.HICMOBillNo}',{subData.HWWOrderInterID},{subData.HWWOrderEntryID},'{subData.HWWOrderBillNo}'
+                                        ,case when '{subData.HProduceDate}' = '1900/1/1 0:00:00' then NULL else '{subData.HProduceDate}' end
+                                        ,case when '{subData.HExpiryDate}' = '1900/1/1 0:00:00' then NULL else '{subData.HExpiryDate}' end
+                                        ,{subData.HOWNERID},'{subData.HOWNERTYPEID}',{subData.HKEEPERID},'{subData.HKEEPERTYPEID}')";
+                            oCn.RunProc(sql.Replace("\r\n", ""));
+                        }
+
+                        oCn.Commit();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍗曟嵁鍚屾鎴愬姛锛�";
+                        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 = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍗曟嵁鍚屾澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
     }
 }

--
Gitblit v1.9.1