Browse Source

升级版MORKS

master
pry 1 year ago
parent
commit
c79f7b12f5
33 changed files with 2315 additions and 12 deletions
  1. +1
    -1
      BPASmartClient.Business/BPASmartClient.Business.csproj
  2. +1
    -1
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  3. +1
    -1
      BPASmartClient.Device/BPASmartClient.Device.csproj
  4. +1
    -1
      BPASmartClient.DosingSystemSingle/BPASmartClient.DosingSystemSingle.csproj
  5. +1
    -1
      BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj
  6. +1
    -1
      BPASmartClient.Model/BPASmartClient.Model.csproj
  7. +1
    -1
      BPASmartClient.MorkF/BPASmartClient.MorkF.csproj
  8. +1
    -1
      BPASmartClient.MorkMW/BPASmartClient.MorkMW.csproj
  9. +1
    -1
      BPASmartClient.MorkS/BPASmartClient.MorkS.csproj
  10. +74
    -0
      BPASmartClient.MorkSUpgradedVer/Alarm.cs
  11. +35
    -0
      BPASmartClient.MorkSUpgradedVer/BPASmartClient.MorkSUpgradedVer.csproj
  12. +755
    -0
      BPASmartClient.MorkSUpgradedVer/Control_MorkSUpgradedVer.cs
  13. +51
    -0
      BPASmartClient.MorkSUpgradedVer/DataServer.cs
  14. +193
    -0
      BPASmartClient.MorkSUpgradedVer/DeviceData.cs
  15. +322
    -0
      BPASmartClient.MorkSUpgradedVer/GVL_MorkSUpgradedVer.cs
  16. +26
    -0
      BPASmartClient.MorkSUpgradedVer/GlobalUsing.cs
  17. +13
    -0
      BPASmartClient.MorkSUpgradedVer/Model/Global.cs
  18. +16
    -0
      BPASmartClient.MorkSUpgradedVer/Model/MorksPar.cs
  19. +29
    -0
      BPASmartClient.MorkSUpgradedVer/Model/ParSet.cs
  20. +14
    -0
      BPASmartClient.MorkSUpgradedVer/Model/WritePar.cs
  21. +23
    -0
      BPASmartClient.MorkSUpgradedVer/OrderLocInfo.cs
  22. +117
    -0
      BPASmartClient.MorkSUpgradedVer/View/Debug.xaml
  23. +30
    -0
      BPASmartClient.MorkSUpgradedVer/View/Debug.xaml.cs
  24. +242
    -0
      BPASmartClient.MorkSUpgradedVer/View/Monitor.xaml
  25. +28
    -0
      BPASmartClient.MorkSUpgradedVer/View/Monitor.xaml.cs
  26. +130
    -0
      BPASmartClient.MorkSUpgradedVer/View/ParSet.xaml
  27. +28
    -0
      BPASmartClient.MorkSUpgradedVer/View/ParSet.xaml.cs
  28. +79
    -0
      BPASmartClient.MorkSUpgradedVer/ViewModel/DebugViewModel.cs
  29. +25
    -0
      BPASmartClient.MorkSUpgradedVer/ViewModel/MonitorViewModel.cs
  30. +49
    -0
      BPASmartClient.MorkSUpgradedVer/ViewModel/ParSetViewModel.cs
  31. +2
    -1
      BPASmartClient/BPASmartClient.csproj
  32. +1
    -1
      DosingSystem/BPASmartClient.DosingSystem.csproj
  33. +24
    -1
      SmartClient.sln

+ 1
- 1
BPASmartClient.Business/BPASmartClient.Business.csproj View File

@@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Include="BPA.ApolloClient" Version="1.0.12" />
<PackageReference Include="BPA.Helper" Version="1.0.33" />
<PackageReference Include="BPA.Message" Version="1.0.84" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />


+ 1
- 1
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj View File

@@ -410,7 +410,7 @@

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.28" />
<PackageReference Include="BPA.Message" Version="1.0.84" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="MahApps.Metro.IconPacks.FontAwesome" Version="4.11.0" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
</ItemGroup>


+ 1
- 1
BPASmartClient.Device/BPASmartClient.Device.csproj View File

@@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.84" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
</ItemGroup>

<ItemGroup>


+ 1
- 1
BPASmartClient.DosingSystemSingle/BPASmartClient.DosingSystemSingle.csproj View File

@@ -17,7 +17,7 @@

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.33" />
<PackageReference Include="BPA.Message" Version="1.0.84" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>



+ 1
- 1
BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj View File

@@ -14,7 +14,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.84" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>


+ 1
- 1
BPASmartClient.Model/BPASmartClient.Model.csproj View File

@@ -17,7 +17,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.84" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
</ItemGroup>



+ 1
- 1
BPASmartClient.MorkF/BPASmartClient.MorkF.csproj View File

@@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.84" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
</ItemGroup>

<ItemGroup>


+ 1
- 1
BPASmartClient.MorkMW/BPASmartClient.MorkMW.csproj View File

@@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.84" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="BPA.Models" Version="1.0.38" />
<PackageReference Include="CommunityToolkit.Common" Version="8.0.0" />
</ItemGroup>


+ 1
- 1
BPASmartClient.MorkS/BPASmartClient.MorkS.csproj View File

@@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.84" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="BPA.Models" Version="1.0.38" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
<PackageReference Include="System.Speech" Version="6.0.0" />


+ 74
- 0
BPASmartClient.MorkSUpgradedVer/Alarm.cs View File

@@ -0,0 +1,74 @@
using BPASmartClient.Device;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkSUpgradedVer
{
public class Alarm : IAlarm
{
/// <summary>
/// 煮面机温度过低
/// </summary>
[Alarm("煮面机温度过低")]
public bool MachineLowTemperature { get; set; }

/// <summary>
/// 大碗数量不足
/// </summary>
[Alarm("大碗数量不足")]
public bool Supply1_LossBowl { get; set; }

/// <summary>
/// 一次性碗数量不足
/// </summary>
[Alarm("一次性碗数量不足")]
public bool Supply2_LossBowl { get; set; }

/// <summary>
/// 设备未初始化
/// </summary>
[Alarm("设备未初始化")]
public bool DeviceNoInit { get; set; }

/// <summary>
/// 移碗丝杆未初始化
/// </summary>
[Alarm("移碗丝杆未初始化")]
public bool MoveScrewRodNoInit { get; set; }

/// <summary>
/// 供碗1未初始化
/// </summary>
[Alarm("供碗1未初始化")]
public bool SacrificialVesselNoInit { get; set; }

/// <summary>
/// 气缸推杆未初始化
/// </summary>
[Alarm("气缸推杆未初始化")]
public bool CylinderNoInit { get; set; }

/// <summary>
/// 煮面机初未初始化
/// </summary>
[Alarm("煮面机初未初始化")]
public bool NoodleCookerNoInit { get; set; }

/// <summary>
/// 机器人未初始化
/// </summary>
[Alarm("机器人未初始化")]
public bool RobotNoInit { get; set; }

/// <summary>
/// 料仓未初始化
/// </summary>
[Alarm("料仓未初始化")]
public bool SiloNoInit { get; set; }


}
}

+ 35
- 0
BPASmartClient.MorkSUpgradedVer/BPASmartClient.MorkSUpgradedVer.csproj View File

@@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="BPA.Models" Version="1.0.38" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" />
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" />
<ProjectReference Include="..\BPASmartClient.EventBus\BPASmartClient.EventBus.csproj" />
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.MORKSM.BK.PLC\BPASmartClient.PLC.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Update="View\Debug.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="View\Monitor.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="View\ParSet.xaml.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>

</Project>

+ 755
- 0
BPASmartClient.MorkSUpgradedVer/Control_MorkSUpgradedVer.cs View File

@@ -0,0 +1,755 @@
using System;
using System.Collections.Generic;
using BPA.Message.Enum;
using BPASmartClient.Device;
using BPASmartClient.EventBus;
using BPASmartClient.Model;
using BPASmartClient.Peripheral;
using static BPASmartClient.EventBus.EventBus;
using BPASmartClient.Helper;
using System.Threading;
using BPASmartClient.Message;
using BPA.Message;
using System.Linq;
using BPASmartClient.Model.PLC;
using System.Threading.Tasks;
using System.Reflection;
using BPASmartClient.MorkSUpgradedVer.Model;
using System.Collections.ObjectModel;
using BPASmartClient.MorkSUpgradedVer.ViewModel;
using BPASmartClient.Business;
using BPASmartClient.Model.小炒机;
using BPA.Models;
using System.Windows.Forms;
using System.Media;

