pengliangyang 1 vuosi sitten
vanhempi
commit
cd18533921
38 muutettua tiedostoa jossa 3130 lisäystä ja 176 poistoa
  1. +35
    -2
      BPASmartClient.Device/VariableMonitorAttribute.cs
  2. +11
    -11
      BPASmartClient.MORKSM.BK.PLC/PLCMachine.cs
  3. +24
    -0
      BPASmartClient.Model/OrderLocInfo.cs
  4. +74
    -0
      BPASmartClient.MorkMV1/Alarm.cs
  5. +30
    -0
      BPASmartClient.MorkMV1/BPASmartClient.MorkMV1.csproj
  6. +896
    -0
      BPASmartClient.MorkMV1/Control_MorkMV1.cs
  7. +51
    -0
      BPASmartClient.MorkMV1/DataServer.cs
  8. +193
    -0
      BPASmartClient.MorkMV1/DeviceData.cs
  9. +368
    -0
      BPASmartClient.MorkMV1/GVL_MorkMV1.cs
  10. +26
    -0
      BPASmartClient.MorkMV1/GlobalUsing.cs
  11. +14
    -0
      BPASmartClient.MorkMV1/Model/DishType.cs
  12. +13
    -0
      BPASmartClient.MorkMV1/Model/Global.cs
  13. +20
    -0
      BPASmartClient.MorkMV1/Model/MOrderLocInfo.cs
  14. +17
    -0
      BPASmartClient.MorkMV1/Model/MorksPar.cs
  15. +34
    -0
      BPASmartClient.MorkMV1/Model/ParSet.cs
  16. +44
    -0
      BPASmartClient.MorkMV1/Model/SuborderInfo.cs
  17. +14
    -0
      BPASmartClient.MorkMV1/Model/WritePar.cs
  18. +21
    -0
      BPASmartClient.MorkMV1/NoodleShidModel.cs
  19. +24
    -0
      BPASmartClient.MorkMV1/OrderLocInfo.cs
  20. +109
    -0
      BPASmartClient.MorkMV1/Resource/MyStyle.xaml
  21. +117
    -0
      BPASmartClient.MorkMV1/View/Debug.xaml
  22. +30
    -0
      BPASmartClient.MorkMV1/View/Debug.xaml.cs
  23. +242
    -0
      BPASmartClient.MorkMV1/View/Monitor.xaml
  24. +28
    -0
      BPASmartClient.MorkMV1/View/Monitor.xaml.cs
  25. +312
    -0
      BPASmartClient.MorkMV1/View/ParSet.xaml
  26. +28
    -0
      BPASmartClient.MorkMV1/View/ParSet.xaml.cs
  27. +79
    -0
      BPASmartClient.MorkMV1/ViewModel/DebugViewModel.cs
  28. +25
    -0
      BPASmartClient.MorkMV1/ViewModel/MonitorViewModel.cs
  29. +66
    -0
      BPASmartClient.MorkMV1/ViewModel/ParSetViewModel.cs
  30. +36
    -36
      BPASmartClient.MorkMW/Control_MorkMW.cs
  31. +41
    -41
      BPASmartClient.MorkS/Control_Morks.cs
  32. +20
    -20
      BPASmartClient.MorkS/OrderLocInfo.cs
  33. +41
    -43
      BPASmartClient.MorkSUpgradedVer/Control_MorkSUpgradedVer.cs
  34. +20
    -20
      BPASmartClient.MorkSUpgradedVer/OrderLocInfo.cs
  35. +1
    -1
      BPASmartClient.Peripheral/BasePeripheral.cs
  36. +1
    -1
      BPASmartClient.Peripheral/IPeripheral.cs
  37. +1
    -0
      BPASmartClient/BPASmartClient.csproj
  38. +24
    -1
      SmartClient.sln

+ 35
- 2
BPASmartClient.Device/VariableMonitorAttribute.cs Näytä tiedosto

@@ -1,4 +1,5 @@
using System;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -17,10 +18,42 @@ namespace BPASmartClient.Device
public VariableMonitorAttribute(string Notes, string PLCAddress = "", string ModbusTcpAddress = "")
{
this.PLCAddress = PLCAddress;
this.ModbusTcpAddress = ModbusTcpAddress;
this.ModbusTcpAddress = GetModbusTcpAdd(PLCAddress);// ModbusTcpAddress;
this.Notes = Notes;
}

