1
duhe
2024-08-12 f331a2915eebc492e872206d9aa7e13fc7f0861f
WebAPI/Controllers/Æ·ÖʹÜÀí/ÖÊÁ¿±¨±í/QC_QualityReportsController.cs
@@ -770,5 +770,606 @@
        }
        #endregion
        #region è´¨é‡æ¨¡å— å·¥è‰ºå‚数大类分析报表
        [Route("QC_CustomerAppealReport/GtetQc_TechnologyParameterClassList")]
        [HttpGet]
        public object GtetQc_TechnologyParameterClassList(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                Dictionary<object, object> dic = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<object, object>>(sWhere);
                string HProcExchBillNo = dic["HProcExchBillNo"].ToString();
                string HProcName = dic["HProcName"].ToString();
                string HTechParamClass = dic["HTechParamName"].ToString();
                string HEquipName = dic["HEquipName"].ToString();
                if ((HProcExchBillNo == null || HProcExchBillNo == "") && (HProcName == null || HProcName == "") && (HTechParamClass == null || HTechParamClass == "") && (HEquipName == null || HEquipName == ""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查询条件!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("exec h_p_SB_EquipICMOTechParamBillList_Class '" + HProcExchBillNo + "','" + HProcName + "','" + HTechParamClass + "'," + HEquipName, "h_p_SB_EquipICMOTechParamBillList_Class");
                //添加列名
                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 è´¨é‡æ¨¡å— æ€§èƒ½æŠ¥åºŸå°è´¦
        /// <summary>
        /// è¿”回直通率报表列表
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("QC_CustomerAppealReport/QC_PerformanceScrapLedger")]
        [HttpGet]
        public object QC_PerformanceScrapLedger(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (sWhere == null || sWhere == "")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查询条件!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                Dictionary<object, object> dic = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<object, object>>(sWhere);
                string HBeginDate = dic["HBeginDate"].ToString();
                string HEndDate = dic["HEndDate"].ToString();
                string HBatchNo = dic["HBatchNo"].ToString();
                int HMaterID = int.Parse(dic["HMaterID"].ToString());
                ds = oCN.RunProcReturn("exec h_p_QC_PerformanceScrapLedger '" + HBeginDate + "','" + HEndDate + "','" + HMaterID + "','" + HBatchNo+"'", "h_p_QC_PerformanceScrapLedger");
                //添加列名
                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 è´¨é‡æ¨¡å— é€æµ‹ç™»è®°æ•°æ®å°è´¦
        /// <summary>
        /// è¿”回直通率报表列表
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("QC_CustomerAppealReport/QC_RegistrationForTestingReport")]
        [HttpGet]
        public object QC_RegistrationForTestingReport(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (sWhere == null || sWhere == "")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查询条件!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                Dictionary<object, object> dic = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<object, object>>(sWhere);
                string HBeginDate = dic["HBeginDate"].ToString();
                string HEndDate = dic["HEndDate"].ToString();
                string HBatchNo = dic["HBatchNo"].ToString();
                int HMaterID = int.Parse(dic["HMaterID"].ToString());
                ds = oCN.RunProcReturn("exec h_p_QC_RegistrationForTestingReport '" + HBeginDate + "','" + HEndDate + "','" + HMaterID + "','" + HBatchNo + "'", "h_p_QC_RegistrationForTestingReport");
                //添加列名
                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("QC_CustomerAppealReport/getQC_ProcessPerformanceFirstPass")]
        [HttpGet]
        public object getQC_ProcessPerformanceFirstPass(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_QC_ProcessPerformanceFirstPassList order by æœˆä»½ desc", "h_v_QC_ProcessPerformanceFirstPassList");
                }
                else
                {
                    string sql1 = "select * from h_v_QC_ProcessPerformanceFirstPassList where 1 = 1 ";
                    string sql = sql1 + sWhere + " order by æœˆä»½ ";
                    ds = oCN.RunProcReturn(sql, "h_v_QC_ProcessPerformanceFirstPassList");
                }
                //添加列名
                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("QC_CustomerAppealReport/getQC_ProcessPerformancePass")]
        [HttpGet]
        public object getQC_ProcessPerformancePass(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_QC_ProcessPerformancePassList order by æœˆä»½ desc", "h_v_QC_ProcessPerformancePassList");
                }
                else
                {
                    string sql1 = "select * from h_v_QC_ProcessPerformancePassList where 1 = 1 ";
                    string sql = sql1 + sWhere + " order by æœˆä»½ ";
                    ds = oCN.RunProcReturn(sql, "h_v_QC_ProcessPerformancePassList");
                }
                //添加列名
                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("QC_CustomerAppealReport/getOA_ErrMsgBackBillList_Query")]
        [HttpGet]
        public object getOA_ErrMsgBackBillList_Query(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_OA_ErrMsgBackBillList_Query order by æ—¥æœŸ desc", "h_v_OA_ErrMsgBackBillList_Query");
                }
                else
                {
                    string sql1 = "select * from h_v_OA_ErrMsgBackBillList_Query where 1 = 1 ";
                    string sql = sql1 + sWhere + " order by æ—¥æœŸ ";
                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackBillList_Query");
                }
                //添加列名
                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 è´¨é‡æ¨¡å— å¼‚常管理台账
        /// <summary>
        /// è¿”回异常管理台账
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("QC_CustomerAppealReport/QC_ErrManagerLedgerReport")]
        [HttpGet]
        public object QC_ErrManagerLedgerReport(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (sWhere == null || sWhere == "")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查询条件!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                Dictionary<object, object> dic = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<object, object>>(sWhere);
                string HBeginDate = dic["HBeginDate"].ToString();
                string HEndDate = dic["HEndDate"].ToString();
                int HDeptID = int.Parse(dic["HDeptID"].ToString());
                string HMaterModel = dic["HMaterModel"].ToString();
                string HSourceName = dic["HSourceName"].ToString();
                string HProSource = dic["HProSource"].ToString();
                string HShiftsName = dic["HShiftsName"].ToString();
                string HCustomize = dic["HCustomize"].ToString();
                ds = oCN.RunProcReturn("exec h_p_QC_ErrManagerLedgerReport '" + HBeginDate + "','" + HEndDate + "'," + HDeptID + ",'" + HMaterModel + "','" + HSourceName + "','" + HProSource + "','" + HShiftsName + "','" + HCustomize + "'", "h_p_QC_ErrManagerLedgerReport");
                //添加列名
                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 è´¨é‡æ¨¡å— ä¸è‰¯å“å°è´¦
        /// <summary>
        /// è¿”回异常管理台账
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("QC_CustomerAppealReport/QC_BadProductsReport")]
        [HttpGet]
        public object QC_BadProductsReport(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (sWhere == null || sWhere == "")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查询条件!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                Dictionary<object, object> dic = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<object, object>>(sWhere);
                string HBeginDate = dic["HBeginDate"].ToString();
                string HEndDate = dic["HEndDate"].ToString();
                string HMaterNumber = dic["HMaterNumber"].ToString();
                string HMaterModel = dic["HMaterModel"].ToString();
                string HProcessName = dic["HProcessName"].ToString();
                string HDealingType = dic["HDealingType"].ToString();
                string HSendManName = dic["HSendManName"].ToString();
                string HCustomize = dic["HCustomize"].ToString();
                ds = oCN.RunProcReturn("exec h_p_QC_BadProductsReport '" + HBeginDate + "','" + HEndDate + "','" + HMaterNumber + "','" + HMaterModel + "','" + HProcessName + "','" + HDealingType + "','" + HSendManName + "','" + HCustomize + "'", "h_p_QC_BadProductsReport");
                //添加列名
                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 è´¨é‡æ¨¡å— çº¿åˆ«å¼‚常管理台账
        /// <summary>
        /// è¿”回线别异常管理台账
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("QC_CustomerAppealReport/QC_ErrManagerLedgerReport_Source")]
        [HttpGet]
        public object QC_ErrManagerLedgerReport_Source(string HYear, string HMonth, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                ds = oCN.RunProcReturn("exec h_p_QC_ErrManagerLedgerReport_Source '" + HYear + "','" + HMonth + "'", "h_p_QC_ErrManagerLedgerReport_Source");
                //添加列名
                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 è´¨é‡æ¨¡å— å¼‚常管理台账数
        /// <summary>
        /// è¿”回异常管理台账数
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("QC_CustomerAppealReport/QC_ErrManagerLedgerReport_Issue")]
        [HttpGet]
        public object QC_ErrManagerLedgerReport_Issue(string HYear, string HMonth, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                ds = oCN.RunProcReturn("exec h_p_QC_ErrManagerLedgerReport_Issue '" + HYear + "','" + HMonth + "'", "h_p_QC_ErrManagerLedgerReport_Issue");
                //添加列名
                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 è´¨é‡æ¨¡å— å¼‚常问题来源
        /// <summary>
        /// è¿”回异常问题来源
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("QC_CustomerAppealReport/QC_ErrManagerLedgerReport_SourceOfTheProblem")]
        [HttpGet]
        public object QC_ErrManagerLedgerReport_SourceOfTheProblem(string HYear, string HMonth, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                ds = oCN.RunProcReturn("exec h_p_QC_ErrManagerLedgerReport_SourceOfTheProblem '" + HYear + "','" + HMonth + "'", "h_p_QC_ErrManagerLedgerReport_SourceOfTheProblem");
                //添加列名
                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 è´¨é‡æ¨¡å— è®¾å¤‡TOP3问题
        /// <summary>
        /// è¿”回设备TOP3问题
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("QC_CustomerAppealReport/QC_ErrManagerLedgerReport_EquipTop3Issue")]
        [HttpGet]
        public object QC_ErrManagerLedgerReport_EquipTop3Issue(string HYear, string HMonth, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                ds = oCN.RunProcReturn("exec h_p_QC_ErrManagerLedgerReport_EquipTop3Issue '" + HYear + "','" + HMonth + "'", "h_p_QC_ErrManagerLedgerReport_EquipTop3Issue");
                //添加列名
                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
    }
}