namespace BPASmartClient.MorkSUpgradedVer
{
public class Control_MorkSUpgradedVer : BaseDevice
{
public override DeviceClientType DeviceType => DeviceClientType.MORKS;
GVL_MorkSUpgradedVer mORKS = new GVL_MorkSUpgradedVer();
Alarm alarm = new Alarm();

public override void DoMain()
{
MonitorViewModel.DeviceId = DeviceId;
ServerInit();
DataParse();
Json<MorksPar>.Read();
Json<OrderStatistics>.Read();
if (Json<MorksPar>.Data.parSets == null) Json<MorksPar>.Data.parSets = new ObservableCollection<ParSet>();
if (Json<MorksPar>.Data.parSets.Count < 6)
{
Json<MorksPar>.Data.parSets.Clear();
for (int i = 0; i < 6; i++)
{
Json<MorksPar>.Data.parSets.Add(new ParSet()
{
CheckBoxContext = $"煮面口{i + 1}屏蔽",
Minute = 1,
Second = 0,
IsShield = false,
TextBlockContext = $"煮面口{i + 1}时间设定"
});
}
}

ActionManage.GetInstance.Register(new Action<object[]>((o) =>
{
if (o.Length > 0)
{
Random rd = new Random();
ThreadManage.GetInstance().StartLong(new Action(() =>
{
int NoodleLoc = (int)o[0] == 0 ? rd.Next(1, 6) : (int)o[0];
int BowlLoc = (int)o[1] == 0 ? rd.Next(10, 12) : (int)o[1];

string guid = new Guid().ToString();

mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)NoodleLoc, SuborderId = guid });
MessageLog.GetInstance.Show($"添加订单:面条位置【{NoodleLoc}】");

mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)BowlLoc, SuborderId = guid });
MessageLog.GetInstance.Show($"添加订单:碗位置【{BowlLoc}】");
Thread.Sleep(60000);
}), "ForOrder");
}
}), "EnableForOrder");

ActionManage.GetInstance.Register(new Action<object>((o) =>
{
if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value);
}), "WriteVW");
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value);
}), "WriteBools");
ActionManage.GetInstance.Register(new Action(() => { DeviceInit(); }), "InitDevice");
}

public override void ResetProgram()
{
mORKS = null;
mORKS = new GVL_MorkSUpgradedVer();
}

public override void Stop()
{

}

private void ServerInit()
{
//物料信息
EventBus.EventBus.GetInstance().Subscribe<MaterialDeliveryEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
if (@event == null) return;
if (@event is MaterialDeliveryEvent material)
{
orderMaterialDelivery = material.orderMaterialDelivery;
}
});

//配方数据信息
EventBus.EventBus.GetInstance().Subscribe<RecipeBomEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
if (@event == null) return;
if (@event is RecipeBomEvent recipe)
{
recipeBoms = recipe.recipeBoms;
}
});


}

private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
{
var res = mORKS.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid);
string goodName = string.Empty;
string SortNum = string.Empty;
if (res != null)
{
goodName = res.MorkOrder.GoodsName;
SortNum = res.MorkOrder.SortNum.ToString();
}

EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { SortNum = SortNum, GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType });

var index = DataServer.GetInstance.morkS.MakeOrder.FindIndex(p => p.SortNum == SortNum);
if (index >= 0 && index < DataServer.GetInstance.morkS.MakeOrder.Count)
{
if (oRDER_STATUS == ORDER_STATUS.COMPLETED_COOK)
{
DataServer.GetInstance.morkS.MakeOrder.RemoveAt(index);
DataServer.GetInstance.morkS.MakeOrderOver.Add(new OrderMakeModel()
{
Status = oRDER_STATUS,
GoodName = goodName,
SortNum = SortNum,
StopTime = DateTime.Now.ToString("HH:mm:ss")
});
}
else if (oRDER_STATUS == ORDER_STATUS.COMPLETED_TAKE)
{
var temp = DataServer.GetInstance.morkS.MakeOrderOver.FirstOrDefault(p => p.SortNum == SortNum);
if (temp != null) DataServer.GetInstance.morkS.MakeOrderOver.Remove(temp);
}
else
{
DataServer.GetInstance.morkS.MakeOrder.ElementAt(index).Status = oRDER_STATUS;
}
}
else
{
DataServer.GetInstance.morkS.MakeOrder.Add(new OrderMakeModel()
{
Status = oRDER_STATUS,
GoodName = goodName,
SortNum = SortNum,
StartTime = DateTime.Now.ToString("HH:mm:ss")
});
}
}

private void GetStatus(string key, Action<object> action)
{
if (peripheralStatus.ContainsKey(key))
{
if (peripheralStatus[key] != null)
{
action?.Invoke(peripheralStatus[key]);
}
}
}

public override void ReadData()
{
DataServer.GetInstance.morkS.Alarm.Clear();
alarms.ForEach(item =>
{
DataServer.GetInstance.morkS.Alarm.Add(new AlarmModel()
{
AlarmTime = $"{item.Date} {item.Time}",
AlarmMs = item.Info
});
});

GetStatus("M0.1", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 7)
{
mORKS.InitComplete = bools[0];
mORKS.MoveScrewRodInitCom = bools[1];
mORKS.SacrificialVesselInitCom = bools[2];
mORKS.CylinderInitCom = bools[3];
mORKS.NoodleCookerInitCom = bools[4];
mORKS.RobotInitCom = bools[5];
mORKS.SiloInitCom = bools[6];

alarm.DeviceNoInit = mORKS.InitComplete;
alarm.MoveScrewRodNoInit = mORKS.MoveScrewRodInitCom;
alarm.SacrificialVesselNoInit = mORKS.SacrificialVesselInitCom;
alarm.CylinderNoInit = mORKS.CylinderInitCom;
alarm.NoodleCookerNoInit = mORKS.NoodleCookerInitCom;
alarm.RobotNoInit = mORKS.RobotInitCom;
alarm.SiloNoInit = mORKS.SiloInitCom;
}
}));

GetStatus("M10.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 2)
{
mORKS.AllowInvertedFace = bools[0];
mORKS.DiningComplete = bools[1];
}
}));

GetStatus("M10.4", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1)
{
mORKS.DropBowlMechanismStatus = bools[0];
}
}));

GetStatus("M12.2", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1)
{
mORKS.FixedFlag = bools[0];
}
}));

GetStatus("M13.5", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1)
{
mORKS.SiloInPlace = bools[0];
}
}));

GetStatus("M16.7", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1)
{
mORKS.RobotTakeNoodleCom = bools[0];
}
}));

GetStatus("M17.4", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1)
{
mORKS.RobotStatus = bools[0];
}
}));

GetStatus("M18.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 5)
{
mORKS.SmallBowlYesOrNoCheck = bools[0];
mORKS.LargeBowYesOrNoCheck = bools[1];
mORKS.TurntableLowPosition = bools[2];
mORKS.TurntableHighPosition = bools[3];
alarm.Supply2_LossBowl = !mORKS.SmallBowlYesOrNoCheck;
alarm.Supply1_LossBowl = !mORKS.LargeBowYesOrNoCheck;
}
}));

GetStatus("VW17", new Action<object>((obj) =>
{
if (obj is ushort[] ushorts && ushorts.Length > 0 && ushorts.Length <= 1)
{
mORKS.CookNoodleCom[0] = ushorts[0].GetBitValue(1);
mORKS.CookNoodleCom[1] = ushorts[0].GetBitValue(2);
mORKS.CookNoodleCom[2] = ushorts[0].GetBitValue(3);
mORKS.CookNoodleCom[3] = ushorts[0].GetBitValue(4);
mORKS.CookNoodleCom[4] = ushorts[0].GetBitValue(5);
mORKS.CookNoodleCom[5] = ushorts[0].GetBitValue(6);
mORKS.Heating = ushorts[0].GetBitValue(15);
mORKS.TemperatureReaches = ushorts[0].GetBitValue(16);

alarm.MachineLowTemperature = !mORKS.TemperatureReaches;
}

}));

GetStatus("VW770", new Action<object>((obj) =>
{
if (obj is ushort[] ushorts && ushorts.Length > 0 && ushorts.Length <= 1)
{
mORKS.CurrentFeedbackLoc = ushorts[0];
}

}));
}

