|
|
@@ -890,11 +890,11 @@ namespace BPASmartClient.DosingSystem |
|
|
|
} |
|
|
|
MessageNotify.GetInstance.ShowUserLog($"下发工单 {Recipes.ElementAt(index).RecipeName}"); |
|
|
|
RecipeNames.Enqueue(RecipeName); |
|
|
|
|
|
|
|
var res = Recipes.FirstOrDefault(p => p.RecipeName == RecipeName); |
|
|
|
App.Current.Dispatcher.Invoke(() => { UserTreeWait.Add(new RecipeModel { RecipStatus = "等待制作", SerialNum = UserTreeWait.Count + 1, RecipeName = RecipeName, RawMaterials = res.RawMaterials }); }); |
|
|
|
} |
|
|
|
App.Current.Dispatcher.Invoke(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!"); }); |
|
|
|
App.Current.Dispatcher.Invoke(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!"); }); |
|
|
|
MessageNotify.GetInstance.runLogs.Add(new RunLog() { RunLogInfo = $"下发配方:{RecipeNames.Count}", Time = DateTime.Now.ToString() }); |
|
|
|
|
|
|
|
} |
|
|
|
/// <summary> |
|
|
@@ -1379,11 +1379,10 @@ namespace BPASmartClient.DosingSystem |
|
|
|
recipeProcesses.Clear(); |
|
|
|
TaskManage.GetInstance.StartLong(() => |
|
|
|
{ |
|
|
|
SimensSend.GetInstance.SendSimens.Write("M0.0", true); |
|
|
|
SimensSend.GetInstance.SendSimens.Write("M0.1", true); |
|
|
|
if (RecipeNames.Count > 0) |
|
|
|
{ |
|
|
|
|
|
|
|
SimensSend.GetInstance.SendSimens.Write("M0.0", true); |
|
|
|
SimensSend.GetInstance.SendSimens.Write("M0.1", true); |
|
|
|
for (int i = 0; i < DeviceInquire.GetInstance.devices.Count; i++) |
|
|
|
{ |
|
|
|
if (DeviceInquire.GetInstance.DeviceLists.ContainsKey(DeviceInquire.GetInstance.devices[i].IpAddress)) |
|
|
@@ -1392,21 +1391,15 @@ namespace BPASmartClient.DosingSystem |
|
|
|
{ |
|
|
|
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)) |
|
|
|
{ |
|
|
|
doDeviceCount.TryAdd(DeviceInquire.GetInstance.devices[i].IpAddress,0); |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
if (doDeviceCount.ContainsKey(DeviceInquire.GetInstance.devices[i].IpAddress)) |
|
|
|
{ |
|
|
|
int index = 0; |
|
|
|
int recipeNameNum = doDeviceCount[DeviceInquire.GetInstance.devices[i].IpAddress]; |
|
|
|
if (doDeviceCount[DeviceInquire.GetInstance.devices[i].IpAddress] == DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.DoRecipeCount&& doDeviceCount[DeviceInquire.GetInstance.devices[i].IpAddress]< RecipeNames.Count) |
|
|
|
if (recipeNameNum == DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.DoRecipeCount && recipeNameNum < RecipeNames.Count) |
|
|
|
{ |
|
|
|
index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == RecipeNames.ElementAt(recipeNameNum)); |
|
|
|
if (index >= 0 && index < Recipes.Count) |
|
|
|
{ |
|
|
|
MessageNotify.GetInstance.runLogs.Add(new RunLog() { RunLogInfo = $"下发配方{RecipeNames.ElementAt(recipeNameNum)}到设备{DeviceInquire.GetInstance.devices[i].DeviceName}",Time = DateTime.Now.ToString()}); |
|
|
|
int maxPail = 0; |
|
|
|
foreach (var rawMaterial in Recipes.ElementAt(index).RawMaterials) |
|
|
|
{ |
|
|
@@ -1417,20 +1410,37 @@ namespace BPASmartClient.DosingSystem |
|
|
|
} |
|
|
|
DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].modbusTcp.Write<ushort>(DeviceAddress.DeletePassPail.ToAdd(), 1); |
|
|
|
DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].modbusTcp.Write<ushort>(DeviceAddress.MaxPail.ToAdd(), (ushort)maxPail); |
|
|
|
doDeviceCount.TryUpdate(DeviceInquire.GetInstance.devices[i].IpAddress, doDeviceCount[DeviceInquire.GetInstance.devices[i].IpAddress] + 1, doDeviceCount[DeviceInquire.GetInstance.devices[i].IpAddress]); |
|
|
|
App.Current.Dispatcher.Invoke(new Action(() => |
|
|
|
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) |
|
|
|
{ |
|
|
|
if (doDeviceCount.ContainsKey("192.168.2.10")&&UserTreeWait.Count > 0 && doDeviceCount["192.168.2.10"] > recipeProcesses.Count) |
|
|
|
App.Current.Dispatcher.Invoke(() => |
|
|
|
{ |
|
|
|
recipeProcesses.Insert(0, UserTreeWait?.ToList().Find(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum))); |
|
|
|
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(() => |
|
|
|
{ |
|
|
|
RecipeModel recipe = recipeProcesses?.ToList().Find(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum)); |
|
|
|
recipe.RecipStatus = "制作完成"; |
|
|
|
UserTreeCompelete.Insert(0, recipe); |
|
|
|
recipeProcesses.RemoveAt(recipeProcesses.ToList().FindIndex(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum))); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
|
|
|
|
doDeviceCount.TryAdd(DeviceInquire.GetInstance.devices[i].IpAddress, 0); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@@ -1488,7 +1498,6 @@ namespace BPASmartClient.DosingSystem |
|
|
|
DeviceParModel deviceSet = Json<DevicePar>.Data.deviceParModels?.ToList().Find(a => a.MaterialName == DeviceInquire.GetInstance.devices[i].DeviceName); |
|
|
|
if (deviceSet != null && DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].IsConnected == true) |
|
|
|
{ |
|
|
|
MessageNotify.GetInstance.runLogs.Add(new RunLog() { RunLogInfo = $"下发配料信息{Recipes.ElementAt(doCount).RecipeName}到设备{DeviceInquire.GetInstance.devices[i].DeviceName}",Time = DateTime.Now.ToString() }); |
|
|
|
//传送带停止 |
|
|
|
DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].modbusTcp.Write<ushort>(DeviceAddress.TranspportSwitch.ToAdd(), 0); |
|
|
|
//设置下料重量 |
|
|
@@ -1536,11 +1545,10 @@ namespace BPASmartClient.DosingSystem |
|
|
|
if (DeviceInquire.GetInstance.DeviceLists[ DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.PailArrive == 1) |
|
|
|
{ |
|
|
|
SimensSend.GetInstance.SendSimens.Write("DB1.DBX702.0", 0); |
|
|
|
MessageNotify.GetInstance.runLogs.Add(new RunLog() { RunLogInfo = $"中转料仓正在配料,传送带停止", Time = DateTime.Now.ToString() }); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
SimensSend.GetInstance.SendSimens.Write("DB1.DBW104", (ushort)600); |
|
|
|
SimensSend.GetInstance.SendSimens.Write("DB1.DBW104", (ushort)900); |
|
|
|
SimensSend.GetInstance.SendSimens.Write("DB1.DBX702.0", 1); |
|
|
|
} |
|
|
|
} |
|
|
@@ -1604,9 +1612,6 @@ namespace BPASmartClient.DosingSystem |
|
|
|
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); |
|
|
|
MessageNotify.GetInstance.runLogs.Add(new RunLog() { RunLogInfo = $"设备{DeviceInquire.GetInstance.devices[i].DeviceName}检测到有桶,并且料仓输送阻塞" + |
|
|
|
$"" + |
|
|
|
$"", Time = DateTime.Now.ToString() }); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|