From abac1dadf2ba8674a24bb0b91c75de5c7881df72 Mon Sep 17 00:00:00 2001 From: 啊鑫 <t2856754968@163.com> Date: 星期二, 09 九月 2025 15:35:41 +0800 Subject: [PATCH] 同步为祈禧的代码 --- DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesDepot.cs | 212 +++++----------------------------------------------- 1 files changed, 22 insertions(+), 190 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesDepot.cs b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesDepot.cs index fc66fbc..3700bab 100644 --- a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesDepot.cs +++ b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesDepot.cs @@ -1,7 +1,6 @@ using DevExpress.XtraEditors; using DevExpress.XtraEditors.Controls; using DevExpress.XtraGrid.Views.Grid; -using Gs.DevApp.DevFrm.Rpt; using Gs.DevApp.Entity; using Gs.DevApp.ToolBox; using Gs.DevApp.UserControl; @@ -21,73 +20,6 @@ private List<FilterEntity> _filterList = new List<FilterEntity>(); private readonly string _webServiceName = "MesDepotsManager/"; - private DevExpress.XtraEditors.ComboBoxEdit txt_DepotModel; - private string _kwModel; - - /* public Frm_MesDepot() - { - InitializeComponent(); - toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick; - toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick; - toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick; - toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick; - toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; - this.toolBarMenu1.getXmlConfig(); - Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1); - Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, null, "", (value) => - { - Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0); - }, tips); - Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) => - { - getModel(value); - }, (value) => - { - getPageList(this.pageBar1.CurrentPage); - }, lbGuid); - getPageList(1); - pageBar1.PagerEvent += PageBar1_PagerEvent; - - //鎵撳嵃鎵归噺鎿嶄綔浜嬩欢 - this.ucBtnPrint1.btnAllClick += (s, e) => - { - string rowGuid = lbGuid.Text.Trim(); - SelectDeleteBar frm = new SelectDeleteBar(rowGuid, "浠撲綅鐮�"); - string strCodeList = ""; - frm.UpdateParent += (ss, ee) => - { - strCodeList = ee.StringSingle; - }; - frm.ShowDialog(); - if (string.IsNullOrEmpty(strCodeList)) - return; - try - { - string rptParameter = "rpt_KW1{" - + "100"//閲嶆墦閮芥槸浼�100锛� - + "," + "" - + "," + "" - + "," + "" - + "," + "" - + "," + strCodeList - + "}"; - using (Form rpt = new RptPreview(rowGuid, rptParameter)) - { - rpt.ShowDialog(); - } - frm.Close(); - } - catch (Exception ex) - { - MsgHelper.ShowError(ex.Message); - } - }; - this.ucBtnPrint1.SetPrintButton(false); - - } - */ - - /*******搴撲綅鏉$爜妯℃澘鍒囨崲*****/ public Frm_MesDepot() { InitializeComponent(); @@ -99,9 +31,9 @@ this.toolBarMenu1.getXmlConfig(); Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1); Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, null, "", (value) => - { - Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0); - }, tips); + { + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0); + }, tips); Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) => { getModel(value); @@ -111,110 +43,6 @@ }, lbGuid); getPageList(1); pageBar1.PagerEvent += PageBar1_PagerEvent; - - // 鍒濆鍖杢xt_DepotModel鎺т欢 - InitDepotModelControl(); - - //鎵撳嵃鎵归噺鎿嶄綔浜嬩欢 - this.ucBtnPrint1.btnAllClick += (s, e) => - { - string rowGuid = lbGuid.Text.Trim(); - SelectDeleteBar frm = new SelectDeleteBar(rowGuid, "浠撲綅鐮�"); - string strCodeList = ""; - frm.UpdateParent += (ss, ee) => - { - strCodeList = ee.StringSingle; - }; - frm.ShowDialog(); - if (string.IsNullOrEmpty(strCodeList)) - return; - - try - { - // 鏍规嵁閫夋嫨鐨勫�艰缃姤琛ㄦā鍨� - SetKwModelBySelectedValue(); - - // 楠岃瘉妯″瀷鏄惁鏈夋晥 - if (string.IsNullOrEmpty(_kwModel)) - { - MsgHelper.Warning("璇烽�夋嫨鏈夋晥鐨勫簱浣嶆ā鍨嬬被鍨�"); - return; - } - - // 浣跨敤鍔ㄦ�佹ā鍨嬪悕绉版瀯寤哄弬鏁� - string rptParameter = $"{_kwModel}{{" - + "100" // 閲嶆墦閮芥槸浼�100 - + "," + "" - + "," + "" - + "," + "" - + "," + "" - + "," + strCodeList - + "}"; - - using (Form rpt = new RptPreview(rowGuid, rptParameter)) - { - rpt.ShowDialog(); - } - frm.Close(); - } - catch (Exception ex) - { - MsgHelper.ShowError(ex.Message); - } - }; - this.ucBtnPrint1.SetPrintButton(false); - } - - /// <summary> - /// 鍒濆鍖杢xt_DepotModel鎺т欢锛堟煡鎵惧苟璧嬪�硷級 - /// </summary> - private void InitDepotModelControl() - { - // 閫掑綊鏌ユ壘绐椾綋涓墍鏈夋帶浠讹紙鍖呮嫭瀛愬鍣級 - Control[] foundControls = this.Controls.Find("txt_DepotModel", true); - if (foundControls != null && foundControls.Length > 0 && foundControls[0] is DevExpress.XtraEditors.ComboBoxEdit) - { - txt_DepotModel = (DevExpress.XtraEditors.ComboBoxEdit)foundControls[0]; - } - else - { - System.Diagnostics.Debug.WriteLine("璀﹀憡锛氭湭鎵惧埌txt_DepotModel鎺т欢锛岃妫�鏌ユ帶浠禢ame鏄惁姝g‘"); - } - } - - /// <summary> - /// 鏍规嵁txt_DepotModel閫夋嫨鐨勫�艰缃甠kwModel - /// </summary> - private void SetKwModelBySelectedValue() - { - // 閲嶇疆妯″瀷鍊� - _kwModel = string.Empty; - - // 妫�鏌ユ帶浠舵槸鍚﹀瓨鍦� - if (txt_DepotModel == null) - { - MsgHelper.ShowError("鏈壘鍒板簱浣嶆ā鍨嬮�夋嫨鎺т欢"); - return; - } - - // 鑾峰彇閫夋嫨鐨勫�� - string selectedValue = txt_DepotModel.EditValue?.ToString().Trim() ?? string.Empty; - string selectedText = txt_DepotModel.Text?.Trim() ?? string.Empty; - - // 鍒ゆ柇閫夋嫨鐨勫�煎苟璁剧疆瀵瑰簲鐨勬ā鍨� - // 杩欓噷鍚屾椂鍒ゆ柇EditValue鍜孴ext锛岀‘淇濆吋瀹规�э紙鏍规嵁瀹為檯鏁版嵁缁戝畾鎯呭喌璋冩暣锛� - if (selectedValue == "搴撲綅鐮侊紙灏忥級" || selectedText == "搴撲綅鐮侊紙灏忥級") - { - _kwModel = "rpt_KW"; - } - else if (selectedValue == "搴撲綅鐮侊紙澶э級" || selectedText == "搴撲綅鐮侊紙澶э級") - { - _kwModel = "rpt_KW1"; - } - else - { - MsgHelper.Warning("璇烽�夋嫨鏈夋晥鐨勫簱浣嶇爜绫诲瀷锛堝皬/澶э級"); - } } private void GridView1_ColumnFilterChanged(object sender, EventArgs e) { @@ -331,14 +159,14 @@ toolBarMenu1.isSetBtn = false; if (string.IsNullOrEmpty(txt_depotCode.Text.Trim())) { - MsgHelper.Warning("浠撳簱缂栫爜涓嶈兘涓虹┖锛�"); + MsgHelper.ShowError("浠撳簱缂栫爜涓嶈兘涓虹┖锛�"); txt_depotCode.Focus(); return; } if (string.IsNullOrEmpty(txt_depotName.Text.Trim())) { - MsgHelper.Warning("浠撳簱鍚嶇О涓嶈兘涓虹┖锛�"); + MsgHelper.ShowError("浠撳簱鍚嶇О涓嶈兘涓虹┖锛�"); txt_depotName.Focus(); return; } @@ -355,11 +183,11 @@ MsgHelper.ShowError("缂栫爜涓嶈兘涓虹┖锛�"); return; } - if (string.IsNullOrEmpty(row["DepotSectionName"].ToString())) - { - MsgHelper.ShowError("鍚嶇О涓嶈兘涓虹┖锛�"); - return; - } + //if (string.IsNullOrEmpty(row["DepotSectionName"].ToString())) + //{ + // MsgHelper.ShowError("鍚嶇О涓嶈兘涓虹┖锛�"); + // return; + //} lst.Add(new MesDepotSections { Guid = UtilityHelper.ToGuid(row["guid"].ToString()), @@ -375,18 +203,18 @@ DepotCode = txt_depotCode.Text, DepotName = txt_depotName.Text, Description = txt_description.Text, + Remark5=txt_remark5.TextTxt.Trim(), list = lst }; - try { var strJson = UtilityHelper.HttpPost("", _webServiceName + "EditModel", JsonConvert.SerializeObject(_obj)); var _rtn = UtilityHelper.ReturnToDynamic(strJson); - MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); if (_rtn.rtnCode > 0) { + MsgHelper.ShowInformation("鎻愮ず锛�" + _rtn.rtnMsg); lbGuid.Text = _rtn.rtnData; toolBarMenu1.isSetBtn = true; var gridViews = new List<GridView>(); @@ -395,10 +223,12 @@ toolBarMenu1.currentAction = ""; Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6); } + else + MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg); } catch (Exception ex) { - MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } @@ -408,10 +238,12 @@ /// <param name="pageSize">姣忛〉鍑犳潯</param> private void getPageList(int curPage) { - gcMain1.DataSource = null;var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); - var pgq = new PageQueryModel(curPage, - this.pageBar1.RowsCount, - "org.FNumber asc ,a.depot_code", "asc", + gcMain1.DataSource = null; + System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder(); + _sbSqlWhere.Append(" and a.FSubsidiary in"); + _sbSqlWhere.Append(ToolBox.UtilityHelper.GetOrgWhere()); + _sbSqlWhere.Append(UtilityHelper.GetSearchWhere(_filterList)); + var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "org.FNumber asc ,a.depot_code", "asc", "", _sbSqlWhere.ToString()); var json = JsonConvert.SerializeObject(pgq); try @@ -469,7 +301,7 @@ JsonConvert.SerializeObject(_obj)); var _rtn = UtilityHelper.ReturnToDynamic(strJson); if (_rtn.rtnCode > 0) - { + { var dy = _rtn.rtnData; lbGuid.Text = strGuid; var gvList = new List<GridView>(); -- Gitblit v1.9.3