This commit is contained in:
ldw
2025-08-12 14:03:37 +08:00
parent e6f5b275fc
commit 1e9f1052d5
13 changed files with 682 additions and 48 deletions
+70 -36
View File
@@ -256,6 +256,23 @@ namespace JinYuan.ControlCenters
}
return Result;
}
private int JudgmentWGJResult(int A, int[,] B, int C)
{
int Result = 1;
OK_NG = "OK";
for (int i = 0; i < 28; i++)
{
if (B[C,i] ==1)
{
//1OK,2扫码NG,3MES反馈NG,4其他NG
Result = 4;
OK_NG = "NG";
NG_Type += $"外观检测NG{i + 1}";
}
}
return Result;
}
#region 上料工位(数据处理)
/// <summary>
/// 上料工位
@@ -1801,38 +1818,39 @@ namespace JinYuan.ControlCenters
//不良代码判定
List<string> NGcodeList = new List<string>();
NGcodeList = NGcode(m.list_Data1[i, 10], m.list_Data1[i, 11], m.list_Data1[i, 12], m.list_Data1[i, 15], m.list_Data1[i, 26], m.list_Data1[i, 16]
, m.list_Data1[i, 17], m.list_Data1[i, 18], m.list_Data1[i, 19], m.list_Data1[i, 23], m.list_Data1[i, 24], m.list_Data1[i, 25], m.list_Data1[i, 27]);
//NGcodeList = NGcode(m.list_Data1[i, 10], m.list_Data1[i, 11], m.list_Data1[i, 12], m.list_Data1[i, 15], m.list_Data1[i, 26], m.list_Data1[i, 16]
// , m.list_Data1[i, 17], m.list_Data1[i, 18], m.list_Data1[i, 19], m.list_Data1[i, 23], m.list_Data1[i, 24], m.list_Data1[i, 25], m.list_Data1[i, 27]);
NGcodeList = NGWGJcode(m.list_Data1,i);
//电芯CCD判定结果
#region //电芯CCD判定结果
m.CCDResult1 = m.CCD_Data[i, 0] == 0 ? "OK" : (m.CCD_Data[i, 0] == 1 ? "NG" : "缺图");
m.CCDResult2 = m.CCD_Data[i, 1] == 0 ? "OK" : (m.CCD_Data[i, 1] == 1 ? "NG" : "缺图");
m.CCDResult3 = m.CCD_Data[i, 2] == 0 ? "OK" : (m.CCD_Data[i, 2] == 1 ? "NG" : "缺图");
m.CCDResult4 = m.CCD_Data[i, 3] == 0 ? "OK" : (m.CCD_Data[i, 3] == 1 ? "NG" : "缺图");
m.CCDResult5 = m.CCD_Data[i, 4] == 0 ? "OK" : (m.CCD_Data[i, 4] == 1 ? "NG" : "缺图");
m.CCDResult6 = m.CCD_Data[i, 5] == 0 ? "OK" : (m.CCD_Data[i, 5] == 1 ? "NG" : "缺图");
m.CCDResult7 = m.CCD_Data[i, 6] == 0 ? "OK" : (m.CCD_Data[i, 6] == 1 ? "NG" : "缺图");
m.CCDResult8 = m.CCD_Data[i, 7] == 0 ? "OK" : (m.CCD_Data[i, 7] == 1 ? "NG" : "缺图");
m.CCDResult9 = m.CCD_Data[i, 8] == 0 ? "OK" : (m.CCD_Data[i, 8] == 1 ? "NG" : "缺图");
m.CCDResult10 = m.CCD_Data[i, 9] == 0 ? "OK" : (m.CCD_Data[i, 9] == 1 ? "NG" : "缺图");
m.CCDResult11 = m.CCD_Data[i, 10] == 0 ? "OK" : (m.CCD_Data[i, 10] == 1 ? "NG" : "缺图");
m.CCDResult12 = m.CCD_Data[i, 11] == 0 ? "OK" : (m.CCD_Data[i, 11] == 1 ? "NG" : "缺图");
m.CCDResult13 = m.CCD_Data[i, 12] == 0 ? "OK" : (m.CCD_Data[i, 12] == 1 ? "NG" : "缺图");
m.CCDResult14 = m.CCD_Data[i, 13] == 0 ? "OK" : (m.CCD_Data[i, 13] == 1 ? "NG" : "缺图");
m.CCDResult15 = m.CCD_Data[i, 14] == 0 ? "OK" : (m.CCD_Data[i, 14] == 1 ? "NG" : "缺图");
m.CCDResult16 = m.CCD_Data[i, 15] == 0 ? "OK" : (m.CCD_Data[i, 15] == 1 ? "NG" : "缺图");
m.CCDResult17 = m.CCD_Data[i, 16] == 0 ? "OK" : (m.CCD_Data[i, 16] == 1 ? "NG" : "缺图");
m.CCDResult18 = m.CCD_Data[i, 17] == 0 ? "OK" : (m.CCD_Data[i, 17] == 1 ? "NG" : "缺图");
m.CCDResult19 = m.CCD_Data[i, 18] == 0 ? "OK" : (m.CCD_Data[i, 18] == 1 ? "NG" : "缺图");
m.CCDResult20 = m.CCD_Data[i, 19] == 0 ? "OK" : (m.CCD_Data[i, 19] == 1 ? "NG" : "缺图");
m.CCDResult21 = m.CCD_Data[i, 20] == 0 ? "OK" : (m.CCD_Data[i, 20] == 1 ? "NG" : "缺图");
m.CCDResult22 = m.CCD_Data[i, 21] == 0 ? "OK" : (m.CCD_Data[i, 21] == 1 ? "NG" : "缺图");
m.CCDResult23 = m.CCD_Data[i, 22] == 0 ? "OK" : (m.CCD_Data[i, 22] == 1 ? "NG" : "缺图");
m.CCDResult24 = m.CCD_Data[i, 23] == 0 ? "OK" : (m.CCD_Data[i, 23] == 1 ? "NG" : "缺图");
m.CCDResult25 = m.CCD_Data[i, 24] == 0 ? "OK" : (m.CCD_Data[i, 24] == 1 ? "NG" : "缺图");
m.CCDResult26 = m.CCD_Data[i, 25] == 0 ? "OK" : (m.CCD_Data[i, 25] == 1 ? "NG" : "缺图");
m.CCDResult27 = m.CCD_Data[i, 26] == 0 ? "OK" : (m.CCD_Data[i, 26] == 1 ? "NG" : "缺图");
#region //电芯CCD判定结果 1 0K 0NG 2缺图
m.CCDResult1 = m.CCD_Data[i, 0] == 1 ? "OK" : (m.CCD_Data[i, 0] == 0 ? "NG" : "缺图");
m.CCDResult2 = m.CCD_Data[i, 1] == 1 ? "OK" : (m.CCD_Data[i, 1] == 0 ? "NG" : "缺图");
m.CCDResult3 = m.CCD_Data[i, 2] == 1 ? "OK" : (m.CCD_Data[i, 2] == 0 ? "NG" : "缺图");
m.CCDResult4 = m.CCD_Data[i, 3] == 1 ? "OK" : (m.CCD_Data[i, 3] == 0 ? "NG" : "缺图");
m.CCDResult5 = m.CCD_Data[i, 4] == 1 ? "OK" : (m.CCD_Data[i, 4] == 0 ? "NG" : "缺图");
m.CCDResult6 = m.CCD_Data[i, 5] == 1 ? "OK" : (m.CCD_Data[i, 5] == 0 ? "NG" : "缺图");
m.CCDResult7 = m.CCD_Data[i, 6] == 1 ? "OK" : (m.CCD_Data[i, 6] == 0 ? "NG" : "缺图");
m.CCDResult8 = m.CCD_Data[i, 7] == 1 ? "OK" : (m.CCD_Data[i, 7] == 0 ? "NG" : "缺图");
m.CCDResult9 = m.CCD_Data[i, 8] == 1 ? "OK" : (m.CCD_Data[i, 8] == 0 ? "NG" : "缺图");
m.CCDResult10 = m.CCD_Data[i, 9] == 1 ? "OK" : (m.CCD_Data[i, 9] == 0 ? "NG" : "缺图");
m.CCDResult11 = m.CCD_Data[i, 10] == 1 ? "OK" : (m.CCD_Data[i, 10] == 0 ? "NG" : "缺图");
m.CCDResult12 = m.CCD_Data[i, 11] == 1 ? "OK" : (m.CCD_Data[i, 11] == 0 ? "NG" : "缺图");
m.CCDResult13 = m.CCD_Data[i, 12] == 1 ? "OK" : (m.CCD_Data[i, 12] == 0 ? "NG" : "缺图");
m.CCDResult14 = m.CCD_Data[i, 13] == 1 ? "OK" : (m.CCD_Data[i, 13] == 0 ? "NG" : "缺图");
m.CCDResult15 = m.CCD_Data[i, 14] == 1 ? "OK" : (m.CCD_Data[i, 14] == 0 ? "NG" : "缺图");
m.CCDResult16 = m.CCD_Data[i, 15] == 1 ? "OK" : (m.CCD_Data[i, 15] == 0 ? "NG" : "缺图");
m.CCDResult17 = m.CCD_Data[i, 16] == 1 ? "OK" : (m.CCD_Data[i, 16] == 0 ? "NG" : "缺图");
m.CCDResult18 = m.CCD_Data[i, 17] == 1 ? "OK" : (m.CCD_Data[i, 17] == 0 ? "NG" : "缺图");
m.CCDResult19 = m.CCD_Data[i, 18] == 1 ? "OK" : (m.CCD_Data[i, 18] == 0 ? "NG" : "缺图");
m.CCDResult20 = m.CCD_Data[i, 19] == 1 ? "OK" : (m.CCD_Data[i, 19] == 0 ? "NG" : "缺图");
m.CCDResult21 = m.CCD_Data[i, 20] == 1 ? "OK" : (m.CCD_Data[i, 20] == 0 ? "NG" : "缺图");
m.CCDResult22 = m.CCD_Data[i, 21] == 1 ? "OK" : (m.CCD_Data[i, 21] == 0 ? "NG" : "缺图");
m.CCDResult23 = m.CCD_Data[i, 22] == 1 ? "OK" : (m.CCD_Data[i, 22] == 0 ? "NG" : "缺图");
m.CCDResult24 = m.CCD_Data[i, 23] == 1 ? "OK" : (m.CCD_Data[i, 23] == 0 ? "NG" : "缺图");
m.CCDResult25 = m.CCD_Data[i, 24] == 1 ? "OK" : (m.CCD_Data[i, 24] == 0 ? "NG" : "缺图");
m.CCDResult26 = m.CCD_Data[i, 25] == 1 ? "OK" : (m.CCD_Data[i, 25] == 0 ? "NG" : "缺图");
m.CCDResult27 = m.CCD_Data[i, 26] == 1 ? "OK" : (m.CCD_Data[i, 26] == 0 ? "NG" : "缺图");
#endregion
m.CSBYHASCANNINGTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
@@ -1851,9 +1869,10 @@ namespace JinYuan.ControlCenters
{
for (int ii = 0; ii < 27; ii++)
{
if (m.CCD_Data[i, ii] != 0)
if (m.CCD_Data[i, ii] != 1)
{
MyRes[i] = m.CCD_Data[i, ii];
//1OK,2扫码NG,3MES反馈NG,4其他NG
MyRes[i] = 4;
break;
}
@@ -1861,7 +1880,7 @@ namespace JinYuan.ControlCenters
}
else
MyRes[i] = 1;
//MyRes[i] = JudgmentResult(Code_NG, m.CCD_Data);
MyRes[i] = JudgmentWGJResult(Code_NG, m.CCD_Data,i);
m.Result = MyRes[i];
@@ -2008,11 +2027,12 @@ namespace JinYuan.ControlCenters
#endregion
JYResult result1 = null;
JYResult result2 = null;
JYResult result3 = null;
if (pf.IsFeedbackPlc)
{
//result1 = CommonMethods.PlcLink.WriteValue(pf.VarList[2].VarAddress, MyRes[0], Data_Type.Short);//判断结果写入PLC
//result2 = CommonMethods.PlcLink.WriteValue(pf.VarList[3].VarAddress, MyRes[1], Data_Type.Short);//判断结果写入PLC
//if (CommonMethods.sysConfig.OKSwitching)
// if (CommonMethods.sysConfig.OKSwitching)
{
//调试发OK
//MyRes[0] = 1;
@@ -2020,7 +2040,7 @@ namespace JinYuan.ControlCenters
Thread.Sleep(500);
result1 = CommonMethods.PlcLink.WriteValue(pf.VarList[2].VarAddress, MyRes[0], Data_Type.Short);//判断结果写入PLC
result2 = CommonMethods.PlcLink.WriteValue(pf.VarList[3].VarAddress, MyRes[1], Data_Type.Short);//判断结果写入PLC
result2 = CommonMethods.PlcLink.WriteValue(pf.VarList[4].VarAddress, MyRes[2], Data_Type.Short);//判断结果写入PLC
result3 = CommonMethods.PlcLink.WriteValue(pf.VarList[4].VarAddress, MyRes[2], Data_Type.Short);//判断结果写入PLC
}
//else
//{
@@ -2030,7 +2050,7 @@ namespace JinYuan.ControlCenters
// result2 = CommonMethods.PlcLink.WriteValue(pf.VarList[3].VarAddress, MyRes[1], Data_Type.Short);//判断结果写入PLC
//}
}
JYResult result3 = CommonMethods.PlcLink.WriteValue(pf.VarList[0].VarAddress, 0);//置位0
JYResult result4 = CommonMethods.PlcLink.WriteValue(pf.VarList[0].VarAddress, 0);//置位0
CommonMethods.AddDataMonitorLog(0, $"发送信息给PLC:{result1.IsSuccess},{MyRes[0]},{MyRes[1]},{MyRes[2]}");
LoggerHelp.WriteLog($"发送信息给PLC:{result1.IsSuccess},{MyRes[0]},{MyRes[1]},{MyRes[2]}");
@@ -2212,6 +2232,20 @@ namespace JinYuan.ControlCenters
return NGcodelist;
}
//下料不良代码 外观检
public List<string> NGWGJcode(short[ ,] lstResult,int index)
{
List<string> NGcodelist = new List<string>();
for (int i = 0; i < 28; i++)
{
if(lstResult[index,i] == 2)
{
NGcodelist.Add("WGJA00"+(i+1));
}
}
return NGcodelist;
}
#endregion
#region NG下料不良代码