/// <summary>
/// 数据解析
/// </summary>
private void DataParse()
{
EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle)
{
if (@event == null) return;
if (@event is DoOrderEvent order)
{
mORKS.doOrderEvents.Add(order);
if (order.MorkOrder.GoodBatchings == null) return;
if (mORKS.HistorySuborderId.Contains(order.MorkOrder.SuborderId)) return;
OrderCount++;
if (DateTime.Now.Subtract(Json<OrderStatistics>.Data.StatisticsTime).Days != 0)
Json<OrderStatistics>.Data.Count = 0;
Json<OrderStatistics>.Data.StatisticsTime = DateTime.Now;
Json<OrderStatistics>.Data.Count++;
Json<OrderStatistics>.Save();
OrderChange(order.MorkOrder.SuborderId, ORDER_STATUS.WAIT);
DeviceProcessLogShow($"接收到{OrderCount}次订单,订单ID:{order.MorkOrder.SuborderId}");
mORKS.HistorySuborderId.Add(order.MorkOrder.SuborderId);
foreach (var item in order.MorkOrder.GoodBatchings)
{
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
if (res != null)
{
if (ushort.TryParse(res.BatchingLoc, out ushort loc))
{
if (loc >= 1 && loc <= 5)
{
if (mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { GoodName = order.MorkOrder.GoodsName, Loc = ushort.Parse(res.BatchingLoc), SuborderId = order.MorkOrder.SuborderId, BatchingId = res.BatchingId });
}
else if (loc >= 10 && loc <= 11)
{
int index = 0;
if (recipeBoms != null)
{
index = Array.FindIndex(recipeBoms.RecipeIds?.ToArray(), p => p.RecipeId == order.MorkOrder.RecipeId);
index++;
}
if (mORKS.TakeBowlTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo()
{
BatchingId = res.BatchingId,
GoodName = order.MorkOrder.GoodsName,
Loc = ushort.Parse(res.BatchingLoc),
SuborderId = order.MorkOrder.SuborderId,
RecipeNumber = (index >= 1 && index <= 10) ? (ushort)index : (ushort)0
});
}
}
}
}
}
});
}

public override void MainTask()
{
mORKS.AllowRun = mORKS.InitComplete;
if (Json<KeepDataBase>.Data.IsVerify)
IsHealth = mORKS.InitComplete;
else
IsHealth = true;

TakeBowlTask();

TakeNoodleTask();

OutNoodleTask();

SingleDetect();

TurntableControl();
}

private void BowlControl(OrderLocInfo orderLocInfo)
{
if (orderLocInfo.Loc >= 10 && orderLocInfo.Loc <= 11)
{
mORKS.TakeBowlId = orderLocInfo.SuborderId;
mORKS.TakeBowName = orderLocInfo.GoodName;
TakeBowlControl(orderLocInfo.Loc);
OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING);
DeviceProcessLogShow($"订单【{mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
mORKS.TakeBowlInterlock = true;
}
}

/// <summary>
/// 取碗控制
/// </summary>
private void TakeBowlTask()
{
if (mORKS.AllowRun && mORKS.TakeBowlTask.Count > 0 && !mORKS.DropBowlMechanismStatus && !mORKS.TakeBowlInterlock)
{
DeviceProcessLogShow("开始取碗流程");
ushort BowLoc = 0;
var res = orderMaterialDelivery?.BatchingInfo?.Where(p => p.BatchingId == mORKS.TakeBowlTask.ElementAt(0).BatchingId).ToList();
if (res == null || res?.Count == 0)
{
if (mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo)) BowlControl(orderLocInfo);
}
else
{
foreach (var item in res)
{
if (ushort.TryParse(item.BatchingLoc, out ushort loc))
{
if (loc == 10 && !mORKS.SmallBowlYesOrNoCheck)
{
BowLoc = loc;
break;
}
else if (loc == 11 && !mORKS.LargeBowYesOrNoCheck)
{
BowLoc = loc;
break;
}
}
}

if (BowLoc >= 10 && BowLoc <= 11)
{
if (mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo))
{
orderLocInfo.Loc = BowLoc;
BowlControl(orderLocInfo);
}
}
}
}
}

/// <summary>
/// 转台控制
/// </summary>
private void TurntableControl()
{
if (Global.EnableLocalSimOrder)
{
//不做轮询,直接取面,模拟订单使用
if (mORKS.SiloInPlace && !mORKS.Feeding && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0)
{
if (mORKS.TurntableLowPosition)
{
TurntableStart(mORKS.RBTakeNoodleTask.ElementAt(0).Loc);
mORKS.TurntableLocLists.Clear();
mORKS.AllowTakeNoodle = true;
DeviceProcessLogShow($"控制机器人去转台【{mORKS.RBTakeNoodleTask.ElementAt(0).Loc}】号位置取面");
}
}
}
else
{
//正常轮询
if (mORKS.SiloInPlace && !mORKS.Feeding && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0)
{
var result = orderMaterialDelivery.BatchingInfo.Where(p => p.BatchingId == mORKS.RBTakeNoodleTask.ElementAt(0).BatchingId).ToList();
if (result != null)
{
var res = result.FirstOrDefault(P => P.BatchingLoc == mORKS.CurrentFeedbackLoc.ToString());
if (mORKS.TurntableLowPosition && res != null)
{
TurntableStart(mORKS.CurrentFeedbackLoc);
mORKS.TurntableLocLists.Clear();
mORKS.AllowTakeNoodle = true;
DeviceProcessLogShow($"控制机器人去转台【{mORKS.CurrentFeedbackLoc}】号位置取面");
}
else
{
if (!mORKS.TurntableInterlock)
{
foreach (var item in result)
{
if (ushort.TryParse(item.BatchingLoc, out ushort loc))
{
if (mORKS.CurrentFeedbackLoc != loc && !mORKS.TurntableLocLists.Contains(loc))
{
if (!mORKS.TurntableLowPosition)
{
//WriteData("M32.7", false);
DeviceProcessLogShow($"执行了转台启动互锁信号复位");
}
TurntableStart(loc);
DeviceProcessLogShow($"没有物料检测的启动转台控制,转台位置:[{loc}]");
break;
}
else if (mORKS.CurrentFeedbackLoc == loc && !mORKS.TurntableLocLists.Contains(loc)) mORKS.TurntableLocLists.Add(loc);
}
}
}
}
}
else DeviceProcessLogShow("未找到可用的物料信息");
}
}

//补料中检测
if (RTrig.GetInstance("mORKS.Feeding").Start(mORKS.Feeding))
{
mORKS.AllowTakeNoodle = false;
mORKS.TakeNoodleInterlock = false;
}

//转台到位检测
if (RTrig.GetInstance("TurntableInPlace").Start(mORKS.SiloInPlace && mORKS.CurrentLoc == mORKS.CurrentFeedbackLoc))
{
mORKS.CurrentLoc = 0;
mORKS.TurntableInterlock = false;
DeviceProcessLogShow("转台到位检测");
}

//补料完成检测
if (RTrig.GetInstance("FeedComplete").Start(mORKS.FeedComplete))
{
if (!mORKS.AllowTakeNoodle && mORKS.TurntableLocLists.Count > 0)
{
mORKS.TurntableLocLists.Clear();
mORKS.TurntableInterlock = false;
DeviceProcessLogShow("补料完成检测");
}
}

}

/// <summary>
/// 取面任务
/// </summary>
private void TakeNoodleTask()
{
//取面控制
if (mORKS.AllowRun && mORKS.RobotStatus && !mORKS.Feeding && !mORKS.RobotTaskInterlock && mORKS.AllowTakeNoodle && mORKS.SiloInPlace && !mORKS.TakeNoodleInterlock && mORKS.RBTakeNoodleTask.Count > 0)
{
int loc = Array.FindIndex(mORKS.NoodleCookerStatus, p => p == false);//查找煮面炉空闲位置
if (loc >= 0 && loc <= 5)
{
if (!Json<MorksPar>.Data.parSets.ElementAt(loc).IsShield)//检查该煮面篮是否被屏蔽
{
if (mORKS.RBTakeNoodleTask.TryDequeue(out OrderLocInfo orderLocInfo))
{
mORKS.CookNodelId[loc] = orderLocInfo.SuborderId;
mORKS.NoodleCookerStatus[loc] = true;
SetFallNoodleLoc((ushort)(loc + 1));
//机器人开始取面
OrderChange(orderLocInfo.SuborderId, ORDER_STATUS.COOKING);
DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】,机器人倒面至【{loc + 1}】号煮面栏");
//写入煮面时间
List<ushort> values = new List<ushort>();
values.Add(Json<MorksPar>.Data.parSets.ElementAt(loc).Minute);
values.Add(Json<MorksPar>.Data.parSets.ElementAt(loc).Second);
WriteData($"VW{320 + (loc * 4)}", values.ToArray());
mORKS.TakeNoodleInterlock = true;
}
}
}
}
}

