|
|
@@ -404,6 +404,7 @@ namespace BPASmartClient.DosingSystem |
|
|
|
{ |
|
|
|
SimensSend.GetInstance.SendSimens.Write("M0.0", true); |
|
|
|
SimensSend.GetInstance.SendSimens.Write("M0.1", true); |
|
|
|
//遍历每一个味魔方。 |
|
|
|
for (int i = 0; i < DeviceInquire.GetInstance.devices.Count; i++) |
|
|
|
{ |
|
|
|
//判断IP是否在列表中 |
|
|
@@ -412,12 +413,13 @@ namespace BPASmartClient.DosingSystem |
|
|
|
//只有设备在等待配料状态才能下发数据 |
|
|
|
if (DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.RunStatus == 1) |
|
|
|
{ |
|
|
|
//判断 |
|
|
|
//判断MaxPassPail--配方的最大桶数,小于已经通过的桶数。 |
|
|
|
if (DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.MaxPassPail <= DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.PassPail && DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.PailArrive == 0) |
|
|
|
{ |
|
|
|
if (doDeviceCount.ContainsKey(DeviceInquire.GetInstance.devices[i].IpAddress)) |
|
|
|
{ |
|
|
|
int index = 0; |
|
|
|
// 该味魔方已经完成的配方数目。 |
|
|
|
int recipeNameNum = doDeviceCount[DeviceInquire.GetInstance.devices[i].IpAddress]; |
|
|
|
//设备已执行的配方必须小于已经下发的配方。所以每次开启软件时 必须清零设备上的数据。 |
|
|
|
if (recipeNameNum == DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.DoRecipeCount && recipeNameNum < RecipeNames.Count) |
|
|
@@ -441,7 +443,7 @@ namespace BPASmartClient.DosingSystem |
|
|
|
doDeviceCount.TryUpdate(DeviceInquire.GetInstance.devices[i].IpAddress, recipeNameNum + 1, doDeviceCount[DeviceInquire.GetInstance.devices[i].IpAddress]); |
|
|
|
|
|
|
|
App.Current.Dispatcher.Invoke(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方{RecipeNames.ElementAt(recipeNameNum)}{recipeNameNum}下发到设备{DeviceInquire.GetInstance.devices[i].DeviceName}"); }); |
|
|
|
|
|
|
|
//必须等第一台设备下发成功了,才算正在进行。 |
|
|
|
if (doDeviceCount.ContainsKey("192.168.2.10") && UserTreeWait.Count > 0 && doDeviceCount["192.168.2.10"] > recipeProcesses.Count) |
|
|
|
{ |
|
|
|
App.Current.Dispatcher.Invoke(() => |
|
|
@@ -450,6 +452,7 @@ namespace BPASmartClient.DosingSystem |
|
|
|
UserTreeWait.RemoveAt(UserTreeWait.ToList().FindIndex(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum))); |
|
|
|
}); |
|
|
|
} |
|
|
|
// |
|
|
|
if (DeviceInquire.GetInstance.devices[i].IpAddress == "192.168.2.180" && recipeNameNum > 1 && recipeProcesses.Count > 0) |
|
|
|
{ |
|
|
|
App.Current.Dispatcher.Invoke(() => |
|
|
@@ -532,20 +535,31 @@ namespace BPASmartClient.DosingSystem |
|
|
|
var deviceModbus = DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].modbusTcp; |
|
|
|
//传送带停止 |
|
|
|
deviceModbus.Write<ushort>(DeviceAddress.TranspportSwitch.ToAdd(), 0); |
|
|
|
Thread.Sleep(50); |
|
|
|
//设置下料重量 |
|
|
|
deviceModbus.Write<float>(DeviceAddress.WeightSet.ToAdd(), item.RawMaterialWeight); |
|
|
|
Thread.Sleep(50); |
|
|
|
//设置慢加重量 |
|
|
|
deviceModbus.Write<float>(DeviceAddress.SlowlyAddWeight.ToAdd(), deviceSet.SlowlyAddWeight); |
|
|
|
//设置快慢加速度 |
|
|
|
deviceModbus.Write<float>(DeviceAddress.SlowlyAddWeight.ToAdd(), deviceSet.SlowAcceleration); |
|
|
|
deviceModbus.Write<float>(DeviceAddress.RapidAcceleration.ToAdd(), deviceSet.RapidAcceleration); |
|
|
|
Thread.Sleep(50); |
|
|
|
//设置提前关阀重量 |
|
|
|
deviceModbus.Write<float>(DeviceAddress.PreCloseValveWeight.ToAdd(), deviceSet.PreCloseValveWeight); |
|
|
|
Thread.Sleep(50); |
|
|
|
|
|
|
|
//设置快慢加速度 |
|
|
|
deviceModbus.Write<int>(DeviceAddress.SlowAcceleration.ToAdd(), (int)deviceSet.SlowAcceleration); |
|
|
|
Thread.Sleep(50); |
|
|
|
deviceModbus.Write<int>(DeviceAddress.RapidAcceleration.ToAdd(), (int)deviceSet.RapidAcceleration); |
|
|
|
Thread.Sleep(50); |
|
|
|
|
|
|
|
//设置伺服手动速度 |
|
|
|
deviceModbus.Write<float>(DeviceAddress.ServoManualSpeed.ToAdd(), deviceSet.ServoManualSpeed); |
|
|
|
deviceModbus.Write<int>(DeviceAddress.ServoManualSpeed.ToAdd(), deviceSet.ServoManualSpeed); |
|
|
|
Thread.Sleep(50); |
|
|
|
//设置料仓上下限重量 |
|
|
|
deviceModbus.Write<float>(DeviceAddress.SiloUpperLimitWeight.ToAdd(), deviceSet.SiloUpperLimitWeight); |
|
|
|
deviceModbus.Write<float>(DeviceAddress.LowerLimitWeightOfSilo.ToAdd(), deviceSet.LowerLimitWeightOfSilo); |
|
|
|
deviceModbus.Write<int>(DeviceAddress.SiloUpperLimitWeight.ToAdd(), deviceSet.SiloUpperLimitWeight); |
|
|
|
Thread.Sleep(50); |
|
|
|
deviceModbus.Write<int>(DeviceAddress.LowerLimitWeightOfSilo.ToAdd(), deviceSet.LowerLimitWeightOfSilo); |
|
|
|
Thread.Sleep(50); |
|
|
|
//开始配料信号 |
|
|
|
deviceModbus.Write<ushort>(DeviceAddress.Start.ToAdd(), (ushort)1); |
|
|
|
////设置搅拌速度 |
|
|
@@ -637,10 +651,13 @@ namespace BPASmartClient.DosingSystem |
|
|
|
DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].modbusTcp.Write<ushort>(DeviceAddress.TranspportSwitch.ToAdd(), 0); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
var runstatus = DeviceInquire.GetInstance.DeviceLists[$"192.168.2.{(Json<DevicePar>.Data.BaseParModel.StockCount) * 10}"].deviceStatus.RunStatus; |
|
|
|
if (runstatus == 1 || runstatus == 3) |
|
|
|
{ |
|
|
|
if (SimensSend.GetInstance.sendCtrlModel.SendInfo && DeviceInquire.GetInstance.DeviceLists[$"192.168.2.{(Json<DevicePar>.Data.BaseParModel.StockCount) * 10}"].deviceStatus.PailArrive == 1) |
|
|
|
if ((SimensSend.GetInstance.sendCtrlModel.SendInfo && DeviceInquire.GetInstance.DeviceLists[$"192.168.2.{(Json<DevicePar>.Data.BaseParModel.StockCount) * 10}"].deviceStatus.PailArrive == 1)) |
|
|
|
{ |
|
|
|
DeviceInquire.GetInstance.DeviceLists[$"192.168.2.{Json<DevicePar>.Data.BaseParModel.StockCount * 10}"].modbusTcp.Write<ushort>(DeviceAddress.TranspportSwitch.ToAdd(), (ushort)0); |
|
|
|
} |
|
|
@@ -650,8 +667,15 @@ namespace BPASmartClient.DosingSystem |
|
|
|
DeviceInquire.GetInstance.DeviceLists[$"192.168.2.{Json<DevicePar>.Data.BaseParModel.StockCount * 10}"].modbusTcp.Write<ushort>(DeviceAddress.TranspportSwitch.ToAdd(), (ushort)1); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
DeviceInquire.GetInstance.DeviceLists[$"192.168.2.{Json<DevicePar>.Data.BaseParModel.StockCount * 10}"].modbusTcp.Write<ushort>(DeviceAddress.TranspportSwitch.ToAdd(), (ushort)0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Thread.Sleep(10); |
|
|
|