TODO 上传结果参数给MES

This commit is contained in:
liming 蔡
2026-07-17 20:21:57 +08:00
parent 682de34ff5
commit 1ff8f70bcb
10 changed files with 321 additions and 52 deletions
@@ -1,4 +1,5 @@
using JY.Inspection.Common; using JY.Inspection.Common;
using JY.Model.Enums;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
+1
View File
@@ -2,6 +2,7 @@
using JY.Inspection.Mes; using JY.Inspection.Mes;
using JY.MES.Entity; using JY.MES.Entity;
using JY.MES.MES; using JY.MES.MES;
using JY.Model.Enums;
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
+199 -13
View File
@@ -12,6 +12,10 @@ using JY.MES.Entity;
using JY.MES; using JY.MES;
using OfficeOpenXml; using OfficeOpenXml;
using MiniExcelLibs; using MiniExcelLibs;
using System.Collections.Generic;
using JY.Inspection.Enums;
using JY.Model.Enums;
using JY.Model;
namespace JY.Inspection.Frm namespace JY.Inspection.Frm
{ {
@@ -20,8 +24,8 @@ namespace JY.Inspection.Frm
public delegate void myDelegate(DataTable t); public delegate void myDelegate(DataTable t);
public delegate void PDelegate(); public delegate void PDelegate();
Thread tSo; Thread tSo;
int type = 0;//查询类型 //int type = 0;//查询类型
int resulttype = 0;//结果类型 //int resulttype = 0;//结果类型
DataTable dts = null; DataTable dts = null;
/// <summary> /// <summary>
/// 用于电芯进站时设备与FMS校验电芯合法性 /// 用于电芯进站时设备与FMS校验电芯合法性
@@ -44,7 +48,153 @@ namespace JY.Inspection.Frm
{ {
InitializeComponent(); InitializeComponent();
CheckForIllegalCrossThreadCalls = false; CheckForIllegalCrossThreadCalls = false;
InitCombobox();
} }
private void InitCombobox()
{
#region 初始化查询类型列表
var selectItems = new List<ComboItem>()
{
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<ComboItem>()
{
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<ComboItem>()
{
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<EnumSearchType>();
}));
}
else
{
var curItem = cbSelectType.SelectedItem as ComboItem;
curEnum = curItem.Value.ToEnum<EnumSearchType>();
}
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<EnumResultType>();
}));
}
else
{
var curItem = resultSelectType.SelectedItem as ComboItem;
curEnum = curItem.Value.ToEnum<EnumResultType>();
}
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<EnumUpMesStatus>();
}));
}
else
{
var curItem = cmbFlag.SelectedItem as ComboItem;
curEnum = curItem.Value.ToEnum<EnumUpMesStatus>();
}
return curEnum;
}
}
#endregion
/// <summary> /// <summary>
/// 窗体加载事件 /// 窗体加载事件
/// </summary> /// </summary>
@@ -88,35 +238,37 @@ namespace JY.Inspection.Frm
return; return;
} }
this.dgvData.DataSource = null; this.dgvData.DataSource = null;
type = cbSelectType.SelectedIndex; //type = cbSelectType.SelectedIndex;
resulttype = resultSelectType.SelectedIndex; //resulttype = resultSelectType.SelectedIndex;
} }
private void ThreadWork() 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 strDate1 = dtStartTime.Value.ToString("yyyy-MM-dd HH:mm") + ":01";
string strDate2 = dtEndTime.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) if (dtEndTime.Value.Year != dtStartTime.Value.Year)
{ {
MessageBox.Show("请选择日期必须在同一年份内!"); MessageBox.Show("请选择日期必须在同一年份内!");
lblSelectStures.BeginInvoke(new PDelegate(bb)); lblSelectStures.BeginInvoke(new PDelegate(SearchEnd));
return; return;
} }
string flag = cmbFlag.Text; string flag = cmbFlag.Text;
string strBarcode = txtBarCode.Text.Trim(); string strBarcode = txtBarCode.Text.Trim();
// var dt = dbHelper.GetTestData(type, strBarcode, strDate1, strDate2, flag); // 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) if (dt == null || dt.Rows.Count == 0)
{ {
MessageBox.Show("此时间段无数据或无此条码数据", "系统提示"); MessageBox.Show("此时间段无数据或无此条码数据", "系统提示");
lblSelectStures.BeginInvoke(new PDelegate(bb)); lblSelectStures.BeginInvoke(new PDelegate(SearchEnd));
return; return;
} }
this.dgvData.BeginInvoke(new myDelegate(FillData), new object[] { dt });//异步调用(来填充) 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; this.dgvData.DataSource = dt.DefaultView;
} }
private void aa() private void SearchBegin()
{ {
this.lblSelectStures.Text = "正在查询数据..."; this.lblSelectStures.Text = "正在查询数据...";
} }
private void bb()
private void SearchEnd()
{ {
this.lblSelectStures.Text = "查询结束"; this.lblSelectStures.Text = "查询结束";
} }
private void btnExcel_Click(object sender, EventArgs e) private void btnExcel_Click(object sender, EventArgs e)
{ {
if (dts != null && dgvData.Columns.Count <= 0) if (dts != null && dgvData.Columns.Count <= 0)
@@ -210,7 +362,7 @@ namespace JY.Inspection.Frm
} }
try try
{ {
if (cbSelectType.Text=="查询进站数据")//上料 if (cbSelectType.Text == "查询进站数据")//上料
{ {
foreach (DataGridViewRow row in dgvData.Rows) foreach (DataGridViewRow row in dgvData.Rows)
{ {
@@ -262,6 +414,7 @@ namespace JY.Inspection.Frm
} }
else else
{ {
// TODO 获取出站数据上传MES
JY.MES.FMS.FMS_Out fMS_Out = new MES.FMS.FMS_Out(); JY.MES.FMS.FMS_Out fMS_Out = new MES.FMS.FMS_Out();
//fMS_In.deviceCode = Global.systemConfig.eqp_code; //fMS_In.deviceCode = Global.systemConfig.eqp_code;
//fMS_In.houseCode = "test11"; //fMS_In.houseCode = "test11";
@@ -322,6 +475,13 @@ namespace JY.Inspection.Frm
} }
private BlankingData GetBlankingData(DataGridViewRow row)
{
// TODO 获取BlankingData
return null;
}
/// <summary> /// <summary>
/// dgvCellMouseClick鼠标点击列事件 /// dgvCellMouseClick鼠标点击列事件
/// </summary> /// </summary>
@@ -345,5 +505,31 @@ namespace JY.Inspection.Frm
} }
} }
} }
private class ComboItem
{
/// <summary>
/// 实际值
/// </summary>
public int Value { get; set; }
/// <summary>
/// 显示值
/// </summary>
public string Text { get; set; }
}
private void cbSelectType_SelectedIndexChanged(object sender, EventArgs e)
{
if (CurSearchType == EnumSearchType.ExitStation)
{
btnUpMES.Visible = true;
}
else
{
btnUpMES.Visible = false;
}
}
} }
} }
+24 -35
View File
@@ -43,6 +43,8 @@ namespace JY.Inspection.Frm
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.dgvData = new MetroFramework.Controls.MetroGrid(); this.dgvData = new MetroFramework.Controls.MetroGrid();
this.groupBox1 = new System.Windows.Forms.GroupBox(); 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.metroLabel5 = new MetroFramework.Controls.MetroLabel();
this.btnUpMES = new MetroFramework.Controls.MetroButton(); this.btnUpMES = new MetroFramework.Controls.MetroButton();
this.cmbFlag = new MetroFramework.Controls.MetroComboBox(); this.cmbFlag = new MetroFramework.Controls.MetroComboBox();
@@ -50,8 +52,6 @@ namespace JY.Inspection.Frm
this.dtStartTime = new System.Windows.Forms.DateTimePicker(); this.dtStartTime = new System.Windows.Forms.DateTimePicker();
this.lblSelectStures = new System.Windows.Forms.Label(); this.lblSelectStures = new System.Windows.Forms.Label();
this.metroLabel2 = new MetroFramework.Controls.MetroLabel(); this.metroLabel2 = new MetroFramework.Controls.MetroLabel();
this.resultSelectType = new MetroFramework.Controls.MetroComboBox();
this.metroLabel6 = new MetroFramework.Controls.MetroLabel();
this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvData)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvData)).BeginInit();
this.groupBox1.SuspendLayout(); 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.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.cbSelectType.FormattingEnabled = true; this.cbSelectType.FormattingEnabled = true;
this.cbSelectType.ItemHeight = 23; this.cbSelectType.ItemHeight = 23;
this.cbSelectType.Items.AddRange(new object[] {
"查询进站数据",
"查询出站数据"});
this.cbSelectType.Location = new System.Drawing.Point(7, 252); this.cbSelectType.Location = new System.Drawing.Point(7, 252);
this.cbSelectType.Name = "cbSelectType"; this.cbSelectType.Name = "cbSelectType";
this.cbSelectType.Size = new System.Drawing.Size(193, 29); this.cbSelectType.Size = new System.Drawing.Size(193, 29);
this.cbSelectType.TabIndex = 12; this.cbSelectType.TabIndex = 12;
this.cbSelectType.UseSelectable = true; this.cbSelectType.UseSelectable = true;
this.cbSelectType.SelectedIndexChanged += new System.EventHandler(this.cbSelectType_SelectedIndexChanged);
// //
// tableLayoutPanel1 // tableLayoutPanel1
// //
@@ -243,6 +241,26 @@ namespace JY.Inspection.Frm
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "查询条件"; 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 // metroLabel5
// //
this.metroLabel5.AutoSize = true; this.metroLabel5.AutoSize = true;
@@ -269,11 +287,6 @@ namespace JY.Inspection.Frm
this.cmbFlag.FormattingEnabled = true; this.cmbFlag.FormattingEnabled = true;
this.cmbFlag.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.cmbFlag.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.cmbFlag.ItemHeight = 23; this.cmbFlag.ItemHeight = 23;
this.cmbFlag.Items.AddRange(new object[] {
"全部",
"自动上传MES数据",
"手动上传MES数据",
"未上传MES数据"});
this.cmbFlag.Location = new System.Drawing.Point(6, 447); this.cmbFlag.Location = new System.Drawing.Point(6, 447);
this.cmbFlag.Name = "cmbFlag"; this.cmbFlag.Name = "cmbFlag";
this.cmbFlag.Size = new System.Drawing.Size(192, 29); this.cmbFlag.Size = new System.Drawing.Size(192, 29);
@@ -305,7 +318,7 @@ namespace JY.Inspection.Frm
// lblSelectStures // lblSelectStures
// //
this.lblSelectStures.AutoSize = true; 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.Name = "lblSelectStures";
this.lblSelectStures.Size = new System.Drawing.Size(0, 12); this.lblSelectStures.Size = new System.Drawing.Size(0, 12);
this.lblSelectStures.TabIndex = 15; this.lblSelectStures.TabIndex = 15;
@@ -319,30 +332,6 @@ namespace JY.Inspection.Frm
this.metroLabel2.TabIndex = 5; this.metroLabel2.TabIndex = 5;
this.metroLabel2.Text = "查询结束时间:"; 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 // FrmHistoricalDataQuery
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+1 -2
View File
@@ -177,6 +177,7 @@
<Compile Include="Common\ByteUtil.cs" /> <Compile Include="Common\ByteUtil.cs" />
<Compile Include="Common\CollectionUtil.cs" /> <Compile Include="Common\CollectionUtil.cs" />
<Compile Include="Common\CSVHelper.cs" /> <Compile Include="Common\CSVHelper.cs" />
<Compile Include="Common\EnumExtension.cs" />
<Compile Include="Common\MessageTip.cs" /> <Compile Include="Common\MessageTip.cs" />
<Compile Include="Common\MessageBoxTimeOut.cs" /> <Compile Include="Common\MessageBoxTimeOut.cs" />
<Compile Include="Common\AlarmForm.cs" /> <Compile Include="Common\AlarmForm.cs" />
@@ -190,8 +191,6 @@
<Compile Include="Common\DGShowMsg.cs" /> <Compile Include="Common\DGShowMsg.cs" />
<Compile Include="Common\DateTimeSynchronization.cs" /> <Compile Include="Common\DateTimeSynchronization.cs" />
<Compile Include="Entity\AlarmStatus.cs" /> <Compile Include="Entity\AlarmStatus.cs" />
<Compile Include="Enums\EnumAutority.cs" />
<Compile Include="Enums\EnumExtension.cs" />
<Compile Include="Frm\FormMesGradingSet.cs"> <Compile Include="Frm\FormMesGradingSet.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@@ -5,7 +5,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace JY.Inspection.Enums namespace JY.Model.Enums
{ {
/// <summary> /// <summary>
/// 用户权限 /// 用户权限
+33
View File
@@ -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
{
/// <summary>
/// 结果类型
/// </summary>
public enum EnumResultType
{
/// <summary>
/// 全部
/// </summary>
[Description("全部")]
All = 0,
/// <summary>
/// OK
/// </summary>
[Description("OK")]
OK = 1,
/// <summary>
/// NG
/// </summary>
[Description("NG")]
NG = 2
}
}
+29
View File
@@ -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
{
/// <summary>
/// 查询类型
/// </summary>
public enum EnumSearchType
{
/// <summary>
/// 查询进站数据
/// </summary>
[Description("查询进站数据")]
ArrivalStation = 0,
[Description("查询出站数据")]
ExitStation = 1,
//[Description("查询结果数据")]
//ProductResult = 2,
//None = 3,
}
}
+27
View File
@@ -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
{
/// <summary>
/// 上传MES状态
/// </summary>
public enum EnumUpMesStatus
{
[Description("全部")]
All,
[Description("自动上传")]
Auto,
[Description("手动上传")]
Manual,
[Description("未上传")]
None
}
}
+4
View File
@@ -82,6 +82,10 @@
<Compile Include="DB.Entity\SystemConfig.cs" /> <Compile Include="DB.Entity\SystemConfig.cs" />
<Compile Include="DB.Entity\FeedingData.cs" /> <Compile Include="DB.Entity\FeedingData.cs" />
<Compile Include="DB.Entity\TrayTestEntry.cs" /> <Compile Include="DB.Entity\TrayTestEntry.cs" />
<Compile Include="Enums\EnumAutority.cs" />
<Compile Include="Enums\EnumResultType.cs" />
<Compile Include="Enums\EnumSearchType.cs" />
<Compile Include="Enums\EnumUpMesStatus.cs" />
<Compile Include="Excel\CollectItemCfg.cs" /> <Compile Include="Excel\CollectItemCfg.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>