/// <summary>
/// 出餐控制
/// </summary>
private void OutNoodleTask()
{
if (mORKS.AllowInvertedFace && mORKS.RobotTaskInterlock && !mORKS.TakeNoodleInterlock && mORKS.RobotStatus)
{
int loc = Array.FindIndex(mORKS.CookNodelId, p => p == mORKS.IngredientsCompleteId && p.Length > 0);
if (loc >= 0 && loc <= 5)
{
if (mORKS.CookNoodleCom[loc])
{
SetTakeNoodleLoc((ushort)(loc + 1));
mORKS.NoodleCookerStatus[loc] = false;
WriteData($"VW260", 0);//设置出汤时间
OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_COOK);
DeviceProcessLogShow($"订单【{mORKS.OutMealId}】制作完成");
mORKS.CookCompleteFlatBit = true;
mORKS.OutMealId = mORKS.IngredientsCompleteId;
mORKS.OutMealName = mORKS.IngredientsCompleteName;
mORKS.IngredientsCompleteId = string.Empty;
mORKS.CookNodelId[loc] = string.Empty;
DeviceProcessLogShow($"{loc + 1} 号位置出餐控制,订单ID:{mORKS.OutMealId}");
}
}
}
}

/// <summary>
/// 信号检测
/// </summary>
private void SingleDetect()
{
//允许倒面信号检测
if (RTrig.GetInstance("AllowFallNoodle").Start(mORKS.AllowInvertedFace))
{
mORKS.IngredientsCompleteId = mORKS.TakeBowlId;
mORKS.IngredientsCompleteName = mORKS.TakeBowName;
mORKS.TakeBowlId = string.Empty;
mORKS.TakeBowName = string.Empty;
DeviceProcessLogShow($"碗到位,允许到面,{mORKS.IngredientsCompleteId}");
mORKS.TakeBowlInterlock = false;
}

//取餐完成逻辑处理
if (Delay.GetInstance("CompleteChange1").Start(!mORKS.DiningComplete, 1) && mORKS.CookCompleteFlatBit == true)
{
OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE);
DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成");
mORKS.CookCompleteFlatBit = false;
mORKS.OutMealId = string.Empty;
mORKS.OutMealName = string.Empty;
}

//机器人取面完成信号检测
if (RTrig.GetInstance("TakeNoodleComplete").Start(mORKS.RobotTakeNoodleCom))
{
mORKS.TakeNoodleInterlock = false;
mORKS.AllowTakeNoodle = false;
mORKS.TurntableInterlock = false;
DeviceProcessLogShow("机器人取面完成信号检测");
}

int OutMealRequstCount = mORKS.CookNoodleCom.Where(p => p == true).ToList().Count;
int mlCount = mORKS.NoodleCookerStatus.Where(p => p == true).ToList().Count;
int index = Array.FindIndex(mORKS.CookNodelId, p => p == mORKS.IngredientsCompleteId);

bool isok = index >= 0 && index < mORKS.CookNoodleCom.Length && mORKS.CookNoodleCom[index];

mORKS.PriorityJudgment = Delay.GetInstance("取餐优先级判断").Start(mORKS.TurntableLocLists.Count > 0 && !mORKS.TurntableLowPosition, 4);
//mORKS.RobotTaskInterlock = OutMealRequstCount > 0 && mORKS.AllowInvertedFace && (mlCount >= 2 || mORKS.RBTakeNoodleTask.Count == 0 || mORKS.PriorityJudgment);
mORKS.RobotTaskInterlock = isok && mORKS.AllowInvertedFace && (mlCount >= 2 || mORKS.RBTakeNoodleTask.Count == 0 || mORKS.PriorityJudgment);


}
/// <summary>
/// 语音提醒取餐
/// </summary>
/// <param name="meal"></param>
private void WaitMeaLSpeak(string meal)
{
//VoiceAPI.m_SystemPlayWav(@"Vioce\电子提示音.wav");
//Thread.Sleep(1000);
//if (meal != null) mORKS.speech.Speak(meal);
//VoiceAPI.m_SystemPlayWav(@"Vioce\取餐通知.wav");
}

#region PLC 控制函数

private void WriteData(string address, object value)
{
EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = address, Value = value });
}

/// <summary>
/// 设备初始化
/// </summary>
public async void DeviceInit()
{
WriteData("M0.0", true);
await Task.Delay(1000);
WriteData("M0.0", false);
}

/// <summary>
/// 取碗控制
/// </summary>
/// <param name="loc"></param>
private void TakeBowlControl(ushort loc)
{
if (loc == 10)//一次性碗
{
WriteData("M9.1", true);
}
else if (loc == 11)//大碗
{
WriteData("M9.0", true);
}
}

/// <summary>
/// 启动转台
/// </summary>
/// <param name="loc"></param>
private void TurntableStart(ushort loc)
{
if (loc >= 1 && loc <= 5)
{
mORKS.CurrentLoc = loc;
mORKS.TurntableInterlock = true;
mORKS.TurntableLocLists.Add(loc);
WriteData($"M13.{loc - 1}", true);
}
}

/// <summary>
/// 设置倒面位置
/// </summary>
/// <param name="loc"></param>
private void SetFallNoodleLoc(ushort loc)
{
if (loc >= 1 && loc <= 6)
WriteData($"M14.{loc - 1}", true);
}

/// <summary>
/// 设置取面位置
/// </summary>
/// <param name="loc"></param>
private void SetTakeNoodleLoc(ushort loc)
{
if (loc >= 1 && loc <= 6)
WriteData($"M16.{loc - 1}", true);
}



public override void SimOrder()
{
EventBus.EventBus.GetInstance().Subscribe<MorksSimorderModel>(0, delegate (IEvent @event, EventCallBackHandle callBackHandle)
{
if (@event != null && @event is MorksSimorderModel msm)
{
string guid = Guid.NewGuid().ToString();
if (msm.NoodleLoc >= 1 && msm.NoodleLoc <= 5)
{
mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.NoodleLoc, SuborderId = guid });
MessageLog.GetInstance.Show($"添加订单:面条位置【{(ushort)msm.NoodleLoc}】");
}

if (msm.Bowloc >= 10 && msm.Bowloc <= 11)
{
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.Bowloc, SuborderId = guid });
MessageLog.GetInstance.Show($"添加订单:碗位置【{(ushort)msm.Bowloc}】");
}

}
});
}
#endregion


}
}

+ 51
- 0
BPASmartClient.MorkSUpgradedVer/DataServer.cs View File

@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using BPASmartClient.MQTT;
using BPA.Message;
using BPASmartClient.Model;

namespace BPASmartClient.MorkSUpgradedVer
{
public class DataServer
{

private volatile static DataServer _Instance;
public static DataServer GetInstance => _Instance ?? (_Instance = new DataServer());
private DataServer() { }

public ScreenModelMorkS morkS { get; set; } = new ScreenModelMorkS();

MQTTProxy mQTTProxy = new MQTTProxy();
public void Init()
{
mQTTProxy.Connected = new Action(() =>
{
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机));
ThreadManage.GetInstance().StartLong(new Action(() =>
{
morkS.MorkS_OrderCount = Json<OrderStatistics>.Data.Count;
SendScreenDataModel sendScreenDataModel = new SendScreenDataModel();
sendScreenDataModel.Name = ScreenDeviceType.煮面机;
sendScreenDataModel.Value = morkS.ToJSON();
mQTTProxy.Publish(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机), sendScreenDataModel.ToJSON());
Thread.Sleep(100);
}), "海科食堂大屏监听");
});
mQTTProxy.Connect("UserName", "Password", "Host", 1883, $"MORKS 设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}

//订单信息(正在制作,等待制作,制作完成)
//煮面炉上下状态(6个煮面炉上或下)
//温度状态(煮面炉温度是否到达)
//料仓位置(当前料仓在几号位置)
//料仓上下物料检测
//落碗机构缺碗检测
//机器人状态
//当日订单总量
//报警信息
}
}

+ 193
- 0
BPASmartClient.MorkSUpgradedVer/DeviceData.cs View File

