清理无用代码

This commit is contained in:
a88359121
2025-07-31 11:18:43 +08:00
parent 03087c0483
commit 2c4be8993c
107 changed files with 1119 additions and 1477 deletions
+1 -9
View File
@@ -1,9 +1,7 @@
using JinYuan.CommunicationLib.Enum;
using JinYuan.CommunicationLib.Helper;
using JinYuan.DataConvertLib;
using JinYuan.Helper;
using JinYuan.MES.Enums;
using JinYuan.MES.Models;
using JinYuan.Models;
using JinYuan.VirtualDataLibrary;
@@ -11,20 +9,14 @@ using Newtonsoft.Json;
using PLCCommunication;
using SqlSugar;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data.SqlTypes;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.NetworkInformation;
using System.Runtime.InteropServices.ComTypes;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Runtime.CompilerServices.RuntimeHelpers;
namespace JinYuan.ControlCenters
@@ -270,7 +262,7 @@ namespace JinYuan.ControlCenters
if (resByte == null)
{
CommonMethods.AddDataMonitorLog(0, $"上料工位:{pf.GroupName},起始地址:{pf.VarList[1].VarAddress},得到空字节数组");
LoggerHelp.WriteLog("循环读取PLC上料工位"+$"读取工位:{pf.GroupName},起始地址:{pf.VarList[1].VarAddress},得到空字节数组");
LoggerHelp.WriteLog("循环读取PLC上料工位" + $"读取工位:{pf.GroupName},起始地址:{pf.VarList[1].VarAddress},得到空字节数组");
}
else
{
+179 -113
View File
@@ -3,23 +3,14 @@ using JinYuan.CommunicationLib.Enum;
using JinYuan.DataConvertLib;
using JinYuan.Helper;
using JinYuan.MES.Enums;
using JinYuan.MES.Models;
using JinYuan.Models;
using JinYuan.VirtualDataLibrary;
using PLCCommunication;
using SqlSugar;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Diagnostics.Eventing.Reader;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
namespace JinYuan.ControlCenters
{
@@ -157,37 +148,112 @@ namespace JinYuan.ControlCenters
// return Result;
//}
/// <summary>
/// 判断总结果 Code_NG
/// 判断总结果
/// </summary>
private int JudgmentResult(int Code_NG, int[,] CCD_Data,int codeIndex)
{
private int JudgmentResult(int A, int B, int C, int D, int E, int F, int G, int H, int I, int J, int K, int L, int M, int N)
{
//条码,芯包重量,芯包侧厚,芯包CCD极性检测,电芯裁切粘连,电芯裁切毛刺,芯包铜焊印位置,
//芯包正面极耳撕裂H,芯包背面极耳撕裂,芯包正面极耳翻折J,芯包背面极耳翻折,测厚压力结果,
//焊前CCD检测结果,铝焊印位置判定结果
//目前先判断条码,芯包重量,芯包侧厚,芯包CCD极性检测,芯包正面极耳撕裂,芯包正面极耳翻折
int Result = 0;
OK_NG = "OK";
//是否有条码NG 1 = OK 2 = NG
if (Code_NG == 2)
if (A == 2 || B == 2 || C == 2 || D == 2 || H == 2 || J == 2)
{
//ed
Result = 2;
OK_NG = "NG";
}
else if (A == 1 && B == 1 && C == 1 && D == 1 && H == 1 && J == 1)
{
Result = 1;
OK_NG = "OK";
}
else
{
Result = 1;
OK_NG = "OK";
}
if (A == 2)
{
NG_Type += "无条码_";
OK_NG = "NG";
Result = 2;
}
//CCD 判定
for (int i = 0; i < 27; i++)
if (B == 2)
{
//CCD 0 = OK 1 = NG 2 缺图NG
if (CCD_Data[codeIndex, i] == 1)
{
NG_Type += $"CCD{i}NG_";
OK_NG = "NG";
Result = 2;
}
if (CCD_Data[codeIndex, i] == 2)
{
NG_Type += $"CCD{i}缺图NG_";
OK_NG = "NG";
Result = 2;
}
}
NG_Type += "芯包重量1NG_";
//return 2;
Result = 2;
}
if (C == 2)
{
NG_Type += "芯包侧厚NG_";
//return 2;
Result = 2;
}
if (D == 2)
{
NG_Type += "芯包CCD极性检测NG_";
//return 2;
Result = 2;
}
//if (E == 2)
//{
// NG_Type += "电芯裁切粘连NG_";
// //return 2;
//}
//if (F == 2)
//{
// NG_Type += "电芯裁切毛刺NG_";
// //return 2;
//}
//if (G == 2)
//{
// NG_Type += "芯包铜焊印位置判定NG_";
// //return 2;
//}
if (H == 2)
{
NG_Type += "芯包正面极耳撕裂NG_";
//return 2;
}
//if (I == 2)
//{
// NG_Type += "芯包背面极耳撕裂NG_";
// //return 2;
//}
if (J == 2)
{
NG_Type += "芯包正面极耳翻折NG_";
//return 2;
}
//if (K == 2)
//{
// NG_Type += "芯包背面极耳翻折NG_";
// //return 2;
//}
if (L == 2)
{
NG_Type += "测厚压力NG_";
//return 2;
}
if (M == 2)
{
NG_Type += "焊前CCD检测NG_";
//return 2;
}
if (N == 2)
{
NG_Type += "铝焊印位置判定NG_";
//return 2;
}
if (Result == 1)
{
NG_Type += "OK_";
}
return Result;
}
#region 上料工位(数据处理)
@@ -209,7 +275,7 @@ namespace JinYuan.ControlCenters
}
if (bArrays.IsSuccess && bArrays.Content != null)
{
sw2.Restart();
//解析数据
@@ -233,7 +299,7 @@ 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[0] = "TEST";
//listBarCode[1] = "TEST";
//listBarCode[2] = "TEST";
@@ -284,7 +350,7 @@ namespace JinYuan.ControlCenters
MesResType mesResType1 = MesResType.A;
bool Res = CommonMethods.hbgMes.SingleCellInStation(url, siteCode, lineCode, equipNum, materialCode, userName, listBarCode[i], ref MesMessage1, ref mesResType1);
if (MesMessage1.Contains("发生一个或多个错误"))
{
MesMessage1 = "上传失败";
@@ -857,7 +923,7 @@ namespace JinYuan.ControlCenters
// m.Flag = 1;
// }
// //m.UpState = "已上传";
// if (Res)
// {
@@ -900,7 +966,7 @@ namespace JinYuan.ControlCenters
// bool Res1 = CommonMethods.hbgMes.ProducResultParam(ur2, siteCode1, lineCode1, equipNum1, materialCode1, userName1, m, unloadType, ref Mesage);
// if (m.Flag == 1)
// m.UpState = "已上传";
// else
@@ -1674,22 +1740,17 @@ namespace JinYuan.ControlCenters
AGearEntity TT = new AGearEntity();
//极限件标志
int ChallengeFlag = 0;
//芯包信息1 D3300~D3327
//芯包信息2 D3330~D3357
//芯包信息3 D3360~D3387
for (int j = 0; j < 28; j++)
//芯包信息1 D3300~D3326
//芯包信息2 D3330~D3356
//芯包信息3 D3360~D3386
for (int j = 0; j < 27; j++)
{
m.CCD_Data[i,j] = ShortLib.GetShortFromByteArray(bArrays.Content, 200 + i * 30 * 2 + j * 2, DataFormat.CDAB);
m.CCD_Data[i, j] = ShortLib.GetShortFromByteArray(bArrays.Content, 200 + i * 30 * 2 + j * 2, DataFormat.CDAB);
}
//电芯1缺陷代码 D3400~D3427
//电芯2缺陷代码 D3430~D3457
//电芯3缺陷代码 D3460~D3487
for (int j = 0; j < 28; j++)
for (int j = 0; j < 3; j++)
{
m.list_Data1[i, j] = ShortLib.GetShortFromByteArray(bArrays.Content, 400 + i * 30 * 2 + j * 2, DataFormat.CDAB);
m.Thickness_Data[i, j] = FloatLib.GetFloatFromByteArray(bArrays.Content, 400 + i * 30 * 2 + j * 4, DataFormat.CDAB);
}
//电池厚度 D3500 D3502 D3504
m.Thickness_Data[i] = FloatLib.GetFloatFromByteArray(bArrays.Content, 600 + i * 4, DataFormat.CDAB);
//芯包扫码时间
//m.ScanTime[i] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
@@ -1740,56 +1801,67 @@ namespace JinYuan.ControlCenters
//不良代码判定
List<string> NGcodeList = new List<string>();
NGcodeList = NGWGcode(m.list_Data1,i);
// 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]);
//电芯CCD判定结果
#region //电芯CCD判定结果
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" : "缺图");
m.CCDResult28 = m.CCD_Data[i, 27] == 1 ? "OK" : (m.CCD_Data[i, 27] == 0 ? "NG" : "缺图");
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" : "缺图");
#endregion
m.CSBYHASCANNINGTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
m.CSBYHASCANNINGTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
m.CSBYHPROCESSNAME = "外观检测";
m.CSBYHSCHEDULE = CommonMethods.strClass;
m.CSBYHINSTATIONTIME = m.ScanTime[0];
m.CSBYHOUTSTATIONTIME = m.ScanTime[1];
//电芯1厚度数据1,2,3 改为 电芯1厚度 ;3字段只需1字段
m.Thickness1 = SaveTwoNum(m.Thickness_Data[i]);
m.Thickness2 = SaveTwoNum(m.Thickness_Data[i]);
m.Thickness3 = SaveTwoNum(m.Thickness_Data[i]);
m.Thickness1 = SaveTwoNum(m.Thickness_Data[i, 0]);
m.Thickness2 = SaveTwoNum(m.Thickness_Data[i, 1]);
m.Thickness3 = SaveTwoNum(m.Thickness_Data[i, 2]);
//芯包OKNG结果值判定
MyRes[i] = JudgmentResult(Code_NG, m.CCD_Data,i);
//条码,芯包重量,芯包侧厚,芯包CCD极性检测,电芯裁切粘连,电芯裁切毛刺,芯包焊印位置,
//芯包正面极耳撕裂,芯包背面极耳撕裂,芯包正面极耳翻折,芯包背面极耳翻折
if (Code_NG == 1)
{
for (int ii = 0; ii < 27; ii++)
{
if (m.CCD_Data[i, ii] != 0)
{
MyRes[i] = m.CCD_Data[i, ii];
break;
}
}
}
else
MyRes[i] = 1;
//MyRes[i] = JudgmentResult(Code_NG, m.CCD_Data);
m.Result = MyRes[i];
@@ -1841,7 +1913,12 @@ namespace JinYuan.ControlCenters
{
//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
@@ -1867,7 +1944,12 @@ namespace JinYuan.ControlCenters
m.Result = MyRes[i] = 2;
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;
}
//发送产品结果参数给MES
@@ -1895,7 +1977,13 @@ namespace JinYuan.ControlCenters
else
{
m.Result = MyRes[i] = 2;
m.Remark += "本地存储";
m.Remark += "本地存储";
//芯包重量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.UpState = "未上传";
}
//极限件发3给PLC
@@ -2124,31 +2212,9 @@ namespace JinYuan.ControlCenters
return NGcodelist;
}
/// <summary>
/// 下料外观检不良代码
/// </summary>
/// <returns></returns>
public List<string> NGWGcode(short[,] serialNum,int index)
{
List<string> NGcodelist = new List<string>();
var ngType = "A";
for (int i = 0; i < 28; i++)
{
if (serialNum[index,i] == 4 || serialNum[index,i] == 150 || serialNum[index, i] == 151)
ngType = "P";
if (serialNum[index, i] > 0)
{
var strserialNum = serialNum[index, i].ToString().PadLeft(3, '0');
NGcodelist.Add($"PFV{ngType}{strserialNum}");
}
}
return NGcodelist;
}
#endregion
#region NG下料不良代码
#region NG下料不良代码
public List<string> NGCarcode(int a, int b, int c)
{
//芯包重量、测厚位移、极性
+16 -20
View File
@@ -1,19 +1,15 @@
using JinYuan.CommunicationLib.Enum;
using HslCommunication.ModBus;
using JinYuan.CommunicationLib.Enum;
using JinYuan.DataConvertLib;
using JinYuan.Helper;
using JinYuan.MES.Enums;
using JinYuan.MES.Models;
using JinYuan.Models;
using JinYuan.VirtualDataLibrary;
using PLCCommunication;
using PLCCommunication.Language;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using HslCommunication.ModBus;
namespace JinYuan.ControlCenters
{
@@ -195,10 +191,10 @@ namespace JinYuan.ControlCenters
//CommonMethods.Lst_DefectTypeQty.Add(new ChartDataType { DataType = "称重不良", DataCount = 0 });
//CommonMethods.Lst_DefectTypeQty.Add(new ChartDataType { DataType = "铜极耳剪切不良", DataCount = 0 });
//CommonMethods.Lst_DefectTypeQty.Add(new ChartDataType { DataType = "铝极耳剪切不良", DataCount = 0 });
CommonMethods.Lst_DefectTypeQty.Add(new ChartDataType { DataType = "扫码不良", DataCount = 0 });
CommonMethods.Lst_DefectTypeQty.Add(new ChartDataType { DataType = "扫码不良", DataCount = 0 });
CommonMethods.Lst_DefectTypeQty.Add(new ChartDataType { DataType = "MES不良", DataCount = 0 });
CommonMethods.Lst_DefectTypeQty.Add(new ChartDataType { DataType = "其他不良" , DataCount = 0 });
CommonMethods.Lst_DefectTypeQty.Add(new ChartDataType { DataType = "其他不良", DataCount = 0 });
}
else //读取PLC数据
@@ -423,14 +419,14 @@ namespace JinYuan.ControlCenters
string _anemometerAddress = "D15000";//风速仪起始地址
if (CommonMethods.mesConfig.isUpMes)
{
JYResult<byte[]> jYResult = CommonMethods.PlcLink.ReadValue<JYResult<byte[]>>(_anemometerAddress, Data_Type.ArrByte,150);
JYResult<byte[]> jYResult = CommonMethods.PlcLink.ReadValue<JYResult<byte[]>>(_anemometerAddress, Data_Type.ArrByte, 150);
List<float> _anemograph = GetList<float>(_anemometerNumber, 0);//初始化列表
List<string> _anemometerName=new List<string>();
List<string> _anemometerName = new List<string>();
string _mesage = "";
for (int i=0;i< _anemometerNumber;i++)
for (int i = 0; i < _anemometerNumber; i++)
{
//初始化风速仪名称
int _temple = i+1;
int _temple = i + 1;
string _name = "风速仪" + _temple.ToString();
_anemometerName.Add(_name);
@@ -440,22 +436,22 @@ namespace JinYuan.ControlCenters
//
// 写csv文件
string productName = string.Empty;
string fileName=string.Empty;
string filePath=string.Empty;
string fileName = string.Empty;
string filePath = string.Empty;
DateTime nowDate = DateTime.Now;
string fileTitle= "工序名称,生产机台编号,拉线,型号,物料编号,操作人员,班次,采集时间,";
string fileContent= $"预焊工序,{CommonMethods.mesConfig.equipNum},{CommonMethods.mesConfig.lineCode},{productName},{CommonMethods.mesConfig.MaterialCode},{CommonMethods.mesConfig.mesUserName},{CommonMethods.strClass},{nowDate.ToString("yyyy-MM-dd HH:mm:ss")},";
string fileTitle = "工序名称,生产机台编号,拉线,型号,物料编号,操作人员,班次,采集时间,";
string fileContent = $"预焊工序,{CommonMethods.mesConfig.equipNum},{CommonMethods.mesConfig.lineCode},{productName},{CommonMethods.mesConfig.MaterialCode},{CommonMethods.mesConfig.mesUserName},{CommonMethods.strClass},{nowDate.ToString("yyyy-MM-dd HH:mm:ss")},";
filePath = $@"{CommonMethods.strAnemographpath}\{nowDate.Year}\{nowDate.Month}";
fileName = $@"{nowDate.Day}.csv";
for (int j = 0; j < _anemometerNumber; j++)
{
fileTitle = fileTitle +","+ _anemometerName[j];
{
fileTitle = fileTitle + "," + _anemometerName[j];
fileContent = fileContent + "," + _anemograph[j];
}
CSVHelper<object>.WriterCSV(filePath, fileName, fileTitle, fileContent);
if (false)//待确认接口
{
+6 -9
View File
@@ -1,15 +1,12 @@
using JinYuan.VirtualDataLibrary;
using JinYuan.Helper;
using JinYuan.MES;
using JinYuan.MES.Models;
using JinYuan.Models;
using JinYuan.VirtualDataLibrary;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using JinYuan.Helper;
using JinYuan.MES;
using JinYuan.MES.Models;
using JinYuan.MES.Enums;
using JinYuan.Models;
using SqlSugar;
namespace JinYuan.ControlCenters
{
@@ -54,7 +51,7 @@ namespace JinYuan.ControlCenters
alarmParam.alarmLineList = alarmLineList;
string SendJosn = JsonConvert.SerializeObject(alarmParam);
var sw = new Stopwatch();
sw.Start();
sw.Start();
resJson = MESApiHelper.HttpPostJsonAPI(CommonMethods.mesConfig.AlarmCurrencyMesUrl, SendJosn);
sw.Stop();
josnTxtMsg = $"{nowTime.ToString("yyyy-MM-dd HH:mm:ss.fff")}:调用MES设备报警接口:{CommonMethods.mesConfig.AlarmCurrencyMesUrl},请求数据为:{SendJosn},\n{nowTime.AddMilliseconds(sw.ElapsedMilliseconds).ToString("yyyy-MM-dd HH:mm:ss.fff")}:接口耗时:{sw.ElapsedMilliseconds}ms,返回结果:{resJson}";
@@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下