Browse Source

上传

一拖四味魔方配料系统
lyw 10 months ago
parent
commit
076b57b178
1 changed files with 23 additions and 20 deletions
  1. +23
    -20
      DosingSystem/ExcuteControl .cs

+ 23
- 20
DosingSystem/ExcuteControl .cs View File

@@ -505,22 +505,23 @@ namespace BPASmartClient.DosingSystem
{
re = recipeProcesses.ElementAt(recipeProcesses.Count-(recipeNameNum-finish)).RawMaterials.ToList().FindIndex(a => a.RawMaterialName == DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].DeviceName && a.Loc == DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.PassPail && a.RecipeStatus == 1);
re_1 = recipeProcesses.ElementAt(recipeProcesses.Count - (recipeNameNum - finish)).RawMaterials.ToList().FindIndex(a => a.RawMaterialName == DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].DeviceName && a.Loc == DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.PassPail && a.RecipeStatus == 2);
}
if (rTrig[DeviceInquire.GetInstance.devices[i].IpAddress] && re>=0)
{
MessageNotify.GetInstance.ShowRunLog($"找到配方桶,开始下{Recipes.ElementAt(doCount).RawMaterials.ElementAt(res).RawMaterialWeight}g料");
recipeProcesses.ElementAt(recipeNameNum - finish - 1).RawMaterials.ElementAt(re).RecipeStatus = 2;
Raction?.Invoke(DeviceInquire.GetInstance.devices[i].IpAddress, Recipes.ElementAt(doCount).RawMaterials.ElementAt(res).RawMaterialWeight);
rTrig.TryUpdate(DeviceInquire.GetInstance.devices[i].IpAddress,false,true);
}
if (tTrig[DeviceInquire.GetInstance.devices[i].IpAddress] &&re_1>=0)
{
recipeProcesses.ElementAt(recipeNameNum - finish - 1).RawMaterials.ElementAt(re_1).RecipeStatus = 3;
Recipes.ElementAt(doCount).RawMaterials.ElementAt(res).TotalWeight = DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.CutWeightFeedback;
MessageNotify.GetInstance.ShowRunLog($"设备{DeviceInquire.GetInstance.devices[i].IpAddress}已下料{Recipes.ElementAt(doCount).RawMaterials.ElementAt(res).TotalWeight}g");
tTrig.TryUpdate(DeviceInquire.GetInstance.devices[i].IpAddress, false, true);
if (rTrig[DeviceInquire.GetInstance.devices[i].IpAddress] && re >= 0)
{
MessageNotify.GetInstance.ShowRunLog($"找到配方桶,开始下{Recipes.ElementAt(doCount).RawMaterials.ElementAt(res).RawMaterialWeight}g料");
recipeProcesses.ElementAt(recipeProcesses.Count - (recipeNameNum - finish)).RawMaterials.ElementAt(re).RecipeStatus = 2;
recipeProcesses.ElementAt(recipeProcesses.Count - (recipeNameNum - finish)).RawMaterials.ElementAt(re).Status = (Status)1;
Raction?.Invoke(DeviceInquire.GetInstance.devices[i].IpAddress, Recipes.ElementAt(doCount).RawMaterials.ElementAt(res).RawMaterialWeight);
rTrig.TryUpdate(DeviceInquire.GetInstance.devices[i].IpAddress, false, true);
}

if (tTrig[DeviceInquire.GetInstance.devices[i].IpAddress] && re_1 >= 0)
{
recipeProcesses.ElementAt(recipeProcesses.Count - (recipeNameNum - finish)).RawMaterials.ElementAt(re_1).RecipeStatus = 3;
recipeProcesses.ElementAt(recipeProcesses.Count - (recipeNameNum - finish)).RawMaterials.ElementAt(re_1).Status = (Status)2;
Recipes.ElementAt(doCount).RawMaterials.ElementAt(res).TotalWeight = DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.CutWeightFeedback;
MessageNotify.GetInstance.ShowRunLog($"设备{DeviceInquire.GetInstance.devices[i].IpAddress}已下料{Recipes.ElementAt(doCount).RawMaterials.ElementAt(res).TotalWeight}g");
tTrig.TryUpdate(DeviceInquire.GetInstance.devices[i].IpAddress, false, true);
}
}
}
@@ -641,10 +642,11 @@ namespace BPASmartClient.DosingSystem
}
});
}
if (maxPail <= DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.PassPail&& recipeNameNum < RecipeNames.Count)
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)
{
MessageNotify.GetInstance.ShowRunLog("下发下一个配方");
doDeviceCount.TryUpdate(DeviceInquire.GetInstance.devices[i].IpAddress, recipeNameNum + 1, doDeviceCount[DeviceInquire.GetInstance.devices[i].IpAddress]);
recipeNameNum = doDeviceCount[DeviceInquire.GetInstance.devices[i].IpAddress];
index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == RecipeNames.ElementAt(recipeNameNum-1));
if (index >= 0)
{
@@ -660,23 +662,24 @@ namespace BPASmartClient.DosingSystem
}
}
}
SimensSend.GetInstance.SendSimens.Write<int>($"DB1.DBD{710 + 4 * (dnum - 1)}", 0);
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);
SimensSend.GetInstance.SendSimens.Write<ushort>($"DB1.DBW{810 + 2 * (dnum - 1)}", 0);
MessageNotify.GetInstance.ShowRunLog($"设备{dnum}下发配方{RecipeNames.ElementAt(recipeNameNum)},桶数已清零");
MessageNotify.GetInstance.ShowRunLog($"设备{dnum}下发配方{RecipeNames.ElementAt(recipeNameNum-1)},桶数已清零");
if (dnum == 1)
{
App.Current.Dispatcher.Invoke(() =>
{
RecipeModel recipe = UserTreeWait?.ToList().Find(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum));
RecipeModel recipe = UserTreeWait?.ToList().Find(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum-1));
recipe.RecipStatus = "正在配料";
recipeProcesses.Insert(0, recipe);
/* Json<OnRecipe>.Data.Recipes.Insert(0, recipe);
Json<OnRecipe>.Save();*/
UserTreeWait.RemoveAt(UserTreeWait.ToList().FindIndex(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum)));
UserTreeWait.RemoveAt(UserTreeWait.ToList().FindIndex(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum-1)));
});
}
}


Loading…
Cancel
Save