private string GetModbusTcpAdd(string address)
{
if (address == null) return "";
if (address.Length > 0)
{
address = address.Trim();
if (address.ToUpper().Contains("M") && address.Length >= 4)
{
var res = address.Substring(1).Split('.');
if (res != null && res.Length == 2)
{
if (int.TryParse(res[0], out int firstAddress) && int.TryParse(res[1], out int ExitAddress))
{
if (ExitAddress >= 0 && ExitAddress <= 7)
{
return ((firstAddress * 8) + 320 + ExitAddress).ToString();
}
}
}
}
else if ((address.ToUpper().Contains("VW") || address.ToUpper().Contains("VD")) && address.Length >= 3)
{
var res = address.Substring(2);
if (res != null && int.TryParse(res, out int tempAddress))
{
return ((tempAddress / 2) + 100).ToString();
}
}
}
return "";
}

/// <summary>
/// PLC 地址
/// </summary>


+ 11
- 11
BPASmartClient.MORKSM.BK.PLC/PLCMachine.cs Näytä tiedosto

@@ -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()
{


+ 24
- 0
BPASmartClient.Model/OrderLocInfo.cs Näytä tiedosto

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

}
}

+ 74
- 0
BPASmartClient.MorkMV1/Alarm.cs Näytä tiedosto

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


}
}

+ 30
- 0
BPASmartClient.MorkMV1/BPASmartClient.MorkMV1.csproj Näytä tiedosto

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

+ 896
- 0
BPASmartClient.MorkMV1/Control_MorkMV1.cs Näytä tiedosto

@@ -0,0 +1,896 @@
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 Microsoft.EntityFrameworkCore.Metadata.Internal;
//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 MOrderLocInfo() { Loc = (ushort)NoodleLoc, SuborderId = guid });
MessageLog.GetInstance.Show($"添加订单:面条位置【{NoodleLoc}】");

mORKM.TakeBowlTask.Enqueue(new MOrderLocInfo() { 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 (!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")
});
}
}
}

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.6", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 2)
{
mORKM.RobotInvertedSurfaceCom = bools[0];
mORKM.RobotTakeNoodleCom = bools[1];
}
}));

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;
}
}
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);
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);
List<MOrderLocInfo> oli = new List<MOrderLocInfo>();
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)
{
var x = Json<MorksPar>.Data.DishLibraryParSets.FirstOrDefault(p => p.TextBlockContext == loc.ToString());
if (x != null)
{
oli.Add(new MOrderLocInfo()
{
GoodName = order.MorkOrder.GoodsName,
Loc = ushort.Parse(res.BatchingLoc),
SuborderId = order.MorkOrder.SuborderId,
SortNum = order.MorkOrder.SortNum,
BatchingId = res.BatchingId,
Minute = x.Minute,
Second = x.Second,
LocDishType = x.LocDishType
});
}
}
}
}
}

for (int i = 0; i <= 1; i++)
{
oli.Where(p => p.LocDishType == i).ToList()?.ForEach(y =>
{
mORKM.RBTakeNoodleTask.Enqueue(new MOrderLocInfo()
{
GoodName = y.GoodName,
Loc = y.Loc,
SuborderId = y.SuborderId,
SortNum = y.SortNum,
BatchingId = y.BatchingId,
LocDishType = y.LocDishType,
Minute = y.Minute,
RecipeId = y.RecipeId,
RecipeNumber = y.RecipeNumber,
Recipes = y.Recipes,
Second = y.Second
});
});
}

if (mORKM.TakeBowlTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
mORKM.TakeBowlTask.Enqueue(new OrderLocInfo()
{
GoodName = order.MorkOrder.GoodsName,
Loc = 11,
SuborderId = order.MorkOrder.SuborderId,
SortNum = order.MorkOrder.SortNum,
});

if (!mORKM.SuborderCount.ContainsKey(order.MorkOrder.SuborderId))
{
mORKM.SuborderCount.TryAdd(order.MorkOrder.SuborderId, new SuborderInfo()
{
ActualCount = oli.Count,
AcMeatDishesCount = oli.Where(p => p.LocDishType == 0).ToList().Count,
AcVegetableCount = oli.Where(p => p.LocDishType == 1).ToList().Count,
});
}

}
});
}

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 = mORKM.nsm.ToList().FindIndex(p => p.NoodleCookerStatus == false && p.IsShield == false);//查找煮面炉空闲位置
if (loc >= 0 && loc <= 5)
{
if (mORKM.RBTakeNoodleTask.TryDequeue(out MOrderLocInfo orderLocInfo))
{
//写入煮面时间
List<ushort> values = new List<ushort>();
values.Add(orderLocInfo.Minute);
values.Add(orderLocInfo.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}】号煮面栏");

if (mORKM.SuborderCount.ContainsKey(orderLocInfo.SuborderId))
{
if (orderLocInfo.LocDishType == 0)
mORKM.SuborderCount[orderLocInfo.SuborderId].MeatDishesLoc.Add(loc + 1);
else if (orderLocInfo.LocDishType == 1)
mORKM.SuborderCount[orderLocInfo.SuborderId].VegetableLoc.Add(loc + 1);
}

mORKM.TakeNoodleInterlock = true;
}
}
}
}
}

