Sfoglia il codice sorgente

shangchaun

一拖四味魔方配料系统
lyw 10 mesi fa
parent
commit
bf077fb66c
3 ha cambiato i file con 72 aggiunte e 13 eliminazioni
  1. +69
    -11
      DosingSystem/ExcuteControl .cs
  2. +1
    -0
      DosingSystem/Model/DeviceInquire.cs
  3. +2
    -2
      DosingSystem/Model/RawMaterialDeviceStatus.cs

+ 69
- 11
DosingSystem/ExcuteControl .cs Vedi File

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


+ 1
- 0
DosingSystem/Model/DeviceInquire.cs Vedi File

@@ -460,6 +460,7 @@ namespace BPASmartClient.DosingSystem
{
deviceStatus.PailArrive = SimensSend.GetInstance.SendSimens.Read<bool>($"DB1.DBX80{(int)((dnum.Content-1)/8)}.{(dnum.Content-1)%8}").Content;
deviceStatus.PassPail = SimensSend.GetInstance.SendSimens.Read<ushort>($"DB1.DBW{810 + 2 * (dnum.Content - 1)}").Content;
deviceStatus.RecipePail = SimensSend.GetInstance.SendSimens.Read<int>($"DB1.DBW{710 + 4 * (dnum.Content - 1)}").Content;
}
}



+ 2
- 2
DosingSystem/Model/RawMaterialDeviceStatus.cs Vedi File

@@ -115,8 +115,8 @@ namespace BPASmartClient.DosingSystem
/// </summary>
public bool PailArrive { get; set; }
/// <summary>
/// 设备执行配方数量
/// 设置桶号
/// </summary>
public ushort DoRecipeCount { get;set; }
public int RecipePail { get;set; }
}
}

Caricamento…
Annulla
Salva