From 719894be883cd18a0ce3334e6d9f32ebf6b9a002 Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期一, 23 十二月 2024 18:35:16 +0800 Subject: [PATCH] 委外排产 --- DevApp/Gs.DevApp/DevFrm/Sys/Organization.cs | 240 +++++++++++++++--------------------------------------------- 1 files changed, 60 insertions(+), 180 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/Sys/Organization.cs b/DevApp/Gs.DevApp/DevFrm/Sys/Organization.cs index f610075..70c2c2a 100644 --- a/DevApp/Gs.DevApp/DevFrm/Sys/Organization.cs +++ b/DevApp/Gs.DevApp/DevFrm/Sys/Organization.cs @@ -1,81 +1,36 @@ -锘縰sing Gs.DevApp.Entity; -using Gs.DevApp.ToolBox; -using Newtonsoft.Json; -using System; +锘縰sing System; +using System.Collections.Generic; using System.Data; using System.Windows.Forms; +using DevExpress.XtraEditors; +using Gs.DevApp.Entity; +using Gs.DevApp.Properties; +using Gs.DevApp.ToolBox; +using Newtonsoft.Json; namespace Gs.DevApp.DevFrm.User { - public partial class Organization : DevExpress.XtraEditors.XtraForm + public partial class Organization : XtraForm { + List<FilterEntity> _filterList = new List<FilterEntity>(); public Organization() { + InitializeComponent(); - this.toolBarMenu1.btnAddClick += ToolBarMenu1_btnAddClick; - this.toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick; - this.toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick; this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick; - this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1; - this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick; + this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; tlMenu.DoubleClick += TlMenu_DoubleClick; getTree(); } - - private void TlMenu_DoubleClick(object sender, EventArgs e) - { - TreeNode clickedNode = tlMenu.SelectedNode; - if (clickedNode.FirstNode == null) - { - string rowGuid = clickedNode.Name.ToString(); - getModel(rowGuid, false, 999); - } - } /// <summary> - /// 鍙栨秷浜嬩欢 + /// 鏌ヨ浜嬩欢 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> - private void ToolBarMenu1_btnEscClick(object sender, EventArgs e) + private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e) { - UtilityHelper.JumpToTab(xtraTabControl1, 0); + Gs.DevApp.ToolBox.MsgHelper.ShowInformation("璇ョ獥浣撲笉鏀寔鏌ヨ锛岃嫢鎯虫洿鏂伴〉闈紝璇风偣鍑� 鍒锋柊"); } - - /// <summary> - /// 鍒犻櫎浜嬩欢 - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e) - { - string rowGuid, rowName; - (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_name, tlMenu); - if (string.IsNullOrEmpty(rowGuid)) - { - ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鍒犻櫎鐨勮锛�"); - return; - } - if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾鍒犻櫎鍚楋紵")) - { - return; - } - var _obj = new - { - guid = rowGuid,//涓诲缓 - }; - try - { - string strJson = UtilityHelper.HttpPost("", "Organization/DeleteModel", JsonConvert.SerializeObject(_obj)); - ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); - if (_rtn.rtnCode > 0) { getTree(); } - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); - } - catch (Exception ex) - { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); - } - } - /// <summary> /// 鍒锋柊浜嬩欢 /// </summary> @@ -83,134 +38,55 @@ /// <param name="e"></param> private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e) { - UtilityHelper.JumpToTab(xtraTabControl1, 0); - getTree(); + if (xtraTabControl1.SelectedTabPageIndex == 1) + getModel(lbGuid.Text.Trim(), false, 999); + else + getTree(); } - - /// <summary> - /// 淇敼浜嬩欢 - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - private void ToolBarMenu1_btnEdtClick(object sender, EventArgs e) + private void TlMenu_DoubleClick(object sender, EventArgs e) { - string rowGuid, rowName; - (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_name, tlMenu); - if (string.IsNullOrEmpty(rowGuid)) + var clickedNode = tlMenu.SelectedNode; + if (clickedNode == null) return; + if (clickedNode.FirstNode == null) { - ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); - return; - } - getModel(rowGuid, true, 1); - } - /// <summary> - /// 鏂板浜嬩欢 - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - private void ToolBarMenu1_btnAddClick(object sender, EventArgs e) - { - UtilityHelper.JumpToTab(xtraTabControl1, 1); - lbGuid.Text = ""; - UtilityHelper.CleanValueByControl(this.panel1.Controls, true); - } - /// <summary> - /// 淇濆瓨浜嬩欢 - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e) - { - toolBarMenu1.isSetBtn = false; - if (string.IsNullOrEmpty(txt_factory.Text.Trim())) - { - Gs.DevApp.ToolBox.MsgHelper.Warning("鍚嶇О涓嶈兘涓虹┖锛�"); - txt_factory.Focus(); - return; - } - if (string.IsNullOrEmpty(txt_name.Text.Trim())) - { - Gs.DevApp.ToolBox.MsgHelper.Warning("鍚嶇О涓嶈兘涓虹┖锛�"); - txt_name.Focus(); - return; - } - if (string.IsNullOrEmpty(txt_conPeople.Text.Trim())) - { - Gs.DevApp.ToolBox.MsgHelper.Warning("鑱旂郴浜轰笉鑳戒负绌猴紒"); - txt_conPeople.Focus(); - return; - } - if (string.IsNullOrEmpty(txt_conTel.Text.Trim())) - { - Gs.DevApp.ToolBox.MsgHelper.Warning("鑱旂郴鐢佃瘽涓嶈兘涓虹┖锛�"); - txt_conTel.Focus(); - return; - } - if (txt_isStatus.SelectedIndex <= 0) - { - Gs.DevApp.ToolBox.MsgHelper.Warning("鐘舵�佷笉鑳戒负绌猴紒"); - txt_isStatus.Focus(); - return; - } - string _upGuid = txt_upGuid.Text.Trim().Length > 0 ? txt_upGuid.SelectedValue.ToString() : ""; - var _obj = new - { - guid = lbGuid.Text.Trim(),//涓诲缓 - upGuid = _upGuid,//涓婄骇鐨勪富寤� - name = txt_name.Text.Trim(),//鍚嶇О - conPeople = txt_conPeople.Text,//鑱旂郴浜� - conTel = txt_conPeople.Text,//鑱旂郴鐢佃瘽 - isStatus = txt_isStatus.SelectedIndex,//鐘舵�� - factory = txt_factory.Text,//缁勭粐缂栧彿 - }; - try - { - string strJson = UtilityHelper.HttpPost("", "Organization/EditModel", JsonConvert.SerializeObject(_obj)); - ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); - if (_rtn.rtnCode > 0) - { - lbGuid.Text = _rtn.rtnData; - toolBarMenu1.isSetBtn = true; - UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false); - } - } - catch (Exception ex) - { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + var rowGuid = clickedNode.Name; + getModel(rowGuid, false, 999); } } - private void getTree() { tlMenu.Nodes.Clear(); - ImageList imageList = new ImageList(); - imageList.Images.Add("icon1", Properties.Resources.publicfix_32x32); - imageList.Images.Add("icon2", Properties.Resources.user_16x16); + var imageList = new ImageList(); + imageList.Images.Add("icon1", Resources.publicfix_32x32); + imageList.Images.Add("icon2", Resources.user_16x16); tlMenu.ImageList = imageList; - PageQueryModel pgq = new PageQueryModel(1, 999999, "factory", "asc", "", ""); - string json = JsonConvert.SerializeObject(pgq); + var pgq = new PageQueryModel(1, 999999, "FID"); + var json = JsonConvert.SerializeObject(pgq); try { - string strReturn = UtilityHelper.HttpPost("", "Organization/GetListPage", json); - ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn); - DataTable dt = dd.rtnData.list; - DataRow[] drGrp = dt.Select("upGuid='' or upguid is null"); - DataTable dtComList = new DataTable(); + var strReturn = UtilityHelper.HttpPost("", + "Organization/GetListPage", json); + var dd = UtilityHelper.ReturnToTablePage(strReturn); + var dt = dd.rtnData.list; + var drGrp = dt.Select("FID=1"); + var dtComList = new DataTable(); dtComList.Columns.Add("guid", typeof(string)); dtComList.Columns.Add("name", typeof(string)); - foreach (DataRow _dy in drGrp) + foreach (var _dy in drGrp) { - dtComList.Rows.Add(_dy["guid"].ToString(), _dy["name"].ToString()); - TreeNode node = new TreeNode();//瀹氫箟缁撶偣 - node.Text = _dy["name"].ToString();//涓虹粨鐐硅祴鍊� + dtComList.Rows.Add(_dy["guid"].ToString(), + _dy["name"].ToString()); + var node = new TreeNode(); //瀹氫箟缁撶偣 + node.Text = + "(" + _dy["FNumber"] + ")" + _dy["name"]; //涓虹粨鐐硅祴鍊� node.Name = _dy["guid"].ToString(); node.ImageIndex = 0; - DataRow[] drItem = dt.Select("upGuid='" + _dy["guid"].ToString() + "'"); - foreach (DataRow _dy2 in drItem) + var drItem = dt.Select("FParentlD='" + _dy["FID"] + "'"); + foreach (var _dy2 in drItem) { - TreeNode node22 = new TreeNode();//瀹氫箟缁撶偣 - node22.Text = _dy2["name"].ToString();//涓虹粨鐐硅祴鍊� + var node22 = new TreeNode(); //瀹氫箟缁撶偣 + node22.Text = + "(" + _dy2["FNumber"] + ")" + _dy2["name"]; //涓虹粨鐐硅祴鍊� node22.Name = _dy2["guid"].ToString(); node22.ImageIndex = 1; node.Nodes.Add(node22); @@ -221,41 +97,45 @@ txt_upGuid.DataSource = dtComList; txt_upGuid.DisplayMember = "name"; txt_upGuid.ValueMember = "guid"; + getModel(dtComList.Rows[0]["guid"].ToString(),false,0); } catch (Exception ex) { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } } - private void getModel(string strGuid, bool isEdit, int tabIdx) { if (string.IsNullOrEmpty(strGuid)) { - ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } + UtilityHelper.JumpToTab(xtraTabControl1, tabIdx); var _obj = new { - guid = strGuid,//涓诲缓 + guid = strGuid //涓诲缓 }; try { - string strJson = UtilityHelper.HttpPost("", "Organization/GetModel", JsonConvert.SerializeObject(_obj)); - ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); + var strJson = UtilityHelper.HttpPost("", + "Organization/GetModel", JsonConvert.SerializeObject(_obj)); + var _rtn = UtilityHelper.ReturnToDynamic(strJson); if (_rtn.rtnCode > 0) { - dynamic dy = _rtn.rtnData; + var dy = _rtn.rtnData; lbGuid.Text = strGuid; - UtilityHelper.SetValueByObj(this.panel1.Controls, dy, isEdit); + UtilityHelper.SetValueByObj(panel1.Controls, dy, isEdit); } else - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + { + MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + } } catch (Exception ex) { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } } } -- Gitblit v1.9.3