| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Drawing; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | |
| | |
| | | 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); |
| | |
| | | txt_iCount_2.Text = ""; |
| | | txt_psnQty_2.Text = ""; |
| | | }; |
| | | |
| | | // gvMx3 批量打印事件 |
| | | this.ucBtnPrint2.btnAllClick += (s, e) => |
| | | { |
| | | // string rowGuid = lbMxGuid3.Text.Trim(); // 使用gvMx3的GUID |
| | | string rowGuid = txt_releaseNo.Text.Trim(); |
| | | SelectDeleteBar frm = new SelectDeleteBar(rowGuid, "采购入库"); // 标题区分来源 |
| | | SelectDeleteBar frm = new SelectDeleteBar(rowGuid, "到货条码(合并)码"); // 标题区分来源 |
| | | string strCodeList = ""; |
| | | frm.UpdateParent += (ss, ee) => |
| | | { |
| | |
| | | MsgHelper.ShowError(ex.Message); |
| | | } |
| | | }; |
| | | |
| | | //明细行切换事件 |
| | | // 关键:绑定gvMx1和gvMx3的焦点行变化事件 |
| | | gvMx1.FocusedRowChanged += GvMx1_FocusedRowChanged; |
| | |
| | | { |
| | | Gs.DevApp.ToolBox.UtilityHelper.PrintAuto(txt_psnQty_1, txt_iCount_1, radOut, txt_yuliang_1); |
| | | }; |
| | | |
| | | // gvMx3的自动计算 |
| | | txt_psnQty_2.TextChanged += (s, e) => |
| | | { |
| | |
| | | { |
| | | 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) |
| | | { |
| | |
| | | gvList.Add(gvMx2); |
| | | gvList.Add(gvMx3); |
| | | UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList); |
| | | |
| | | JArray array1 = new JArray(); |
| | | foreach (var a in dy["list1"]) |
| | | { |
| | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |