|  |  |  | 
|---|
|  |  |  | //----------创建虚表------------------------ | 
|---|
|  |  |  | 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);//将新行加入到表中 | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #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 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 用关联工序获取信息 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | 
|---|
|  |  |  | 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"; | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <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> | 
|---|
|  |  |  | 
|---|
|  |  |  | 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"; | 
|---|
|  |  |  | 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")] | 
|---|
|  |  |  | [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"; | 
|---|
|  |  |  | 
|---|
|  |  |  | ds = oCn.RunProcReturn(sql, "Gy_MenuDefineSet");        //查询当前用户的自定义菜单数据 | 
|---|
|  |  |  | 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"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|