yxj
2024-06-27 4a71279770509d6876265b64002779c035295e3c
WebAPI/Controllers/SBGL/Sb_EquipDotCheckBillController.cs
@@ -15,7 +15,8 @@
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;//单据状态(新增,修改,浏览,更新单价,变更)
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        public DAL.ClsSb_EquipDotCheckBill BillNew = new DAL.ClsSb_EquipDotCheckBill();   //对应单据类
        public DAL.ClsSb_EquipDotCheckBill BillOld = new DAL.ClsSb_EquipDotCheckBill();   //对应单据类
        public DAL.ClsSb_EquipDotCheckBill BillOld = new DAL.ClsSb_EquipDotCheckBill();   //对应单据类
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();   //获取系统参数
        #region 设备点检记录表
@@ -38,15 +39,34 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (sWhere == null || sWhere.Equals(""))
                string sReturn = "";
                string HViewName = "h_v_Sb_EquipDotCheckBillList";//视图命名
                if (oSystemParameter.ShowBill(ref sReturn) == true)
                {
                    ds = oCN.RunProcReturn("select * from h_v_Sb_EquipDotCheckBillList " + sWhere + " order by hmainid desc", "h_v_Sb_EquipDotCheckBillList");
                    if (oSystemParameter.omodel.WMS_CampanyName == "九菱")
                    {
                        HViewName = "h_v_Sb_EquipDotCheckBillMainList";
                    }
                }
                else
                {
                    string sql1 = "select * from h_v_Sb_EquipDotCheckBillList where 1 = 1";
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据读取失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from " + HViewName + " " + sWhere + " order by hmainid desc", HViewName);
                }
                else
                {
                    string sql1 = "select * from " + HViewName + " " + " where 1 = 1";
                    string sql = sql1 + sWhere + " order by hmainid desc";
                    ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipDotCheckBillList");
                    ds = oCN.RunProcReturn(sql, HViewName);
                }
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
@@ -362,7 +382,7 @@
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                if (sqlWhere == null || sqlWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select 点检项目ID HDotCheckItemID,点检项目代码 as HDotCheckCode ,点检项目 HDotCheckItem,点检部位 HDotCheckPart ,具体要求 HClaim,表体备注 HRemark,负责人ID HManagerID,负责人编码 HManagerCode,负责人 HManagerName  from h_v_Sb_EquipDotCheckBillList", "h_v_Sb_EquipDotCheckBillList");
                    ds = oCN.RunProcReturn("select * from h_v_Sb_EquipDotCheckBill_Edit", "h_v_Sb_EquipDotCheckBill_Edit");
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "获取信息成功!";
@@ -370,9 +390,9 @@
                }
                else
                {
                    string sql1 = "select 点检项目ID HDotCheckItemID,点检项目代码 as HDotCheckCode ,点检项目 HDotCheckItem,点检部位 HDotCheckPart,具体要求 HClaim,表体备注 HRemark,负责人ID HManagerID,负责人编码 HManagerCode,负责人 HManagerName  from h_v_Sb_EquipDotCheckBillList where 1 = 1 ";
                    string sql1 = "select * from h_v_Sb_EquipDotCheckBill_Edit where 1 = 1 ";
                    string sql = sql1 + sqlWhere;
                    ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipDotCheckBillList");
                    ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipDotCheckBill_Edit");
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "获取信息成功!";
@@ -391,13 +411,8 @@
        #endregion
        #endregion
        #region 设备点检记录单PDA
        #region 根据设备条码查找设备档案信息PDA
        [Route("Sb_PDA_EquipDotCheckBill/txtHBarCode_KeyDown")]
@@ -416,6 +431,49 @@
                }
                //得到信息
                ds = oCN.RunProcReturn("select top 1 * from Gy_EquipFileBillMain  where HEquipFileNumber= '" + HBarCode + "'", "Gy_EquipFileBillMain");
                //写入信息
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "未查询到设备信息!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 根据设备条码查找设备档案信息PDA  查询条码档案列表
        [Route("Sb_PDA_EquipDotCheckBill/txtHBarCode_KeyDown_List")]
        [HttpGet]
        public object txtHBarCode_KeyDown_List(string HBarCode)
        {
            try
            {
                if (HBarCode == null || HBarCode.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "条形码不能为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //得到信息
                ds = oCN.RunProcReturn("select top 1 * from h_v_Gy_EquipFileMainList  where 条形码= '" + HBarCode + "'", "h_v_Gy_EquipFileMainList");
                //写入信息
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
@@ -732,7 +790,62 @@
        }
        #endregion
        #endregion
        #region 设备点检逾期预警报表
        [Route("Sb_EquipDotCheckWarning/Report")]
        [HttpGet]
        public object Report(string HYear,string HMonth,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("") || HMonth == null || HMonth.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "请选择有效年份,月份";
                    objJsonResult.data = "";
                    objJsonResult.list = columnNameList;
                    return objJsonResult;
                }
                else
                {
                    string sql = "exec h_p_Sb_EquipDotCheckWarningReport " + HYear + "," + HMonth + "," + HEquipTypeID;
                    ds = oCN.RunProcReturn(sql, "h_p_Sb_EquipDotCheckWarningReport");
                }
                //添加列名
                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
    }
}