change-修改箱体发泡,门体发泡(发泡机注料记录数据采集)

dev
liuwf 1 year ago
parent 1c6d48bff1
commit 47b733e7f6

@ -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
});
}
/// <summary>
/// 读取注料结束信号
/// </summary>
/// <param name="obj_1"></param>
private void ReadFillingRecord(PlcModel obj_1)
{
if (obj_1 != null && obj_1.plc.IsConnected)

@ -105,6 +105,8 @@ namespace Aucma.Core.BoxFoam.Business
public void init()
{
try
{
allSpaces = _baseSpaceInfoServices.Query(x => x.StoreCode == storeCode);
foreach (var space in allSpaces)
{
@ -119,6 +121,11 @@ namespace Aucma.Core.BoxFoam.Business
//实时监测入库任务下发和入库任务完成
StartPassDownAndRealInstoreFinish();
}
catch (Exception ex)
{
logHelper.Info(ex.Message.ToString());
}
}
/// <summary>
/// 定时器实时监测入库出库完成信号

@ -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)

@ -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
}

@ -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,7 +51,7 @@ namespace Aucma.Core.DoorFoam.Business
Semaphore semaphore = new Semaphore(1, 1);
private readonly IBoxLastShotRecordServices? _lastShotRecordServices = App.ServiceProvider.GetService<IBoxLastShotRecordServices>();
private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(CollectionFoamMachine));
public CollectionFoamMachine()
{
@ -59,6 +60,18 @@ namespace Aucma.Core.DoorFoam.Business
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,13 +86,8 @@ 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);
RefreshSystemDataDelegateEvent?.Invoke(systemKeys);
foreach (KeyValuePair<string, BoxLastShotRecord> 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
});
}
/// <summary>
/// 读取注料结束信号
/// </summary>
/// <param name="obj_1"></param>
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);
}
}
}
/// <summary>
/// 采集设备系统参数
/// </summary>
@ -242,6 +295,7 @@ namespace Aucma.Core.DoorFoam.Business
lastShotRecord.SystemStatus = 0;
}
}
lastShotRecord.StationNumber = "1020";
lastShotRecord.ProductLineCode = "CX_02";

@ -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 () =>
{

@ -203,6 +203,7 @@
"PlcType": "Siemens",
"Enabled": true,
"IP": "10.10.92.180",
//"10.10.92.180": null,
"Port": 102
},
{

Loading…
Cancel
Save