分档
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
|
||||
using JinYuan.CommunicationLib.Enum;
|
||||
using JinYuan.CommunicationLib.Interface;
|
||||
using JinYuan.DataConvertLib;
|
||||
using JinYuan.Helper;
|
||||
using JinYuan.MES.Enums;
|
||||
@@ -342,9 +343,9 @@ namespace JinYuan.ControlCenters
|
||||
//解析数据
|
||||
//1257 3个条码
|
||||
List<AGearEntity> list = new List<AGearEntity>();//实体
|
||||
List<string> listBarCode = GetList<string>(3, "");//电芯条码
|
||||
List<string> listBarCode = GetList<string>(6, "");//电芯条码
|
||||
//List<string> listNum = GetList<string>(1, "");//进站磁悬浮动子编号
|
||||
List<short> listRes = GetList<short>(3, 0);//进站电芯反馈结果
|
||||
List<short> listRes = GetList<short>(6, 0);//进站电芯反馈结果
|
||||
|
||||
byte[] bytes = bArrays.Content.ByteReverse();//高低位转换
|
||||
|
||||
@@ -360,13 +361,15 @@ namespace JinYuan.ControlCenters
|
||||
listBarCode[0] = StringLib.GetStringFromByteArrayByEncoding(bytes, 0, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim();
|
||||
listBarCode[1] = StringLib.GetStringFromByteArrayByEncoding(bytes, 40, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim();
|
||||
listBarCode[2] = StringLib.GetStringFromByteArrayByEncoding(bytes, 80, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim();
|
||||
|
||||
listBarCode[3] = StringLib.GetStringFromByteArrayByEncoding(bytes, 120, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim();
|
||||
listBarCode[4] = StringLib.GetStringFromByteArrayByEncoding(bytes, 160, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim();
|
||||
listBarCode[5] = StringLib.GetStringFromByteArrayByEncoding(bytes, 200, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim();
|
||||
//listBarCode[0] = "TEST";
|
||||
//listBarCode[1] = "TEST";
|
||||
//listBarCode[2] = "TEST";
|
||||
//listBarCode[3] = "TEST";
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
//有无条码标志
|
||||
int CodeFlag = 1;
|
||||
@@ -543,7 +546,7 @@ namespace JinYuan.ControlCenters
|
||||
//CommonMethods.PlcLink.WriteInt16("D2100", listRes[0]);//调试结果OK写入PLC
|
||||
if (result != null)
|
||||
{
|
||||
string strres = $"外观检工位发送给PLC: D2100={listRes[0]},D2101={listRes[1]},D2102={listRes[2]},";
|
||||
string strres = $"分档工位发送给PLC: D2100={listRes[0]},D2101={listRes[1]},D2102={listRes[2]},";
|
||||
CommonMethods.AddDataMonitorLog(0, strres);
|
||||
}
|
||||
|
||||
@@ -1777,54 +1780,43 @@ namespace JinYuan.ControlCenters
|
||||
#region 数据变量定义
|
||||
List<BGearEntity> list = new List<BGearEntity>();//实体
|
||||
//int[] MyRes = new int[2];//AB反馈结果
|
||||
int[] MyRes = new int[3];//三个外观检测反馈结果
|
||||
int[] MyRes = new int[6];//6个外观检测反馈结果
|
||||
#endregion
|
||||
//高低位转换
|
||||
byte[] bytes = bArrays.Content.ByteReverse();
|
||||
byte[] bytes1 = bArrays.Content;
|
||||
|
||||
List<string> listBarCode = GetList<string>(3, "");//电芯条码
|
||||
List<string> listBarCode = GetList<string>(6, "");//电芯条码
|
||||
//List<string> listNum = GetList<string>(1, "");//进站磁悬浮动子编号
|
||||
List<short> listRes = GetList<short>(3, 0);//出站电芯反馈结果
|
||||
List<short> listRes = GetList<short>(6, 0);//出站电芯反馈结果
|
||||
List<short> listGradeResult = GetList<short>(6, 0);//grading plc 数字结果
|
||||
//反馈结果
|
||||
#region 电芯解析
|
||||
//电芯解析 从3200 开始
|
||||
listBarCode[0] = StringLib.GetStringFromByteArrayByEncoding(bytes, 0, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim();
|
||||
listBarCode[1] = StringLib.GetStringFromByteArrayByEncoding(bytes, 40, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim();
|
||||
listBarCode[2] = StringLib.GetStringFromByteArrayByEncoding(bytes, 80, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim();
|
||||
listBarCode[3] = StringLib.GetStringFromByteArrayByEncoding(bytes, 120, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim();
|
||||
listBarCode[4] = StringLib.GetStringFromByteArrayByEncoding(bytes, 160, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim();
|
||||
listBarCode[5] = StringLib.GetStringFromByteArrayByEncoding(bytes, 200, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim();
|
||||
#region 上传MES
|
||||
var lstBGearEntity = GetBlankingData(listBarCode);
|
||||
//D3200起
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
//读取bgearentity
|
||||
|
||||
try
|
||||
{
|
||||
BGearEntity m = new BGearEntity();
|
||||
AGearEntity TT = new AGearEntity();
|
||||
//极限件标志
|
||||
int ChallengeFlag = 0;
|
||||
//芯包信息1 D3300~D3326
|
||||
//芯包信息2 D3330~D3356
|
||||
//芯包信息3 D3360~D3386
|
||||
for (int j = 0; j < 16; j++)
|
||||
var bGearEntity = lstBGearEntity.OrderByDescending(x => x.CSBYHOUTSTATIONTIME).FirstOrDefault(x => x.BarCode == listBarCode[i]);
|
||||
if (bGearEntity != null)
|
||||
{
|
||||
m.CCD_Data[i, j] = ShortLib.GetShortFromByteArray(bArrays.Content, 200 + i * 30 * 2 + j * 2, DataFormat.CDAB);
|
||||
m = bGearEntity;
|
||||
}
|
||||
//厚度3400
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
m.Thickness_Data[i, j] = FloatLib.GetFloatFromByteArray(bArrays.Content, 400 + i * 30 * 2 + j * 4, DataFormat.CDAB);
|
||||
}
|
||||
//厚度plc 3500
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
m.Thickness_PLCData[i, j] = ShortLib.GetShortFromByteArray(bArrays.Content, 500 + i * 30 * 2 + j * 2, DataFormat.CDAB);
|
||||
}
|
||||
//不良ng编号4300
|
||||
for (int j = 0; j < 16; j++)
|
||||
{
|
||||
m.CCD_NgNo[i, j] = ShortLib.GetShortFromByteArray(bArrays.Content, 2200 + i * 30 * 2 + j * 2, DataFormat.CDAB);
|
||||
}
|
||||
|
||||
|
||||
//芯包扫码时间
|
||||
//m.ScanTime[i] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
@@ -1881,69 +1873,27 @@ namespace JinYuan.ControlCenters
|
||||
// var (NGcodeList, NGmessage) = NGWGJcode(m.CCD_Data, i);
|
||||
|
||||
//电芯CCD判定结果
|
||||
#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" : "缺图");
|
||||
#endregion
|
||||
#region //厚度判定结果
|
||||
m.ThicknessResult1 = m.Thickness_PLCData[i, 0] == 1 ? "OK" : (m.Thickness_PLCData[i, 0] == 0 ? "NG" : "缺测");
|
||||
m.ThicknessResult2 = m.Thickness_PLCData[i, 1] == 1 ? "OK" : (m.Thickness_PLCData[i, 1] == 0 ? "NG" : "缺测");
|
||||
m.ThicknessResult3 = m.Thickness_PLCData[i, 2] == 1 ? "OK" : (m.Thickness_PLCData[i, 2] == 0 ? "NG" : "缺测");
|
||||
#endregion
|
||||
|
||||
m.CSBYHASCANNINGTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
m.CSBYHPROCESSNAME = "外观检测";
|
||||
m.CSBYHPROCESSNAME = "分档";
|
||||
m.CSBYHSCHEDULE = CommonMethods.strClass;
|
||||
m.CSBYHINSTATIONTIME = m.ScanTime[0];
|
||||
m.CSBYHOUTSTATIONTIME = m.ScanTime[1];
|
||||
|
||||
m.Thickness1 = SaveTwoNum(m.Thickness_Data[i, 0]);
|
||||
m.Thickness2 = SaveTwoNum(m.Thickness_Data[i, 1]);
|
||||
m.Thickness3 = SaveTwoNum(m.Thickness_Data[i, 2]);
|
||||
|
||||
m.ChannelNo = i + 1;
|
||||
//条码,芯包重量,芯包侧厚,芯包CCD极性检测,电芯裁切粘连,电芯裁切毛刺,芯包焊印位置,
|
||||
//芯包正面极耳撕裂,芯包背面极耳撕裂,芯包正面极耳翻折,芯包背面极耳翻折
|
||||
if (Code_NG == 1)
|
||||
{
|
||||
for (int ii = 0; ii < 16; ii++)
|
||||
{
|
||||
if (m.CCD_Data[i, ii] != 1)
|
||||
{
|
||||
//1OK,2扫码NG,3MES反馈NG,4其他NG
|
||||
MyRes[i] = 4;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
MyRes[i] = 2;//扫码NG
|
||||
MyRes[i] = JudgmentCCDResult(Code_NG, m.CCD_Data,i);
|
||||
MyRes[i] = JudgmentThickNessResult(m.Thickness_PLCData, i, MyRes[i]);
|
||||
m.Result = MyRes[i];
|
||||
|
||||
m.CSBYHOUTSTATIONJUDGMENTRESULT = m.judgment_result[i] = OK_NG;
|
||||
|
||||
m.Remark += NG_Type;
|
||||
MyRes[i] = m.Result;
|
||||
|
||||
m.MaterialCode = CommonMethods.mesConfig.MaterialCode;
|
||||
NG_Type = "";//清除上一次不良字符串
|
||||
OK_NG = ""; //清除上一次结果
|
||||
|
||||
list.Add(m);
|
||||
|
||||
|
||||
string ur2 = CommonMethods.mesConfig.ResultProcessParamMesUrl;
|
||||
string siteCode1 = CommonMethods.mesConfig.siteCode;
|
||||
string lineCode1 = CommonMethods.mesConfig.lineCode;
|
||||
@@ -1953,85 +1903,91 @@ namespace JinYuan.ControlCenters
|
||||
MesUploadType unloadType = MesUploadType.DD;
|
||||
string Mesage = "";
|
||||
//加判断无条码不上传mes 1为有条码
|
||||
#region 发送结果MES ,本地存储
|
||||
if (Code_NG == 1)
|
||||
{
|
||||
string MesMessage = "";
|
||||
MesResType mesResType = MesResType.C;
|
||||
|
||||
if (CommonMethods.mesConfig.isUpMes)
|
||||
{
|
||||
string url = CommonMethods.mesConfig.OutStationMesUrl;
|
||||
string siteCode = CommonMethods.mesConfig.siteCode;
|
||||
string lineCode = CommonMethods.mesConfig.lineCode;
|
||||
string equipNum = CommonMethods.mesConfig.equipNum;
|
||||
string materialCode = CommonMethods.mesConfig.MaterialCode;
|
||||
string userName = CommonMethods.mesConfig.mesUserName;
|
||||
int type = 1;
|
||||
//int type = 1;
|
||||
//string materialLotCodeLocator = "";
|
||||
var (NGcodeList, NGmessage) = NGWGJcode(m.CCD_NgNo, i);
|
||||
bool Res = CommonMethods.hbgMes.OutboundInformations(url, siteCode, lineCode, equipNum, materialCode, userName, m, ref MesMessage, ref mesResType, NGcodeList, NGmessage);
|
||||
//bool Res = CommonMethods.hbgMes.SingleCellOutStation(url, siteCode, lineCode, equipNum, materialCode, userName, m,)
|
||||
if (MesMessage.Contains("发生一个或多个错误"))
|
||||
{
|
||||
MesMessage = "上传失败,";
|
||||
}
|
||||
else
|
||||
{
|
||||
m.Flag = 1;
|
||||
}
|
||||
if (Res)
|
||||
{
|
||||
//MES出站判定结果
|
||||
m.Result = MyRes[i];
|
||||
////芯包重量1判定结果
|
||||
//if (m.list_Data1[i, 10] == 2) { m.Remark += "芯包重量NG,"; }
|
||||
////芯包侧厚判定结果
|
||||
//if (m.list_Data1[i, 11] == 2) { m.Remark += "芯包侧厚NG,"; }
|
||||
////芯包CCD极性检测结果
|
||||
//if (m.list_Data1[i, 12] == 2) { m.Remark += "芯包CCD极性检测NG,"; }
|
||||
m.Remark += MesMessage;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (mesResType)
|
||||
{
|
||||
case MesResType.A:// 停线,设备报警停机
|
||||
//m.listRes[i] = 10;
|
||||
// m.Result = MyRes[i] = 2;
|
||||
m.Result = MyRes[i] = 3;
|
||||
m.Remark += "MES NG";
|
||||
break;
|
||||
case MesResType.B://不停机,MEs NG品要排出,要给PLC发NG信号
|
||||
//m.listRes[i] = 9;
|
||||
// m.Result = MyRes[i] = 2;
|
||||
m.Result = MyRes[i] = 3;
|
||||
m.Remark += "MES NG";
|
||||
break;
|
||||
case MesResType.C://可忽略
|
||||
//m.listRes[i] = 1;
|
||||
// m.Result = MyRes[i] = 2;
|
||||
m.Result = MyRes[i] = 1;
|
||||
m.Remark += "MES Alerm OK";
|
||||
break;
|
||||
case MesResType.D://可忽略
|
||||
//m.listRes[i] = 1;
|
||||
// m.Result = MyRes[i] = 2;
|
||||
m.Result = MyRes[i] = 1;
|
||||
m.Remark += "MES OK";
|
||||
break;
|
||||
default:
|
||||
m.Remark += "MES NG";
|
||||
m.Result = MyRes[i] = 3;
|
||||
break;
|
||||
}
|
||||
////芯包重量1判定结果
|
||||
//if (m.list_Data1[i, 10] == 2) { m.Remark += "芯包重量NG,"; }
|
||||
////芯包侧厚判定结果
|
||||
//if (m.list_Data1[i, 11] == 2) { m.Remark += "芯包侧厚NG,"; }
|
||||
////芯包CCD极性检测结果
|
||||
//if (m.list_Data1[i, 12] == 2) { m.Remark += "芯包CCD极性检测NG,"; }
|
||||
m.Remark += MesMessage;
|
||||
}
|
||||
#region 出站 分档取消出站
|
||||
////{
|
||||
//// string url = CommonMethods.mesConfig.OutStationMesUrl;
|
||||
//// string siteCode = CommonMethods.mesConfig.siteCode;
|
||||
//// string lineCode = CommonMethods.mesConfig.lineCode;
|
||||
//// string equipNum = CommonMethods.mesConfig.equipNum;
|
||||
//// string materialCode = CommonMethods.mesConfig.MaterialCode;
|
||||
//// string userName = CommonMethods.mesConfig.mesUserName;
|
||||
//// int type = 1;
|
||||
//// //int type = 1;
|
||||
//// //string materialLotCodeLocator = "";
|
||||
//// var (NGcodeList, NGmessage) = NGWGJcode(m.CCD_NgNo, i);
|
||||
//// bool Res = CommonMethods.hbgMes.OutboundInformations(url, siteCode, lineCode, equipNum, materialCode, userName, m, ref MesMessage, ref mesResType, NGcodeList, NGmessage);
|
||||
//// //bool Res = CommonMethods.hbgMes.SingleCellOutStation(url, siteCode, lineCode, equipNum, materialCode, userName, m,)
|
||||
//// if (MesMessage.Contains("发生一个或多个错误"))
|
||||
//// {
|
||||
//// MesMessage = "上传失败,";
|
||||
//// }
|
||||
//// else
|
||||
//// {
|
||||
//// m.Flag = 1;
|
||||
//// }
|
||||
//// if (Res)
|
||||
//// {
|
||||
//// //MES出站判定结果
|
||||
//// m.Result = MyRes[i];
|
||||
//// ////芯包重量1判定结果
|
||||
//// //if (m.list_Data1[i, 10] == 2) { m.Remark += "芯包重量NG,"; }
|
||||
//// ////芯包侧厚判定结果
|
||||
//// //if (m.list_Data1[i, 11] == 2) { m.Remark += "芯包侧厚NG,"; }
|
||||
//// ////芯包CCD极性检测结果
|
||||
//// //if (m.list_Data1[i, 12] == 2) { m.Remark += "芯包CCD极性检测NG,"; }
|
||||
//// m.Remark += MesMessage;
|
||||
//// }
|
||||
//// else
|
||||
//// {
|
||||
//// switch (mesResType)
|
||||
//// {
|
||||
//// case MesResType.A:// 停线,设备报警停机
|
||||
//// //m.listRes[i] = 10;
|
||||
//// // m.Result = MyRes[i] = 2;
|
||||
//// m.Result = MyRes[i] = 3;
|
||||
//// m.Remark += "MES NG";
|
||||
//// break;
|
||||
//// case MesResType.B://不停机,MEs NG品要排出,要给PLC发NG信号
|
||||
//// //m.listRes[i] = 9;
|
||||
//// // m.Result = MyRes[i] = 2;
|
||||
//// m.Result = MyRes[i] = 3;
|
||||
//// m.Remark += "MES NG";
|
||||
//// break;
|
||||
//// case MesResType.C://可忽略
|
||||
//// //m.listRes[i] = 1;
|
||||
//// // m.Result = MyRes[i] = 2;
|
||||
//// m.Result = MyRes[i] = 1;
|
||||
//// m.Remark += "MES Alerm OK";
|
||||
//// break;
|
||||
//// case MesResType.D://可忽略
|
||||
//// //m.listRes[i] = 1;
|
||||
//// // m.Result = MyRes[i] = 2;
|
||||
//// m.Result = MyRes[i] = 1;
|
||||
//// m.Remark += "MES OK";
|
||||
//// break;
|
||||
//// default:
|
||||
//// m.Remark += "MES NG";
|
||||
//// m.Result = MyRes[i] = 3;
|
||||
//// break;
|
||||
//// }
|
||||
//// ////芯包重量1判定结果
|
||||
//// //if (m.list_Data1[i, 10] == 2) { m.Remark += "芯包重量NG,"; }
|
||||
//// ////芯包侧厚判定结果
|
||||
//// //if (m.list_Data1[i, 11] == 2) { m.Remark += "芯包侧厚NG,"; }
|
||||
//// ////芯包CCD极性检测结果
|
||||
//// //if (m.list_Data1[i, 12] == 2) { m.Remark += "芯包CCD极性检测NG,"; }
|
||||
//// m.Remark += MesMessage;
|
||||
//// }
|
||||
////}
|
||||
#endregion
|
||||
//发送产品结果参数给MES
|
||||
bool Res1 = CommonMethods.hbgMes.ProducResultParam(ur2, siteCode1, lineCode1, equipNum1, materialCode1, userName1, m, unloadType, ref Mesage);
|
||||
|
||||
@@ -2047,6 +2003,7 @@ namespace JinYuan.ControlCenters
|
||||
m.Remark += "本地存储";
|
||||
m.UpState = "未上传";
|
||||
}
|
||||
|
||||
if (CommonMethods.sysConfig.OKSwitching)
|
||||
{
|
||||
//调试发OK
|
||||
@@ -2066,6 +2023,116 @@ namespace JinYuan.ControlCenters
|
||||
//if (m.list_Data1[i, 12] == 2) { m.Remark += ",芯包CCD极性检测NG"; }
|
||||
m.UpState = "未上传";
|
||||
}
|
||||
#endregion
|
||||
#region OK分档查询
|
||||
//if (CommonMethods.sysConfig.MesModeSwitching && CommonMethods.mesConfig.isConnected)
|
||||
{ //1 分选测厚度NG ,2 分选外观不良 21分选一档,22分选二档,23分选三档、24分选四档,25分档5 26 ==6
|
||||
|
||||
if (list[i].Result == 1)
|
||||
{
|
||||
if (CommonMethods.mesConfig.isUpMes)
|
||||
{
|
||||
//分档接口
|
||||
//21~26 OK挡位
|
||||
var (success, mesage, mesResType) = CommonMethods.hbgMes.MesGrading(
|
||||
CommonMethods.mesConfig.GradingMesUrl,
|
||||
list[i].BarCode,
|
||||
CommonMethods.mesConfig.siteCode,
|
||||
CommonMethods.mesConfig.lineCode,
|
||||
CommonMethods.mesConfig.mesUserName,
|
||||
CommonMethods.mesConfig.equipNum,
|
||||
CommonMethods.mesConfig.MaterialCode);//分档查询
|
||||
|
||||
try
|
||||
{
|
||||
//listGradeResult[i] = (short)26;//默认分档OK
|
||||
list[i].Remark = "外观检OK分档";
|
||||
if (success && mesResType[0] != "NULL")
|
||||
{
|
||||
|
||||
if (mesResType[0].Equals(CommonMethods.mesConfig.Grading1))
|
||||
{
|
||||
listGradeResult[i] = (short)(CommonMethods.MESGradingSet[0] + 20);
|
||||
list[i].Remark = $"出站条码[{list[i].BarCode}]外观检OKMES反馈档位:{mesResType[0]}";
|
||||
}
|
||||
else if (mesResType[0].Equals(CommonMethods.mesConfig.Grading2))
|
||||
{
|
||||
listGradeResult[i] = (short)(CommonMethods.MESGradingSet[1] + 20);
|
||||
list[i].Remark = $"出站条码[{list[i].BarCode}]外观检OKMES反馈档位:{mesResType[0]}";
|
||||
}
|
||||
else if (mesResType[0].Equals(CommonMethods.mesConfig.Grading3))
|
||||
{
|
||||
listGradeResult[i] = (short)(CommonMethods.MESGradingSet[2] + 20);
|
||||
list[i].Remark = $"出站条码[{list[i].BarCode}]外观检OKMES反馈档位:{mesResType[0]}";
|
||||
}
|
||||
else if (mesResType[0].Equals(CommonMethods.mesConfig.Grading4))
|
||||
{
|
||||
listGradeResult[i] = (short)(CommonMethods.MESGradingSet[3] + 20);
|
||||
list[i].Remark = $"出站条码[{list[i].BarCode}]外观检OKMES反馈档位:{mesResType[0]}";
|
||||
}
|
||||
else if (mesResType[0].Equals(CommonMethods.mesConfig.Grading5))
|
||||
{
|
||||
listGradeResult[i] = (short)(CommonMethods.MESGradingSet[4] + 20);
|
||||
list[i].Remark = $"出站条码[{list[i].BarCode}]外观检OKMES反馈档位:{mesResType[0]}";
|
||||
}
|
||||
else if (mesResType[0].Equals(CommonMethods.mesConfig.Grading6))
|
||||
{
|
||||
listGradeResult[i] = (short)(CommonMethods.MESGradingSet[5] + 20);
|
||||
list[i].Remark = $"出站条码[{list[i].BarCode}]外观检OKMES反馈档位:{mesResType[0]}";
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("MES未反馈正确档位");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
throw new Exception("MES未反馈正确档位");
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
listGradeResult[i] = (short)26;
|
||||
|
||||
list[i].Remark = $"出站条码[{list[i].BarCode}]外观检OK分档NG,MES未反馈正确档位";
|
||||
LoggerHelp.WriteLog("解析出站MES分档数据异常:{ex.Message}", "SysErrorLog");
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
list[i].Remark = $"出站条码[{list[i].BarCode}]外观检OK分档,MES断连";
|
||||
listGradeResult[i] = (short)26;
|
||||
// list[i].Result = "MES NG";
|
||||
CommonMethods.PlcLink.WriteValue("D80", 1, Data_Type.Short);
|
||||
//反馈MES结果
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//厚度不良分档
|
||||
if (!(list[i].ThicknessPLCResult1 == 1 && list[i].ThicknessPLCResult2 == 1 && list[i].ThicknessPLCResult3 == 1))
|
||||
{
|
||||
listGradeResult[i] = 1;
|
||||
list[i].Remark = $"出站条码[{list[i].BarCode}]测厚度NG";
|
||||
}
|
||||
else
|
||||
{
|
||||
//外观不良分档
|
||||
listGradeResult[i] = 2;
|
||||
list[i].Remark = $"出站条码[{list[i].BarCode}]外观检NG不分类";
|
||||
}
|
||||
}
|
||||
listRes[i] = listGradeResult[i];
|
||||
list[i].Result = listGradeResult[i];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
#region//极限件发3给PLC
|
||||
//if (ChallengeFlag == 1)
|
||||
//{
|
||||
@@ -2315,6 +2382,89 @@ namespace JinYuan.ControlCenters
|
||||
return NGcodelist;
|
||||
}
|
||||
#endregion
|
||||
#region 读取下料数据 sql数据库
|
||||
private List<BGearEntity> GetBlankingData(List<string> listBarCode)
|
||||
{
|
||||
//数据的读取
|
||||
List<BGearEntity> listData = new List<BGearEntity>();
|
||||
try
|
||||
{
|
||||
if (listBarCode != null && listBarCode.Count > 0)
|
||||
{
|
||||
listData = CommonMethods.dbServer.QuerySqlList<BGearEntity>(CommonMethods.dBSQL.GetBGearEntityByBarcode(listBarCode)).ToList();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LoggerHelp.WriteLog($"GetBlankingData:{ex}", "SysErrorLog");
|
||||
}
|
||||
return listData;
|
||||
}
|
||||
/// <summary>
|
||||
/// 通过RFID读取下料数据 mysql数据库
|
||||
/// </summary>
|
||||
/// <param name="strRFID"></param>
|
||||
/// <returns></returns>
|
||||
//private List<BGearEntity> GetBlankingData_ByRFID(string strRFID)
|
||||
//{
|
||||
// //数据的读取
|
||||
// List<BGearEntity> listData = new List<BGearEntity>();
|
||||
// try
|
||||
// {
|
||||
// if (!string.IsNullOrEmpty(strRFID) && strRFID != "ERROR")
|
||||
// {
|
||||
// var listDataTemp = CommonMethods.dbServer.QuerySqlList<BGearEntityTemp>(CommonMethods.dBSQL.GetBGearEntity(strRFID));
|
||||
// if (listDataTemp != null && listDataTemp.Count > 0)
|
||||
// {
|
||||
// foreach (var m in listDataTemp)
|
||||
// {
|
||||
// var entity = new BGearEntity();
|
||||
// foreach (var item in m.GetType().GetProperties())
|
||||
// {
|
||||
// foreach (var eitem in entity.GetType().GetProperties())
|
||||
// {
|
||||
// if (eitem.Name == item.Name)
|
||||
// eitem.SetValue(entity, item.GetValue(m));
|
||||
// }
|
||||
// }
|
||||
// listData.Add(entity);
|
||||
// }
|
||||
// }
|
||||
// // CommonMethods.db.QueryWhereList<Hourprod>(x=>x.FHour==14);
|
||||
|
||||
// // listData = CommonMethods.db.QueryWhereList<BGearEntity>(x => x.RFID == "123");//.ToList();//.OrderBy(x => x.ChannelNo).ToList();
|
||||
// //await CommonMethods.dbServer.GetReturnListByRFIDAsync(strRFID);
|
||||
|
||||
// //数据显示
|
||||
// // CommonMethods.ShowBlankingDelegate.Invoke(listData);
|
||||
|
||||
// //数据保存本地
|
||||
// string strData = string.Empty;//数据字符串,本地保存
|
||||
// foreach (BGearEntity m in listData)
|
||||
// {
|
||||
// foreach (var item in m.GetType().GetProperties())
|
||||
// {
|
||||
// strData += item.GetValue(m) + ",";
|
||||
// }
|
||||
// strData = strData.TrimEnd(',');
|
||||
// //BlankingDataSaveLocal(strData);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// LoggerHelp.WriteLog($"电芯出站数据List为空", "SysErrorLog");
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// LoggerHelp.WriteLog($"电芯出站数据保存异常:{ex}", "SysErrorLog");
|
||||
// }
|
||||
// return listData;
|
||||
//}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user