diff --git a/Aucma.Core.BoxFoam/Business/CollectionFoamMachine.cs b/Aucma.Core.BoxFoam/Business/CollectionFoamMachine.cs
index 0aecdbf6..2bb029b6 100644
--- a/Aucma.Core.BoxFoam/Business/CollectionFoamMachine.cs
+++ b/Aucma.Core.BoxFoam/Business/CollectionFoamMachine.cs
@@ -67,7 +67,7 @@ namespace Aucma.Core.BoxFoam.Business
//采集注料记录
Task.Run(() =>
{
- Thread.Sleep(15000);
+ Thread.Sleep(3000);
while (true)
{
var obj = PlcHelper.siemensList.FirstOrDefault(d => d.EquipName.Equals("foamMachinePlc"));
@@ -154,10 +154,10 @@ namespace Aucma.Core.BoxFoam.Business
});
}
-
-
-
-
+ ///
+ /// 读取注料结束信号
+ ///
+ ///
private void ReadFillingRecord(PlcModel obj_1)
{
if (obj_1 != null && obj_1.plc.IsConnected)
diff --git a/Aucma.Core.BoxFoam/Business/InStoreBusiness.cs b/Aucma.Core.BoxFoam/Business/InStoreBusiness.cs
index 24665fbb..b9eba5b8 100644
--- a/Aucma.Core.BoxFoam/Business/InStoreBusiness.cs
+++ b/Aucma.Core.BoxFoam/Business/InStoreBusiness.cs
@@ -104,20 +104,27 @@ namespace Aucma.Core.BoxFoam.Business
public void init()
{
-
- allSpaces = _baseSpaceInfoServices.Query(x => x.StoreCode == storeCode);
- foreach (var space in allSpaces)
+
+ try
+ {
+ allSpaces = _baseSpaceInfoServices.Query(x => x.StoreCode == storeCode);
+ foreach (var space in allSpaces)
+ {
+ spaceAddresses.Add(spaceConfig.GetSpaceAddress(storeCode, space.SpaceCode));
+ }
+ // 模拟入库
+ //Task.Run(() =>
+ //{
+ // Thread.Sleep(5000);
+ // InStore("B24010183025024860011");
+ //});
+ //实时监测入库任务下发和入库任务完成
+ StartPassDownAndRealInstoreFinish();
+ }
+ catch (Exception ex)
{
- spaceAddresses.Add(spaceConfig.GetSpaceAddress(storeCode, space.SpaceCode));
+ logHelper.Info(ex.Message.ToString());
}
- // 模拟入库
- //Task.Run(() =>
- //{
- // Thread.Sleep(5000);
- // InStore("B24010183025024860011");
- //});
- //实时监测入库任务下发和入库任务完成
- StartPassDownAndRealInstoreFinish();
}
///
diff --git a/Aucma.Core.BoxFoam/ViewModels/FoamMachinesPageViewModel.cs b/Aucma.Core.BoxFoam/ViewModels/FoamMachinesPageViewModel.cs
index e20462b6..729255d7 100644
--- a/Aucma.Core.BoxFoam/ViewModels/FoamMachinesPageViewModel.cs
+++ b/Aucma.Core.BoxFoam/ViewModels/FoamMachinesPageViewModel.cs
@@ -223,7 +223,7 @@ namespace Aucma.Core.BoxFoam.ViewModels
LastShotRecordDataGrid.Clear();
int i = 1;
- var list = _boxLastShotRecordServices.QueryAsync(x=>x.StationNumber == "1005").Result.OrderByDescending(d => d.CreateTime).Take(10);
+ var list = _boxLastShotRecordServices.QueryAsync(x=>x.StationNumber == "1005").Result.OrderBy(d => d.CreateTime).Take(10);
if (list == null) return;
//list.OrderByDescending(d => d.CreateTime);
foreach (var item in list)
diff --git a/Aucma.Core.BoxFoam/appsettings.json b/Aucma.Core.BoxFoam/appsettings.json
index 1cda1c76..66123a48 100644
--- a/Aucma.Core.BoxFoam/appsettings.json
+++ b/Aucma.Core.BoxFoam/appsettings.json
@@ -202,31 +202,31 @@
"EquipName": "泡前库Plc",
"PlcType": "Siemens",
"Enabled": true,
- "IP": "127.0.0.1",
- "Port": 103
+ "IP": "10.10.93.41",
+ "Port": 102
},
{
"Id": 2,
"EquipName": "foamLine1Plc",
"PlcType": "Siemens",
"Enabled": true,
- "IP": "127.0.0.1",
- "Port": 104
+ "IP": "10.10.93.21",
+ "Port": 102
},
{
"Id": 3,
"EquipName": "foamLine2Plc",
"PlcType": "Siemens",
"Enabled": true,
- "IP": "127.0.0.1",
- "Port": 105
+ "IP": "10.10.93.1",
+ "Port": 102
},
{
"Id": 4,
"EquipName": "foamMachinePlc",
"PlcType": "Siemens",
"Enabled": true,
- "IP": "127.0.0.1",
+ "IP": "10.10.93.180",
//"IP": "10.10.93.180",
"Port": 102
}
diff --git a/Aucma.Core.DoorFoam/Business/CollectionFoamMachine.cs b/Aucma.Core.DoorFoam/Business/CollectionFoamMachine.cs
index 9fe7f628..dd5d93a1 100644
--- a/Aucma.Core.DoorFoam/Business/CollectionFoamMachine.cs
+++ b/Aucma.Core.DoorFoam/Business/CollectionFoamMachine.cs
@@ -3,6 +3,7 @@ using Admin.Core.IService;
using Admin.Core.Model;
using Aucma.Core.DoorFoam.Models;
using Aucma.Core.HwPLc;
+using log4net;
using Microsoft.Extensions.DependencyInjection;
using NetTaste;
using NPOI.Util;
@@ -50,15 +51,27 @@ namespace Aucma.Core.DoorFoam.Business
Semaphore semaphore = new Semaphore(1, 1);
private readonly IBoxLastShotRecordServices? _lastShotRecordServices = App.ServiceProvider.GetService();
-
+ private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(CollectionFoamMachine));
public CollectionFoamMachine()
{
-
+
}
public void startCollect()
{
+ //采集注料记录
+ Task.Run(() =>
+ {
+ Thread.Sleep(3000);
+ while (true)
+ {
+ var obj = PlcHelper.siemensList.FirstOrDefault(d => d.EquipName.Equals("FoamPlc"));
+ ReadFillingRecord(obj);
+ Thread.Sleep(200);
+ }
+ });
+
Task.Run(() =>
{
while (true)
@@ -73,14 +86,9 @@ namespace Aucma.Core.DoorFoam.Business
ReadEquipSystem(obj, "DB50.388", systemKeys, "1"); //采集1系统
ReadEquipSystem(obj, "DB50.642", systemKeys, "2"); //采集2系统
- ReadGunData(obj, "DB50.896", gunKeys, "A1"); //A1枪数据
- ReadGunData(obj, "DB50.1084", gunKeys, "B1"); //B1枪数据
- ReadGunData(obj, "DB50.1272", gunKeys, "A2"); //A2枪数据
- ReadGunData(obj, "DB50.1460", gunKeys, "B2"); //A2枪数据
+
RefreshSystemDataDelegateEvent?.Invoke(systemKeys);
- RefreshGunDataDelegateEvent?.Invoke(gunKeys);
-
-
+
foreach (KeyValuePair kvPair in gunKeys)
{
@@ -99,17 +107,11 @@ namespace Aucma.Core.DoorFoam.Business
}
tempKeys.Add(kvPair.Key, record);
}
- if (!kvPair.Value.MixpistOff.Equals(tempKeys[kvPair.Key].MixpistOff) && !kvPair.Value.MixpistOff.Equals("0"))
- {
- kvPair.Value.ProductLineCode = "CX_02";
- kvPair.Value.StationNumber = "1020";
- int b = _lastShotRecordServices.AddAsync(kvPair.Value).Result;
- RefreshLastShotDataDelegateEvent?.Invoke(kvPair.Value);
- }
+
// 设备状态变化,更新设备状态
if (kvPair.Value.SystemStatus != tempKeys[kvPair.Key].SystemStatus)
{
- BoxLastShotRecord record = _lastShotRecordServices.Query(x => x.System.Equals(kvPair.Value.System) && x.ProductLineCode.Equals(kvPair.Value.ProductLineCode) && x.GunCode.Equals(kvPair.Value.GunCode) && x.StationNumber == "1020").OrderByDescending(x => x.CreateTime).FirstOrDefault();
+ BoxLastShotRecord record = _lastShotRecordServices.Query(x => x.System.Equals(kvPair.Value.System) && x.ProductLineCode.Equals(kvPair.Value.ProductLineCode) && x.GunCode.Equals(kvPair.Value.GunCode) && x.StationNumber == "1005").OrderByDescending(x => x.CreateTime).FirstOrDefault();
if (record != null)
{
record.SystemStatus = kvPair.Value.SystemStatus;
@@ -150,6 +152,57 @@ namespace Aucma.Core.DoorFoam.Business
});
}
+
+ ///
+ /// 读取注料结束信号
+ ///
+ ///
+ private void ReadFillingRecord(PlcModel obj_1)
+ {
+ if (obj_1 != null && obj_1.plc.IsConnected)
+ {
+ if (obj_1.plc.ReadBool("DB50.DBX983.0"))
+ {
+ logHelper.Info("读取到发泡机A1枪结束信号");
+ ReadGunData(obj_1, "DB50.896", gunKeys, "A1"); //A1枪数据
+ int a = _lastShotRecordServices.AddAsync(gunKeys["A1"]).Result;
+ RefreshLastShotDataDelegateEvent?.Invoke(gunKeys["A1"]);
+ RefreshGunDataDelegateEvent?.Invoke(gunKeys);
+ Thread.Sleep(2000);
+ }
+ else if (obj_1.plc.ReadBool("DB50.DBX1171.0"))
+ {
+ logHelper.Info("读取到发泡机B1枪结束信号");
+ ReadGunData(obj_1, "DB50.1084", gunKeys, "B1"); //B1枪数据
+ int a = _lastShotRecordServices.AddAsync(gunKeys["B1"]).Result;
+ RefreshLastShotDataDelegateEvent?.Invoke(gunKeys["B1"]);
+ RefreshGunDataDelegateEvent?.Invoke(gunKeys);
+ Thread.Sleep(2000);
+ }
+ else if (obj_1.plc.ReadBool("DB50.DBX1359.0"))
+ {
+ logHelper.Info("读取到发泡机A2枪结束信号");
+ ReadGunData(obj_1, "DB50.1272", gunKeys, "A2"); //A2枪数据
+ int a = _lastShotRecordServices.AddAsync(gunKeys["A2"]).Result;
+ RefreshLastShotDataDelegateEvent?.Invoke(gunKeys["A2"]);
+ RefreshGunDataDelegateEvent?.Invoke(gunKeys);
+ Thread.Sleep(2000);
+ }
+ else if (obj_1.plc.ReadBool("DB50.DBX1547.0"))
+ {
+ logHelper.Info("读取到发泡机B2结束信号");
+ ReadGunData(obj_1, "DB50.1460", gunKeys, "B2"); //A2枪数据
+ int a = _lastShotRecordServices.AddAsync(gunKeys["B2"]).Result;
+ RefreshLastShotDataDelegateEvent?.Invoke(gunKeys["B2"]);
+ RefreshGunDataDelegateEvent?.Invoke(gunKeys);
+ Thread.Sleep(2000);
+ }
+ }
+
+ }
+
+
+
///
/// 采集设备系统参数
///
@@ -242,6 +295,7 @@ namespace Aucma.Core.DoorFoam.Business
lastShotRecord.SystemStatus = 0;
}
}
+ lastShotRecord.StationNumber = "1020";
lastShotRecord.ProductLineCode = "CX_02";
diff --git a/Aucma.Core.DoorFoam/ViewModels/FoamMachinesPageViewModel.cs b/Aucma.Core.DoorFoam/ViewModels/FoamMachinesPageViewModel.cs
index 4079768c..9ea53bd6 100644
--- a/Aucma.Core.DoorFoam/ViewModels/FoamMachinesPageViewModel.cs
+++ b/Aucma.Core.DoorFoam/ViewModels/FoamMachinesPageViewModel.cs
@@ -216,7 +216,7 @@ namespace Aucma.Core.DoorFoam.ViewModels
try
{
- var list = _boxLastShotRecordServices.QueryAsync(x => x.CreateTime >= System.DateTime.Now.AddDays(-1)).Result.Take(30).OrderByDescending(d => d.CreateTime);
+ var list = _boxLastShotRecordServices.QueryAsync(x => x.StationNumber == "1020").Result.OrderBy(d => d.CreateTime).Take(10);
if (list == null) return;
System.Windows.Application.Current.Dispatcher.Invoke((Action)(async () =>
{
diff --git a/Aucma.Core.DoorFoam/appsettings.json b/Aucma.Core.DoorFoam/appsettings.json
index 51cf9d2b..ae220806 100644
--- a/Aucma.Core.DoorFoam/appsettings.json
+++ b/Aucma.Core.DoorFoam/appsettings.json
@@ -203,6 +203,7 @@
"PlcType": "Siemens",
"Enabled": true,
"IP": "10.10.92.180",
+ //"10.10.92.180": null,
"Port": 102
},
{