From 0c3d3f4b2be6e38afde96537c73c38d2d18b96fe Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期三, 20 十一月 2024 13:53:11 +0800 Subject: [PATCH] 工单 --- DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.resx | 120 +++++++++++++++ DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs | 305 ++++++++++++++++++++++++++++++++++++++ DevApp/Gs.DevApp/Gs.DevApp.csproj | 9 + 3 files changed, 434 insertions(+), 0 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs b/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs new file mode 100644 index 0000000..09579c6 --- /dev/null +++ b/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs @@ -0,0 +1,305 @@ +using DevExpress.XtraGrid.Views.Grid; +using DevExpress.XtraGrid.Views.Grid.ViewInfo; +using Gs.DevApp.Entity; +using Gs.DevApp.ToolBox; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Data; +using System.Drawing; +using System.Windows.Forms; + +namespace Gs.DevApp.DevFrm +{ + public partial class Frm_Wompba : DevExpress.XtraEditors.XtraForm + { + string _webServiceName = "WompbaManager/"; + List<FilterEntity> _filterList = new List<FilterEntity>(); + public Frm_Wompba() + { + 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; + gcMain.MouseDoubleClick += GcMain_MouseDoubleClick; + getPageList(1, UtilityHelper.GetPageSize()); + pageBar1.PagerEvent += PageBar1_PagerEvent; + gridView1.CustomDrawRowIndicator += (s, e) => + { + if (e.Info.IsRowIndicator && e.RowHandle >= 0) + { + e.Info.DisplayText = (e.RowHandle + 1).ToString(); + } + }; + gridView1.CustomDrawEmptyForeground += (s, e) => + { + string str = "鏆傛湭鏌ユ壘鍒板尮閰嶇殑鏁版嵁!"; + Font f = new Font("寰蒋闆呴粦", 16); + Rectangle r = new Rectangle(gridView1.GridControl.Width / 2 - 100, e.Bounds.Top + 45, e.Bounds.Right - 5, e.Bounds.Height - 5); + e.Graphics.DrawString(str, f, Brushes.Gray, r); + }; + } + + /// <summary> + /// 鍙屽嚮浜嬩欢 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void GcMain_MouseDoubleClick(object sender, MouseEventArgs e) + { + string rowGuid = Gs.DevApp.ToolBox.UtilityHelper.GetCurrentDoubleRow(gridView1, e, "guid"); + if (!string.IsNullOrEmpty(rowGuid)) + getModel(rowGuid, false, 999); + } + /// <summary> + /// 鍒嗛〉浜嬩欢 + /// </summary> + /// <param name="curPage"></param> + /// <param name="pageSize"></param> + private void PageBar1_PagerEvent(int curPage, int pageSize) + { + getPageList(curPage, pageSize); + } + /// <summary> + /// 鏌ヨ浜嬩欢 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e) + { + Gs.DevApp.UserControl.ShowFilter frm = new Gs.DevApp.UserControl.ShowFilter(gridView1.Columns, _filterList); + frm.UpdateParent += Frm_UpdateParent; + frm.ShowDialog(); + } + /// <summary> + /// 鏌ヨ鍥炶皟 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void Frm_UpdateParent(object sender, UpdateParentEventArgs e) + { + _filterList = e.FilterList; + getPageList(1, pageBar1.RowsCount); + } + + /// <summary> + /// 鍙栨秷浜嬩欢 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void ToolBarMenu1_btnEscClick(object sender, EventArgs e) + { + UtilityHelper.JumpToTab(xtraTabControl1, 0); + } + + /// <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_billNo, gridView1); + if (string.IsNullOrEmpty(rowGuid)) + { + ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + return; + } + if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾鍒犻櫎鍚楋紵")) + return; + List<dynamic> lst = new List<dynamic>(); + lst.Add(rowGuid); + var _obj = lst; + try + { + string strJson = UtilityHelper.HttpPost("", _webServiceName + "DeleteModel", JsonConvert.SerializeObject(_obj)); + ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); + if (_rtn.rtnCode > 0) + { + UtilityHelper.JumpToTab(xtraTabControl1, 0); + getPageList(1, UtilityHelper.GetPageSize()); + } + ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + } + catch (Exception ex) + { + ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } + } + + /// <summary> + /// 鍒锋柊浜嬩欢 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e) + { + if (xtraTabControl1.SelectedTabPageIndex == 1) + getModel(lbGuid.Text.Trim(), false, 999); + else + getPageList(1, UtilityHelper.GetPageSize()); + } + /// <summary> + /// 淇敼浜嬩欢 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void ToolBarMenu1_btnEdtClick(object sender, EventArgs e) + { + string rowGuid = "", rowName = ""; + // (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1); + if (string.IsNullOrEmpty(rowGuid)) + { + 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 = ""; + List<DevExpress.XtraGrid.Views.Grid.GridView> gridViews = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); + gridViews.Add(gvMx1); + UtilityHelper.CleanValueByControl(this.panel1.Controls, true, gridViews); + Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); + } + /// <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_account.Text.Trim())) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("鐧诲綍璐﹀彿涓嶈兘涓虹┖锛�"); + // txt_account.Focus(); + return; + } + var _obj = new + { + guid =UtilityHelper.ToGuid( lbGuid.Text.Trim()), //涓诲缓 + }; + try + { + string strJson = UtilityHelper.HttpPost("", _webServiceName + "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); + } + } + + /// <summary> + /// + /// </summary> + /// <param name="curPage">绗嚑椤�</param> + /// <param name="pageSize">姣忛〉鍑犳潯</param> + private void getPageList(int curPage, int pageSize) + { + System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder(); + foreach (FilterEntity itm in _filterList) + { + _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" + itm.fileValue + "'"); + } + PageQueryModel pgq = new PageQueryModel(curPage, pageSize, "create_date", "asc", "", _sbSqlWhere.ToString()); + string json = JsonConvert.SerializeObject(pgq); + try + { + string strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetListPage", json); + ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn); + if (dd.rtnCode > 0) + { + DataTable dt = dd.rtnData.list; + gcMain.BindingContext = new BindingContext(); + gcMain.DataSource = dt; + gcMain.ForceInitialize(); + int dddd = dd.rtnData.pages;//鎬婚〉 + pageBar1.TotalPages = dddd; + pageBar1.RecordCount = dd.rtnData.total;//璁板綍鎬绘暟 + pageBar1.CurrentPage = curPage;//褰撳墠椤� + pageBar1.RowsCount = pageSize;//姣忛〉鏄剧ず + pageBar1.setTxt(); + } + else + { + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + dd.rtnMsg); + } + } + catch (Exception ex) + { + ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } + } + private void getModel(string strGuid, bool isEdit, int tabIdx) + { + if (string.IsNullOrEmpty(strGuid)) + { + ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + return; + } + UtilityHelper.JumpToTab(xtraTabControl1, tabIdx); + 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; + lbGuid.Text = strGuid; + List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); + gvList.Add(gvMx1); + UtilityHelper.SetValueByObj(this.panel1.Controls, dy, isEdit, gvList); + JObject _job = JObject.Parse(strJson); + JArray array = new 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(); + } + else + { + Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); + } + } + else + ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + } + catch (Exception ex) + { + ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } + } + } +} \ No newline at end of file diff --git a/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.resx b/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.resx new file mode 100644 index 0000000..d58980a --- /dev/null +++ b/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.resx @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root> \ No newline at end of file diff --git a/DevApp/Gs.DevApp/Gs.DevApp.csproj b/DevApp/Gs.DevApp/Gs.DevApp.csproj index d620554..bcbad1e 100644 --- a/DevApp/Gs.DevApp/Gs.DevApp.csproj +++ b/DevApp/Gs.DevApp/Gs.DevApp.csproj @@ -426,6 +426,12 @@ <Compile Include="DevFrm\WOM\Frm_Womcaa.Designer.cs"> <DependentUpon>Frm_Womcaa.cs</DependentUpon> </Compile> + <Compile Include="DevFrm\WOM\Frm_Wompba.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="DevFrm\WOM\Frm_Wompba.Designer.cs"> + <DependentUpon>Frm_Wompba.cs</DependentUpon> + </Compile> <Compile Include="Entity\LoginInfoModel.cs" /> <Compile Include="Entity\PageQueryModel.cs" /> <Compile Include="Entity\ReturnModel.cs" /> @@ -658,6 +664,9 @@ <EmbeddedResource Include="DevFrm\WOM\Frm_Womcaa.resx"> <DependentUpon>Frm_Womcaa.cs</DependentUpon> </EmbeddedResource> + <EmbeddedResource Include="DevFrm\WOM\Frm_Wompba.resx"> + <DependentUpon>Frm_Wompba.cs</DependentUpon> + </EmbeddedResource> <EmbeddedResource Include="Properties\licenses.licx" /> <EmbeddedResource Include="Properties\Resources.resx"> <Generator>ResXFileCodeGenerator</Generator> -- Gitblit v1.9.3