mes接口调试审核

This commit is contained in:
ldw
2025-09-05 15:06:12 +08:00
parent 65bdf3d210
commit eecbbfca32
12 changed files with 158 additions and 153 deletions
+36 -38
View File
@@ -9,6 +9,7 @@ using PLCCommunication;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@@ -1775,23 +1776,27 @@ namespace JinYuan.ControlCenters
{
m.Thickness_Data[i, j] = FloatLib.GetFloatFromByteArray(bArrays.Content, 400 + i * 30 * 2 + j * 4, DataFormat.CDAB);
}
for (int j = 0; j < 27; 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");
m.CSBYHCODEA = listBarCode[i];
m.BarCode = listBarCode[i];
//m.CSBYHCODEA = "TEST";
var EX = CommonMethods.db.QuerySqlList<Challenge>(CommonMethods.dBSQL.GetChallengeCode(m.CSBYHCODEA));
var EX = CommonMethods.db.QuerySqlList<Challenge>(CommonMethods.dBSQL.GetChallengeCode(m.BarCode));
for (int j = 0; j < EX.Count; j++)
{
if (string.Compare(EX[j].ChallengeBarCode, m.CSBYHCODEA) == 0)
if (string.Compare(EX[j].ChallengeBarCode, m.BarCode) == 0)
{
m.Remark += "(极限件," + EX[j].CodeMessage + "," + EX[j].WeldingCCD + ")";
ChallengeFlag = 1;
}
}
//查询进站时间数据
var w = CommonMethods.db.QuerySqlList<AGearEntity>(CommonMethods.dBSQL.GetInTime(m.CSBYHCODEA));
var w = CommonMethods.db.QuerySqlList<AGearEntity>(CommonMethods.dBSQL.GetInTime(m.BarCode));
//获取新一行数据
if (w.Count > 0)
TT = w[w.Count - 1];
@@ -1815,7 +1820,7 @@ namespace JinYuan.ControlCenters
int Code_NG = 0;//条码有无标志 1为有,2为无
//判断有无条码
if (m.CSBYHCODEA != null && m.CSBYHCODEA != "" && m.CSBYHCODEA != "ERROR")
if (m.BarCode != null && m.BarCode != "" && m.BarCode != "ERROR")
Code_NG = 1;
else
Code_NG = 2;
@@ -1824,10 +1829,10 @@ namespace JinYuan.ControlCenters
//m.TestTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
//不良代码判定
List<string> NGcodeList = new List<string>();
//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 = NGWGJcode(m.CCD_Data, i);
// var (NGcodeList, NGmessage) = NGWGJcode(m.CCD_Data, i);
//电芯CCD判定结果
#region //电芯CCD判定结果 1 0K 0NG 2缺图
@@ -1894,7 +1899,7 @@ namespace JinYuan.ControlCenters
m.CSBYHOUTSTATIONJUDGMENTRESULT = m.judgment_result[i] = OK_NG;
m.Remark += NG_Type;
m.MaterialCode = CommonMethods.mesConfig.MaterialCode;
NG_Type = "";//清除上一次不良字符串
OK_NG = ""; //清除上一次结果
@@ -1924,8 +1929,8 @@ namespace JinYuan.ControlCenters
int type = 1;
//int type = 1;
//string materialLotCodeLocator = "";
bool Res = CommonMethods.hbgMes.OutboundInformations(url, siteCode, lineCode, equipNum, materialCode, userName, m, ref MesMessage, ref mesResType, NGcodeList);
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("发生一个或多个错误"))
{
@@ -2125,29 +2130,9 @@ namespace JinYuan.ControlCenters
string strRes = "";
foreach (BGearEntity m in list)
{
if (true)
{
bool b = CommonMethods.db.AddReturnBool<BGearEntity>(m);
//strRes = b ? ",本存Yes" : ",本存No";
#region 存储到服务器
try
{
//int b1 = CommonMethods.dbServer.Delete<DataTurnover>(it => it.containerCode == m.RFID);
//bool res = CommonMethods.dbServer.AddReturnBool<DataTurnover>(server);
//strRes += res == true ? ",远存Yes" : ",远存No";
}
catch (Exception ex)
{
//JYResult result = CommonMethods.PlcLink.WriteValue("D80", 1, Data_Type.Short);//反馈PLC结果
//CommonMethods.AddDataMonitorLog(1, $"服务器连接失败!解决办法:1、请检查MES网络,2、查看服务器是否正常!");
//LogHelper.Instance.WriteError($"服务器连接失败:{ex}", "系统报错");
}
#endregion
}
else
bool b = CommonMethods.db.AddReturnBool<BGearEntity>(m);
if(!b)
{
strRes = ",不存储";
}
@@ -2250,19 +2235,32 @@ namespace JinYuan.ControlCenters
return NGcodelist;
}
//下料不良代码 外观检
public List<string> NGWGJcode(int[ ,] lstResult,int index)
public (List<string>, List<string>) NGWGJcode(int[,] lstResult, int index)
{
List<string> NGcodelist = new List<string>();
List<string> NGmessagelist = new List<string>();
for (int i = 0; i < 27; i++)
{
if(lstResult[index,i] !=1)
if (lstResult[index, i] != 0)
{
NGcodelist.Add("WGJA00"+(i+1));
var strCode = lstResult[index, i].ToString().PadLeft(3, '0');
NGcodelist.Add($"PFVA{strCode}");
var codeEntity = CommonMethods.listNgCodeEntity.FirstOrDefault(x => strCode == x.ngCode);
if (codeEntity != null)
{
NGmessagelist.Add(codeEntity.ngMessage);
}
else
{
NGmessagelist.Add("未知错误");
}
}
}
return NGcodelist;
return (NGcodelist, NGmessagelist);
}
#endregion
#region NG下料不良代码