| | |
| | | using Newtonsoft.Json.Linq; |
| | | using DBUtility; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | |
| | | #region 设备保养规程单列表 |
| | | [Route("Sb_EquipMaintainRuleBill/GetEquipMaintainRuleList")] |
| | | [HttpGet] |
| | | public object GetEquipMaintainRuleList(string sWhere) |
| | | public object GetEquipMaintainRuleList(string sWhere,string user) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | if (!DBUtility.ClsPub.Security_Log("Sb_EquipMaintainRuleBillList", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无查看权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_Sb_EquipMaintainRuleList " + sWhere + " order by hmainid desc", "h_v_Sb_EquipMaintainRuleList"); |
| | |
| | | string sql = sql1 + sWhere + " order by hmainid desc"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipMaintainRuleList"); |
| | | } |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有你要找的记录!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "返回记录成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | #region 设备保养规程记录删除功能 |
| | | [Route("Sb_EquipMaintainRuleBill/DeleteEquipMaintainRuleBillList")] |
| | | [HttpGet] |
| | | public object DeleteEquipMaintainRuleBillList(string HInterID) |
| | | public object DeleteEquipMaintainRuleBillList(string HInterID,string user) |
| | | { |
| | | if (!DBUtility.ClsPub.Security_Log("Sb_EquipMaintainRuleBill_Delete", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无删除权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(HInterID); |
| | | if (lngBillKey == 0) |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HChecker != "") |
| | | if (oBill.omodel.HChecker != ""&& oBill.omodel.HChecker != null) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | bool IsDete = oBill.DeleteBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (IsDete) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | } |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | //获取保养项目编辑数据 |
| | | string sql = "select 保养项目ID,保养项目,保养部位,具体要求,负责人ID,负责人代码,负责人名称,子备注2 from h_v_Sb_EquipMaintainRuleList where 1 = 1 " + Swhere + ""; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipMaintainRuleList"); |
| | | string sql = "select 保养项目ID,保养项目,保养部位,具体要求,负责人ID,负责人代码,负责人名称,子备注2 from h_v_Sb_EquipMaintainRuleSub_Item where 1 = 1 " + Swhere + ""; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipMaintainRuleSub_Item"); |
| | | //获取配件项目编辑数据 |
| | | string sql1 = "select 配件ID,配件代码,配件名称,单位ID,计量单位代码,计量单位名称,用量,标准用量,子备注1 from h_v_Sb_EquipMaintainRuleList where 1 = 1 " + Swhere + ""; |
| | | ds1 = oCN.RunProcReturn(sql1, "h_v_Sb_EquipMaintainRuleList"); |
| | | string sql1 = "select 配件ID,配件代码,配件名称,单位ID,计量单位代码,计量单位名称,用量,标准用量,子备注1 from h_v_Sb_EquipMaintainRuleSub where 1 = 1 " + Swhere + ""; |
| | | ds1 = oCN.RunProcReturn(sql1, "h_v_Sb_EquipMaintainRuleSub"); |
| | | |
| | | list.Add(ds.Tables[0]); |
| | | list.Add(ds1.Tables[0]); |
| | |
| | | } |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | //获取保养项目编辑数据 |
| | | string sql = "select 保养项目ID HMaintainItemID,保养项目代码 HMaintainItemNumber,保养项目 HMaintainItem,保养部位 HMaintainPart,具体要求 HClaim,负责人ID HManagerID,负责人代码 HManagerNumber,负责人名称 HManagerName,子备注2 HRemark from h_v_Sb_EquipMaintainRuleList where 1 = 1 " + Swhere + ""; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipMaintainRuleList"); |
| | | string sql = "select 保养项目ID HMaintainItemID,保养项目代码 HMaintainItemNumber,保养项目 HMaintainItem,保养部位 HMaintainPart,具体要求 HClaim,负责人ID HManagerID,负责人代码 HManagerNumber,负责人名称 HManagerName,子备注2 HRemark from h_v_Sb_EquipMaintainRuleSub_Item where 1 = 1 " + Swhere + ""; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipMaintainRuleSub_Item"); |
| | | //获取配件项目编辑数据 |
| | | string sql1 = "select 配件ID HMaterID,配件代码 HMaterNumber,配件名称 HMaterName,单位ID HUnitID,计量单位代码 HUnitNumber,计量单位名称 HUnitName,用量 HQty,子备注1 HRemark from h_v_Sb_EquipMaintainRuleList where 1 = 1 " + Swhere + ""; |
| | | ds1 = oCN.RunProcReturn(sql1, "h_v_Sb_EquipMaintainRuleList"); |
| | | string sql1 = "select 配件ID HMaterID,配件代码 HMaterNumber,配件名称 HMaterName,单位ID HUnitID,计量单位代码 HUnitNumber,计量单位名称 HUnitName,用量 HQty,子备注1 HRemark from h_v_Sb_EquipMaintainRuleSub where 1 = 1 " + Swhere + ""; |
| | | ds1 = oCN.RunProcReturn(sql1, "h_v_Sb_EquipMaintainRuleSub"); |
| | | |
| | | list.Add(ds.Tables[0]); |
| | | list.Add(ds1.Tables[0]); |
| | |
| | | string msg2 = sArray[0].ToString(); |
| | | string msg3 = sArray[1].ToString(); |
| | | string msg4 = sArray[2].ToString(); |
| | | string msg5 = sArray[3].ToString(); |
| | | |
| | | string UserName = ""; |
| | | ListModels oListModels = new ListModels(); |
| | | try |
| | | { |
| | | if (!DBUtility.ClsPub.Security_Log("Sb_EquipMaintainRuleBill_Edit", 1, false, msg5)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无保存权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | DLL.ClsSb_EquipMaintainRuleBill oBill = new DLL.ClsSb_EquipMaintainRuleBill(); |
| | | List<Models.ClsSb_EquipMaintainRuleBillMain> lsmain = new List<Models.ClsSb_EquipMaintainRuleBillMain>(); |
| | | msg2 = msg2.Replace("\\", ""); |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 设备保养规程单审核/反审核功能 |
| | | [Route("Sb_EquipMaintainRuleBill/CheckSb_EquipMaintainRuleBill")] |
| | | [HttpGet] |
| | | public object CheckSb_EquipMaintainRuleBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sb_EquipMaintainRuleBill_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; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 审核 2 反审核 |
| | | if (Type == 1) |
| | | { |
| | | if (!BillOld.CheckBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (BillOld.AbandonCheck(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | } |
| | | else |
| | | { |
| | | 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 |
| | | |
| | | #region 设备保养规程单关闭/反关闭功能 |
| | | [Route("Sb_EquipMaintainRuleBill/CloseSb_EquipMaintainRuleBill")] |
| | | [HttpGet] |
| | | public object CloseSb_EquipMaintainRuleBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sb_EquipMaintainRuleBill_Close", 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; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 关闭 2 反关闭 |
| | | if (Type == 1) |
| | | { |
| | | if (!BillOld.CloseBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (!BillOld.CancelClose(int.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 |
| | | } |
| | | } |