/// <summary>
/// 出餐控制
/// </summary>
private void OutNoodleTask()
{
if (mORKM.AllowInvertedFace && !mORKM.RobotOutDinnigLock && mORKM.RobotTaskInterlock && !mORKM.TakeNoodleInterlock && mORKM.RobotStatus)
{
for (int i = 0; i < mORKM.CookNodelId.Length; i++)
{
if (mORKM.CookNodelId[i] == mORKM.IngredientsCompleteId && !string.IsNullOrEmpty(mORKM.CookNodelId[i]))
{
if (mORKM.CookNoodleCom[i] && mORKM.SuborderCount.ContainsKey(mORKM.CookNodelId[i]))
{
var x = mORKM.SuborderCount[mORKM.CookNodelId[i]];

//执行取素菜操作
if (x.AcVegetableCount != x.CuVegetableCount)
{
int index = x.VegetableLoc.FindIndex(p => p == i + 1);
if (index >= 0)
{
SetTakeNoodleLoc((ushort)(x.VegetableLoc.ElementAt(index)));
mORKM.NoodleCookerStatus[i] = false;
WriteData($"VW260", (ushort)0);//设置出汤时间
DeviceProcessLogShow($"{x.VegetableLoc.ElementAt(index)} 号位置-[素菜]-出餐控制,订单ID:{mORKM.CookNodelId[i]}");
mORKM.CookNodelId[i] = string.Empty;
mORKM.CookNoodleCom[i] = false;
x.VegetableLoc.RemoveAt(index);
x.CuVegetableCount++;
mORKM.RobotOutDinnigLock = true;
}
}

//执行取荤菜
if (x.AcVegetableCount == x.CuVegetableCount && x.AcMeatDishesCount != x.CuMeatDishesCount)
{
int index = x.MeatDishesLoc.FindIndex(p => p == i + 1);
if (index >= 0)
{
SetTakeNoodleLoc((ushort)(x.MeatDishesLoc.ElementAt(index)));
mORKM.NoodleCookerStatus[i] = false;
WriteData($"VW260", (ushort)0);//设置出汤时间
DeviceProcessLogShow($"{x.MeatDishesLoc.ElementAt(index)} 号位置-[荤菜]-出餐控制,订单ID:{mORKM.CookNodelId[i]}");
mORKM.CookNodelId[i] = string.Empty;
mORKM.CookNoodleCom[i] = false;
x.MeatDishesLoc.RemoveAt(index);
x.CuMeatDishesCount++;
mORKM.RobotOutDinnigLock = true;
}
}
}
}
}
}
}

/// <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());
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("机器人取面完成信号检测");
}

if (RTrig.GetInstance("RobotInvertedSurfaceCom").Start(mORKM.RobotInvertedSurfaceCom))
{
if (mORKM.SuborderCount.ContainsKey(mORKM.IngredientsCompleteId))
{
var x = mORKM.SuborderCount[mORKM.IngredientsCompleteId];
if (x.CuMeatDishesCount + x.CuVegetableCount == x.ActualCount)
{
OrderChange(mORKM.IngredientsCompleteId, ORDER_STATUS.COMPLETED_COOK);
DeviceProcessLogShow($"订单【{mORKM.IngredientsCompleteId}】制作完成");
mORKM.SuborderCount.Remove(mORKM.IngredientsCompleteId, out _);
mORKM.CookCompleteFlatBit = true;
mORKM.OutMealId = mORKM.IngredientsCompleteId;
mORKM.OutMealName = mORKM.IngredientsCompleteName;
mORKM.OutMealSortNum = mORKM.IngredientsCompleteSortNum;
mORKM.IngredientsCompleteId = string.Empty;
CookComplete();
DeviceProcessLogShow($"倒面完成");

}
}
mORKM.RobotOutDinnigLock = false;
}

