TODO 上传结果参数给MES
This commit is contained in:
@@ -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;
|
||||
/// <summary>
|
||||
/// 用于电芯进站时设备与FMS校验电芯合法性
|
||||
@@ -44,7 +48,153 @@ namespace JY.Inspection.Frm
|
||||
{
|
||||
InitializeComponent();
|
||||
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>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// dgvCellMouseClick鼠标点击列事件
|
||||
/// </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
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user