black-goat-me
2023-05-19 752a904c8c3bee0c56bd9c4129ffa868cd7a3917
WebAPI/Controllers/MateOutController.cs
@@ -1317,6 +1317,110 @@
                return objJsonResult;
            }
        }
        //#region 白坯发布汇总报表
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
        //private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        //DataSet ds;
        public class MaterOutSumReport
        {
            public DateTime HBeginDate;
            public DateTime HEndDate;
            public string HMaterNumber;
            public string HBillNo;
            public string HProductName;
            public string HProductModel;
            //public string RandomSearch;
        }
        //白坯发布汇总报表
        [Route("MaterOutSumReport/MaterOutSumReport_Cloth")]
        [HttpGet]
        public object MaterOutSumReport_Cloth(string sWhere)
        {
            try
            {
                //反序列化传递的值
                MaterOutSumReport com = JsonConvert.DeserializeObject<MaterOutSumReport>(sWhere.ToString());
                ds = oCN.RunProcReturn($"exec h_p_Kf_MaterOutSumReport_Cloth '{com.HBeginDate}','{com.HEndDate}'" +
                    $",'{com.HMaterNumber}','{com.HBillNo}','{com.HProductName}','{com.HProductModel}'", "h_p_Kf_MaterOutSumReport_Cloth");
                //获取列名
                List<object> columnNameList = new List<object>();
                //添加列名
                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.list = columnNameList;
                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;
            }
        }
        //白坯发布明细报表
        [Route("MaterOutEntryReport/MaterOutEntryReport_Cloth")]
        [HttpGet]
        public object MaterOutEntryReport_Cloth(string sWhere)
        {
            int i = 0;
            try
            {
                //反序列化传递的值
                MaterOutSumReport com = JsonConvert.DeserializeObject<MaterOutSumReport>(sWhere.ToString());
                ds = oCN.RunProcReturn($"exec h_p_Kf_MaterOutEntryReport_Cloth '{com.HBeginDate}','{com.HEndDate}'" +
                    $",'{com.HMaterNumber}','{com.HBillNo}','{com.HProductName}','{com.HProductModel}'", "h_p_Kf_MaterOutEntryReport_Cloth");
                //获取列名
                List<object> columnNameList = new List<object>();
                //添加列名
                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.list = columnNameList;
                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
    }
}