From 8fe3e47aeda2f957aa521766a2ec22a9dbbfdb8c Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期四, 09 五月 2024 09:40:08 +0800
Subject: [PATCH] 增加 防错装置的 基础资料编辑 和 列表 页面;

---
 WebAPI/ListModels.cs                                 |   14 +
 Model/基础资料/基础资料/ClsGy_PreventErrMould_Model.cs       |   14 +
 WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs |  241 ++++++++++++++++++++
 Model/Model.csproj                                   |    1 
 WebAPI/Controllers/WebAPIController.cs               |  272 ++++++++++++++++++++++
 WebAPI/DLL/ClsGy_PreventErrMould_Ctl.cs              |  102 ++++++++
 WebAPI/Service/LuBaoSevice.cs                        |   19 +
 WebAPI/WebAPI.csproj                                 |    1 
 8 files changed, 663 insertions(+), 1 deletions(-)

diff --git a/Model/Model.csproj b/Model/Model.csproj
index d285e15..f04640d 100644
--- a/Model/Model.csproj
+++ b/Model/Model.csproj
@@ -364,6 +364,7 @@
     <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_DotCheckItemMethod_Model.cs" />
     <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_DotCheckItemClass_Model.cs" />
     <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_ErrMsgBackType_Model.cs" />
+    <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_PreventErrMould_Model.cs" />
     <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_TaskClass_Model.cs" />
     <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_ProjectClass_Model.cs" />
     <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_StockCheckItem_Model.cs" />
diff --git "a/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_PreventErrMould_Model.cs" "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_PreventErrMould_Model.cs"
new file mode 100644
index 0000000..3487bf9
--- /dev/null
+++ "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_PreventErrMould_Model.cs"
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsGy_PreventErrMould_Model : DBUtility.ClsGy_Base_Model
+    {
+        public DateTime HMakeTime;
+        public int HUSEORGID;
+        public string HMakeEmp;
+        public DateTime HModifyTime;
+    }
+}
diff --git a/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs b/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs
index 9556978..b63becc 100644
--- a/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs
@@ -6083,5 +6083,246 @@
         }
         #endregion
 
