From 98ab093f1f35f9130e586d81540060b286e45e8e Mon Sep 17 00:00:00 2001 From: cnf <3200815559@qq.com> Date: 星期日, 24 八月 2025 14:14:32 +0800 Subject: [PATCH] 通用控件采购明细修改 --- DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_ArrivalBarcode.cs | 143 ++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 138 insertions(+), 5 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_ArrivalBarcode.cs b/DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_ArrivalBarcode.cs index 42f1abe..8d614d7 100644 --- a/DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_ArrivalBarcode.cs +++ b/DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_ArrivalBarcode.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; using System.Data; +using System.Drawing; using System.Threading.Tasks; using System.Windows.Forms; @@ -28,7 +29,9 @@ Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, "", "", (value) => { Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0); - }, tips); + }, tips, true, (strGuid) => { + getModelList(strGuid); + }); Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) => { getModel(value); @@ -150,7 +153,6 @@ txt_iCount_2.Text = ""; txt_psnQty_2.Text = ""; }; - // gvMx3 鎵归噺鎵撳嵃浜嬩欢 this.ucBtnPrint2.btnAllClick += (s, e) => { @@ -186,7 +188,6 @@ MsgHelper.ShowError(ex.Message); } }; - //鏄庣粏琛屽垏鎹簨浠� // 鍏抽敭锛氱粦瀹歡vMx1鍜実vMx3鐨勭劍鐐硅鍙樺寲浜嬩欢 gvMx1.FocusedRowChanged += GvMx1_FocusedRowChanged; @@ -200,7 +201,6 @@ { Gs.DevApp.ToolBox.UtilityHelper.PrintAuto(txt_psnQty_1, txt_iCount_1, radOut, txt_yuliang_1); }; - // gvMx3鐨勮嚜鍔ㄨ绠� txt_psnQty_2.TextChanged += (s, e) => { @@ -210,6 +210,52 @@ { Gs.DevApp.ToolBox.UtilityHelper.PrintAuto(txt_psnQty_2, txt_iCount_2, radOut2, txt_yuliang_2); }; + + + ////搴曢儴姹囨�诲惎鐢� + //gvMx1.OptionsView.ShowFooter = true; + //// 涓烘煇涓�鍒楄缃眰鍜屾眹鎬� + //gvMx1.Columns["quantity"].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum; + //gvMx1.Columns["quantity"].SummaryItem.DisplayFormat = "鍚堣: {0}"; + + // 涓轰簡鏂逛究浣跨敤鏁村悎鍒� UtilityHelper 绫讳腑鐨� SetupGridSummary 鏂规硶 + UtilityHelper.SetupGridSummary(gvMx1, "quantity", "okRkqty"); + UtilityHelper.SetupGridSummary(gvMxL1, "quantity", "okRkqty"); + + // 妫�鏌ユ暟鎹姞杞藉悗鍐嶈缃鑹� + this.Load += (s, e) => { + System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer(); + timer.Interval = 1000; // 1绉掑悗鎵ц锛岀‘淇濇暟鎹凡鍔犺浇 + timer.Tick += (sender, args) => { + timer.Stop(); + timer.Dispose(); + + // 浣跨敤鏂扮殑绠�鍖栨牸寮忚缃楠岀粨鏋滈鑹� + UtilityHelper.SetSimpleGridColor(gvMxL1, "jyjg", "contains涓嶅悎鏍�", "Cell", Color.Red); + UtilityHelper.SetSimpleGridColor(gvMxL1, "jyjg", "contains鍚堟牸", "Cell", Color.Green); + UtilityHelper.SetSimpleGridColor(gvMxL1, "jyjg", "contains鍏嶆", "Cell", Color.Green); + + UtilityHelper.SetSimpleGridColor(gvMxL2, "jyjg", "contains涓嶅悎鏍�", "Cell", Color.Red); + UtilityHelper.SetSimpleGridColor(gvMxL2, "jyjg", "contains鍚堟牸", "Cell", Color.Green); + UtilityHelper.SetSimpleGridColor(gvMxL2, "jyjg", "contains鍏嶆", "Cell", Color.Green); + + UtilityHelper.SetSimpleGridColor(gvMx1, "jyjg", "contains涓嶅悎鏍�", "Cell", Color.Red); + UtilityHelper.SetSimpleGridColor(gvMx1, "jyjg", "contains鍚堟牸", "Cell", Color.Green); + UtilityHelper.SetSimpleGridColor(gvMx1, "jyjg", "contains鍏嶆", "Cell", Color.Green); + + UtilityHelper.SetSimpleGridColor(gvMx3, "jyjg", "contains涓嶅悎鏍�", "Cell", Color.Red); + UtilityHelper.SetSimpleGridColor(gvMx3, "jyjg", "contains鍚堟牸", "Cell", Color.Green); + UtilityHelper.SetSimpleGridColor(gvMx3, "jyjg", "contains鍏嶆", "Cell", Color.Green); + + // 瀛楁杩愮畻绀轰緥锛氬綋鏀惰揣鏁伴噺(quantity)澶т簬宸插叆搴撴暟閲�(okRkqty)鏃讹紝鏁磋鏄剧ず姗欒壊 + UtilityHelper.SetSimpleGridColor(gvMx1, "", "quantity-okRkqty>0", "Row", Color.Orange); + + // 瀛楁杩愮畻绀轰緥锛氬綋鍙墦鍗版暟閲�(kQty)灏忎簬绛変簬0鏃讹紝鏁磋鏄剧ず鐏拌壊 + UtilityHelper.SetSimpleGridColor(gvMx1, "", "kQty<=0", "Row", Color.Gray); + }; + timer.Start(); + }; + } private void GridView1_ColumnFilterChanged(object sender, EventArgs e) { @@ -411,6 +457,7 @@ gvList.Add(gvMx2); gvList.Add(gvMx3); UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList); + JArray array1 = new JArray(); foreach (var a in dy["list1"]) { @@ -475,6 +522,92 @@ ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } } - + /// <summary> + /// 鏂板鏂规硶锛氬垪琛ㄦ樉绀� + /// </summary> + /// <param name="strGuid">涓昏〃id</param> + + private void getModelList(string strGuid) + { + gcMxL1.DataSource = null; + gcMxL2.DataSource = null; + gcMxL3.DataSource = null; + var _obj = new + { + guid = strGuid,//涓诲缓 + }; + try + { + string strJson = UtilityHelper.HttpPost("", _webServiceName + "GetModel", JsonConvert.SerializeObject(_obj)); + ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); + if (_rtn.rtnCode > 0) + { + dynamic dy = _rtn.rtnData; + + JArray array1 = new JArray(); + foreach (var a in dy["list1"]) + { + array1.Add(a); + } + DataTable dt1 = JsonConvert.DeserializeObject<DataTable>(array1.ToString()); + if (dt1.Rows.Count > 0) + { + gcMxL1.BindingContext = new BindingContext(); + gcMxL1.DataSource = dt1; + gcMxL1.ForceInitialize(); + gvMxL1.BestFitColumns(); + Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMxL1); + } + else + { + Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMxL1, gvMxL1); + } + JArray array2 = new JArray(); + foreach (var a in dy["list3"]) + { + array2.Add(a); + } + + DataTable dt2 = JsonConvert.DeserializeObject<DataTable>(array2.ToString()); + if (dt2.Rows.Count > 0) + { + gcMxL2.BindingContext = new BindingContext(); + gcMxL2.DataSource = dt2; + gcMxL2.ForceInitialize(); + gvMxL2.BestFitColumns(); + Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMxL2); + } + else + { + Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMxL2, gvMxL2); + } + JArray array3 = new JArray(); + foreach (var a in dy["list2"]) + { + array3.Add(a); + } + DataTable dt3 = JsonConvert.DeserializeObject<DataTable>(array3.ToString()); + if (dt3.Rows.Count > 0) + { + gcMxL3.BindingContext = new BindingContext(); + gcMxL3.DataSource = dt3; + gcMxL3.ForceInitialize(); + gvMxL3.BestFitColumns(); + Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMxL3); + } + else + { + Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMxL3, gvMxL3); + } + } + else + ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + } + catch (Exception ex) + { + ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } + } + } } \ No newline at end of file -- Gitblit v1.9.3