出站数据处理
This commit is contained in:
@@ -22,5 +22,25 @@ namespace JY.Inspection.Common
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<float> GetListFloat(int Num)
|
||||
{
|
||||
List<float> list = new List<float>();
|
||||
for (int i = 0; i < Num; i++)
|
||||
{
|
||||
list.Add(1);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<int> GetListInt(int Num)
|
||||
{
|
||||
List<int> list = new List<int>();
|
||||
for (int i = 0; i < Num; i++)
|
||||
{
|
||||
list.Add(1);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JY.Inspection
|
||||
{
|
||||
public class ConstValue
|
||||
{
|
||||
/// <summary>
|
||||
/// CCD的OK/NG数量
|
||||
/// </summary>
|
||||
//public const int CCD_SCount = 16;
|
||||
public const string CCD_OK = "OK";
|
||||
public const string CCD_NG = "NG";
|
||||
|
||||
public static readonly Dictionary<string, string> CCD_SDict = new Dictionary<string, string>()
|
||||
{
|
||||
{ "CCD1", "正面侧面_3D" },
|
||||
{ "CCD2", "正面侧面_2D" },
|
||||
{ "CCD3", "正面底面棱_3D" },
|
||||
{ "CCD4", "后面右侧面_2D" },
|
||||
{ "CCD5", "后面底面棱_3D" },
|
||||
{ "CCD6", "极柱面_3D" },
|
||||
{ "CCD7", "极柱面_2D" },
|
||||
{ "CCD8", "底面_3D" },
|
||||
{ "CCD9", "底面_2D" },
|
||||
{ "CCD10", "左中间棱_3D" },
|
||||
{ "CCD11", "右中间棱_3D" },
|
||||
{ "CCD12", "防爆阀_2D" },
|
||||
{ "CCD13", "左右极柱_2D" },
|
||||
{ "CCD14", "L胶检测结果" },
|
||||
{ "CCD15", "二维码等级判定结果" }
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// CCD的浮点数数量
|
||||
/// </summary>
|
||||
//public const int CCD_FCount = 3;
|
||||
|
||||
public static readonly Dictionary<string, string> CCD_FDict = new Dictionary<string, string>()
|
||||
{
|
||||
{ "CCDF1", "大面平面度" },
|
||||
{ "CCDF2", "侧面平面度" },
|
||||
{ "CCDF3", "底面平面度" }
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// CCD的整数数量
|
||||
/// </summary>
|
||||
//public const int CCD_ICount = 6;
|
||||
|
||||
public static readonly Dictionary<string, string> CCD_IDict = new Dictionary<string, string>()
|
||||
{
|
||||
{ "CCDI1", "通道" },
|
||||
{ "CCDI2", "下面凹坑数量" },
|
||||
{ "CCDI3", "前面凹坑数量" },
|
||||
{ "CCDI4", "后面凹坑数量" },
|
||||
{ "CCDI5", "左面凹坑数量" },
|
||||
{ "CCDI6", "右面凹坑数量" }
|
||||
};
|
||||
}
|
||||
}
|
||||
+726
-454
File diff suppressed because it is too large
Load Diff
Generated
+1
-300
@@ -83,31 +83,6 @@ namespace JY.Inspection
|
||||
this.txtlog = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.dgvDataShow_B = new JY.Inspection.GridViewBuff();
|
||||
this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column31 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column26 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column27 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column25 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column12 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column13 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column14 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column15 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column16 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column17 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column18 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column19 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column20 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column21 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column23 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column28 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column29 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column22 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column24 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.dgvDataShow_A = new JY.Inspection.GridViewBuff();
|
||||
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
@@ -667,32 +642,6 @@ namespace JY.Inspection
|
||||
this.dgvDataShow_B.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
|
||||
this.dgvDataShow_B.ColumnHeadersHeight = 29;
|
||||
this.dgvDataShow_B.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
|
||||
this.dgvDataShow_B.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.Column6,
|
||||
this.Column8,
|
||||
this.Column31,
|
||||
this.Column26,
|
||||
this.Column7,
|
||||
this.Column27,
|
||||
this.Column25,
|
||||
this.Column9,
|
||||
this.Column10,
|
||||
this.Column11,
|
||||
this.Column12,
|
||||
this.Column13,
|
||||
this.Column14,
|
||||
this.Column15,
|
||||
this.Column16,
|
||||
this.Column17,
|
||||
this.Column18,
|
||||
this.Column19,
|
||||
this.Column20,
|
||||
this.Column21,
|
||||
this.Column23,
|
||||
this.Column28,
|
||||
this.Column29,
|
||||
this.Column22,
|
||||
this.Column24});
|
||||
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||
dataGridViewCellStyle2.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
@@ -726,230 +675,6 @@ namespace JY.Inspection
|
||||
this.dgvDataShow_B.TabIndex = 0;
|
||||
this.dgvDataShow_B.RowPrePaint += new System.Windows.Forms.DataGridViewRowPrePaintEventHandler(this.dgvDataShow_B_RowPrePaint);
|
||||
//
|
||||
// Column6
|
||||
//
|
||||
this.Column6.DataPropertyName = "TD";
|
||||
this.Column6.HeaderText = "序号";
|
||||
this.Column6.MinimumWidth = 6;
|
||||
this.Column6.Name = "Column6";
|
||||
this.Column6.ReadOnly = true;
|
||||
this.Column6.Width = 52;
|
||||
//
|
||||
// Column8
|
||||
//
|
||||
this.Column8.DataPropertyName = "WorkShift";
|
||||
this.Column8.HeaderText = "班次";
|
||||
this.Column8.MinimumWidth = 6;
|
||||
this.Column8.Name = "Column8";
|
||||
this.Column8.ReadOnly = true;
|
||||
this.Column8.Width = 52;
|
||||
//
|
||||
// Column31
|
||||
//
|
||||
this.Column31.DataPropertyName = "TDGroup";
|
||||
this.Column31.HeaderText = "主道";
|
||||
this.Column31.MinimumWidth = 8;
|
||||
this.Column31.Name = "Column31";
|
||||
this.Column31.ReadOnly = true;
|
||||
this.Column31.Width = 52;
|
||||
//
|
||||
// Column26
|
||||
//
|
||||
this.Column26.DataPropertyName = "ArrivalBarCode";
|
||||
this.Column26.HeaderText = "入站条码";
|
||||
this.Column26.MinimumWidth = 8;
|
||||
this.Column26.Name = "Column26";
|
||||
this.Column26.ReadOnly = true;
|
||||
this.Column26.Width = 64;
|
||||
//
|
||||
// Column7
|
||||
//
|
||||
this.Column7.DataPropertyName = "DepartureBarCode";
|
||||
this.Column7.HeaderText = "出站条码";
|
||||
this.Column7.MinimumWidth = 6;
|
||||
this.Column7.Name = "Column7";
|
||||
this.Column7.ReadOnly = true;
|
||||
this.Column7.Width = 64;
|
||||
//
|
||||
// Column27
|
||||
//
|
||||
this.Column27.DataPropertyName = "TMDB";
|
||||
this.Column27.HeaderText = "条码对比";
|
||||
this.Column27.MinimumWidth = 8;
|
||||
this.Column27.Name = "Column27";
|
||||
this.Column27.ReadOnly = true;
|
||||
this.Column27.Width = 64;
|
||||
//
|
||||
// Column25
|
||||
//
|
||||
this.Column25.DataPropertyName = "OutTime";
|
||||
this.Column25.HeaderText = "出站时间";
|
||||
this.Column25.MinimumWidth = 6;
|
||||
this.Column25.Name = "Column25";
|
||||
this.Column25.ReadOnly = true;
|
||||
this.Column25.Width = 64;
|
||||
//
|
||||
// Column9
|
||||
//
|
||||
this.Column9.DataPropertyName = "CCD1";
|
||||
this.Column9.HeaderText = "正面(2D/3D)";
|
||||
this.Column9.MinimumWidth = 6;
|
||||
this.Column9.Name = "Column9";
|
||||
this.Column9.ReadOnly = true;
|
||||
this.Column9.Width = 86;
|
||||
//
|
||||
// Column10
|
||||
//
|
||||
this.Column10.DataPropertyName = "CCD2";
|
||||
this.Column10.HeaderText = "反面(2D/3D)";
|
||||
this.Column10.MinimumWidth = 6;
|
||||
this.Column10.Name = "Column10";
|
||||
this.Column10.ReadOnly = true;
|
||||
this.Column10.Width = 86;
|
||||
//
|
||||
// Column11
|
||||
//
|
||||
this.Column11.DataPropertyName = "CCD3";
|
||||
this.Column11.HeaderText = "左侧面(2D/3D)";
|
||||
this.Column11.MinimumWidth = 6;
|
||||
this.Column11.Name = "Column11";
|
||||
this.Column11.ReadOnly = true;
|
||||
this.Column11.Width = 98;
|
||||
//
|
||||
// Column12
|
||||
//
|
||||
this.Column12.DataPropertyName = "CCD4";
|
||||
this.Column12.HeaderText = "右侧面(2D/3D)";
|
||||
this.Column12.MinimumWidth = 6;
|
||||
this.Column12.Name = "Column12";
|
||||
this.Column12.ReadOnly = true;
|
||||
this.Column12.Width = 98;
|
||||
//
|
||||
// Column13
|
||||
//
|
||||
this.Column13.DataPropertyName = "CCD5";
|
||||
this.Column13.HeaderText = "顶面(2D/3D)";
|
||||
this.Column13.MinimumWidth = 6;
|
||||
this.Column13.Name = "Column13";
|
||||
this.Column13.ReadOnly = true;
|
||||
this.Column13.Width = 86;
|
||||
//
|
||||
// Column14
|
||||
//
|
||||
this.Column14.DataPropertyName = "CCD6";
|
||||
this.Column14.HeaderText = "底面(2D/3D)";
|
||||
this.Column14.MinimumWidth = 6;
|
||||
this.Column14.Name = "Column14";
|
||||
this.Column14.ReadOnly = true;
|
||||
this.Column14.Width = 86;
|
||||
//
|
||||
// Column15
|
||||
//
|
||||
this.Column15.DataPropertyName = "CCD7";
|
||||
this.Column15.HeaderText = "底棱边WE1";
|
||||
this.Column15.MinimumWidth = 6;
|
||||
this.Column15.Name = "Column15";
|
||||
this.Column15.ReadOnly = true;
|
||||
this.Column15.Width = 85;
|
||||
//
|
||||
// Column16
|
||||
//
|
||||
this.Column16.DataPropertyName = "CCD8";
|
||||
this.Column16.HeaderText = "底棱边WE2";
|
||||
this.Column16.MinimumWidth = 6;
|
||||
this.Column16.Name = "Column16";
|
||||
this.Column16.ReadOnly = true;
|
||||
this.Column16.Width = 85;
|
||||
//
|
||||
// Column17
|
||||
//
|
||||
this.Column17.DataPropertyName = "CCD9";
|
||||
this.Column17.HeaderText = "底棱边WE3";
|
||||
this.Column17.MinimumWidth = 6;
|
||||
this.Column17.Name = "Column17";
|
||||
this.Column17.ReadOnly = true;
|
||||
this.Column17.Width = 85;
|
||||
//
|
||||
// Column18
|
||||
//
|
||||
this.Column18.DataPropertyName = "CCD10";
|
||||
this.Column18.HeaderText = "底棱边WE4";
|
||||
this.Column18.MinimumWidth = 6;
|
||||
this.Column18.Name = "Column18";
|
||||
this.Column18.ReadOnly = true;
|
||||
this.Column18.Width = 85;
|
||||
//
|
||||
// Column19
|
||||
//
|
||||
this.Column19.DataPropertyName = "CCD11";
|
||||
this.Column19.HeaderText = "中棱边ME1";
|
||||
this.Column19.MinimumWidth = 6;
|
||||
this.Column19.Name = "Column19";
|
||||
this.Column19.ReadOnly = true;
|
||||
this.Column19.Width = 84;
|
||||
//
|
||||
// Column20
|
||||
//
|
||||
this.Column20.DataPropertyName = "CCD12";
|
||||
this.Column20.HeaderText = "中棱边ME2";
|
||||
this.Column20.MinimumWidth = 6;
|
||||
this.Column20.Name = "Column20";
|
||||
this.Column20.ReadOnly = true;
|
||||
this.Column20.Width = 84;
|
||||
//
|
||||
// Column21
|
||||
//
|
||||
this.Column21.DataPropertyName = "CCD13";
|
||||
this.Column21.HeaderText = "中棱边ME3";
|
||||
this.Column21.MinimumWidth = 6;
|
||||
this.Column21.Name = "Column21";
|
||||
this.Column21.ReadOnly = true;
|
||||
this.Column21.Width = 84;
|
||||
//
|
||||
// Column23
|
||||
//
|
||||
this.Column23.DataPropertyName = "CCD14";
|
||||
this.Column23.HeaderText = "中棱边ME4";
|
||||
this.Column23.MinimumWidth = 6;
|
||||
this.Column23.Name = "Column23";
|
||||
this.Column23.ReadOnly = true;
|
||||
this.Column23.Width = 84;
|
||||
//
|
||||
// Column28
|
||||
//
|
||||
this.Column28.DataPropertyName = "CCD15";
|
||||
this.Column28.HeaderText = "极柱(POS/NEG)";
|
||||
this.Column28.MinimumWidth = 8;
|
||||
this.Column28.Name = "Column28";
|
||||
this.Column28.ReadOnly = true;
|
||||
//
|
||||
// Column29
|
||||
//
|
||||
this.Column29.DataPropertyName = "CCD16";
|
||||
this.Column29.HeaderText = "防爆阀(PRO)";
|
||||
this.Column29.MinimumWidth = 8;
|
||||
this.Column29.Name = "Column29";
|
||||
this.Column29.ReadOnly = true;
|
||||
this.Column29.Width = 89;
|
||||
//
|
||||
// Column22
|
||||
//
|
||||
this.Column22.DataPropertyName = "Result";
|
||||
this.Column22.HeaderText = "综合结果";
|
||||
this.Column22.MinimumWidth = 6;
|
||||
this.Column22.Name = "Column22";
|
||||
this.Column22.ReadOnly = true;
|
||||
this.Column22.Width = 64;
|
||||
//
|
||||
// Column24
|
||||
//
|
||||
this.Column24.DataPropertyName = "Remark";
|
||||
this.Column24.HeaderText = "备注";
|
||||
this.Column24.MinimumWidth = 6;
|
||||
this.Column24.Name = "Column24";
|
||||
this.Column24.ReadOnly = true;
|
||||
this.Column24.Width = 52;
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.dgvDataShow_A);
|
||||
@@ -2416,31 +2141,7 @@ namespace JY.Inspection
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column4;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column5;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column6;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column8;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column31;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column26;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column7;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column27;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column25;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column9;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column10;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column11;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column12;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column13;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column14;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column15;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column16;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column17;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column18;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column19;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column20;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column21;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column23;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column28;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column29;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column22;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column24;
|
||||
|
||||
private System.Windows.Forms.TextBox txtTensionStrapCCD1;
|
||||
private MetroFramework.Controls.MetroLabel metroLabel5;
|
||||
private System.Windows.Forms.TextBox txtTensionStrapCCD4;
|
||||
|
||||
@@ -194,6 +194,7 @@
|
||||
<Compile Include="Common\ConnectionClient.cs" />
|
||||
<Compile Include="Common\DGShowMsg.cs" />
|
||||
<Compile Include="Common\DateTimeSynchronization.cs" />
|
||||
<Compile Include="ConstValue.cs" />
|
||||
<Compile Include="Entity\AlarmStatus.cs" />
|
||||
<Compile Include="Frm\FormMesGradingSet.cs">
|
||||
<SubType>Form</SubType>
|
||||
|
||||
@@ -160,6 +160,29 @@ namespace JY.Model
|
||||
[Name("防爆阀(PRO)结果1")]
|
||||
[SugarColumn(ColumnName = "CCD16")]
|
||||
public string CCD16 { set; get; }
|
||||
|
||||
#region CCD浮点数结果
|
||||
public float CCDF1 { get; set; }
|
||||
|
||||
public float CCDF2 { get; set; }
|
||||
|
||||
public float CCDF3 { get; set; }
|
||||
#endregion
|
||||
|
||||
#region CCD整数结果
|
||||
public int CCDI1 { get; set; }
|
||||
|
||||
public int CCDI2 { get; set; }
|
||||
|
||||
public int CCDI3 { get; set; }
|
||||
|
||||
public string CCDI4 { get; set; }
|
||||
|
||||
public string CCDI5 { get; set; }
|
||||
|
||||
public string CCDI6 { get; set; }
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 综合结果
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
import re
|
||||
|
||||
file_path = r'd:\CodeProject\1440\JY.Inspection\HomeForm.cs'
|
||||
|
||||
with open(file_path, 'r', encoding='utf-8-sig') as f:
|
||||
content = f.read()
|
||||
|
||||
# Define the old method block (from doc comment to closing brace)
|
||||
old_pattern = r''' /// <summary>
|
||||
/// 结果判断
|
||||
/// </summary>
|
||||
/// <param name="list"></param>
|
||||
/// <param name="NGType"></param>
|
||||
/// <param name="strBoiData"></param>
|
||||
private short GetResult\(BlankingData m, ref string strErr,ref List<short> lstError\)
|
||||
\{
|
||||
short res = 0;
|
||||
|
||||
strErr = "";
|
||||
#region 判断各项参数
|
||||
//入站条码判断
|
||||
bool IsBarInOK = !m\.ArrivalBarCode\.Contains\("ERROR"\);
|
||||
//出站条码判断
|
||||
bool IsBarOK = !m\.DepartureBarCode\.Contains\("ERROR"\);
|
||||
//判断条码是否一致
|
||||
bool bBar = true;
|
||||
if \(m\.ArrivalBarCode\.Trim\(\) != m\.DepartureBarCode\.Trim\(\)\)
|
||||
bBar = false;
|
||||
m\.TMDB = bBar \? "OK" : "NG";
|
||||
|
||||
// CCD判断
|
||||
bool isAllCCD = true;
|
||||
foreach \(var propName in ConstValue\.CCD_SDict\.Keys\)
|
||||
\{
|
||||
if \(BlankingDataProps\.TryGetValue\(propName, out var prop\)\)
|
||||
\{
|
||||
string result = prop\.GetValue\(m\)\.ToString\(\);
|
||||
|
||||
if \(result != "OK"\)
|
||||
\{
|
||||
isAllCCD = false;
|
||||
\}
|
||||
\}
|
||||
\}
|
||||
|
||||
bool\[\] b0 = new bool\[16\] \{ true, true, true, true, true, true, true, true, true, true, true, true, true, true,true,true \};
|
||||
b0\[0\] = m\.CCD1 == "OK" \? true : false;
|
||||
b0\[1\] = m\.CCD2 == "OK" \? true : false;
|
||||
b0\[2\] = m\.CCD3 == "OK" \? true : false;
|
||||
b0\[3\] = m\.CCD4 == "OK" \? true : false;
|
||||
b0\[4\] = m\.CCD5 == "OK" \? true : false;
|
||||
b0\[5\] = m\.CCD6 == "OK" \? true : false;
|
||||
b0\[6\] = m\.CCD7 == "OK" \? true : false;
|
||||
b0\[7\] = m\.CCD8 == "OK" \? true : false;
|
||||
b0\[8\] = m\.CCD9 == "OK" \? true : false;
|
||||
b0\[9\] = m\.CCD10 == "OK" \? true : false;
|
||||
b0\[10\] = m\.CCD11 == "OK" \? true : false;
|
||||
b0\[11\] = m\.CCD12 == "OK" \? true : false;
|
||||
b0\[12\] = m\.CCD13 == "OK" \? true : false;
|
||||
b0\[13\] = m\.CCD14 == "OK" \? true : false;
|
||||
b0\[14\] = m\.CCD15 == "OK" \? true : false;
|
||||
b0\[15\] = m\.CCD16 == "OK" \? true : false;
|
||||
#endregion
|
||||
|
||||
|
||||
#region
|
||||
if \( IsBarOK && bBar && b0\[0\] && b0\[1\] && b0\[2\] && b0\[3\] && b0\[4\] && b0\[5\] && b0\[6\] && b0\[7\] && b0\[8\] && b0\[9\] && b0\[10\] && b0\[11\] && b0\[12\] && b0\[13\] && b0\[14\] && b0\[15\]\)
|
||||
\{
|
||||
strErr = "良品";
|
||||
res = 1;
|
||||
lstError\.Add\(res\);
|
||||
return 1;
|
||||
\}.*?return 0;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
\}'''
|
||||
|
||||
new_method = ''' /// <summary>
|
||||
/// 检验结果错误类型
|
||||
/// </summary>
|
||||
private enum InspectionErrorType
|
||||
{
|
||||
ScanError,
|
||||
BarcodeMismatch,
|
||||
CcdError
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检验错误项
|
||||
/// </summary>
|
||||
private class InspectionError
|
||||
{
|
||||
public InspectionErrorType Type { get; set; }
|
||||
public string Description { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CCD检测项名称(索引0-15对应CCD1-CCD16)
|
||||
/// </summary>
|
||||
private static readonly string[] CcdDefectNames = {
|
||||
"正面(2D/3D)不良", "反面(2D/3D)不良", "左侧面(2D/3D)不良", "右侧面(2D/3D)不良",
|
||||
"顶面(2D/3D)不良", "底面(2D/3D)不良", "底WE1不良", "底WE2不良",
|
||||
"底WE3不良", "底WE4不良", "中ME1不良", "中ME2不良",
|
||||
"中ME3不良", "中ME4不良", "极柱(POS/NEG)不良", "防爆阀(PRO)不良"
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 结果判断:检查条码和CCD结果,返回错误列表(空列表=良品)
|
||||
/// </summary>
|
||||
/// <param name="m">出站数据实体</param>
|
||||
/// <returns>错误列表,空列表表示良品</returns>
|
||||
private List<InspectionError> GetResult(BlankingData m, ref string strErr)
|
||||
{
|
||||
var errors = new List<InspectionError>();
|
||||
strErr = "";
|
||||
|
||||
// 1. 条码检查
|
||||
bool isBarOK = !m.DepartureBarCode.Contains("ERROR");
|
||||
bool isBarcodeMatch = m.ArrivalBarCode.Trim() == m.DepartureBarCode.Trim();
|
||||
m.TMDB = isBarcodeMatch ? "OK" : "NG";
|
||||
|
||||
// 2. CCD结果检查
|
||||
var ccdValues = new[] {
|
||||
m.CCD1, m.CCD2, m.CCD3, m.CCD4, m.CCD5, m.CCD6, m.CCD7, m.CCD8,
|
||||
m.CCD9, m.CCD10, m.CCD11, m.CCD12, m.CCD13, m.CCD14, m.CCD15, m.CCD16
|
||||
};
|
||||
bool allCcdOk = Array.TrueForAll(ccdValues, v => v == "OK");
|
||||
|
||||
// 3. 全部通过 = 良品
|
||||
if (isBarOK && isBarcodeMatch && allCcdOk)
|
||||
{
|
||||
strErr = "良品";
|
||||
return errors;
|
||||
}
|
||||
|
||||
// 4. 分类收集错误
|
||||
if (!isBarOK)
|
||||
{
|
||||
errors.Add(new InspectionError
|
||||
{
|
||||
Type = InspectionErrorType.ScanError,
|
||||
Description = $"出站扫码不良,出站条码:{m.DepartureBarCode}"
|
||||
});
|
||||
}
|
||||
|
||||
if (!isBarcodeMatch)
|
||||
{
|
||||
errors.Add(new InspectionError
|
||||
{
|
||||
Type = InspectionErrorType.BarcodeMismatch,
|
||||
Description = "入站与出站条码不一致"
|
||||
});
|
||||
}
|
||||
|
||||
for (int i = 0; i < ccdValues.Length; i++)
|
||||
{
|
||||
if (ccdValues[i] != "OK")
|
||||
{
|
||||
errors.Add(new InspectionError
|
||||
{
|
||||
Type = InspectionErrorType.CcdError,
|
||||
Description = CcdDefectNames[i]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
strErr = string.Join(";", errors.Select(e => e.Description));
|
||||
return errors;
|
||||
}'''
|
||||
|
||||
# Use DOTALL to match across lines
|
||||
new_content = re.sub(old_pattern, new_method, content, flags=re.DOTALL)
|
||||
|
||||
if new_content == content:
|
||||
print("ERROR: Pattern not found!")
|
||||
# Try to find partial matches
|
||||
if '结果判断' in content:
|
||||
print("Found '结果判断' in content")
|
||||
if 'private short GetResult' in content:
|
||||
print("Found 'private short GetResult' in content")
|
||||
if '防爆阀(PRO)不良' in content:
|
||||
print("Found '防爆阀(PRO)不良' in content")
|
||||
# Check for the exact method signature
|
||||
idx = content.find('private short GetResult')
|
||||
if idx >= 0:
|
||||
print(f"Found at index {idx}")
|
||||
print(f"Context: {repr(content[idx:idx+100])}")
|
||||
else:
|
||||
with open(file_path, 'w', encoding='utf-8-sig') as f:
|
||||
f.write(new_content)
|
||||
print("SUCCESS: Method replaced!")
|
||||
print(f"Old content length: {len(content)}")
|
||||
print(f"New content length: {len(new_content)}")
|
||||
Reference in New Issue
Block a user