|  |  | 
 |  |  |                     //----------创建虚表------------------------ | 
 |  |  |                     DataTable dt_Main = new DataTable("Json"); | 
 |  |  |                     dt_Main.Columns.Add("HBillNo", typeof(string)); | 
 |  |  |                     dt_Main.Columns.Add("HInterID", typeof(int)); | 
 |  |  |                     dt_Main.Columns.Add("HInterID", typeof(Int64)); | 
 |  |  |                     //---------创建新行------------------------ | 
 |  |  |                     DataRow dr_main = dt_Main.NewRow();//创建新行  | 
 |  |  |                     dt_Main.Rows.Add(dr_main);//将新行加入到表中 | 
 |  |  | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Web/GetMAXNumber")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetMAXNumber(string HBillType,string HName,string TableName) | 
 |  |  |         public object GetMAXNumber(string HBillType, string HName, string TableName) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 string HNumber = ""; | 
 |  |  |                 HNumber = DBUtility.ClsPub.CreateHNumber(HBillType,HName, TableName, ref DBUtility.ClsPub.sExeReturnInfo, true); | 
 |  |  |                 HNumber = DBUtility.ClsPub.CreateHNumber(HBillType, HName, TableName, ref DBUtility.ClsPub.sExeReturnInfo, true); | 
 |  |  |                 //----------创建虚表------------------------ | 
 |  |  |                 DataTable dt_Main = new DataTable("Json"); | 
 |  |  |                 dt_Main.Columns.Add("HNumber", typeof(string)); | 
 |  |  |                | 
 |  |  |  | 
 |  |  |                 //---------创建新行------------------------ | 
 |  |  |                 DataRow dr_main = dt_Main.NewRow();//创建新行  | 
 |  |  |                 dt_Main.Rows.Add(dr_main);//将新行加入到表中 | 
 |  |  |                 dr_main["HNumber"] = DBUtility.ClsPub.isStrNull(HNumber); | 
 |  |  |                | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 if (HNumber == null) | 
 |  |  |                 { | 
 |  |  | 
 |  |  |         public object GetUser(string UserName, string PassWord, string HOrgName) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             {                               | 
 |  |  |             { | 
 |  |  |                 DataSet ds = null; | 
 |  |  |                 ClsCN oCnLoc = new ClsCN(); | 
 |  |  |                 DAL.ClsUser oUser = new DAL.ClsUser(); | 
 |  |  | 
 |  |  |                             return objjson; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 }                 | 
 |  |  |                 } | 
 |  |  |                 objjson.code = "0"; | 
 |  |  |                 objjson.count = 1; | 
 |  |  |                 objjson.Message = "展开成功!"; | 
 |  |  | 
 |  |  |                 //    return objJsonResult; | 
 |  |  |                 //} | 
 |  |  |  | 
 |  |  |                 string sql = "update Gy_Czygl set " +  | 
 |  |  |                     "HWhID = " + HWhID +  | 
 |  |  |                 string sql = "update Gy_Czygl set " + | 
 |  |  |                     "HWhID = " + HWhID + | 
 |  |  |                     ", HWhName = '" + HWhName + | 
 |  |  |                     "', HSecManagerID = " + HSecManagerID + | 
 |  |  |                     ", HSecManager = '" + HSecManager + | 
 |  |  | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Web/GetSouceList_Json")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetSouceList_Json(string HMaterID,string Value, Int64 HOrgID) | 
 |  |  |         public object GetSouceList_Json(string HMaterID, string Value, Int64 HOrgID) | 
 |  |  |         { | 
 |  |  |             sWhere = " and HStopFlag=0 and HUSEORGID =" + HOrgID + ""; | 
 |  |  |             if (Value != "" && Value != null) | 
 |  |  | 
 |  |  |             } | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 string sql = "EXEC h_p_Gy_SouceViewList " + HMaterID+",'"+ sWhere + "'"; | 
 |  |  |                 string sql = "EXEC h_p_Gy_SouceViewList " + HMaterID + ",'" + sWhere + "'"; | 
 |  |  |                 ds = oCN.RunProcReturn(sql, "h_p_Gy_SouceViewList"); | 
 |  |  |  | 
 |  |  |                 if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
 |  |  | 
 |  |  |                     string sql1 = "Select HItemID,HNumber ,HName  from Gy_SellStyle where HStopflag=0 and HEndFlag=1 "; | 
 |  |  |                     string sql = sql1 + sWhere; | 
 |  |  |                     ds = oCN.RunProcReturn(sql, "Gy_SellStyle"); | 
 |  |  |                 }               | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
 |  |  |                 { | 
 |  |  | 
 |  |  |                 objjson.Message = "获取失败" + ex.ToString(); | 
 |  |  |                 objjson.data = null; | 
 |  |  |                 return objjson; | 
 |  |  |             }          | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 不异常类型删除功能 | 
 |  |  |         /// 异常类型删除功能 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("DeltetGy_ErrType")] | 
 |  |  | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; ; | 
 |  |  |                 } | 
 |  |  |               | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 oCN.RunProc("delete Gy_ErrType where HItemID=" + HItemID); | 
 |  |  |                 oCN.Commit();//提交事务 | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         #region 异常类型审核/反审核 | 
 |  |  |         [Route("Gy_ErrType/AuditGy_ErrType")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object AuditGy_ErrType(string HInterID, int Type, string user) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 //判断是否有审核权限 | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Gy_ErrType_Check", 1, false, user)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "无权限审核!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 if (string.IsNullOrWhiteSpace(HInterID)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "HInterID为空!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 DAL.ClsGy_ErrType_Ctl oBill = new DAL.ClsGy_ErrType_Ctl(); | 
 |  |  |                 ClsPub.CurUserName = user; | 
 |  |  |                 oCN.BeginTran();//开始事务 | 
 |  |  |  | 
 |  |  |                 //Type 1 审核  2  反审核 | 
 |  |  |                 if (Type == 1) | 
 |  |  |                 { | 
 |  |  |                     //判断单据是否已经审核 | 
 |  |  |                     DataSet ds; | 
 |  |  |                     string sql = "select * from  Gy_ErrType where HItemID = " + HInterID; | 
 |  |  |                     ds = oCN.RunProcReturn(sql, oBill.MvarItemKey); | 
 |  |  |                     if (ds.Tables[0].Rows[0]["HCheckEmp"] != null && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "单据已审核!不能再次审核!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     //审核单据 | 
 |  |  |                     if (!oBill.AuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 1; | 
 |  |  |                         objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     //判断单据是否已经反审核 | 
 |  |  |                     DataSet ds; | 
 |  |  |                     string sql = "select * from  Gy_ErrType where HItemID = " + HInterID; | 
 |  |  |                     ds = oCN.RunProcReturn(sql, oBill.MvarItemKey); | 
 |  |  |                     if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) | 
 |  |  |                     { | 
 |  |  |                         if (ds.Tables[0].Rows[0]["HCheckEmp"] == null || ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "") | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = "单据未审核!不需要反审核!"; | 
 |  |  |                             objJsonResult.data = null; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  |                         //反审核单据 | 
 |  |  |                         if (!oBill.DeAuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 1; | 
 |  |  |                             objJsonResult.Message = "反审核失败!原因:" + ClsPub.sExeReturnInfo; | 
 |  |  |                             objJsonResult.data = null; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 oCN.Commit();//提交事务 | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "执行成功!"; | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; ; | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "执行失败!" + e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 不良类型获取信息 | 
 |  |  | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; ; | 
 |  |  |                 } | 
 |  |  |                 | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 oCN.RunProc("delete Gy_PostSkill where HItemID=" + HItemID); | 
 |  |  |                 oCN.Commit();//提交事务 | 
 |  |  | 
 |  |  |                 WebAPI.DLL.ClsGy_StockMoveStyle_Ctl oBill = new WebAPI.DLL.ClsGy_StockMoveStyle_Ctl(); | 
 |  |  |                 List<Model.ClsGy_StockMoveStyle_Model> lsmain = new List<Model.ClsGy_StockMoveStyle_Model>(); | 
 |  |  |                 msg1 = msg1.Replace("\\", ""); | 
 |  |  |                 msg1 = msg1.Replace("\n", "");   | 
 |  |  |                 msg1 = msg1.Replace("\n", ""); | 
 |  |  |                 lsmain = oListModels.getObjectByJson_Gy_StockMoveStyle(msg1); | 
 |  |  |                 foreach (Model.ClsGy_StockMoveStyle_Model oItem in lsmain) | 
 |  |  |                 { | 
 |  |  | 
 |  |  |             ListModels oListModels = new ListModels(); | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                  | 
 |  |  |  | 
 |  |  |                 WebAPI.DLL.ClsGy_ProjectMoney_Ctl oBill = new WebAPI.DLL.ClsGy_ProjectMoney_Ctl(); | 
 |  |  |                 List<Model.ClsGy_ProjectMoney_Model> lsmain = new List<Model.ClsGy_ProjectMoney_Model>(); | 
 |  |  |                 msg1 = msg1.Replace("\\", ""); | 
 |  |  | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 oCN.BeginTran();//开始事务 | 
 |  |  |                  | 
 |  |  |  | 
 |  |  |                 ds = oCN.RunProcReturn("select * from Gy_ProjectMoney where HItemID=" + HItemID, "Gy_ProjectMoney"); | 
 |  |  |                 if (ds.Tables[0].Rows.Count > 0) | 
 |  |  |                 { | 
 |  |  | 
 |  |  |             ListModels oListModels = new ListModels(); | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                  | 
 |  |  |  | 
 |  |  |                 WebAPI.DLL.ClsGy_ErrMsgBackType_Ctl oBill = new WebAPI.DLL.ClsGy_ErrMsgBackType_Ctl(); | 
 |  |  |                 List<Model.ClsGy_ErrMsgBackType_Model> lsmain = new List<Model.ClsGy_ErrMsgBackType_Model>(); | 
 |  |  |                 msg1 = msg1.Replace("\\", ""); | 
 |  |  | 
 |  |  |         } | 
 |  |  |         #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(); | 
 |  |  |             //获取最大ID值赋值 | 
 |  |  |             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 = "保存失败!短代码为空!"; | 
 |  |  |                         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 | 
 |  |  |  | 
 |  |  |         #region 保养级别  设置列表/保存/编辑/删除方法 | 
 |  |  |         /// <summary> | 
 |  |  |         /// 保养级别 保存 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="msg"></param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("SaveGy_MaintainLevList")] | 
 |  |  |         [HttpPost] | 
 |  |  |         public object SaveGy_MaintainLevList([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_MaintainLev_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(); | 
 |  |  |             //获取最大ID值赋值 | 
 |  |  |             DataSet Maxds = oCN.RunProcReturn("select isNull(MAX(HItemID),0) HItemID from Gy_MaintainLev ", "Gy_MaintainLev"); | 
 |  |  |             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_MaintainLev_Ctl oBill = new WebAPI.DLL.ClsGy_MaintainLev_Ctl(); | 
 |  |  |                 List<Model.ClsGy_MaintainLev_Model> lsmain = new List<Model.ClsGy_MaintainLev_Model>(); | 
 |  |  |                 msg1 = msg1.Replace("\\", ""); | 
 |  |  |                 msg1 = msg1.Replace("\n", ""); | 
 |  |  |                 lsmain = oListModels.getObjectByJson_Gy_MaintainLev(msg1); | 
 |  |  |                 foreach (Model.ClsGy_MaintainLev_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_MaintainLev where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_MaintainLev"); | 
 |  |  |                     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 = "保存失败!短代码为空!"; | 
 |  |  |                         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_MaintainLevDetail")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public ApiResult<DataSet> GetGy_MaintainLevDetail(string HID) | 
 |  |  |         { | 
 |  |  |             var model = LuBaoSevice.GetGy_MaintainLevDetail(HID); | 
 |  |  |             return model; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         ///保养级别 删除功能 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("DeltetGy_MaintainLev")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object DeltetGy_MaintainLev(string HItemID, string user) | 
 |  |  |         { | 
 |  |  |             DataSet ds; | 
 |  |  |             //string ModRightNameCheck = "Sc_ProcessReport_check"; | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 //删除权限 | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Gy_MaintainLev_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_MaintainLev 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 | 
 |  |  |  | 
 |  |  |         #region 启动检查项目  设置列表/保存/编辑/删除方法 | 
 |  |  |         /// <summary> | 
 |  |  |         /// 启动检查项目 保存 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="msg"></param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("SaveGy_CheckNoteItemList")] | 
 |  |  |         [HttpPost] | 
 |  |  |         public object SaveGy_CheckNoteItemList([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_CheckNoteItem_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(); | 
 |  |  |             //获取最大ID值赋值 | 
 |  |  |             DataSet Maxds = oCN.RunProcReturn("select isNull(MAX(HItemID),0) HItemID from Gy_CheckNoteItem ", "Gy_CheckNoteItem"); | 
 |  |  |             if (Maxds != null || Maxds.Tables[0].Rows.Count > 0) | 
 |  |  |             { | 
 |  |  |                 var maxid = Convert.ToInt32(Maxds.Tables[0].Rows[0]["HItemID"]); | 
 |  |  |                 maxid += 1; | 
 |  |  |                 HItemID = maxid; | 
 |  |  |             } | 
 |  |  |             ListModels oListModels = new ListModels(); | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |  | 
 |  |  |                 WebAPI.DLL.ClsGy_CheckNoteItem_Ctl oBill = new WebAPI.DLL.ClsGy_CheckNoteItem_Ctl(); | 
 |  |  |                 List<Model.ClsGy_CheckNoteItem_Model> lsmain = new List<Model.ClsGy_CheckNoteItem_Model>(); | 
 |  |  |                 msg1 = msg1.Replace("\\", ""); | 
 |  |  |                 msg1 = msg1.Replace("\n", ""); | 
 |  |  |                 lsmain = oListModels.getObjectByJson_Gy_CheckNoteItem(msg1); | 
 |  |  |                 foreach (Model.ClsGy_CheckNoteItem_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_CheckNoteItem where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_CheckNoteItem"); | 
 |  |  |                     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 = "保存失败!短代码为空!"; | 
 |  |  |                         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.AddNew(); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     bResult = oBill.ModifyByID(oBill.oModel.HItemID); | 
 |  |  |                 } | 
 |  |  |                 if (bResult) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 1; | 
 |  |  |                     objJsonResult.Message = "保存成功!"; | 
 |  |  |                     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_CheckNoteItemDetail")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public ApiResult<DataSet> GetGy_CheckNoteItemDetail(string HID) | 
 |  |  |         { | 
 |  |  |             var model = LuBaoSevice.GetGy_CheckNoteItemDetail(HID); | 
 |  |  |             return model; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         ///启动检查项目 删除功能 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("DeltetGy_CheckNoteItem")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object DeltetGy_CheckNoteItem(string HItemID, string user) | 
 |  |  |         { | 
 |  |  |             DataSet ds; | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 //删除权限 | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Gy_CheckNoteItem_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_CheckNoteItem 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 | 
 |  |  |  | 
 |  |  |         #region  休息日  设置列表/保存/编辑/删除方法 | 
 |  |  |         /// <summary> | 
 |  |  |         ///  休息日 保存 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="msg"></param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("SaveGy_RestDayList")] | 
 |  |  |         [HttpPost] | 
 |  |  |         public object SaveGy_RestDayList([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_RestDay_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(); | 
 |  |  |             //获取最大ID值赋值 | 
 |  |  |             DataSet Maxds = oCN.RunProcReturn("select isNull(MAX(HItemID),0) HItemID from Gy_RestDay ", "Gy_RestDay"); | 
 |  |  |             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_RestDay_Ctl oBill = new WebAPI.DLL.ClsGy_RestDay_Ctl(); | 
 |  |  |                 List<Model.ClsGy_RestDay_Model> lsmain = new List<Model.ClsGy_RestDay_Model>(); | 
 |  |  |                 msg1 = msg1.Replace("\\", ""); | 
 |  |  |                 msg1 = msg1.Replace("\n", ""); | 
 |  |  |                 lsmain = oListModels.getObjectByJson_Gy_RestDay(msg1); | 
 |  |  |                 foreach (Model.ClsGy_RestDay_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; | 
 |  |  |                     } | 
 |  |  |                     //得到短代码 | 
 |  |  |                     string sShortNumber; | 
 |  |  |                     sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim()); | 
 |  |  |                     if (sShortNumber.Trim() == "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "保存失败!短代码为空!"; | 
 |  |  |                         objJsonResult.data = 1; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     oItem.HShortNumber = sShortNumber;//短代码 | 
 |  |  |                     oItem.HEndFlag = true;//末级标志 | 
 |  |  |                     oItem.HLevel = DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()); //等级 | 
 |  |  |                     oItem.HMakeEmp = msg2; //创建人 | 
 |  |  |                     DayOfWeek dayOfWeek = oItem.HRestDay.DayOfWeek; | 
 |  |  |  | 
 |  |  |                     // 定义星期几的中文映射关系 | 
 |  |  |                     Dictionary<DayOfWeek, string> chineseDayOfWeek = new Dictionary<DayOfWeek, string> | 
 |  |  |                     { | 
 |  |  |                         { DayOfWeek.Sunday, "星期日" },                       | 
 |  |  |                         { DayOfWeek.Saturday, "星期六" } | 
 |  |  |                     }; | 
 |  |  |  | 
 |  |  |                     // 获取中文星期几名称 | 
 |  |  |                     oItem.HWeekDay = chineseDayOfWeek[dayOfWeek]; | 
 |  |  |                     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 = "保存成功!"; | 
 |  |  |                     objJsonResult.data = 1; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "保存失败!数据已存在!"; | 
 |  |  |                     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> | 
 |  |  |         /// <param name="msg"></param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("SaveSumGy_RestDayList")] | 
 |  |  |         [HttpPost] | 
 |  |  |         public object SaveSumGy_RestDayList([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_RestDay_Edit", 1, false, msg2)) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "无保存权限!"; | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             JObject msgObj = JObject.Parse(msg1); | 
 |  |  |             string HYear = msgObj["HYear"].ToString(); | 
 |  |  |             string HNumber1 = msgObj["HDeptNumber"].ToString()+'-' + msgObj["HOrgNumber"].ToString(); | 
 |  |  |             string HName1 = msgObj["HDeptName"].ToString()+'-'+msgObj["HOrgName"].ToString(); | 
 |  |  |             string HOrgID = msgObj["HOrgID"].ToString(); | 
 |  |  |             string HDeptID = msgObj["HDeptID"].ToString();    | 
 |  |  |             bool HStopflag = bool.Parse(msgObj["HStopflag"].ToString()); | 
 |  |  |             string HRemark= msgObj["HRemark"].ToString(); | 
 |  |  |             string HUSEORGID= msgObj["HUSEORGID"].ToString(); | 
 |  |  |             string HHelpCode= msgObj["HHelpCode"].ToString(); | 
 |  |  |             string HMakeEmp = msg2; //创建人 | 
 |  |  |             bool Sunday = Convert.ToBoolean(msgObj["Sunday"]); | 
 |  |  |             bool Saturday = Convert.ToBoolean(msgObj["Saturday"]); | 
 |  |  |             List<Tuple<DateTime, string>> sundaysInYear = GetSundaysInYear(Convert.ToInt32(HYear),  Sunday,  Saturday); | 
 |  |  |  | 
 |  |  |             foreach (var oItem in sundaysInYear) | 
 |  |  |             { | 
 |  |  |                 Int64 HItemID = 0; | 
 |  |  |                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
 |  |  |                 //获取最大ID值赋值 | 
 |  |  |                 DataSet Maxds = oCN.RunProcReturn("select isNull(MAX(HItemID),0) HItemID from Gy_RestDay ", "Gy_RestDay"); | 
 |  |  |                 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; | 
 |  |  |                 } | 
 |  |  |                 DateTime HRestDay = oItem.Item1; | 
 |  |  |                 string HWeekDay = oItem.Item2; // 获取星期字符串 | 
 |  |  |                 string HDate = oItem.Item1.ToString("yyyyMMdd"); | 
 |  |  |                 string HNumber = ""; | 
 |  |  |                 string HName = ""; | 
 |  |  |                 HNumber = HNumber1 + '-' + HDate; | 
 |  |  |                | 
 |  |  |                  HName = HName1 + '-' + HDate; | 
 |  |  |                 //先查看数据库有没有 | 
 |  |  |                 ds = oCN.RunProcReturn("select * from Gy_RestDay where HRestDay='" + HRestDay + "' and HOrgID='" + HOrgID + "' and HDeptID='" + HDeptID + "'", "Gy_RestDay"); | 
 |  |  |                 if (ds.Tables[0].Rows.Count<1) | 
 |  |  |                 { | 
 |  |  |                     oCN.RunProc("Insert into Gy_RestDay " + | 
 |  |  |                    " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + | 
 |  |  |                    ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID," + | 
 |  |  |                    "HOrgID,HDeptID,HRestDay,HWeekDay) " + | 
 |  |  |                    " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "',''," + 0 + | 
 |  |  |                    "," + 0 + "," + 0 + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "','" + DateTime.Now + "','" + HUSEORGID + "',' 未检测','" + HMakeEmp + "','" + HUSEORGID + "'" + | 
 |  |  |                    ",'" + HOrgID.ToString() + "','" + HDeptID.ToString() + "','" + HRestDay.ToString() + "','" + HWeekDay.ToString() + "')"); | 
 |  |  |                 }                 | 
 |  |  |             } | 
 |  |  |             objJsonResult.code = "0"; | 
 |  |  |             objJsonResult.count = 1; | 
 |  |  |             objJsonResult.Message = "保存成功!"; | 
 |  |  |             objJsonResult.data = 1; | 
 |  |  |             return objJsonResult; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 休息日 获取信息 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("GetGy_RestDayDetailEdit")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public ApiResult<DataSet> GetGy_RestDayDetailEdit(string HID) | 
 |  |  |         { | 
 |  |  |             var model = LuBaoSevice.GetGy_RestDayDetailEdit(HID); | 
 |  |  |             return model; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 休息日 获取信息 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("GetGy_RestDayDetail")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public ApiResult<DataSet> GetGy_RestDayDetail(string HName) | 
 |  |  |         { | 
 |  |  |             var model = LuBaoSevice.GetGy_RestDayDetail(HName); | 
 |  |  |             return model; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 休息日 删除功能 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("DeltetGy_RestDay")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object DeltetGy_RestDay(string HItemID, string user) | 
 |  |  |         { | 
 |  |  |             DataSet ds; | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 //删除权限 | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Gy_RestDay_Delete", 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_RestDay 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; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //获取一年中的周六,周日或者两个同时获取 | 
 |  |  |         public List<Tuple<DateTime, string>> GetSundaysInYear(int HYear, bool Sunday,bool Saturday) | 
 |  |  |         { | 
 |  |  |             List<Tuple<DateTime, string>> Days = new List<Tuple<DateTime, string>>(); | 
 |  |  |             DateTime startDate = new DateTime(HYear, 1, 1); | 
 |  |  |             DateTime endDate = new DateTime(HYear, 12, 31); | 
 |  |  |             //星期天勾选 | 
 |  |  |             if (Sunday && !Saturday) | 
 |  |  |             { | 
 |  |  |                 while (startDate <= endDate) | 
 |  |  |                 { | 
 |  |  |                     if (startDate.DayOfWeek == DayOfWeek.Sunday) | 
 |  |  |                     { | 
 |  |  |                         Days.Add(Tuple.Create(startDate, "星期天")); | 
 |  |  |                     } | 
 |  |  |                     startDate = startDate.AddDays(1); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             //星期六 勾选 | 
 |  |  |             else if (!Sunday && Saturday) | 
 |  |  |             { | 
 |  |  |                 while (startDate <= endDate) | 
 |  |  |                 { | 
 |  |  |                     if (startDate.DayOfWeek == DayOfWeek.Saturday) | 
 |  |  |                     { | 
 |  |  |                         Days.Add(Tuple.Create(startDate, "星期六")); | 
 |  |  |                     } | 
 |  |  |                     startDate = startDate.AddDays(1); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             else if (Sunday && Saturday) | 
 |  |  |             { | 
 |  |  |                 while (startDate <= endDate) | 
 |  |  |                 { | 
 |  |  |                     if (startDate.DayOfWeek == DayOfWeek.Saturday || startDate.DayOfWeek == DayOfWeek.Sunday) | 
 |  |  |                     { | 
 |  |  |                         string weekdayChinese; | 
 |  |  |                         if (startDate.DayOfWeek == DayOfWeek.Sunday) | 
 |  |  |                         { | 
 |  |  |                             weekdayChinese = "星期天"; | 
 |  |  |                             Days.Add(Tuple.Create(startDate, weekdayChinese)); | 
 |  |  |                         }                        | 
 |  |  |                         else if (startDate.DayOfWeek == DayOfWeek.Saturday) | 
 |  |  |                         { | 
 |  |  |                             weekdayChinese = "星期六"; | 
 |  |  |                             Days.Add(Tuple.Create(startDate, weekdayChinese)); | 
 |  |  |                         }                        | 
 |  |  |                     } | 
 |  |  |                     startDate = startDate.AddDays(1); | 
 |  |  |                 } | 
 |  |  |             }                      | 
 |  |  |             return Days; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //返回的字段 | 
 |  |  |         public class DayOfWeekInfo | 
 |  |  |         { | 
 |  |  |             public DateTime Date { get; set; } | 
 |  |  |             public string DayOfWeekText { get; set; } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 用关联工序获取信息 | 
 |  |  |         /// </summary> | 
 |  |  | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Web/GetSc_ICMOBillListView3")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetSc_ICMOBillListView3(string ICMOBill, int OrganizationID,int HSourceID) | 
 |  |  |         public object GetSc_ICMOBillListView3(string ICMOBill, int OrganizationID, int HSourceID) | 
 |  |  |         { | 
 |  |  |             if (ICMOBill != "") | 
 |  |  |             { | 
 |  |  | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetSc_ProcessExchangeBillListView(string ICMOBill, int OrganizationID) | 
 |  |  |         { | 
 |  |  |             if (ICMOBill != "") | 
 |  |  |             if (ICMOBill != "" & ICMOBill != null) | 
 |  |  |             { | 
 |  |  |                 sWhere = " where 1=1 and 单据号 like '%" + ICMOBill + "%' "; | 
 |  |  |             } | 
 |  |  | 
 |  |  |                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
 |  |  |                 if (sWhere == null || sWhere.Equals("")) | 
 |  |  |                 { | 
 |  |  |                     ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillList where 1=1 order by 单据号 desc,hsubid ", "h_v_Sc_ProcessExchangeBillList"); | 
 |  |  |                     ds = oCN.RunProcReturn(" select * from h_v_Sc_ProcessExchangeBillList where 1=1 and 日期>=DATEADD(MONTH,-2,GETDATE()) order by 单据号 desc,hsubid", "h_v_Sc_ProcessExchangeBillList"); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Web/GetCheckItemByCheckProjectID")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetCheckItemByCheckProjectID(int CheckProjectID,int HBatchQty) | 
 |  |  |         public object GetCheckItemByCheckProjectID(int CheckProjectID, int HBatchQty) | 
 |  |  |         { | 
 |  |  |             if (CheckProjectID <= 0) | 
 |  |  |             { | 
 |  |  | 
 |  |  |                 List<object> list = new List<object>(); | 
 |  |  |                 DataSet ds2; | 
 |  |  |                 DataSet ds1; | 
 |  |  |                 string sql1 = string.Format(@"select t.HMaintainItemID ,m.HNumber HMaintainItemNumber,t.HMaintainItem,t.HMaintainPart,t.HClaim,t.HManagerID,e.HNumber HManagerNumber,e.HName HManagerName,a.HRemark | 
 |  |  |                                                 from Sc_MouldMaintainRuleBillMain a left join Sc_MouldMaintainRuleBillSub_Item t on a.HInterID=t.HInterID  | 
 |  |  |                                                 left join Gy_Maintain m on m.HItemID=t.HMaintainItemID | 
 |  |  |                                                 left join Gy_Employee e on e.HItemID=t.HManagerID | 
 |  |  |                                                 where a.HInterID=" + MouldMaintainRuleID); | 
 |  |  |  | 
 |  |  |                 string sql2 = string.Format(@"select b.HMaterID,m.HNumber HMaterNumber,m.HName HMaterName, m.HModel HMaterSpec,b.HUnitID,u.HNumber HUnitNumber,u.HName HUnitName,b.HQty,b.HQtyMust,b.HRemark from Sc_MouldMaintainRuleBillMain a   | 
 |  |  |                                     left join Sc_MouldMaintainRuleBillSub b on a.HInterID=b.HInterID  | 
 |  |  |                                                 left join h_v_IF_Material m on b.HMaterID=m.HItemID | 
 |  |  |                                     left join h_v_IF_Unit u on b.HUnitID=u.HItemID | 
 |  |  |                                                 where a.HInterID=" + MouldMaintainRuleID); | 
 |  |  |                 ds1 = oCN.RunProcReturn(sql1, "Sc_MouldMaintainRuleBillMain");//保养 | 
 |  |  |                 ds2 = oCN.RunProcReturn(sql2, "Sc_MouldMaintainRuleBillMain");//配件 | 
 |  |  |                 //    string sql1 = string.Format(@"select t.HMaintainItemID ,m.HNumber HMaintainItemNumber,t.HMaintainItem,t.HMaintainPart,t.HClaim,t.HManagerID,e.HNumber HManagerNumber,e.HName HManagerName,a.HRemark | 
 |  |  |                 //                                    from Sc_MouldMaintainRuleBillMain a left join Sc_MouldMaintainRuleBillSub_Item t on a.HInterID=t.HInterID  | 
 |  |  |                 //                                    left join Gy_Maintain m on m.HItemID=t.HMaintainItemID | 
 |  |  |                 //                                    left join Gy_Employee e on e.HItemID=t.HManagerID | 
 |  |  |                 //                                    where a.HInterID=" + MouldMaintainRuleID); | 
 |  |  |  | 
 |  |  |                 //    string sql2 = string.Format(@"select b.HMaterID,m.HNumber HMaterNumber,m.HName HMaterName, m.HModel HMaterSpec,b.HUnitID,u.HNumber HUnitNumber,u.HName HUnitName,b.HQty,b.HQtyMust,b.HRemark from Sc_MouldMaintainRuleBillMain a   | 
 |  |  |                 //left join Sc_MouldMaintainRuleBillSub b on a.HInterID=b.HInterID  | 
 |  |  |                 //                                    left join h_v_IF_Material m on b.HMaterID=m.HItemID | 
 |  |  |                 //left join h_v_IF_Unit u on b.HUnitID=u.HItemID | 
 |  |  |                 //                                    where a.HInterID=" + MouldMaintainRuleID); | 
 |  |  |  | 
 |  |  |                 string sql1 = string.Format(@"select * from h_v_Sc_MouldMaintainRuleBillSub_Item where hmainid=" + MouldMaintainRuleID); | 
 |  |  |                 string sql2 = string.Format(@"select * from h_v_Sc_MouldMaintainRuleBillSub where hmainid=" + MouldMaintainRuleID); | 
 |  |  |  | 
 |  |  |                 ds1 = oCN.RunProcReturn(sql1, "h_v_Sc_MouldMaintainRuleBillSub_Item");//保养 | 
 |  |  |                 ds2 = oCN.RunProcReturn(sql2, "h_v_Sc_MouldMaintainRuleBillSub");//配件 | 
 |  |  |                 list.Add(ds1.Tables[0]); | 
 |  |  |                 list.Add(ds2.Tables[0]); | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |                 List<object> list = new List<object>(); | 
 |  |  |                 DataSet ds2; | 
 |  |  |                 DataSet ds1; | 
 |  |  |                 string sql1 = string.Format(@"select t.HMaintainItemID HMaintainItemID,m.HNumber HMaintainItemNumber,t.HMaintainItem HMaintainItem,t.HMaintainPart HMaintainPart,t.HClaim HClaim,t.HManagerID HManagerID,e.HNumber HManagerNumber,e.HName HManagerName,a.HRemark | 
 |  |  |                                                 from Sb_EquipMaintainRuleBillMain a left join Sb_EquipMaintainRuleBillSub_Item t on a.HInterID=t.HInterID  | 
 |  |  |                                                 left join Gy_Maintain m on m.HItemID=t.HMaintainItemID | 
 |  |  |                                                 left join Gy_Employee e on e.HItemID=t.HManagerID | 
 |  |  |                                                 where a.HInterID=" + EquipProjectID); | 
 |  |  |                 string sql2 = string.Format(@"select b.HMaterID,m.HNumber HMaterNumber,m.HName HMaterName,b.HUnitID,u.HNumber HUnitNumber,u.HName HUnitName,b.HQty,b.HRemark from Sb_EquipMaintainRuleBillMain a   | 
 |  |  |                                     left join Sb_EquipMaintainRuleBillSub b on a.HInterID=b.HInterID  | 
 |  |  |                                                 left join h_v_IF_Material m on b.HMaterID=m.HItemID | 
 |  |  |                                     left join h_v_IF_Unit u on b.HUnitID=u.HItemID | 
 |  |  |                                                 where a.HInterID=" + EquipProjectID); | 
 |  |  |                 //    string sql1 = string.Format(@"select t.HMaintainItemID HMaintainItemID,m.HNumber HMaintainItemNumber,t.HMaintainItem HMaintainItem,t.HMaintainPart HMaintainPart,t.HClaim HClaim,t.HManagerID HManagerID,e.HNumber HManagerNumber,e.HName HManagerName,a.HRemark | 
 |  |  |                 //                                    from Sb_EquipMaintainRuleBillMain a left join Sb_EquipMaintainRuleBillSub_Item t on a.HInterID=t.HInterID  | 
 |  |  |                 //                                    left join Gy_Maintain m on m.HItemID=t.HMaintainItemID | 
 |  |  |                 //                                    left join Gy_Employee e on e.HItemID=t.HManagerID | 
 |  |  |                 //                                    where a.HInterID=" + EquipProjectID); | 
 |  |  |                 //    string sql2 = string.Format(@"select b.HMaterID,m.HNumber HMaterNumber,m.HName HMaterName,b.HUnitID,u.HNumber HUnitNumber,u.HName HUnitName,b.HQty,b.HRemark from Sb_EquipMaintainRuleBillMain a   | 
 |  |  |                 //left join Sb_EquipMaintainRuleBillSub b on a.HInterID=b.HInterID  | 
 |  |  |                 //                                    left join h_v_IF_Material m on b.HMaterID=m.HItemID | 
 |  |  |                 //left join h_v_IF_Unit u on b.HUnitID=u.HItemID | 
 |  |  |                 //                                    where a.HInterID=" + EquipProjectID); | 
 |  |  |  | 
 |  |  |                 ds1 = oCN.RunProcReturn(sql1, "Sb_EquipMaintainRuleBillMain");//保养 | 
 |  |  |                 ds2 = oCN.RunProcReturn(sql2, "Sc_MouldMaintainRuleBillMain");//配件 | 
 |  |  |                 string sql1 = string.Format(@"select * from h_v_Sb_EquipMaintainRuleBillList where HInterID=" + EquipProjectID); | 
 |  |  |                 string sql2 = string.Format(@"select * from h_v_Sb_EquipMaintainRuleSub where hmainid=" + EquipProjectID); | 
 |  |  |  | 
 |  |  |                 ds1 = oCN.RunProcReturn(sql1, "h_v_Sb_EquipMaintainRuleBillList");//保养 | 
 |  |  |                 ds2 = oCN.RunProcReturn(sql2, "h_v_Sb_EquipMaintainRuleSub");//配件 | 
 |  |  |                 list.Add(ds1.Tables[0]); | 
 |  |  |                 list.Add(ds2.Tables[0]); | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Web/GetItemByEquipFile")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetItemByEquipFile(int EquipProjectID,string Type,string HDate) | 
 |  |  |         public object GetItemByEquipFile(int EquipProjectID, string Type, string HDate) | 
 |  |  |         { | 
 |  |  |             if (EquipProjectID <= 0) | 
 |  |  |             { | 
 |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 根据器具带出项目 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Web/GetItemByMouldFile")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetItemByMouldFile(int MouldProjectID, string Type, string HDate) | 
 |  |  |         { | 
 |  |  |             if (MouldProjectID <= 0) | 
 |  |  |             { | 
 |  |  |                 objjson.code = "0"; | 
 |  |  |                 objjson.count = 0; | 
 |  |  |                 objjson.Message = "产品器具未选择"; | 
 |  |  |                 objjson.data = null; | 
 |  |  |                 return objjson; | 
 |  |  |             } | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 string HView = ""; | 
 |  |  |                 switch (Type) | 
 |  |  |                 { | 
 |  |  |                     case "DJ": | 
 |  |  |                         HView = "h_v_QJ_GetDotCheckItemList"; | 
 |  |  |                         break; | 
 |  |  |                     default: | 
 |  |  |                         objjson.code = "0"; | 
 |  |  |                         objjson.count = 0; | 
 |  |  |                         objjson.Message = "设备模块类型错误!"; | 
 |  |  |                         objjson.data = null; | 
 |  |  |                         return objjson; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
 |  |  |                 //string sql = string.Format(@"select * from " + HView + " where HInterID = " + EquipProjectID); | 
 |  |  |                 string sql = string.Format(@"Exec h_p_Sb_GetCheckItem_PDA '" + MouldProjectID + "','" + Type + "','" + HDate + "'"); | 
 |  |  |                 ds = oCN.RunProcReturn(sql, HView); | 
 |  |  |                 if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
 |  |  |                 { | 
 |  |  |                     objjson.code = "0"; | 
 |  |  |                     objjson.count = 0; | 
 |  |  |                     objjson.Message = "获取失败,查无数据" + DBUtility.ClsPub.sErrInfo; | 
 |  |  |                     objjson.data = null; | 
 |  |  |                     return objjson; | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     objjson.code = "1"; | 
 |  |  |                     objjson.count = 1; | 
 |  |  |                     objjson.Message = "获取成功!"; | 
 |  |  |                     objjson.data = ds.Tables[0]; | 
 |  |  |                     return objjson; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             catch (Exception ex) | 
 |  |  |             { | 
 |  |  |                 objjson.code = "0"; | 
 |  |  |                 objjson.count = 0; | 
 |  |  |                 objjson.Message = "获取失败" + ex.ToString(); | 
 |  |  |                 objjson.data = null; | 
 |  |  |                 return objjson; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 根据器具点检计划带出项目 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Web/GetItemByMouldDotCheckPlan")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetItemByMouldDotCheckPlan(int HInterID) | 
 |  |  |         { | 
 |  |  |             if (HInterID <= 0) | 
 |  |  |             { | 
 |  |  |                 objjson.code = "0"; | 
 |  |  |                 objjson.count = 0; | 
 |  |  |                 objjson.Message = "产品器具点检计划未选择"; | 
 |  |  |                 objjson.data = null; | 
 |  |  |                 return objjson; | 
 |  |  |             } | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |  | 
 |  |  |                 string sql = string.Format(@"select * from  h_v_QJ_GetDotCheckItemList where 点检计划ID = " + HInterID); | 
 |  |  |                 ds = oCN.RunProcReturn(sql, "h_v_QJ_GetDotCheckItemList"); | 
 |  |  |                 if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
 |  |  |                 { | 
 |  |  |                     objjson.code = "0"; | 
 |  |  |                     objjson.count = 0; | 
 |  |  |                     objjson.Message = "获取失败,查无数据" + DBUtility.ClsPub.sErrInfo; | 
 |  |  |                     objjson.data = null; | 
 |  |  |                     return objjson; | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     objjson.code = "1"; | 
 |  |  |                     objjson.count = 1; | 
 |  |  |                     objjson.Message = "获取成功!"; | 
 |  |  |                     objjson.data = ds.Tables[0]; | 
 |  |  |                     return objjson; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             catch (Exception ex) | 
 |  |  |             { | 
 |  |  |                 objjson.code = "0"; | 
 |  |  |                 objjson.count = 0; | 
 |  |  |                 objjson.Message = "获取失败" + ex.ToString(); | 
 |  |  |                 objjson.data = null; | 
 |  |  |                 return objjson; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 查询各类设备单据列表(设备点检,设备维修,设备保养......) | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Web/GetEquipmentBillsList")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetEquipmentBillsList(string sWhere, string Type,string user) | 
 |  |  |         {             | 
 |  |  |         public object GetEquipmentBillsList(string sWhere, string Type, string user) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 List<object> columnNameList = new List<object>(); | 
 |  |  | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
 |  |  |                 string sql = string.Format(@"select b.HDotCheckItemID HDotCheckItemID,c.HNumber HDotCheckCode,b.HDotCheckItem,b.HDotCheckPart,b.HClaim, | 
 |  |  |                                     b.HManagerID,e.HNumber HManagerCode,e.HName HManagerName,b.HRemark from Sb_EquipDotCheckRuleBillMain  a  | 
 |  |  |                            left join Sb_EquipDotCheckRuleBillSub b on a.HInterID=b.HInterID  | 
 |  |  |                                     left join Gy_QCCheckItem c on c.HItemID=b.HDotCheckItemID | 
 |  |  |                                      left join Gy_Employee e on e.HItemID=b.HManagerID | 
 |  |  |                                     where a.HInterID=" + HDotCheckRuleInterID); | 
 |  |  |                 ds = oCN.RunProcReturn(sql, "Sb_EquipDotCheckRuleBillMain"); | 
 |  |  |                 string sql = string.Format(@"select * from h_v_Sb_EquipDotCheckRuleBillList_PDA where HInterID=" + HDotCheckRuleInterID); | 
 |  |  |                 ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipDotCheckRuleBillList_PDA"); | 
 |  |  |                 if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
 |  |  |                 { | 
 |  |  |                     objjson.code = "0"; | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 根据设备保养规程显示设备保养程项目 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Web/GetMaintainItemByMaintainRuleID")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetMaintainItemByMaintainRuleID(int HEquipMaintainRuleInterID) | 
 |  |  |         { | 
 |  |  |             if (HEquipMaintainRuleInterID <= 0) | 
 |  |  |             { | 
 |  |  |                 objjson.code = "0"; | 
 |  |  |                 objjson.count = 0; | 
 |  |  |                 objjson.Message = "设备保养规程未选择"; | 
 |  |  |                 objjson.data = null; | 
 |  |  |                 return objjson; | 
 |  |  |             } | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
 |  |  |                 string sql = string.Format(@"select * from h_v_Sb_EquipMaintainRuleBillList_PDA where HInterID=" + HEquipMaintainRuleInterID); | 
 |  |  |                 ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipMaintainRuleBillList_PDA"); | 
 |  |  |                 if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
 |  |  |                 { | 
 |  |  |                     objjson.code = "0"; | 
 |  |  |                     objjson.count = 0; | 
 |  |  |                     objjson.Message = "获取失败" + DBUtility.ClsPub.sErrInfo; | 
 |  |  |                     objjson.data = null; | 
 |  |  |                     return objjson; | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     objjson.code = "1"; | 
 |  |  |                     objjson.count = 1; | 
 |  |  |                     objjson.Message = "获取成功!"; | 
 |  |  |                     objjson.data = ds.Tables[0]; | 
 |  |  |                     return objjson; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             catch (Exception ex) | 
 |  |  |             { | 
 |  |  |                 objjson.code = "0"; | 
 |  |  |                 objjson.count = 0; | 
 |  |  |                 objjson.Message = "获取失败" + ex.ToString(); | 
 |  |  |                 objjson.data = null; | 
 |  |  |                 return objjson; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 根据器具点检规程显示器具点检程项目 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Web/GetDotCheckRuleItemByDotCheckRuleID/Mould")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetDotCheckRuleItemByDotCheckRuleIDForMould(int HDotCheckRuleInterID) | 
 |  |  |         { | 
 |  |  |             if (HDotCheckRuleInterID <= 0) | 
 |  |  |             { | 
 |  |  |                 objjson.code = "0"; | 
 |  |  |                 objjson.count = 0; | 
 |  |  |                 objjson.Message = "器具点检规程未选择"; | 
 |  |  |                 objjson.data = null; | 
 |  |  |                 return objjson; | 
 |  |  |             } | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
 |  |  |                 string sql = string.Format(@"select * from h_v_Sc_MouldDotCheckRuleBillList_PDA where HInterID=" + HDotCheckRuleInterID); | 
 |  |  |                 ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldDotCheckRuleBillList_PDA"); | 
 |  |  |                 if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
 |  |  |                 { | 
 |  |  |                     objjson.code = "0"; | 
 |  |  |                     objjson.count = 0; | 
 |  |  |                     objjson.Message = "获取失败" + DBUtility.ClsPub.sErrInfo; | 
 |  |  |                     objjson.data = null; | 
 |  |  |                     return objjson; | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     objjson.code = "1"; | 
 |  |  |                     objjson.count = 1; | 
 |  |  |                     objjson.Message = "获取成功!"; | 
 |  |  |                     objjson.data = ds.Tables[0]; | 
 |  |  |                     return objjson; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             catch (Exception ex) | 
 |  |  |             { | 
 |  |  |                 objjson.code = "0"; | 
 |  |  |                 objjson.count = 0; | 
 |  |  |                 objjson.Message = "获取失败" + ex.ToString(); | 
 |  |  |                 objjson.data = null; | 
 |  |  |                 return objjson; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 根据器具保养规程显示器具保养程项目 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Web/GetMaintainItemByMaintainRuleID/Mould")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetMaintainItemByMaintainRuleIDForMould(int HMouldMaintainRuleInterID) | 
 |  |  |         { | 
 |  |  |             if (HMouldMaintainRuleInterID <= 0) | 
 |  |  |             { | 
 |  |  |                 objjson.code = "0"; | 
 |  |  |                 objjson.count = 0; | 
 |  |  |                 objjson.Message = "器具保养规程未选择"; | 
 |  |  |                 objjson.data = null; | 
 |  |  |                 return objjson; | 
 |  |  |             } | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
 |  |  |                 string sql = string.Format(@"select * from h_v_Sb_MouldMaintainRuleBillList_PDA where HInterID=" + HMouldMaintainRuleInterID); | 
 |  |  |                 ds = oCN.RunProcReturn(sql, "h_v_Sb_MouldMaintainRuleBillList_PDA"); | 
 |  |  |                 if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
 |  |  |                 { | 
 |  |  |                     objjson.code = "0"; | 
 |  |  |                     objjson.count = 0; | 
 |  |  |                     objjson.Message = "获取失败" + DBUtility.ClsPub.sErrInfo; | 
 |  |  |                     objjson.data = null; | 
 |  |  |                     return objjson; | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     objjson.code = "1"; | 
 |  |  |                     objjson.count = 1; | 
 |  |  |                     objjson.Message = "获取成功!"; | 
 |  |  |                     objjson.data = ds.Tables[0]; | 
 |  |  |                     return objjson; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             catch (Exception ex) | 
 |  |  |             { | 
 |  |  |                 objjson.code = "0"; | 
 |  |  |                 objjson.count = 0; | 
 |  |  |                 objjson.Message = "获取失败" + ex.ToString(); | 
 |  |  |                 objjson.data = null; | 
 |  |  |                 return objjson; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 获取维修项目列表 | 
 |  |  | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Web/GetHSourceBillType")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetHSourceBillType(string HName,int Num) | 
 |  |  |         public object GetHSourceBillType(string HName, int Num) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 ClsCN oCn = new ClsCN(); | 
 |  |  |                 DataSet oDs = new DataSet(); | 
 |  |  |                 //有的单子源单分为红蓝单  0代表蓝单  1代表红单 | 
 |  |  |                 if (Num==0) | 
 |  |  |                 if (Num == 0) | 
 |  |  |                 {           //源单为蓝单 | 
 |  |  |                     oDs = oCn.RunProcReturn("select * from  Xt_BillSourceSet where HName='" + HName + "'and  HRedBlueFlag ='"+ Num+"' ", "Xt_BillSourceSet"); | 
 |  |  |                     oDs = oCn.RunProcReturn("select * from  Xt_BillSourceSet where HName='" + HName + "'and  HRedBlueFlag ='" + Num + "' ", "Xt_BillSourceSet"); | 
 |  |  |                 } | 
 |  |  |                 else if (Num==1) | 
 |  |  |                 else if (Num == 1) | 
 |  |  |                 {          //源单为红单 | 
 |  |  |                     oDs = oCn.RunProcReturn("select * from  Xt_BillSourceSet where HName='" + HName + "' and  HRedBlueFlag ='" + Num + "' ", "Xt_BillSourceSet"); | 
 |  |  |                 } | 
 |  |  |                 else if(Num==2) | 
 |  |  |                 else if (Num == 2) | 
 |  |  |                 {       //不分红蓝单 | 
 |  |  |                     oDs = oCn.RunProcReturn("select * from  Xt_BillSourceSet where HName='" + HName + "'", "Xt_BillSourceSet"); | 
 |  |  |                 } | 
 |  |  |                  | 
 |  |  |  | 
 |  |  |                 objjson.code = "1"; | 
 |  |  |                 objjson.count = 1; | 
 |  |  |                 objjson.Message = "获取成功!"; | 
 |  |  | 
 |  |  |                 SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();            //数据库操作工具 | 
 |  |  |                 string sql = "select HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HPicNum from Gy_MenuDefineSet where HMakeName = '" + HMakeName + "' and HType = '" + HType + "' order by HPosition"; | 
 |  |  |                 ds = oCn.RunProcReturn(sql, "Gy_MenuDefineSet");        //查询当前用户的自定义菜单数据 | 
 |  |  |                 if (ds.Tables[0]==null || ds.Tables[0].Rows.Count == 0) //判断当前用户是否有设置过自定义信息,若记录数为0,则没有设置过,加载所有的菜单信息 | 
 |  |  |                 if (ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0) //判断当前用户是否有设置过自定义信息,若记录数为0,则没有设置过,加载所有的菜单信息 | 
 |  |  |                 { | 
 |  |  |                     sql = "Select * from Gy_Menu_1 where HType = '" + HType + "' Order by HPosition "; | 
 |  |  |                     sql = "Select * from Gy_Menu_1 where HType = '" + HType + "' Order by HPosition,len(HitemID),HitemID  "; | 
 |  |  |                     ds = oCn.RunProcReturn(sql, "Gy_Menu"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  | 
 |  |  |                 List<MenuInit> menuInitList = new List<MenuInit>();                     //用以获取Gy_Menu_1中的所有菜单信息,以及对应节点是否被选中需要加载显示 | 
 |  |  |  | 
 |  |  |                 SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); | 
 |  |  |                 ds = oCn.RunProcReturn("Select * from Gy_Menu_1 where HType = '" +HType + "' Order by HItemID ", "Gy_Menu");     //获取Gy_Menu_1中的所有菜单信息,用于为menuInitList列表充实数据 | 
 |  |  |                 ds = oCn.RunProcReturn("Select * from Gy_Menu_1 where HType = '" + HType + "' Order by HItemID ", "Gy_Menu");     //获取Gy_Menu_1中的所有菜单信息,用于为menuInitList列表充实数据 | 
 |  |  |  | 
 |  |  |                 DataSet ds1 = new DataSet(); | 
 |  |  |                 for (int i = 0; i < ds.Tables[0].Rows.Count; i++)                                   //将Gy_Menu_1中的菜单信息及选中情况保存到menuInitList列表中, | 
 |  |  | 
 |  |  |  | 
 |  |  |                 //设置数据库操作的回滚点,若在提交前报错,则回滚到该点,期间操作取消 | 
 |  |  |                 oCN.BeginTran(); | 
 |  |  |                  | 
 |  |  |  | 
 |  |  |                 //删除当前用户的自定义数据 | 
 |  |  |                 string sql = "delete from Gy_MenuDefineSet where HMakeName = '" + HMakeName + "' and HType = '" + HTypes + "'"; | 
 |  |  |                 oCN.RunProc(sql); | 
 |  |  |  | 
 |  |  |                 //插入当前用户最新的自定义数据 | 
 |  |  |                 for(int i=0;i< saveDataList.Count; i++) | 
 |  |  |                 for (int i = 0; i < saveDataList.Count; i++) | 
 |  |  |                 { | 
 |  |  |                     sql = "select * from Gy_Menu_1 where HItemID = '" + saveDataList[i].HItemID + "'"; | 
 |  |  |                     ds = oCn.RunProcReturn(sql,"Gy_Menu_1"); | 
 |  |  |                     ds = oCn.RunProcReturn(sql, "Gy_Menu_1"); | 
 |  |  |                     if (ds.Tables[0].Rows.Count > 0) | 
 |  |  |                     { | 
 |  |  |                         string HPartentID = ds.Tables[0].Rows[0]["HPartentID"].ToString(); | 
 |  |  | 
 |  |  |                         string HType = ds.Tables[0].Rows[0]["HType"].ToString(); | 
 |  |  |                         string HPicNum = ds.Tables[0].Rows[0]["HPicNum"].ToString(); | 
 |  |  |  | 
 |  |  |                         if(HPartentID == "0" || HPartentID == ds.Tables[0].Rows[0]["HItemID"].ToString()) | 
 |  |  |                         if (HPartentID == "0" || HPartentID == ds.Tables[0].Rows[0]["HItemID"].ToString()) | 
 |  |  |                         { | 
 |  |  |                             string HPosition = ds.Tables[0].Rows[0]["HPosition"].ToString(); | 
 |  |  |                             sql = "insert into Gy_MenuDefineSet(HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HMakeName,HPicNum,HPosition) values('" + saveDataList[i].HItemID + "','" + HPartentID + "','" + HNumber + "','" + saveDataList[i].HName + "'," + HLevel + ",'" + Hurl + "','" + HType + "','" + HMakeName + "','" + HPicNum + "','" + HPosition + "')"; | 
 |  |  | 
 |  |  |                             sql = "insert into Gy_MenuDefineSet(HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HMakeName,HPicNum,HPosition) values('" + saveDataList[i].HItemID + "','" + HPartentID + "','" + HNumber + "','" + saveDataList[i].HName + "'," + HLevel + ",'" + Hurl + "','" + HType + "','" + HMakeName + "','" + HPicNum + "','z')"; | 
 |  |  |                             oCN.RunProc(sql); | 
 |  |  |                         } | 
 |  |  |                          | 
 |  |  |  | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 //提交数据库操作 | 
 |  |  |                 oCN.Commit(); | 
 |  |  |                  | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "保存成功!"; | 
 |  |  | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Web/GetOtherInBillMain_TempList_New")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetOtherInBillMain_TempList_New (string HBillType, string sHMaker, Int64 HOrgID) | 
 |  |  |         public object GetOtherInBillMain_TempList_New(string HBillType, string sHMaker, Int64 HOrgID) | 
 |  |  |         { | 
 |  |  |             WebS.WebService1 oWebs = new WebS.WebService1(); | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 List<object> columnNameList = new List<object>(); | 
 |  |  |                  | 
 |  |  |  | 
 |  |  |                 DataSet ds = oCN.RunProcReturn("exec h_p_KF_GetPonderationBillMain_TempList_New1 '" + HBillType + "','" + sHMaker + "'," + HOrgID.ToString(), "h_p_KF_GetPonderationBillMain_TempList_New1"); | 
 |  |  |                  | 
 |  |  |  | 
 |  |  |                 //添加列名 | 
 |  |  |                 foreach (DataColumn col in ds.Tables[0].Columns) | 
 |  |  |                 { | 
 |  |  | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Web/GetProcNoList")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetProcNoList(int HInterID,string sWhere,string UserID) | 
 |  |  |         public object GetProcNoList(int HInterID, string sWhere, string UserID) | 
 |  |  |         { | 
 |  |  |             List<object> columnNameList = new List<object>(); | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 ds = oCN.RunProcReturn("exec h_p_Sc_ProcNoList '" + HInterID + "','" + sWhere + "','" + UserID + "'" , "h_p_Sc_ProcNoList"); | 
 |  |  |                 ds = oCN.RunProcReturn("exec h_p_Sc_ProcNoList '" + HInterID + "','" + sWhere + "','" + UserID + "'", "h_p_Sc_ProcNoList"); | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; |