int OutMealRequstCount = mORKM.CookNoodleCom.Where(p => p == true).ToList().Count;
int mlCount = mORKM.nsm.Where(p => p.NoodleCookerStatus == true && p.IsShield == false).ToList().Count;

bool isok = false;
for (int i = 0; i < mORKM.CookNodelId.Length; i++)
{
if (mORKM.CookNodelId[i] == mORKM.IngredientsCompleteId && mORKM.CookNoodleCom[i])
{
isok = true;
break;
}
}
mORKM.PriorityJudgment = Delay.GetInstance("取餐优先级判断").Start(mORKM.TurntableLocLists.Count > 0 && !mORKM.TurntableLowPosition, 4);
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);
}

/// <summary>
/// 上位机单订单执行完成
/// </summary>
private void CookComplete()
{
WriteData("M11.0", 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 MOrderLocInfo() { 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


}
}

+ 51
- 0
BPASmartClient.MorkMV1/DataServer.cs Näytä tiedosto

@@ -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个煮面炉上或下)
//温度状态(煮面炉温度是否到达)
//料仓位置(当前料仓在几号位置)
//料仓上下物料检测
//落碗机构缺碗检测
//机器人状态
//当日订单总量
//报警信息
}
}

+ 193
- 0
BPASmartClient.MorkMV1/DeviceData.cs Näytä tiedosto

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

}
}

+ 368
- 0
BPASmartClient.MorkMV1/GVL_MorkMV1.cs Näytä tiedosto

@@ -0,0 +1,368 @@
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 RobotOutDinnigLock { 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<MOrderLocInfo> RBTakeNoodleTask { get; set; } = new ConcurrentQueue<MOrderLocInfo>();

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


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

/// <summary>
/// 子订单对应的物料数量
/// </summary>
public ConcurrentDictionary<string, SuborderInfo> SuborderCount { get; set; } = new ConcurrentDictionary<string, SuborderInfo>();

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.6")]
public bool RobotInvertedSurfaceCom { get; set; }

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

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

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

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

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

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

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

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

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

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

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

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

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

+ 26
- 0
BPASmartClient.MorkMV1/GlobalUsing.cs Näytä tiedosto

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



+ 14
- 0
BPASmartClient.MorkMV1/Model/DishType.cs Näytä tiedosto

@@ -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 enum DishType : int
{
荤菜 = 0,
素菜 = 1
}
}

+ 13
- 0
BPASmartClient.MorkMV1/Model/Global.cs Näytä tiedosto

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

+ 20
- 0
BPASmartClient.MorkMV1/Model/MOrderLocInfo.cs Näytä tiedosto

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

namespace BPASmartClient.MorkMV1.Model
{
public class MOrderLocInfo : OrderLocInfo
{
public ushort Minute { get; set; }

public ushort Second { get; set; }

/// <summary>
/// 库位菜品类型,0,荤菜,1素菜
/// </summary>
public int LocDishType { get; set; }
}
}

+ 17
- 0
BPASmartClient.MorkMV1/Model/MorksPar.cs Näytä tiedosto

@@ -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 Microsoft.Toolkit.Mvvm.ComponentModel;

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

+ 34
- 0
BPASmartClient.MorkMV1/Model/ParSet.cs Näytä tiedosto

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

namespace BPASmartClient.MorkMV1.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;

/// <summary>
/// 库位菜品类型
/// </summary>
public int LocDishType { get { return _mLocDishType; } set { _mLocDishType = value; } }
private int _mLocDishType;

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

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

}
}

+ 44
- 0
BPASmartClient.MorkMV1/Model/SuborderInfo.cs Näytä tiedosto

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

namespace BPASmartClient.MorkMV1.Model
{
public class SuborderInfo
{
/// <summary>
/// 实际荤素物料总数
/// </summary>
public int ActualCount { get; set; }

/// <summary>
/// 当前荤菜总数
/// </summary>
public int CuMeatDishesCount { get; set; }
/// <summary>
/// 实际荤菜出餐数量
/// </summary>
public int AcMeatDishesCount { get; set; }

/// <summary>
/// 荤菜位置集合信息
/// </summary>
public List<int> MeatDishesLoc { get; set; } = new List<int>();

/// <summary>
/// 当前素菜总数
/// </summary>
public int CuVegetableCount { get; set; }
/// <summary>
/// 实际素菜出餐数量
/// </summary>
public int AcVegetableCount { get; set; }
/// <summary>
/// 素菜位置集合信息
/// </summary>
public List<int> VegetableLoc { get; set; } = new List<int>();

}
}

