1
cwjbxqmz
2023-11-10 b9d2d6f02a977d0b2ea48f28d6eb396f4326e504
WebAPI/Controllers/WebAPIController.cs
@@ -1838,6 +1838,57 @@
        }
        /// <summary>
        /// 获取银行列表
        /// <summary>
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Web/GetBankList_Json")]
        [HttpGet]
        public object GetBankList_Json(string sWhere)
        {
            DataSet ds;
            //sWhere = " Where HStopFlag=0  and HEndFlag=1";
            //sWhere = " Where HStopFlag=0  and HEndFlag=1  and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString();
            if (sWhere != "")
            {
                sWhere = " and ( HNumber like '%" + sWhere + "%' or HName like '%" + sWhere + "%' ) ";
            }
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                string sql = "select HItemID,HNumber 银行代码,HName 银行名称,HStopflag from Gy_Bank where 1=1 " + sWhere;
                ds = oCN.RunProcReturn(sql, "Gy_Bank");
                if (ds == null || ds.Tables[0].Rows.Count <= 0)
                {
                    objjson.code = "0";
                    objjson.count = 0;
                    objjson.Message = "获取失败";
                    objjson.data = null;
                    return objjson;
                }
                else
                {
                    objjson.code = "0";
                    objjson.count = 1;
                    objjson.Message = "获取成功!";
                    objjson.data = ds.Tables[0];
                    return objjson;
                }
            }
            catch (Exception e)
            {
                objjson.code = "0";
                objjson.count = 0;
                objjson.Message = "获取失败" + e.ToString();
                objjson.data = null;
                return objjson;
            }
        }
        /// <summary>
        /// 获取物料列表
        /// <summary>
        ///参数:string sql。
@@ -4069,6 +4120,142 @@
                return objjson;
            }
        }
        /// <summary>
        /// 根据设备带出项目
        /// </summary>
        /// <returns></returns>
        [Route("Web/GetItemByEquipFile")]
        [HttpGet]
        public object GetItemByEquipFile(int EquipProjectID,string Type)
        {
            if (EquipProjectID <= 0)
            {
                objjson.code = "0";
                objjson.count = 0;
                objjson.Message = "产品器具未选择";
                objjson.data = null;
                return objjson;
            }
            try
            {
                string HView = "";
                switch (Type)
                {
                    case "DJ":
                        HView = "h_v_Sb_GetDotCheckItemList";
                        break;
                    case "BY":
                        HView = "h_v_Sb_GetMaintainItemList";
                        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);
                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/GetEquipmentBillsList")]
        [HttpGet]
        public object GetEquipmentBillsList(string sWhere, string Type)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                string HView = "";
                switch (Type)
                {
                    case "DJ":
                        HView = "h_v_Sb_EquipDotCheckBillList";
                        break;
                    case "BY":
                        HView = "h_v_Sb_EquipMaintainBillList";
                        break;
                    case "WX":
                        HView = "h_v_Sb_EquipRepairCheckBillList";
                        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 1 = 1 ");
                ds = oCN.RunProcReturn(sql, HView);
                //添加列名
                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列对象的列名
                }
                if (ds == null || ds.Tables[0].Rows.Count <= 0)
                {
                    objjson.code = "0";
                    objjson.count = 0;
                    objjson.Message = "获取失败,查无数据" + DBUtility.ClsPub.sErrInfo;
                    objjson.data = null;
                    objjson.list = columnNameList;
                    return objjson;
                }
                else
                {
                    objjson.code = "1";
                    objjson.count = 1;
                    objjson.Message = "获取成功!";
                    objjson.data = ds.Tables[0];
                    objjson.list = columnNameList;
                    return objjson;
                }
            }
            catch (Exception ex)
            {
                objjson.code = "0";
                objjson.count = 0;
                objjson.Message = "获取失败" + ex.ToString();
                objjson.data = null;
                return objjson;
            }
        }
        /// <summary>
        /// 根据设备点检规程显示设备点检程项目
        /// </summary>