cnf
7 天以前 0c4b20311211843bd51a8c598593799cf7f7bd48
其他出入库
已添加6个文件
928 ■■■■■ 文件已修改
DevApp/Gs.DevApp/UserControl/CopyXls.Designer.cs 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/UserControl/CopyXls.cs 276 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/UserControl/CopyXls.resx 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/UserControl/SelectDaa.Designer.cs 231 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/UserControl/SelectDaa.cs 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/UserControl/SelectDaa.resx 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/UserControl/CopyXls.Designer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,87 @@
namespace 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;
    }
}
DevApp/Gs.DevApp/UserControl/CopyXls.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,276 @@
using 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("找不到xlsCopy.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 = "正在快捷录入到【" + 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">位置格式如A1 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;
    }
}
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>
DevApp/Gs.DevApp/UserControl/SelectDaa.Designer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,231 @@
namespace 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;
    }
}
DevApp/Gs.DevApp/UserControl/SelectDaa.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,94 @@
using 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;
    }
}
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>