@@ -0,0 +1,193 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace BPASmartClient.MorkSUpgradedVer
{
public class DeviceData : IStatus
{
/// <summary>
/// 初始化启动
/// </summary>
[VariableMonitor("初始化启动", "M0.0", "320")]
public bool InitStart { get; set; }

/// <summary>
/// 初始化完成
/// </summary>
[VariableMonitor("初始化完成", "M0.1", "321")]
public bool InitComplete { get; set; }

/// <summary>
/// 移碗丝杆初始化完成
/// </summary>
[VariableMonitor("移碗丝杆初始化完成", "M0.2", "322")]
public bool MoveScrewRodInitCom { get; set; }

/// <summary>
/// 供碗1初始化完成
/// </summary>
[VariableMonitor("供碗1初始化完成", "M0.3", "323")]
public bool SacrificialVesselInitCom { get; set; }

/// <summary>
/// 气缸推杆初始化完成
/// </summary>
[VariableMonitor("气缸推杆初始化完成", "M0.4", "324")]
public bool CylinderInitCom { get; set; }

/// <summary>
/// 煮面机初始化完成
/// </summary>
[VariableMonitor("煮面机初始化完成", "M0.5", "325")]
public bool NoodleCookerInitCom { get; set; }

/// <summary>
/// 机器人初始化完成
/// </summary>
[VariableMonitor("机器人初始化完成", "M0.6", "326")]
public bool RobotInitCom { get; set; }

/// <summary>
/// 料仓初始化完成
/// </summary>
[VariableMonitor("料仓初始化完成", "M0.7", "327")]
public bool SiloInitCom { get; set; }

/// <summary>
/// 故障复位/停止
/// </summary>
[VariableMonitor("故障复位/停止", "M1.0", "328")]
public bool FaultResetOrStop { get; set; }

/// <summary>
/// 落碗1,大碗
/// </summary>
[VariableMonitor("落碗1,大碗", "M9.0", "392")]
public bool DropBowlOne { get; set; }

/// <summary>
/// 落碗2,一次性碗
/// </summary>
[VariableMonitor("落碗2,一次性碗", "M9.1", "393")]
public bool DropBowlTow { get; set; }

/// <summary>
/// 允许倒面
/// </summary>
[VariableMonitor("允许倒面", "M10.0", "400")]
public bool AllowInvertedFace { get; set; }

/// <summary>
/// 出餐完成
/// </summary>
[VariableMonitor("出餐完成", "M10.1", "401")]
public bool DiningComplete { get; set; }

/// <summary>
/// 落碗机构状态,1:忙碌 0:空闲
/// </summary>
[VariableMonitor("落碗机构状态,1:忙碌 0:空闲", "M10.4", "404")]
public bool DropBowlMechanismStatus { get; set; }

/// <summary>
/// 定位标志,1:忙碌 0:空闲
/// </summary>
[VariableMonitor("定位标志,1:忙碌 0:空闲", "M12.2", "418")]
public bool FixedFlag { get; set; }

/// <summary>
/// 定位启动
/// </summary>
[VariableMonitor("定位启动", "M12.3", "419")]
public bool FixedStart { get; set; }

/// <summary>
/// 料仓到位
/// </summary>
[VariableMonitor("料仓到位", "M13.5", "429")]
public bool SiloInPlace { get; set; }

/// <summary>
/// 机器人料仓取面完成
/// </summary>
[VariableMonitor("机器人去料仓取面完成", "M16.7", "455")]
public bool RobotTakeNoodleCom { get; set; }

/// <summary>
/// 机器人状态
/// </summary>
[VariableMonitor("机器人状态", "M17.4", "460")]
public bool RobotStatus { get; set; }

/// <summary>
/// 一次性碗有无检测
/// </summary>
[VariableMonitor("一次性碗有无检测", "M18.0", "464")]
public bool SmallBowlYesOrNoCheck { get; set; }

/// <summary>
/// 大碗有无检测
/// </summary>
[VariableMonitor("大碗有无检测", "M18.1", "465")]
public bool LargeBowYesOrNoCheck { get; set; }

/// <summary>
/// 转台高位
/// </summary>
[VariableMonitor("转台高位", "M18.2", "466")]
public bool TurntableHighPosition { get; set; }

/// <summary>
/// 转台低位
/// </summary>
[VariableMonitor("转台低位", "M18.3", "467")]
public bool TurntableLowPosition { get; set; }

/// <summary>
/// 煮面完成
/// </summary>
[VariableMonitor("煮面完成", "V17.0")]
public bool[] CookNoodleCom { get; set; } = new bool[6];

/// <summary>
/// 本地/远程
/// </summary>
[VariableMonitor("本地/远程", "V18.0")]
public bool LocalOrRemote { get; set; }

/// <summary>
/// 温度到达
/// </summary>
[VariableMonitor("温度到达", "V18.7")]
public bool TemperatureReaches { get; set; }

/// <summary>
/// 加热中
/// </summary>
[VariableMonitor("加热中", "V18.6")]
public bool Heating { get; set; }

/// <summary>
/// 转台当前位置
/// </summary>
[VariableMonitor("转台当前位置", "VW770")]
public ushort CurrentLoc { get; set; }

/// <summary>
/// 补料完成
/// </summary>
[VariableMonitor("补料完成", "M101.6", "1134")]
public bool FeedComplete { get; set; }

/// <summary>
/// 补料中
/// </summary>
[VariableMonitor("补料中", "M102.6", "1142")]
public bool Feeding { get; set; }

}
}

+ 322
- 0
BPASmartClient.MorkSUpgradedVer/GVL_MorkSUpgradedVer.cs View File

