@@ -95,17 +95,17 @@ namespace BPASmartClient.PLC | |||
modbusTcp.Write(address, value); | |||
} | |||
public override void AddVarInfo(string add, int len) | |||
{ | |||
if (!tempVar.ContainsKey(add) && !string.IsNullOrEmpty(add) && len > 0) | |||
{ | |||
tempVar.TryAdd(add, new Variable() | |||
{ | |||
Address = add, | |||
ReadLeng = len | |||
}); | |||
} | |||
} | |||
//public override void AddVarInfo(string add, int len) | |||
//{ | |||
// if (!tempVar.ContainsKey(add) && !string.IsNullOrEmpty(add) && len > 0) | |||
// { | |||
// tempVar.TryAdd(add, new Variable() | |||
// { | |||
// Address = add, | |||
// ReadLeng = len | |||
// }); | |||
// } | |||
//} | |||
protected override void InitStatus() | |||
{ | |||
@@ -0,0 +1,24 @@ | |||
using BPA.Message; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.Model | |||
{ | |||
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 SortNum { get; set; } | |||
public int RecipeId { get; set; } | |||
public List<int> Recipes { get; set; } | |||
} | |||
} |
@@ -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.MorkMV1 | |||
{ | |||
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; } | |||
} | |||
} |
@@ -0,0 +1,30 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0-windows</TargetFramework> | |||
<Nullable>enable</Nullable> | |||
<UseWPF>true</UseWPF> | |||
</PropertyGroup> | |||
<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> |
@@ -0,0 +1,864 @@ | |||
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.MorkMV1.Model; | |||
using System.Collections.ObjectModel; | |||
using BPASmartClient.MorkMV1.ViewModel; | |||
using BPASmartClient.Business; | |||
using BPASmartClient.Model.小炒机; | |||
using BPA.Models; | |||
using System.Windows.Forms; | |||
using System.Media; | |||
using BPASmartClient.CustomResource; | |||
//using BPA.Helper; | |||
namespace BPASmartClient.MorkMV1 | |||
{ | |||
public class Control_MorkMV1 : BaseDevice | |||
{ | |||
public override DeviceClientType DeviceType => DeviceClientType.MORKM; | |||
GVL_MorkMV1 mORKM = new GVL_MorkMV1(); | |||
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(); | |||
mORKM.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)NoodleLoc, SuborderId = guid }); | |||
MessageLog.GetInstance.Show($"添加订单:面条位置【{NoodleLoc}】"); | |||
mORKM.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() | |||
{ | |||
mORKM = null; | |||
mORKM = new GVL_MorkMV1(); | |||
} | |||
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 = mORKM.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(); | |||
} | |||
//if (mORKS.doe.ContainsKey(subid)) | |||
//{ | |||
// goodName = mORKS.doe[subid].MorkOrder.GoodsName; | |||
// SortNum = mORKS.doe[subid].MorkOrder.SortNum.ToString(); | |||
if (!string.IsNullOrEmpty(goodName) && !string.IsNullOrEmpty(SortNum)) | |||
{ | |||
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") | |||
}); | |||
} | |||
//mORKS.doe.Remove(subid, out _); | |||
} | |||
//} | |||
//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) | |||
{ | |||
Initing = !bools[0]; | |||
mORKM.InitComplete = bools[0]; | |||
mORKM.MoveScrewRodInitCom = bools[1]; | |||
mORKM.SacrificialVesselInitCom = bools[2]; | |||
mORKM.CylinderInitCom = bools[3]; | |||
mORKM.NoodleCookerInitCom = bools[4]; | |||
mORKM.RobotInitCom = bools[5]; | |||
mORKM.SiloInitCom = bools[6]; | |||
alarm.DeviceNoInit = !mORKM.InitComplete; | |||
alarm.MoveScrewRodNoInit = !mORKM.MoveScrewRodInitCom; | |||
alarm.SacrificialVesselNoInit = !mORKM.SacrificialVesselInitCom; | |||
alarm.CylinderNoInit = !mORKM.CylinderInitCom; | |||
alarm.NoodleCookerNoInit = !mORKM.NoodleCookerInitCom; | |||
alarm.RobotNoInit = !mORKM.RobotInitCom; | |||
alarm.SiloNoInit = !mORKM.SiloInitCom; | |||
} | |||
})); | |||
GetStatus("M10.0", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 2) | |||
{ | |||
mORKM.AllowInvertedFace = bools[0]; | |||
mORKM.DiningComplete = bools[1]; | |||
} | |||
})); | |||
GetStatus("M10.4", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1) | |||
{ | |||
mORKM.DropBowlMechanismStatus = bools[0]; | |||
} | |||
})); | |||
GetStatus("M12.2", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1) | |||
{ | |||
mORKM.FixedFlag = bools[0]; | |||
} | |||
})); | |||
GetStatus("M13.5", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1) | |||
{ | |||
mORKM.SiloInPlace = bools[0]; | |||
} | |||
})); | |||
GetStatus("M16.7", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1) | |||
{ | |||
mORKM.RobotTakeNoodleCom = bools[0]; | |||
} | |||
})); | |||
GetStatus("M17.4", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1) | |||
{ | |||
mORKM.RobotStatus = bools[0]; | |||
} | |||
})); | |||
GetStatus("M18.0", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 5) | |||
{ | |||
mORKM.SmallBowlYesOrNoCheck = bools[0]; | |||
mORKM.LargeBowYesOrNoCheck = bools[1]; | |||
mORKM.TurntableLowPosition = bools[2]; | |||
mORKM.TurntableHighPosition = bools[3]; | |||
alarm.Supply2_LossBowl = !mORKM.SmallBowlYesOrNoCheck; | |||
alarm.Supply1_LossBowl = !mORKM.LargeBowYesOrNoCheck; | |||
} | |||
})); | |||
GetStatus("VW17", new Action<object>((obj) => | |||
{ | |||
if (obj is ushort[] ushorts && ushorts.Length > 0 && ushorts.Length <= 1) | |||
{ | |||
var tt = ushorts.UshortsToBytes(true).BytesToUshorts(); | |||
for (byte i = 0; i < 6; i++) | |||
{ | |||
if (RTrig.GetInstance($"CookNoodleCom{i + 1}").Start(tt[0].GetBitValue((byte)(i + 1)))) | |||
{ | |||
if (!string.IsNullOrEmpty(mORKM.CookNodelId[i])) | |||
mORKM.CookNoodleCom[i] = true; | |||
} | |||
} | |||
//mORKS.CookNoodleCom[0] = tt[0].GetBitValue(1); | |||
//mORKS.CookNoodleCom[1] = tt[0].GetBitValue(2); | |||
//mORKS.CookNoodleCom[2] = tt[0].GetBitValue(3); | |||
//mORKS.CookNoodleCom[3] = tt[0].GetBitValue(4); | |||
//mORKS.CookNoodleCom[4] = tt[0].GetBitValue(5); | |||
//mORKS.CookNoodleCom[5] = tt[0].GetBitValue(6); | |||
mORKM.Heating = ushorts[0].GetBitValue(15); | |||
mORKM.TemperatureReaches = ushorts[0].GetBitValue(16); | |||
alarm.MachineLowTemperature = !mORKM.TemperatureReaches; | |||
} | |||
})); | |||
GetStatus("VW770", new Action<object>((obj) => | |||
{ | |||
if (obj is ushort[] ushorts && ushorts.Length > 0 && ushorts.Length <= 1) | |||
{ | |||
mORKM.CurrentFeedbackLoc = ushorts[0]; | |||
} | |||
})); | |||
mORKM.TakeBowlTaskCount = mORKM.TakeBowlTask.Count; | |||
mORKM.RBTakeNoodleTaskCount = mORKM.RBTakeNoodleTask.Count; | |||
for (int i = 0; i < Json<MorksPar>.Data.parSets.Count; i++) | |||
{ | |||
mORKM.nsm.ElementAt(i).IsShield = Json<MorksPar>.Data.parSets.ElementAt(i).IsShield; | |||
mORKM.nsm.ElementAt(i).NoodleCookerStatus = mORKM.NoodleCookerStatus[i]; | |||
} | |||
} | |||
/// <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) | |||
{ | |||
mORKM.doOrderEvents.Add(order); | |||
//mORKS.doe.TryAdd(order.MorkOrder.SuborderId, order); | |||
if (order.MorkOrder.GoodBatchings == null) return; | |||
if (mORKM.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}"); | |||
mORKM.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 (mORKM.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||
mORKM.RBTakeNoodleTask.Enqueue(new OrderLocInfo() | |||
{ | |||
GoodName = order.MorkOrder.GoodsName, | |||
Loc = ushort.Parse(res.BatchingLoc), | |||
SuborderId = order.MorkOrder.SuborderId, | |||
SortNum = order.MorkOrder.SortNum, | |||
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 (mORKM.TakeBowlTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||
mORKM.TakeBowlTask.Enqueue(new OrderLocInfo() | |||
{ | |||
BatchingId = res.BatchingId, | |||
GoodName = order.MorkOrder.GoodsName, | |||
Loc = ushort.Parse(res.BatchingLoc), | |||
SuborderId = order.MorkOrder.SuborderId, | |||
SortNum = order.MorkOrder.SortNum, | |||
RecipeNumber = (index >= 1 && index <= 10) ? (ushort)index : (ushort)0 | |||
}); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
}); | |||
} | |||
public override void MainTask() | |||
{ | |||
mORKM.AllowRun = mORKM.InitComplete; | |||
if (Json<KeepDataBase>.Data.IsVerify) | |||
IsHealth = mORKM.InitComplete; | |||
else | |||
IsHealth = true; | |||
TakeBowlTask(); | |||
TakeNoodleTask(); | |||
OutNoodleTask(); | |||
SingleDetect(); | |||
TurntableControl(); | |||
} | |||
private void BowlControl(OrderLocInfo orderLocInfo) | |||
{ | |||
if (orderLocInfo.Loc >= 10 && orderLocInfo.Loc <= 11) | |||
{ | |||
mORKM.TakeBowlId = orderLocInfo.SuborderId; | |||
mORKM.TakeBowName = orderLocInfo.GoodName; | |||
mORKM.TakeBowSortNum = orderLocInfo.SortNum; | |||
TakeBowlControl(orderLocInfo.Loc); | |||
OrderChange(mORKM.TakeBowlId, ORDER_STATUS.COOKING); | |||
DeviceProcessLogShow($"订单【{mORKM.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]"); | |||
mORKM.TakeBowlInterlock = true; | |||
} | |||
} | |||
/// <summary> | |||
/// 取碗控制 | |||
/// </summary> | |||
private void TakeBowlTask() | |||
{ | |||
if (mORKM.AllowRun && mORKM.TakeBowlTask.Count > 0 && !mORKM.DropBowlMechanismStatus && !mORKM.TakeBowlInterlock) | |||
{ | |||
ushort BowLoc = 0; | |||
var res = orderMaterialDelivery?.BatchingInfo?.Where(p => p.BatchingId == mORKM.TakeBowlTask.ElementAt(0).BatchingId).ToList(); | |||
if (res == null || res?.Count == 0) | |||
{ | |||
if (mORKM.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo)) BowlControl(orderLocInfo); | |||
} | |||
else | |||
{ | |||
foreach (var item in res) | |||
{ | |||
if (ushort.TryParse(item.BatchingLoc, out ushort loc)) | |||
{ | |||
if (loc == 10 && mORKM.SmallBowlYesOrNoCheck) | |||
{ | |||
BowLoc = loc; | |||
break; | |||
} | |||
else if (loc == 11 && mORKM.LargeBowYesOrNoCheck) | |||
{ | |||
BowLoc = loc; | |||
break; | |||
} | |||
} | |||
} | |||
if (BowLoc >= 10 && BowLoc <= 11) | |||
{ | |||
if (mORKM.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo)) | |||
{ | |||
orderLocInfo.Loc = BowLoc; | |||
BowlControl(orderLocInfo); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 转台控制 | |||
/// </summary> | |||
private void TurntableControl() | |||
{ | |||
if (Global.EnableLocalSimOrder) | |||
{ | |||
//不做轮询,直接取面,模拟订单使用 | |||
if (mORKM.SiloInPlace && !mORKM.Feeding && mORKM.InitComplete && !mORKM.AllowTakeNoodle && mORKM.RBTakeNoodleTask.Count > 0) | |||
{ | |||
if (mORKM.TurntableLowPosition) | |||
{ | |||
TurntableStart(mORKM.RBTakeNoodleTask.ElementAt(0).Loc); | |||
mORKM.TurntableLocLists.Clear(); | |||
mORKM.AllowTakeNoodle = true; | |||
DeviceProcessLogShow($"控制机器人去转台【{mORKM.RBTakeNoodleTask.ElementAt(0).Loc}】号位置取面"); | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
//正常轮询 | |||
if (Delay.GetInstance("到位检测延时").Start(mORKM.SiloInPlace, 2)) | |||
{ | |||
if (mORKM.SiloInPlace && !mORKM.Feeding && mORKM.InitComplete && !mORKM.AllowTakeNoodle && mORKM.RBTakeNoodleTask.Count > 0) | |||
{ | |||
var result = orderMaterialDelivery.BatchingInfo.Where(p => p.BatchingId == mORKM.RBTakeNoodleTask.ElementAt(0).BatchingId).ToList(); | |||
if (result != null) | |||
{ | |||
var res = result.FirstOrDefault(P => P.BatchingLoc == mORKM.CurrentFeedbackLoc.ToString()); | |||
if (mORKM.TurntableLowPosition && res != null) | |||
{ | |||
TurntableStart(mORKM.CurrentFeedbackLoc); | |||
mORKM.TurntableLocLists.Clear(); | |||
mORKM.AllowTakeNoodle = true; | |||
DeviceProcessLogShow($"控制机器人去转台【{mORKM.CurrentFeedbackLoc}】号位置取面"); | |||
} | |||
else | |||
{ | |||
if (!mORKM.TurntableInterlock) | |||
{ | |||
foreach (var item in result) | |||
{ | |||
if (ushort.TryParse(item.BatchingLoc, out ushort loc)) | |||
{ | |||
if (mORKM.CurrentFeedbackLoc != loc && !mORKM.TurntableLocLists.Contains(loc)) | |||
{ | |||
if (!mORKM.TurntableLowPosition) | |||
{ | |||
DeviceProcessLogShow($"执行了转台启动互锁信号复位"); | |||
} | |||
TurntableStart(loc); | |||
DeviceProcessLogShow($"没有物料检测的启动转台控制,转台位置:[{loc}]"); | |||
break; | |||
} | |||
else if (mORKM.CurrentFeedbackLoc == loc && !mORKM.TurntableLocLists.Contains(loc)) mORKM.TurntableLocLists.Add(loc); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
else DeviceProcessLogShow("未找到可用的物料信息"); | |||
} | |||
} | |||
} | |||
//补料中检测 | |||
if (RTrig.GetInstance("mORKS.Feeding").Start(mORKM.Feeding)) | |||
{ | |||
mORKM.AllowTakeNoodle = false; | |||
mORKM.TakeNoodleInterlock = false; | |||
} | |||
//转台到位检测 | |||
if (RTrig.GetInstance("TurntableInPlace").Start(mORKM.SiloInPlace && mORKM.CurrentLoc == mORKM.CurrentFeedbackLoc)) | |||
{ | |||
mORKM.TurntableInterlock = false; | |||
DeviceProcessLogShow("转台到位检测"); | |||
} | |||
//补料完成检测 | |||
if (RTrig.GetInstance("FeedComplete").Start(mORKM.FeedComplete)) | |||
{ | |||
if (!mORKM.AllowTakeNoodle && mORKM.TurntableLocLists.Count > 0) | |||
{ | |||
mORKM.TurntableLocLists.Clear(); | |||
mORKM.TurntableInterlock = false; | |||
DeviceProcessLogShow("补料完成检测"); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 取面任务 | |||
/// </summary> | |||
private void TakeNoodleTask() | |||
{ | |||
//取面控制 | |||
if (mORKM.AllowRun && mORKM.RobotStatus && !mORKM.Feeding && !mORKM.RobotTaskInterlock && mORKM.AllowTakeNoodle && mORKM.SiloInPlace && !mORKM.TakeNoodleInterlock && mORKM.RBTakeNoodleTask.Count > 0) | |||
{ | |||
if (mORKM.CurrentLoc == mORKM.CurrentFeedbackLoc) | |||
{ | |||
//int loc = Array.FindIndex(mORKS.NoodleCookerStatus, p => p == false);//查找煮面炉空闲位置 | |||
int loc = mORKM.nsm.ToList().FindIndex(p => p.NoodleCookerStatus == false && p.IsShield == false);//查找煮面炉空闲位置 | |||
if (loc >= 0 && loc <= 5) | |||
{ | |||
//if (!Json<MorksPar>.Data.parSets.ElementAt(loc).IsShield)//检查该煮面篮是否被屏蔽 | |||
//{ | |||
if (mORKM.RBTakeNoodleTask.TryDequeue(out OrderLocInfo orderLocInfo)) | |||
{ | |||
//写入煮面时间 | |||
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{324 + (loc * 4)}", values.ToArray()); | |||
mORKM.CurrentLoc = 0; | |||
mORKM.CookNodelId[loc] = orderLocInfo.SuborderId; | |||
mORKM.NoodleCookerStatus[loc] = true; | |||
SetFallNoodleLoc((ushort)(loc + 1)); | |||
//机器人开始取面 | |||
OrderChange(orderLocInfo.SuborderId, ORDER_STATUS.COOKING); | |||
DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】,机器人倒面至【{loc + 1}】号煮面栏"); | |||
mORKM.TakeNoodleInterlock = true; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 出餐控制 | |||
/// </summary> | |||
private void OutNoodleTask() | |||
{ | |||
if (mORKM.AllowInvertedFace && mORKM.RobotTaskInterlock && !mORKM.TakeNoodleInterlock && mORKM.RobotStatus) | |||
{ | |||
int loc = Array.FindIndex(mORKM.CookNodelId, p => p == mORKM.IngredientsCompleteId && p.Length > 0); | |||
if (loc >= 0 && loc <= 5) | |||
{ | |||
if (mORKM.CookNoodleCom[loc]) | |||
{ | |||
SetTakeNoodleLoc((ushort)(loc + 1)); | |||
mORKM.NoodleCookerStatus[loc] = false; | |||
WriteData($"VW260", (ushort)0);//设置出汤时间 | |||
OrderChange(mORKM.IngredientsCompleteId, ORDER_STATUS.COMPLETED_COOK); | |||
DeviceProcessLogShow($"订单【{mORKM.IngredientsCompleteId}】制作完成"); | |||
mORKM.CookCompleteFlatBit = true; | |||
mORKM.OutMealId = mORKM.IngredientsCompleteId; | |||
mORKM.OutMealName = mORKM.IngredientsCompleteName; | |||
mORKM.OutMealSortNum = mORKM.IngredientsCompleteSortNum; | |||
mORKM.IngredientsCompleteId = string.Empty; | |||
mORKM.CookNodelId[loc] = string.Empty; | |||
DeviceProcessLogShow($"{loc + 1} 号位置出餐控制,订单ID:{mORKM.OutMealId}"); | |||
mORKM.CookNoodleCom[loc] = false; | |||
} | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 信号检测 | |||
/// </summary> | |||
private void SingleDetect() | |||
{ | |||
//允许倒面信号检测 | |||
if (RTrig.GetInstance("AllowFallNoodle").Start(mORKM.AllowInvertedFace)) | |||
{ | |||
mORKM.IngredientsCompleteId = mORKM.TakeBowlId; | |||
mORKM.IngredientsCompleteName = mORKM.TakeBowName; | |||
mORKM.IngredientsCompleteSortNum = mORKM.TakeBowSortNum; | |||
mORKM.TakeBowSortNum = 0; | |||
mORKM.TakeBowlId = string.Empty; | |||
mORKM.TakeBowName = string.Empty; | |||
DeviceProcessLogShow($"碗到位,允许到面,{mORKM.IngredientsCompleteId}"); | |||
mORKM.TakeBowlInterlock = false; | |||
} | |||
//取餐完成逻辑处理 | |||
if (RTrig.GetInstance("CompleteChange1").Start(mORKM.DiningComplete) && mORKM.CookCompleteFlatBit == true) | |||
{ | |||
OrderChange(mORKM.OutMealId, ORDER_STATUS.COMPLETED_TAKE); | |||
DeviceProcessLogShow($"订单【{mORKM.OutMealId}】取餐完成"); | |||
WriteData("M10.1", false); | |||
DeviceProcessLogShow($"出餐订单序号【{mORKM.OutMealSortNum}】"); | |||
VoiceAPI.Speak(mORKM.OutMealSortNum.ToString()); | |||
//DeviceProcessLogShow($"叫号系统通知主题【MORKS/VoiceCall/{DeviceId}】"); | |||
//Plugin.GetInstance().GetPlugin<MQTTMgr>().Publish($"MORKS/VoiceCall/{DeviceId}", mORKS.OutMealSortNum.ToString()); | |||
mORKM.CookCompleteFlatBit = false; | |||
mORKM.OutMealId = string.Empty; | |||
mORKM.OutMealName = string.Empty; | |||
mORKM.OutMealSortNum = 0; | |||
} | |||
//机器人取面完成信号检测 | |||
if (RTrig.GetInstance("TakeNoodleComplete").Start(mORKM.RobotTakeNoodleCom)) | |||
{ | |||
mORKM.TakeNoodleInterlock = false; | |||
mORKM.AllowTakeNoodle = false; | |||
mORKM.TurntableInterlock = false; | |||
DeviceProcessLogShow("机器人取面完成信号检测"); | |||
} | |||
int OutMealRequstCount = mORKM.CookNoodleCom.Where(p => p == true).ToList().Count; | |||
//int mlCount = mORKS.NoodleCookerStatus.Where(p => p == true).ToList().Count - Json<MorksPar>.Data.parSets.Where(x => x.IsShield == true).ToList().Count; | |||
int mlCount = mORKM.nsm.Where(p => p.NoodleCookerStatus == true && p.IsShield == false).ToList().Count; | |||
int index = Array.FindIndex(mORKM.CookNodelId, p => p == mORKM.IngredientsCompleteId); | |||
bool isok = index >= 0 && index < mORKM.CookNoodleCom.Length && mORKM.CookNoodleCom[index]; | |||
mORKM.PriorityJudgment = Delay.GetInstance("取餐优先级判断").Start(mORKM.TurntableLocLists.Count > 0 && !mORKM.TurntableLowPosition, 4); | |||
//mORKS.RobotTaskInterlock = OutMealRequstCount > 0 && mORKS.AllowInvertedFace && (mlCount >= 2 || mORKS.RBTakeNoodleTask.Count == 0 || mORKS.PriorityJudgment); | |||
mORKM.RobotTaskInterlock = isok && mORKM.AllowInvertedFace && (mlCount >= 2 || mORKM.RBTakeNoodleTask.Count == 0 || mORKM.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) | |||
{ | |||
mORKM.CurrentLoc = loc; | |||
mORKM.TurntableInterlock = true; | |||
mORKM.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($"M15.{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) | |||
{ | |||
mORKM.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.NoodleLoc, SuborderId = guid }); | |||
MessageLog.GetInstance.Show($"添加订单:面条位置【{(ushort)msm.NoodleLoc}】"); | |||
} | |||
if (msm.Bowloc >= 10 && msm.Bowloc <= 11) | |||
{ | |||
mORKM.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.Bowloc, SuborderId = guid }); | |||
MessageLog.GetInstance.Show($"添加订单:碗位置【{(ushort)msm.Bowloc}】"); | |||
} | |||
} | |||
}); | |||
} | |||
#endregion | |||
} | |||
} |
@@ -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.MorkMV1 | |||
{ | |||
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个煮面炉上或下) | |||
//温度状态(煮面炉温度是否到达) | |||
//料仓位置(当前料仓在几号位置) | |||
//料仓上下物料检测 | |||
//落碗机构缺碗检测 | |||
//机器人状态 | |||
//当日订单总量 | |||
//报警信息 | |||
} | |||
} |
@@ -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.MorkMV1 | |||
{ | |||
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; } | |||
} | |||
} |
@@ -0,0 +1,353 @@ | |||
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.MorkMV1 | |||
{ | |||
public class GVL_MorkMV1 : 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; } | |||
/// <summary> | |||
/// 取碗任务数量 | |||
/// </summary> | |||
[VariableMonitor("取碗任务数量")] | |||
public int TakeBowlTaskCount { get; set; } | |||
/// <summary> | |||
/// 取面任务数量 | |||
/// </summary> | |||
[VariableMonitor("取面任务数量")] | |||
public int RBTakeNoodleTaskCount { 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 ConcurrentDictionary<string, DoOrderEvent> doe { get; set; } = new ConcurrentDictionary<string, DoOrderEvent>(); | |||
public List<string> HistorySuborderId { get; set; } = new List<string>(); | |||
public NoodleShidModel[] nsm { get; set; } = new NoodleShidModel[6] { new NoodleShidModel(), new NoodleShidModel(), new NoodleShidModel(), new NoodleShidModel(), new NoodleShidModel(), new NoodleShidModel() }; | |||
#endregion | |||
#region 订单ID记录 | |||
/// <summary> | |||
/// 取碗订单ID | |||
/// </summary> | |||
public string TakeBowlId { get; set; } = string.Empty; | |||
/// <summary> | |||
/// 取碗订单名称 | |||
/// </summary> | |||
public string TakeBowName { get; set; } = string.Empty; | |||
/// <summary> | |||
/// 配料完成订单名称 | |||
/// </summary> | |||
public int TakeBowSortNum { get; set; } = 0; | |||
/// <summary> | |||
/// 允许倒面位置ID | |||
/// </summary> | |||
public string IngredientsCompleteId { get; set; } = string.Empty; | |||
/// <summary> | |||
/// 配料完成订单名称 | |||
/// </summary> | |||
public string IngredientsCompleteName { get; set; } = string.Empty; | |||
/// <summary> | |||
/// 配料完成订单名称 | |||
/// </summary> | |||
public int IngredientsCompleteSortNum { get; set; } = 0; | |||
/// <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 int OutMealSortNum { get; set; } = 0; | |||
/// <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 | |||
} | |||
} |
@@ -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.MorkMV1.Model; | |||
global using System.Collections.ObjectModel; | |||
global using BPASmartClient.MorkMV1.ViewModel; | |||
global using BPASmartClient.Business; | |||
global using BPASmartClient.Model.小炒机; | |||
global using BPA.Models; | |||
global using System.Windows.Forms; | |||
global using System.Media; | |||
@@ -0,0 +1,13 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkMV1.Model | |||
{ | |||
public class Global | |||
{ | |||
public static bool EnableLocalSimOrder { get; set; } | |||
} | |||
} |
@@ -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.MorkMV1.Model | |||
{ | |||
internal class MorksPar | |||
{ | |||
public ObservableCollection<ParSet> parSets { get; set; } = new ObservableCollection<ParSet>(); | |||
} | |||
} |
@@ -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; | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkMV1.Model | |||
{ | |||
public class WritePar | |||
{ | |||
public string Address { get; set; } | |||
public object Value { get; set; } | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkMV1 | |||
{ | |||
public class NoodleShidModel | |||
{ | |||
/// <summary> | |||
/// 是否被屏蔽,true:屏蔽,false:未屏蔽 | |||
/// </summary> | |||
public bool IsShield { get; set; } | |||
/// <summary> | |||
/// 是否忙碌,true:忙碌,FALSE:空闲 | |||
/// </summary> | |||
public bool NoodleCookerStatus { get; set; } | |||
} | |||
} |
@@ -0,0 +1,24 @@ | |||
//using BPA.Message; | |||
//using System; | |||
//using System.Collections.Generic; | |||
//using System.Linq; | |||
//using System.Text; | |||
//using System.Threading.Tasks; | |||
//namespace BPASmartClient.MorkMV1 | |||
//{ | |||
// 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 SortNum { get; set; } | |||
// public int RecipeId { get; set; } | |||
// public List<int> Recipes { get; set; } | |||
// } | |||
//} |
@@ -0,0 +1,117 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.MorkMV1.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.MorkMV1.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.MorkMV1.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> |
@@ -0,0 +1,30 @@ | |||
using BPASmartClient.MorkMV1.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.MorkMV1.View | |||
{ | |||
/// <summary> | |||
/// Debug.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class Debug : System.Windows.Controls.UserControl | |||
{ | |||
public Debug() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,242 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.MorkMV1.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.MorkMV1.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.MorkMV1.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> |
@@ -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.MorkMV1.View | |||
{ | |||
/// <summary> | |||
/// Monitor.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class Monitor : System.Windows.Controls.UserControl | |||
{ | |||
public Monitor() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,130 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.MorkMV1.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.MorkMV1.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.MorkMV1.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="" | |||
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> |
@@ -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.MorkMV1.View | |||
{ | |||
/// <summary> | |||
/// ParSet.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class ParSet : System.Windows.Controls.UserControl | |||
{ | |||
public ParSet() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -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.MorkMV1.Model; | |||
using System.Windows; | |||
using BPASmartClient.Message; | |||
namespace BPASmartClient.MorkMV1.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; | |||
} | |||
} |
@@ -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.MorkMV1.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; | |||
} | |||
} |
@@ -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.MorkMV1.Model; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace BPASmartClient.MorkMV1.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(); | |||
} | |||
} | |||
} |
@@ -129,59 +129,59 @@ namespace BPASmartClient.MorkS | |||
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS) | |||
{ | |||
//var res = mORKS.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid); | |||
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(); | |||
//} | |||
if (res != null) | |||
{ | |||
goodName = res.MorkOrder.GoodsName; | |||
SortNum = res.MorkOrder.SortNum.ToString(); | |||
} | |||
if (mORKS.doe.ContainsKey(subid)) | |||
//if (mORKS.doe.ContainsKey(subid)) | |||
//{ | |||
//goodName = mORKS.doe[subid].MorkOrder.GoodsName; | |||
//SortNum = mORKS.doe[subid].MorkOrder.SortNum.ToString(); | |||
if (!string.IsNullOrEmpty(goodName) && !string.IsNullOrEmpty(SortNum)) | |||
{ | |||
goodName = mORKS.doe[subid].MorkOrder.GoodsName; | |||
SortNum = mORKS.doe[subid].MorkOrder.SortNum.ToString(); | |||
if (!string.IsNullOrEmpty(goodName) && !string.IsNullOrEmpty(SortNum)) | |||
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) | |||
{ | |||
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) | |||
{ | |||
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() | |||
DataServer.GetInstance.morkS.MakeOrder.RemoveAt(index); | |||
DataServer.GetInstance.morkS.MakeOrderOver.Add(new OrderMakeModel() | |||
{ | |||
Status = oRDER_STATUS, | |||
GoodName = goodName, | |||
SortNum = SortNum, | |||
StartTime = DateTime.Now.ToString("HH:mm:ss") | |||
StopTime = DateTime.Now.ToString("HH:mm:ss") | |||
}); | |||
} | |||
mORKS.doe.Remove(subid, out _); | |||
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") | |||
}); | |||
} | |||
//mORKS.doe.Remove(subid, out _); | |||
} | |||
//} | |||
} | |||
@@ -330,8 +330,8 @@ namespace BPASmartClient.MorkS | |||
if (@event == null) return; | |||
if (@event is DoOrderEvent order) | |||
{ | |||
//mORKS.doOrderEvents.Add(order); | |||
mORKS.doe.TryAdd(order.MorkOrder.SuborderId, order); | |||
mORKS.doOrderEvents.Add(order); | |||
//mORKS.doe.TryAdd(order.MorkOrder.SuborderId, order); | |||
DeviceProcessLogShow($"接收到{order.MorkOrder.SortNum}号订单"); | |||
if (order.MorkOrder.GoodBatchings == null) return; | |||
if (mORKS.HistorySuborderId.Contains(order.MorkOrder.SuborderId)) return; | |||
@@ -1,24 +1,24 @@ | |||
using BPA.Message; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
//using BPA.Message; | |||
//using System; | |||
//using System.Collections.Generic; | |||
//using System.Linq; | |||
//using System.Text; | |||
//using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkS | |||
{ | |||
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; } | |||
//namespace BPASmartClient.MorkS | |||
//{ | |||
// 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 int SortNum { get; set; } | |||
// public int RecipeId { get; set; } | |||
// public int SortNum { get; set; } | |||
public List<int> Recipes { get; set; } | |||
// public List<int> Recipes { get; set; } | |||
} | |||
} | |||
// } | |||
//} |
@@ -128,61 +128,59 @@ namespace BPASmartClient.MorkSUpgradedVer | |||
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS) | |||
{ | |||
//var res = mORKS.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid); | |||
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(); | |||
//} | |||
if (res != null) | |||
{ | |||
goodName = res.MorkOrder.GoodsName; | |||
SortNum = res.MorkOrder.SortNum.ToString(); | |||
} | |||
if (mORKS.doe.ContainsKey(subid)) | |||
//if (mORKS.doe.ContainsKey(subid)) | |||
//{ | |||
// goodName = mORKS.doe[subid].MorkOrder.GoodsName; | |||
// SortNum = mORKS.doe[subid].MorkOrder.SortNum.ToString(); | |||
if (!string.IsNullOrEmpty(goodName) && !string.IsNullOrEmpty(SortNum)) | |||
{ | |||
goodName = mORKS.doe[subid].MorkOrder.GoodsName; | |||
SortNum = mORKS.doe[subid].MorkOrder.SortNum.ToString(); | |||
if (!string.IsNullOrEmpty(goodName) && !string.IsNullOrEmpty(SortNum)) | |||
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) | |||
{ | |||
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 | |||
if (oRDER_STATUS == ORDER_STATUS.COMPLETED_COOK) | |||
{ | |||
DataServer.GetInstance.morkS.MakeOrder.Add(new OrderMakeModel() | |||
DataServer.GetInstance.morkS.MakeOrder.RemoveAt(index); | |||
DataServer.GetInstance.morkS.MakeOrderOver.Add(new OrderMakeModel() | |||
{ | |||
Status = oRDER_STATUS, | |||
GoodName = goodName, | |||
SortNum = SortNum, | |||
StartTime = DateTime.Now.ToString("HH:mm:ss") | |||
StopTime = DateTime.Now.ToString("HH:mm:ss") | |||
}); | |||
} | |||
mORKS.doe.Remove(subid, out _); | |||
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") | |||
}); | |||
} | |||
//mORKS.doe.Remove(subid, out _); | |||
} | |||
//} | |||
@@ -400,8 +398,8 @@ namespace BPASmartClient.MorkSUpgradedVer | |||
if (@event == null) return; | |||
if (@event is DoOrderEvent order) | |||
{ | |||
//mORKS.doOrderEvents.Add(order); | |||
mORKS.doe.TryAdd(order.MorkOrder.SuborderId, order); | |||
mORKS.doOrderEvents.Add(order); | |||
//mORKS.doe.TryAdd(order.MorkOrder.SuborderId, order); | |||
if (order.MorkOrder.GoodBatchings == null) return; | |||
if (mORKS.HistorySuborderId.Contains(order.MorkOrder.SuborderId)) return; | |||
OrderCount++; | |||
@@ -1,24 +1,24 @@ | |||
using BPA.Message; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
//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 SortNum { get; set; } | |||
//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 SortNum { get; set; } | |||
public int RecipeId { get; set; } | |||
// public int RecipeId { get; set; } | |||
public List<int> Recipes { get; set; } | |||
// public List<int> Recipes { get; set; } | |||
} | |||
} | |||
// } | |||
//} |
@@ -66,7 +66,7 @@ namespace BPASmartClient.Peripheral | |||
public abstract void WriteData(string address, object value); | |||
public abstract void AddVarInfo(string add, int len); | |||
//public abstract void AddVarInfo(string add, int len); | |||
public ConcurrentDictionary<string, object> GetAllStatus() | |||
{ | |||
@@ -59,7 +59,7 @@ namespace BPASmartClient.Peripheral | |||
void WriteData(string address, object value); | |||
void AddVarInfo(string add, int len); | |||
//void AddVarInfo(string add, int len); | |||
//void ReadData(string address); | |||
@@ -33,6 +33,7 @@ | |||
<ProjectReference Include="..\BPASmartClient.MorkBF\BPASmartClient.MorkBF.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MorkD\BPASmartClient.MorkD.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MorkF\BPASmartClient.MorkF.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MorkMV1\BPASmartClient.MorkMV1.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MorkMW\BPASmartClient.MorkMW.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MorkM\BPASmartClient.MorkM.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MorkSUpgradedVer\BPASmartClient.MorkSUpgradedVer.csproj" /> | |||
@@ -212,7 +212,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.RobotGripper | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MilkTeaCube", "BPASmartClient.MilkTeaCube\BPASmartClient.MilkTeaCube.csproj", "{915F0718-B7AC-428D-ACD5-7DAACC28539F}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.Update", "BPASmartClient.Update\BPASmartClient.Update.csproj", "{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}" | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.Update", "BPASmartClient.Update\BPASmartClient.Update.csproj", "{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkMV1", "BPASmartClient.MorkMV1\BPASmartClient.MorkMV1.csproj", "{2D2200CF-7A66-40EA-998A-F0CE9BC2B3BB}" | |||
EndProject | |||
Global | |||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
@@ -2008,6 +2010,26 @@ Global | |||
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Release|x64.Build.0 = Release|Any CPU | |||
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Release|x86.ActiveCfg = Release|Any CPU | |||
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Release|x86.Build.0 = Release|Any CPU | |||
{2D2200CF-7A66-40EA-998A-F0CE9BC2B3BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{2D2200CF-7A66-40EA-998A-F0CE9BC2B3BB}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{2D2200CF-7A66-40EA-998A-F0CE9BC2B3BB}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{2D2200CF-7A66-40EA-998A-F0CE9BC2B3BB}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{2D2200CF-7A66-40EA-998A-F0CE9BC2B3BB}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{2D2200CF-7A66-40EA-998A-F0CE9BC2B3BB}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{2D2200CF-7A66-40EA-998A-F0CE9BC2B3BB}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{2D2200CF-7A66-40EA-998A-F0CE9BC2B3BB}.Debug|x64.Build.0 = Debug|Any CPU | |||
{2D2200CF-7A66-40EA-998A-F0CE9BC2B3BB}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{2D2200CF-7A66-40EA-998A-F0CE9BC2B3BB}.Debug|x86.Build.0 = Debug|Any CPU | |||
{2D2200CF-7A66-40EA-998A-F0CE9BC2B3BB}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{2D2200CF-7A66-40EA-998A-F0CE9BC2B3BB}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{2D2200CF-7A66-40EA-998A-F0CE9BC2B3BB}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{2D2200CF-7A66-40EA-998A-F0CE9BC2B3BB}.Release|ARM.Build.0 = Release|Any CPU | |||
{2D2200CF-7A66-40EA-998A-F0CE9BC2B3BB}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{2D2200CF-7A66-40EA-998A-F0CE9BC2B3BB}.Release|ARM64.Build.0 = Release|Any CPU | |||
{2D2200CF-7A66-40EA-998A-F0CE9BC2B3BB}.Release|x64.ActiveCfg = Release|Any CPU | |||
{2D2200CF-7A66-40EA-998A-F0CE9BC2B3BB}.Release|x64.Build.0 = Release|Any CPU | |||
{2D2200CF-7A66-40EA-998A-F0CE9BC2B3BB}.Release|x86.ActiveCfg = Release|Any CPU | |||
{2D2200CF-7A66-40EA-998A-F0CE9BC2B3BB}.Release|x86.Build.0 = Release|Any CPU | |||
EndGlobalSection | |||
GlobalSection(SolutionProperties) = preSolution | |||
HideSolutionNode = FALSE | |||
@@ -2107,6 +2129,7 @@ Global | |||
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD} | |||
{915F0718-B7AC-428D-ACD5-7DAACC28539F} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD} | |||
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | |||
{2D2200CF-7A66-40EA-998A-F0CE9BC2B3BB} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} | |||
EndGlobalSection | |||
GlobalSection(ExtensibilityGlobals) = postSolution | |||
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC} | |||