+        #region  闃查敊瑁呯疆  鏌ヨ,瀹℃牳锛屽弽瀹℃牳锛岀鐢紝鍙嶇鐢�
+        /// <summary> 
+        /// 渚涘簲鍟嗗垎绫�  鏌ヨ
+        /// </summary>
+        /// <param name="sWhere"></param>
+        /// <param name="user"></param>
+        /// <returns></returns>
+        [Route("Gy_BadReason/Gy_PreventErrMouldList")]
+        [HttpGet]
+        public object Gy_PreventErrMouldList(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Gy_PreventErrMould_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                string sql1 = "select * from  h_v_Gy_PreventErrMould where 1 = 1";
+                string sql = sql1 + sWhere + " order by 闃查敊瑁呯疆浠g爜 ";
+                ds = oCN.RunProcReturn(sql, "h_v_Gy_PreventErrMould");
+
+                //娣诲姞鍒楀悕
+                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 = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        /// <summary>
+        /// 闃查敊瑁呯疆 瀹℃牳銆佸弽瀹℃牳
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param>
+        /// <param name="CurUserName">瀹℃牳浜�</param>
+        /// <returns></returns>
+        [Route("Gy_BadReason/AuditGy_PreventErrMould")]
+        [HttpGet]
+        public object AuditGy_PreventErrMould(int HInterID, int IsAudit, string CurUserName)
+        {
+            try
+            {
+                //瀹℃牳鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_PreventErrMould_Check", 1, false, CurUserName))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                var ds = oCN.RunProcReturn("select * from Gy_PreventErrMould where HItemID=" + HInterID, "Gy_PreventErrMould");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
+                    {
+                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                    {
+                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.BeginTran();
+
+                if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
+                {
+                    oCN.RunProc("update Gy_PreventErrMould set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "瀹℃牳鎴愬姛";
+                    objJsonResult.data = null;
+                }
+                if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                {
+                    oCN.RunProc("update Gy_PreventErrMould set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍙嶅鏍告垚鍔�";
+                    objJsonResult.data = null;
+                }
+                oCN.Commit();
+
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+
+
+        /// <summary>
+        /// 闃查敊瑁呯疆 绂佺敤銆佸弽绂佺敤
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="IsStop">绂佺敤(0),鍙嶇鐢�(1)</param>
+        /// <param name="CurUserName">瀹℃牳浜�</param>
+        /// <returns></returns>
+        [Route("Gy_BadReason/StopGy_PreventErrMould")]
+        [HttpGet]
+        public object StopGy_PreventErrMould(int HInterID, int IsStop, string CurUserName)
+        {
+            try
+            {
+                //瀹℃牳鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_PreventErrMould_Close", 1, false, CurUserName))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "绂佺敤澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                var ds = oCN.RunProcReturn("select * from Gy_PreventErrMould where HItemID=" + HInterID, "Gy_SupType");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    if (IsStop == 0)  //绂佺敤鍒ゆ柇
+                    {
+                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸茬鐢�!涓嶈兘鍐嶆绂佺敤锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    if (IsStop == 1) //鍙嶇鐢ㄥ垽鏂�
+                    {
+                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鐢�!涓嶉渶瑕佸弽绂佺敤!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.BeginTran();
+
+                if (IsStop == 0)  //绂佺敤鍒ゆ柇
+                {
+                    oCN.RunProc("update Gy_PreventErrMould set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "绂佺敤鎴愬姛";
+                    objJsonResult.data = null;
+                }
+                if (IsStop == 1) //鍙嶇鐢ㄥ垽鏂�
+                {
+                    oCN.RunProc("update Gy_PreventErrMould set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍙嶇鐢ㄦ垚鍔�";
+                    objJsonResult.data = null;
+                }
+                oCN.Commit();
+
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "绂佺敤澶辫触鎴栬�呭弽绂佺敤澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
     }
 }
\ No newline at end of file
diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index 681f05e..ddac4ef 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -9565,6 +9565,278 @@
         }
         #endregion
 
+        #region  闃查敊瑁呯疆  璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶
+        /// <summary>
+        ///  闃查敊瑁呯疆 淇濆瓨
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("SaveGy_PreventErrMouldList")]
+        [HttpPost]
+        public object SaveGy_PreventErrMouldList([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();
+
+            //鏌ョ湅鏉冮檺
+            if (!DBUtility.ClsPub.Security_Log("Gy_PreventErrMould_Edit", 1, false, msg2))
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+
+            Int64 HItemID = 0;
+            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+            //鑾峰彇鏈�澶D鍊艰祴鍊�
+            DataSet Maxds = oCN.RunProcReturn("select isNull(MAX(HItemID),0) HItemID from Gy_PreventErrMould ", "Gy_PreventErrMould");
+            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
+            {
+
+                WebAPI.DLL.ClsGy_PreventErrMould_Ctl oBill = new WebAPI.DLL.ClsGy_PreventErrMould_Ctl();
+                List<Model.ClsGy_PreventErrMould_Model> lsmain = new List<Model.ClsGy_PreventErrMould_Model>();
+                msg1 = msg1.Replace("\\", "");
+                msg1 = msg1.Replace("\n", "");
+                lsmain = oListModels.getObjectByJson_Gy_PreventErrMould(msg1);
+                foreach (Model.ClsGy_PreventErrMould_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 (!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_PreventErrMould where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_PreventErrMould");
+                    if (oItem.HNumber.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷负绌猴紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    //鏂板鏃跺垽鏂�
+                    if (oItem.HItemID == 0)
+                    {
+                        if (ds == null || ds.Tables[0].Rows.Count == 0)
+                        {
+
+                        }
+                        else
+                        {
+                            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;
+                            }
+                        }
+                    }
+                    //寰楀埌鐭唬鐮�
+                    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.HShortNumber = sShortNumber;//鐭唬鐮�
+                    oItem.HEndFlag = true;//鏈骇鏍囧織
+                    oItem.HLevel = DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()); //绛夌骇
+                    oItem.HMakeEmp = msg2; //鍒涘缓浜�
+
+                    oBill.oModel = oItem;
+                }
+
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                bool bResult;
+                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 = "0";
+                    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;
+            }
+        }
+
+        /// <summary>
+        /// 闃查敊瑁呯疆 鑾峰彇淇℃伅
+        /// </summary>
+        /// <returns></returns>
+        [Route("GetGy_PreventErrMouldDetail")]
+        [HttpGet]
+        public ApiResult<DataSet> GetGy_PreventErrMouldDetail(string HID)
+        {
+            var model = LuBaoSevice.GetGy_PreventErrMouldDetail(HID);
+            return model;
+        }
+
+        /// <summary>
+        /// 闃查敊瑁呯疆 鍒犻櫎鍔熻兘
+        /// </summary>
+        /// <returns></returns>
+        [Route("DeltetGy_PreventErrMould")]
+        [HttpGet]
+        public object DeltetGy_PreventErrMould(string HItemID, string user)
+        {
+            DataSet ds;
+            //string ModRightNameCheck = "Sc_ProcessReport_check";
+            try
+            {
+                //鍒犻櫎鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Gy_PreventErrMould_Drop", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                if (string.IsNullOrWhiteSpace(HItemID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HItemID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+               
+                oCN.RunProc("delete Gy_PreventErrMould where HItemID=" + HItemID);
+                oCN.Commit();//鎻愪氦浜嬪姟
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         /// <summary>
         /// 鐢ㄥ叧鑱斿伐搴忚幏鍙栦俊鎭�
         /// </summary>
diff --git a/WebAPI/DLL/ClsGy_PreventErrMould_Ctl.cs b/WebAPI/DLL/ClsGy_PreventErrMould_Ctl.cs
new file mode 100644
index 0000000..3ec2b2a
--- /dev/null
+++ b/WebAPI/DLL/ClsGy_PreventErrMould_Ctl.cs
@@ -0,0 +1,102 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using System.Data;
+
+namespace WebAPI.DLL
+{
+    public class ClsGy_PreventErrMould_Ctl : DBUtility.ClsGy_Base_Ctl   
+    {
+        
+           SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+        //鍘熶唬鐮� 鐢ㄤ簬 鏇挎崲瀛愰」鐩�
+        public string HOldNumber;
+        public Model.ClsGy_PreventErrMould_Model oModel = new Model.ClsGy_PreventErrMould_Model();
+        //鏂板
+        public override bool AddNew()
+        {
+            //
+            try
+            {
+                oCn.BeginTran();
+                oCn.RunProc("Insert into " + MvarItemKey + " " +
+                    " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
+                    ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID) " +
+                    " Values('" + oModel.HNumber + "','" + oModel.HName + "','" + oModel.HHelpCode + "','" + oModel.HShortNumber + "'," + oModel.HParentID.ToString() +
+                    "," + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "','" +DateTime.Now+ "','" + oModel.HUSEORGID + "','" + oModel.HUseFlag + "','" + oModel.HMakeEmp+ "','" + oModel.HUSEORGID + "')", ref DBUtility.ClsPub.sExeReturnInfo);
+                //淇敼涓婄骇涓洪潪鏈骇浠g爜
+                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+
+        //淇敼
+        public override bool ModifyByID(Int64 sItemID)
+        {
+            try
+            {
+                
+                oCn.BeginTran();
+                oCn.RunProc("Update " + MvarItemKey + " set " +
+                    " HNumber='" + oModel.HNumber + "'" +
+                    ",HName='" + oModel.HName + "'" +
+                    ",HShortNumber='" + oModel.HShortNumber + "'" +
+                    ",HHelpCode='" + oModel.HHelpCode + "'" +
+                    ",HModifyTime='" + DateTime.Now + "'" +   
+                    ",HUSEORGID='" + oModel.HUSEORGID + "'" +
+                    ",HModifyEmp ='" + oModel.HMakeEmp + "'" +
+                    ",HUseFlag='" + oModel.HUseFlag + "'" +
+                    ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) +
+                    ",HRemark= '" + oModel.HRemark + "' Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo);
+                //淇敼瀛愰」鐩唬鐮�
+                oCn.RunProc("exec h_p_Gy_UpdateNumber '" + MvarItemKey + "','" + oModel.HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
+                //灏嗕笂绾� 涓洪潪鏈骇
+                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
+                //
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+        //鏍规嵁浠g爜鍒ゆ柇淇℃伅
+        public override bool HavParentCode(string sCode, Int64 sItemID)
+        {
+            DataSet DS;
+            try
+            {
+                DS = oCn.RunProcReturn("Select * from " + MvarItemKey + " Where HStopflag=0 and HNumber='" + sCode + "' and HItemID<>" + sItemID, MvarItemKey, ref Pub_Class.ClsPub.sExeReturnInfo);
+                if (DS.Tables[0].Rows.Count == 0)
+                    return false;
+                else
+                {
+                    oModel.HItemID = Convert.ToInt64(DS.Tables[0].Rows[0]["HItemID"]);
+                    return true;
+                }
+            }
+            catch (Exception e)
+            {
+                throw (e);
+            }
+        }
+        //鏋勯�犲嚱鏁�
+        public ClsGy_PreventErrMould_Ctl()
+        {
+            MvarItemKey = "Gy_PreventErrMould";
+            MvarReportTitle = "闃查敊瑁呯疆璁剧疆";
+            oModel = new Model.ClsGy_PreventErrMould_Model();
+        }
+
+    
+
+    }
+}
diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs
index b4c6991..89ba9ac 100644
--- a/WebAPI/ListModels.cs
+++ b/WebAPI/ListModels.cs
@@ -1122,7 +1122,19 @@
             List<Model.ClsGy_ProjectMoney_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_ProjectMoney_Model>>(jsonString);
             return list;
         }
-        
+
+        /// <summary>  
+        /// 澶勭悊鏂板闃查敊瑁呯疆琛ㄧ殑json
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Model.ClsGy_PreventErrMould_Model> getObjectByJson_Gy_PreventErrMould(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Model.ClsGy_PreventErrMould_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_PreventErrMould_Model>>(jsonString);
+            return list;
+        }
+
         /// <summary>  
         /// 澶勭悊鏂板椤圭洰绫诲埆琛ㄧ殑json
         /// </summary>
diff --git a/WebAPI/Service/LuBaoSevice.cs b/WebAPI/Service/LuBaoSevice.cs
index 4fcbda0..8f79e69 100644
--- a/WebAPI/Service/LuBaoSevice.cs
+++ b/WebAPI/Service/LuBaoSevice.cs
@@ -643,6 +643,25 @@
         }
 
         /// <summary>
+        /// 闃查敊瑁呯疆鏍规嵁id鑾峰彇淇℃伅
+        /// </summary>
+        public static ApiResult<DataSet> GetGy_PreventErrMouldDetail(string HID)
+        {
+            if (string.IsNullOrEmpty(HID))
+                return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" };
+            var dataSet = GetGy_PreventErrMouldDb(HID);
+            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
+                return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄩ槻閿欒缃暟鎹�" };
+            return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet };
+        }
+        public static DataSet GetGy_PreventErrMouldDb(string HID)
+        {
+            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Gy_PreventErrMould  where HItemID= " + HID + " ", "h_v_Gy_PreventErrMould");
+            return dataSet;
+        }
+
+        /// <summary>
         /// 椤圭洰绫诲埆鏍规嵁id鑾峰彇淇℃伅
         /// </summary>
         public static ApiResult<DataSet> GetGy_ProjectClassDetail(string HID)
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index 2fa77fe..b3af5ff 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -658,6 +658,7 @@
     <Compile Include="DLL\ClsGy_AreaSet_Ctl.cs" />
     <Compile Include="DLL\ClsGy_CusType_Ctl.cs" />
     <Compile Include="DLL\ClsGy_ErrMsgBackType_Ctl.cs" />
+    <Compile Include="DLL\ClsGy_PreventErrMould_Ctl.cs" />
     <Compile Include="DLL\ClsGy_TaskClass_Ctl.cs" />
     <Compile Include="DLL\ClsGy_ProjectClass_Ctl.cs" />
     <Compile Include="DLL\ClsGy_StockCheckItem_Ctl.cs" />

--
Gitblit v1.9.1