@@ -0,0 +1,322 @@
using BPASmartClient.Device;
using BPASmartClient.Model;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkSUpgradedVer
{
public class GVL_MorkSUpgradedVer : IStatus
{
#region 临时变量
/// <summary>
/// 允许运行
/// </summary>
[VariableMonitor("允许运行")]
public bool AllowRun { get; set; }

/// <summary>
/// 优先级判断
/// </summary>
[VariableMonitor("优先级判断条件")]
public bool PriorityJudgment { get; set; }

/// <summary>
/// 机器人任务互锁信号,false:取面,true:出餐
/// </summary>
[VariableMonitor("机器人任务互锁信号")]
public bool RobotTaskInterlock { get; set; }

/// <summary>
/// 取碗互锁信号
/// </summary>
[VariableMonitor("取碗互锁信号")]
public bool TakeBowlInterlock { get; set; }

/// <summary>
/// 取面互锁信号
/// </summary>
[VariableMonitor("取面互锁信号")]
public bool TakeNoodleInterlock { get; set; }

/// <summary>
/// 出面中
/// </summary>
[VariableMonitor("出面中")]
public bool OutNoodleing { get; set; }

/// <summary>
/// 允许取面
/// </summary>
[VariableMonitor("允许取面")]
public bool AllowTakeNoodle { get; set; }

/// <summary>
/// 转台互锁信号
/// </summary>
[VariableMonitor("转台互锁信号")]
public bool TurntableInterlock { get; set; }


/// <summary>
/// 煮面炉状态,True:忙碌,false:空闲
/// </summary>
[VariableMonitor("煮面炉状态")]
public bool[] NoodleCookerStatus { get; set; } = new bool[6];

/// <summary>
/// 转台当前启动位置
/// </summary>
[VariableMonitor("转台当前启动位置")]
public ushort CurrentLoc { get; set; } = 0;

/// <summary>
/// 制作完成标志
/// </summary>
[VariableMonitor("制作完成标志")]
public bool CookCompleteFlatBit { get; set; }
#endregion

#region 列表数据
/// <summary>
/// 机器人取面位置队列
/// </summary>
public ConcurrentQueue<OrderLocInfo> RBTakeNoodleTask { get; set; } = new ConcurrentQueue<OrderLocInfo>();

/// <summary>
/// 出碗队列
/// </summary>
public ConcurrentQueue<OrderLocInfo> TakeBowlTask { get; set; } = new ConcurrentQueue<OrderLocInfo>();


public List<DoOrderEvent> doOrderEvents { get; set; } = new List<DoOrderEvent>();

public List<string> HistorySuborderId { get; set; } = new List<string>();
#endregion

#region 订单ID记录
/// <summary>
/// 取碗订单ID
/// </summary>
public string TakeBowlId { get; set; } = string.Empty;
/// <summary>
/// 取碗订单名称
/// </summary>
public string TakeBowName { get; set; } = string.Empty;

/// <summary>
/// 配料完成订单ID
/// </summary>
public string IngredientsCompleteId { get; set; } = string.Empty;
/// <summary>
/// 配料完成订单名称
/// </summary>
public string IngredientsCompleteName { get; set; } = string.Empty;

/// <summary>
/// 煮面口对应的订单ID
/// </summary>
public string[] CookNodelId { get; set; } = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, };

/// <summary>
/// 出餐订单ID
/// </summary>
public string OutMealId { get; set; } = string.Empty;
/// <summary>
/// 出餐订单名称
/// </summary>
public string OutMealName { get; set; } = string.Empty;

/// <summary>
/// 转台位置轮询
/// </summary>
public List<ushort> TurntableLocLists { get; set; } = new List<ushort>();

#endregion

#region device Data
/// <summary>
/// 初始化启动
/// </summary>
[VariableMonitor("初始化启动", "M0.0", "320")]
public bool InitStart { get; set; }

/// <summary>
/// 初始化完成
/// </summary>
[VariableMonitor("初始化完成", "M0.1", "321")]
public bool InitComplete { get; set; }

/// <summary>
/// 移碗丝杆初始化完成
/// </summary>
[VariableMonitor("移碗丝杆初始化完成", "M0.2", "322")]
public bool MoveScrewRodInitCom { get; set; }

/// <summary>
/// 供碗1初始化完成
/// </summary>
[VariableMonitor("供碗1初始化完成", "M0.3", "323")]
public bool SacrificialVesselInitCom { get; set; }

/// <summary>
/// 气缸推杆初始化完成
/// </summary>
[VariableMonitor("气缸推杆初始化完成", "M0.4", "324")]
public bool CylinderInitCom { get; set; }

/// <summary>
/// 煮面机初始化完成
/// </summary>
[VariableMonitor("煮面机初始化完成", "M0.5", "325")]
public bool NoodleCookerInitCom { get; set; }

/// <summary>
/// 机器人初始化完成
/// </summary>
[VariableMonitor("机器人初始化完成", "M0.6", "326")]
public bool RobotInitCom { get; set; }

/// <summary>
/// 料仓初始化完成
/// </summary>
[VariableMonitor("料仓初始化完成", "M0.7", "327")]
public bool SiloInitCom { get; set; }

/// <summary>
/// 故障复位/停止
/// </summary>
[VariableMonitor("故障复位/停止", "M1.0", "328")]
public bool FaultResetOrStop { get; set; }

/// <summary>
/// 落碗1,大碗
/// </summary>
[VariableMonitor("落碗1,大碗", "M9.0", "392")]
public bool DropBowlOne { get; set; }

/// <summary>
/// 落碗2,一次性碗
/// </summary>
[VariableMonitor("落碗2,一次性碗", "M9.1", "393")]
public bool DropBowlTow { get; set; }

/// <summary>
/// 允许倒面
/// </summary>
[VariableMonitor("允许倒面", "M10.0", "400")]
public bool AllowInvertedFace { get; set; }

/// <summary>
/// 出餐完成
/// </summary>
[VariableMonitor("出餐完成", "M10.1", "401")]
public bool DiningComplete { get; set; }

/// <summary>
/// 落碗机构状态,1:忙碌 0:空闲
/// </summary>
[VariableMonitor("落碗机构状态,1:忙碌 0:空闲", "M10.4", "404")]
public bool DropBowlMechanismStatus { get; set; }

/// <summary>
/// 定位标志,1:忙碌 0:空闲
/// </summary>
[VariableMonitor("定位标志,1:忙碌 0:空闲", "M12.2", "418")]
public bool FixedFlag { get; set; }

/// <summary>
/// 定位启动
/// </summary>
[VariableMonitor("定位启动", "M12.3", "419")]
public bool FixedStart { get; set; }

/// <summary>
/// 料仓到位
/// </summary>
[VariableMonitor("料仓到位", "M13.5", "429")]
public bool SiloInPlace { get; set; }

/// <summary>
/// 机器人料仓取面完成
/// </summary>
[VariableMonitor("机器人去料仓取面完成", "M16.7", "455")]
public bool RobotTakeNoodleCom { get; set; }

/// <summary>
/// 机器人状态
/// </summary>
[VariableMonitor("机器人状态", "M17.4", "460")]
public bool RobotStatus { get; set; }

/// <summary>
/// 一次性碗有无检测
/// </summary>
[VariableMonitor("一次性碗有无检测", "M18.0", "464")]
public bool SmallBowlYesOrNoCheck { get; set; }

/// <summary>
/// 大碗有无检测
/// </summary>
[VariableMonitor("大碗有无检测", "M18.1", "465")]
public bool LargeBowYesOrNoCheck { get; set; }

/// <summary>
/// 转台高位
/// </summary>
[VariableMonitor("转台高位", "M18.2", "466")]
public bool TurntableHighPosition { get; set; }

/// <summary>
/// 转台低位
/// </summary>
[VariableMonitor("转台低位", "M18.3", "467")]
public bool TurntableLowPosition { get; set; }

/// <summary>
/// 煮面完成
/// </summary>
[VariableMonitor("煮面完成")]
public bool[] CookNoodleCom { get; set; } = new bool[6];

/// <summary>
/// 本地/远程
/// </summary>
[VariableMonitor("本地/远程")]
public bool LocalOrRemote { get; set; }

/// <summary>
/// 温度到达
/// </summary>
[VariableMonitor("温度到达")]
public bool TemperatureReaches { get; set; }

/// <summary>
/// 加热中
/// </summary>
[VariableMonitor("加热中")]
public bool Heating { get; set; }

/// <summary>
/// 转台当前位置
/// </summary>
[VariableMonitor("转台当前位置", "VW770", "870")]
public ushort CurrentFeedbackLoc { get; set; }

/// <summary>
/// 补料完成
/// </summary>
[VariableMonitor("补料完成", "M101.6", "1134")]
public bool FeedComplete { get; set; }

/// <summary>
/// 补料中
/// </summary>
[VariableMonitor("补料中", "M102.6", "1142")]
public bool Feeding { get; set; }
#endregion
}
}

+ 26
- 0
BPASmartClient.MorkSUpgradedVer/GlobalUsing.cs View File

@@ -0,0 +1,26 @@
global using System;
global using System.Collections.Generic;
global using BPA.Message.Enum;
global using BPASmartClient.Device;
global using BPASmartClient.EventBus;
global using BPASmartClient.Model;
global using BPASmartClient.Peripheral;
global using static BPASmartClient.EventBus.EventBus;
global using BPASmartClient.Helper;
global using System.Threading;
global using BPASmartClient.Message;
global using BPA.Message;
global using System.Linq;
global using BPASmartClient.Model.PLC;
global using System.Threading.Tasks;
global using System.Reflection;
global using BPASmartClient.MorkSUpgradedVer.Model;
global using System.Collections.ObjectModel;
global using BPASmartClient.MorkSUpgradedVer.ViewModel;
global using BPASmartClient.Business;
global using BPASmartClient.Model.小炒机;
global using BPA.Models;
global using System.Windows.Forms;
global using System.Media;



+ 13
- 0
BPASmartClient.MorkSUpgradedVer/Model/Global.cs View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkSUpgradedVer.Model
{
public class Global
{
public static bool EnableLocalSimOrder { get; set; }
}
}

+ 16
- 0
BPASmartClient.MorkSUpgradedVer/Model/MorksPar.cs View File

@@ -0,0 +1,16 @@
using BPASmartClient.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.MorkSUpgradedVer.Model
{
internal class MorksPar
{
public ObservableCollection<ParSet> parSets { get; set; } = new ObservableCollection<ParSet>();
}
}

+ 29
- 0
BPASmartClient.MorkSUpgradedVer/Model/ParSet.cs View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Model
{
public class ParSet
{
public ushort Minute { get { return _mMinute; } set { _mMinute = value; } }
private ushort _mMinute;

public ushort Second { get { return _mSecond; } set { _mSecond = value; } }
private ushort _mSecond;


public bool IsShield { get { return _mIsShield; } set { _mIsShield = value; } }
private bool _mIsShield;


public string TextBlockContext { get { return _mTextBlockContext; } set { _mTextBlockContext = value; } }
private string _mTextBlockContext;

public string CheckBoxContext { get { return _mCheckBoxContext; } set { _mCheckBoxContext = value; } }
private string _mCheckBoxContext;

}
}

+ 14
- 0
BPASmartClient.MorkSUpgradedVer/Model/WritePar.cs View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkSUpgradedVer.Model
{
public class WritePar
{
public string Address { get; set; }
public object Value { get; set; }
}
}

+ 23
- 0
BPASmartClient.MorkSUpgradedVer/OrderLocInfo.cs View File