+ 14
- 0
BPASmartClient.MorkMV1/Model/WritePar.cs Näytä tiedosto

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

+ 21
- 0
BPASmartClient.MorkMV1/NoodleShidModel.cs Näytä tiedosto

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

+ 24
- 0
BPASmartClient.MorkMV1/OrderLocInfo.cs Näytä tiedosto

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

// }
//}

+ 109
- 0
BPASmartClient.MorkMV1/Resource/MyStyle.xaml Näytä tiedosto

@@ -0,0 +1,109 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" />
<!--<SolidColorBrush x:Key="bordColor" Color="#33ffffff" />-->
<SolidColorBrush x:Key="bordColor" Color="#552AB2E7" />


<Style x:Key="RowRadioButtonStyle" TargetType="{x:Type RadioButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Border
x:Name="NvaBor"
Background="Transparent"
BorderBrush="#FF2AB2E7"
BorderThickness="0">
<ContentControl
Margin="10,4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="{TemplateBinding Content}"
FontSize="16" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
<Setter TargetName="NvaBor" Property="BorderThickness" Value="0" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="false" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
</MultiTrigger.Setters>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="InputTextboxStyle" TargetType="TextBox">
<Setter Property="Margin" Value="5,0,0,0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Width" Value="150" />
<Setter Property="Height" Value="40" />
<Setter Property="CaretBrush" Value="{StaticResource TitleBorderColor}" />
<Setter Property="Foreground" Value="{StaticResource TitleBorderColor}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<Style x:Key="ControlButtonStyle" TargetType="Button">
<Setter Property="Margin" Value="0" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="#FFF53F62" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
Name="TitleBarBr"
BorderBrush="#00c2f4"
BorderThickness="0"
CornerRadius="0"
Opacity="0.8">

<ContentPresenter
Margin="{TemplateBinding Margin}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
<Border.Background>
<ImageBrush
ImageSource="/BPASmartClient.CustomResource;component/Image/组合边框1.1.png"
Opacity="0.8"
Stretch="Fill" />
</Border.Background>

</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="TitleBarBr" Property="Opacity" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="TitleTextblockStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="16" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Foreground" Value="{StaticResource tabColor}" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontWeight" Value="SemiBold" />
</Style>


</ResourceDictionary>

+ 117
- 0
BPASmartClient.MorkMV1/View/Debug.xaml Näytä tiedosto

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

+ 30
- 0
BPASmartClient.MorkMV1/View/Debug.xaml.cs Näytä tiedosto

@@ -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();
}

}
}

+ 242
- 0
BPASmartClient.MorkMV1/View/Monitor.xaml Näytä tiedosto

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

+ 28
- 0
BPASmartClient.MorkMV1/View/Monitor.xaml.cs Näytä tiedosto

@@ -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();
}
}
}

+ 312
- 0
BPASmartClient.MorkMV1/View/ParSet.xaml Näytä tiedosto

@@ -0,0 +1,312 @@
<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 Source="/BPASmartClient.MorkMV1;component/Resource/MyStyle.xaml" />

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

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

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

</UserControl.Resources>

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

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

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

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


</StackPanel>

<!-- 参数放置面板 -->
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<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.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition />
</Grid.RowDefinitions>

<Grid
Grid.Row="0"
Margin="0,10,0,0"
Background="#ff0C255F">

<Grid.ColumnDefinitions>
<ColumnDefinition />
<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="煮时间(分)" />

<TextBlock
Grid.Column="3"
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">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl Foreground="DeepSkyBlue" ItemsSource="{Binding DishLibraryParSets}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Name="gr">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</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}" />

<TextBox
Grid.Column="2"
FontSize="18"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding Minute}" />

<TextBox
Grid.Column="3"
FontSize="18"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding Second}" />


<Border
Grid.Column="0"
Grid.ColumnSpan="4"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,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>

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

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

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

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

</Grid>

</Grid>


</UserControl>

