Преглед на файлове

配料更新

一拖四味魔方配料系统
yaowen liu преди 1 година
родител
ревизия
0e8d79d275
променени са 3 файла, в които са добавени 79 реда и са изтрити 55 реда
  1. +1
    -1
      DosingSystem/ExcuteControl .cs
  2. +4
    -3
      DosingSystem/Model/DeviceInquire.cs
  3. +74
    -51
      DosingSystem/ViewModel/RecipeControlViewModel.cs

+ 1
- 1
DosingSystem/ExcuteControl .cs Целия файл

@@ -100,7 +100,7 @@ namespace BPASmartClient.DosingSystem

}), "取消配方");

AliYunInit();
//AliYunInit();
RecipeRun();
BusinessExcute();
ConveyerPropertyReport();


+ 4
- 3
DosingSystem/Model/DeviceInquire.cs Целия файл

@@ -150,7 +150,7 @@ namespace BPASmartClient.DosingSystem
{
if (!string.IsNullOrEmpty(Json<DevicePar>.Data.BaseParModel.NetworkSegAddress)) IPSegment = Json<DevicePar>.Data.BaseParModel.NetworkSegAddress;
else Json<DevicePar>.Data.BaseParModel.NetworkSegAddress = IPSegment;
TestData();
//TestData();
IpAddressLines();
Task.Factory.StartNew(() =>
{
@@ -210,8 +210,9 @@ namespace BPASmartClient.DosingSystem
stockCount = Json<DevicePar>.Data.BaseParModel.StockCount;
for (int i = 0; i < stockCount; i++)
{
//IPLists.Add($"{IPSegment}{(i + 1) * 10}");
IPLists.Add($"{IPSegment}{this.devices[i].DeviceNum}");
aa((i + 1) * 10, "A" + i.ToString());
IPLists.Add($"{IPSegment}{(i + 1) * 10}");
//IPLists.Add($"{IPSegment}{this.devices[i].DeviceNum}");
}

IPLists.ForEach((item) =>


+ 74
- 51
DosingSystem/ViewModel/RecipeControlViewModel.cs Целия файл

@@ -122,91 +122,114 @@ namespace BPASmartClient.DosingSystem.ViewModel
//}


int index = 0;
private void MatchRun()
{
int index = 0;
string passRecipeName = "";
recipeProcesses.Clear();
TaskManage.GetInstance.StartLong(() =>
{
if (RecipeNames.Count > 0)
{
passRecipeName = recipeProcesses[0].RecipeName;
passRecipeName = recipeProcesses.Last().RecipeName;
if (DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices.Last().IpAddress].deviceStatus.MaxPassPail!=0 && DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices.Last().IpAddress].deviceStatus.MaxPassPail == DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices.Last().IpAddress].deviceStatus.PassPail && DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices.Last().IpAddress].deviceStatus.RunStatus == 3)
{
RecipeNames.TryDequeue(out passRecipeName);
UserTreeCompelete.Insert(0, recipeProcesses.Last());
}
foreach (var item in DeviceInquire.GetInstance.devices)
for (int i = 0; i < DeviceInquire.GetInstance.devices.Count; i++)
{
if (DeviceInquire.GetInstance.DeviceLists.ContainsKey(item.IpAddress))
if (DeviceInquire.GetInstance.DeviceLists.ContainsKey(DeviceInquire.GetInstance.devices[i].IpAddress))
{
if (DeviceInquire.GetInstance.DeviceLists[item.IpAddress].deviceStatus.MaxPassPail == 0 && DeviceInquire.GetInstance.DeviceLists[item.IpAddress].deviceStatus.MaxPassPail == DeviceInquire.GetInstance.DeviceLists[item.IpAddress].deviceStatus.PassPail)
if (DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.MaxPassPail == 0 || DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.RunStatus == 3)
{

index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == RecipeNames.ElementAt(0));
if (index > 0 && index < Recipes.Count)
if (DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.MaxPassPail == DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.PassPail)
{
App.Current.Dispatcher.Invoke(new Action(() =>
index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == RecipeNames.ElementAt(0));
if (index > 0 && index < Recipes.Count)
{
if (UserTreeWait.Count > 0)
App.Current.Dispatcher.Invoke(new Action(() =>
{
recipeProcesses.Insert(0, UserTreeWait[0]);
UserTreeWait.RemoveAt(0);
if (UserTreeWait.Count > 0)
{
recipeProcesses.Insert(0, UserTreeWait?.ToList().Find(a => a.RecipeName == RecipeNames.ElementAt(0)));
UserTreeWait.RemoveAt(UserTreeWait.ToList().FindIndex(a => a.RecipeName == RecipeNames.ElementAt(0)));
}
}));
int maxPail = 0;
foreach (var rawMaterial in Recipes.ElementAt(index).RawMaterials)
{
if (rawMaterial.Loc > maxPail)
{
maxPail = rawMaterial.Loc;
}
}
}));
int maxPail = 0;
foreach (var rawMaterial in Recipes.ElementAt(index).RawMaterials)
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);

}
}
RawMaterialModel res = Recipes.ElementAt(index).RawMaterials?.ToList().Find(a => a.RawMaterialName == DeviceInquire.GetInstance.devices[i].DeviceName);
if (res != null && res.Loc == DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.PassPail)
{
if (DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.PailArrive == 1)
{
if (rawMaterial.Loc > maxPail)
DeviceParModel deviceSet = Json<DevicePar>.Data.deviceParModels?.ToList().Find(a => a.MaterialName == DeviceInquire.GetInstance.devices[i].DeviceName);
if (deviceSet!= null)
{
maxPail = rawMaterial.Loc;
//设置启动
DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].modbusTcp.Write<ushort>(DeviceAddress.Start.ToAdd(), 1);
//设置下料重量
DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].modbusTcp.Write<uint>(DeviceAddress.WeightSet.ToAdd(), res.RawMaterialWeight);
//设置慢加重量
DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].modbusTcp.Write<float>(DeviceAddress.SlowlyAddWeight.ToAdd(), deviceSet.SlowlyAddWeight);
//设置快慢加速度
DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].modbusTcp.Write<int>(DeviceAddress.SlowlyAddWeight.ToAdd(), deviceSet.SlowAcceleration);
DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].modbusTcp.Write<int>(DeviceAddress.RapidAcceleration.ToAdd(), deviceSet.RapidAcceleration);
//设置提前关阀重量
DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].modbusTcp.Write<float>(DeviceAddress.PreCloseValveWeight.ToAdd(), deviceSet.PreCloseValveWeight);
//设置伺服手动速度
DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].modbusTcp.Write<float>(DeviceAddress.ServoManualSpeed.ToAdd(), deviceSet.ServoManualSpeed);
//设置料仓上下限重量
DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].modbusTcp.Write<float>(DeviceAddress.SiloUpperLimitWeight.ToAdd(), deviceSet.SiloUpperLimitWeight);
DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].modbusTcp.Write<float>(DeviceAddress.LowerLimitWeightOfSilo.ToAdd(), deviceSet.LowerLimitWeightOfSilo);
//设置搅拌速度
DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].modbusTcp.Write<int>(DeviceAddress.StirringSpeed.ToAdd(), deviceSet.StirringSpeed);
}
//写入出货量
//下料设定参数
}


