From b129762a4bb5ec2cde5edf16bc9cbda57c73587d Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期三, 24 五月 2023 09:33:10 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/MateOutController.cs |  146 +++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 136 insertions(+), 10 deletions(-)

diff --git a/WebAPI/Controllers/MateOutController.cs b/WebAPI/Controllers/MateOutController.cs
index 7c9a49e..d2da3a0 100644
--- a/WebAPI/Controllers/MateOutController.cs
+++ b/WebAPI/Controllers/MateOutController.cs
@@ -1351,21 +1351,30 @@
                     "( (鏃ユ湡 between ''" + com.HBeginDate + "'' and ''" + com.HEndDate + "'') or (''" + com.HBeginDate + "'' = '''' and ''" + com.HEndDate + "''='''') ) " +
                     "and (浜у搧浠g爜=''" + com.HMaterNumber + "'' or ''" + com.HMaterNumber + "''='''') " +
                     "and (鍗曟嵁鍙�=''" + com.HBillNo + "'' or ''"+ com.HBillNo + "''='''') " +
-                    "and (浜у搧鍚嶇О=''" + com.HProductName + "'' or ''" + com.HBillNo + "''='''') " +
+                    "and (浜у搧鍚嶇О=''" + com.HProductName + "'' or ''" + com.HProductName + "''='''') " +
                     "and (瑙勬牸鍨嬪彿=''" + com.HProductModel + "'' or ''" + com.HProductModel + "''='''') " + com.RandomSearch;
 
-                ds = oCN.RunProcReturn($"exec h_p_Kf_MaterOutSumReport_Cloth_New '{sql}','1' , ''" , "h_p_Kf_MaterOutSumReport_Cloth_New");
-
-
-                DataTable dt = ds.Tables[0];
+                ds = oCN.RunProcReturn($"exec h_p_Kf_MaterOutSumReport_Cloth_New '{sql}'" , "h_p_Kf_MaterOutSumReport_Cloth_New");
 
                 //鑾峰彇鍒楀悕
                 List<object> columnNameList = new List<object>();
                 //娣诲姞鍒楀悕
                 foreach (DataColumn col in ds.Tables[0].Columns)
                 {
+                    int headLen = col.ColumnName.ToString().Length;        //鍒楀悕鐨勯暱搴�
+                    int colLen = 0;
+                    if (ds.Tables[1].Rows[0][col.ColumnName] != null)
+                    {
+                        string colLenStr=ds.Tables[1].Rows[0][col.ColumnName].ToString();
+                        if(colLenStr != "")
+                        {
+                            colLen = int.Parse(colLenStr);   //鍒椾腑鏈�闀挎暟鎹殑闀垮害
+                        }
+                        
+                    }
+                    colLen = (headLen >= colLen) ? headLen : colLen;
                     Type dataType = col.DataType;
-                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\",\"width\":\"" + colLen + "\"}";
                     columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
                 }
 
@@ -1373,7 +1382,7 @@
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
                 objJsonResult.list = columnNameList;
-                objJsonResult.data = dt;
+                objJsonResult.data = ds.Tables[0];
                 return objJsonResult;
             }
             catch (Exception e)
@@ -1401,10 +1410,10 @@
                     "( (鏃ユ湡 between ''" + com.HBeginDate + "'' and ''" + com.HEndDate + "'') or (''" + com.HBeginDate + "'' = '''' and ''" + com.HEndDate + "''='''') ) " +
                     "and (浜у搧浠g爜=''" + com.HMaterNumber + "'' or ''" + com.HMaterNumber + "''='''') " +
                     "and (浠诲姟鍗�=''" + com.HBillNo + "'' or ''" + com.HBillNo + "''='''') " +
-                    "and (浜у搧鍚嶇О=''" + com.HProductName + "'' or ''" + com.HBillNo + "''='''') " +
+                    "and (浜у搧鍚嶇О=''" + com.HProductName + "'' or ''" + com.HProductName + "''='''') " +
                     "and (瑙勬牸鍨嬪彿=''" + com.HProductModel + "'' or ''" + com.HProductModel + "''='''') " + com.RandomSearch;
 
-                ds = oCN.RunProcReturn($"exec h_p_Kf_MaterOutEntryReport_Cloth_New '{sql}','1' , ''", "h_p_Kf_MaterOutEntryReport_Cloth_New");
+                ds = oCN.RunProcReturn($"exec h_p_Kf_MaterOutEntryReport_Cloth_New '{sql}'", "h_p_Kf_MaterOutEntryReport_Cloth_New");
 
                 DataTable dt = ds.Tables[0];
 