+ 28
- 0
BPASmartClient.MorkMV1/View/ParSet.xaml.cs Näytä tiedosto

@@ -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();
}
}
}

+ 79
- 0
BPASmartClient.MorkMV1/ViewModel/DebugViewModel.cs Näytä tiedosto

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

+ 25
- 0
BPASmartClient.MorkMV1/ViewModel/MonitorViewModel.cs Näytä tiedosto

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

}
}

+ 66
- 0
BPASmartClient.MorkMV1/ViewModel/ParSetViewModel.cs Näytä tiedosto

@@ -0,0 +1,66 @@
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, "初始化设定煮面时间");
typeof(DishType).GetEnumNames()?.ToList()?.ForEach(item => { DishTypeName.Add(item); });

if (Json<MorksPar>.Data.DishLibraryParSets.Count < 5)
{
Json<MorksPar>.Data.DishLibraryParSets.Clear();
for (int i = 0; i < 5; i++)
{
Json<MorksPar>.Data.DishLibraryParSets.Add(new ParSet()
{
LocDishType = 0,
Minute = 2,
Second = 0,
TextBlockContext = $"{i + 1}"
});
}
}
}

public RelayCommand SaveInfoCommand { get; set; }

public ObservableCollection<ParSet> parSets { get; set; } = Json<MorksPar>.Data.parSets;
public ObservableCollection<ParSet> DishLibraryParSets { get; set; } = Json<MorksPar>.Data.DishLibraryParSets;
public ObservableCollection<string> DishTypeName { get; set; } = new ObservableCollection<string>();

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();
}
}
}

+ 36
- 36
BPASmartClient.MorkMW/Control_MorkMW.cs Näytä tiedosto

@@ -37,18 +37,18 @@ namespace BPASmartClient.MorkMW
ConnectKlpRobot("192.168.0.100", 8001);
ServerInit();
DataParse();
ThreadManage.GetInstance().StartLong(new Action(() => { VariableMonitor();Thread.Sleep(5); }),"机器人变量状态监控线程",true);
ThreadManage.GetInstance().StartLong(new Action(() => { VariableMonitor(); Thread.Sleep(5); }), "机器人变量状态监控线程", true);
}

private void VaribleMonitorDis()
{
PropertyInfo[] pros= morkMW.GetType().GetProperties();
PropertyInfo[] pros = morkMW.GetType().GetProperties();
foreach (var item in pros)
{
var res= item.GetCustomAttribute<VariblesAttribute>();
if(res!=null)
var res = item.GetCustomAttribute<VariblesAttribute>();
if (res != null)
{
GVL_MorkMW.varibleInfos.Add(new VaribleModel { Id = id + 1, VaribleName = res.VarName,RobotAddress=res.RobotAddress,ModbusAddress=res.ModbusTcpAddress,Notes=res.Notes });
GVL_MorkMW.varibleInfos.Add(new VaribleModel { Id = id + 1, VaribleName = res.VarName, RobotAddress = res.RobotAddress, ModbusAddress = res.ModbusTcpAddress, Notes = res.Notes });
id++;
}
}
@@ -62,8 +62,8 @@ namespace BPASmartClient.MorkMW
if (@event == null) return;
if (@event is MorkMWGoodsEvent recipe)
{
listMorkMWGoods= recipe.morkMWPushMessage?.MorkMWGoods;
DeviceProcessLogShow($"接收到调酒机【{listMorkMWGoods?.Count}】个商品配方数据");
listMorkMWGoods = recipe.morkMWPushMessage?.MorkMWGoods;
DeviceProcessLogShow($"接收到调酒机【{listMorkMWGoods?.Count}】个商品配方数据");
}
});
}
@@ -86,14 +86,14 @@ namespace BPASmartClient.MorkMW
{
if (!GVL_MorkMW.AllowLocalSimOrder)
{
if (morkMW.RobotIdle && orderLocInfos.Count > 0 && !morkMW.TaskLock && !morkMW.PourWinkComplete && morkMW.CupSignal&&modbus.Connected)
if (morkMW.RobotIdle && orderLocInfos.Count > 0 && !morkMW.TaskLock && !morkMW.PourWinkComplete && morkMW.CupSignal && modbus.Connected)
{
DeviceProcessLogShow("订单开始制作");
morkMW.TaskLock = true;
if (orderLocInfos.TryDequeue(out OrderLocInfo res))
if (orderLocInfos.TryDequeue(out BPASmartClient.MorkMW.Model.OrderLocInfo res))
{
morkMW.CurrentSuborderId = res.SuborderId;
OrderChange(res.SuborderId,ORDER_STATUS.COOKING);
OrderChange(res.SuborderId, ORDER_STATUS.COOKING);
foreach (var item in res.mixWink)
{
switch (item.Loc)
@@ -122,7 +122,7 @@ namespace BPASmartClient.MorkMW
}

morkMW.AllowMixWink = true;//接酒完成,允许调酒
// morkMW.AllowPourWink = true;//调酒完成,允许倒酒
// morkMW.AllowPourWink = true;//调酒完成,允许倒酒
}
}
}
@@ -163,7 +163,7 @@ namespace BPASmartClient.MorkMW
}
DeviceProcessLogShow($"所有位置接酒完成");
morkMW.AllowMixWink = true;//接酒完成,允许调酒
// morkMW.AllowPourWink = true;//调酒完成,允许倒酒
// morkMW.AllowPourWink = true;//调酒完成,允许倒酒
}
}

