From 8c7ac11905cc442d9cf8920de01dc5ef29179987 Mon Sep 17 00:00:00 2001 From: cnf <3200815559@qq.com> Date: 星期一, 01 九月 2025 17:48:50 +0800 Subject: [PATCH] 工单撤回报工条码选择 --- DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Staff.cs | 93 +++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 82 insertions(+), 11 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Staff.cs b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Staff.cs index 3852e31..5922664 100644 --- a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Staff.cs +++ b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Staff.cs @@ -1,8 +1,10 @@ -锘縰sing DevExpress.XtraEditors; +锘縰sing DevExpress.DataAccess.Native.Json; +using DevExpress.XtraEditors; using Gs.DevApp.Entity; using Gs.DevApp.ToolBox; using Gs.DevApp.UserControl; using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; @@ -147,6 +149,42 @@ } } + //private void getModel(string strGuid) + //{ + // bool isEdit = false; + // if (toolBarMenu1.currentAction == "add") return; + // if (toolBarMenu1.currentAction == "edit") isEdit = true; + // if (string.IsNullOrEmpty(strGuid)) + // { + // MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + // return; + // } + // var _obj = new + // { + // guid = strGuid //涓诲缓 + // }; + // try + // { + // var strJson = UtilityHelper.HttpPost("", + // _webServiceName + "GetModel", + // JsonConvert.SerializeObject(_obj)); + // var _rtn = UtilityHelper.ReturnToDynamic(strJson); + // if (_rtn.rtnCode > 0) + // { + // var dy = _rtn.rtnData; + // lbGuid.Text = strGuid; + // UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit); + // } + // else + // { + // MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + // } + // } + // catch (Exception ex) + // { + // MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + // } + //} private void getModel(string strGuid) { bool isEdit = false; @@ -154,34 +192,67 @@ if (toolBarMenu1.currentAction == "edit") isEdit = true; if (string.IsNullOrEmpty(strGuid)) { - MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } + + // 鏋勯�犺姹傚弬鏁板璞� var _obj = new { - guid = strGuid //涓诲缓 + guid = strGuid, // 涓婚敭 }; + try { - var strJson = UtilityHelper.HttpPost("", - _webServiceName + "GetModel", - JsonConvert.SerializeObject(_obj)); - var _rtn = UtilityHelper.ReturnToDynamic(strJson); + // 鍙戦�丠TTP璇锋眰鑾峰彇鏁版嵁 + string strJson = UtilityHelper.HttpPost("", _webServiceName + "GetModel", JsonConvert.SerializeObject(_obj)); + ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); + if (_rtn.rtnCode > 0) { - var dy = _rtn.rtnData; + dynamic dy = _rtn.rtnData; lbGuid.Text = strGuid; - UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit); + + // 缁戝畾涓昏〃鏁版嵁鍒扮晫闈㈡帶浠� + List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); + + gvList.Add(gvMx1); + UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList); + + // ================== 绗竴涓槑缁嗚〃锛坙ist锛夊鐞嗛�昏緫 ================== + // 鏄惧紡鎸囧畾Newtonsoft.Json.Linq.JObject + Newtonsoft.Json.Linq.JObject _job = Newtonsoft.Json.Linq.JObject.Parse(strJson); + Newtonsoft.Json.Linq.JArray array = new Newtonsoft.Json.Linq.JArray(); + foreach (var a in _job["rtnData"]["list"]) + { + array.Add(a); + } + DataTable dt = JsonConvert.DeserializeObject<DataTable>(array.ToString()); + + if (dt.Rows.Count > 0) + { + gcMx1.BindingContext = new BindingContext(); + gcMx1.DataSource = dt; + gcMx1.ForceInitialize(); + gvMx1.BestFitColumns(); + Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1); + } + else + { + Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); + } + } else { - MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); } } catch (Exception ex) { - MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } } + } } \ No newline at end of file -- Gitblit v1.9.3