From e95704c98f6683e8368831ea6a79344eae65418d Mon Sep 17 00:00:00 2001
From: cnf <3283105747@qq.com>
Date: 星期五, 12 十二月 2025 15:44:04 +0800
Subject: [PATCH] 退料申请显示优化
---
DevApp/Gs.DevApp/DevFrm/Ck/UcBlclSelect.cs | 195 ++----------------------------------------------
1 files changed, 11 insertions(+), 184 deletions(-)
diff --git a/DevApp/Gs.DevApp/DevFrm/Ck/UcBlclSelect.cs b/DevApp/Gs.DevApp/DevFrm/Ck/UcBlclSelect.cs
index 4be43bc..48e5863 100644
--- a/DevApp/Gs.DevApp/DevFrm/Ck/UcBlclSelect.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Ck/UcBlclSelect.cs
@@ -12,59 +12,24 @@
private readonly string _webServiceName = "WomdaaManager/";
private string daaId = "";
private string orgId = "";
-
/// <summary>
- /// 鏋勯�犲嚱鏁�
+ ///
/// </summary>
/// <param name="_daaGuid">daaGuid</param>
/// <param name="_orgId">鐢熶骇缁勭粐</param>
public UcBlclSelect(string _daaGuid, string _orgId)
{
InitializeComponent();
- InitializeGridSettings();
- this.daaId = _daaGuid;
- this.orgId = _orgId;
- Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, null, "", null, null, false);
- getPageList(1);
- getPageListWithFilter(2); // 浣跨敤杩囨护鏂规硶
- SetupButtonClickEvent();
- }
-
- /// <summary>
- /// 閲嶈浇鏋勯�犲嚱鏁� - 绛涢�夋帀kbsl涓�0鐨勬暟鎹�
- /// </summary>
- /// <param name="_daaGuid">daaGuid</param>
- /// <param name="_orgId">鐢熶骇缁勭粐</param>
- /// <param name="_type">绫诲瀷鏍囪瘑</param>
- public UcBlclSelect(string _daaGuid, string _orgId, string _type)
- {
- InitializeComponent();
- InitializeGridSettings();
- this.daaId = _daaGuid;
- this.orgId = _orgId;
- Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, null, "", null, null, false);
- getPageListWithFilter(1); // 浣跨敤杩囨护鏂规硶
- SetupButtonClickEvent();
- }
-
- /// <summary>
- /// 鍒濆鍖栫綉鏍艰缃�
- /// </summary>
- private void InitializeGridSettings()
- {
this.gridView1.CustomDrawColumnHeader += (s, e) => { Gs.DevApp.ToolBox.UtilityHelper.CustomDrawColumnHeader(s, e); };
this.gridView1.MouseUp += (s, e) => { Gs.DevApp.ToolBox.UtilityHelper.CustomMouseUp(s, e, gcMain, gridView1); };
this.colChkInt.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False;
this.colChkInt.OptionsFilter.AllowAutoFilter = false;
this.colChkInt.OptionsFilter.AllowFilter = false;
this.colChkInt.OptionsFilter.AllowInHeaderSearch = DevExpress.Utils.DefaultBoolean.False;
- }
-
- /// <summary>
- /// 璁剧疆鎸夐挳鐐瑰嚮浜嬩欢
- /// </summary>
- private void SetupButtonClickEvent()
- {
+ this.daaId = _daaGuid;
+ this.orgId = _orgId;
+ Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, null, "", null, null, false);
+ getPageList(1);
btnIn.Click += (s, e) =>
{
gridView1.PostEditor();
@@ -75,7 +40,7 @@
foreach (DataRow dr in dt.Rows)
{
string checkBox = dr["chkInt"].ToString();
- string _guid = dr["dabGuid"].ToString();
+ string _guid = dr["guid"].ToString();
if (Gs.DevApp.ToolBox.UtilityHelper.ToCheck(checkBox))
{
list.Add(new
@@ -86,25 +51,23 @@
itemName = dr["itemName"].ToString(),
itemNo = dr["itemNo"].ToString(),
gdh = dr["gdh"].ToString(),
- kbsl = dr["kbsl"].ToString()
- });
+ });
}
}
}
- UpdateParent?.Invoke(this, new UpdateParentEventArgs { DynamicList = list });
- Close();
+ UpdateParent?.Invoke(this, new UpdateParentEventArgs { DynamicList = list }); Close();
};
}
/// <summary>
- /// 閫夋嫨鍚庣殑鍥炶皟浜嬩欢
+ /// 閫夋嫨鍚庣殑鍥炶皟浜嬩欢
/// </summary>
public event EventHandler<UpdateParentEventArgs> UpdateParent;
/// <summary>
- /// 鑾峰彇椤甸潰鏁版嵁锛堜笉杩囨护锛�
/// </summary>
/// <param name="curPage">绗嚑椤�</param>
+ /// <param name="pageSize">姣忛〉鍑犳潯</param>
private void getPageList(int curPage)
{
var _obj = new
@@ -125,148 +88,12 @@
gcMain.BindingContext = new BindingContext();
gcMain.DataSource = dt;
gcMain.ForceInitialize();
- gridView1.BestFitColumns();
- Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1);
+ gridView1.BestFitColumns(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1);
}
catch (Exception ex)
{
MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
}
}
-
- /// <summary>
- /// 鑾峰彇椤甸潰鏁版嵁骞剁瓫閫夋帀kbsl涓�0鐨勬暟鎹�
- /// </summary>
- /// <param name="curPage">绗嚑椤�</param>
- private void getPageListWithFilter(int curPage)
- {
- var _obj = new
- {
- currentPage = 1,
- everyPageSize = 999999,
- sortName = "",
- keyWhere = "",
- daaGuid = daaId
- };
- var json = JsonConvert.SerializeObject(_obj);
- try
- {
- var strReturn = UtilityHelper.HttpPost("",
- _webServiceName + "GetListSelectDab", json);
- var dd = UtilityHelper.ReturnToTablePage(strReturn);
- var dt = dd.rtnData.list;
-
- DataTable filteredDt = FilterZeroKbsl(dt);
-
- if (curPage == 1)
- {
- // 绛涢�夋帀kbsl涓�0鐨勬暟鎹�
- filteredDt = FilterZeroKbsl(dt);
- }
- else
- {
- // 杩囨护dab006锛堥渶棰嗙敤閲忥級灏忎簬绛変簬ylQty锛堝凡棰嗙敤閲忥級鐨勬暟鎹�
- filteredDt = FilterByDab006AndYlQty(dt);
- }
-
- gcMain.BindingContext = new BindingContext();
- gcMain.DataSource = filteredDt;
- gcMain.ForceInitialize();
- gridView1.BestFitColumns();
- Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1);
- }
- catch (Exception ex)
- {
- MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
- }
- }
-
- /// <summary>
- /// 绛涢�夋帀kbsl涓�0鐨勬暟鎹�
- /// </summary>
- /// <param name="sourceTable">婧愭暟鎹〃</param>
- /// <returns>杩囨护鍚庣殑鏁版嵁琛�</returns>
- private DataTable FilterZeroKbsl(DataTable sourceTable)
- {
- if (sourceTable == null || sourceTable.Rows.Count == 0)
- return sourceTable;
-
- // 鍒涘缓鏂扮殑DataTable鏉ュ瓨鍌ㄨ繃婊ゅ悗鐨勬暟鎹�
- DataTable filteredTable = sourceTable.Clone();
-
- foreach (DataRow row in sourceTable.Rows)
- {
- // 妫�鏌bsl鍒楁槸鍚﹀瓨鍦ㄤ笖涓嶄负0
- if (sourceTable.Columns.Contains("kbsl"))
- {
- object kbslValue = row["kbsl"];
- decimal kbsl = 0;
-
- // 灏濊瘯杞崲涓篸ecimal
- if (kbslValue != null && kbslValue != DBNull.Value &&
- decimal.TryParse(kbslValue.ToString(), out kbsl))
- {
- if (kbsl > 0) // 鍙繚鐣檏bsl澶т簬0鐨勮
- {
- filteredTable.ImportRow(row);
- }
- }
- }
- else
- {
- // 濡傛灉娌℃湁kbsl鍒楋紝淇濈暀鎵�鏈夎
- filteredTable.ImportRow(row);
- }
- }
-
- return filteredTable;
- }
-
- /// <summary>
- /// 杩囨护dab006锛堥渶棰嗙敤閲忥級灏忎簬绛変簬ylQty锛堝凡棰嗙敤閲忥級鐨勬暟鎹�
- /// </summary>
- /// <param name="sourceTable">婧愭暟鎹〃</param>
- /// <returns>杩囨护鍚庣殑鏁版嵁琛�</returns>
- private DataTable FilterByDab006AndYlQty(DataTable sourceTable)
- {
- if (sourceTable == null || sourceTable.Rows.Count == 0)
- return sourceTable;
-
- // 鍒涘缓鏂扮殑DataTable鏉ュ瓨鍌ㄨ繃婊ゅ悗鐨勬暟鎹�
- DataTable filteredTable = sourceTable.Clone();
-
- foreach (DataRow row in sourceTable.Rows)
- {
- // 妫�鏌ab006鍜寉lQty鍒楁槸鍚﹀瓨鍦�
- if (sourceTable.Columns.Contains("dab006") && sourceTable.Columns.Contains("ylQty"))
- {
- object dab006Value = row["dab006"];
- object ylQtyValue = row["ylQty"];
-
- decimal dab006 = 0;
- decimal ylQty = 0;
-
- // 灏濊瘯杞崲涓篸ecimal
- bool dab006Valid = dab006Value != null && dab006Value != DBNull.Value &&
- decimal.TryParse(dab006Value.ToString(), out dab006);
- bool ylQtyValid = ylQtyValue != null && ylQtyValue != DBNull.Value &&
- decimal.TryParse(ylQtyValue.ToString(), out ylQty);
-
- // 杩囨护鏉′欢锛歞ab006 >= ylQty
- if (dab006Valid && ylQtyValid && dab006 <= ylQty)
- {
- filteredTable.ImportRow(row);
- }
- }
- else
- {
- // 濡傛灉娌℃湁杩欎袱涓垪锛屼繚鐣欐墍鏈夎
- filteredTable.ImportRow(row);
- }
- }
-
- return filteredTable;
- }
-
}
}
\ No newline at end of file
--
Gitblit v1.9.3