1
yusijie
2023-07-24 91466d2cdaf6da07ba28274f5f46d52daf86c049
WebAPI/Controllers/WebAPIController.cs
@@ -3379,6 +3379,118 @@
        }
        /// <summary>
        /// 获取抽样方案列表
        /// </summary>
        /// <returns></returns>
        [Route("Web/GetGy_SampleScheme")]
        [HttpGet]
        public object GetSampleScheme(string SampleScheme, int OrganizationID)
        {
            if (SampleScheme != "")
            {
                sWhere = " and ( 抽样方案代码 like '%" + SampleScheme + "%' or 抽样方案名称 like '%" + SampleScheme + "%' ) ";
            }
            try
            {
                List<object> columnNameList = new List<object>();
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                string sql = "Select * from h_v_Gy_GetSampleSchemeListView where 1 = 1 " + sWhere + "Order by hmainid ";
                ds = oCN.RunProcReturn(sql, "h_v_Gy_GetSampleSchemeListView");
                //添加列名
                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;
                    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>
        /// <returns></returns>
        [Route("Web/GetGy_InspectValue")]
        [HttpGet]
        public object GetInspectValue(string InspectValue, int OrganizationID)
        {
            if (InspectValue != "")
            {
                sWhere = " and ( 检验值代码 like '%" + InspectValue + "%' or 检验值名称 like '%" + InspectValue + "%' ) ";
            }
            try
            {
                List<object> columnNameList = new List<object>();
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                string sql = "Select * from h_v_Gy_GetInspectValueList where 1 = 1 " + sWhere + "Order by hmainid ";
                ds = oCN.RunProcReturn(sql, "h_v_Gy_GetInspectValueList");
                //添加列名
                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;
                    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>
        /// <returns></returns>
@@ -3397,7 +3509,7 @@
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                string sql = "select c.HItemID HQCCheckItemID,c.HName 检验项目,b.HQCStd,b.HQCUnit HUnit from Gy_QCCheckProjectMain a left join Gy_QCCheckProjectSub b on a.HInterID = b.HInterID left join Gy_QCCheckItem c on b.HQCCheckItemID = c.HItemID where a.HInterID = " + CheckProjectID;
                string sql = "select c.HItemID HQCCheckItemID,c.HName 检验项目,b.HQCStd,b.HQCUnit HUnit,b.HAnalysisMethod,b.HStatus HResult from Gy_QCCheckProjectMain a left join Gy_QCCheckProjectSub b on a.HInterID = b.HInterID left join Gy_QCCheckItem c on b.HQCCheckItemID = c.HItemID where a.HInterID = " + CheckProjectID;
                ds = oCN.RunProcReturn(sql, "Gy_QCCheckProjectMain");
                if (ds == null || ds.Tables[0].Rows.Count <= 0)
                {