@@ -1413,8 +1422,20 @@
                 //娣诲姞鍒楀悕
                 foreach (DataColumn col in ds.Tables[0].Columns)
                 {
+                    int headLen = col.ColumnName.ToString().Length;        //鍒楀悕鐨勯暱搴�
+                    int colLen = 0;
+                    if (ds.Tables[1].Rows[0][col.ColumnName] != null)
+                    {
+                        string colLenStr = ds.Tables[1].Rows[0][col.ColumnName].ToString();
+                        if (colLenStr != "")
+                        {
+                            colLen = int.Parse(colLenStr);   //鍒椾腑鏈�闀挎暟鎹殑闀垮害
+                        }
+
+                    }
+                    colLen = (headLen >= colLen) ? headLen : colLen;
                     Type dataType = col.DataType;
-                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name +"\",\"width\":\"" + colLen + "\"}";
                     columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
                 }
 
@@ -1437,6 +1458,111 @@
         #endregion
 
 
+
+        #region 鏌撳巶姹囨�绘姤琛�
+
+        #region 鏌撳巶姹囨�绘姤琛�
+        [Route("ProdProcessSumReport/ProdProcessSumReport_DyeColor")]
+        [HttpGet]
+        public object ProdProcessSumReport_DyeColor(string sWhere)
+        {
+            try
+            {
+                //鍙嶅簭鍒楀寲浼犻�掔殑鍊�
+                MaterOutSumReport com = JsonConvert.DeserializeObject<MaterOutSumReport>(sWhere.ToString());
+
+                string sql = "" +
+                    "( (鐢熶骇璁㈠崟鏃ユ湡 between ''" + com.HBeginDate + "'' and ''" + com.HEndDate + "'') or (''" + com.HBeginDate + "'' = '''' and ''" + com.HEndDate + "''='''') ) " +
+                    "and (浜у搧浠g爜=''" + com.HMaterNumber + "'' or ''" + com.HMaterNumber + "''='''') " +
+                    "and (鐢熶骇璁㈠崟鍙�=''" + com.HBillNo + "'' or ''" + com.HBillNo + "''='''') " +
+                    "and (浜у搧鍚嶇О=''" + com.HProductName + "'' or ''" + com.HProductName + "''='''') " +
+                    "and (瑙勬牸鍨嬪彿=''" + com.HProductModel + "'' or ''" + com.HProductModel + "''='''') " + com.RandomSearch;
+
+                ds = oCN.RunProcReturn($"exec h_p_Kf_ProdProcessSumReport_DyeColor '{sql}'", "h_p_Kf_ProdProcessSumReport_DyeColor");
+
+                //鑾峰彇鍒楀悕
+                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));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                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
+
+
+        #region 鏌撳巶鏄庣粏鎶ヨ〃
+        [Route("ProdProcessEntryReport/ProdProcessEntryReport_DyeColor")]
+        [HttpGet]
+        public object ProdProcessEntryReport_DyeColor(string sWhere,string sProcessNo)
+        {
+            try
+            {
+                //鍙嶅簭鍒楀寲浼犻�掔殑鍊�
+                MaterOutSumReport com = JsonConvert.DeserializeObject<MaterOutSumReport>(sWhere.ToString());
+
+                string sql = "" +
+                    "( (宸ヨ壓鍗曟棩鏈� between ''" + com.HBeginDate + "'' and ''" + com.HEndDate + "'') or (''" + com.HBeginDate + "'' = '''' and ''" + com.HEndDate + "''='''') ) " +
+                    "and (浜у搧浠g爜=''" + com.HMaterNumber + "'' or ''" + com.HMaterNumber + "''='''') " +
+                    "and (鐢熶骇璁㈠崟鍙�=''" + com.HBillNo + "'' or ''" + com.HBillNo + "''='''') " +
+                    "and (浜у搧鍚嶇О=''" + com.HProductName + "'' or ''" + com.HProductName + "''='''') " +
+                    "and (浜у搧瑙勬牸=''" + com.HProductModel + "'' or ''" + com.HProductModel + "''='''') " +
+                    "and (娴佽浆鍗″彿=''" + sProcessNo + "'' or ''"+ sProcessNo + "''= '''')" + com.RandomSearch;
+
+                ds = oCN.RunProcReturn($"exec h_p_Kf_ProdProcessEntryReport_DyeColor '{sql}'", "h_p_Kf_ProdProcessEntryReport_DyeColor");
+
+                //鑾峰彇鍒楀悕
+                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));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                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
+
+
+
+
+        #endregion
+
+
         #endregion
 
     }

--
Gitblit v1.9.1