@@ -0,0 +1,23 @@
using BPA.Message;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkSUpgradedVer
{
public class OrderLocInfo
{
public string SuborderId { get; set; }
public ushort Loc { get; set; }
public ushort RecipeNumber { get; set; }
public int BatchingId { get; set; }
public string GoodName { get; set; }

public int RecipeId { get; set; }

public List<int> Recipes { get; set; }

}
}

+ 117
- 0
BPASmartClient.MorkSUpgradedVer/View/Debug.xaml View File

@@ -0,0 +1,117 @@
<UserControl
x:Class="BPASmartClient.MorkSUpgradedVer.View.Debug"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkSUpgradedVer.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.MorkSUpgradedVer.ViewModel"
Name="调试界面"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:DebugViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<Style x:Key="TextboxStyle" TargetType="TextBox">
<Setter Property="FontSize" Value="18" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource TitleBorderColor}" />
<Setter Property="Width" Value="150" />
<Setter Property="BorderBrush" Value="{StaticResource TitleBorderColor}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CaretBrush" Value="Aqua" />
</Style>
<Style x:Key="CheckBox" TargetType="CheckBox">
<Setter Property="Foreground" Value="Aqua" />
<Setter Property="FontSize" Value="16" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Margin" Value="10,0" />
<Setter Property="IsChecked" Value="False" />
</Style>
</UserControl.Resources>

<Grid Margin="20">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<StackPanel>
<StackPanel Margin="10,0,0,20" Orientation="Horizontal">
<TextBlock
FontSize="18"
Foreground="{StaticResource TitleBorderColor}"
Text="面条位置:" />
<TextBox Style="{StaticResource TextboxStyle}" Text="{Binding NoodleLoc}" />
<CheckBox
Background="White"
Content="随机面条位置"
IsChecked="{Binding IsNoodPositon}"
Style="{StaticResource CheckBox}" />

</StackPanel>

<StackPanel Margin="10,0,0,20" Orientation="Horizontal">
<TextBlock
FontSize="18"
Foreground="{StaticResource TitleBorderColor}"
Text="面碗位置:" />
<TextBox Style="{StaticResource TextboxStyle}" Text="{Binding BowlLoc}" />
<CheckBox
Background="White"
Content="随机面碗位置"
IsChecked="{Binding IsBowPositon}"
Style="{StaticResource CheckBox}" />
<CheckBox
Background="White"
Command="{Binding EnableLacalSimOrder}"
Content="启用本地模拟功能"
IsChecked="{Binding LocalSimOrder}"
Style="{StaticResource CheckBox}" />
</StackPanel>

<StackPanel Orientation="Horizontal">
<Button
Grid.Row="0"
Width="170"
HorizontalAlignment="Left"
Command="{Binding SimOrderRandomCommand}"
Content="启动随机模拟订单"
Style="{StaticResource ButtonStyle}"
Visibility="{Binding VisibilitySimOrder}" />
<Button
Grid.Row="0"
Width="170"
HorizontalAlignment="Left"
Command="{Binding SimOrderRandomCloseCommand}"
Content="关闭随机模拟订单"
Style="{StaticResource ButtonStyle}"
Visibility="{Binding VisibilitySimOrder}" />
<Button
Grid.Row="0"
Width="130"
HorizontalAlignment="Left"
Command="{Binding SimOrderCommand}"
Content="模拟订单"
Style="{StaticResource ButtonStyle}"
Visibility="{Binding VisibilitySimOrder}" />
<Button
Grid.Row="0"
Width="120"
HorizontalAlignment="Left"
Command="{Binding InitCommand}"
Content="初始化设备"
Style="{StaticResource ButtonStyle}" />
</StackPanel>
</StackPanel>



</Grid>
</UserControl>

+ 30
- 0
BPASmartClient.MorkSUpgradedVer/View/Debug.xaml.cs View File

@@ -0,0 +1,30 @@
using BPASmartClient.MorkSUpgradedVer.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MorkSUpgradedVer.View
{
/// <summary>
/// Debug.xaml 的交互逻辑
/// </summary>
public partial class Debug : System.Windows.Controls.UserControl
{
public Debug()
{
InitializeComponent();
}

}
}

+ 242
- 0
BPASmartClient.MorkSUpgradedVer/View/Monitor.xaml View File

@@ -0,0 +1,242 @@
<UserControl
x:Class="BPASmartClient.MorkSUpgradedVer.View.Monitor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkSUpgradedVer.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.MorkSUpgradedVer.ViewModel"
Name="监控画面"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:MonitorViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<!--<convert:TextDisplayConvert x:Key="textDisplayConvert" />
<convert:IsEnableConvert x:Key="isEnableConvert" />
<convert:AnalogAlarmConvert x:Key="analogAlarmConvert" />
<convert:DiscreteAlarmConvert x:Key="discreteAlarmConvert" />
<convert:AlarmTypeTextConvert x:Key="alarmTypeTextConvert" />-->
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" />
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" />
<SolidColorBrush x:Key="CursorColor" Color="Aqua" />
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" />

<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>

<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="22" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="BorderBrush" Value="#FF23CACA" />
<Setter Property="CaretBrush" Value="Aqua" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>

<!--#region 表格标题栏设置-->
<Grid Background="#dd2AB2E7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="ID" />

<Grid Grid.Column="1">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="变量名" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="PLC 地址" />


<Grid Grid.Column="3">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="注释" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,0,0"
Cursor="SizeWE" />
</Grid>



<Grid Grid.Column="4">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="Modbus TCP 地址" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="当前值" />

</Grid>
<!--#endregion-->

<!--#region 表格数据显示-->
<ScrollViewer
Grid.Row="1"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding variableMonitors}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"
Text="{Binding Id}" />

<Grid Grid.Column="1">
<TextBlock
Margin="5,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"
Text="{Binding VarName}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>


<TextBlock
Grid.Column="2"
Margin="5,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"
Text="{Binding PLCAddress}" />

<Grid Grid.Column="3">
<TextBlock
Margin="5,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"
Text="{Binding Notes}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,0,0" />
</Grid>

<Grid Grid.Column="4">
<TextBlock
Margin="5,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"
Text="{Binding ModbusTcpAddress}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="5"
Margin="5,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"
Text="{Binding CurrentValue}" />

<Border
Grid.ColumnSpan="8"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<!--#endregion-->


</Grid>

</UserControl>

+ 28
- 0
BPASmartClient.MorkSUpgradedVer/View/Monitor.xaml.cs View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MorkSUpgradedVer.View
{
/// <summary>
/// Monitor.xaml 的交互逻辑
/// </summary>
public partial class Monitor : System.Windows.Controls.UserControl
{
public Monitor()
{
InitializeComponent();
}
}
}

+ 130
- 0
BPASmartClient.MorkSUpgradedVer/View/ParSet.xaml View File

@@ -0,0 +1,130 @@
<UserControl
x:Class="BPASmartClient.MorkSUpgradedVer.View.ParSet"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkSUpgradedVer.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.MorkSUpgradedVer.ViewModel"
Name="参数设置界面"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:ParSetViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>

<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="22" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="BorderBrush" Value="#FF23CACA" />
<Setter Property="CaretBrush" Value="Aqua" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="35" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">

<TextBlock Style="{StaticResource TextBlockStyle}" Text="请点击按钮保存参数:" />

<pry:IcoButton
Grid.Column="5"
Width="140"
HorizontalAlignment="Left"
Command="{Binding SaveInfoCommand}"
Content="保存配置"
FontSize="16"
IcoText="&#xe936;"
Style="{StaticResource IcoButtonStyle}">
<pry:IcoButton.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</pry:IcoButton.Foreground>
</pry:IcoButton>


</StackPanel>

<!-- 参数放置面板 -->
<Grid Grid.Row="2">
<ItemsControl ItemsSource="{Binding parSets}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle}" Text="{Binding TextBlockContext}" />
<TextBox
Width="100"
Margin="10,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding Minute}" />
<TextBlock Style="{StaticResource TextBlockStyle}" Text="(分)" />
<TextBox
Width="100"
Margin="0,10"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding Second}" />
<TextBlock Style="{StaticResource TextBlockStyle}" Text="(秒)" />

<CheckBox
Height="20"
Margin="10"
VerticalAlignment="Center"
Background="#FF2AB2E7"
Content="{Binding CheckBoxContext}"
FontSize="14"
Foreground="#00c2f4"
IsChecked="{Binding IsShield}"
Template="{StaticResource CbTemplate}" />