@@ -193,11 +193,11 @@ namespace BPASmartClient.MorkMW
//发送接酒信号
switch (loc)
{
case 1: modbus.WriteSingleRegister(0000, 1);DeviceProcessLogShow($"开始接【{loc}】号位置原酒"); break;
case 2: modbus.WriteSingleRegister(0000, 2);DeviceProcessLogShow($"开始接【{loc}】号位置原酒"); break;
case 3: modbus.WriteSingleRegister(0000, 3);DeviceProcessLogShow($"开始接【{loc}】号位置原酒"); break;
case 4: modbus.WriteSingleRegister(0000, 4);DeviceProcessLogShow($"开始接【{loc}】号位置原酒"); break;
case 5: modbus.WriteSingleRegister(0000, 5);DeviceProcessLogShow($"开始接【{loc}】号位置原酒"); break;
case 1: modbus.WriteSingleRegister(0000, 1); DeviceProcessLogShow($"开始接【{loc}】号位置原酒"); break;
case 2: modbus.WriteSingleRegister(0000, 2); DeviceProcessLogShow($"开始接【{loc}】号位置原酒"); break;
case 3: modbus.WriteSingleRegister(0000, 3); DeviceProcessLogShow($"开始接【{loc}】号位置原酒"); break;
case 4: modbus.WriteSingleRegister(0000, 4); DeviceProcessLogShow($"开始接【{loc}】号位置原酒"); break;
case 5: modbus.WriteSingleRegister(0000, 5); DeviceProcessLogShow($"开始接【{loc}】号位置原酒"); break;
case 6: modbus.WriteSingleRegister(0000, 6); DeviceProcessLogShow($"开始接【{loc}】号位置原酒"); break;

}
@@ -216,11 +216,11 @@ namespace BPASmartClient.MorkMW
//发送接酒完成信号
switch (loc)
{
case 1: modbus.WriteSingleCoil(4596, true);DeviceProcessLogShow($"【{loc}】号位置接酒完成"); break;
case 2: modbus.WriteSingleCoil(4597, true);DeviceProcessLogShow($"【{loc}】号位置接酒完成"); break;
case 3: modbus.WriteSingleCoil(4598, true);DeviceProcessLogShow($"【{loc}】号位置接酒完成"); break;
case 4: modbus.WriteSingleCoil(4599, true);DeviceProcessLogShow($"【{loc}】号位置接酒完成"); break;
case 5: modbus.WriteSingleCoil(4600, true);DeviceProcessLogShow($"【{loc}】号位置接酒完成"); break;
case 1: modbus.WriteSingleCoil(4596, true); DeviceProcessLogShow($"【{loc}】号位置接酒完成"); break;
case 2: modbus.WriteSingleCoil(4597, true); DeviceProcessLogShow($"【{loc}】号位置接酒完成"); break;
case 3: modbus.WriteSingleCoil(4598, true); DeviceProcessLogShow($"【{loc}】号位置接酒完成"); break;
case 4: modbus.WriteSingleCoil(4599, true); DeviceProcessLogShow($"【{loc}】号位置接酒完成"); break;
case 5: modbus.WriteSingleCoil(4600, true); DeviceProcessLogShow($"【{loc}】号位置接酒完成"); break;
case 6: modbus.WriteSingleCoil(4601, true); DeviceProcessLogShow($"【{loc}】号位置接酒完成"); break;

}
@@ -307,7 +307,7 @@ namespace BPASmartClient.MorkMW
morkMW.MixWinkComplte = modbus.ReadCoils(4612);
morkMW.ProcessComplete = modbus.ReadCoils(4613);

}
else
{
@@ -355,7 +355,7 @@ namespace BPASmartClient.MorkMW
{
if (order.mixWink.Count > 0)
{
string guid = Guid.NewGuid().ToString();
simOrderLocInfos.Enqueue(new SimOrderLocInfo { mixWink = order.mixWink, SuborderId = guid });
DeviceProcessLogShow("收到模拟订单");
@@ -402,11 +402,11 @@ namespace BPASmartClient.MorkMW
if (listMorkMWGoods.Count == 0) return;
if (morkMW.historySuborderId.FirstOrDefault(p => p == order.MorkOrder.SuborderId) != null) return;
OrderCount++;
var res= listMorkMWGoods?.FirstOrDefault(p => p.GoodsKey == order.MorkOrder.GoodsKey);
var res = listMorkMWGoods?.FirstOrDefault(p => p.GoodsKey == order.MorkOrder.GoodsKey);
if (res != null)
{
string guid = Guid.NewGuid().ToString();
orderLocInfos.Enqueue(new OrderLocInfo { mixWink = res.MorkMWBoms, SuborderId = order.MorkOrder.SuborderId });
orderLocInfos.Enqueue(new BPASmartClient.MorkMW.Model.OrderLocInfo { mixWink = res.MorkMWBoms, SuborderId = order.MorkOrder.SuborderId });
morkMW.historySuborderId.Add(order.MorkOrder.SuborderId);
OrderChange(order.MorkOrder.SuborderId, ORDER_STATUS.WAIT);
DeviceProcessLogShow($"收到【{OrderCount}】次小程序订单,当前订单【{order.MorkOrder.GoodsName}】,订单号【{order.MorkOrder.SuborderId}】");
@@ -445,12 +445,12 @@ namespace BPASmartClient.MorkMW
//throw;
}
}
/// <summary>
/// 连接卡乐普机器人
/// </summary>
/// <param name="ip"></param>
/// <param name="port"></param>
public void ConnectKlpRobot(string ip, int port)
/// <summary>
/// 连接卡乐普机器人
/// </summary>
/// <param name="ip"></param>
/// <param name="port"></param>
public void ConnectKlpRobot(string ip, int port)
{
modbus = new ModbusTcp();
modbus.Show += new Action<string>((s) =>
@@ -464,11 +464,11 @@ namespace BPASmartClient.MorkMW
modbus.ModbusTcpConnect(ip, port);

}
/// <summary>
/// 调酒小程序订单队列
/// </summary>
public ConcurrentQueue<OrderLocInfo> orderLocInfos = new ConcurrentQueue<OrderLocInfo>();
public ConcurrentQueue<BPASmartClient.MorkMW.Model.OrderLocInfo> orderLocInfos = new ConcurrentQueue<BPASmartClient.MorkMW.Model.OrderLocInfo>();

/// <summary>
/// 调酒模拟订单队列
@@ -479,8 +479,8 @@ namespace BPASmartClient.MorkMW
/// 调酒机配方集合
/// </summary>
public List<MORKMWGoods> listMorkMWGoods = new List<MORKMWGoods>();

}
}

+ 41
- 41
BPASmartClient.MorkS/Control_Morks.cs Näytä tiedosto

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


+ 20
- 20
BPASmartClient.MorkS/OrderLocInfo.cs Näytä tiedosto

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

}
}
// }
//}

+ 41
- 43
BPASmartClient.MorkSUpgradedVer/Control_MorkSUpgradedVer.cs Näytä tiedosto

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


+ 20
- 20
BPASmartClient.MorkSUpgradedVer/OrderLocInfo.cs Näytä tiedosto

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

}
}
// }
//}

+ 1
- 1
BPASmartClient.Peripheral/BasePeripheral.cs Näytä tiedosto

@@ -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()
{


+ 1
- 1
BPASmartClient.Peripheral/IPeripheral.cs Näytä tiedosto

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



+ 1
- 0
BPASmartClient/BPASmartClient.csproj Näytä tiedosto

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


+ 24
- 1
SmartClient.sln Näytä tiedosto

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


Ladataan…
Peruuta
Tallenna