|
|
@@ -35,6 +35,7 @@ using Microsoft.VisualBasic.Logging; |
|
|
|
using Org.BouncyCastle.Asn1.Utilities; |
|
|
|
using Google.Protobuf.WellKnownTypes; |
|
|
|
using System.Windows; |
|
|
|
using Org.BouncyCastle.Asn1; |
|
|
|
|
|
|
|
namespace BPASmartClient.DosingSystem |
|
|
|
{ |
|
|
@@ -574,9 +575,62 @@ namespace BPASmartClient.DosingSystem |
|
|
|
List<int> device_Loc = new List<int>();//下发桶号 |
|
|
|
int recipeNameNum = doDeviceCount[DeviceInquire.GetInstance.devices[i].IpAddress]; |
|
|
|
var dnum = DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.DeviceNum; |
|
|
|
if (recipeNameNum == 0) |
|
|
|
if (DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.RecipePail == 0) |
|
|
|
{ |
|
|
|
MessageNotify.GetInstance.ShowRunLog("执行首个配方"); |
|
|
|
if (dnum ==18) |
|
|
|
{ |
|
|
|
App.Current.Dispatcher.Invoke(() => |
|
|
|
{ |
|
|
|
|
|
|
|
RecipeModel recipe = recipeProcesses?.ToList().Find(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum - 1)); |
|
|
|
if (recipe != null && recipe.RecipStatus == "正在配料") |
|
|
|
{ |
|
|
|
recipe.RecipStatus = "制作完成"; |
|
|
|
UserTreeCompelete.Insert(0, recipe); |
|
|
|
recipeProcesses.RemoveAt(recipeProcesses.ToList().FindIndex(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum - 1))); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == RecipeNames.ElementAt(recipeNameNum)); |
|
|
|
|
|
|
|
if (index >= 0 && dnum > 0) |
|
|
|
{ |
|
|
|
foreach (var rawMaterial in Recipes.ElementAt(index).RawMaterials) |
|
|
|
{ |
|
|
|
if (rawMaterial.DeviceIp == DeviceInquire.GetInstance.devices[i].IpAddress) |
|
|
|
{ |
|
|
|
device_Loc.Add(rawMaterial.Loc); |
|
|
|
} |
|
|
|
} |
|
|
|
foreach (var down_Loc in device_Loc) |
|
|
|
{ |
|
|
|
SimensSend.GetInstance.SendSimens.Write<bool>($"DB1.DBX{710 + 4 * (dnum - 1) + (int)((down_Loc - 1) / 8)}.{(down_Loc - 1) % 8}", true); |
|
|
|
} |
|
|
|
SimensSend.GetInstance.SendSimens.Write<ushort>($"DB1.DBW{106 + 2 * (dnum - 1)}", 600); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"设备{dnum}下发配方{RecipeNames.ElementAt(recipeNameNum)}"); |
|
|
|
if (dnum == 1) |
|
|
|
{ |
|
|
|
App.Current.Dispatcher.Invoke(() => |
|
|
|
{ |
|
|
|
RecipeModel recipe = UserTreeWait?.ToList().Find(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum)); |
|
|
|
if (recipe != null) |
|
|
|
{ |
|
|
|
recipe.RecipStatus = "正在配料"; |
|
|
|
recipeProcesses.Insert(0, recipe); |
|
|
|
UserTreeWait.RemoveAt(UserTreeWait.ToList().FindIndex(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum))); |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
doDeviceCount.TryUpdate(DeviceInquire.GetInstance.devices[i].IpAddress, recipeNameNum + 1, doDeviceCount[DeviceInquire.GetInstance.devices[i].IpAddress]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/* if (recipeNameNum ==0) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
MessageNotify.GetInstance.ShowRunLog("执行首个配方"); |
|
|
|
index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == RecipeNames.ElementAt(recipeNameNum)); |
|
|
|
if (index >= 0 && dnum > 0) |
|
|
|
{ |
|
|
@@ -612,8 +666,8 @@ namespace BPASmartClient.DosingSystem |
|
|
|
{ |
|
|
|
recipe.RecipStatus = "正在配料"; |
|
|
|
recipeProcesses.Insert(0, recipe); |
|
|
|
/*Json<OnRecipe>.Data.Recipes.Insert(0, recipe); |
|
|
|
Json<OnRecipe>.Save();*/ |
|
|
|
*//*Json<OnRecipe>.Data.Recipes.Insert(0, recipe); |
|
|
|
Json<OnRecipe>.Save();*//* |
|
|
|
int removeObj = UserTreeWait.ToList().FindIndex(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum)); |
|
|
|
if (removeObj >= 0 && removeObj < UserTreeWait.Count()) |
|
|
|
UserTreeWait.RemoveAt(removeObj); |
|
|
@@ -641,23 +695,27 @@ namespace BPASmartClient.DosingSystem |
|
|
|
device_Loc.Add(rawMaterial.Loc); |
|
|
|
} |
|
|
|
} |
|
|
|
if (DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.RecipePail == 0) |
|
|
|
{ |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"设备{dnum}下发配方{RecipeNames.ElementAt(recipeNameNum - 1)},桶数已清零"); |
|
|
|
} |
|
|
|
if (dnum == 18 && maxPail <= DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.PassPail) |
|
|
|
{ |
|
|
|
App.Current.Dispatcher.Invoke(() => |
|
|
|
{ |
|
|
|
|
|
|
|
RecipeModel recipe = recipeProcesses?.ToList().Find(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum - 1)); |
|
|
|
if (recipe != null && recipe.RecipStatus != "制作完成") |
|
|
|
if (recipe != null && recipe.RecipStatus == "正在配料"&&UserTreeCompelete.Count< recipeNameNum) |
|
|
|
{ |
|
|
|
/*Json<OnRecipe>.Data.Recipes.RemoveAt(recipeProcesses.ToList().FindIndex(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum))); |
|
|
|
Json<OnRecipe>.Save();*/ |
|
|
|
*//*Json<OnRecipe>.Data.Recipes.RemoveAt(recipeProcesses.ToList().FindIndex(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum))); |
|
|
|
Json<OnRecipe>.Save();*//* |
|
|
|
recipe.RecipStatus = "制作完成"; |
|
|
|
UserTreeCompelete.Insert(0, recipe); |
|
|
|
recipeProcesses.RemoveAt(recipeProcesses.ToList().FindIndex(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum - 1))); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
if (maxPail <= DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.PassPail && recipeNameNum < RecipeNames.Count && !DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.PailArrive) |
|
|
|
if ( DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.RecipePail ==0 && recipeNameNum < RecipeNames.Count && !DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.PailArrive) |
|
|
|
{ |
|
|
|
MessageNotify.GetInstance.ShowRunLog("下发下一个配方"); |
|
|
|
doDeviceCount.TryUpdate(DeviceInquire.GetInstance.devices[i].IpAddress, recipeNameNum + 1, doDeviceCount[DeviceInquire.GetInstance.devices[i].IpAddress]); |
|
|
@@ -694,8 +752,8 @@ namespace BPASmartClient.DosingSystem |
|
|
|
{ |
|
|
|
recipe.RecipStatus = "正在配料"; |
|
|
|
recipeProcesses.Insert(0, recipe); |
|
|
|
/* Json<OnRecipe>.Data.Recipes.Insert(0, recipe); |
|
|
|
Json<OnRecipe>.Save();*/ |
|
|
|
*//* Json<OnRecipe>.Data.Recipes.Insert(0, recipe); |
|
|
|
Json<OnRecipe>.Save();*//* |
|
|
|
UserTreeWait.RemoveAt(UserTreeWait.ToList().FindIndex(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum - 1))); |
|
|
|
} |
|
|
|
|
|
|
@@ -703,7 +761,7 @@ namespace BPASmartClient.DosingSystem |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}*/ |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|