@@ -34,7 +34,7 @@ | |||
</ControlTemplate> | |||
<Style x:Key="IcoButtonStyle" TargetType="local:IcoButton"> | |||
<Setter Property="FontFamily" Value="../Fonts/pic/#iconfont"/> | |||
<Setter Property="FontFamily" Value="../Fonts/pic/#iconfont" /> | |||
<Setter Property="FontSize" Value="14" /> | |||
<!--<Setter Property="Background" Value="#2219b7ec" /> | |||
<Setter Property="BorderBrush" Value="#ff19b7ec" /> | |||
@@ -455,7 +455,7 @@ namespace BPASmartClient.Device | |||
vm.Add(new VariableMonitor() | |||
{ | |||
Id = vm.Count, | |||
Id = vm.Count+1, | |||
VarName = $"{item.Name}_{i + 1}", | |||
Notes = $"{notes}_{i + 1}", | |||
ModbusTcpAddress = $"{int.Parse(modadd) + i}", | |||
@@ -478,7 +478,7 @@ namespace BPASmartClient.Device | |||
{ | |||
vm.Add(new VariableMonitor() | |||
{ | |||
Id = vm.Count, | |||
Id = vm.Count+1, | |||
VarName = $"{item.Name}_{i + 1}", | |||
Notes = $"{notes}_{i + 1}", | |||
@@ -495,7 +495,7 @@ namespace BPASmartClient.Device | |||
{ | |||
vm.Add(new VariableMonitor() | |||
{ | |||
Id = vm.Count, | |||
Id = vm.Count+1, | |||
VarName = item.Name, | |||
Notes = notes, | |||
ModbusTcpAddress = modadd, | |||
@@ -0,0 +1,78 @@ | |||
using BPASmartClient.Device; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkSVer3 | |||
{ | |||
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 NMachNoInit { get; set; } | |||
/// <summary> | |||
/// 制面机面娄气缸到位信号错误 | |||
/// </summary> | |||
[Alarm("制面机面娄气缸到位信号错误")] | |||
public bool NoodleBoxError { get; set; } | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
<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" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Compile Update="View\DebugView.xaml.cs"> | |||
<SubType>Code</SubType> | |||
</Compile> | |||
<Compile Update="View\MonitorView.xaml.cs"> | |||
<SubType>Code</SubType> | |||
</Compile> | |||
<Compile Update="View\ParSetView.xaml.cs"> | |||
<SubType>Code</SubType> | |||
</Compile> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,907 @@ | |||
using static BPA.Helper.EventBus; | |||
using System.Collections.Concurrent; | |||
using BPASmartClient.CustomResource; | |||
using BPASmartClient.MorkSVer3.Enum; | |||
//using BPA.Helper; | |||
namespace BPASmartClient.MorkSVer3 | |||
{ | |||
public class Control_MorkSVer3 : BaseDevice | |||
{ | |||
public override DeviceClientType DeviceType => DeviceClientType.MORKS; | |||
private GVL_MorkSVer3 mORKS = new GVL_MorkSVer3(); | |||
private 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(); | |||
TaskManage.GetInstance.StartLong(new Action(() => | |||
{ | |||
int NoodleLoc = (int)o[0] == 0 ? rd.Next(1, 4) : (int)o[0]; | |||
int BowlLoc = (int)o[1] == 0 ? rd.Next(10, 12) : (int)o[1]; | |||
string guid = Guid.NewGuid().ToString(); | |||
var locInfo = new OrderLocInfo() { Loc = (ushort)NoodleLoc, SuborderId = guid }; | |||
mORKS.MakeNoodleTask.Enqueue(locInfo); | |||
mORKS.RBTakeNoodleTask.Enqueue(locInfo); | |||
MessageLog.GetInstance.Show($"添加模拟订单【{guid}】:面条位置【{NoodleLoc}】"); | |||
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)BowlLoc, SuborderId = guid }); | |||
MessageLog.GetInstance.Show($"添加模拟订单【{guid}】:碗位置【{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_MorkSVer3(); | |||
} | |||
public override void Stop() | |||
{ | |||
} | |||
private void ServerInit() | |||
{ | |||
//物料信息 | |||
EventBus.GetInstance().Subscribe<MaterialDeliveryEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||
{ | |||
if (@event == null) | |||
return; | |||
if (@event is MaterialDeliveryEvent material) | |||
{ | |||
orderMaterialDelivery = material.orderMaterialDelivery; | |||
} | |||
}); | |||
//配方数据信息 | |||
EventBus.GetInstance().Subscribe<RecipeBomEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||
{ | |||
if (@event == null) | |||
return; | |||
if (@event is RecipeBomEvent recipe) | |||
{ | |||
recipeBoms = recipe.recipeBoms; | |||
} | |||
}); | |||
OrderNotifyInit(); | |||
} | |||
#region 接口通知任务处理 | |||
ConcurrentQueue<OrderStatusModel> osm = new ConcurrentQueue<OrderStatusModel>(); | |||
private void OrderNotifyInit() | |||
{ | |||
TaskManage.GetInstance.StartLong(() => | |||
{ | |||
while (osm.Count > 0) | |||
{ | |||
TempOrderChange(osm.ElementAt(0).SubOrderId, osm.ElementAt(0).Status, () => | |||
{ | |||
osm.TryDequeue(out OrderStatusModel tempOSM); | |||
DeviceProcessLogShow($"订单:【{tempOSM.SubOrderId}】, 状态:【{tempOSM.Status}】, API状态修改成功。"); | |||
}); | |||
} | |||
Thread.Sleep(100); | |||
}, $"订单状态更新接口{DeviceId}", true); | |||
} | |||
private void TempOrderChange(string subid, ORDER_STATUS oRDER_STATUS, Action complete) | |||
{ | |||
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 (!string.IsNullOrEmpty(goodName) && !string.IsNullOrEmpty(SortNum)) | |||
{ | |||
EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { SortNum = SortNum, GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType }, e => { complete?.Invoke(); }); | |||
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") | |||
}); | |||
} | |||
} | |||
} | |||
#endregion | |||
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS) | |||
{ | |||
osm.Enqueue(new OrderStatusModel() { SubOrderId = subid, Status = oRDER_STATUS }); | |||
return; | |||
} | |||
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]; | |||
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.NMachInitComp = 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.NMachNoInit = !mORKS.NMachInitComp; | |||
} | |||
})); | |||
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.0", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 3) | |||
{ | |||
mORKS.CylLeftPos = bools[0]; | |||
mORKS.CylRightPos = bools[1]; | |||
mORKS.CylRotate = bools[2]; | |||
alarm.NoodleBoxError = mORKS.CylRightPos == mORKS.CylLeftPos; | |||
} | |||
})); | |||
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("M20.0", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1) | |||
{ | |||
mORKS.NMachMakeComp = bools[0]; | |||
} | |||
})); | |||
GetStatus("VW17", new Action<object>((obj) => | |||
{ | |||
if (obj is ushort[] ushorts && ushorts.Length > 0 && ushorts.Length <= 1) | |||
{ | |||
var tt = ushorts.ToBytes(true).ToUshorts(); | |||
for (byte i = 0; i < 6; i++) | |||
{ | |||
if (RTrig.GetInstance($"CookNoodleCom{i + 1}").Start(tt[0].GetBitValue((byte)(i + 1)))) | |||
{ | |||
if (!string.IsNullOrEmpty(mORKS.CookNodelId[i])) | |||
mORKS.CookNoodleCom[i] = true; | |||
} | |||
} | |||
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]; | |||
// } | |||
//})); | |||
mORKS.TakeBowlTaskCount = mORKS.TakeBowlTask.Count; | |||
mORKS.RBTakeNoodleTaskCount = mORKS.RBTakeNoodleTask.Count; | |||
for (int i = 0; i < Json<MorksPar>.Data.parSets.Count; i++) | |||
{ | |||
mORKS.nsm.ElementAt(i).IsShield = Json<MorksPar>.Data.parSets.ElementAt(i).IsShield; | |||
mORKS.nsm.ElementAt(i).NoodleCookerStatus = mORKS.NoodleCookerStatus[i]; | |||
} | |||
} | |||
/// <summary>数据解析</summary> | |||
private void DataParse() | |||
{ | |||
EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle) | |||
{ | |||
if (@event == null) | |||
return; | |||
if (@event is DoOrderEvent 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++; | |||
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 <= 3) | |||
{ | |||
var result1 = mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null; | |||
var result2 = mORKS.MakeNoodleTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null; | |||
if (result1&&result2) | |||
{ | |||
var info = new OrderLocInfo() | |||
{ | |||
GoodName = order.MorkOrder.GoodsName, | |||
Loc = ushort.Parse(res.BatchingLoc), | |||
SuborderId = order.MorkOrder.SuborderId, | |||
SortNum = order.MorkOrder.SortNum, | |||
BatchingId = res.BatchingId | |||
}; | |||
mORKS.RBTakeNoodleTask.Enqueue(info); | |||
mORKS.MakeNoodleTask.Enqueue(info); | |||
} | |||
} | |||
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, | |||
SortNum = order.MorkOrder.SortNum, | |||
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(); | |||
MakeNoodle(); | |||
TurnBoxes(); | |||
} | |||
private void BowlControl(OrderLocInfo orderLocInfo) | |||
{ | |||
if (orderLocInfo.Loc >= 10 && orderLocInfo.Loc <= 11) | |||
{ | |||
//mORKS.TakeBowlId = orderLocInfo.SuborderId; | |||
mORKS.TakeBowName = orderLocInfo.GoodName; | |||
mORKS.TakeBowSortNum = orderLocInfo.SortNum; | |||
TakeBowlControl(orderLocInfo.Loc); | |||
//OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING); | |||
OrderChange(orderLocInfo.SuborderId, ORDER_STATUS.COOKING); | |||
//DeviceProcessLogShow($"订单【{mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]"); | |||
//2023-8-5修改修改取碗打印日志。 | |||
//DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】执行取碗控制,位置:[{orderLocInfo.Loc}]"); | |||
DeviceProcessLogShow($"执行取碗控制,位置:[{orderLocInfo.Loc}]"); | |||
mORKS.TakeBowlInterlock = true; | |||
} | |||
} | |||
/// <summary>取碗控制</summary> | |||
private void TakeBowlTask() | |||
{ | |||
if (mORKS.AllowRun && mORKS.TakeBowlTask.Count > 0 && !mORKS.DropBowlMechanismStatus && !mORKS.TakeBowlInterlock) | |||
{ | |||
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); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
private void MakeNoodle() | |||
{ | |||
//TODO:可能会需要取消制作完成条件,刚开机可能没有制作完成。 | |||
if (mORKS.AllowRun && !mORKS.MakeNoodleInterlock&& mORKS.MakeNoodleTask.Count>0 && mORKS.NMachMakeComp && mORKS.NoodleBoxes[0]==null) | |||
{ | |||
if (mORKS.MakeNoodleTask.TryDequeue(out OrderLocInfo order)) | |||
{ | |||
//TODO:具体物料大小份怎么定待商议。 | |||
var loc = order.Loc; | |||
SetNMachMake(loc - 1); | |||
mORKS.CurrentMakeNoodleID = order.SuborderId; | |||
mORKS.CurrentMakeBatchingID = order.BatchingId; | |||
DeviceProcessLogShow($"订单【{order.SuborderId}】开始制面【{order.Loc}】。"); | |||
mORKS.MakeNoodleInterlock = true; | |||
} | |||
} | |||
} | |||
private void TurnBoxes() | |||
{ | |||
if (mORKS.AllowRun &&!mORKS.TakeNoodleInterlock && !mORKS.MakeNoodleInterlock && mORKS.NMachMakeComp && mORKS.NoodleBoxes[0] != null && mORKS.NoodleBoxes[1] == null) | |||
{ | |||
SwapNoodleBox(); | |||
} | |||
} | |||
/// <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 (Delay.GetInstance("到位检测延时").Start(mORKS.SiloInPlace, 2)) | |||
// { | |||
// 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) | |||
// { | |||
// 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.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.RobotTaskInterlock && mORKS.AllowTakeNoodle && !mORKS.TakeNoodleInterlock && mORKS.RBTakeNoodleTask.Count > 0) | |||
{ | |||
//查找煮面炉空闲位置 | |||
int loc = mORKS.nsm.ToList().FindIndex(p => p.NoodleCookerStatus == false && p.IsShield == false); | |||
if (loc >= 0 && loc <= 5) | |||
{ | |||
if (mORKS.RBTakeNoodleTask.TryDequeue(out OrderLocInfo orderLocInfo)) | |||
{ | |||
//写入煮面时间 | |||
List<ushort> values = new List<ushort>(); | |||
var setTime = Json<MorksPar>.Data.parSets.ElementAt(loc); | |||
values.Add(setTime.Minute); | |||
values.Add(setTime.Second); | |||
WriteData($"VW{324 + (loc * 4)}", values.ToArray()); | |||
DeviceProcessLogShow($"煮面炉[{loc + 1}]:写入煮面时间{setTime.Minute}分{setTime.Second}秒。"); | |||
mORKS.CookNodelId[loc] = orderLocInfo.SuborderId; | |||
mORKS.NoodleCookerStatus[loc] = true; | |||
SetFallNoodleLoc((ushort)(loc + 1)); | |||
//机器人开始取面 | |||
OrderChange(orderLocInfo.SuborderId, ORDER_STATUS.COOKING); | |||
DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】,请求机器人倒面至【{loc + 1}】号煮面栏"); | |||
mORKS.TakeNoodleInterlock = true; | |||
} | |||
} | |||
} | |||
} | |||
/// <summary>出餐控制</summary> | |||
private void OutNoodleTask() | |||
{ | |||
if (mORKS.AllowInvertedFace && mORKS.RobotTaskInterlock && !mORKS.RobotOutDinnigLock && !mORKS.TakeNoodleInterlock && mORKS.RobotStatus) | |||
{ | |||
for (int loc = 0; loc < mORKS.CookNodelId.Length; loc++) | |||
{ | |||
if (mORKS.CookNoodleCom[loc] && !mORKS.RobotOutDinnigLock) | |||
{ | |||
SetTakeNoodleLoc((ushort)(loc + 1)); | |||
mORKS.NoodleCookerStatus[loc] = false; | |||
WriteData($"VW260", (ushort)0);//设置出汤时间 | |||
OrderChange(mORKS.CookNodelId[loc], ORDER_STATUS.COMPLETED_COOK); | |||
DeviceProcessLogShow($"订单【{mORKS.CookNodelId[loc]}】制作完成"); | |||
mORKS.CookCompleteFlatBit = true; | |||
mORKS.OutMealId = mORKS.CookNodelId[loc]; | |||
mORKS.OutMealName = mORKS.IngredientsCompleteName; | |||
mORKS.OutMealSortNum = mORKS.IngredientsCompleteSortNum; | |||
mORKS.IngredientsCompleteId = string.Empty; | |||
mORKS.CookNodelId[loc] = string.Empty; | |||
DeviceProcessLogShow($"{loc + 1} 号位置出餐控制,订单ID:{mORKS.OutMealId}"); | |||
mORKS.CookNoodleCom[loc] = false; | |||
mORKS.RobotOutDinnigLock = true; | |||
} | |||
} | |||
} | |||
} | |||
/// <summary>信号检测</summary> | |||
private void SingleDetect() | |||
{ | |||
//允许倒面信号检测 | |||
if (RTrig.GetInstance("AllowFallNoodle").Start(mORKS.AllowInvertedFace)) | |||
{ | |||
//mORKS.IngredientsCompleteId = mORKS.TakeBowlId; | |||
mORKS.IngredientsCompleteName = mORKS.TakeBowName; | |||
mORKS.IngredientsCompleteSortNum = mORKS.TakeBowSortNum; | |||
mORKS.TakeBowSortNum = 0; | |||
mORKS.TakeBowlId = string.Empty; | |||
mORKS.TakeBowName = string.Empty; | |||
//DeviceProcessLogShow($"碗到位,允许到面,{mORKS.IngredientsCompleteId}"); | |||
DeviceProcessLogShow($"碗到位,允许倒面。"); | |||
mORKS.TakeBowlInterlock = false; | |||
mORKS.RobotOutDinnigLock = false; | |||
} | |||
//取餐完成逻辑处理 | |||
if (RTrig.GetInstance("CompleteChange1").Start(mORKS.DiningComplete) && mORKS.CookCompleteFlatBit == true) | |||
{ | |||
OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE); | |||
DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成"); | |||
WriteData("M10.1", false); | |||
var orderEvent = mORKS.doOrderEvents.FirstOrDefault(order => order.MorkOrder.SuborderId == mORKS.OutMealId); | |||
mORKS.OutMealSortNum = orderEvent?.MorkOrder.SortNum ?? 0; | |||
DeviceProcessLogShow($"出餐订单序号【{mORKS.OutMealSortNum}】"); | |||
VoiceAPI.Speak(mORKS.OutMealSortNum.ToString()); | |||
//DeviceProcessLogShow($"叫号系统通知主题【MORKS/VoiceCall/{DeviceId}】"); | |||
//Plugin.GetInstance().GetPlugin<MQTTMgr>().Publish($"MORKS/VoiceCall/{DeviceId}", mORKS.OutMealSortNum.ToString()); | |||
mORKS.CookCompleteFlatBit = false; | |||
mORKS.OutMealId = string.Empty; | |||
mORKS.OutMealName = string.Empty; | |||
mORKS.OutMealSortNum = 0; | |||
} | |||
//机器人取面完成信号检测 | |||
if (RTrig.GetInstance("TakeNoodleComplete").Start(mORKS.RobotTakeNoodleCom)) | |||
{ | |||
mORKS.TakeNoodleInterlock = false; | |||
mORKS.AllowTakeNoodle = false; | |||
mORKS.TurntableInterlock = false; | |||
DeviceProcessLogShow("检测到机器人取面完成信号"); | |||
} | |||
//制面机制面完成信号检测 | |||
if (RTrig.GetInstance("MakeNoodleCompleted").Start(mORKS.NMachMakeComp)) | |||
{ | |||
DeviceProcessLogShow($"检测到制面机制面完成信号,配方【{mORKS.CurrentMakeNoodleID}】"); | |||
mORKS.MakeNoodleInterlock = false; | |||
mORKS.NoodleBoxes[0] = new() | |||
{ | |||
SubOrderID = mORKS.CurrentMakeNoodleID, | |||
BathingID = mORKS.CurrentMakeBatchingID, | |||
IsOccupy = true | |||
}; | |||
mORKS.CurrentMakeNoodleID = string.Empty; | |||
} | |||
int OutMealRequstCount = mORKS.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 = mORKS.nsm.Where(p => p.NoodleCookerStatus == true && p.IsShield == false).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); | |||
//2023-8-5注释修改,并联出餐请求,出餐优先。 | |||
//mORKS.RobotTaskInterlock = mORKS.AllowInvertedFace && (mlCount >= 6 || mORKS.RBTakeNoodleTask.Count == 0 || mORKS.PriorityJudgment); | |||
mORKS.RobotTaskInterlock = mORKS.AllowInvertedFace && (OutMealRequstCount >= 1 || 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.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($"M15.{loc - 1}", true); | |||
} | |||
/// <summary> | |||
/// 制面机制面 | |||
/// </summary> | |||
private async void SetNMachMake(int noodleSize,int number=1) | |||
{ | |||
if (number <=0) | |||
{ | |||
throw new ArgumentException("份数不应小于1。"); | |||
} | |||
WriteData($"M20.{(5 + noodleSize)}", true); | |||
WriteData("VD800", number); | |||
Task.Delay(1000).Wait(); | |||
WriteData("M20.2", new bool[]{ true,true}); | |||
await Task.Delay(1000); | |||
WriteData($"M20.{(5 + noodleSize)}", false); | |||
WriteData("M20.2", false); | |||
} | |||
/// <summary> | |||
/// 交换制面框 | |||
/// </summary> | |||
private void SwapNoodleBox() | |||
{ | |||
bool oper = false; | |||
if (mORKS.CylLeftPos) | |||
{ | |||
oper = false; | |||
}else if (mORKS.CylRightPos) | |||
{ | |||
oper = true; | |||
} | |||
WriteData("M13.2", oper); | |||
//todo:应该校验到位信号。 | |||
//交换 | |||
Swap(mORKS.NoodleBoxes, 0, 1); | |||
} | |||
public override void SimOrder() | |||
{ | |||
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 <= 3) | |||
{ | |||
var locInfo = new OrderLocInfo() { Loc = (ushort)msm.NoodleLoc, SuborderId = guid }; | |||
mORKS.MakeNoodleTask.Enqueue(locInfo); | |||
mORKS.RBTakeNoodleTask.Enqueue(locInfo); | |||
MessageLog.GetInstance.Show($"添加模拟订单【{guid}】:面条位置【{(ushort)msm.NoodleLoc}】"); | |||
} | |||
if (msm.Bowloc >= 10 && msm.Bowloc <= 11) | |||
{ | |||
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.Bowloc, SuborderId = guid }); | |||
MessageLog.GetInstance.Show($"添加模拟订单【{guid}】:碗位置【{(ushort)msm.Bowloc}】"); | |||
} | |||
} | |||
}); | |||
} | |||
#endregion PLC 控制函数 | |||
static void Swap<T>(T[] list, int index1, int index2) | |||
{ | |||
T temp = list[index1]; | |||
list[index1] = list[index2]; | |||
list[index2] = temp; | |||
} | |||
} | |||
} |
@@ -0,0 +1,59 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
using BPA.Message; | |||
using BPASmartClient.Model; | |||
using BPA.Communication; | |||
namespace BPASmartClient.MorkSVer3 | |||
{ | |||
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(); | |||
MqttHelper mQTTProxy = new MqttHelper(); | |||
public void Init() | |||
{ | |||
mQTTProxy.Connected = new Action(() => | |||
{ | |||
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机)); | |||
TaskManage.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")}"); | |||
mQTTProxy.Connect(new BPA.Communication.Base.ConfigurationOptions() | |||
{ | |||
UserName = "UserName", | |||
Password = "Password", | |||
IpAddress = "Host", | |||
Port = 1883, | |||
ClientId = $"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.MorkSVer3 | |||
{ | |||
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,27 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkSVer3.Enum | |||
{ | |||
/// <summary> | |||
/// 面条份量。 | |||
/// </summary> | |||
internal enum NoodleSize : int | |||
{ | |||
/// <summary> | |||
/// 小份 | |||
/// </summary> | |||
Small = 0, | |||
/// <summary> | |||
/// 中份 | |||
/// </summary> | |||
Medium = 1, | |||
/// <summary> | |||
/// 大份 | |||
/// </summary> | |||
Large = 2, | |||
} | |||
} |
@@ -0,0 +1,424 @@ | |||
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.MorkSVer3 | |||
{ | |||
public class GVL_MorkSVer3 : IStatus | |||
{ | |||
#region 临时变量 | |||
/// <summary> | |||
/// 允许运行 | |||
/// </summary> | |||
[VariableMonitor("允许运行")] | |||
public bool AllowRun { get; set; } | |||
/// <summary> | |||
/// 设备连接状态 | |||
/// </summary> | |||
//[VariableMonitor("设备连接状态")] | |||
//public bool IsConnected { get; set; } | |||
/// <summary> | |||
/// 优先级判断 | |||
/// </summary> | |||
[VariableMonitor("优先级判断条件")] | |||
public bool PriorityJudgment { get; set; } | |||
/// <summary> | |||
/// 机器人任务互锁信号,false:取面,true:出餐 | |||
/// </summary> | |||
[VariableMonitor("机器人任务互锁信号")] | |||
public bool RobotTaskInterlock { get; set; } | |||
/// <summary> | |||
/// 取碗互锁信号,False:可取碗,反之为True. | |||
/// </summary> | |||
[VariableMonitor("取碗互锁信号")] | |||
public bool TakeBowlInterlock { get; set; } | |||
/// <summary> | |||
/// 取面互锁信号 | |||
/// </summary> | |||
[VariableMonitor("取面互锁信号")] | |||
public bool TakeNoodleInterlock { get; set; } | |||
/// <summary> | |||
/// 制面互锁信号,为true时即正在制面,不可再次制面。 | |||
/// </summary> | |||
[VariableMonitor("制面互锁信号")] | |||
public bool MakeNoodleInterlock { 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> | |||
/// 机器人出餐互锁 | |||
/// </summary> | |||
[VariableMonitor("机器人出餐互锁")] | |||
public bool RobotOutDinnigLock { 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>(); | |||
/// <summary> | |||
/// 订单事件队列 | |||
/// </summary> | |||
public List<DoOrderEvent> doOrderEvents { get; set; } = new List<DoOrderEvent>(); | |||
public ConcurrentDictionary<string, DoOrderEvent> doe { get; set; } = new ConcurrentDictionary<string, DoOrderEvent>(); | |||
/// <summary> | |||
/// 历史订单 | |||
/// </summary> | |||
public List<string> HistorySuborderId { get; set; } = new List<string>(); | |||
/// <summary> | |||
/// 煮面口信息队列 | |||
/// </summary> | |||
public NoodleShidModel[] nsm { get; set; } = new NoodleShidModel[6] { new NoodleShidModel(), new NoodleShidModel(), new NoodleShidModel(), new NoodleShidModel(), new NoodleShidModel(), new NoodleShidModel() }; | |||
/// <summary> | |||
/// 制面机放面框信息,固定在NoodleBoxes[1]取面,气缸动作时,需要交换数据。 | |||
/// </summary> | |||
public NoodleBox[] NoodleBoxes { get; set; } = new NoodleBox[2] { new(), new() }; | |||
/// <summary> | |||
/// 制面队列 | |||
/// </summary> | |||
public ConcurrentQueue<OrderLocInfo> MakeNoodleTask { get; set; } = new ConcurrentQueue<OrderLocInfo>(); | |||
#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> | |||
/// 当前制面ID | |||
/// </summary> | |||
public string CurrentMakeNoodleID { get; set; } = string.Empty; | |||
/// <summary> | |||
/// 当前制面物料ID | |||
/// </summary> | |||
public int CurrentMakeBatchingID { get; set; } | |||
/// <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 | |||
#region 制面机 | |||
/// <summary> | |||
/// 取面任务数量 | |||
/// </summary> | |||
[VariableMonitor("制面机初始化完成","M0.7")] | |||
public bool NMachInitComp { get; set; } | |||
/// <summary> | |||
/// 制面机气缸左侧到位 | |||
/// </summary> | |||
[VariableMonitor("制面机气缸左侧到位", "M13.0")] | |||
public bool CylLeftPos { get; set; } | |||
/// <summary> | |||
/// 制面机气缸右侧到位 | |||
/// </summary> | |||
[VariableMonitor("制面机气缸右侧到位", "M13.1")] | |||
public bool CylRightPos { get; set; } | |||
/// <summary> | |||
/// 制面机气缸动作 | |||
/// </summary> | |||
[VariableMonitor("制面机气缸动作", "M13.2")] | |||
public bool CylRotate { get; set; } | |||
/// <summary> | |||
/// 制面机制面完成 | |||
/// </summary> | |||
[VariableMonitor("制面机制面完成", "M20.0")] | |||
public bool NMachMakeComp { get; set; } | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,23 @@ | |||
global using System; | |||
global using System.Collections.Generic; | |||
global using BPA.Message.Enum; | |||
global using BPASmartClient.Device; | |||
global using BPASmartClient.Model; | |||
global using BPASmartClient.Peripheral; | |||
global using BPA.Helper; | |||
global using System.Threading; | |||
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.MorkSVer3.Model; | |||
global using System.Collections.ObjectModel; | |||
global using BPASmartClient.MorkSVer3.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.MorkSVer3.Model | |||
{ | |||
public class Global | |||
{ | |||
public static bool EnableLocalSimOrder { get; set; } | |||
} | |||
} |
@@ -0,0 +1,29 @@ | |||
using BPASmartClient.MorkSVer3.Enum; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkSVer3.Model | |||
{ | |||
/// <summary> | |||
/// 制面信息 | |||
/// </summary> | |||
internal class MakeNoodleInfo | |||
{ | |||
/// <summary> | |||
/// 对应的订单ID | |||
/// </summary> | |||
public string SubOrderID { get; set; } | |||
/// <summary> | |||
/// 面条份量 | |||
/// </summary> | |||
public NoodleSize NoodleSize { get; set; } | |||
/// <summary> | |||
/// 面条数量 | |||
/// </summary> | |||
public int NoodleNumber { get; set; } | |||
} | |||
} |
@@ -0,0 +1,17 @@ | |||
using BPASmartClient.Model; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPA.Helper; | |||
namespace BPASmartClient.MorkSVer3.Model | |||
{ | |||
internal class MorksPar | |||
{ | |||
public ObservableCollection<ParSet> parSets { get; set; } = new ObservableCollection<ParSet>(); | |||
//public ObservableCollection<ParSet> DishLibraryParSets { get; set; } = new ObservableCollection<ParSet>(); | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkSVer3.Model | |||
{ | |||
public class NoodleBox | |||
{ | |||
public string SubOrderID { get; set; } | |||
/// <summary> | |||
/// 物料ID | |||
/// </summary> | |||
public int BathingID { get; set; } | |||
/// <summary> | |||
/// 是否占用 | |||
/// </summary> | |||
public bool IsOccupy { get; set; } | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkSVer3.Model | |||
{ | |||
internal class OrderStatusModel | |||
{ | |||
public string SubOrderId { get; set; } | |||
public ORDER_STATUS Status { get; set; } | |||
} | |||
} |
@@ -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.MorkSVer3.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.MorkSVer3 | |||
{ | |||
public class NoodleShidModel | |||
{ | |||
/// <summary> | |||
/// 是否被屏蔽,true:屏蔽,false:未屏蔽 | |||
/// </summary> | |||
public bool IsShield { get; set; } | |||
/// <summary> | |||
/// 是否忙碌,true:忙碌,FALSE:空闲 | |||
/// </summary> | |||
public bool NoodleCookerStatus { get; set; } | |||
} | |||
} |
@@ -0,0 +1,119 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.MorkSVer3.View.DebugView" | |||
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.MorkSVer3.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.MorkSVer3.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 Orientation="Vertical"> | |||
<StackPanel Margin="10,0,0,20" Orientation="Horizontal"> | |||
<TextBlock | |||
FontSize="18" | |||
Foreground="{StaticResource TitleBorderColor}" | |||
Text="面条份量:" /> | |||
<TextBox Style="{StaticResource TextboxStyle}" Text="{Binding NoodleLoc}" /> | |||
<CheckBox | |||
VerticalContentAlignment="Center" | |||
Background="White" | |||
Content="随机面条份量" | |||
IsChecked="{Binding IsNoodPositon}" | |||
Style="{StaticResource CheckBox}" /> | |||
<TextBlock | |||
FontSize="18" | |||
Foreground="{StaticResource TitleBorderColor}" | |||
Text="(1:小份,2:中份,3:大份)" /> | |||
</StackPanel> | |||
<StackPanel Margin="10,0,0,20" Orientation="Horizontal"> | |||
<TextBlock | |||
FontSize="18" | |||
Foreground="{StaticResource TitleBorderColor}" | |||
Text="面碗位置:" /> | |||
<TextBox Style="{StaticResource TextboxStyle}" Text="{Binding BowlLoc}" /> | |||
<CheckBox | |||
VerticalContentAlignment="Center" | |||
Background="White" | |||
Content="随机面碗位置" | |||
IsChecked="{Binding IsBowPositon}" | |||
Style="{StaticResource CheckBox}" /> | |||
<CheckBox | |||
VerticalContentAlignment="Center" | |||
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.MorkSVer3.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.MorkSVer3.View | |||
{ | |||
/// <summary> | |||
/// Debug.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class DebugView : System.Windows.Controls.UserControl | |||
{ | |||
public DebugView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,242 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.MorkSVer3.View.MonitorView" | |||
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.MorkSVer3.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.MorkSVer3.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.MorkSVer3.View | |||
{ | |||
/// <summary> | |||
/// Monitor.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class MonitorView : System.Windows.Controls.UserControl | |||
{ | |||
public MonitorView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,251 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.MorkSVer3.View.ParSetView" | |||
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.MorkSVer3.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.MorkSVer3.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="请点击按钮保存参数:" /> | |||
<Button | |||
Grid.Column="5" | |||
Width="140" | |||
HorizontalAlignment="Left" | |||
Command="{Binding SaveInfoCommand}" | |||
Content="保存配置" | |||
FontSize="16" | |||
Style="{StaticResource ButtonStyle}"> | |||
</Button> | |||
</StackPanel> | |||
<!-- 参数放置面板 --> | |||
<Grid Grid.Row="2"> | |||
<StackPanel Orientation="Horizontal"> | |||
<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> | |||
<!--#region 根据库位写入煮面时间,-已废弃 --> | |||
<!--<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid | |||
Grid.Row="0" | |||
Margin="100,10,0,0" | |||
Background="#ff0C255F"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
FontSize="24" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="库位序号" /> | |||
<TextBlock | |||
Grid.Column="1" | |||
FontSize="24" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="煮时间(分)" /> | |||
<TextBlock | |||
Grid.Column="2" | |||
FontSize="24" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="煮时间(秒)" /> | |||
<Border | |||
Grid.Column="0" | |||
Grid.ColumnSpan="4" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,1,1,1" /> | |||
<Border | |||
Grid.Column="1" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" /> | |||
<Border | |||
Grid.Column="3" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<Grid Grid.Row="1" Margin="100,0,0,0"> | |||
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl Foreground="DeepSkyBlue" ItemsSource="{Binding DishLibraryParSets}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Name="gr"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="157"/> | |||
<ColumnDefinition Width="1*"/> | |||
<ColumnDefinition Width="1*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="18" | |||
Text="{Binding TextBlockContext}" /> | |||
--> | |||
<!--<ComboBox | |||
Grid.Column="1" | |||
Height="auto" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
FontSize="18" | |||
Foreground="DeepSkyBlue" | |||
IsEditable="False" | |||
ItemsSource="{Binding DataContext.DishTypeName, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
SelectedIndex="{Binding LocDishType}" />--> | |||
<!-- | |||
<Border | |||
Grid.Column="0" | |||
Grid.ColumnSpan="3" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,1"></Border> | |||
<Border | |||
Grid.Column="1" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0"> | |||
<TextBox | |||
Grid.Column="1" | |||
FontSize="18" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding Minute}" /> | |||
</Border> | |||
<Border | |||
Grid.Column="2" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0"> | |||
<TextBox | |||
Grid.Column="2" | |||
FontSize="18" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding Second}" /> | |||
</Border> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
</Grid>--> | |||
<!--#endregion--> | |||
</StackPanel> | |||
</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.MorkSVer3.View | |||
{ | |||
/// <summary> | |||
/// ParSet.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class ParSetView : System.Windows.Controls.UserControl | |||
{ | |||
public ParSetView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,97 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPA.Helper; | |||
using BPASmartClient.Model; | |||
using BPA.Helper; | |||
using BPASmartClient.MorkSVer3.Model; | |||
using System.Windows; | |||
namespace BPASmartClient.MorkSVer3.ViewModel | |||
{ | |||
public class DebugViewModel : NotifyBase | |||
{ | |||
public DebugViewModel() | |||
{ | |||
InitCommand = new BPARelayCommand(() => { | |||
ActionManage.GetInstance.Send("InitDevice"); | |||
//ActionManage.GetInstance.Send("初始化设定煮面时间"); | |||
}); | |||
SimOrderCommand = new BPARelayCommand(() => | |||
{ | |||
new MorksSimorderModel() { Bowloc = this.BowlLoc, NoodleLoc = this.NoodleLoc }.Publish(); | |||
}); | |||
SimOrderRandomCommand = new BPARelayCommand(() => | |||
{ | |||
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 BPARelayCommand(() => | |||
{ | |||
TaskManage.GetInstance.StopTask("ForOrder"); | |||
MessageLog.GetInstance.Show("停止模拟随机订单"); | |||
}); | |||
EnableLacalSimOrder = new BPARelayCommand(() => | |||
{ | |||
Global.EnableLocalSimOrder = LocalSimOrder; | |||
VisibilitySimOrder = LocalSimOrder == true ? Visibility.Visible : Visibility.Collapsed; | |||
}); | |||
VisibilitySimOrder = LocalSimOrder == true? Visibility.Visible : Visibility.Collapsed; | |||
} | |||
public BPARelayCommand InitCommand { get; set; } | |||
public BPARelayCommand SimOrderCommand { get; set; } | |||
public BPARelayCommand SimOrderRandomCommand { get; set; } | |||
public BPARelayCommand SimOrderRandomCloseCommand { get; set; } | |||
public BPARelayCommand EnableLacalSimOrder { get; set; } | |||
public int NoodleLoc { get { return _mNoodleLoc; } | |||
set { | |||
if (value <=3 && value >=1) | |||
{ | |||
_mNoodleLoc = value; | |||
} | |||
else | |||
{ _mNoodleLoc = 1; } | |||
OnPropertyChanged(); } } | |||
private int _mNoodleLoc = 1; | |||
public int BowlLoc { get { return _mBowlLoc; } set { | |||
if (value == 10 ||value ==11) | |||
{ | |||
_mBowlLoc = value; | |||
} | |||
else | |||
{ | |||
_mBowlLoc = 11; | |||
} | |||
OnPropertyChanged(); } } | |||
private int _mBowlLoc = 11; | |||
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 BPA.Helper; | |||
using System.Collections.ObjectModel; | |||
namespace BPASmartClient.MorkSVer3.ViewModel | |||
{ | |||
public class MonitorViewModel : NotifyBase | |||
{ | |||
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,58 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPA.Helper; | |||
using BPASmartClient.Model; | |||
using BPASmartClient.MorkSVer3.Model; | |||
using BPA.Helper; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
namespace BPASmartClient.MorkSVer3.ViewModel | |||
{ | |||
public class ParSetViewModel : NotifyBase | |||
{ | |||
public ParSetViewModel() | |||
{ | |||
SaveInfoCommand = new BPARelayCommand(SaveSettingData); | |||
//ActionManage.GetInstance.Register(SaveSettingData, "初始化设定煮面时间"); | |||
} | |||
public BPARelayCommand SaveInfoCommand { get; set; } | |||
public ObservableCollection<ParSet> parSets { get; set; } = Json<MorksPar>.Data.parSets; | |||
//public ObservableCollection<ParSet> DishLibraryParSets { get; set; } = Json<MorksPar>.Data.DishLibraryParSets; | |||
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() }); | |||
var result = MessageNotify.GetInstance.ShowDialog("是否保存煮面口设置信息?"); | |||
if (result) | |||
{ | |||
Json<MorksPar>.Save(); | |||
} | |||
} | |||
} | |||
} |
@@ -36,6 +36,7 @@ | |||
<ProjectReference Include="..\BPASmartClient.MorkMW\BPASmartClient.MorkMW.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MorkM\BPASmartClient.MorkM.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MorkSUpgradedVer\BPASmartClient.MorkSUpgradedVer.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MorkSWithNoodleMachine\BPASmartClient.MorkSVer3.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" /> | |||
@@ -168,7 +168,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test", "Test\Test.csproj", | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "阿里云IOT平台测试", "阿里云IOT平台测试\阿里云IOT平台测试.csproj", "{774286FD-0C88-4592-972C-101239F75954}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.AliyunIot", "BPASmartClient.AliyunIot\BPASmartClient.AliyunIot.csproj", "{75CD8585-6D44-4291-9524-0B6CE22D3C74}" | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.AliyunIot", "BPASmartClient.AliyunIot\BPASmartClient.AliyunIot.csproj", "{75CD8585-6D44-4291-9524-0B6CE22D3C74}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkSVer3", "BPASmartClient.MorkSWithNoodleMachine\BPASmartClient.MorkSVer3.csproj", "{B042F069-B71A-40AA-81F3-BA8AFF7F075F}" | |||
EndProject | |||
Global | |||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
@@ -1604,6 +1606,26 @@ Global | |||
{75CD8585-6D44-4291-9524-0B6CE22D3C74}.Release|x64.Build.0 = Release|Any CPU | |||
{75CD8585-6D44-4291-9524-0B6CE22D3C74}.Release|x86.ActiveCfg = Release|Any CPU | |||
{75CD8585-6D44-4291-9524-0B6CE22D3C74}.Release|x86.Build.0 = Release|Any CPU | |||
{B042F069-B71A-40AA-81F3-BA8AFF7F075F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{B042F069-B71A-40AA-81F3-BA8AFF7F075F}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{B042F069-B71A-40AA-81F3-BA8AFF7F075F}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{B042F069-B71A-40AA-81F3-BA8AFF7F075F}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{B042F069-B71A-40AA-81F3-BA8AFF7F075F}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{B042F069-B71A-40AA-81F3-BA8AFF7F075F}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{B042F069-B71A-40AA-81F3-BA8AFF7F075F}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{B042F069-B71A-40AA-81F3-BA8AFF7F075F}.Debug|x64.Build.0 = Debug|Any CPU | |||
{B042F069-B71A-40AA-81F3-BA8AFF7F075F}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{B042F069-B71A-40AA-81F3-BA8AFF7F075F}.Debug|x86.Build.0 = Debug|Any CPU | |||
{B042F069-B71A-40AA-81F3-BA8AFF7F075F}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{B042F069-B71A-40AA-81F3-BA8AFF7F075F}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{B042F069-B71A-40AA-81F3-BA8AFF7F075F}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{B042F069-B71A-40AA-81F3-BA8AFF7F075F}.Release|ARM.Build.0 = Release|Any CPU | |||
{B042F069-B71A-40AA-81F3-BA8AFF7F075F}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{B042F069-B71A-40AA-81F3-BA8AFF7F075F}.Release|ARM64.Build.0 = Release|Any CPU | |||
{B042F069-B71A-40AA-81F3-BA8AFF7F075F}.Release|x64.ActiveCfg = Release|Any CPU | |||
{B042F069-B71A-40AA-81F3-BA8AFF7F075F}.Release|x64.Build.0 = Release|Any CPU | |||
{B042F069-B71A-40AA-81F3-BA8AFF7F075F}.Release|x86.ActiveCfg = Release|Any CPU | |||
{B042F069-B71A-40AA-81F3-BA8AFF7F075F}.Release|x86.Build.0 = Release|Any CPU | |||
EndGlobalSection | |||
GlobalSection(SolutionProperties) = preSolution | |||
HideSolutionNode = FALSE | |||
@@ -1682,6 +1704,7 @@ Global | |||
{918B73A6-B6FF-46FE-8C96-8474A5BD648B} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} | |||
{36E8EDC4-DD22-4968-B43A-984A5DDE5D78} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | |||
{75CD8585-6D44-4291-9524-0B6CE22D3C74} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625} | |||
{B042F069-B71A-40AA-81F3-BA8AFF7F075F} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} | |||
EndGlobalSection | |||
GlobalSection(ExtensibilityGlobals) = postSolution | |||
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC} | |||