From 409529b1a6e7478d691e95f84713bdd5ad5ffed2 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期二, 05 八月 2025 19:05:14 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/BaseSet/Gy_MaterialController.cs |  529 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 528 insertions(+), 1 deletions(-)

diff --git a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
index 161a2af..f8cb64e 100644
--- a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
@@ -625,6 +625,320 @@
             }
         }
 
+        #region 淇濆瓨鐗╂枡_鎵归噺
+        /// <summary>
+        /// 淇濆瓨鐗╂枡
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("Gy_Material/SaveGy_MaterialList_Batch")]
+        [HttpPost]
+        public object SaveGy_MaterialList_Batch([FromBody] JObject msg)
+        {
+            DataSet ds;
+            var _value = msg["msg"].ToString();
+            string msg3 = _value.ToString();
+            string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg1 = sArray[0].ToString();
+            string msg2 = sArray[1].ToString();
+            string msg_HUSEORGID = sArray[2].ToString();
+            bool bResult = false;
+            Int64 HItemID = 0;
+            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+
+            //缂栬緫鏉冮檺
+            if (!DBUtility.ClsPub.Security_Log_second("Gy_Material_Edit", 1, false, msg2))
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+
+            //鑾峰彇鏈�澶D鍊艰祴鍊�
+            DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_Material ", "Gy_Material");
+            if (Maxds != null || Maxds.Tables[0].Rows.Count > 0)
+            {
+                //HItemID= Maxds.Tables[0].Rows[0]["HItemID"]
+                var maxid = Convert.ToInt32(Maxds.Tables[0].Rows[0]["HItemID"]);
+                maxid += 1;
+                HItemID = maxid;
+            }
+            ListModels oListModels = new ListModels();
+
+            try
+            {
+                DLL.ClsGy_Material_Ctl oBill = new DLL.ClsGy_Material_Ctl();
+                List<Models.ClsGy_Material_Model> lsmain = new List<Models.ClsGy_Material_Model>();
+                msg1 = msg1.Replace("\\", "");
+                msg1 = msg1.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Gy_Material(msg1);
+                foreach (ClsGy_Material_Model oItem in lsmain)
+                {
+                    if (oItem.HNumber.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷笉鑳戒负绌猴紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    if (oItem.HName.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佸悕绉颁笉鑳戒负绌猴紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    if (oItem.HMaterTypeID == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佺墿鏂欏垎绫讳笉鑳戒负绌猴紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    //if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim()))
+                    //{
+                    //    objJsonResult.code = "0";
+                    //    objJsonResult.count = 0;
+                    //    objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷腑涓嶈兘鍑虹幇杩炵画鈥�.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒";
+                    //    objJsonResult.data = 1;
+                    //    return objJsonResult;
+                    //}
+                    //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
+                    ds = oCN.RunProcReturn("select * from  Gy_Material where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_Material");
+                    //鏂板鏃跺垽鏂�
+                    #region 鐖剁骇鏍¢獙鏂规硶锛坅pi璋冪敤鍏堟敞閲婃帀锛岋級
+                    /*
+                    if (oItem.HItemID == 0)
+                    {
+                        if (ds == null || ds.Tables[0].Rows.Count > 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
+                        string sParent;
+                        sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
+                        if (sParent.Trim() == "")
+                        {
+                            oBill.oModel.HParentID = 0;
+                        }
+                        else
+                        {
+                            if (oBill.HavParentCode(sParent.Trim(), HItemID))
+                            {
+                                oBill.oModel.HParentID = oBill.oModel.HItemID;
+                            }
+                            else
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�";
+                                objJsonResult.data = 1;
+                                return objJsonResult;
+                            }
+                        }
+                    }
+                    else//缂栬緫鏃跺垽鏂�
+                    {
+                        //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
+                        string sParent;
+                        sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
+                        if (sParent.Trim() == "")
+                        {
+                            oBill.oModel.HParentID = 0;
+                        }
+                        else
+                        {
+                            if (oBill.HavParentCode(sParent.Trim(), oItem.HItemID))
+                            {
+                                oBill.oModel.HParentID = oBill.oModel.HItemID;
+                            }
+                            else
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�";
+                                objJsonResult.data = 1;
+                                return objJsonResult;
+                            }
+                        }
+                    }
+                    */
+                    #endregion
+                    //寰楀埌鐭唬鐮�
+                    string sShortNumber;
+                    sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim());
+                    if (sShortNumber.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    oItem.HUSEORGID = Convert.ToInt32(msg_HUSEORGID); //缁勭粐id
+                    oItem.HShortNumber = sShortNumber;//鐭唬鐮�
+                    oItem.HEndFlag = true;//鏈骇鏍囧織
+                    oItem.HLevel = DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()); //绛夌骇
+                    oItem.HModifyEmp = msg2;
+                    oBill.oModel = oItem;  
+                    
+                    if (oBill.oModel.HItemID == 0)
+                    {
+                        //bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                        bResult = oBill.AddNew();
+                    }
+                    else
+                    {
+                        bResult = oBill.ModifyByIDDynamic(oBill.oModel.HItemID);
+                    }
+                }
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                
+                /*if (oBill.oModel.HItemID == 0)
+                {
+                    //bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                    bResult = oBill.AddNew();
+                }
+                else
+                {
+                    bResult = oBill.ModifyByID(oBill.oModel.HItemID);
+                }*/
+                if (bResult)
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 淇濆瓨鐗╂枡_鎵归噺
+        /// <summary>
+        /// 淇濆瓨鐗╂枡
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("Gy_Material/SaveGy_MaterialList_Modify")]
+        [HttpPost]
+        public object SaveGy_MaterialList_Modify([FromBody] JObject msg)
+        {
+            DataSet ds;
+            var _value = msg["msg"].ToString();
+            string msg3 = _value.ToString();
+            string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg1 = sArray[0].ToString();
+            string msg2 = sArray[1].ToString();
+            string msg_HUSEORGID = sArray[2].ToString();
+            string msg_itemIdList = sArray[3].ToString();
+            string msg_UpdateInfo = sArray[4].ToString();
+            bool bResult = false;
+            Int64 HItemID = 0;
+            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+
+            //缂栬緫鏉冮檺
+            if (!DBUtility.ClsPub.Security_Log_second("Gy_Material_Edit", 1, false, msg2))
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+
+            //鑾峰彇鏈�澶D鍊艰祴鍊�
+            DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_Material ", "Gy_Material");
+            if (Maxds != null || Maxds.Tables[0].Rows.Count > 0)
+            {
+                //HItemID= Maxds.Tables[0].Rows[0]["HItemID"]
+                var maxid = Convert.ToInt32(Maxds.Tables[0].Rows[0]["HItemID"]);
+                maxid += 1;
+                HItemID = maxid;
+            }
+            ListModels oListModels = new ListModels();
+
+            try
+            {
+                DLL.ClsGy_Material_Ctl oBill = new DLL.ClsGy_Material_Ctl();
+                List<Models.ClsGy_Material_Model> lsmain = new List<Models.ClsGy_Material_Model>();
+                msg1 = msg1.Replace("\\", "");
+                msg1 = msg1.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Gy_Material(msg1);
+                JObject jobject = JObject.Parse(msg_UpdateInfo);
+                var paramStr = "";
+                foreach (var property in jobject.Properties())
+                {
+                    string key = property.Name;
+                    string value = property.Value.ToString();
+
+                    // 鎷兼帴鏍煎紡: key=value
+                    paramStr += string.Format("{0}='{1}',", key, value);
+                    // 鍒犻櫎鏈�鍚庝竴涓�楀彿
+                   
+                }
+                paramStr = paramStr.Substring(0, paramStr.Length - 1);
+
+                bResult = oBill.ModifyByIDListDynamic(msg_itemIdList, paramStr, lsmain);
+
+
+                if (bResult)
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         [Route("Gy_Material/SaveGy_MaterialListApi")]
         [HttpPost]
         public object SaveGy_MaterialListApi([FromBody] JObject msg)
@@ -641,7 +955,8 @@
                 List<Models.ClsGy_Material_Model> lsmain = new List<Models.ClsGy_Material_Model>();
                 msg1 = msg1.Replace("\\", "");
                 msg1 = msg1.Replace("\n", "");  //\n
-                lsmain = oListModels.getObjectByJson_Gy_Material(msg1);
+                lsmain = oListModels.getObjectByJson_Gy_Material(msg1); 
+
                 oBill.oModel = lsmain[0];
                 //淇濆瓨
                 bool bResult = oBill.AddNewApi();
@@ -1903,6 +2218,24 @@
                 //杩涜闇�瑕佽繘琛岀殑浣滃簾/鍙嶄綔搴熸搷浣�
                 if (IsAudit == 0) //浣滃簾鎻愪氦
                 {
+                    string sql_deleteBeforeCtrl = "exec h_p_Gy_BarCodeBill_Cancelltion_Before " + HInterID;
+                    DataSet ds_deleteBeforeCtrl = oCN.RunProcReturn(sql_deleteBeforeCtrl, "h_p_Gy_BarCodeBill_Cancelltion_Before");
+                    if (ds_deleteBeforeCtrl == null || ds_deleteBeforeCtrl.Tables.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "浣滃簾澶辫触锛氭潯鐮佷綔搴熷墠鎺у埗澶辫触锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }else if(ds_deleteBeforeCtrl.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "浣滃簾澶辫触锛�" + ds_deleteBeforeCtrl.Tables[0].Rows[0]["HRemark"].ToString();
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
                     oCN.BeginTran();
 
                     //浣滃簾鏉$爜
@@ -1981,6 +2314,187 @@
                     if (ds != null && ds.Tables[0].Rows.Count > 0)
                     {
                         string HBarCode = ds.Tables[0].Rows[0]["HBarCode"].ToString();
+                        oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + CurUserName + "','" + DBUtility.ClsPub.ComputerName + "','鍙嶄綔搴熸潯鐮侊細" + HBarCode + "','WMS绯荤粺-鏉$爜妗f鍒楄〃妯″潡','" + DBUtility.ClsPub.IPAddress + "','鍙嶄綔搴�'", ref DBUtility.ClsPub.sExeReturnInfo);
+
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "[0000-1-043]鍙嶄綔搴熸垚鍔�";
+                        objJsonResult.data = null;
+                        oCN.Commit();
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "[0000-1-042]鍙嶄綔搴熷け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        oCN.RollBack();
+                        return objJsonResult;
+                    }
+                }
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "[0000-1-044]浣滃簾澶辫触鎴栬�呭弽浣滃簾澶辫触锛�" + 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("Gy_BarCodeBillList/DeleteBatchGy_BarCodeBillList")]
+        [HttpGet]
+        public object DeleteBatchGy_BarCodeBillList(string HInterID, int IsAudit, string CurUserName)
+        {
+            string ModRightNameCheck = "Gy_BarCodeBillList_Delete";
+            DBUtility.ClsPub.CurUserName = CurUserName;
+            try
+            {
+                //妫�鏌ユ潈闄�
+                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "[0000-1-063]浣滃簾/鍙嶄綔搴熷け璐ワ紒鏃犳潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //HInterID鏁版嵁鍒ゆ柇
+                if (HInterID.Length<=0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈�夋嫨闇�瑕佷綔搴�/鍙嶄綔搴� 鐨勬潯鐮�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                Int64 lngBillKey = 0;
+                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹�
+
+                //杩涜闇�瑕佽繘琛岀殑浣滃簾/鍙嶄綔搴熸搷浣�
+                if (IsAudit == 0) //浣滃簾鎻愪氦
+                {
+                    string sql_deleteBeforeCtrl = "exec h_p_Gy_BarCodeBill_Cancelltion_Before '" + HInterID + "'";
+                    DataSet ds_deleteBeforeCtrl = oCN.RunProcReturn(sql_deleteBeforeCtrl, "h_p_Gy_BarCodeBill_Cancelltion_Before");
+                    if (ds_deleteBeforeCtrl == null || ds_deleteBeforeCtrl.Tables.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "浣滃簾澶辫触锛氭潯鐮佷綔搴熷墠鎺у埗澶辫触锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else if (ds_deleteBeforeCtrl.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "浣滃簾澶辫触锛�" + ds_deleteBeforeCtrl.Tables[0].Rows[0]["HRemark"].ToString();
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    oCN.BeginTran();
+
+                    //浣滃簾鏉$爜
+                    oCN.RunProc("update Gy_BarCodeBill set HStopflag=1,HDeleteMan='" + CurUserName + "',HDeleteDate=getdate() where HItemID in (" + HInterID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
+
+                    string sql = "select * from Gy_BarCodeBill where HItemID in (" + HInterID + ")";
+                    ds = oCN.RunProcReturn(sql, "Gy_BarCodeBill");
+                    if (ds != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        string HBarCode = "";
+                        for(int i = 0; i < ds.Tables[0].Rows.Count; i++)
+                        {
+                            HBarCode = ds.Tables[0].Rows[0]["HBarCode"].ToString() + "锛�";
+                        }
+
+
+                        //娣诲姞鎿嶄綔鏃ュ織
+                        oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + CurUserName + "','" + DBUtility.ClsPub.ComputerName + "','浣滃簾鏉$爜锛�" + HBarCode + "','WMS绯荤粺-鏉$爜妗f鍒楄〃妯″潡','" + DBUtility.ClsPub.IPAddress + "','浣滃簾'", ref DBUtility.ClsPub.sExeReturnInfo);
+
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "[0000-1-040]浣滃簾鎴愬姛";
+                        objJsonResult.data = null;
+
+                        oCN.Commit();
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "[0000-1-042]浣滃簾澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+
+                        oCN.RollBack();
+                    }
+
+
+                    return objJsonResult;
+                }
+                if (IsAudit == 1) //鍙嶅叧闂彁浜�
+                {
+                    oCN.BeginTran();
+
+                    //#region 鍙嶄綔搴熸潯鐮佸墠杩涜鍒ゆ柇
+                    ////鍙嶄綔搴熸潯鐮佸墠杩涜鍒ゆ柇------------------------------------------------------------------------------------------------------------------------------------------------------
+                    ////--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+                    //DataSet DS = oCN.RunProcReturn("exec h_p_Gy_BarCodeBill_UnCancelltion '" + HInterID + "','N'", "h_p_Gy_BarCodeBill_UnCancelltion", ref DBUtility.ClsPub.sExeReturnInfo);
+                    //if (DS == null || DS.Tables[0].Rows.Count <= 0)
+                    //{
+                    //    oCN.RollBack();
+
+                    //    objJsonResult.code = "0";
+                    //    objJsonResult.count = 0;
+                    //    objJsonResult.Message = "[0000-1-042]鍙嶄綔搴熷け璐ワ紝鍘熷洜锛氬弽浣滃簾鏉$爜鍓嶅垽鏂彂鐢熼敊璇紒";
+                    //    objJsonResult.data = null;
+                    //    return objJsonResult;
+                    //}
+                    //else
+                    //{
+                    //    if (DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0][0]) == "1")
+                    //    {
+                    //        oCN.RollBack();
+
+                    //        objJsonResult.code = "1";
+                    //        objJsonResult.count = 1;
+                    //        objJsonResult.Message = "[0000-1-042]鍙嶄綔搴熷け璐ワ紝鍘熷洜锛�" + DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HRemark"]);
+                    //        objJsonResult.data = null;
+                    //        return objJsonResult;
+                    //    }
+                    //}
+                    ////--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+                    ////--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+                    //#endregion
+
+                    //鍙嶄綔搴熸潯鐮�
+                    oCN.RunProc("update Gy_BarCodeBill set HStopflag=0,HDeleteMan='',HDeleteDate=null where HItemID in (" + HInterID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
+
+                    //澧炲姞鎿嶄綔鏃ュ織
+                    string sql = "select * from Gy_BarCodeBill where HItemID in (" + HInterID + ")";
+                    ds = oCN.RunProcReturn(sql, "Gy_BarCodeBill");
+                    if (ds != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        string HBarCode = "";
+                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
+                        {
+                            HBarCode = ds.Tables[0].Rows[0]["HBarCode"].ToString() + "锛�";
+                        }
+
                         oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + CurUserName + "','" + DBUtility.ClsPub.ComputerName + "','鍙嶄綔搴熸潯鐮侊細" + HBarCode + "','WMS绯荤粺-鏉$爜妗f鍒楄〃妯″潡','" + DBUtility.ClsPub.IPAddress + "','鍙嶄綔搴�'", ref DBUtility.ClsPub.sExeReturnInfo);
 
                         objJsonResult.code = "1";
@@ -2350,6 +2864,7 @@
                 int HNowSPID = mainList[0].HNowSPID;
                 string HMouldUseStatus = mainList[0].HMouldUseStatus;
                 int HUSEORGID = mainList[0].HUSEORGID;
+                DateTime HNextMainDate = mainList[0].HNextMainDate;
                 //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
                 oCN.BeginTran();
 
@@ -2430,6 +2945,7 @@
                 ",HNowWHID=" + HNowWHID +
                 ",HNowSPID=" + HNowSPID +
                 ",HInitLife='" + HInitLife +
+                ",HNextMainDate='" + HNextMainDate +
                 "',HMouldUseStatus='" + HMouldUseStatus +
                 "' where HInterID=" + HInterID.ToString());
 
@@ -2649,6 +3165,17 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
+
+                ds = oCN.RunProcReturn("select * from Gy_MouldFileMain where HInterID = " + hmainid + " and ISNULL(HChecker,'') <> ''", "Gy_MouldFileMain");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍒犻櫎澶辫触锛佸崟鎹凡瀹℃牳锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
                 if (oBill.DeleteBill(hmainid, ref DBUtility.ClsPub.sExeReturnInfo))
                 {
                     oCN.BeginTran();

--
Gitblit v1.9.1