From 3cf29b343534f84074c1b4b8f209a30aae317c70 Mon Sep 17 00:00:00 2001 From: SoulStar Date: Wed, 8 Apr 2026 19:09:45 +0800 Subject: [PATCH] =?UTF-8?q?feat=20-=20=E5=AE=8C=E5=96=84=E6=97=A5=E5=BF=97?= =?UTF-8?q?=EF=BC=8C=E6=9B=B4=E6=96=B0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sln.FormTest/Form1.Designer.cs | 124 +++++++++++++++++++++++ Sln.FormTest/Form1.cs | 40 ++++++++ Sln.FormTest/Form1.resx | 120 ++++++++++++++++++++++ Sln.FormTest/Program.cs | 17 ++++ Sln.FormTest/Sln.FormTest.csproj | 11 ++ Sln.FormTest/TestVar.cs | 13 +++ Sln.Iot.Business/ErrorAnalyseBusiness.cs | 2 +- Sln.Iot.Business/RFID01Business.cs | 34 +++++-- Sln.Iot.Business/RFID02Business.cs | 32 +++--- Sln.Iot.Business/RFID03Business.cs | 8 +- Sln.Iot.Business/RFID04Business.cs | 24 +++-- Sln.Iot.Business/RFID05Business.cs | 51 +++++----- Sln.Iot.Business/RFID06Business.cs | 28 ++--- Sln.Iot.CFX/CFXHelper.cs | 1 + Sln.Iot.PLC/PLCConnect.cs | 5 + Sln.Iot.sln | 10 +- Sln.Iot/appsettings.json | 8 +- 17 files changed, 455 insertions(+), 73 deletions(-) create mode 100644 Sln.FormTest/Form1.Designer.cs create mode 100644 Sln.FormTest/Form1.cs create mode 100644 Sln.FormTest/Form1.resx create mode 100644 Sln.FormTest/Program.cs create mode 100644 Sln.FormTest/Sln.FormTest.csproj create mode 100644 Sln.FormTest/TestVar.cs diff --git a/Sln.FormTest/Form1.Designer.cs b/Sln.FormTest/Form1.Designer.cs new file mode 100644 index 0000000..31339a0 --- /dev/null +++ b/Sln.FormTest/Form1.Designer.cs @@ -0,0 +1,124 @@ +namespace Sln.FormTest +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + button1 = new Button(); + button2 = new Button(); + button3 = new Button(); + button4 = new Button(); + button5 = new Button(); + button6 = new Button(); + SuspendLayout(); + // + // button1 + // + button1.Location = new Point(106, 102); + button1.Name = "button1"; + button1.Size = new Size(75, 23); + button1.TabIndex = 0; + button1.Text = "button1"; + button1.UseVisualStyleBackColor = true; + button1.Click += button1_Click; + // + // button2 + // + button2.Location = new Point(225, 102); + button2.Name = "button2"; + button2.Size = new Size(75, 23); + button2.TabIndex = 1; + button2.Text = "button2"; + button2.UseVisualStyleBackColor = true; + button2.Click += button2_Click; + // + // button3 + // + button3.Location = new Point(364, 102); + button3.Name = "button3"; + button3.Size = new Size(75, 23); + button3.TabIndex = 2; + button3.Text = "button3"; + button3.UseVisualStyleBackColor = true; + button3.Click += button3_Click; + // + // button4 + // + button4.Location = new Point(491, 102); + button4.Name = "button4"; + button4.Size = new Size(75, 23); + button4.TabIndex = 3; + button4.Text = "button4"; + button4.UseVisualStyleBackColor = true; + button4.Click += button4_Click; + // + // button5 + // + button5.Location = new Point(604, 102); + button5.Name = "button5"; + button5.Size = new Size(75, 23); + button5.TabIndex = 4; + button5.Text = "button5"; + button5.UseVisualStyleBackColor = true; + button5.Click += button5_Click; + // + // button6 + // + button6.Location = new Point(741, 102); + button6.Name = "button6"; + button6.Size = new Size(75, 23); + button6.TabIndex = 5; + button6.Text = "button6"; + button6.UseVisualStyleBackColor = true; + button6.Click += button6_Click; + // + // Form1 + // + AutoScaleDimensions = new SizeF(7F, 17F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(1125, 700); + Controls.Add(button6); + Controls.Add(button5); + Controls.Add(button4); + Controls.Add(button3); + Controls.Add(button2); + Controls.Add(button1); + Name = "Form1"; + Text = "Form1"; + ResumeLayout(false); + } + + #endregion + + private Button button1; + private Button button2; + private Button button3; + private Button button4; + private Button button5; + private Button button6; + } +} diff --git a/Sln.FormTest/Form1.cs b/Sln.FormTest/Form1.cs new file mode 100644 index 0000000..5762ce9 --- /dev/null +++ b/Sln.FormTest/Form1.cs @@ -0,0 +1,40 @@ +namespace Sln.FormTest +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + + } + + private void button2_Click(object sender, EventArgs e) + { + + } + + private void button3_Click(object sender, EventArgs e) + { + + } + + private void button4_Click(object sender, EventArgs e) + { + + } + + private void button5_Click(object sender, EventArgs e) + { + + } + + private void button6_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/Sln.FormTest/Form1.resx b/Sln.FormTest/Form1.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/Sln.FormTest/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Sln.FormTest/Program.cs b/Sln.FormTest/Program.cs new file mode 100644 index 0000000..76092ad --- /dev/null +++ b/Sln.FormTest/Program.cs @@ -0,0 +1,17 @@ +namespace Sln.FormTest +{ + internal static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + // To customize application configuration such as set high DPI settings or default font, + // see https://aka.ms/applicationconfiguration. + ApplicationConfiguration.Initialize(); + Application.Run(new Form1()); + } + } +} \ No newline at end of file diff --git a/Sln.FormTest/Sln.FormTest.csproj b/Sln.FormTest/Sln.FormTest.csproj new file mode 100644 index 0000000..118b4b0 --- /dev/null +++ b/Sln.FormTest/Sln.FormTest.csproj @@ -0,0 +1,11 @@ + + + + WinExe + net7.0-windows7.0 + enable + true + enable + + + \ No newline at end of file diff --git a/Sln.FormTest/TestVar.cs b/Sln.FormTest/TestVar.cs new file mode 100644 index 0000000..8a48af2 --- /dev/null +++ b/Sln.FormTest/TestVar.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Sln.FormTest +{ + public class TestVar + { + + } +} diff --git a/Sln.Iot.Business/ErrorAnalyseBusiness.cs b/Sln.Iot.Business/ErrorAnalyseBusiness.cs index 084b4a8..ff1c48d 100644 --- a/Sln.Iot.Business/ErrorAnalyseBusiness.cs +++ b/Sln.Iot.Business/ErrorAnalyseBusiness.cs @@ -129,7 +129,7 @@ namespace Sln.Iot.Business if (errorList.Where(x => x.ErrorName == errorMessage.ENAlarmMessage).Count() != 0) { //删除错误 - string delGuid = errorService.DeleteVacuum2Error(errorMessage.ENAlarmMessage); + string delGuid = errorService.DeleteVacuum1Error(errorMessage.ENAlarmMessage); Guid.TryParse(delGuid, out Guid guidRes); connect1.PublishEvent(new CFXEnvelope(faultClearedEvent.Handle(guidRes))); _log.Info($"真空箱1报警消除 内容:{errorMessage.CNAlarmMessage} 级别:{errorMessage.AlarmDegarde.GetDescription()}"); diff --git a/Sln.Iot.Business/RFID01Business.cs b/Sln.Iot.Business/RFID01Business.cs index 8292695..fdec601 100644 --- a/Sln.Iot.Business/RFID01Business.cs +++ b/Sln.Iot.Business/RFID01Business.cs @@ -15,6 +15,7 @@ using System.Linq; using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; +using TouchSocket.Core; using static System.Runtime.CompilerServices.RuntimeHelpers; namespace Sln.Iot.Business @@ -63,23 +64,40 @@ namespace Sln.Iot.Business { //读取托盘码和产品码 OperateResult trayBytesResult = _plc.ReadBytes(_plc.DeltaInstance3, "D5000", 10); - OperateResult pordBytesResult = _plc.ReadBytes(_plc.DeltaInstance3, "D8000", 60); + OperateResult pordBytesResult1 = _plc.ReadBytes(_plc.DeltaInstance3, "D8000", 90); + OperateResult pordBytesResult2 = _plc.ReadBytes(_plc.DeltaInstance3, "D8090", 90); //成功验证 - if (trayBytesResult.IsSuccess && pordBytesResult.IsSuccess) + if (trayBytesResult.IsSuccess && pordBytesResult1.IsSuccess && pordBytesResult2.IsSuccess) { + //转换托盘码 string traycode = Encoding.ASCII.GetString(trayBytesResult.Content); traycode = traycode.Replace("\0", ""); - _log.Info($"RFID01 [{traycode}]"); - byte[] prodBytes = pordBytesResult.Content; + _log.Info($"托盘到达-RFID01-托盘号-[{traycode}]"); + byte[] prodBytes = pordBytesResult1.Content.Concat(pordBytesResult2.Content).ToArray(); string[] prodcode = new string[6]; //分割转换产品码 for (int i = 0; i < 6; i++) { - prodcode[i] = Encoding.ASCII.GetString(prodBytes[(i * 20)..(i * 20 + 20)]); + prodcode[i] = Encoding.ASCII.GetString(prodBytes[(i * 60)..(i * 60 + 60)]); prodcode[i] = prodcode[i].Replace("\0", ""); + if (!string.IsNullOrEmpty(prodcode[i])) + { + // 将相邻偶数位和奇数位字符对调 + char[] chars = prodcode[i].ToCharArray(); + for (int j = 0; j < chars.Length - 1; j += 2) + { + // 交换相邻的两个字符 + char temp = chars[j]; + chars[j] = chars[j + 1]; + chars[j + 1] = temp; + } + prodcode[i] = new string(chars); + _log.Info($"{prodcode[i]}进入产线"); + } } + //connect1.SendValidateUnitsRequest("", traycode, prodcode); //生成work唯一guid(tid) @@ -120,12 +138,16 @@ namespace Sln.Iot.Business _log.Info($"预热炉工段开始 ID:{tid}"); }); } + else + { + _log.Error($"PLC读取失败,原因1:{trayBytesResult.Message} 2:{pordBytesResult1.Message} 3:{pordBytesResult2.Message}"); + } //流程完成 } } else { - _log.Error("上料提升机PLC读取信号异常"); + _log.Error($"上料提升机PLC读取信号异常,原因:{signalRes.Message}"); } } catch (Exception ex) diff --git a/Sln.Iot.Business/RFID02Business.cs b/Sln.Iot.Business/RFID02Business.cs index ae773bd..815a14a 100644 --- a/Sln.Iot.Business/RFID02Business.cs +++ b/Sln.Iot.Business/RFID02Business.cs @@ -66,7 +66,7 @@ namespace Sln.Iot.Business //转换托盘码 string traycode = Encoding.ASCII.GetString(trayBytesResult.Content); traycode = traycode.Replace("\0", ""); - _log.Info($"RFID02 [{traycode}]"); + _log.Info($"托盘到达-RFID02-托盘号-[{traycode}]"); //sql更新 @@ -105,31 +105,35 @@ namespace Sln.Iot.Business //预热炉数据采集 var data = unitsProcessPLCDataGetBusiness.PreHeatOvenPlcDataGet(); ovenPlcDataService.InsertData(stid, data); - _log.Info($"预热炉数据采集, {data}"); + _log.Info($"预热炉数据采集, 预热炉温度:{data}"); //真空箱1数据采集 var data2 = unitsProcessPLCDataGetBusiness.Vacuum1PlcDataGet(); vacuumInjectionPlcDataService.InsertData(stid, data2); - _log.Info($"真空箱1温度数据采集, " + - $"GlueAmountSetValue1:{data2.GlueAmountSetValue1} " + - $"GluePushSpeedSetValue1:{data2.GluePushSpeedSetValue1} " + - $"BarrelA1TempActValue1:{data2.BarrelA1TempActValue1} " + - $"BarrelA2TempActValue1:{data2.BarrelA2TempActValue1} " + - $"BarrelB1TempActValue1:{data2.BarrelB1TempActValue1} " + - $"BarrelB2TempActValue1:{data2.BarrelB2TempActValue1} " + - $"PumpAPressureActValue1:{data2.PumpAPressureActValue1} " + - $"PumpBPressureActValue1:{data2.PumpBPressureActValue1} " + - $"VacuumDegreeActValue1:{data2.VacuumDegreeActValue1} " + - $"PressureHoldTimeSetValue1:{data2.PressureHoldTimeSetValue1}"); + _log.Info($"真空箱1温度数据采集\n" + + $"胶量1:{data2.GlueAmountSetValue1}\t" + + $"推胶速度1:{data2.GluePushSpeedSetValue1}\n" + + $"A1温度1:{data2.BarrelA1TempActValue1}\t" + + $"A2温度1:{data2.BarrelA2TempActValue1}\t" + + $"B1温度1:{data2.BarrelB1TempActValue1}\t" + + $"B2温度1:{data2.BarrelB2TempActValue1}\n" + + $"A泵压力1:{data2.PumpAPressureActValue1}\t" + + $"B泵压力1:{data2.PumpBPressureActValue1}\t" + + $"真空度1:{data2.VacuumDegreeActValue1}\t" + + $"保压时间1:{data2.PressureHoldTimeSetValue1}"); }); //CFX } + else + { + _log.Error($"PLC读取失败,原因:{trayBytesResult.Message}"); + } //流程完成 } } else { - _log.Error("胶机1真空箱内PLC读取信号异常"); + _log.Error($"胶机1真空箱内PLC读取信号异常,原因:{signalRes.Message}"); } } catch (Exception ex) diff --git a/Sln.Iot.Business/RFID03Business.cs b/Sln.Iot.Business/RFID03Business.cs index 5a60329..3a2b701 100644 --- a/Sln.Iot.Business/RFID03Business.cs +++ b/Sln.Iot.Business/RFID03Business.cs @@ -60,7 +60,7 @@ namespace Sln.Iot.Business //转换托盘码 string traycode = Encoding.ASCII.GetString(trayBytesResult.Content); traycode = traycode.Replace("\0", ""); - _log.Info($"RFID03 [{traycode}]"); + _log.Info($"托盘到达-RFID03-托盘号-[{traycode}]"); //sql更新 //取出work唯一guid(tid) @@ -94,12 +94,16 @@ namespace Sln.Iot.Business _log.Info($"预固炉工段开启, {tid}"); }); } + else + { + _log.Error($"PLC读取失败,原因:{trayBytesResult.Message}"); + } //流程完成 } } else { - _log.Error("胶机1真空箱外PLC读取信号异常"); + _log.Error($"胶机1真空箱外PLC读取信号异常,原因:{signalRes.Message}"); } } catch (Exception ex) diff --git a/Sln.Iot.Business/RFID04Business.cs b/Sln.Iot.Business/RFID04Business.cs index 04c7b0f..7cb27f0 100644 --- a/Sln.Iot.Business/RFID04Business.cs +++ b/Sln.Iot.Business/RFID04Business.cs @@ -66,7 +66,7 @@ namespace Sln.Iot.Business //转换托盘吗 string traycode = Encoding.ASCII.GetString(trayBytesResult.Content); traycode = traycode.Replace("\0", ""); - _log.Info($"RFID04 [{traycode}]"); + _log.Info($"托盘到达-RFID04-托盘号-[{traycode}]"); //sql更新 //取出work唯一guid(tid) @@ -103,13 +103,17 @@ namespace Sln.Iot.Business //预固炉数据采集 var data = unitsProcessPLCDataGetBusiness.PreCureOvenPlcDataGet(); ovenPlcDataService.UpdateDataPreCure(stid, data); - _log.Info($"预固炉温度数据采集, " + - $"PreCureOven1TempActValue:{data.PreCureOven1TempActValue} " + - $"PreCureOven2TempActValue:{data.PreCureOven2TempActValue} " + - $"PreCureOven3TempActValue:{data.PreCureOven3TempActValue} " + - $"PreCureOven4TempActValue:{data.PreCureOven4TempActValue}"); + _log.Info($"预固炉温度数据采集\n" + + $"预固炉1温度:{data.PreCureOven1TempActValue}\t" + + $"预固炉2温度:{data.PreCureOven2TempActValue}\t" + + $"预固炉3温度:{data.PreCureOven3TempActValue}\t" + + $"预固炉4温度:{data.PreCureOven4TempActValue}\n"); }); } + else + { + _log.Error($"PLC读取失败,原因:{trayBytesResult.Message}"); + } //流程完成 } // 计算时间差 @@ -139,7 +143,7 @@ namespace Sln.Iot.Business //计算时间差 TimeSpan span = Convert.ToDateTime(time2) - Convert.ToDateTime(nowTime); spanSecond = (ushort)span.TotalSeconds; - _log.Info($"预固炉时间差" + spanSecond); + _log.Info($"预固炉时间差: [" + spanSecond + "] 秒"); } res = _plc.PlcWrite(_plc.DeltaInstance2, "D810", spanSecond, DataTypeEnum.UInt16).IsSuccess; if (!res) @@ -153,12 +157,16 @@ namespace Sln.Iot.Business _log.Error("胶机2真空箱前时间计算PLC写入完成信号异常"); } } + else + { + _log.Error($"PLC读取失败,原因:{trayBytesResult.Message}"); + } //流程完成 } } else { - _log.Error("胶机2真空箱前开始时间读PLC取信号异常"); + _log.Error($"胶机2真空箱前开始时间读PLC取信号异常,原因:{signalRes.Message}"); } } catch (Exception ex) diff --git a/Sln.Iot.Business/RFID05Business.cs b/Sln.Iot.Business/RFID05Business.cs index 1a1e089..39880ce 100644 --- a/Sln.Iot.Business/RFID05Business.cs +++ b/Sln.Iot.Business/RFID05Business.cs @@ -68,7 +68,7 @@ namespace Sln.Iot.Business //转换托盘吗 string traycode = Encoding.ASCII.GetString(trayBytesResult.Content); traycode = traycode.Replace("\0", ""); - _log.Info($"RFID05 [{traycode}]"); + _log.Info($"托盘到达-RFID05-托盘号-[{traycode}]"); //sql更新 //取出work唯一guid(tid) @@ -116,42 +116,45 @@ namespace Sln.Iot.Business unitsData1.VacuumDegreeActValue2 = unitsData2.VacuumDegreeActValue2; unitsData1.PressureHoldTimeSetValue2 = unitsData2.PressureHoldTimeSetValue2; connect1.PublishEvent(new CFXEnvelope(unitsProcessedEvent.Handle(tid, cFXUnitProcessedDataGet.ProcessDataGet1(unitsData1)))); - _log.Info($"真空箱温度数据上传, " + - $"GlueAmountSetValue1:{unitsData1.GlueAmountSetValue1} " + - $"GluePushSpeedSetValue1:{unitsData1.GluePushSpeedSetValue1} " + - $"BarrelA1TempActValue1:{unitsData1.BarrelA1TempActValue1} " + - $"BarrelA2TempActValue1:{unitsData1.BarrelA2TempActValue1} " + - $"BarrelB1TempActValue1:{unitsData1.BarrelB1TempActValue1} " + - $"BarrelB2TempActValue1:{unitsData1.BarrelB2TempActValue1} " + - $"PumpAPressureActValue1:{unitsData1.PumpAPressureActValue1} " + - $"PumpBPressureActValue1:{unitsData1.PumpBPressureActValue1} " + - $"VacuumDegreeActValue1:{unitsData1.VacuumDegreeActValue1} " + - $"PressureHoldTimeSetValue1:{unitsData1.PressureHoldTimeSetValue1} " + - $"GlueAmountSetValue2:{unitsData1.GlueAmountSetValue2} " + - $"GluePushSpeedSetValue2:{unitsData1.GluePushSpeedSetValue2} " + - $"BarrelA1TempActValue2:{unitsData1.BarrelA1TempActValue2} " + - $"BarrelA2TempActValue2:{unitsData1.BarrelA2TempActValue2} " + - $"BarrelB1TempActValue2:{unitsData1.BarrelB1TempActValue2} " + - $"BarrelB2TempActValue2:{unitsData1.BarrelB2TempActValue2} " + - $"PumpAPressureActValue2:{unitsData1.PumpAPressureActValue2} " + - $"PumpBPressureActValue2:{unitsData1.PumpBPressureActValue2} " + - $"VacuumDegreeActValue2:{unitsData1.VacuumDegreeActValue2} " + - $"PressureHoldTimeSetValue2:{unitsData1.PressureHoldTimeSetValue2}"); + _log.Info($"真空箱温度数据上传\n" + + $"胶量1:{unitsData1.GlueAmountSetValue1}\t" + + $"推胶速度1:{unitsData1.GluePushSpeedSetValue1}\n" + + $"A1温度1:{unitsData1.BarrelA1TempActValue1}\t" + + $"A2温度1:{unitsData1.BarrelA2TempActValue1}\t" + + $"B1温度1:{unitsData1.BarrelB1TempActValue1}\t" + + $"B2温度1:{unitsData1.BarrelB2TempActValue1}\n" + + $"A泵压力1:{unitsData1.PumpAPressureActValue1}\t" + + $"B泵压力1:{unitsData1.PumpBPressureActValue1}\t" + + $"真空度1:{unitsData1.VacuumDegreeActValue1}\t" + + $"保压时间1:{unitsData1.PressureHoldTimeSetValue1}\n" + + $"胶量2:{unitsData1.GlueAmountSetValue2}\t" + + $"推胶速度2:{unitsData1.GluePushSpeedSetValue2}\n" + + $"A1温度2:{unitsData1.BarrelA1TempActValue2}\t" + + $"A2温度2:{unitsData1.BarrelA2TempActValue2}\t" + + $"B1温度2:{unitsData1.BarrelB1TempActValue2}\t" + + $"B2温度2:{unitsData1.BarrelB2TempActValue2}\n" + + $"A泵压力2:{unitsData1.PumpAPressureActValue2}\t" + + $"B泵压力2:{unitsData1.PumpBPressureActValue2}\t" + + $"真空度2:{unitsData1.VacuumDegreeActValue2}\t" + + $"保压时间2:{unitsData1.PressureHoldTimeSetValue2}"); }); } + else + { + _log.Error($"PLC读取失败,原因:{trayBytesResult.Message}"); + } //流程完成 } } else { - _log.Error("胶机2真空箱后PLC读取信号异常"); + _log.Error($"胶机2真空箱后PLC读取信号异常,原因:{signalRes.Message}"); } } catch (Exception ex) { _log.Error("RFID0业务出现异常", ex); } - } } } diff --git a/Sln.Iot.Business/RFID06Business.cs b/Sln.Iot.Business/RFID06Business.cs index bf53a1c..596c746 100644 --- a/Sln.Iot.Business/RFID06Business.cs +++ b/Sln.Iot.Business/RFID06Business.cs @@ -78,7 +78,7 @@ namespace Sln.Iot.Business //转换托盘吗 string traycode = Encoding.ASCII.GetString(trayBytesResult.Content); traycode = traycode.Replace("\0", ""); - _log.Info($"RFID06 [{traycode}]"); + _log.Info($"托盘到达-RFID06-托盘号-[{traycode}]"); //sql更新 //取出work唯一guid(tid) @@ -135,24 +135,28 @@ namespace Sln.Iot.Business unitsdata = ovenPlcDataService.GetData(stid); connect3.PublishEvent(new CFXEnvelope(unitsProcessedEvent.Handle(tid, cFXUnitProcessedDataGet.ProcessDataGet3(unitsdata)))); - _log.Info($"隧道烤箱温度数据上传, " + - $"PreheatOvenTempActValue:{unitsdata.PreheatOvenTempActValue} " + - $"PreCureOven1TempActValue:{unitsdata.PreCureOven1TempActValue} " + - $"PreCureOven2TempActValue:{unitsdata.PreCureOven2TempActValue} " + - $"PreCureOven3TempActValue:{unitsdata.PreCureOven3TempActValue} " + - $"PreCureOven4TempActValue:{unitsdata.PreCureOven4TempActValue} " + - $"CureOven1TempActValue:{unitsdata.CureOven1TempActValue} " + - $"CureOven2TempActValue:{unitsdata.CureOven2TempActValue} " + - $"CureOven3TempActValue:{unitsdata.CureOven3TempActValue} " + - $"CureOven4TempActValue:{unitsdata.CureOven4TempActValue} "); + _log.Info($"隧道烤箱温度数据上传\n" + + $"预热炉温度:{unitsdata.PreheatOvenTempActValue}\n" + + $"预固炉1温度:{unitsdata.PreCureOven1TempActValue}\t" + + $"预固炉2温度:{unitsdata.PreCureOven2TempActValue}\t" + + $"预固炉3温度:{unitsdata.PreCureOven3TempActValue}\t" + + $"预固炉4温度:{unitsdata.PreCureOven4TempActValue}\n" + + $"固化炉1温度:{unitsdata.CureOven1TempActValue}\t" + + $"固化炉2温度:{unitsdata.CureOven2TempActValue}\t" + + $"固化炉3温度:{unitsdata.CureOven3TempActValue}\t" + + $"固化炉4温度:{unitsdata.CureOven4TempActValue}"); }); } + else + { + _log.Error($"PLC读取失败,原因:{trayBytesResult.Message}"); + } //流程完成 } } else { - _log.Error("下料提升机PLC读取信号异常"); + _log.Error($"下料提升机PLC读取信号异常,原因:{signalRes.Message}"); } } catch (Exception ex) diff --git a/Sln.Iot.CFX/CFXHelper.cs b/Sln.Iot.CFX/CFXHelper.cs index e0a3016..dcd6966 100644 --- a/Sln.Iot.CFX/CFXHelper.cs +++ b/Sln.Iot.CFX/CFXHelper.cs @@ -118,6 +118,7 @@ public abstract class CFXHelper //Task.Run(() => //{ Endpoint.Publish(env); + _log.Iot($"{Endpoint.CFXHandle}推送事件{env.MessageName}"); //}); } catch (Exception e) diff --git a/Sln.Iot.PLC/PLCConnect.cs b/Sln.Iot.PLC/PLCConnect.cs index 96ef469..eb79cf7 100644 --- a/Sln.Iot.PLC/PLCConnect.cs +++ b/Sln.Iot.PLC/PLCConnect.cs @@ -64,10 +64,15 @@ namespace Sln.Iot.PLC await Task.WhenAll(tasks); DeltaInstance0 = tasks[0].GetAwaiter().GetResult(); + _log.Info($"PLC连接成功: {DeltaInstance0.IpAddress}"); DeltaInstance1 = tasks[1].GetAwaiter().GetResult(); + _log.Info($"PLC连接成功: {DeltaInstance1.IpAddress}"); DeltaInstance2 = tasks[2].GetAwaiter().GetResult(); + _log.Info($"PLC连接成功: {DeltaInstance2.IpAddress}"); DeltaInstance3 = tasks[3].GetAwaiter().GetResult(); + _log.Info($"PLC连接成功: {DeltaInstance3.IpAddress}"); DeltaInstance4 = tasks[4].GetAwaiter().GetResult(); + _log.Info($"PLC连接成功: {DeltaInstance4.IpAddress}"); _log.Info("PLC连接全部成功"); } diff --git a/Sln.Iot.sln b/Sln.Iot.sln index 5f762d0..e9c0d97 100644 --- a/Sln.Iot.sln +++ b/Sln.Iot.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.9.34714.143 +# Visual Studio Version 18 +VisualStudioVersion = 18.2.11415.280 d18.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sln.Iot", "Sln.Iot\Sln.Iot.csproj", "{2140AD68-D4CE-44EC-B9D3-20D18EB59F9D}" EndProject @@ -25,6 +25,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Iot.CFX", "Sln.Iot.CFX\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Iot.Model", "Sln.Iot.Model\Sln.Iot.Model.csproj", "{B3E4E8E2-36BE-4EC7-BD7D-F53508468407}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.FormTest", "Sln.FormTest\Sln.FormTest.csproj", "{D33C64B6-898E-4AF0-84A6-304071875137}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -75,6 +77,10 @@ Global {B3E4E8E2-36BE-4EC7-BD7D-F53508468407}.Debug|Any CPU.Build.0 = Debug|Any CPU {B3E4E8E2-36BE-4EC7-BD7D-F53508468407}.Release|Any CPU.ActiveCfg = Release|Any CPU {B3E4E8E2-36BE-4EC7-BD7D-F53508468407}.Release|Any CPU.Build.0 = Release|Any CPU + {D33C64B6-898E-4AF0-84A6-304071875137}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D33C64B6-898E-4AF0-84A6-304071875137}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D33C64B6-898E-4AF0-84A6-304071875137}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D33C64B6-898E-4AF0-84A6-304071875137}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Sln.Iot/appsettings.json b/Sln.Iot/appsettings.json index ec7f85d..7fbbb41 100644 --- a/Sln.Iot/appsettings.json +++ b/Sln.Iot/appsettings.json @@ -5,25 +5,25 @@ "DeviceName": "Vacuum", "CFXHandle": "CFX.A00.OT00470018", "LocalURI": "amqp://127.0.0.1:1235", - "UpperURI": "amqp://127.0.0.1:30031" + "UpperURI": "http://10.148.192.32:8090/sensordata?sensorId=UploadMachineData" }, "Lift1Config": { "DeviceName": "Lift1", "CFXHandle": "CFX.A00.OT00470019", "LocalURI": "amqp://127.0.0.1:1236", - "UpperURI": "amqp://127.0.0.1:30031" + "UpperURI": "http://10.148.192.32:8090/sensordata?sensorId=UploadMachineData" }, "OvenConfig": { "DeviceName": "Oven", "CFXHandle": "CFX.A00.OT00470017", "LocalURI": "amqp://127.0.0.1:1237", - "UpperURI": "amqp://127.0.0.1:30031" + "UpperURI": "http://10.148.192.32:8090/sensordata?sensorId=UploadMachineData" }, "Lift2Config": { "DeviceName": "Lift2", "CFXHandle": "CFX.A00.OT00470020", "LocalURI": "amqp://127.0.0.1:1238", - "UpperURI": "amqp://127.0.0.1:30031" + "UpperURI": "http://10.148.192.32:8090/sensordata?sensorId=UploadMachineData" } } }