WebAPI/Controllers/SBGL/Sb_EquipMaintainBillController.cs
@@ -140,6 +140,43 @@
        #endregion
        #region 设备负荷分析表
        [Route("Sb_EquipMaintainReport/Sb_EquipmentLoadReportList")]
        [HttpGet]
        public object Sb_EquipmentLoadReportList(string HDeptID, string HWorkCenterID, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                ds = oCN.RunProcReturn("exec h_p_Sb_EquipmentLoadReportListt '" + HDeptID + "','" + HWorkCenterID + "'", "h_p_Sb_EquipmentLoadReportListt");
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds;
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region sql语句
@@ -366,7 +403,29 @@
                    return objJsonResult;
                }
                bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                //删除前控制
                DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_Sb_EquipMaintainBill_BeforeDelCtrl " + HInterID.ToString() + ",'" + user + "'", "h_p_Sb_EquipMaintainBill_BeforeDelCtrl");
                if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Sb_EquipMaintainBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo);
                if (IsDete)
                {
                    objJsonResult.code = "0";
@@ -473,7 +532,7 @@
                }
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                //获取保养项目编辑数据
                string sql = "select 保养项目ID HMaintainItemID, 保养项目代码 HMaintainItemNumber,保养项目名称 HMaintainItem,保养部位 HMaintainPart,具体要求 HClaim,HManagerID,负责人代码 HManagerNumber,负责人 HManagerName,表体备注 HRemark  from h_v_Sb_EquipMaintainBillSub_Item where 1 = 1 " + Swhere + "";
                string sql = "select 保养项目ID HMaintainItemID, 保养项目代码 HMaintainItemNumber,保养项目名称 HMaintainItem,保养部位 HMaintainPart,具体要求 HClaim,HManagerID,负责人代码 HManagerNumber,负责人 HManagerName,表体备注 HRemark,保养结果 HMaintainResult  from h_v_Sb_EquipMaintainBillSub_Item where 1 = 1 " + Swhere + "";
                ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipMaintainBillSub_Item");
                //获取配件项目编辑数据
                string sql1 = "select HMaterID, 配件代码 HMaterNumber,配件名称 HMaterName,单位ID HUnitID,单位代码 HUnitNumber,单位名称 HUnitName,实际用量 HQty,标准用量 HQtyMust,表体备注 HRemark,负责人ID HManagerID,负责人代码 HManagerNumber,负责人 HManagerName  from h_v_Sb_EquipMaintainBillList where 1 = 1 " + Swhere + "";
@@ -621,8 +680,8 @@
                    item.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                    item.HCloseType = false;   //关闭类型
                    //oItemSub.HRemark = "";         //备注
                    item.HSourceInterID = 0;     // 源单主内码
                    item.HSourceEntryID = 0;   //源单子内码
                    //item.HSourceInterID = 0;     // 源单主内码
                    //item.HSourceEntryID = 0;   //源单子内码
                    //oItemSub.HSourceBillNo = "";  //源单单号
                    //oItemSub.HSourceBillType = ""; //源单类型
                    item.HRelationQty = 0;     //关联数量
@@ -882,5 +941,63 @@
        #endregion
        #endregion
        #region 设备保养逾期预警报表
        [Route("Sb_EquipMaintainWarning/Report")]
        [HttpGet]
        public object Report(string HYear, string HEquipTypeID, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //if (!DBUtility.ClsPub.Security_Log("Gy_EquipFileList", 1, false, user))
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "没有查看权限";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                if (HYear == null || HYear.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "请选择有效年份";
                    objJsonResult.data = "";
                    objJsonResult.list = columnNameList;
                    return objJsonResult;
                }
                else
                {
                    string sql = "exec h_p_Sb_EquipMaintainWarningReport " + HYear + "," + HEquipTypeID;
                    ds = oCN.RunProcReturn(sql, "h_p_Sb_EquipMaintainWarningReport");
                }
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}