From c884c789edec46084c81ee500a404da2f0685e7d Mon Sep 17 00:00:00 2001 From: cnf <3200815559@qq.com> Date: 星期三, 27 八月 2025 14:18:13 +0800 Subject: [PATCH] 生产部分优化 --- DevApp/Gs.DevApp/UserControl/SelectCgMx.cs | 134 ++++++++++++++++++++++++++++++++++++++------ 1 files changed, 116 insertions(+), 18 deletions(-) diff --git a/DevApp/Gs.DevApp/UserControl/SelectCgMx.cs b/DevApp/Gs.DevApp/UserControl/SelectCgMx.cs index 72d4ae2..d965a56 100644 --- a/DevApp/Gs.DevApp/UserControl/SelectCgMx.cs +++ b/DevApp/Gs.DevApp/UserControl/SelectCgMx.cs @@ -1,4 +1,6 @@ -锘縰sing DevExpress.XtraEditors; +锘縰sing DevExpress.Data; +using DevExpress.XtraEditors; +using DevExpress.XtraGrid.Views.Grid; using Gs.DevApp.ToolBox; using Newtonsoft.Json; using System; @@ -8,36 +10,112 @@ namespace Gs.DevApp.UserControl { + // 缁ф壙鑷猉traForm锛岃繖鏄疍evExpress鎻愪緵鐨勫寮哄瀷琛ㄥ崟鎺т欢 public partial class SelectCgMx : XtraForm { - + // Web鏈嶅姟鍚嶇О甯搁噺锛岀敤浜庤皟鐢ㄥ悗绔帴鍙� private readonly string _webServiceName = "MesInvItemArnManager/"; + // 渚涘簲鍟咺D鍜屾敹鏂欑粍缁嘔D鐨勭鏈夊彉閲� private string suppId = ""; private string receiveOrgId = ""; + /// <summary> - /// + /// 鏋勯�犲嚱鏁� /// </summary> - /// <param name="_suppId">渚涘簲鍟�</param> - /// <param name="_receiveOrgId">鏀舵枡缁勭粐</param> - /// <param name="_isWw">鏄惁濮斿</param> + /// <param name="_suppId">渚涘簲鍟咺D鍙傛暟</param> + /// <param name="_receiveOrgId">鏀舵枡缁勭粐ID鍙傛暟</param> public SelectCgMx(string _suppId, string _receiveOrgId) { + // 鍒濆鍖栬〃鍗曟帶浠� InitializeComponent(); + + /* #region 鑷姩姹囨�籦eg + gridView1.Columns["purchaseQty"].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Custom; + gridView1.Columns["yssl"].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Custom; + gridView1.Columns["wssl"].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Custom; + + gridView1.CustomSummaryCalculate += (sender, e) => + { + GridView view = sender as GridView; + if (e.SummaryProcess == CustomSummaryProcess.Start) + { + // 鍒濆鍖栨眹鎬诲�� + e.TotalValue = 0m; + } + else if (e.SummaryProcess == CustomSummaryProcess.Calculate) + { + // 妫�鏌ュ綋鍓嶈鐨凷tatus瀛楁鏄惁涓�1 + int status = Convert.ToInt32(view.GetListSourceRowCellValue(e.RowHandle, "chkInt")); + if (status == 1) + { + string _colCaption = e.Item.ToString(); + if (_colCaption.Contains("閲囪喘")) + { + decimal amount = Convert.ToDecimal(view.GetListSourceRowCellValue(e.RowHandle, "purchaseQty")); + e.TotalValue = Convert.ToDecimal(e.TotalValue) + amount; + } + else if (_colCaption.Contains("宸叉敹")) + { + decimal amount2 = Convert.ToDecimal(view.GetListSourceRowCellValue(e.RowHandle, "yssl")); + e.TotalValue = Convert.ToDecimal(e.TotalValue) + amount2; + } + else if (_colCaption.Contains("鏈敹")) + { + decimal amount3 = Convert.ToDecimal(view.GetListSourceRowCellValue(e.RowHandle, "wssl")); + e.TotalValue = Convert.ToDecimal(e.TotalValue) + amount3; + } + } + } + else if (e.SummaryProcess == CustomSummaryProcess.Finalize) + { + // 璁剧疆鏈�缁堟眹鎬诲�� + e.TotalValue = e.TotalValue; + } + }; + + // 娣诲姞澶嶉�夋鍙樺寲浜嬩欢锛屽疄鏃舵洿鏂版眹鎬� + gridView1.CellValueChanged += (s, e) => + { + if (e.Column.FieldName == "chkInt") + { + // 澶嶉�夋鍊煎彉鍖栨椂寮哄埗鍒锋柊姹囨�� + gridView1.UpdateSummary(); + } + }; + #endregion + */ + + // 涓篏ridView鐨勫垪鏍囬缁樺埗浜嬩欢娣诲姞澶勭悊鏂规硶锛屼娇鐢ㄨ嚜瀹氫箟缁樺埗 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; + + // 璁剧疆鍗曢�夋寜閽粍榛樿閫変腑绗竴椤癸紙閲囪喘绫诲瀷锛� radioGroup1.SelectedIndex = 0; + + // 淇濆瓨浼犲叆鐨勪緵搴斿晢ID鍜屾敹鏂欑粍缁嘔D this.suppId = _suppId; this.receiveOrgId = _receiveOrgId; + + // 璁剧疆GridView鐨勫弬鏁伴厤缃� Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, null, "", null, null, false); + + // 鍔犺浇绗竴椤垫暟鎹� getPageList(1); + + // 涓�"纭畾"鎸夐挳娣诲姞鐐瑰嚮浜嬩欢澶勭悊 btnIn.Click += (s, e) => { + // 鎻愪氦缂栬緫骞舵洿鏂板綋鍓嶈鏁版嵁 gridView1.PostEditor(); gridView1.UpdateCurrentRow(); + + // 鏀堕泦閫変腑琛岀殑GUID var list = new List<string>(); DataTable dt = this.gcMain.DataSource as DataTable; { @@ -45,55 +123,75 @@ { string checkBox = dr["chkInt"].ToString(); string _guid = dr["guid"].ToString(); + // 妫�鏌ユ槸鍚﹂�変腑 if (Gs.DevApp.ToolBox.UtilityHelper.ToCheck(checkBox)) { list.Add(_guid); } } } - UpdateParent?.Invoke(this, new UpdateParentEventArgs { StringList = list }); Close(); + + // 瑙﹀彂鍥炶皟浜嬩欢锛屼紶閫掗�変腑鐨凣UID鍒楄〃锛岀劧鍚庡叧闂〃鍗� + UpdateParent?.Invoke(this, new UpdateParentEventArgs { StringList = list }); + Close(); }; + + // 涓哄崟閫夋寜閽粍娣诲姞閫変腑椤瑰彉鍖栦簨浠讹紝鍒囨崲鏃堕噸鏂板姞杞芥暟鎹� radioGroup1.SelectedIndexChanged += (s, e) => { getPageList(1); }; + } /// <summary> - /// 閫夋嫨鍚庣殑鍥炶皟浜嬩欢 + /// 閫夋嫨鍚庣殑鍥炶皟浜嬩欢锛岀敤浜庡悜鐖剁獥浣撲紶閫掗�変腑鐨勬暟鎹� /// </summary> public event EventHandler<UpdateParentEventArgs> UpdateParent; /// <summary> + /// 浠庢湇鍔″櫒鑾峰彇鍒嗛〉鏁版嵁骞剁粦瀹氬埌GridView /// </summary> - /// <param name="curPage">绗嚑椤�</param> - /// <param name="pageSize">姣忛〉鍑犳潯</param> + /// <param name="curPage">褰撳墠椤电爜</param> private void getPageList(int curPage) { + // 鍒涘缓璇锋眰鍙傛暟瀵硅薄 var _obj = new { - currentPage = curPage, - everyPageSize = 999999, - sortName = "", - keyWhere = "", - inBusType = (radioGroup1.SelectedIndex + 1),//1鏄噰璐紝2鏄澶� - inSupId = this.suppId, - inReceiveOrgId = this.receiveOrgId, + currentPage = curPage, // 褰撳墠椤电爜 + everyPageSize = 999999, // 姣忛〉璁板綍鏁�(杩欓噷璁剧疆浜嗕竴涓緢澶х殑鍊硷紝鍙兘鏄负浜嗚幏鍙栨墍鏈夋暟鎹�) + sortName = "", // 鎺掑簭瀛楁 + keyWhere = "", // 鏌ヨ鏉′欢 + inBusType = (radioGroup1.SelectedIndex + 1), // 涓氬姟绫诲瀷锛�1鏄噰璐紝2鏄澶� + inSupId = this.suppId, // 渚涘簲鍟咺D + inReceiveOrgId = this.receiveOrgId, // 鏀舵枡缁勭粐ID }; + + // 灏嗗弬鏁板璞″簭鍒楀寲涓篔SON瀛楃涓� var json = JsonConvert.SerializeObject(_obj); + try { + // 璋冪敤Web鏈嶅姟鑾峰彇鏁版嵁 var strReturn = UtilityHelper.HttpPost("", _webServiceName + "SelectForm", json); + + // 瑙f瀽杩斿洖缁撴灉涓篋ataTable var dd = UtilityHelper.ReturnToTablePage(strReturn); var dt = dd.rtnData.list; + + // 缁戝畾鏁版嵁鍒癎ridControl 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); } } -- Gitblit v1.9.3