From 680b605296b299a426438579b8a271882521dc8a Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期一, 22 五月 2023 11:26:35 +0800
Subject: [PATCH] 1
---
WebAPI/Controllers/MateOutController.cs | 66 ++++++++++++++++++++++++++-------
1 files changed, 52 insertions(+), 14 deletions(-)
diff --git a/WebAPI/Controllers/MateOutController.cs b/WebAPI/Controllers/MateOutController.cs
index 7b48ecc..1c97cba 100644
--- a/WebAPI/Controllers/MateOutController.cs
+++ b/WebAPI/Controllers/MateOutController.cs
@@ -1320,7 +1320,7 @@
- //#region 鐧藉澂鍙戝竷姹囨�绘姤琛�
+ #region 鐧藉澂鍙戝竷姹囨�绘姤琛�
public DBUtility.ClsPub.Enum_BillStatus BillStatus;
//private json objJsonResult = new json();
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
@@ -1334,29 +1334,47 @@
public string HBillNo;
public string HProductName;
public string HProductModel;
+ public string RandomSearch;
}
- //鐧藉澂鍙戝竷姹囨�绘姤琛�
+ #region 鐧藉澂鍙戝竷姹囨�绘姤琛�
[Route("MaterOutSumReport/MaterOutSumReport_Cloth")]
[HttpGet]
public object MaterOutSumReport_Cloth(string sWhere)
{
- int i = 0;
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");
+ 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.HBillNo + "''='''') " +
+ "and (瑙勬牸鍨嬪彿=''" + com.HProductModel + "'' or ''" + com.HProductModel + "''='''') " + com.RandomSearch;
+
+ 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鍒楀璞$殑鍒楀悕
}
@@ -1376,29 +1394,48 @@
return objJsonResult;
}
}
+ #endregion
-
- //鐧藉澂鍙戝竷鏄庣粏鎶ヨ〃
+ #region 鐧藉澂鍙戝竷鏄庣粏鎶ヨ〃
[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");
+ 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.HBillNo + "''='''') " +
+ "and (瑙勬牸鍨嬪彿=''" + com.HProductModel + "'' or ''" + com.HProductModel + "''='''') " + com.RandomSearch;
+
+ ds = oCN.RunProcReturn($"exec h_p_Kf_MaterOutEntryReport_Cloth_New '{sql}'", "h_p_Kf_MaterOutEntryReport_Cloth_New");
+
+ DataTable dt = ds.Tables[0];
//鑾峰彇鍒楀悕
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鍒楀璞$殑鍒楀悕
}
@@ -1406,7 +1443,7 @@
objJsonResult.count = 1;
objJsonResult.Message = "Sucess锛�";
objJsonResult.list = columnNameList;
- objJsonResult.data = ds.Tables[0];
+ objJsonResult.data = dt;
return objJsonResult;
}
catch (Exception e)
@@ -1418,9 +1455,10 @@
return objJsonResult;
}
}
+ #endregion
- //#endregion
+ #endregion
}
}
\ No newline at end of file
--
Gitblit v1.9.1