DeviceInquire.GetInstance.DeviceLists[item.IpAddress].modbusTcp.Write<ushort>(DeviceAddress.DeletePassPail.ToAdd(), 1);
DeviceInquire.GetInstance.DeviceLists[item.IpAddress].modbusTcp.Write<ushort>(DeviceAddress.MaxPail.ToAdd(), (ushort)maxPail);
}


}
}
}
for (int i = 0; i < DeviceInquire.GetInstance.devices.Count; i++)
{
RawMaterialModel res = Recipes.ElementAt(index).RawMaterials?.ToList().Find(a => a.RawMaterialName == DeviceInquire.GetInstance.devices[i].DeviceName);
if (res != null && res.Loc == DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.PassPail)
{
if (DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.PailArrive == 1)
if (i <= 6)
{
//写入出货量
//出料状态
if (DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.RunStatus == 3 && DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i + 1].IpAddress].deviceStatus.PailArrive == 0)
{
//出料状态
//传送带运行

}
else
{
//传送带停止
}
}
}
if (i <= 6)
{
if (DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.RunStatus == 3 && DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i + 1].IpAddress].deviceStatus.PailArrive == 0)
else
{
//出料状态
//传送带运行
//传送带终点为3则传送带停止,小于3则按照出料状态运行
}
else
if (i == DeviceInquire.GetInstance.devices.Count - 1)
{
//传送带停止
}
}
else
{
//传送带终点为3则传送带停止,小于3则按照出料状态运行
}
if (i== DeviceInquire.GetInstance.devices.Count - 1)
{
}
}
}

Thread.Sleep(100);


Зареждане…
Отказ
Запис