</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

</Grid>

</Grid>


</UserControl>

+ 28
- 0
BPASmartClient.MorkSUpgradedVer/View/ParSet.xaml.cs View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MorkSUpgradedVer.View
{
/// <summary>
/// ParSet.xaml 的交互逻辑
/// </summary>
public partial class ParSet : System.Windows.Controls.UserControl
{
public ParSet()
{
InitializeComponent();
}
}
}

+ 79
- 0
BPASmartClient.MorkSUpgradedVer/ViewModel/DebugViewModel.cs View File

@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmartClient.Helper;
using BPASmartClient.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.EventBus;
using BPASmartClient.MorkSUpgradedVer.Model;
using System.Windows;
using BPASmartClient.Message;

namespace BPASmartClient.MorkSUpgradedVer.ViewModel
{
public class DebugViewModel : ObservableObject
{
public DebugViewModel()
{
InitCommand = new RelayCommand(() => {
ActionManage.GetInstance.Send("InitDevice");
ActionManage.GetInstance.Send("初始化设定煮面时间");
});
SimOrderCommand = new RelayCommand(() =>
{
new MorksSimorderModel() { Bowloc = this.BowlLoc, NoodleLoc = this.NoodleLoc }.Publish();
});
SimOrderRandomCommand = new RelayCommand(() =>
{
int NoodPosition = 0;
int BowPosion = 0;
NoodPosition = IsNoodPositon == true ? 0 : NoodleLoc;
BowPosion = IsBowPositon == true ? 0 : BowlLoc;
ActionManage.GetInstance.Send("EnableForOrder", new object[] { NoodPosition, BowPosion });
});
SimOrderRandomCloseCommand = new RelayCommand(() =>
{
ThreadManage.GetInstance().StopTask("ForOrder");
MessageLog.GetInstance.Show("停止模拟随机订单");
});
EnableLacalSimOrder = new RelayCommand(() =>
{
Global.EnableLocalSimOrder = LocalSimOrder;
VisibilitySimOrder = LocalSimOrder == true ? Visibility.Visible : Visibility.Collapsed;
});
VisibilitySimOrder = LocalSimOrder == true? Visibility.Visible : Visibility.Collapsed;
}

public RelayCommand InitCommand { get; set; }

public RelayCommand SimOrderCommand { get; set; }

public RelayCommand SimOrderRandomCommand { get; set; }

public RelayCommand SimOrderRandomCloseCommand { get; set; }

public RelayCommand EnableLacalSimOrder { get; set; }
public int NoodleLoc { get { return _mNoodleLoc; } set { _mNoodleLoc = value; OnPropertyChanged(); } }
private int _mNoodleLoc = 1;


public int BowlLoc { get { return _mBowlLoc; } set { _mBowlLoc = value; OnPropertyChanged(); } }
private int _mBowlLoc = 10;

public bool IsNoodPositon { get { return _isNoodPositon; } set { _isNoodPositon = value; OnPropertyChanged(); } }
private bool _isNoodPositon = false;

public bool IsBowPositon { get { return _isBowPositon; } set { _isBowPositon = value; OnPropertyChanged(); } }
private bool _isBowPositon = false;

public bool LocalSimOrder { get { return _localSimOrder; } set { _localSimOrder = value; OnPropertyChanged(); } }
private bool _localSimOrder = Global.EnableLocalSimOrder;

public Visibility VisibilitySimOrder { get { return _visibilitySimOrder; } set { _visibilitySimOrder = value; OnPropertyChanged(); } }
private Visibility _visibilitySimOrder;
}
}

+ 25
- 0
BPASmartClient.MorkSUpgradedVer/ViewModel/MonitorViewModel.cs View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmartClient.Business;
using BPASmartClient.Device;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;

namespace BPASmartClient.MorkSUpgradedVer.ViewModel
{
public class MonitorViewModel : ObservableObject
{
public MonitorViewModel()
{

}

public static int DeviceId { get; set; }

public ObservableCollection<VariableMonitor> variableMonitors { get; set; } = Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices()?.FirstOrDefault(p => p.DeviceId == DeviceId)?.variableMonitors;

}
}

+ 49
- 0
BPASmartClient.MorkSUpgradedVer/ViewModel/ParSetViewModel.cs View File

@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmartClient.Helper;
using BPASmartClient.Model;
using BPASmartClient.MorkSUpgradedVer.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;

namespace BPASmartClient.MorkSUpgradedVer.ViewModel
{
public class ParSetViewModel : ObservableObject
{
public ParSetViewModel()
{
SaveInfoCommand = new RelayCommand(SaveSettingData);

ActionManage.GetInstance.Register(SaveSettingData, "初始化设定煮面时间");
}

public RelayCommand SaveInfoCommand { get; set; }

public ObservableCollection<ParSet> parSets { get; set; } = Json<MorksPar>.Data.parSets;

private void SaveSettingData()
{
List<ushort> values = new List<ushort>();
values.Clear();

List<bool> bools = new List<bool>();
bools.Clear();

for (int i = 0; i < Json<MorksPar>.Data.parSets.Count; i++)
{
values.Clear();
values.Add(Json<MorksPar>.Data.parSets[i].Minute);
values.Add(Json<MorksPar>.Data.parSets[i].Second);
bools.Add(Json<MorksPar>.Data.parSets[i].IsShield);
ActionManage.GetInstance.Send("WriteVW", new WritePar() { Address = $"VW{116 + (i * 6)}", Value = values.ToArray() });
}
ActionManage.GetInstance.Send("WriteBools", new WritePar() { Address = "M260.0", Value = bools.ToArray() });
Json<MorksPar>.Save();
}
}
}

+ 2
- 1
BPASmartClient/BPASmartClient.csproj View File

@@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.84" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1264.42" />
</ItemGroup>

@@ -35,6 +35,7 @@
<ProjectReference Include="..\BPASmartClient.MorkF\BPASmartClient.MorkF.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkMW\BPASmartClient.MorkMW.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkM\BPASmartClient.MorkM.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkSUpgradedVer\BPASmartClient.MorkSUpgradedVer.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkS\BPASmartClient.MorkS.csproj" />
<ProjectReference Include="..\BPASmartClient.Morkt.JAKA.JC\BPASmartClient.MorkTJAKAJC.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT.Lebai.JC\BPASmartClient.MorkTLebaiJC.csproj" />


+ 1
- 1
DosingSystem/BPASmartClient.DosingSystem.csproj View File

@@ -22,7 +22,7 @@

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.28" />
<PackageReference Include="BPA.Message" Version="1.0.84" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>



+ 24
- 1
SmartClient.sln View File

@@ -202,7 +202,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.DosingSystem
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "设备监控", "设备监控", "{106E84C1-CAC5-4F14-9E31-201D3202C9FD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MaxWokControl", "BPASmartClient.MaxWokControl\BPASmartClient.MaxWokControl.csproj", "{888382C0-6750-4E81-BED3-0F38775DCCCB}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MaxWokControl", "BPASmartClient.MaxWokControl\BPASmartClient.MaxWokControl.csproj", "{888382C0-6750-4E81-BED3-0F38775DCCCB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkSUpgradedVer", "BPASmartClient.MorkSUpgradedVer\BPASmartClient.MorkSUpgradedVer.csproj", "{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -1898,6 +1900,26 @@ Global
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Release|x64.Build.0 = Release|Any CPU
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Release|x86.ActiveCfg = Release|Any CPU
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Release|x86.Build.0 = Release|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|ARM.ActiveCfg = Debug|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|ARM.Build.0 = Debug|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|ARM64.Build.0 = Debug|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|x64.ActiveCfg = Debug|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|x64.Build.0 = Debug|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|x86.ActiveCfg = Debug|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|x86.Build.0 = Debug|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|Any CPU.Build.0 = Release|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|ARM.ActiveCfg = Release|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|ARM.Build.0 = Release|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|ARM64.ActiveCfg = Release|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|ARM64.Build.0 = Release|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|x64.ActiveCfg = Release|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|x64.Build.0 = Release|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|x86.ActiveCfg = Release|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1992,6 +2014,7 @@ Global
{B79914B9-3A81-426B-88FF-8ABAF5C92AB5} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{106E84C1-CAC5-4F14-9E31-201D3202C9FD} = {7BE13E55-D8B1-4232-AE63-8BF122633297}
{888382C0-6750-4E81-BED3-0F38775DCCCB} = {106E84C1-CAC5-4F14-9E31-201D3202C9FD}
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC}


Loading…
Cancel
Save