From 1ff8f70bcbb0049f584d308eb6e5d47aa944f35d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?liming=20=E8=94=A1?= Date: Fri, 17 Jul 2026 20:21:57 +0800 Subject: [PATCH] =?UTF-8?q?TODO=20=E4=B8=8A=E4=BC=A0=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E7=BB=99MES?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{Enums => Common}/EnumExtension.cs | 1 + JY.Inspection/Common/UserHelper.cs | 1 + JY.Inspection/Frm/FrmHistoricalDataQuery.cs | 214 ++++++++++++++++-- .../Frm/FrmHistoricalDataQuery.designer.cs | 59 ++--- JY.Inspection/JY.Inspection.csproj | 3 +- .../Enums/EnumAutority.cs | 2 +- JY.Model/Enums/EnumResultType.cs | 33 +++ JY.Model/Enums/EnumSearchType.cs | 29 +++ JY.Model/Enums/EnumUpMesStatus.cs | 27 +++ JY.Model/JY.Model.csproj | 4 + 10 files changed, 321 insertions(+), 52 deletions(-) rename JY.Inspection/{Enums => Common}/EnumExtension.cs (98%) rename {JY.Inspection => JY.Model}/Enums/EnumAutority.cs (95%) create mode 100644 JY.Model/Enums/EnumResultType.cs create mode 100644 JY.Model/Enums/EnumSearchType.cs create mode 100644 JY.Model/Enums/EnumUpMesStatus.cs diff --git a/JY.Inspection/Enums/EnumExtension.cs b/JY.Inspection/Common/EnumExtension.cs similarity index 98% rename from JY.Inspection/Enums/EnumExtension.cs rename to JY.Inspection/Common/EnumExtension.cs index 68c5a2f..3a4998a 100644 --- a/JY.Inspection/Enums/EnumExtension.cs +++ b/JY.Inspection/Common/EnumExtension.cs @@ -1,4 +1,5 @@ using JY.Inspection.Common; +using JY.Model.Enums; using System; using System.Collections.Generic; using System.ComponentModel; diff --git a/JY.Inspection/Common/UserHelper.cs b/JY.Inspection/Common/UserHelper.cs index 5c30389..71ffab9 100644 --- a/JY.Inspection/Common/UserHelper.cs +++ b/JY.Inspection/Common/UserHelper.cs @@ -2,6 +2,7 @@ using JY.Inspection.Mes; using JY.MES.Entity; using JY.MES.MES; +using JY.Model.Enums; using Newtonsoft.Json; using System; using System.Collections.Generic; diff --git a/JY.Inspection/Frm/FrmHistoricalDataQuery.cs b/JY.Inspection/Frm/FrmHistoricalDataQuery.cs index ad7f9bb..83abbdf 100644 --- a/JY.Inspection/Frm/FrmHistoricalDataQuery.cs +++ b/JY.Inspection/Frm/FrmHistoricalDataQuery.cs @@ -12,6 +12,10 @@ using JY.MES.Entity; using JY.MES; using OfficeOpenXml; using MiniExcelLibs; +using System.Collections.Generic; +using JY.Inspection.Enums; +using JY.Model.Enums; +using JY.Model; namespace JY.Inspection.Frm { @@ -20,8 +24,8 @@ namespace JY.Inspection.Frm public delegate void myDelegate(DataTable t); public delegate void PDelegate(); Thread tSo; - int type = 0;//查询类型 - int resulttype = 0;//结果类型 + //int type = 0;//查询类型 + //int resulttype = 0;//结果类型 DataTable dts = null; /// /// 用于电芯进站时设备与FMS校验电芯合法性 @@ -44,7 +48,153 @@ namespace JY.Inspection.Frm { InitializeComponent(); CheckForIllegalCrossThreadCalls = false; + + InitCombobox(); } + + private void InitCombobox() + { + #region 初始化查询类型列表 + var selectItems = new List() + { + new ComboItem() { + Value = (int)EnumSearchType.ArrivalStation, + Text = EnumSearchType.ArrivalStation.GetDescription() + }, + new ComboItem() { + Value = (int)EnumSearchType.ExitStation, + Text = EnumSearchType.ExitStation.GetDescription() + }, + //new ComboItem() { + // Value = (int)EnumSearchType.ProductResult, + // Text = EnumSearchType.ProductResult.GetDescription() + //} + }; + + cbSelectType.DataSource = selectItems; + cbSelectType.DisplayMember = "Text"; + cbSelectType.ValueMember = "Value"; + #endregion + + #region 初始化结果类型列表 + var resultItems = new List() + { + new ComboItem() { + Value = (int)EnumResultType.All, + Text = EnumResultType.All.GetDescription() + }, + new ComboItem() { + Value = (int)EnumResultType.OK, + Text = EnumResultType.OK.GetDescription() + }, + new ComboItem() { + Value = (int)EnumResultType.NG, + Text = EnumResultType.NG.GetDescription() + } + }; + + resultSelectType.DataSource = resultItems; + resultSelectType.DisplayMember = "Text"; + resultSelectType.ValueMember = "Value"; + #endregion + + #region 初始化上传类型列表 + var upMesStatusItems = new List() + { + new ComboItem() { + Value = (int)EnumUpMesStatus.All, + Text = EnumUpMesStatus.All.GetDescription() + }, + new ComboItem() { + Value = (int)EnumUpMesStatus.Auto, + Text = EnumUpMesStatus.Auto.GetDescription() + }, + new ComboItem() { + Value = (int)EnumUpMesStatus.Manual, + Text = EnumUpMesStatus.Manual.GetDescription() + }, + new ComboItem() { + Value = (int)EnumUpMesStatus.None, + Text = EnumUpMesStatus.None.GetDescription() + } + }; + + cmbFlag.DataSource = upMesStatusItems; + cmbFlag.DisplayMember = "Text"; + cmbFlag.ValueMember = "Value"; + #endregion + } + + #region 属性 + public EnumSearchType CurSearchType + { + get + { + EnumSearchType curEnum = EnumSearchType.ArrivalStation; + if (this.InvokeRequired) + { + this.BeginInvoke(new Action(() => { + var curItem = cbSelectType.SelectedItem as ComboItem; + curEnum = curItem.Value.ToEnum(); + })); + } + else + { + var curItem = cbSelectType.SelectedItem as ComboItem; + curEnum = curItem.Value.ToEnum(); + } + + return curEnum; + } + } + + public EnumResultType CurResultType + { + get + { + EnumResultType curEnum = EnumResultType.All; + if (this.InvokeRequired) + { + this.BeginInvoke(new Action(() => + { + var curItem = resultSelectType.SelectedItem as ComboItem; + curEnum = curItem.Value.ToEnum(); + })); + } + else + { + var curItem = resultSelectType.SelectedItem as ComboItem; + curEnum = curItem.Value.ToEnum(); + } + + return curEnum; + } + } + + public EnumUpMesStatus CurUpMesStatus + { + get + { + EnumUpMesStatus curEnum = EnumUpMesStatus.All; + if (this.InvokeRequired) + { + this.BeginInvoke(new Action(() => + { + var curItem = cmbFlag.SelectedItem as ComboItem; + curEnum = curItem.Value.ToEnum(); + })); + } + else + { + var curItem = cmbFlag.SelectedItem as ComboItem; + curEnum = curItem.Value.ToEnum(); + } + + return curEnum; + } + } + #endregion + /// /// 窗体加载事件 /// @@ -88,35 +238,37 @@ namespace JY.Inspection.Frm return; } this.dgvData.DataSource = null; - type = cbSelectType.SelectedIndex; - resulttype = resultSelectType.SelectedIndex; + //type = cbSelectType.SelectedIndex; + //resulttype = resultSelectType.SelectedIndex; } private void ThreadWork() { - lblSelectStures.BeginInvoke(new PDelegate(aa)); + lblSelectStures.BeginInvoke(new PDelegate(SearchBegin)); string strDate1 = dtStartTime.Value.ToString("yyyy-MM-dd HH:mm") + ":01"; string strDate2 = dtEndTime.Value.ToString("yyyy-MM-dd HH:mm") + ":01"; if (dtEndTime.Value.Year != dtStartTime.Value.Year) { MessageBox.Show("请选择日期必须在同一年份内!"); - lblSelectStures.BeginInvoke(new PDelegate(bb)); + lblSelectStures.BeginInvoke(new PDelegate(SearchEnd)); return; } string flag = cmbFlag.Text; string strBarcode = txtBarCode.Text.Trim(); // var dt = dbHelper.GetTestData(type, strBarcode, strDate1, strDate2, flag); - var dt = dbHelper.GetTestData2(type,resulttype, strBarcode, strDate1, strDate2, flag); + int type = (int)CurSearchType; + int resultType = (int)CurResultType; + var dt = dbHelper.GetTestData2(type, resultType, strBarcode, strDate1, strDate2, flag); if (dt == null || dt.Rows.Count == 0) { MessageBox.Show("此时间段无数据或无此条码数据", "系统提示"); - lblSelectStures.BeginInvoke(new PDelegate(bb)); + lblSelectStures.BeginInvoke(new PDelegate(SearchEnd)); return; } this.dgvData.BeginInvoke(new myDelegate(FillData), new object[] { dt });//异步调用(来填充) - lblSelectStures.BeginInvoke(new PDelegate(bb)); + lblSelectStures.BeginInvoke(new PDelegate(SearchEnd)); } @@ -128,16 +280,16 @@ namespace JY.Inspection.Frm this.dgvData.DataSource = dt.DefaultView; } - private void aa() + private void SearchBegin() { this.lblSelectStures.Text = "正在查询数据..."; } - private void bb() + + private void SearchEnd() { this.lblSelectStures.Text = "查询结束"; } - private void btnExcel_Click(object sender, EventArgs e) { if (dts != null && dgvData.Columns.Count <= 0) @@ -210,7 +362,7 @@ namespace JY.Inspection.Frm } try { - if (cbSelectType.Text=="查询进站数据")//上料 + if (cbSelectType.Text == "查询进站数据")//上料 { foreach (DataGridViewRow row in dgvData.Rows) { @@ -261,7 +413,8 @@ namespace JY.Inspection.Frm return; } else - { + { + // TODO 获取出站数据上传MES JY.MES.FMS.FMS_Out fMS_Out = new MES.FMS.FMS_Out(); //fMS_In.deviceCode = Global.systemConfig.eqp_code; //fMS_In.houseCode = "test11"; @@ -322,6 +475,13 @@ namespace JY.Inspection.Frm } + + private BlankingData GetBlankingData(DataGridViewRow row) + { + // TODO 获取BlankingData + return null; + } + /// /// dgvCellMouseClick鼠标点击列事件 /// @@ -345,5 +505,31 @@ namespace JY.Inspection.Frm } } } + + + private class ComboItem + { + /// + /// 实际值 + /// + public int Value { get; set; } + + /// + /// 显示值 + /// + public string Text { get; set; } + } + + private void cbSelectType_SelectedIndexChanged(object sender, EventArgs e) + { + if (CurSearchType == EnumSearchType.ExitStation) + { + btnUpMES.Visible = true; + } + else + { + btnUpMES.Visible = false; + } + } } } diff --git a/JY.Inspection/Frm/FrmHistoricalDataQuery.designer.cs b/JY.Inspection/Frm/FrmHistoricalDataQuery.designer.cs index f73a1b9..f8420b3 100644 --- a/JY.Inspection/Frm/FrmHistoricalDataQuery.designer.cs +++ b/JY.Inspection/Frm/FrmHistoricalDataQuery.designer.cs @@ -43,6 +43,8 @@ namespace JY.Inspection.Frm this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.dgvData = new MetroFramework.Controls.MetroGrid(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.resultSelectType = new MetroFramework.Controls.MetroComboBox(); + this.metroLabel6 = new MetroFramework.Controls.MetroLabel(); this.metroLabel5 = new MetroFramework.Controls.MetroLabel(); this.btnUpMES = new MetroFramework.Controls.MetroButton(); this.cmbFlag = new MetroFramework.Controls.MetroComboBox(); @@ -50,8 +52,6 @@ namespace JY.Inspection.Frm this.dtStartTime = new System.Windows.Forms.DateTimePicker(); this.lblSelectStures = new System.Windows.Forms.Label(); this.metroLabel2 = new MetroFramework.Controls.MetroLabel(); - this.resultSelectType = new MetroFramework.Controls.MetroComboBox(); - this.metroLabel6 = new MetroFramework.Controls.MetroLabel(); this.tableLayoutPanel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dgvData)).BeginInit(); this.groupBox1.SuspendLayout(); @@ -142,14 +142,12 @@ namespace JY.Inspection.Frm this.cbSelectType.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.cbSelectType.FormattingEnabled = true; this.cbSelectType.ItemHeight = 23; - this.cbSelectType.Items.AddRange(new object[] { - "查询进站数据", - "查询出站数据"}); this.cbSelectType.Location = new System.Drawing.Point(7, 252); this.cbSelectType.Name = "cbSelectType"; this.cbSelectType.Size = new System.Drawing.Size(193, 29); this.cbSelectType.TabIndex = 12; this.cbSelectType.UseSelectable = true; + this.cbSelectType.SelectedIndexChanged += new System.EventHandler(this.cbSelectType_SelectedIndexChanged); // // tableLayoutPanel1 // @@ -243,6 +241,26 @@ namespace JY.Inspection.Frm this.groupBox1.TabStop = false; this.groupBox1.Text = "查询条件"; // + // resultSelectType + // + this.resultSelectType.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.resultSelectType.FormattingEnabled = true; + this.resultSelectType.ItemHeight = 23; + this.resultSelectType.Location = new System.Drawing.Point(8, 317); + this.resultSelectType.Name = "resultSelectType"; + this.resultSelectType.Size = new System.Drawing.Size(193, 29); + this.resultSelectType.TabIndex = 55; + this.resultSelectType.UseSelectable = true; + // + // metroLabel6 + // + this.metroLabel6.AutoSize = true; + this.metroLabel6.Location = new System.Drawing.Point(10, 295); + this.metroLabel6.Name = "metroLabel6"; + this.metroLabel6.Size = new System.Drawing.Size(79, 19); + this.metroLabel6.TabIndex = 54; + this.metroLabel6.Text = "结果类型:"; + // // metroLabel5 // this.metroLabel5.AutoSize = true; @@ -269,11 +287,6 @@ namespace JY.Inspection.Frm this.cmbFlag.FormattingEnabled = true; this.cmbFlag.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.cmbFlag.ItemHeight = 23; - this.cmbFlag.Items.AddRange(new object[] { - "全部", - "自动上传MES数据", - "手动上传MES数据", - "未上传MES数据"}); this.cmbFlag.Location = new System.Drawing.Point(6, 447); this.cmbFlag.Name = "cmbFlag"; this.cmbFlag.Size = new System.Drawing.Size(192, 29); @@ -305,7 +318,7 @@ namespace JY.Inspection.Frm // lblSelectStures // this.lblSelectStures.AutoSize = true; - this.lblSelectStures.Location = new System.Drawing.Point(59, 354); + this.lblSelectStures.Location = new System.Drawing.Point(8, 516); this.lblSelectStures.Name = "lblSelectStures"; this.lblSelectStures.Size = new System.Drawing.Size(0, 12); this.lblSelectStures.TabIndex = 15; @@ -319,30 +332,6 @@ namespace JY.Inspection.Frm this.metroLabel2.TabIndex = 5; this.metroLabel2.Text = "查询结束时间:"; // - // resultSelectType - // - this.resultSelectType.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.resultSelectType.FormattingEnabled = true; - this.resultSelectType.ItemHeight = 23; - this.resultSelectType.Items.AddRange(new object[] { - "全部", - "OK", - "NG"}); - this.resultSelectType.Location = new System.Drawing.Point(8, 317); - this.resultSelectType.Name = "resultSelectType"; - this.resultSelectType.Size = new System.Drawing.Size(193, 29); - this.resultSelectType.TabIndex = 55; - this.resultSelectType.UseSelectable = true; - // - // metroLabel6 - // - this.metroLabel6.AutoSize = true; - this.metroLabel6.Location = new System.Drawing.Point(10, 295); - this.metroLabel6.Name = "metroLabel6"; - this.metroLabel6.Size = new System.Drawing.Size(79, 19); - this.metroLabel6.TabIndex = 54; - this.metroLabel6.Text = "结果类型:"; - // // FrmHistoricalDataQuery // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); diff --git a/JY.Inspection/JY.Inspection.csproj b/JY.Inspection/JY.Inspection.csproj index 3cab2be..e421252 100644 --- a/JY.Inspection/JY.Inspection.csproj +++ b/JY.Inspection/JY.Inspection.csproj @@ -177,6 +177,7 @@ + @@ -190,8 +191,6 @@ - - Form diff --git a/JY.Inspection/Enums/EnumAutority.cs b/JY.Model/Enums/EnumAutority.cs similarity index 95% rename from JY.Inspection/Enums/EnumAutority.cs rename to JY.Model/Enums/EnumAutority.cs index 007c839..53fcda7 100644 --- a/JY.Inspection/Enums/EnumAutority.cs +++ b/JY.Model/Enums/EnumAutority.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace JY.Inspection.Enums +namespace JY.Model.Enums { /// /// 用户权限 diff --git a/JY.Model/Enums/EnumResultType.cs b/JY.Model/Enums/EnumResultType.cs new file mode 100644 index 0000000..86c1c70 --- /dev/null +++ b/JY.Model/Enums/EnumResultType.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JY.Model.Enums +{ + /// + /// 结果类型 + /// + public enum EnumResultType + { + /// + /// 全部 + /// + [Description("全部")] + All = 0, + + /// + /// OK + /// + [Description("OK")] + OK = 1, + + /// + /// NG + /// + [Description("NG")] + NG = 2 + } +} diff --git a/JY.Model/Enums/EnumSearchType.cs b/JY.Model/Enums/EnumSearchType.cs new file mode 100644 index 0000000..be86836 --- /dev/null +++ b/JY.Model/Enums/EnumSearchType.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JY.Model.Enums +{ + /// + /// 查询类型 + /// + public enum EnumSearchType + { + /// + /// 查询进站数据 + /// + [Description("查询进站数据")] + ArrivalStation = 0, + + [Description("查询出站数据")] + ExitStation = 1, + + //[Description("查询结果数据")] + //ProductResult = 2, + + //None = 3, + } +} diff --git a/JY.Model/Enums/EnumUpMesStatus.cs b/JY.Model/Enums/EnumUpMesStatus.cs new file mode 100644 index 0000000..d80386a --- /dev/null +++ b/JY.Model/Enums/EnumUpMesStatus.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JY.Model.Enums +{ + /// + /// 上传MES状态 + /// + public enum EnumUpMesStatus + { + [Description("全部")] + All, + + [Description("自动上传")] + Auto, + + [Description("手动上传")] + Manual, + + [Description("未上传")] + None + } +} diff --git a/JY.Model/JY.Model.csproj b/JY.Model/JY.Model.csproj index 4256fb6..56fde9a 100644 --- a/JY.Model/JY.Model.csproj +++ b/JY.Model/JY.Model.csproj @@ -82,6 +82,10 @@ + + + +