限制NG为98

This commit is contained in:
liming 蔡
2026-08-11 18:57:20 +08:00
parent 25f2ae3d44
commit 3ea4e4fd7b
3 changed files with 39 additions and 36 deletions
+2 -2
View File
@@ -1957,7 +1957,7 @@ namespace JinYuan.ControlCenters
var channels = CommonMethods.mesConfig.ChannelConfig.Channels; var channels = CommonMethods.mesConfig.ChannelConfig.Channels;
var ngChanel = channels.FirstOrDefault(x => x.Gears.Contains("NG")); var ngChanel = channels.FirstOrDefault(x => x.Gears.Contains("NG"));
int ngVal = ngChanel == null ? 97 : ngChanel.DefaultValue; int ngVal = ngChanel == null ? 98 : ngChanel.DefaultValue;
try try
{ {
@@ -2044,7 +2044,7 @@ namespace JinYuan.ControlCenters
else else
{ {
list[i].Remark = $"出站条码[{list[i].BarCode}]外观检OK分档,MES断连"; list[i].Remark = $"出站条码[{list[i].BarCode}]外观检OK分档,MES断连";
listGradeResult[i] = 97; //(short)26; listGradeResult[i] = 98; //(short)26;
// list[i].Result = "MES NG"; // list[i].Result = "MES NG";
CommonMethods.PlcLink.WriteValue("D80", 1, Data_Type.Short); CommonMethods.PlcLink.WriteValue("D80", 1, Data_Type.Short);
//反馈MES结果 //反馈MES结果
+25 -25
View File
@@ -29,6 +29,7 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.panel1 = new JinYuan.ControlLib.PanelExt(); this.panel1 = new JinYuan.ControlLib.PanelExt();
this.label7 = new System.Windows.Forms.Label();
this.btnRemoveGear = new System.Windows.Forms.Button(); this.btnRemoveGear = new System.Windows.Forms.Button();
this.listBoxGears = new System.Windows.Forms.ListBox(); this.listBoxGears = new System.Windows.Forms.ListBox();
this.numChannelId = new System.Windows.Forms.NumericUpDown(); this.numChannelId = new System.Windows.Forms.NumericUpDown();
@@ -44,7 +45,6 @@
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numChannelId)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numChannelId)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numDefaultValue)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numDefaultValue)).BeginInit();
@@ -82,6 +82,16 @@
this.panel1.TabIndex = 0; this.panel1.TabIndex = 0;
this.panel1.TopGap = 0; this.panel1.TopGap = 0;
// //
// label7
//
this.label7.AutoSize = true;
this.label7.ForeColor = System.Drawing.Color.DarkGray;
this.label7.Location = new System.Drawing.Point(882, 133);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(62, 21);
this.label7.TabIndex = 20;
this.label7.Text = "98: NG";
//
// btnRemoveGear // btnRemoveGear
// //
this.btnRemoveGear.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(3)))), ((int)(((byte)(27)))), ((int)(((byte)(78))))); this.btnRemoveGear.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(3)))), ((int)(((byte)(27)))), ((int)(((byte)(78)))));
@@ -101,11 +111,11 @@
this.listBoxGears.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(14)))), ((int)(((byte)(23)))), ((int)(((byte)(38))))); this.listBoxGears.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(14)))), ((int)(((byte)(23)))), ((int)(((byte)(38)))));
this.listBoxGears.ForeColor = System.Drawing.Color.White; this.listBoxGears.ForeColor = System.Drawing.Color.White;
this.listBoxGears.FormattingEnabled = true; this.listBoxGears.FormattingEnabled = true;
this.listBoxGears.ItemHeight = 27; this.listBoxGears.ItemHeight = 21;
this.listBoxGears.Location = new System.Drawing.Point(674, 213); this.listBoxGears.Location = new System.Drawing.Point(674, 213);
this.listBoxGears.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.listBoxGears.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.listBoxGears.Name = "listBoxGears"; this.listBoxGears.Name = "listBoxGears";
this.listBoxGears.Size = new System.Drawing.Size(289, 247); this.listBoxGears.Size = new System.Drawing.Size(289, 235);
this.listBoxGears.TabIndex = 18; this.listBoxGears.TabIndex = 18;
this.listBoxGears.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listBoxGears_MouseDoubleClick); this.listBoxGears.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listBoxGears_MouseDoubleClick);
// //
@@ -115,7 +125,7 @@
this.numChannelId.Location = new System.Drawing.Point(674, 60); this.numChannelId.Location = new System.Drawing.Point(674, 60);
this.numChannelId.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.numChannelId.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.numChannelId.Name = "numChannelId"; this.numChannelId.Name = "numChannelId";
this.numChannelId.Size = new System.Drawing.Size(180, 34); this.numChannelId.Size = new System.Drawing.Size(180, 29);
this.numChannelId.TabIndex = 17; this.numChannelId.TabIndex = 17;
// //
// listBoxChannels // listBoxChannels
@@ -123,11 +133,11 @@
this.listBoxChannels.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(14)))), ((int)(((byte)(23)))), ((int)(((byte)(38))))); this.listBoxChannels.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(14)))), ((int)(((byte)(23)))), ((int)(((byte)(38)))));
this.listBoxChannels.ForeColor = System.Drawing.Color.White; this.listBoxChannels.ForeColor = System.Drawing.Color.White;
this.listBoxChannels.FormattingEnabled = true; this.listBoxChannels.FormattingEnabled = true;
this.listBoxChannels.ItemHeight = 27; this.listBoxChannels.ItemHeight = 21;
this.listBoxChannels.Location = new System.Drawing.Point(69, 62); this.listBoxChannels.Location = new System.Drawing.Point(69, 62);
this.listBoxChannels.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.listBoxChannels.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.listBoxChannels.Name = "listBoxChannels"; this.listBoxChannels.Name = "listBoxChannels";
this.listBoxChannels.Size = new System.Drawing.Size(367, 517); this.listBoxChannels.Size = new System.Drawing.Size(367, 508);
this.listBoxChannels.TabIndex = 16; this.listBoxChannels.TabIndex = 16;
this.listBoxChannels.SelectedIndexChanged += new System.EventHandler(this.listBoxChannels_SelectedIndexChanged); this.listBoxChannels.SelectedIndexChanged += new System.EventHandler(this.listBoxChannels_SelectedIndexChanged);
// //
@@ -136,7 +146,7 @@
this.numDefaultValue.Location = new System.Drawing.Point(674, 126); this.numDefaultValue.Location = new System.Drawing.Point(674, 126);
this.numDefaultValue.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.numDefaultValue.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.numDefaultValue.Name = "numDefaultValue"; this.numDefaultValue.Name = "numDefaultValue";
this.numDefaultValue.Size = new System.Drawing.Size(180, 34); this.numDefaultValue.Size = new System.Drawing.Size(180, 29);
this.numDefaultValue.TabIndex = 15; this.numDefaultValue.TabIndex = 15;
this.numDefaultValue.ValueChanged += new System.EventHandler(this.numDefaultValue_ValueChanged); this.numDefaultValue.ValueChanged += new System.EventHandler(this.numDefaultValue_ValueChanged);
this.numDefaultValue.Validating += new System.ComponentModel.CancelEventHandler(this.numDefaultValue_Validating); this.numDefaultValue.Validating += new System.ComponentModel.CancelEventHandler(this.numDefaultValue_Validating);
@@ -187,7 +197,7 @@
this.txtNewGear.Location = new System.Drawing.Point(674, 579); this.txtNewGear.Location = new System.Drawing.Point(674, 579);
this.txtNewGear.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.txtNewGear.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtNewGear.Name = "txtNewGear"; this.txtNewGear.Name = "txtNewGear";
this.txtNewGear.Size = new System.Drawing.Size(148, 34); this.txtNewGear.Size = new System.Drawing.Size(148, 29);
this.txtNewGear.TabIndex = 10; this.txtNewGear.TabIndex = 10;
// //
// label6 // label6
@@ -197,7 +207,7 @@
this.label6.Location = new System.Drawing.Point(552, 579); this.label6.Location = new System.Drawing.Point(552, 579);
this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label6.Name = "label6"; this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(92, 27); this.label6.Size = new System.Drawing.Size(74, 21);
this.label6.TabIndex = 9; this.label6.TabIndex = 9;
this.label6.Text = "新增档位"; this.label6.Text = "新增档位";
// //
@@ -208,7 +218,7 @@
this.label5.Location = new System.Drawing.Point(543, 198); this.label5.Location = new System.Drawing.Point(543, 198);
this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label5.Name = "label5"; this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(92, 27); this.label5.Size = new System.Drawing.Size(74, 21);
this.label5.TabIndex = 7; this.label5.TabIndex = 7;
this.label5.Text = "档位列表"; this.label5.Text = "档位列表";
// //
@@ -220,7 +230,7 @@
this.label4.Location = new System.Drawing.Point(528, 126); this.label4.Location = new System.Drawing.Point(528, 126);
this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(107, 27); this.label4.Size = new System.Drawing.Size(87, 21);
this.label4.TabIndex = 5; this.label4.TabIndex = 5;
this.label4.Text = "PLC档位值"; this.label4.Text = "PLC档位值";
// //
@@ -231,7 +241,7 @@
this.label3.Location = new System.Drawing.Point(563, 62); this.label3.Location = new System.Drawing.Point(563, 62);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(72, 27); this.label3.Size = new System.Drawing.Size(58, 21);
this.label3.TabIndex = 3; this.label3.TabIndex = 3;
this.label3.Text = "通道号"; this.label3.Text = "通道号";
// //
@@ -242,7 +252,7 @@
this.label2.Location = new System.Drawing.Point(669, 19); this.label2.Location = new System.Drawing.Point(669, 19);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(92, 27); this.label2.Size = new System.Drawing.Size(74, 21);
this.label2.TabIndex = 2; this.label2.TabIndex = 2;
this.label2.Text = "通道详情"; this.label2.Text = "通道详情";
// //
@@ -253,23 +263,13 @@
this.label1.Location = new System.Drawing.Point(64, 19); this.label1.Location = new System.Drawing.Point(64, 19);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(92, 27); this.label1.Size = new System.Drawing.Size(74, 21);
this.label1.TabIndex = 1; this.label1.TabIndex = 1;
this.label1.Text = "通道列表"; this.label1.Text = "通道列表";
// //
// label7
//
this.label7.AutoSize = true;
this.label7.ForeColor = System.Drawing.Color.DarkGray;
this.label7.Location = new System.Drawing.Point(882, 133);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(292, 27);
this.label7.TabIndex = 20;
this.label7.Text = "98: 扫码NG(不允许在界面配置)";
//
// FrmChannelCfg // FrmChannelCfg
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 27F); this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(14)))), ((int)(((byte)(23)))), ((int)(((byte)(38))))); this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(14)))), ((int)(((byte)(23)))), ((int)(((byte)(38)))));
this.ClientSize = new System.Drawing.Size(1204, 752); this.ClientSize = new System.Drawing.Size(1204, 752);
+12 -9
View File
@@ -81,11 +81,14 @@ namespace LargeSquareOne
// 保存 // 保存
private void btnSave_Click(object sender, EventArgs e) private void btnSave_Click(object sender, EventArgs e)
{ {
// 更新当前通道数据 var errList = _config.Channels.Where(x => x.AllContent.Contains("NG") && x.DefaultValue != 98).ToList();
if (_currentChannel != null) if (errList.Count > 0)
{ {
_currentChannel.DefaultValue = (int)numDefaultValue.Value; var errArr = errList.Select(it => it.DefaultValue).ToArray();
MessageBox.Show($"NG写给PLC的值必须为98,不能为{string.Join(",", errArr)}");
return;
} }
CommonMethods.SaveToJson(CommonMethods.ChannelPath, _config); CommonMethods.SaveToJson(CommonMethods.ChannelPath, _config);
MessageBox.Show("保存成功!"); MessageBox.Show("保存成功!");
} }
@@ -122,12 +125,12 @@ namespace LargeSquareOne
private void numDefaultValue_Validating(object sender, CancelEventArgs e) private void numDefaultValue_Validating(object sender, CancelEventArgs e)
{ {
if ((int)numDefaultValue.Value == 98) //if ((int)numDefaultValue.Value == 98)
{ //{
MessageBox.Show("98: 扫码NG(不允许在界面配置)"); // MessageBox.Show("98: 扫码NG(不允许在界面配置)");
e.Cancel = true; // e.Cancel = true;
return; // return;
} //}
} }
} }
} }