From 0c4b20311211843bd51a8c598593799cf7f7bd48 Mon Sep 17 00:00:00 2001 From: cnf <3200815559@qq.com> Date: 星期五, 12 九月 2025 08:45:43 +0800 Subject: [PATCH] 其他出入库 --- DevApp/Gs.DevApp/UserControl/CopyXls.resx | 120 +++++++ DevApp/Gs.DevApp/UserControl/SelectDaa.resx | 120 +++++++ DevApp/Gs.DevApp/UserControl/CopyXls.cs | 276 +++++++++++++++++ DevApp/Gs.DevApp/UserControl/CopyXls.Designer.cs | 87 +++++ DevApp/Gs.DevApp/UserControl/SelectDaa.Designer.cs | 231 ++++++++++++++ DevApp/Gs.DevApp/UserControl/SelectDaa.cs | 94 +++++ 6 files changed, 928 insertions(+), 0 deletions(-) diff --git a/DevApp/Gs.DevApp/UserControl/CopyXls.Designer.cs b/DevApp/Gs.DevApp/UserControl/CopyXls.Designer.cs new file mode 100644 index 0000000..993c528 --- /dev/null +++ b/DevApp/Gs.DevApp/UserControl/CopyXls.Designer.cs @@ -0,0 +1,87 @@ +锘縩amespace Gs.DevApp.UserControl +{ + partial class CopyXls + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.spreadsheetControl1 = new DevExpress.XtraSpreadsheet.SpreadsheetControl(); + this.panel1 = new System.Windows.Forms.Panel(); + this.btnSave = new DevExpress.XtraEditors.SimpleButton(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // spreadsheetControl1 + // + this.spreadsheetControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.spreadsheetControl1.Location = new System.Drawing.Point(0, 0); + this.spreadsheetControl1.Name = "spreadsheetControl1"; + this.spreadsheetControl1.Size = new System.Drawing.Size(895, 593); + this.spreadsheetControl1.TabIndex = 0; + this.spreadsheetControl1.Text = "spreadsheetControl1"; + // + // panel1 + // + this.panel1.Controls.Add(this.btnSave); + this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.panel1.Location = new System.Drawing.Point(0, 545); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(895, 48); + this.panel1.TabIndex = 2; + // + // btnSave + // + this.btnSave.ImageOptions.Image = global::Gs.DevApp.Properties.Resources.print_16x161; + this.btnSave.Location = new System.Drawing.Point(359, 7); + this.btnSave.Name = "btnSave"; + this.btnSave.Size = new System.Drawing.Size(94, 29); + this.btnSave.TabIndex = 3; + this.btnSave.Text = "纭畾淇濆瓨"; + this.btnSave.Click += new System.EventHandler(this.btnSave_Click); + // + // CopyXls + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(895, 593); + this.Controls.Add(this.panel1); + this.Controls.Add(this.spreadsheetControl1); + this.MinimizeBox = false; + this.Name = "CopyXls"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Xls"; + this.panel1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private DevExpress.XtraSpreadsheet.SpreadsheetControl spreadsheetControl1; + private System.Windows.Forms.Panel panel1; + private DevExpress.XtraEditors.SimpleButton btnSave; + } +} \ No newline at end of file diff --git a/DevApp/Gs.DevApp/UserControl/CopyXls.cs b/DevApp/Gs.DevApp/UserControl/CopyXls.cs new file mode 100644 index 0000000..bc48303 --- /dev/null +++ b/DevApp/Gs.DevApp/UserControl/CopyXls.cs @@ -0,0 +1,276 @@ +锘縰sing CefSharp.DevTools.Debugger; +using DevExpress.Spreadsheet; +using DevExpress.Utils.DirectXPaint; +using DevExpress.XtraEditors; +using DevExpress.XtraLayout.Customization; +using Gs.DevApp.ToolBox; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Configuration; +using System.Data; +using System.Data.SqlTypes; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Gs.DevApp.UserControl +{ + public partial class CopyXls : DevExpress.XtraEditors.XtraForm + { + private string orderType; + private string orderGuid; + private string orgId; + private static readonly string filePath = AppContext.BaseDirectory + "xlsCopy.xls"; + + public CopyXls(string _orgId, string _orderGuid, string _orderType) + { + InitializeComponent(); + this.orderType = _orderType; + this.orderGuid = _orderGuid; + this.orgId = _orgId; + this.spreadsheetControl1.DocumentLoaded += new EventHandler(spreadsheetControl1_DocumentLoaded); + if (!string.IsNullOrEmpty(filePath)) + { + if (File.Exists(filePath)) + { + IWorkbook workbook = spreadsheetControl1.Document; + workbook.LoadDocument(filePath); + switch (this.orderType) + { + case "鍏跺畠鍏ュ簱": + SetCellText(spreadsheetControl1.ActiveWorksheet, "A1", "鐗╂枡缂栧彿", true); + SetCellText(spreadsheetControl1.ActiveWorksheet, "B1", "鐢宠鏁伴噺", true); + SetCellText(spreadsheetControl1.ActiveWorksheet, "C1", "鐢宠澶囨敞", true); + SetCellText(spreadsheetControl1.ActiveWorksheet, "D1", "涓嶈壇绫诲瀷", true); + break; + case "鐗╂枡璋冩嫧": + SetCellText(spreadsheetControl1.ActiveWorksheet, "A1", "鐗╂枡缂栧彿", true); + SetCellText(spreadsheetControl1.ActiveWorksheet, "B1", "鐢宠鏁伴噺", true); + SetCellText(spreadsheetControl1.ActiveWorksheet, "C1", "鐢宠澶囨敞", true); + break; + case "鍏跺畠鍑哄簱": + SetCellText(spreadsheetControl1.ActiveWorksheet, "A1", "鐗╂枡缂栧彿", true); + SetCellText(spreadsheetControl1.ActiveWorksheet, "B1", "鐢宠鏁伴噺", true); + SetCellText(spreadsheetControl1.ActiveWorksheet, "C1", "鐢宠澶囨敞", true); + //SetCellText(spreadsheetControl1.ActiveWorksheet, "D1", "涓嶈壇绫诲瀷", true); + break; + } + } + else + { + Gs.DevApp.ToolBox.MsgHelper.ShowError("鎵句笉鍒皒lsCopy.xls鏂囦欢锛岃鑱旂郴绠$悊鍛橈紒"); + } + } + } + + /// <summary> + /// 鏂囨。鍙樺寲鍚庯紝瀹炵幇瀵规柊鏂囦欢鍚嶇О鐨勬樉绀� + /// </summary> + void spreadsheetControl1_DocumentLoaded(object sender, EventArgs e) + { + string fileName = Path.GetFileName(this.spreadsheetControl1.Document.Path); + if (String.IsNullOrEmpty(fileName)) + { + Text = "璇烽�夋嫨鏂囦欢"; + } + else + { + Text = "姝e湪蹇嵎褰曞叆鍒般��" + this.orderType.ToString() + "銆戯紝缁勭粐ID涓恒��" + this.orgId.ToString() + "銆�"; + } + } + + /// <summary> + /// 淇濆瓨 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void btnSave_Click(object sender, EventArgs e) + { + int rowsCount = spreadsheetControl1.ActiveWorksheet.GetUsedRange().RowCount; + spreadsheetControl1.ActiveWorksheet.MoveToEnd(); + if (rowsCount < 2) + { + MsgHelper.ShowError("澶嶅埗澶辫触锛氳〃鏍间笉鑳戒负绌猴紒"); + return; + } + if (!MsgHelper.AskQuestion("鍏辨湁銆�" + (rowsCount - 1).ToString() + "銆戞潯鏁版嵁锛岀‘瀹氬鍒跺悧锛�")) + return; + var list = new List<dynamic>(); + switch (this.orderType) + { + case "鍏跺畠鍏ュ簱": + #region MyRegion + { + for (int row = 2; row <= rowsCount; row++) + { + string itemNo = spreadsheetControl1.ActiveWorksheet.Cells["A" + row.ToString()].Value.ToString().Trim(); + string sl = spreadsheetControl1.ActiveWorksheet.Cells["B" + row.ToString()].Value.ToString().Trim(); + string bz = spreadsheetControl1.ActiveWorksheet.Cells["C" + row.ToString()].Value.ToString().Trim(); + string bllx = spreadsheetControl1.ActiveWorksheet.Cells["D" + row.ToString()].Value.ToString().Trim(); + var _obj = new + { + itemNo = itemNo, + orgId = this.orgId, + }; + try + { + var strJson = UtilityHelper.HttpPost("", "MesItemsManager/GetModelByOrg", JsonConvert.SerializeObject(_obj)); + var _rtn = UtilityHelper.ReturnToDynamic(strJson); + if (_rtn.rtnCode > 0) + { + var dy = _rtn.rtnData; + list.Add(new + { + itemNo = itemNo, + sl = sl, + bz = bz, + bllx = bllx, + itemName = dy.itemName, + itemModel = dy.itemModel, + dwName = dy.kfName, + itemId = dy.itemId + }); + } + else + { + MsgHelper.ShowError("澶嶅埗澶辫触锛氥��" + itemNo + "銆戝彲鑳戒笉瀛樺湪,璇锋鏌ュ悗閲嶈瘯锛�"); + return; + } + } + catch (Exception ex) + { + MsgHelper.ShowError("澶嶅埗澶辫触锛氥��" + itemNo + "銆戝彂鐢熼敊璇�,璇锋鏌ュ悗閲嶈瘯锛�" + ex.Message); + return; + } + } + } + #endregion + break; + case "鐗╂枡璋冩嫧": + #region MyRegion + { + for (int row = 2; row <= rowsCount; row++) + { + string itemNo = spreadsheetControl1.ActiveWorksheet.Cells["A" + row.ToString()].Value.ToString().Trim(); + string sl = spreadsheetControl1.ActiveWorksheet.Cells["B" + row.ToString()].Value.ToString().Trim(); + string bz = spreadsheetControl1.ActiveWorksheet.Cells["C" + row.ToString()].Value.ToString().Trim(); + var _obj = new + { + itemNo = itemNo, + orgId = this.orgId, + }; + try + { + var strJson = UtilityHelper.HttpPost("", "MesItemsManager/GetModelByOrg", JsonConvert.SerializeObject(_obj)); + var _rtn = UtilityHelper.ReturnToDynamic(strJson); + if (_rtn.rtnCode > 0) + { + var dy = _rtn.rtnData; + list.Add(new + { + itemNo = itemNo, + sl = sl, + bz = bz, + itemName = dy.itemName, + itemModel = dy.itemModel, + dwName = dy.kfName, + itemId = dy.itemId + }); + } + else + { + MsgHelper.ShowError("澶嶅埗澶辫触锛氥��" + itemNo + "銆戝彲鑳戒笉瀛樺湪,璇锋鏌ュ悗閲嶈瘯锛�"); + return; + } + } + catch (Exception ex) + { + MsgHelper.ShowError("澶嶅埗澶辫触锛氥��" + itemNo + "銆戝彂鐢熼敊璇�,璇锋鏌ュ悗閲嶈瘯锛�" + ex.Message); + return; + } + } + } + #endregion + break; + case "鍏跺畠鍑哄簱": + #region MyRegion + { + for (int row = 2; row <= rowsCount; row++) + { + string itemNo = spreadsheetControl1.ActiveWorksheet.Cells["A" + row.ToString()].Value.ToString().Trim(); + string sl = spreadsheetControl1.ActiveWorksheet.Cells["B" + row.ToString()].Value.ToString().Trim(); + string bz = spreadsheetControl1.ActiveWorksheet.Cells["C" + row.ToString()].Value.ToString().Trim(); + var _obj = new + { + itemNo = itemNo, + orgId = this.orgId, + }; + try + { + var strJson = UtilityHelper.HttpPost("", "MesItemsManager/GetModelByOrg", JsonConvert.SerializeObject(_obj)); + var _rtn = UtilityHelper.ReturnToDynamic(strJson); + if (_rtn.rtnCode > 0) + { + var dy = _rtn.rtnData; + list.Add(new + { + itemNo = itemNo, + sl = sl, + bz = bz, + itemName = dy.itemName, + itemModel = dy.itemModel, + dwName = dy.kfName, + itemId = dy.itemId, + //榛樿浠撳簱鍜屼粨搴撴暟閲� + depotName = dy.depotName, + depotId = dy.depotId, + kcQty = dy.kcQty, + }); + } + else + { + MsgHelper.ShowError("澶嶅埗澶辫触锛氥��" + itemNo + "銆戝彲鑳戒笉瀛樺湪,璇锋鏌ュ悗閲嶈瘯锛�"); + return; + } + } + catch (Exception ex) + { + MsgHelper.ShowError("澶嶅埗澶辫触锛氥��" + itemNo + "銆戝彂鐢熼敊璇�,璇锋鏌ュ悗閲嶈瘯锛�" + ex.Message); + return; + } + } + } + #endregion + break; + } + + UpdateParent?.Invoke(this, + new UpdateParentEventArgs { DynamicList = list }); + Close(); + } + + /// <summary> + /// 浠庢暟鎹簱閲岃鍙栧埌Excel + /// </summary> + /// <param name="workSheet"></param> + /// <param name="coordinates">浣嶇疆鏍煎紡濡侫1 B2</param> + /// <param name="coordValue">鍊�</param> + /// <param name="isBold">鏄惁鍔犵矖</param> + private void SetCellText(Worksheet workSheet, string coordinates, string coordValue, bool isBold) + { + workSheet.Cells[coordinates].Value = coordValue; + workSheet.Cells[coordinates].Style.Font.Bold = isBold; + } + + /// <summary> + /// 閫夋嫨鍚庣殑鍥炶皟浜嬩欢 + /// </summary> + public event EventHandler<UpdateParentEventArgs> UpdateParent; + + } +} \ No newline at end of file diff --git a/DevApp/Gs.DevApp/UserControl/CopyXls.resx b/DevApp/Gs.DevApp/UserControl/CopyXls.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DevApp/Gs.DevApp/UserControl/CopyXls.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/UserControl/SelectDaa.Designer.cs b/DevApp/Gs.DevApp/UserControl/SelectDaa.Designer.cs new file mode 100644 index 0000000..6902af0 --- /dev/null +++ b/DevApp/Gs.DevApp/UserControl/SelectDaa.Designer.cs @@ -0,0 +1,231 @@ +锘縩amespace Gs.DevApp.UserControl +{ + partial class SelectDaa + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + DevExpress.XtraEditors.Controls.EditorButtonImageOptions editorButtonImageOptions1 = new DevExpress.XtraEditors.Controls.EditorButtonImageOptions(); + DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject1 = new DevExpress.Utils.SerializableAppearanceObject(); + DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject2 = new DevExpress.Utils.SerializableAppearanceObject(); + DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject3 = new DevExpress.Utils.SerializableAppearanceObject(); + DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject4 = new DevExpress.Utils.SerializableAppearanceObject(); + this.gcMain = new DevExpress.XtraGrid.GridControl(); + this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView(); + this.gv_operationTime = new DevExpress.XtraGrid.Columns.GridColumn(); + this.gv_operationTable = new DevExpress.XtraGrid.Columns.GridColumn(); + this.gv_userName = new DevExpress.XtraGrid.Columns.GridColumn(); + this.gv_Btn = new DevExpress.XtraGrid.Columns.GridColumn(); + this.repositoryItemButtonEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit(); + this.gridColumn1 = new DevExpress.XtraGrid.Columns.GridColumn(); + this.gridColumn2 = new DevExpress.XtraGrid.Columns.GridColumn(); + this.gridColumn3 = new DevExpress.XtraGrid.Columns.GridColumn(); + this.gridColumn4 = new DevExpress.XtraGrid.Columns.GridColumn(); + this.gridColumn5 = new DevExpress.XtraGrid.Columns.GridColumn(); + ((System.ComponentModel.ISupportInitialize)(this.gcMain)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.gridView1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.repositoryItemButtonEdit1)).BeginInit(); + this.SuspendLayout(); + // + // gcMain + // + this.gcMain.Dock = System.Windows.Forms.DockStyle.Fill; + this.gcMain.Location = new System.Drawing.Point(0, 0); + this.gcMain.MainView = this.gridView1; + this.gcMain.Name = "gcMain"; + this.gcMain.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] { + this.repositoryItemButtonEdit1}); + this.gcMain.Size = new System.Drawing.Size(996, 489); + this.gcMain.TabIndex = 3; + this.gcMain.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { + this.gridView1}); + // + // gridView1 + // + this.gridView1.Appearance.Row.Options.UseFont = true; + this.gridView1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] { + this.gv_operationTime, + this.gv_operationTable, + this.gv_userName, + this.gridColumn1, + this.gridColumn2, + this.gridColumn3, + this.gridColumn4, + this.gridColumn5, + this.gv_Btn}); + this.gridView1.GridControl = this.gcMain; + this.gridView1.Name = "gridView1"; + this.gridView1.OptionsFind.ShowSearchNavButtons = false; + this.gridView1.OptionsView.ShowAutoFilterRow = true; + this.gridView1.OptionsView.ShowGroupPanel = false; + // + // gv_operationTime + // + this.gv_operationTime.AppearanceCell.Options.UseFont = true; + this.gv_operationTime.Caption = "鐢熶骇绾垮埆"; + this.gv_operationTime.FieldName = "xb"; + this.gv_operationTime.MinWidth = 10; + this.gv_operationTime.Name = "gv_operationTime"; + this.gv_operationTime.OptionsColumn.AllowEdit = false; + this.gv_operationTime.Tag = "query_OPERATION_TIME"; + this.gv_operationTime.Visible = true; + this.gv_operationTime.VisibleIndex = 1; + this.gv_operationTime.Width = 48; + // + // gv_operationTable + // + this.gv_operationTable.AppearanceCell.Options.UseFont = true; + this.gv_operationTable.Caption = "鐢熶骇杞﹂棿"; + this.gv_operationTable.FieldName = "dptnName"; + this.gv_operationTable.MinWidth = 10; + this.gv_operationTable.Name = "gv_operationTable"; + this.gv_operationTable.OptionsColumn.AllowEdit = false; + this.gv_operationTable.Tag = "query_OPERATION_TABLE"; + this.gv_operationTable.Visible = true; + this.gv_operationTable.VisibleIndex = 2; + this.gv_operationTable.Width = 48; + // + // gv_userName + // + this.gv_userName.AppearanceCell.Options.UseFont = true; + this.gv_userName.Caption = "宸ュ崟鍙�"; + this.gv_userName.FieldName = "daa001"; + this.gv_userName.Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Left; + this.gv_userName.MinWidth = 10; + this.gv_userName.Name = "gv_userName"; + this.gv_userName.OptionsColumn.AllowEdit = false; + this.gv_userName.Tag = "query_USER_NAME"; + this.gv_userName.Visible = true; + this.gv_userName.VisibleIndex = 0; + this.gv_userName.Width = 50; + // + // gv_Btn + // + this.gv_Btn.Caption = "閫夋嫨"; + this.gv_Btn.ColumnEdit = this.repositoryItemButtonEdit1; + this.gv_Btn.Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Right; + this.gv_Btn.MinWidth = 25; + this.gv_Btn.Name = "gv_Btn"; + this.gv_Btn.Visible = true; + this.gv_Btn.VisibleIndex = 8; + this.gv_Btn.Width = 50; + // + // repositoryItemButtonEdit1 + // + this.repositoryItemButtonEdit1.AutoHeight = false; + editorButtonImageOptions1.Image = global::Gs.DevApp.Properties.Resources.checkbox2_16x162; + editorButtonImageOptions1.ImageToTextAlignment = DevExpress.XtraEditors.ImageAlignToText.LeftCenter; + this.repositoryItemButtonEdit1.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { + new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "閫夋嫨", -1, true, true, false, editorButtonImageOptions1, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject1, serializableAppearanceObject2, serializableAppearanceObject3, serializableAppearanceObject4, "", null, null, DevExpress.Utils.ToolTipAnchor.Default)}); + this.repositoryItemButtonEdit1.Name = "repositoryItemButtonEdit1"; + this.repositoryItemButtonEdit1.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor; + this.repositoryItemButtonEdit1.ButtonClick += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(this.repositoryItemButtonEdit1_ButtonClick); + // + // gridColumn1 + // + this.gridColumn1.Caption = "鎶曟枡鍗曞彿"; + this.gridColumn1.FieldName = "daa014"; + this.gridColumn1.MinWidth = 25; + this.gridColumn1.Name = "gridColumn1"; + this.gridColumn1.Visible = true; + this.gridColumn1.VisibleIndex = 3; + this.gridColumn1.Width = 50; + // + // gridColumn2 + // + this.gridColumn2.Caption = "浠诲姟鍗曞彿"; + this.gridColumn2.FieldName = "daa021"; + this.gridColumn2.MinWidth = 25; + this.gridColumn2.Name = "gridColumn2"; + this.gridColumn2.Visible = true; + this.gridColumn2.VisibleIndex = 4; + this.gridColumn2.Width = 50; + // + // gridColumn3 + // + this.gridColumn3.Caption = "浜у搧缂栫爜"; + this.gridColumn3.FieldName = "itemNo"; + this.gridColumn3.MinWidth = 25; + this.gridColumn3.Name = "gridColumn3"; + this.gridColumn3.Visible = true; + this.gridColumn3.VisibleIndex = 5; + this.gridColumn3.Width = 50; + // + // gridColumn4 + // + this.gridColumn4.Caption = "浜у搧鍚嶇О"; + this.gridColumn4.FieldName = "itemName"; + this.gridColumn4.MinWidth = 25; + this.gridColumn4.Name = "gridColumn4"; + this.gridColumn4.Visible = true; + this.gridColumn4.VisibleIndex = 6; + this.gridColumn4.Width = 50; + // + // gridColumn5 + // + this.gridColumn5.Caption = "瑙勬牸鍨嬪彿"; + this.gridColumn5.FieldName = "itemModel"; + this.gridColumn5.MinWidth = 25; + this.gridColumn5.Name = "gridColumn5"; + this.gridColumn5.Visible = true; + this.gridColumn5.VisibleIndex = 7; + this.gridColumn5.Width = 50; + // + // SelectDaa + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(996, 489); + this.Controls.Add(this.gcMain); + this.IconOptions.Image = global::Gs.DevApp.Properties.Resources.logo_png_black; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "SelectDaa"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "閫夋嫨鍏宠仈宸ュ崟"; + ((System.ComponentModel.ISupportInitialize)(this.gcMain)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.gridView1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.repositoryItemButtonEdit1)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private DevExpress.XtraGrid.GridControl gcMain; + private DevExpress.XtraGrid.Views.Grid.GridView gridView1; + private DevExpress.XtraGrid.Columns.GridColumn gv_operationTime; + private DevExpress.XtraGrid.Columns.GridColumn gv_operationTable; + private DevExpress.XtraGrid.Columns.GridColumn gv_userName; + private DevExpress.XtraGrid.Columns.GridColumn gv_Btn; + private DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit repositoryItemButtonEdit1; + private DevExpress.XtraGrid.Columns.GridColumn gridColumn1; + private DevExpress.XtraGrid.Columns.GridColumn gridColumn2; + private DevExpress.XtraGrid.Columns.GridColumn gridColumn3; + private DevExpress.XtraGrid.Columns.GridColumn gridColumn4; + private DevExpress.XtraGrid.Columns.GridColumn gridColumn5; + } +} \ No newline at end of file diff --git a/DevApp/Gs.DevApp/UserControl/SelectDaa.cs b/DevApp/Gs.DevApp/UserControl/SelectDaa.cs new file mode 100644 index 0000000..3e97c96 --- /dev/null +++ b/DevApp/Gs.DevApp/UserControl/SelectDaa.cs @@ -0,0 +1,94 @@ +锘縰sing Gs.DevApp.Entity; +using Gs.DevApp.ToolBox; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Gs.DevApp.UserControl +{ + public partial class SelectDaa : DevExpress.XtraEditors.XtraForm + { + private List<FilterEntity> _filterList = new List<FilterEntity>(); + public SelectDaa() + { + InitializeComponent(); + getPageList(1); + Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, null, "", null, null, false); + } + + /// <summary> + /// </summary> + /// <param name="curPage">绗嚑椤�</param> + /// <param name="pageSize">姣忛〉鍑犳潯</param> + private void getPageList(int curPage) + { + gcMain.DataSource = null; var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); + var pgq = new PageQueryModel(1, 999999, "a.daa001", "asc", ""," and 1=1" + _sbSqlWhere.ToString()); + var json = JsonConvert.SerializeObject(pgq); + try + { + var strReturn = UtilityHelper.HttpPost("", "WomdaaManager/GetListSelect", json); + var dd = UtilityHelper.ReturnToTablePage(strReturn); + if (dd.rtnCode > 0) + { + DataTable dt = dd.rtnData.list; + gcMain.BindingContext = new BindingContext(); + if (dt.Rows.Count > 0) + { + gcMain.DataSource = dt; + gcMain.ForceInitialize(); + gridView1.BestFitColumns(); + Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1); + } + else + UtilityHelper.SetDefaultTable(gcMain, gridView1); + } + else + { + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + dd.rtnMsg); + } + } + catch (Exception ex) + { + MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } + } + + + private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) + { + var rowhandle = gridView1.FocusedRowHandle; + if (rowhandle < 0) + return; + if (e.Button.Index == 0) + { + var dr = gridView1.GetDataRow(rowhandle); + var mxGuid = dr["daa001"].ToString(); + if (string.IsNullOrEmpty(mxGuid)) + { + return; + } + var list = new List<dynamic>(); + list.Add(new + { + guid = mxGuid, + }); + UpdateParent?.Invoke(this, new UpdateParentEventArgs { DynamicList = list }); + Close(); + } + } + + /// <summary> + /// 閫夋嫨鍚庣殑鍥炶皟浜嬩欢 + /// </summary> + public event EventHandler<UpdateParentEventArgs> UpdateParent; + + } +} \ No newline at end of file diff --git a/DevApp/Gs.DevApp/UserControl/SelectDaa.resx b/DevApp/Gs.DevApp/UserControl/SelectDaa.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DevApp/Gs.DevApp/UserControl/SelectDaa.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 -- Gitblit v1.9.3