zrg
2024-07-31 e1dd681c82cdde2b21c35eb091fc992202d6d339
WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs
@@ -82,7 +82,7 @@
                return objJsonResult;
            }
            string s = "";
            //string s = "";
            Int64 lngBillKey = 0;
            lngBillKey = DBUtility.ClsPub.isLong(HItemID);
            if (lngBillKey == 0)
@@ -153,6 +153,51 @@
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        # region 设备保养规程编辑时获取表体数据新(保养规程列表、点检规程列表)
        [Route("Gy_EquipFileMain/Gy_EquipFileMainSubAndSubItem")]
        [HttpGet]
        public object Gy_EquipFileMainSubAndSubItem(string HInterID)
        {
            DataSet ds, ds1;
            List<object> list = new List<object>();
            string Swhere = "";
            try
            {
                if (HInterID != "" || HInterID != null)
                {
                    Swhere = " and hmainid='" + HInterID + "'";
                }
                else
                {
                    Swhere = HInterID;
                }
                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_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_EquipMaintainRuleSub where 1 = 1 " + Swhere + "";
                ds1 = oCN.RunProcReturn(sql1, "h_v_Sb_EquipMaintainRuleSub");
                list.Add(ds.Tables[0]);
                list.Add(ds1.Tables[0]);
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "获取信息成功!";
                objJsonResult.list = list;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "没有返回任何记录!" + e.ToString();
                objJsonResult.data = null;
            }
            return objJsonResult;
        }
        #endregion
@@ -1144,5 +1189,131 @@
        }
        #endregion
        #region 设备履历列表
        [Route("Gy_EquipFileMain/GetResumeList")]
        [HttpGet]
        public object GetResumeList(string HInterID, 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;
                }
                ds = oCN.RunProcReturn($@"select a.HInterID,a.HDate '日期',a.HBillType,x.HName 单据类型,a.HBillNo as '单据号',
                    CASE WHEN a.HBillStatus <= 1 THEN '创建' WHEN a.HBillStatus = 2 THEN '已审核' WHEN a.HBillStatus = 3 AND
                    a.HCloseType = 0 THEN '自动关闭' WHEN a.HBillStatus = 3 AND
                    a.HCloseType = 1 THEN '手动关闭' WHEN a.HBillStatus = 4 THEN '已作废' ELSE '其它状态' END AS 单据状态,
                    a.HMaker AS 制单人, a.HMakeDate AS 制单日期,a.HChecker AS 审核人, a.HCheckDate AS 审核日期, a.HUpDater AS 修改人, a.HUpDateDate AS 修改日期,
                    a.HCloseMan AS 关闭人, a.HCloseDate AS 关闭日期, a.HDeleteMan AS 作废人, a.HDeleteDate AS 作废日期
                    from (
                    select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType  from Gy_EquipFileBillMain where HInterID = {HInterID} UNION ALL
                    select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from Sb_EquipStockInCheckBillMain where HEquipID = {HInterID} UNION ALL
                    select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from Sb_EquipDotCheckBillMain where HEquipID = {HInterID} UNION ALL
                    select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from Sb_EquipMaintainBillMain where HEquipID = {HInterID} UNION ALL
                    select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from Sb_EquipRepairWorkBillMain where HEquipID = {HInterID} UNION ALL
                    select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from Sb_EquipConkBookBillMain where HEquipID = {HInterID}
                    )as a,Xt_BillType as x
                    where a.HBillType = x.HNumber
                    ORDER BY '日期' ASC;", "h_v_Gy_EquipFileMainList");
                //添加动态列信息
                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
        #region 器具履历列表
        [Route("Gy_MouldFileMain/GetMouldResumeList")]
        [HttpGet]
        public object GetMouldResumeList(string HInterID, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (!DBUtility.ClsPub.Security_Log("Gy_MouldFileList", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "没有查看权限";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn($@"select a.HInterID,a.HDate '日期',a.HBillType,x.HName 单据类型,a.HBillNo as '单据号',
                CASE WHEN a.HBillStatus <= 1 THEN '创建' WHEN a.HBillStatus = 2 THEN '已审核' WHEN a.HBillStatus = 3 AND
                a.HCloseType = 0 THEN '自动关闭' WHEN a.HBillStatus = 3 AND
                a.HCloseType = 1 THEN '手动关闭' WHEN a.HBillStatus = 4 THEN '已作废' ELSE '其它状态' END AS 单据状态,
                a.HMaker AS 制单人, a.HMakeDate AS 制单日期,a.HChecker AS 审核人, a.HCheckDate AS 审核日期, a.HUpDater AS 修改人, a.HUpDateDate AS 修改日期,
                a.HCloseMan AS 关闭人, a.HCloseDate AS 关闭日期, a.HDeleteMan AS 作废人, a.HDeleteDate AS 作废日期
                from (
                select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType  from Gy_MouldFileMain where HInterID = {HInterID} UNION ALL
                select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from Sc_MouldDotCheckBillMain where HMouldID = {HInterID} UNION ALL
                select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from Sc_MouldMaintainBillMain where HMouldID = {HInterID} UNION ALL
                select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from Sc_MouldRepairWorkBillMain  where HMouldID = {HInterID} UNION ALL
                select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from Sc_MouldConkBookBillMain where HMouldID = {HInterID} UNION ALL
                select a.HInterID,a.HDate,a.HBillType,a.HBillNo,a.HBillStatus,a.HMaker,a.HMakeDate,a.HChecker,a.HCheckDate,a.HUpDater,a.HUpDateDate,a.HCloseMan,a.HCloseDate,a.HDeleteMan,a.HDeleteDate,a.HCloseType
                from Sc_MouldStockBillMain as a,Sc_MouldStockBillSub as b
                where  a.HInterID = b.HInterID and b.HMaterID = {HInterID} and HBillType in ('3801','3829','3826','3831','3827')
                )as a,Xt_BillType as x
                where a.HBillType = x.HNumber
                ORDER BY '日期' ASC;", "Gy_MouldFileResume");
                //添加动态列信息
                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
    }
}