5.12 OEE相关日志放到右侧
螺丝添加NG的统计
This commit is contained in:
1 parent
e8001a81bb
commit
817b66ad53
4 files changed
+124
-85
No files matched your search
@@ -17,6 +17,7 @@ using System.Threading.Tasks;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using HslCommunication.LogNet;
|
using HslCommunication.LogNet;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using WindowsFormsApp1.db;
|
using WindowsFormsApp1.db;
|
||||||
using WindowsFormsApp1.form;
|
using WindowsFormsApp1.form;
|
||||||
using WindowsFormsApp1.mod;
|
using WindowsFormsApp1.mod;
|
||||||
@@ -131,10 +132,10 @@ namespace WindowsFormsApp1
|
|||||||
statusReportTimer.Interval = 1000 * 15;
|
statusReportTimer.Interval = 1000 * 15;
|
||||||
statusReportTimer.Tick += StatusReportTimer_Tick;
|
statusReportTimer.Tick += StatusReportTimer_Tick;
|
||||||
|
|
||||||
screwReportTimer.Interval = 1000 * 60 * 15;
|
screwReportTimer.Interval = 1000 * 60 * 5;
|
||||||
screwReportTimer.Tick += ScrewReportTimer_Tick;
|
screwReportTimer.Tick += ScrewReportTimer_Tick;
|
||||||
|
|
||||||
fileUploadTimer.Interval = 1000 * 60 * 15;
|
fileUploadTimer.Interval = 1000 * 60 * 2;
|
||||||
fileUploadTimer.Tick += FileUploadTimer_Tick;
|
fileUploadTimer.Tick += FileUploadTimer_Tick;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,7 +211,6 @@ namespace WindowsFormsApp1
|
|||||||
continue;
|
continue;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
if (Init.t_Lineplcs.Count >= 2 && Plc.id == Init.t_Lineplcs.First().plcid)
|
if (Init.t_Lineplcs.Count >= 2 && Plc.id == Init.t_Lineplcs.First().plcid)
|
||||||
{
|
{
|
||||||
LOT号.Text = PlcData.Write_stSN;
|
LOT号.Text = PlcData.Write_stSN;
|
||||||
@@ -338,7 +338,7 @@ namespace WindowsFormsApp1
|
|||||||
var statusresult = apiClient.CallFunctionByName("Status", PlcData, otherdata);
|
var statusresult = apiClient.CallFunctionByName("Status", PlcData, otherdata);
|
||||||
if (statusresult.Success)
|
if (statusresult.Success)
|
||||||
{
|
{
|
||||||
LogExecute.OEElogNet.WriteDebug($"上报机台状态成功: {plcstatus.GetName(typeof(plcstatus), Init.Plcstatus)} {Init.ErrorCode}");
|
LogExecute.OEElogNet.WriteDebug($"上报机台状态成功: {plcstatus.GetName(typeof(plcstatus), Init.Plcstatus)} {otherdata.Plc_Status}");
|
||||||
//beginScrewReportTimer = 0;
|
//beginScrewReportTimer = 0;
|
||||||
if (!statusReportTimer.Enabled)
|
if (!statusReportTimer.Enabled)
|
||||||
{
|
{
|
||||||
@@ -403,7 +403,7 @@ namespace WindowsFormsApp1
|
|||||||
siemensHelp.WriteAddress(plcaddress, PlcData);
|
siemensHelp.WriteAddress(plcaddress, PlcData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue;
|
//continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -424,6 +424,8 @@ namespace WindowsFormsApp1
|
|||||||
OldPlcTrigger[Plc.id] = PlcData.Read_Trigger;
|
OldPlcTrigger[Plc.id] = PlcData.Read_Trigger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LogExecute.logNet.WriteDebug($"读取状态字{Plc.plcname}:{Plc.id}-{PlcData.Read_Trigger}");
|
||||||
|
|
||||||
if (PlcData.Read_Trigger == 0 && PlcData.Write_Status == 0)
|
if (PlcData.Read_Trigger == 0 && PlcData.Write_Status == 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -442,9 +444,10 @@ namespace WindowsFormsApp1
|
|||||||
//PLC链接状态.BackColor = Color.Red;
|
//PLC链接状态.BackColor = Color.Red;
|
||||||
LogExecute.logNet.WriteError($"{Plc.plcip}写入地址处理错误:处理停止");
|
LogExecute.logNet.WriteError($"{Plc.plcip}写入地址处理错误:处理停止");
|
||||||
}
|
}
|
||||||
|
LogExecute.logNet.WriteDebug($"写入状态字0");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
LogExecute.logNet.WriteDebug($"读取状态字{Plc.id}-{PlcData.Read_Trigger}");
|
|
||||||
|
|
||||||
var nowflow = Init.t_Flows.FirstOrDefault(a => a.hopestatus == PlcData.Read_Trigger);
|
var nowflow = Init.t_Flows.FirstOrDefault(a => a.hopestatus == PlcData.Read_Trigger);
|
||||||
if (nowflow == null)
|
if (nowflow == null)
|
||||||
@@ -580,23 +583,21 @@ namespace WindowsFormsApp1
|
|||||||
}
|
}
|
||||||
otherdata.FinalPressureCurve = pressurecurveaddress_result.Data;
|
otherdata.FinalPressureCurve = pressurecurveaddress_result.Data;
|
||||||
}
|
}
|
||||||
//if (nowflow.finaltorquecurve)
|
|
||||||
//{
|
|
||||||
// //扭力曲线(这里不处理,后端API获取)
|
|
||||||
//}
|
|
||||||
//螺丝扭力
|
//螺丝扭力
|
||||||
if (nowflow.finaltorquevalue)
|
if (nowflow.finaltorquevalue)
|
||||||
{
|
{
|
||||||
//螺丝枪扭力数据
|
//螺丝枪扭力数据
|
||||||
var finaltorquevalue_result = siemensHelp.ReadAddress(torqueaddress);
|
/* var finaltorquevalue_result = siemensHelp.ReadAddress(torqueaddress);
|
||||||
if (!finaltorquevalue_result.Success)
|
if (!finaltorquevalue_result.Success)
|
||||||
{
|
{
|
||||||
//PLC链接状态.Text = "PLC链接状态:NG";
|
//PLC链接状态.Text = "PLC链接状态:NG";
|
||||||
//PLC链接状态.BackColor = Color.Red;
|
//PLC链接状态.BackColor = Color.Red;
|
||||||
LogExecute.logNet.WriteError($"{Plc.plcip}螺丝枪扭力数据地址处理错误:处理停止");
|
LogExecute.logNet.WriteError($"{Plc.plcip}螺丝枪扭力数据地址处理错误:处理停止");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
otherdata.FinalTorqueValue = finaltorquevalue_result.Data;
|
otherdata.FinalTorqueValue = finaltorquevalue_result.Data;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
//气密
|
//气密
|
||||||
if (nowflow.airtight)
|
if (nowflow.airtight)
|
||||||
@@ -611,12 +612,14 @@ namespace WindowsFormsApp1
|
|||||||
var finalanglevaluue_result = siemensHelp.ReadAddress(angleaddress);
|
var finalanglevaluue_result = siemensHelp.ReadAddress(angleaddress);
|
||||||
if (!finalanglevaluue_result.Success)
|
if (!finalanglevaluue_result.Success)
|
||||||
{
|
{
|
||||||
//PLC链接状态.Text = "PLC链接状态:NG";
|
|
||||||
//PLC链接状态.BackColor = Color.Red;
|
|
||||||
LogExecute.logNet.WriteError($"{Plc.plcip}螺丝枪角度数据地址处理错误:处理停止");
|
LogExecute.logNet.WriteError($"{Plc.plcip}螺丝枪角度数据地址处理错误:处理停止");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
otherdata.FinalAngleValue = finalanglevaluue_result.Data;
|
|
||||||
|
otherdata.FinalAngleValue = Enumerable
|
||||||
|
.Range(0, (finalanglevaluue_result.Data.Count + 3) / 4) // 计算组数
|
||||||
|
.Select(i => finalanglevaluue_result.Data.Skip(i * 4).Take(4).ToList())
|
||||||
|
.ToList();
|
||||||
}
|
}
|
||||||
if (nowflow.fileupload)
|
if (nowflow.fileupload)
|
||||||
{
|
{
|
||||||
@@ -793,7 +796,7 @@ namespace WindowsFormsApp1
|
|||||||
PlcData.Write_Status = 1001;
|
PlcData.Write_Status = 1001;
|
||||||
}
|
}
|
||||||
siemensHelp.WriteAddress(plcaddress, PlcData);
|
siemensHelp.WriteAddress(plcaddress, PlcData);
|
||||||
LogExecute.logNet.WriteDebug($"上位机写入触发字:{PlcData.Write_Status}");
|
LogExecute.logNet.WriteDebug($"{Plc.plcname}:{Plc.plcip}上位机写入触发字:{PlcData.Write_Status}");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -804,7 +807,8 @@ namespace WindowsFormsApp1
|
|||||||
PlcData.Write_stSN = "";
|
PlcData.Write_stSN = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LogExecute.logNet.WriteDebug($"上位机写入触发字:{PlcData.Write_Status}");
|
LogExecute.logNet.WriteDebug($"{Plc.plcname}:{Plc.plcip}上位机写入触发字:{PlcData.Write_Status}");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1868,7 +1872,7 @@ namespace WindowsFormsApp1
|
|||||||
if (material_sqlresult.Success)
|
if (material_sqlresult.Success)
|
||||||
{
|
{
|
||||||
ApiClient apiClient = new ApiClient();
|
ApiClient apiClient = new ApiClient();
|
||||||
var materialList = material_sqlresult.Data.Where(x => (DateTime.Now - x.outtime).TotalHours > 1).Take(5);
|
var materialList = material_sqlresult.Data.Where(x => (DateTime.Now - x.outtime).TotalMinutes > 20).Take(5);
|
||||||
foreach (var material in materialList)
|
foreach (var material in materialList)
|
||||||
{
|
{
|
||||||
otherdata OtherData = new otherdata();
|
otherdata OtherData = new otherdata();
|
||||||
@@ -1929,7 +1933,8 @@ namespace WindowsFormsApp1
|
|||||||
material.vedioUploaded = 2;
|
material.vedioUploaded = 2;
|
||||||
sQLiteHelper_upload.Update(material);
|
sQLiteHelper_upload.Update(material);
|
||||||
LogExecute.logNet.WriteDebug($"{material.sn} 文件上传成功!");
|
LogExecute.logNet.WriteDebug($"{material.sn} 文件上传成功!");
|
||||||
}else if (result.Mesresult == mesresult.NONE)
|
}
|
||||||
|
else if (result.Mesresult == mesresult.NONE)
|
||||||
{
|
{
|
||||||
//标记该物料已上传
|
//标记该物料已上传
|
||||||
if (material.imageUploaded == 1)
|
if (material.imageUploaded == 1)
|
||||||
@@ -2007,7 +2012,10 @@ namespace WindowsFormsApp1
|
|||||||
{
|
{
|
||||||
SiemensHelp siemensHelp = Plc.plchelp;
|
SiemensHelp siemensHelp = Plc.plchelp;
|
||||||
List<t_plcaddress> plcaddress = Init.t_Plcaddresses.FindAll(a => a.plcid == Plc.id
|
List<t_plcaddress> plcaddress = Init.t_Plcaddresses.FindAll(a => a.plcid == Plc.id
|
||||||
&& a.code.Contains("Heartbeat") || a.code == "NowDateTime");
|
&& a.code == "Write_Heartbeat");
|
||||||
|
|
||||||
|
List<t_plcaddress> timeplcaddress = Init.t_Plcaddresses.FindAll(a => a.plcid == Plc.id
|
||||||
|
&& a.code == "NowDateTime");
|
||||||
|
|
||||||
plcdata PlcData = new plcdata();
|
plcdata PlcData = new plcdata();
|
||||||
|
|
||||||
@@ -2019,12 +2027,22 @@ namespace WindowsFormsApp1
|
|||||||
|
|
||||||
//写入心跳
|
//写入心跳
|
||||||
PlcData.Write_Heartbeat = PlcData.Write_Heartbeat == 0 ? (short)1 : (short)0;
|
PlcData.Write_Heartbeat = PlcData.Write_Heartbeat == 0 ? (short)1 : (short)0;
|
||||||
PlcData.NowDateTime = DateTime.Now.AddSeconds(3);
|
|
||||||
//LogExecute.logNet.WriteDebug($"{Plc.plcname}:{Plc.plcip}写入心跳{PlcData.Write_Heartbeat}!");
|
|
||||||
var haertresult = siemensHelp.WriteAddress(plcaddress, PlcData);
|
var haertresult = siemensHelp.WriteAddress(plcaddress, PlcData);
|
||||||
if (!haertresult.Success)
|
if (!haertresult.Success)
|
||||||
{
|
{
|
||||||
LogExecute.logNet.WriteError($"{Plc.plcname}:{Plc.plcip}写入心跳错误!");
|
LogExecute.logNet.WriteError($"{Plc.plcname}:{Plc.plcip}写入心跳失败!");
|
||||||
|
}
|
||||||
|
|
||||||
|
//写入时间
|
||||||
|
var timeData = new plcdata
|
||||||
|
{
|
||||||
|
NowDateTime = DateTime.Now.AddSeconds(3)
|
||||||
|
};
|
||||||
|
var timeresult = siemensHelp.WriteAddress(timeplcaddress, timeData);
|
||||||
|
if (!timeresult.Success)
|
||||||
|
{
|
||||||
|
LogExecute.logNet.WriteError($"{Plc.plcname}:{Plc.plcip}写入时间失败!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace WindowsFormsApp1.mod.server
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 螺丝枪角度
|
/// 螺丝枪角度
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<float> FinalAngleValue { get; set; }
|
public List<List<dynamic>> FinalAngleValue { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 螺丝枪扭力曲线
|
/// 螺丝枪扭力曲线
|
||||||
|
|||||||
@@ -143,7 +143,14 @@ namespace WindowsFormsApp1.server
|
|||||||
PlcData.Write_Status = (short)statusCode;
|
PlcData.Write_Status = (short)statusCode;
|
||||||
if (eventName == "SN_Release" || eventName == "SN_CheckIN")
|
if (eventName == "SN_Release" || eventName == "SN_CheckIN")
|
||||||
PlcData.Write_stSN = "TEST MODE testsn";
|
PlcData.Write_stSN = "TEST MODE testsn";
|
||||||
LogExecute.logNet.WriteDebug($"{eventName} 测试接口请求成功\n请求:{jsonPayload}\n");
|
if (eventName == "Status" || eventName == "Alarm" || eventName == "OEEDataCollection")
|
||||||
|
{
|
||||||
|
LogExecute.OEElogNet.WriteDebug($"{eventName} 接口请求成功\n请求:{jsonPayload}\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogExecute.logNet.WriteDebug($"{eventName} 测试接口请求成功\n请求:{jsonPayload}\n");
|
||||||
|
}
|
||||||
return ApiFormResult.Sucess(mesresult.PASS, true, "PASS", PlcData, DateTime.Now);
|
return ApiFormResult.Sucess(mesresult.PASS, true, "PASS", PlcData, DateTime.Now);
|
||||||
}
|
}
|
||||||
#endregion test
|
#endregion test
|
||||||
@@ -169,13 +176,20 @@ namespace WindowsFormsApp1.server
|
|||||||
// 访问动态对象的属性
|
// 访问动态对象的属性
|
||||||
if (res != null)
|
if (res != null)
|
||||||
{
|
{
|
||||||
LogExecute.logNet.WriteDebug($"{eventName} 接口请求成功\n请求:{jsonPayload}\n 返回: {responseContent}");
|
//oee相关日志单独存
|
||||||
|
if (eventName == "Status" || eventName == "Alarm" || eventName == "OEEDataCollection")
|
||||||
|
{
|
||||||
|
LogExecute.OEElogNet.WriteDebug($"{eventName} 接口请求成功\n请求:{jsonPayload}\n 返回: {responseContent}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogExecute.logNet.WriteDebug($"{eventName} 接口请求成功\n请求:{jsonPayload}\n 返回: {responseContent}");
|
||||||
|
}
|
||||||
// 成功!
|
// 成功!
|
||||||
if (res.Result != null && !string.IsNullOrEmpty(res.Result.Value))
|
if (res.Result != null && !string.IsNullOrEmpty(res.Result.Value))
|
||||||
{
|
{
|
||||||
var result = res.Result.Value == "PASS";
|
var result = res.Result.Value == "PASS";
|
||||||
if(!string.IsNullOrEmpty( res?.Need_Work?.Value) && res?.Need_Work?.Value == "PASS")
|
if (!string.IsNullOrEmpty(res?.Need_Work?.Value) && res?.Need_Work?.Value == "PASS")
|
||||||
result = true;
|
result = true;
|
||||||
if (eventName == "SN_Release" || eventName == "SN_CheckIN")
|
if (eventName == "SN_Release" || eventName == "SN_CheckIN")
|
||||||
PlcData.Write_stSN = res.SN.Value;
|
PlcData.Write_stSN = res.SN.Value;
|
||||||
@@ -527,7 +541,7 @@ namespace WindowsFormsApp1.server
|
|||||||
else if ("ScrewE,Assy2,Assy3,ScrewS,ScrewM,ScrewTC".ToLower().Contains(station))
|
else if ("ScrewE,Assy2,Assy3,ScrewS,ScrewM,ScrewTC".ToLower().Contains(station))
|
||||||
{
|
{
|
||||||
// 扭力 读马头服务器
|
// 扭力 读马头服务器
|
||||||
var geturl = $"http://10.50.12.41/getdata/v2/tighteningresults?startTime={OtherData.material.date.Substring(0,10)}&endTime={DateTime.Now.AddDays(1).ToString("yyyy-MM-dd")}&vin={OtherData.material.sn}&controllerName={Init.t_Line.lineremark2}@{Init.t_Line.linecode}&includeCurve=true&includeSteps=false";
|
var geturl = $"http://10.50.12.41/getdata/v2/tighteningresults?startTime={OtherData.material.date.Substring(0, 10)}&endTime={DateTime.Now.AddDays(1).ToString("yyyy-MM-dd")}&vin={OtherData.material.sn}&controllerName={Init.t_Line.lineremark2}@{Init.t_Line.linecode}&includeCurve=true&includeSteps=false";
|
||||||
//var geturl = "http://10.50.12.41/getdata/v2/tighteningresults?startTime=2025-04-11&endTime=2025-04-12&vin=ok&controllerName=OP1260%4010.50.247.110&includeCurve=true&includeSteps=false";
|
//var geturl = "http://10.50.12.41/getdata/v2/tighteningresults?startTime=2025-04-11&endTime=2025-04-12&vin=ok&controllerName=OP1260%4010.50.247.110&includeCurve=true&includeSteps=false";
|
||||||
|
|
||||||
var res = _httpClient.GetAsync(geturl).Result;
|
var res = _httpClient.GetAsync(geturl).Result;
|
||||||
@@ -588,12 +602,12 @@ namespace WindowsFormsApp1.server
|
|||||||
{
|
{
|
||||||
return ApiFormResult.Sucess(mesresult.FAIL, false, "请求马头服务器获取数据失败", PlcData, DateTime.Now);
|
return ApiFormResult.Sucess(mesresult.FAIL, false, "请求马头服务器获取数据失败", PlcData, DateTime.Now);
|
||||||
}
|
}
|
||||||
if(request.DC_INFO.Count == 0)
|
if (request.DC_INFO.Count == 0)
|
||||||
{
|
{
|
||||||
return ApiFormResult.Sucess(mesresult.NONE, false, "请求马头服务器获取数据失败", PlcData, DateTime.Now);
|
return ApiFormResult.Sucess(mesresult.NONE, false, "请求马头服务器获取数据失败", PlcData, DateTime.Now);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return CallApi(url, request, "Data_Collection", PlcData, statusCode);
|
return CallApi(url, request, "Data_Collection", PlcData, statusCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -646,8 +660,8 @@ namespace WindowsFormsApp1.server
|
|||||||
var day = "";
|
var day = "";
|
||||||
if (OtherData.material.imageUploaded == 1)
|
if (OtherData.material.imageUploaded == 1)
|
||||||
{
|
{
|
||||||
month = OtherData.material.date.Substring(0, 6);
|
month = OtherData.material.date.Replace("-", "").Substring(0, 6);
|
||||||
day =OtherData.material.date.Substring(6, 2);
|
day = OtherData.material.date.Replace("-", "").Substring(6, 2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -702,7 +716,7 @@ namespace WindowsFormsApp1.server
|
|||||||
{
|
{
|
||||||
// 图片
|
// 图片
|
||||||
// 组装路径 可能需要从数据库读 result和sn和日期
|
// 组装路径 可能需要从数据库读 result和sn和日期
|
||||||
sourceFolder = Path.Combine(OtherData.ImageAddress, OtherData.material.date, "DCDC", result);
|
sourceFolder = Path.Combine(OtherData.ImageAddress, OtherData.material.date.Replace("-", ""), "DCDC", result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -803,7 +817,7 @@ namespace WindowsFormsApp1.server
|
|||||||
|
|
||||||
var result = PlcData.Read_Result == 1 ? "PASS" : "FAIL";
|
var result = PlcData.Read_Result == 1 ? "PASS" : "FAIL";
|
||||||
var logresult = PlcData.Read_Result == 1 ? "OK" : "NG";
|
var logresult = PlcData.Read_Result == 1 ? "OK" : "NG";
|
||||||
|
|
||||||
// 基础请求对象
|
// 基础请求对象
|
||||||
var request = new CheckOutObject()
|
var request = new CheckOutObject()
|
||||||
{
|
{
|
||||||
@@ -871,36 +885,40 @@ namespace WindowsFormsApp1.server
|
|||||||
//扭力,角度
|
//扭力,角度
|
||||||
if ("ScrewE,Assy2,Assy3,ScrewS,ScrewM,ScrewTC".Contains(stationid))
|
if ("ScrewE,Assy2,Assy3,ScrewS,ScrewM,ScrewTC".Contains(stationid))
|
||||||
{
|
{
|
||||||
var count = OtherData.FinalAngleValue.Count(x => x > 0);
|
Dictionary<int, int> countDict = new Dictionary<int, int>();
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
|
foreach (var item in OtherData.FinalAngleValue)
|
||||||
{
|
{
|
||||||
CsvLogger.Log($"{PlcData.Write_stSN},{OtherData.FinalAngleValue[i]},{OtherData.FinalTorqueValue[i]}");
|
if (item[0] > 0)
|
||||||
|
{
|
||||||
|
var value = item[3];
|
||||||
|
if (!countDict.ContainsKey(value))
|
||||||
|
{
|
||||||
|
countDict[value] = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
countDict[value]++;
|
||||||
|
}
|
||||||
|
var scewResult = item[2] == 1 ? "PASS" : "FAIL";
|
||||||
|
dcInfo = new DCInfoItem();
|
||||||
|
dcInfo.Item = $"{Init.t_Line.lineremark2}_Angle{item[3]}_{countDict[value]}";
|
||||||
|
dcInfo.Value = item[1].ToString();
|
||||||
|
dcInfo.Result = scewResult;
|
||||||
|
|
||||||
|
sninfo.DC_INFO.Add(dcInfo);
|
||||||
|
|
||||||
|
dcInfo = new DCInfoItem();
|
||||||
|
dcInfo.Item = $"{Init.t_Line.lineremark2}_Torque{item[3]}_{countDict[value]}";
|
||||||
|
dcInfo.Value = item[0].ToString();
|
||||||
|
dcInfo.Result = scewResult;
|
||||||
|
|
||||||
|
sninfo.DC_INFO.Add(dcInfo);
|
||||||
|
|
||||||
|
CsvLogger.Log($"{PlcData.Write_stSN},{item[1]},{item[0]}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var AngleCount = 1;
|
|
||||||
foreach (var item in OtherData.FinalAngleValue.Where(x => x > 0))
|
|
||||||
{
|
|
||||||
//角度
|
|
||||||
dcInfo = new DCInfoItem();
|
|
||||||
dcInfo.Item = $"{Init.t_Line.lineremark2}_Angle{AngleCount}";
|
|
||||||
dcInfo.Value = item.ToString();
|
|
||||||
dcInfo.Result = result;
|
|
||||||
|
|
||||||
sninfo.DC_INFO.Add(dcInfo);
|
|
||||||
AngleCount++;
|
|
||||||
}
|
|
||||||
var TorqueCount = 1;
|
|
||||||
foreach (var item in OtherData.FinalTorqueValue.Where(x => x > 0))
|
|
||||||
{
|
|
||||||
//扭力
|
|
||||||
dcInfo = new DCInfoItem();
|
|
||||||
dcInfo.Item = $"{Init.t_Line.lineremark2}_Torque{TorqueCount}";
|
|
||||||
dcInfo.Value = item.ToString();
|
|
||||||
dcInfo.Result = result;
|
|
||||||
|
|
||||||
sninfo.DC_INFO.Add(dcInfo);
|
|
||||||
TorqueCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_isTestMode)
|
if (!_isTestMode)
|
||||||
{
|
{
|
||||||
@@ -941,7 +959,7 @@ namespace WindowsFormsApp1.server
|
|||||||
}
|
}
|
||||||
//LogExecute.SNlogNet.WriteDebug($"追溯码:{PlcData.Read_MaterialCode0},检测结果:{logresult}");
|
//LogExecute.SNlogNet.WriteDebug($"追溯码:{PlcData.Read_MaterialCode0},检测结果:{logresult}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//抽真空 压力
|
//抽真空 压力
|
||||||
if ("Vacuum".Contains(stationid))
|
if ("Vacuum".Contains(stationid))
|
||||||
{
|
{
|
||||||
@@ -964,7 +982,7 @@ namespace WindowsFormsApp1.server
|
|||||||
str += $",{dcInfo.Value},";
|
str += $",{dcInfo.Value},";
|
||||||
CsvLogger.Log(str);
|
CsvLogger.Log(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
//固化 时间
|
//固化 时间
|
||||||
if ("Curing".Contains(stationid))
|
if ("Curing".Contains(stationid))
|
||||||
{
|
{
|
||||||
@@ -1064,7 +1082,7 @@ namespace WindowsFormsApp1.server
|
|||||||
sn = PlcData.Write_stSN,
|
sn = PlcData.Write_stSN,
|
||||||
imageUploaded = 1,
|
imageUploaded = 1,
|
||||||
result = logresult,
|
result = logresult,
|
||||||
date = DateTime.Now.ToString("yyyyMMdd"),
|
date = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||||
outtime = DateTime.Now
|
outtime = DateTime.Now
|
||||||
};
|
};
|
||||||
materialuploadHelper.Insert(material);
|
materialuploadHelper.Insert(material);
|
||||||
@@ -1100,7 +1118,7 @@ namespace WindowsFormsApp1.server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//调用OEEDataCollection
|
//调用OEEDataCollection
|
||||||
//CallFunctionByName("OEEDataCollection", PlcData, OtherData);
|
//CallFunctionByName("OEEDataCollection", PlcData, OtherData);
|
||||||
return CallApi(url, request, "SN_Checkout", PlcData, PLC_Status.SN_Checkout);
|
return CallApi(url, request, "SN_Checkout", PlcData, PLC_Status.SN_Checkout);
|
||||||
@@ -1170,7 +1188,7 @@ namespace WindowsFormsApp1.server
|
|||||||
|
|
||||||
return CallApi(url, request, "OEEDataCollection", PlcData, 0);
|
return CallApi(url, request, "OEEDataCollection", PlcData, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 暂时不用
|
#region 暂时不用
|
||||||
public ApiFormResult Test(string url, plcdata PlcData, otherdata OtherData)
|
public ApiFormResult Test(string url, plcdata PlcData, otherdata OtherData)
|
||||||
{
|
{
|
||||||
@@ -1260,7 +1278,7 @@ namespace WindowsFormsApp1.server
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 打印调用开始日志
|
// 打印调用开始日志
|
||||||
LogExecute.logNet.WriteDebug($"开始调用API: {functionName}...");
|
//LogExecute.logNet.WriteDebug($"开始调用API: {functionName}...");
|
||||||
|
|
||||||
// 检查API URL是否存在
|
// 检查API URL是否存在
|
||||||
if (!apiUrlDict.ContainsKey(functionName))
|
if (!apiUrlDict.ContainsKey(functionName))
|
||||||
@@ -1272,13 +1290,13 @@ namespace WindowsFormsApp1.server
|
|||||||
// 使用同步方法调用API,并结合重试策略
|
// 使用同步方法调用API,并结合重试策略
|
||||||
var result = retryPolicy.Execute(() =>
|
var result = retryPolicy.Execute(() =>
|
||||||
{
|
{
|
||||||
LogExecute.logNet.WriteDebug($"正在尝试调用API: {functionName}...");
|
//LogExecute.logNet.WriteDebug($"正在尝试调用API: {functionName}...");
|
||||||
// 调用该方法
|
// 调用该方法
|
||||||
return (ApiFormResult)methodInfo.Invoke(this, new object[] { apiUrlDict[functionName], plcdata, otherdata });
|
return (ApiFormResult)methodInfo.Invoke(this, new object[] { apiUrlDict[functionName], plcdata, otherdata });
|
||||||
});
|
});
|
||||||
|
|
||||||
// 打印调用结束日志
|
// 打印调用结束日志
|
||||||
LogExecute.logNet.WriteDebug($"API调用成功: {functionName}");
|
//LogExecute.logNet.WriteDebug($"API调用成功: {functionName}");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -1361,10 +1379,10 @@ namespace WindowsFormsApp1.server
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region checkout class
|
#region checkout class
|
||||||
// 根对象类
|
// 根对象类
|
||||||
public class CheckOutObject
|
public class CheckOutObject
|
||||||
{
|
{
|
||||||
public List<SNInfoItem> SNInfo { get; set; }
|
public List<SNInfoItem> SNInfo { get; set; }
|
||||||
public string Qty { get; set; }
|
public string Qty { get; set; }
|
||||||
|
|||||||
@@ -487,7 +487,7 @@ namespace WindowsFormsApp1.server
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 读取角度
|
#region 读取角度
|
||||||
public BllResult<List<float>> ReadAddress(List<t_angleaddress> address)
|
public BllResult<List<dynamic>> ReadAddress(List<t_angleaddress> address)
|
||||||
{
|
{
|
||||||
var ulist = address.GroupBy(a => a.dbaddress).ToList();
|
var ulist = address.GroupBy(a => a.dbaddress).ToList();
|
||||||
foreach (var u in ulist)
|
foreach (var u in ulist)
|
||||||
@@ -495,15 +495,18 @@ namespace WindowsFormsApp1.server
|
|||||||
var readresult = ReadOneDB(u.ToList());
|
var readresult = ReadOneDB(u.ToList());
|
||||||
if (!readresult.Success)
|
if (!readresult.Success)
|
||||||
{
|
{
|
||||||
return BllResult<List<float>>.Error(readresult.Msg);
|
return BllResult<List<dynamic>>.Error(readresult.Msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<float> list = new List<float>();
|
List<dynamic> list = new List<dynamic>();
|
||||||
foreach (var add in address.OrderBy(a => a.addressoffset))
|
foreach (var add in address.OrderBy(a => a.addressoffset))
|
||||||
{
|
{
|
||||||
list.Add(float.Parse(add.value));
|
if(add.addresstype == "real")
|
||||||
|
list.Add(float.Parse(add.value));
|
||||||
|
else
|
||||||
|
list.Add(short.Parse(add.value));
|
||||||
}
|
}
|
||||||
return BllResult<List<float>>.Sucess(list, "成功");
|
return BllResult<List<dynamic>>.Sucess(list, "成功");
|
||||||
}
|
}
|
||||||
private BllResult ReadOneDB(List<t_angleaddress> address)
|
private BllResult ReadOneDB(List<t_angleaddress> address)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user