Browse Source

环球咖乐美单机设备程序

样式分支
pengliangyang 2 years ago
parent
commit
9930816d4e
44 changed files with 642 additions and 1231 deletions
  1. +10
    -4
      BPASmartClient.KLMCoffee/CoffeeMachine.cs
  2. +5
    -5
      BPASmartClient.KLMCoffee/Protocal/K95commandEnumExtensions.cs
  3. +29
    -29
      BPASmartClient.KLMCoffee/Protocal/K95deFaultCoffeeEnum.cs
  4. +11
    -11
      BPASmartClient.KLMCoffee/Protocal/RecipeModel.cs
  5. +8
    -8
      BPASmartClient.Model/咖啡机/Enum/DrinkType.cs
  6. +58
    -0
      BPASmartClient.Model/咖啡机/Enum/KLMDrinkFaultType.cs
  7. +1
    -1
      BPASmartClient.Model/咖啡机/KLMCoffeeEvent.cs
  8. +1
    -0
      BPASmartClient.Model/订单/MorkTSimOrder.cs
  9. +1
    -2
      BPASmartClient.MorkF/Control_MorkF.cs
  10. +0
    -1
      BPASmartClient.MorkS/Control_Morks.cs
  11. +0
    -13
      BPASmartClient.MorkTJuicer/BPASmartClient.MorkTJuicer.csproj
  12. +0
    -317
      BPASmartClient.MorkTJuicer/Control_MORKJC.cs
  13. +0
    -8
      BPASmartClient.MorkTJuicer/GVL_MORKJC.cs
  14. +0
    -15
      BPASmartClient.MorkTM/Alarm.cs
  15. +0
    -48
      BPASmartClient.MorkTM/BPASmartClient.MorkTM.csproj
  16. +0
    -169
      BPASmartClient.MorkTM/Control_MorkTM.cs
  17. +0
    -33
      BPASmartClient.MorkTM/GVL_MorkTM.cs
  18. +0
    -31
      BPASmartClient.MorkTM/Model/Alarms.cs
  19. +0
    -14
      BPASmartClient.MorkTM/Model/WritePar.cs
  20. +0
    -24
      BPASmartClient.MorkTM/PolymerBatching.cs
  21. +0
    -16
      BPASmartClient.MorkTM/Properties/AssemblyInfo.cs
  22. +0
    -63
      BPASmartClient.MorkTM/Properties/Resources.Designer.cs
  23. +0
    -101
      BPASmartClient.MorkTM/Properties/Resources.resx
  24. +0
    -26
      BPASmartClient.MorkTM/Properties/Settings.Designer.cs
  25. +0
    -6
      BPASmartClient.MorkTM/Properties/Settings.settings
  26. +0
    -69
      BPASmartClient.MorkTM/View/Debug.xaml
  27. +0
    -50
      BPASmartClient.MorkTM/View/Monitor.xaml
  28. +0
    -35
      BPASmartClient.MorkTM/View/Monitor.xaml.cs
  29. +0
    -49
      BPASmartClient.MorkTM/ViewModel/DebugViewModel.cs
  30. +0
    -27
      BPASmartClient.MorkTM/ViewModel/MonitorViewModel.cs
  31. +16
    -0
      BPASmartClient.MorkTSingle/BPASmartClient.MorkTSingle.csproj
  32. +315
    -0
      BPASmartClient.MorkTSingle/Control_MORKJC.cs
  33. +23
    -0
      BPASmartClient.MorkTSingle/GVL_MORKJC.cs
  34. +4
    -4
      BPASmartClient.MorkTSingle/OrderLocInfo.cs
  35. +28
    -15
      BPASmartClient.MorkTSingle/PolymerBatching.cs
  36. +39
    -0
      BPASmartClient.MorkTSingle/View/DebugView.xaml
  37. +4
    -4
      BPASmartClient.MorkTSingle/View/DebugView.xaml.cs
  38. +47
    -0
      BPASmartClient.MorkTSingle/ViewModel/DebugViewModel.cs
  39. +1
    -1
      BPASmartClient.MorkT_Container/Control_MorkT_Container.cs
  40. +2
    -2
      BPASmartClient.MorkT_Container/GVL_MorkT.cs
  41. +9
    -1
      BPASmartClient.SerialPort/SerialPortClient.cs
  42. +4
    -4
      BPASmartClient/App.config
  43. +3
    -2
      BPASmartClient/BPASmartClient.csproj
  44. +23
    -23
      SmartClient.sln

+ 10
- 4
BPASmartClient.KLMCoffee/CoffeeMachine.cs View File

@@ -61,6 +61,8 @@ namespace BPASmartClient.KLMCoffee
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}


}

/// <summary>
@@ -102,6 +104,8 @@ namespace BPASmartClient.KLMCoffee

private void ResolveMsg()
{
status["CoffeeIsConnected"] = OnLine;
IsConnected = OnLine;
List<byte> temp = new List<byte>();
//一系列解包
while (dataStorage.GetSize() > 0)
@@ -170,12 +174,11 @@ namespace BPASmartClient.KLMCoffee
protected override void InitStatus()
{
status["CoffeeStatus"] = K95SysTemStatus.空闲状态;
status["CoffeedrinkType"] = DrinkType.意式;
status["CoffeedrinkType"] = DrinkType.意式咖啡;
status["CoffeeAppStatus"] = TaskIndex.无任务;
status["Coffeeprogress"] = 0;
status["CoffeeWarning"] = new FaultMessage(0x00, 0x00).dataFault();
status["CoffeeKeep"] = new UpkeepMessage(0x00).dataFault();

}

public override void Init()
@@ -189,9 +192,12 @@ namespace BPASmartClient.KLMCoffee
try
{
free = true;
Thread.Sleep(200);
byte[] data = command.ReturnsCommandData(K95CommandEnum.配方咖啡制作.GetString(), new RecipeModel().Packe(((KLMCoffee_MakeCoffeeEvent)@event).DrinkCode));
Thread.Sleep(300);
K95deFaultCoffeeEnum K95Code = (K95deFaultCoffeeEnum)((KLMCoffee_MakeCoffeeEvent)@event).KLMDrinkFaultCode;
//byte[] data = command.ReturnsCommandData(K95CommandEnum.配方咖啡制作.GetString(), new RecipeModel().Packe(((KLMCoffee_MakeCoffeeEvent)@event).DrinkCode));
byte[] data = command.ReturnsCommandData(K95CommandEnum.咖啡制作.GetString(), K95Code.GetString());
commProxy.SendData(data);
MessageLog.GetInstance.Show($"制作{K95Code}数据发送完成");
Thread.Sleep(200);
free = false;
}


+ 5
- 5
BPASmartClient.KLMCoffee/Protocal/K95commandEnumExtensions.cs View File

@@ -89,12 +89,12 @@ namespace BPASmartClient.KLMCoffee.Protocal
{
switch (me)
{
case DrinkType.意式: return "01";
case DrinkType.美式: return "02";
case DrinkType.意式咖啡: return "01";
case DrinkType.美式咖啡: return "02";
case DrinkType.热水: return "03";
case DrinkType.卡布: return "04";
case DrinkType.玛朵: return "05";
case DrinkType.拿铁: return "06";
case DrinkType.卡布奇诺: return "04";
case DrinkType.玛琪雅朵: return "05";
case DrinkType.拿铁咖啡: return "06";
case DrinkType.热牛奶: return "07";
case DrinkType.热奶沫: return "08";
default: return "01";


+ 29
- 29
BPASmartClient.KLMCoffee/Protocal/K95deFaultCoffeeEnum.cs View File

@@ -11,34 +11,34 @@ namespace BPASmartClient.KLMCoffee.Protocal
/// </summary>
public enum K95deFaultCoffeeEnum
{
意式咖啡,
美式咖啡,
咖啡意式咖啡,
卡布奇诺,
玛琪雅朵,
拿铁,
白咖啡,
芮斯崔朵,
意式玛奇朵,
奶油咖啡,
双杯意式咖啡,
双杯卡布奇诺,
双杯拿铁,
双杯玛琪雅朵,
双杯白咖啡,
双杯咖啡,
双杯芮斯崔朵,
双杯意式玛奇朵,
双杯奶油咖啡,
热水,
牛奶,
奶沫,
大壶咖啡,
取消制作,
放杯确认,
清洗冲泡器,
清洗奶沫器,
清洗奶沫器确认,
状态查询
意式咖啡 = 1,
美式咖啡 = 2,
咖啡意式咖啡 = 9,
卡布奇诺 = 4,
玛琪雅朵 = 5,
拿铁 = 6,
白咖啡 = 14,
芮斯崔朵 = 10,
意式玛奇朵 = 13,
奶油咖啡 = 12,
双杯意式咖啡 = 51,
双杯卡布奇诺 = 55,
双杯拿铁 = 57,
双杯玛琪雅朵 = 56,
双杯白咖啡 = 59,
双杯咖啡 = 52,
双杯芮斯崔朵 = 53,
双杯意式玛奇朵 = 58,
双杯奶油咖啡 = 54,
热水 = 3,
牛奶 = 7,
奶沫 = 8,
大壶咖啡 = 11,
取消制作 = 200,
放杯确认 = 201,
清洗冲泡器 = 202,
清洗奶沫器 = 203,
清洗奶沫器确认 = 204,
状态查询 = 205
}
}

+ 11
- 11
BPASmartClient.KLMCoffee/Protocal/RecipeModel.cs View File

@@ -63,7 +63,7 @@ namespace BPASmartClient.KLMCoffee.Protocal

public RecipeModel()
{
饮品类型 = DrinkType.意式;
饮品类型 = DrinkType.意式咖啡;
咖啡量 = 0;
咖啡温度 = TempEnum.低;
咖啡浓度 = CoffeeConcentration.清淡;
@@ -125,22 +125,22 @@ namespace BPASmartClient.KLMCoffee.Protocal
{
switch (drink)
{
case DrinkType.意式:
case DrinkType.意式咖啡:
return GetItalian(60);
break;
case DrinkType.美式:
case DrinkType.美式咖啡:
return GetAmerican(60,450);
break;
case DrinkType.热水:
return GetHotWater(194);
break;
case DrinkType.卡布:
case DrinkType.卡布奇诺:
return GetCabo(60,17);
break;
case DrinkType.玛朵:
case DrinkType.玛琪雅朵:
return GetMacChiato(60,8,17);
break;
case DrinkType.拿铁:
case DrinkType.拿铁咖啡:
return GetLatte(60,8,17);
break;
case DrinkType.热牛奶:
@@ -166,7 +166,7 @@ namespace BPASmartClient.KLMCoffee.Protocal
/// <param name="_咖啡量">15-240</param>
public string GetItalian(int _咖啡量)
{
饮品类型 = DrinkType.意式;
饮品类型 = DrinkType.意式咖啡;
咖啡量 = _咖啡量;
咖啡温度 = TempEnum.中;
咖啡浓度 = CoffeeConcentration.适中;
@@ -187,7 +187,7 @@ namespace BPASmartClient.KLMCoffee.Protocal
/// <param name="_热水量">25-450</param>
public string GetAmerican(int _咖啡量,int _热水量)
{
饮品类型 = DrinkType.美式;
饮品类型 = DrinkType.美式咖啡;
咖啡量 = _咖啡量;
咖啡温度 = TempEnum.中;
咖啡浓度 = CoffeeConcentration.适中;
@@ -228,7 +228,7 @@ namespace BPASmartClient.KLMCoffee.Protocal
/// <param name="_奶沫时间">5-120</param>
public string GetCabo(int _咖啡量,int _奶沫时间)
{
饮品类型 = DrinkType.卡布;
饮品类型 = DrinkType.卡布奇诺;
咖啡量 = _咖啡量;
咖啡温度 = TempEnum.中;
咖啡浓度 = CoffeeConcentration.适中;
@@ -250,7 +250,7 @@ namespace BPASmartClient.KLMCoffee.Protocal
/// <param name="_奶沫时间">5-120</param>
public string GetMacChiato(int _咖啡量,int _牛奶时间,int _奶沫时间)
{
饮品类型 = DrinkType.玛朵;
饮品类型 = DrinkType.玛琪雅朵;
咖啡量 = _咖啡量;
咖啡温度 = TempEnum.中;
咖啡浓度 = CoffeeConcentration.适中;
@@ -272,7 +272,7 @@ namespace BPASmartClient.KLMCoffee.Protocal
/// <param name="_奶沫时间">5-120</param>
public string GetLatte(int _咖啡量,int _牛奶时间,int _奶沫时间)
{
饮品类型 = DrinkType.拿铁;
饮品类型 = DrinkType.拿铁咖啡;
咖啡量 = _咖啡量;
咖啡温度 = TempEnum.中;
咖啡浓度 = CoffeeConcentration.适中;


+ 8
- 8
BPASmartClient.Model/咖啡机/Enum/DrinkType.cs View File

@@ -11,13 +11,13 @@ namespace BPASmartClient.Model.咖啡机.Enum
/// </summary>
public enum DrinkType
{
意式,
美式,
热水,
卡布,
奇朵,
拿铁,
热牛奶,
热奶沫
意式咖啡=0,
美式咖啡=1,
热水=2,
卡布奇诺=3,
琪雅朵=4,
拿铁咖啡=5,
热牛奶=6,
热奶沫=7,
}
}

+ 58
- 0
BPASmartClient.Model/咖啡机/Enum/KLMDrinkFaultType.cs View File

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

namespace BPASmartClient.Model.咖啡机.Enum
{
public enum KLMDrinkFaultType
{
意式咖啡 = 1,
美式咖啡 = 2,
咖啡意式咖啡 = 9,
卡布奇诺 = 4,
玛琪雅朵 = 5,
拿铁 = 6,
白咖啡 = 14,
芮斯崔朵 = 10,
意式玛奇朵 = 13,
奶油咖啡 = 12,
双杯意式咖啡 = 51,
双杯卡布奇诺 = 55,
双杯拿铁 = 57,
双杯玛琪雅朵 = 56,
双杯白咖啡 = 59,
双杯咖啡 = 52,
双杯芮斯崔朵 = 53,
双杯意式玛奇朵 = 58,
双杯奶油咖啡 = 54,
热水 = 3,
牛奶 = 7,
奶沫 = 8,
大壶咖啡 = 11
}
/*意式咖啡 = 1,
美式咖啡 = 2,
咖啡意式咖啡 = 9,
卡布奇诺 = 4,
玛琪雅朵 = 5,
拿铁 = 6,
白咖啡 = 14,
芮斯崔朵 = 10,
意式玛奇朵 = 13,
奶油咖啡 = 12,
双杯意式咖啡 = 51,
双杯卡布奇诺 = 55,
双杯拿铁 = 57,
双杯玛琪雅朵 = 56,
双杯白咖啡 = 59,
双杯咖啡 = 52,
双杯芮斯崔朵 = 53,
双杯意式玛奇朵 = 58,
双杯奶油咖啡 = 54,
热水 = 3,
牛奶 = 100,
奶沫 = 101,
大壶咖啡 = 11*/
}

+ 1
- 1
BPASmartClient.Model/咖啡机/KLMCoffeeEvent.cs View File

@@ -4,7 +4,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Model
{
/// <summary>
@@ -22,6 +21,7 @@ namespace BPASmartClient.Model
/// 饮品类型
/// </summary>
public DrinkType DrinkCode { get; set; }
public KLMDrinkFaultType KLMDrinkFaultCode { get; set; }
}

/// <summary>


+ 1
- 0
BPASmartClient.Model/订单/MorkTSimOrder.cs View File

@@ -11,6 +11,7 @@ namespace BPASmartClient.Model
{
public int OrderNum { get; set; }
public DrCoffeeDrinksCode DrinkCode { get; set; }
public KLMDrinkFaultType KLMDrinkFaultCode { get; set; }
public int JuiceList { get; set; }
public string JuiceMakeID{ get; set; }
}


+ 1
- 2
BPASmartClient.MorkF/Control_MorkF.cs View File

@@ -845,7 +845,7 @@ namespace BPASmartClient.MorkF
/// </summary>
private void SingleProcess()
{

//主流程出餐完成,相应变量复位
if (morkF.MainOutMealComplete)
@@ -1950,7 +1950,6 @@ namespace BPASmartClient.MorkF
Task.Delay(5).Wait();
}
}

}
if (morkF.MinorProessStatus)
{


+ 0
- 1
BPASmartClient.MorkS/Control_Morks.cs View File

@@ -88,7 +88,6 @@ namespace BPASmartClient.MorkS
if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value);
}), "WriteBools");
ActionManage.GetInstance.Register(new Action(() => { DeviceInit(); }), "InitDevice");

}

public override void ResetProgram()


+ 0
- 13
BPASmartClient.MorkTJuicer/BPASmartClient.MorkTJuicer.csproj View File

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

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" />
</ItemGroup>

</Project>

+ 0
- 317
BPASmartClient.MorkTJuicer/Control_MORKJC.cs View File

@@ -1,317 +0,0 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Threading;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Threading.Tasks;
using BPASmartClient.Device;
using BPA.Message.Enum;
using BPA.Message;
using BPASmartClient.Helper;
using BPASmartClient.Model.咖啡机.Enum;
using BPASmartClient.Model;
using BPASmartClient.EventBus;
using static BPASmartClient.EventBus.EventBus;
using BPASmartClient.Model.PLC;
using BPASmartClient.Model.单片机;

namespace BPASmartClient.MorkTJuicer
{
/*
* 冰淇淋咖啡机组合套装
* 物料位置:
* 1:冰淇料
* 2:冰淇淋杯
* 5:咖啡
* 6:咖啡杯
* 9: 茶
* 10: 茶杯
*/
public class Control_MORKJC : BaseDevice
{
GVL_MORKJC mORKD = new GVL_MORKJC();
//物料存放位置
private Dictionary<string, PolymerBatching> batchings = new Dictionary<string, PolymerBatching>();
//容器位置
private string holderLoc;
//主料位置
private string mainMaterialLoc;
//子订单ID
private string subOrderId;

private bool enableFunny = false;
private DateTime lastRecvdOrder = DateTime.Now;
private bool working = false;
/// <summary>
/// 果汁机做法,true:热饮,false:冷饮
/// </summary>
private bool GuMake = false;

private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
{
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType });
}

//private SerialPortClient commProxy;
public void ConnectOk()
{

}
ConcurrentQueue<MorkOrderPush> morkOrderPushes = new ConcurrentQueue<MorkOrderPush>();
public void Init()
{
//构建所有商品物料信息
batchings = PolymerBatching.BuildAll();
Main();
ReadData();
ThreadManage.GetInstance().StartLong(new Action(() =>
{
while (morkOrderPushes.Count > 0)
{
while (enableFunny) { Thread.Sleep(10); }
DeviceProcessLogShow("当前非自嗨模式,允许开工");
working = true;
if (morkOrderPushes.TryDequeue(out MorkOrderPush order))
{
DeviceProcessLogShow($"开始制作订单[{order.SortNum}]");
//商品类型
GOODS_TYPE currentGoodsType = GOODS_TYPE.NEITHER;
//子订单ID
subOrderId = order.SuborderId;
//遍历物料
foreach (var item in order.GoodBatchings)
{
var res = Json<BatchingInfoPar>.Data.orderMaterialDelivery.BatchingInfo.FirstOrDefault(p => p.BatchingId == item.BatchingId);
if (res != null)
{
//获取主料和容器位置
switch (batchings[res.BatchingLoc].BatchingClass)
{
case BATCHING_CLASS.HOLDER:
holderLoc = res.BatchingLoc;
break;
case BATCHING_CLASS.MAIN_MATERIAL:
// mainMaterialLoc ="1";
mainMaterialLoc = res.BatchingLoc;
//验证商品是咖啡还是冰淇淋
if (ValidateGoodsByBatching(res.BatchingLoc) != GOODS_TYPE.NEITHER)
{
//获取当前物料所属商品类型
currentGoodsType = ValidateGoodsByBatching(res.BatchingLoc);
}
break;
}
}
}
//根据商品类型执行具体制作流程
switch (currentGoodsType)
{
case GOODS_TYPE.JUICE:
GuMake = order.MakeID == "2";
DoJuicer();
break;
case GOODS_TYPE.NEITHER:
DeviceProcessLogShow("未知的商品类型");
break;
}
}
working = false;
lastRecvdOrder = DateTime.Now;
}
Thread.Sleep(1000);
}), "订单制作");
}

public void Main()
{
//开始心跳刷新,根据咖啡机及冰淇淋机来判断
//ThreadManage.GetInstance().StartLong(new Action(() =>
//{
// Thread.Sleep(100);
//}), "MORK-IC心跳刷新");
}

public void DataParse<T>(T order)
{
if (order is MorkOrderPush morkOrderPush)
{
morkOrderPushes.Enqueue(morkOrderPush);
}
}

/// <summary>
///
/// </summary>
/// <param name="batchingLoc">物料位置</param>
private GOODS_TYPE ValidateGoodsByBatching(string batchingLoc)
{
if (batchings.ContainsKey(batchingLoc))
return batchings[batchingLoc].GoodsType;
return GOODS_TYPE.NEITHER;
}

private AutoResetEvent are = new AutoResetEvent(false);

private T GetStatus<T>(string key)
{
if (peripheralStatus.ContainsKey(key))
{
if (peripheralStatus[key] != null)
{
return (T)(peripheralStatus[key]);
}
}
return default;
}

private void Wait(int value)
{
while (!((GetStatus<int>("Get_RobotAO1") == value) && GetStatus<int>("GetProgramStatus") == 0))//判断文件是否已经执行结束 且 文件末端变量值==文件名
{
Thread.Sleep(5);
}
}
int[] devStatusBy = new int[2] { 0, 0 };
/// <summary>
/// 果汁机控制信号
/// </summary>
private byte JuicerNum;
/// <summary>
/// 做果汁
/// </summary>
private void DoJuicer()
{
#region 接果汁流程
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
try
{
int JuicerNum1 = int.Parse(mainMaterialLoc);
switch (JuicerNum1)
{
case 52:
if (GuMake)
{
JuicerNum = 0x00;
}
else
{
JuicerNum = 0x01;
}
break;
case 53:
if (GuMake)
{
JuicerNum = 0x02;
}
else
{
JuicerNum = 0x03;
}
break;
case 54:
if (GuMake)
{
JuicerNum = 0x04;
}
else
{
JuicerNum = 0x05;
}
break;
case 55:
if (GuMake)
{
JuicerNum = 0x06;
}
else
{
JuicerNum = 0x07;
}
break;
default:
JuicerNum = 0x00;
break;
}
var devStatus = GetStatus<int[]>("GetDeviceStatus");
var devStatus1 = Convert.ToString(devStatus[0], 2);
var devStatus2 = devStatus[1];

if (devStatus1.IndexOf("0") == 1 && devStatus2 == 0)
{
new WriteJuicer() { Value = JuicerNum }.Publish();

Thread.Sleep(100);
devStatusBy = GetStatus<int[]>("GetDeviceStatus");
while (!(devStatusBy[1] == 0))
{
Thread.Sleep(100);
devStatusBy = GetStatus<int[]>("GetDeviceStatus");
while (devStatusBy.Length != 2)
{
Thread.Sleep(100);
devStatusBy = GetStatus<int[]>("GetDeviceStatus");
}
}
devStatusBy = GetStatus<int[]>("GetDeviceStatus");
Thread.Sleep(5000);
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
}
}
catch (Exception ex)
{
DeviceProcessLogShow("获取果汁机状态失败");
}
#endregion
}

public override DeviceClientType DeviceType => throw new NotImplementedException();


private T McuRead<T>(string tagName, object par)
{
new ReadMcu() { DeviceId = DeviceId, TagName = tagName, ReadPar = par };
if (peripheralStatus.ContainsKey(tagName))
{
if (peripheralStatus[tagName] != null)
{
return (T)peripheralStatus[tagName];
}
}
return default;
}

public void SimOrder<T>(T simOrder)
{

}
public override void DoMain()
{

}

public override void Stop()
{

}

public override void ReadData()
{

}

public override void MainTask()
{

}

public override void ResetProgram()
{

}
public override void SimOrder()
{
}
}
}

+ 0
- 8
BPASmartClient.MorkTJuicer/GVL_MORKJC.cs View File

@@ -1,8 +0,0 @@
using BPASmartClient.Device;

namespace BPASmartClient.MorkTJuicer
{
public class GVL_MORKJC : IStatus
{
}
}

+ 0
- 15
BPASmartClient.MorkTM/Alarm.cs View File

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

namespace BPASmartClient.MorkTM
{
public class Alarm: IAlarm
{
[Alarm("报警")]
public string Name { get; set; }
}
}

+ 0
- 48
BPASmartClient.MorkTM/BPASmartClient.MorkTM.csproj View File

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

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<OutputType>Library</OutputType>
<UseWindowsForms>False</UseWindowsForms>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Update="Properties\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>

<ItemGroup>
<Folder Include="Control\" />
</ItemGroup>

</Project>

+ 0
- 169
BPASmartClient.MorkTM/Control_MorkTM.cs View File

@@ -1,169 +0,0 @@
using BPA.Message;
using BPA.Message.Enum;
using BPASmartClient.Device;
using BPASmartClient.EventBus;
using BPASmartClient.Helper;
using BPASmartClient.Message;
using BPASmartClient.Model;
using BPASmartClient.Model.PLC;
using BPASmartClient.MorkTM.Model;
using System.Collections.Concurrent;
using static BPASmartClient.EventBus.EventBus;

namespace BPASmartClient.MorkTM
{
public class Control_MorkTM : BaseDevice
{
public override DeviceClientType DeviceType => throw new NotImplementedException();

GVL_MorkTM morkTM = new GVL_MorkTM();
public override void DoMain()
{
ServerInit();
DataParse();

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

DeviceProcessLogShow("设备初始化完成");

}
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 DataParse()
{
EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
if(@event == null) return;
if(@event is DoOrderEvent order)
{
if (order.MorkOrder.GoodBatchings == null) return;
OrderCount++;
OrderChange(order.MorkOrder, ORDER_STATUS.WAIT);
DeviceProcessLogShow($"接收到{OrderCount}次订单");
Dictionary<string, int> OrderPushes = new Dictionary<string, int>();
foreach (var item in order.MorkOrder.GoodBatchings)
{
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
if (res != null)
{
OrderPushes.TryAdd(res.BatchingLoc, item.BatchingCount);
}
}

morkTM.morkOrderPushesTeaWithMilk.Enqueue(new OrderLocInfo()
{
GoodName = order.MorkOrder.GoodsName,
SuborderId = order.MorkOrder.SuborderId,
GoodPushes = OrderPushes
});
}
});
}
private void OrderChange(MorkOrderPush orderPush, ORDER_STATUS oRDER_STATUS)
{
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent()
{
SortNum = orderPush.SortNum.ToString(),
GoodName = orderPush.GoodsName,
Status = oRDER_STATUS,
SubOrderId = orderPush.SuborderId,
deviceClientType = DeviceType
});
}


public override void MainTask()
{
IsHealth = true;
MakeTeaWithMilkProcess();
}

private void MakeTeaWithMilkProcess()
{
if(morkTM.morkOrderPushesTeaWithMilk.Count > 0)
{
if(morkTM.morkOrderPushesTeaWithMilk.TryDequeue(out OrderLocInfo orderLoc))
{
morkTM.RecipesPushes.Clear();
morkTM.RecipesPushes = orderLoc.GoodPushes;
foreach(var item in morkTM.RecipesPushes)
{
WriteData(item.Key,item.Value);
while (!RTrig.GetInstance("OutMaterialComplete").Start(morkTM.OutMaterialComplete))
{
Thread.Sleep(100);
}
DeviceProcessLogShow($"奶茶{orderLoc.GoodName}:配料{item.Key}:添加量{item.Value}");
}
}
}
}


public override void ReadData()
{
throw new NotImplementedException();
}

public override void ResetProgram()
{
morkTM = null;
morkTM = new GVL_MorkTM();
}

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

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

public override void SimOrder()
{
throw new NotImplementedException();
}

public override void Stop()
{
throw new NotImplementedException();
}
}
}

+ 0
- 33
BPASmartClient.MorkTM/GVL_MorkTM.cs View File

@@ -1,33 +0,0 @@
using BPA.Models;
using BPASmartClient.Device;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkTM
{
public class GVL_MorkTM: IStatus
{
/// <summary>
/// 奶茶订单队列
/// </summary>
public ConcurrentQueue<OrderLocInfo> morkOrderPushesTeaWithMilk = new ConcurrentQueue<OrderLocInfo>();
/// <summary>
/// 当前正在制作的奶茶订单
/// </summary>
public OrderLocInfo CurrentOrderLoc = new OrderLocInfo();
/// <summary>
/// 奶茶配料的队列
/// </summary>
public Dictionary<string, int> RecipesPushes = new Dictionary<string, int>();
/// <summary>
///
/// </summary>
[VariableMonitor("出料完成", "", "")]
public bool OutMaterialComplete { get; set; }

}
}

+ 0
- 31
BPASmartClient.MorkTM/Model/Alarms.cs View File

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

namespace BPASmartClient.MorkTM.Model
{
public class Alarms : ObservableObject
{
private string _id;
public string ID { get { return _id; } set { _id = value; OnPropertyChanged(); } }

private string _varName;
public string VarName { get { return _varName; } set { _varName = value; OnPropertyChanged(); } }

private string _plcAddress;
public string PLCAddress { get { return _plcAddress; } set { _plcAddress = value; OnPropertyChanged(); } }

private string _modbusTCP;
public string ModbusTCP { get { return _modbusTCP; } set { _modbusTCP = value; OnPropertyChanged(); } }

private string _value;
public string Value { get { return _value; } set { _value = value; OnPropertyChanged(); } }

private string _notes;
public string Notes { get { return _notes; } set { _notes = value; OnPropertyChanged(); } }
}
}

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

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

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

+ 0
- 24
BPASmartClient.MorkTM/PolymerBatching.cs View File

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

namespace BPASmartClient.MorkTM
{
public enum Material
{
Material_Top_1, Material_Top_2, Material_Top_3, Material_Top_4, Material_Top_5, Material_Top_6,
Material_Mid_1, Material_Mid_2, Material_Mid_3, Material_Mid_4, Material_Mid_5, Material_Mid_6, Material_Mid_7, Material_Mid_8, Material_Mid_9, Material_Mid_10,
Marerial_Bottom_1, Marerial_Bottom_2, Marerial_Bottom_3, Marerial_Top_4,Marerial_Bottom_5, Marerial_Bottom_6
}
public enum TeaStorageBox
{
TeaStorageBox_1, TeaStorageBox_2, TeaStorageBox_3, TeaStorageBox_4, TeaStorageBox_5, TeaStorageBox_6
}

public class PolymerBatching
{

}
}

+ 0
- 16
BPASmartClient.MorkTM/Properties/AssemblyInfo.cs View File

@@ -1,16 +0,0 @@
using System.Runtime.InteropServices;

[assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)]

// 在此类的 SDK 样式项目中,现在,在此文件中早前定义的几个程序集属性将在生成期间自动添加,并使用在项目属性中定义的值进行填充。有关包含的属性以及如何定制此过程的详细信息,请参阅
// https://aka.ms/assembly-info-properties


// 将 ComVisible 设置为 false 会使此程序集中的类型对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,请将该类型的 ComVisible
// 属性设置为 true。

[assembly: ComVisible(false)]

// 如果此项目向 COM 公开,则下列 GUID 用于 typelib 的 ID。

[assembly: Guid("a100db3c-23af-4bd5-991e-224a062d4f2d")]

+ 0
- 63
BPASmartClient.MorkTM/Properties/Resources.Designer.cs View File

@@ -1,63 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------

namespace BPASmartClient.MorkTM.Properties {
using System;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BPASmartClient.MorkTM.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

+ 0
- 101
BPASmartClient.MorkTM/Properties/Resources.resx View File

@@ -1,101 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema

Version 1.3

The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.

Example:

... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>

There are any number of "resheader" rows that contain simple
name/value pairs.

Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.

The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:

Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.

mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

+ 0
- 26
BPASmartClient.MorkTM/Properties/Settings.Designer.cs View File

@@ -1,26 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------

namespace BPASmartClient.MorkTM.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.1.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

+ 0
- 6
BPASmartClient.MorkTM/Properties/Settings.settings View File

@@ -1,6 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
</SettingsFile>

+ 0
- 69
BPASmartClient.MorkTM/View/Debug.xaml View File

@@ -1,69 +0,0 @@
<UserControl x:Class="BPASmartClient.MorkTM.View.Debug"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkTM.View"
xmlns:vm="clr-namespace:BPASmartClient.MorkTM.ViewModel"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="1000"
Name="调试界面">
<UserControl.DataContext>
<vm:DebugViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<TextBlock Text="出料口" Margin="10,0"/>
<ComboBox ItemsSource="{Binding Materials}" Width="80" Margin="20,0"/>
<TextBlock Text="出料量" Margin="40,0,10,0"/>
<TextBox Text="{Binding MaertialsWight}" Width="60" Margin="10,0"/>
<Button Content="出料" Margin="40,0" Command="{Binding OutMaterials}"/>
</StackPanel>
<Button Grid.Column="1"
Width="120" Margin="20,0" HorizontalAlignment="Left"
Content="转盘转动" Command="{Binding TurnOn}"/>
<Border BorderBrush="White" BorderThickness="2" Grid.Column="0" Grid.Row="1" Grid.RowSpan="2"/>
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock Text="奶茶" Margin="20,0"/>
<ComboBox ItemsSource="{Binding}" Width="120"/>
</StackPanel>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>

</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="4*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Viewbox Stretch="Fill">
</Viewbox>
<Button Content="制作"
Grid.Row="3" Grid.ColumnSpan="4"
HorizontalAlignment="Center"/>
</Grid>

</Grid>
</UserControl>

+ 0
- 50
BPASmartClient.MorkTM/View/Monitor.xaml View File

@@ -1,50 +0,0 @@
<UserControl x:Class="BPASmartClient.MorkTM.View.Monitor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkTM.View"
xmlns:vm="clr-namespace:BPASmartClient.MorkTM.ViewModel"
mc:Ignorable="d"
Name="监控画面"
d:DesignHeight="450" d:DesignWidth="800">
<Control.DataContext>
<vm:MonitorViewModel/>
</Control.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid Margin="5" >
<DataGrid Style="{StaticResource dataGrid_Style}" ItemsSource="{Binding alarms}"
x:Name="gridAlarm" Margin="5" AutoGenerateColumns="False" RowHeight="100"
LoadingRow="gridProducts_LoadingRow"
FrozenColumnCount="1"
VerticalAlignment="Top"
IsReadOnly="True"
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">
<DataGrid.Columns>

<DataGridTextColumn Header="ID" Binding="{Binding Path=ID ,Mode=TwoWay ,UpdateSourceTrigger=PropertyChanged}" HeaderStyle="{StaticResource dataGridHeader_Style}" Width="60"
CellStyle="{StaticResource dataGridCell_Style}"/>
<DataGridTextColumn Header="变量名" Binding="{Binding Path=VarName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HeaderStyle="{StaticResource dataGridHeader_Style}" Width="120"
CellStyle="{StaticResource dataGridCell_Style}"/>
<DataGridTextColumn Header="PLC地址" Binding="{Binding Path=PLCAddress,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HeaderStyle="{StaticResource dataGridHeader_Style}" Width="120"
CellStyle="{StaticResource dataGridCell_Style}"/>
<DataGridTextColumn Header="Modbus TCP地址" Binding="{Binding Path=ModbusTCP,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HeaderStyle="{StaticResource dataGridHeader_Style}" Width="170"
CellStyle="{StaticResource dataGridCell_Style}"/>
<DataGridTextColumn Header="当前值" Binding="{Binding Path=Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HeaderStyle="{StaticResource dataGridHeader_Style}" Width="100"
CellStyle="{StaticResource dataGridCell_Style}"/>
<DataGridTextColumn Header="注释" Binding="{Binding Path=Notes,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HeaderStyle="{StaticResource dataGridHeader_Style}" Width="*"
CellStyle="{StaticResource dataGridCell_Style}"/>
</DataGrid.Columns>
</DataGrid>

</Grid>
</UserControl>

+ 0
- 35
BPASmartClient.MorkTM/View/Monitor.xaml.cs View File

@@ -1,35 +0,0 @@
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.MorkTM.View
{
/// <summary>
/// Monitor.xaml 的交互逻辑
/// </summary>
public partial class Monitor : UserControl
{
public Monitor()
{
InitializeComponent();

}

private void gridProducts_LoadingRow(object sender, DataGridRowEventArgs e)
{

}
}
}

+ 0
- 49
BPASmartClient.MorkTM/ViewModel/DebugViewModel.cs View File

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

namespace BPASmartClient.MorkTM.ViewModel
{
public class DebugViewModel : ObservableObject
{
/// <summary>
/// 出料口集合
/// </summary>
public List<string> Materials { get; set; } = new List<string>();

/// <summary>
/// 奶茶
/// </summary>
public ObservableCollection<string> TeaWithMilkType { get; set; }
/// <summary>
/// 出料
/// </summary>
public RelayCommand OutMaterials { get; set; }
/// <summary>
/// 转盘转动
/// </summary>
public RelayCommand TurnOn { get; set; }
public float MaertialsWight { get { return _maertialsWight; } set { _maertialsWight = value; OnPropertyChanged(); } }
private float _maertialsWight = 10;
public DebugViewModel()
{
foreach(TeaStorageBox code in Enum.GetValues(typeof(TeaStorageBox)))
{
Materials.Add(code.ToString());
}

foreach (Material materials in Enum.GetValues(typeof(Material)))
{
Materials.Add(materials.ToString());
}

}
}
}

+ 0
- 27
BPASmartClient.MorkTM/ViewModel/MonitorViewModel.cs View File

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

namespace BPASmartClient.MorkTM.ViewModel
{
public class MonitorViewModel: ObservableObject
{
public ObservableCollection<Alarms> alarms { get; set; } = new ObservableCollection<Alarms>();

public MonitorViewModel()
{
alarms.Add(new Alarms() { ID = "1", VarName = "1", ModbusTCP = "1", Notes = "1111", PLCAddress = "D1", Value = "33" });
alarms.Add(new Alarms() { ID = "2", VarName = "2", ModbusTCP = "2", Notes = "2222", PLCAddress = "D2", Value = "33" });
alarms.Add(new Alarms() { ID = "3", VarName = "3", ModbusTCP = "3", Notes = "3333", PLCAddress = "D2", Value = "33" });




}
}
}

+ 16
- 0
BPASmartClient.MorkTSingle/BPASmartClient.MorkTSingle.csproj View File

@@ -0,0 +1,16 @@
<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.KLMCoffee\BPASmartClient.KLMCoffee.csproj" />
</ItemGroup>

</Project>

+ 315
- 0
BPASmartClient.MorkTSingle/Control_MORKJC.cs View File

@@ -0,0 +1,315 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Threading;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Threading.Tasks;
using BPASmartClient.Device;
using BPA.Message.Enum;
using BPA.Message;
using BPASmartClient.Helper;
using BPASmartClient.Model.咖啡机.Enum;
using BPASmartClient.Model;
using BPASmartClient.EventBus;
using static BPASmartClient.EventBus.EventBus;
using BPASmartClient.Model.PLC;
using BPASmartClient.Model.单片机;
using BPASmartClient.Business;
using BPASmartClient.KLMCoffee.Protocal;
using BPASmartClient.Message;
namespace BPASmartClient.MorkTSingle
{
/*
* 冰淇淋咖啡机组合套装
* 物料位置:
* 1:冰淇料
* 2:冰淇淋杯
* 5:咖啡
* 6:咖啡杯
* 9: 茶
* 10: 茶杯
*/
public class Control_MORKJC : BaseDevice
{
public override global::BPA.Message.Enum.DeviceClientType DeviceType { get { return BPA.Message.Enum.DeviceClientType.MORKT; } }

GVL_MORKJC morkT = new GVL_MORKJC();
//物料存放位置
private Dictionary<string, PolymerBatching> batchings = new Dictionary<string, PolymerBatching>();
//容器位置
private string holderLoc;
//主料位置
private string mainMaterialLoc;
/// <summary>
/// 果汁机做法,true:热饮,false:冷饮
/// </summary>
private bool GuMake = false;

private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
{
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType });
}

//private SerialPortClient commProxy;
public void ConnectOk()
{

}
ConcurrentQueue<MorkOrderPush> morkOrderPushes = new ConcurrentQueue<MorkOrderPush>();
/// <summary>
///
/// </summary>
/// <param name="batchingLoc">物料位置</param>
private GOODS_TYPE ValidateGoodsByBatching(string batchingLoc)
{
if (batchings.ContainsKey(batchingLoc))
return batchings[batchingLoc].GoodsType;
return GOODS_TYPE.NEITHER;
}

private AutoResetEvent are = new AutoResetEvent(false);

private void GetStatus(string key, Action<object> action)
{
if (peripheralStatus.ContainsKey(key))
{
if (peripheralStatus[key] != null)
{
action?.Invoke(peripheralStatus[key]);
}
}
}
DateTime delayTimeOut_Coffee;
private void DoCoffee()
{
if (IsHealth && morkT.morkOrderPushesCoffee.Count > 0 && !morkT.IsCoffeeMake /*&& morkT.coffeeState== K95SysTemStatus.空闲状态*/)
{
Thread.Sleep(1000);
OrderChange(morkT.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
new KLMCoffee_MakeCoffeeEvent() { DeviceId=DeviceId, KLMDrinkFaultCode = (KLMDrinkFaultType)(morkT.morkOrderPushesCoffee.ElementAt(0).Loc) }.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水
morkT.IsCoffeeMake = true;
}
else if (morkT.MakeCoffeeFinish && IsHealth && morkT.morkOrderPushesCoffee.Count > 0 && morkT.IsCoffeeMake)
{
OrderChange(morkT.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
DeviceProcessLogShow($"{morkT.morkOrderPushesCoffee.ElementAt(0).GoodName}制作完成");
if (morkT.morkOrderPushesCoffee.TryDequeue(out OrderLocInfo orderloc))
{
morkT.IsCoffeeMake = false;
morkT.MakeCoffeeFinish = false;
Thread.Sleep(1000);
};
}
}

private T McuRead<T>(string tagName, object par)
{
new ReadMcu() { DeviceId = DeviceId, TagName = tagName, ReadPar = par };
if (peripheralStatus.ContainsKey(tagName))
{
if (peripheralStatus[tagName] != null)
{
return (T)peripheralStatus[tagName];
}
}
return default;
}

public void SimOrder<T>(T simOrder)
{

}
public override void DoMain()
{
if (Json<KeepDataBase>.Data.IsVerify)
{
IsHealth = true;
}
IsHealth = true;
serverInit();
DataParse();
}
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;
}
});
}
private void DataParse()
{

EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle)
{
if (@event == null) return;
if (@event is DoOrderEvent order)
{
if (order.MorkOrder.GoodBatchings == null) return;
OrderCount++;
DeviceProcessLogShow($"接收到{OrderCount}次订单");
batchings = PolymerBatching.BuildAll();
//商品类型
GOODS_TYPE currentGoodsType = GOODS_TYPE.NEITHER;
foreach (var item in order.MorkOrder.GoodBatchings)
{
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
if (res != null)
{
//验证商品是做的某种饮料
if (ValidateGoodsByBatching(res.BatchingLoc) != GOODS_TYPE.NEITHER)
{
//获取当前物料所属商品类型
currentGoodsType = ValidateGoodsByBatching(res.BatchingLoc);
}
switch (batchings[res.BatchingLoc].BatchingClass)
{
case BATCHING_CLASS.HOLDER:
holderLoc = res.BatchingLoc;
break;
case BATCHING_CLASS.MAIN_MATERIAL:
mainMaterialLoc = res.BatchingLoc;
break;
}
//根据商品类型执行具体制作流程
switch (currentGoodsType)
{
case GOODS_TYPE.COFFEE:

if (morkT.morkOrderPushesCoffee.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
{
morkT.morkOrderPushesCoffee.Enqueue(new OrderLocInfo()
{
SuborderId = order.MorkOrder.SuborderId,
BatchingId = res.BatchingId,
Loc = ushort.Parse(mainMaterialLoc),
GoodName = order.MorkOrder.GoodsName,
});
}
break;
case GOODS_TYPE.NEITHER:
DeviceProcessLogShow("未知的商品类型");
break;
}
}
}
}
});
}
public override void Stop()
{

}

public override void ReadData()
{

}
private bool bFirstTrig_Coffee = false;
public override void MainTask()
{
GetStatus("CoffeeStatus", new Action<object>((o) =>
{
if (o is int b)
{
morkT.coffeeState = (K95SysTemStatus)b;
}
}));
GetStatus("CoffeeIsConnected", new Action<object>((o) =>
{
if (o is bool b)
{
morkT.KLMCoffeeIsConnected = b;
}
}));
if ( morkT.morkOrderPushesCoffee.Count > 0) {
if (morkT.KLMCoffeeIsConnected)
{
if (morkT.IsCoffeeMake)
{
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_CoffeEndCookEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
bFirstTrig_Coffee = false;
morkT.MakeCoffeeFinish = true;
});
if (morkT.MakeCoffeeFinish != true && morkT.MakeCoffeeFinish == false)
{
if (!bFirstTrig_Coffee)
{
bFirstTrig_Coffee = true;
delayTimeOut_Coffee = DateTime.Now;
}
else if (DateTime.Now.Subtract(delayTimeOut_Coffee).TotalSeconds > 60 && bFirstTrig_Coffee == true)
{
DeviceProcessLogShow("接咖啡超时,接咖啡结束,等待取咖啡");
bFirstTrig_Coffee = false;
morkT.MakeCoffeeFinish = true;
}
}
}
DoCoffee();
}
else
{
MessageLog.GetInstance.ShowEx("未读取到咖啡机设备心跳");
}
}
}

public override void ResetProgram()
{

}
public override void SimOrder()
{
EventBus.EventBus.GetInstance().Subscribe<MorkTSimOrder>(0, delegate (IEvent @event, EventCallBackHandle callBackHandle)
{
string guid = Guid.NewGuid().ToString();
if (@event != null && @event is MorkTSimOrder msm)
{
DeviceProcessLogShow("----开始模拟订单----");
morkT.morkOrderPushesCoffee.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.KLMDrinkFaultCode, SuborderId = guid, GoodName = "模拟咖啡订单" });
}
});
/*
string aa = calLrcCommon("01" + "05" + "0000000D");
string bb = ":01010001" + aa + "\r\n";*/
}
public static string calLrcCommon(string data)
{
try
{
if (data.Length % 2 != 0)
{
data = data + "0";
}
int total = 0;
int len = data.Length;
int num = 0;
while (num < len)
{
string s = data.Substring(num, 2);
total += Convert.ToInt32(s, 16);
num += 2;
}
total = ~total + 1;
string checkSum = (total & 255).ToString("x").ToUpper();
while (checkSum.Length < 2)
{
checkSum = "0" + checkSum;
}
return checkSum;
}
catch (Exception)
{
}
return "";
}
}
}

+ 23
- 0
BPASmartClient.MorkTSingle/GVL_MORKJC.cs View File

@@ -0,0 +1,23 @@
using BPASmartClient.Device;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using BPASmartClient.KLMCoffee.Protocal;

namespace BPASmartClient.MorkTSingle
{
public class GVL_MORKJC : IStatus
{
/// <summary>
/// 咖啡机订单队列
/// </summary>
public ConcurrentQueue<OrderLocInfo> morkOrderPushesCoffee = new ConcurrentQueue<OrderLocInfo>();
public bool MakeCoffeeFinish = false;
public bool IsCoffeeMake = false;
public K95SysTemStatus coffeeState { get; set; }
/// <summary>
/// 咖乐美咖啡机心跳
/// </summary>
public bool KLMCoffeeIsConnected = false;
}
}

BPASmartClient.MorkTM/OrderLocInfo.cs → BPASmartClient.MorkTSingle/OrderLocInfo.cs View File

@@ -4,15 +4,15 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkTM
namespace BPASmartClient.MorkTSingle
{
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 Dictionary<string, int> GoodPushes { get; set; }
public string makeID { get; set; }
}
}

BPASmartClient.MorkTJuicer/PolymerBatching.cs → BPASmartClient.MorkTSingle/PolymerBatching.cs View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkTJuicer
namespace BPASmartClient.MorkTSingle
{
internal enum GOODS_TYPE
{
@@ -13,6 +13,10 @@ namespace BPASmartClient.MorkTJuicer
/// </summary>
NEITHER,
/// <summary>
/// 咖啡
/// </summary>
COFFEE,
/// <summary>
/// 果汁
/// </summary>
JUICE
@@ -26,17 +30,30 @@ namespace BPASmartClient.MorkTJuicer

internal class PolymerBatching
{
internal const string Juicer_MAIN_BATCHIN1_LOC = "52";
internal const string Juicer_MAIN_BATCHIN2_LOC = "53";
internal const string Juicer_MAIN_BATCHIN3_LOC = "54";
internal const string Juicer_MAIN_BATCHIN4_LOC = "55";
internal const string COFFEE_HOLDER_LOC = "30";
internal const string TEA_HOLDER_LOC = "51";
public static Dictionary<string, GOODS_TYPE> GOODS_TYPES = new Dictionary<string, GOODS_TYPE>() {
{Juicer_MAIN_BATCHIN1_LOC,GOODS_TYPE.JUICE},
{Juicer_MAIN_BATCHIN2_LOC,GOODS_TYPE.JUICE},
{Juicer_MAIN_BATCHIN3_LOC,GOODS_TYPE.JUICE},
{Juicer_MAIN_BATCHIN4_LOC,GOODS_TYPE.JUICE},
{"1", GOODS_TYPE.COFFEE},
{"2", GOODS_TYPE.COFFEE},
{"3", GOODS_TYPE.COFFEE},
{"4", GOODS_TYPE.COFFEE},
{"5", GOODS_TYPE.COFFEE},
{"6", GOODS_TYPE.COFFEE},
{"9", GOODS_TYPE.COFFEE},
{"10", GOODS_TYPE.COFFEE},
{"11", GOODS_TYPE.COFFEE},
{"12", GOODS_TYPE.COFFEE},
{"13", GOODS_TYPE.COFFEE},
{"14", GOODS_TYPE.COFFEE},
{"51", GOODS_TYPE.COFFEE},
{"52", GOODS_TYPE.COFFEE},
{"53", GOODS_TYPE.COFFEE},
{"54", GOODS_TYPE.COFFEE},
{"55", GOODS_TYPE.COFFEE},
{"56", GOODS_TYPE.COFFEE},
{"57", GOODS_TYPE.COFFEE},
{"58", GOODS_TYPE.COFFEE},
{"59", GOODS_TYPE.COFFEE},
{"7", GOODS_TYPE.COFFEE},
{"8", GOODS_TYPE.COFFEE},
};

public GOODS_TYPE GoodsType { get; set; }
@@ -53,10 +70,6 @@ namespace BPASmartClient.MorkTJuicer
GoodsType = GOODS_TYPES[loc];
switch (loc)
{
case COFFEE_HOLDER_LOC:
case TEA_HOLDER_LOC:
BatchingClass = BATCHING_CLASS.HOLDER;
break;
default:
BatchingClass = BATCHING_CLASS.MAIN_MATERIAL;
break;

+ 39
- 0
BPASmartClient.MorkTSingle/View/DebugView.xaml View File

@@ -0,0 +1,39 @@
<UserControl x:Class="BPASmartClient.MorkTSingle.View.DebugView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="clr-namespace:BPASmartClient.MorkTSingle.ViewModel"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.DataContext>
<vm:DebugViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="15*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<TextBlock>咖啡:</TextBlock>
<ComboBox Margin="10,0"
Width="100"
ItemsSource="{Binding Coffees}"
SelectedItem="{Binding SimOrderCoffeeList}" />
<Button Command="{Binding SimOrderMakeCoffee}">制作</Button>
</StackPanel>
</Grid>
</UserControl>

BPASmartClient.MorkTM/View/Debug.xaml.cs → BPASmartClient.MorkTSingle/View/DebugView.xaml.cs View File

@@ -13,14 +13,14 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MorkTM.View
namespace BPASmartClient.MorkTSingle.View
{
/// <summary>
/// Debug.xaml 的交互逻辑
/// DebugView.xaml 的交互逻辑
/// </summary>
public partial class Debug : UserControl
public partial class DebugView : UserControl
{
public Debug()
public DebugView()
{
InitializeComponent();
}

+ 47
- 0
BPASmartClient.MorkTSingle/ViewModel/DebugViewModel.cs View File

@@ -0,0 +1,47 @@
using BPASmartClient.Business;
using BPASmartClient.Device;
using BPASmartClient.EventBus;
using BPASmartClient.Helper;
using BPASmartClient.Message;
using BPASmartClient.Model;
using BPASmartClient.Model.乐白机器人;
using BPASmartClient.Model.冰淇淋.Enum;
using BPASmartClient.Model.单片机;
using BPASmartClient.Model.单片机.Enum;
using BPASmartClient.Model.咖啡机.Enum;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;
namespace BPASmartClient.MorkTSingle.ViewModel;
public class DebugViewModel : ObservableObject
{
public RelayCommand SimOrderMakeCoffee { get; set; }
/// <summary>
/// 设备ID
/// </summary>
public int DeviceId { get; set; }
/// <summary>
/// 设备数据
/// </summary>
public ObservableCollection<VariableMonitor> variableMonitors { get; set; }
public List<string> Coffees { get; set; } = new List<string>();
public string SimOrderCoffeeList { get { return _simOrderCoffeeList; } set { _simOrderCoffeeList = value; OnPropertyChanged(); } }
public string _simOrderCoffeeList { get; set; }
public DebugViewModel()
{
foreach (KLMDrinkFaultType code in Enum.GetValues(typeof(KLMDrinkFaultType)))
{
Coffees.Add(code.ToString());
}
SimOrderCoffeeList = Coffees[0];
SimOrderMakeCoffee = new RelayCommand(() =>
{
new MorkTSimOrder() {KLMDrinkFaultCode = (KLMDrinkFaultType)Enum.Parse(typeof(KLMDrinkFaultType), SimOrderCoffeeList) }.Publish();
});
}
}


+ 1
- 1
BPASmartClient.MorkT_Container/Control_MorkT_Container.cs View File

@@ -503,7 +503,7 @@ namespace BPASmartClient.MorkT_Container
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.接咖啡);
//Wait();
new DRCoffee_MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).Loc)}.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水
new DRCoffee_MakeCoffeeEvent() { DeviceId=DeviceId, DrinkCode = (DrCoffeeDrinksCode)(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).Loc)}.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水
}
else
{


+ 2
- 2
BPASmartClient.MorkT_Container/GVL_MorkT.cs View File

@@ -21,7 +21,7 @@ namespace BPASmartClient.MorkT_Container
public const int 取纸杯 = 10005;//安全位---取杯位
public const int 二次取杯 = 10008;//取纸杯检测位---二次取杯位
public const int 取纸杯检测 = 10006;//取杯位---取杯检测位
public const int 取杯位_机器人安全位 = 10002;//取杯检测位---安全位
public const int 取杯位_机器人安全位 = 10002;//取杯检测位---模组移动安全位

public const int 接咖啡 = 10010;//安全位---接咖啡位

@@ -30,7 +30,7 @@ namespace BPASmartClient.MorkT_Container
public const int 接果汁2 = 10012;//接果汁过渡位---果汁2位
public const int 接果汁3 = 10013;//接果汁过渡位---果汁3位
public const int 接果汁4 = 10014;//接果汁过渡位---果汁4位
public const int 接果汁_机器人安全位 = 10002;//接果汁过渡位---安全位
public const int 接果汁_机器人安全位 = 10002;//接果汁过渡位---模组移动安全位

public const int 接茶叶 = 10015;
public const int 接茶水 = 10016;


+ 9
- 1
BPASmartClient.SerialPort/SerialPortClient.cs View File

@@ -152,7 +152,11 @@ namespace BPASmartClient.SerialPort
{
lock (lck4Serial)
{
if (!IsHavePort) return;
if (!IsHavePort)
{
MessageLog.GetInstance.Show("咖乐美咖啡机连接失败");
return;
}
if (comPort.IsOpen) comPort.Close();
comPort.PortName = portName;
comPort.BaudRate = (int)baudRate;
@@ -160,6 +164,7 @@ namespace BPASmartClient.SerialPort
comPort.DataBits = (int)dataBits;
comPort.StopBits = stopBits;
comPort.Open();
MessageLog.GetInstance.Show("咖乐美咖啡机连接成功");
}
}

@@ -224,12 +229,15 @@ namespace BPASmartClient.SerialPort
Close();
}

private static readonly object objLock = new object();

/// <summary>
/// 发送数据
/// </summary>
/// <param name="data">发送数据</param>
public void SendData(byte[] data)
{
lock(objLock)
Write(data, 0, data.Length);
}



+ 4
- 4
BPASmartClient/App.config View File

@@ -7,14 +7,14 @@
<add key="IsEnableTest" value="false"/>

<!--开发环境-->
<add key="apollouri" value="http://10.2.1.21:28080/"/>
<!--add key="apollouri" value="http://10.2.1.21:28080/"/>
<add key="AppId" value="dev1_common"/>
<add key ="Namespaces" value="DEV.Config"/>
<add key ="Namespaces" value="DEV.Config"/>-->

<!--正式环境-->
<!--<add key="apollouri" value="http://47.108.65.220:28080/"/>
<add key="apollouri" value="http://47.108.65.220:28080/"/>
<add key="AppId" value="order"/>
<add key ="Namespaces" value="TEST1.Config"/>-->
<add key ="Namespaces" value="TEST1.Config"/>

<!--阿里云上报启动方式:API 或者 LOCAL-->
<!--API :通过客户端ID,调用接口查询“设备连接信息”-->


+ 3
- 2
BPASmartClient/BPASmartClient.csproj View File

@@ -35,9 +35,10 @@
<ProjectReference Include="..\BPASmartClient.MorkS\BPASmartClient.MorkS.csproj" />
<ProjectReference Include="..\BPASmartClient.Morkt.JAKA.JC\BPASmartClient.MorkTJAKAJC.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT.Lebai.JC\BPASmartClient.MorkTLebaiJC.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkTJuicer\BPASmartClient.MorkTJuicer.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkTM\BPASmartClient.MorkTM.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkTSingle\BPASmartClient.MorkTSingle.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT\BPASmartClient.MorkT.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT_BarCounter\BPASmartClient.MorkT_BarCounter.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT_Container\BPASmartClient.MorkT_Container.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT_HQ\BPASmartClient.MorkTHQ.csproj" />
<ProjectReference Include="..\BPASmartClient.SCChip\BPASmartClient.SCChip.csproj" />
<ProjectReference Include="..\BPASmartClient.ViewModel\BPASmartClient.ViewModel.csproj" />


+ 23
- 23
SmartClient.sln View File

@@ -96,8 +96,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTHQ", "B
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.DosingSystem", "DosingSystem\BPASmartClient.DosingSystem.csproj", "{4E0B01AD-CFD0-4BD5-BBE6-AD2A4183B4DB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTJuicer", "BPASmartClient.MorkTJuicer\BPASmartClient.MorkTJuicer.csproj", "{724087A3-E7E7-4494-B844-414FF5CD1D40}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.AGV", "BPASmartClient.AGV\BPASmartClient.AGV.csproj", "{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.IceMaker", "BPASmartClient.IceMaker\BPASmartClient.IceMaker.csproj", "{F61AC179-156D-4075-BFEB-355862231F48}"
@@ -116,6 +114,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestDemo", "TestDemo\TestDe
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.HubHelper", "BPASmartClient.HubHelper\BPASmartClient.HubHelper.csproj", "{099E047C-F40E-47A3-A5BA-81FC1500D5E8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkTSingle", "BPASmartClient.MorkTSingle\BPASmartClient.MorkTSingle.csproj", "{84B7D506-C720-4E67-A161-1E9A8E94B6EF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -890,26 +890,6 @@ Global
{4E0B01AD-CFD0-4BD5-BBE6-AD2A4183B4DB}.Release|x64.Build.0 = Release|Any CPU
{4E0B01AD-CFD0-4BD5-BBE6-AD2A4183B4DB}.Release|x86.ActiveCfg = Release|Any CPU
{4E0B01AD-CFD0-4BD5-BBE6-AD2A4183B4DB}.Release|x86.Build.0 = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Debug|Any CPU.Build.0 = Debug|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Debug|ARM.ActiveCfg = Debug|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Debug|ARM.Build.0 = Debug|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Debug|ARM64.Build.0 = Debug|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Debug|x64.ActiveCfg = Debug|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Debug|x64.Build.0 = Debug|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Debug|x86.ActiveCfg = Debug|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Debug|x86.Build.0 = Debug|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|Any CPU.ActiveCfg = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|Any CPU.Build.0 = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|ARM.ActiveCfg = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|ARM.Build.0 = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|ARM64.ActiveCfg = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|ARM64.Build.0 = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|x64.ActiveCfg = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|x64.Build.0 = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|x86.ActiveCfg = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|x86.Build.0 = Release|Any CPU
{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Debug|ARM.ActiveCfg = Debug|Any CPU
@@ -1090,6 +1070,26 @@ Global
{099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|x64.Build.0 = Release|Any CPU
{099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|x86.ActiveCfg = Release|Any CPU
{099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|x86.Build.0 = Release|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Debug|ARM.ActiveCfg = Debug|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Debug|ARM.Build.0 = Debug|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Debug|ARM64.Build.0 = Debug|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Debug|x64.ActiveCfg = Debug|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Debug|x64.Build.0 = Debug|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Debug|x86.ActiveCfg = Debug|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Debug|x86.Build.0 = Debug|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Release|Any CPU.Build.0 = Release|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Release|ARM.ActiveCfg = Release|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Release|ARM.Build.0 = Release|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Release|ARM64.ActiveCfg = Release|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Release|ARM64.Build.0 = Release|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Release|x64.ActiveCfg = Release|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Release|x64.Build.0 = Release|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Release|x86.ActiveCfg = Release|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1133,7 +1133,6 @@ Global
{C28A88B1-E449-484C-AC67-B5038FF2CA79} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD}
{00C17D87-A323-4A97-BC21-7039E55614DE} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
{4E0B01AD-CFD0-4BD5-BBE6-AD2A4183B4DB} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{724087A3-E7E7-4494-B844-414FF5CD1D40} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625}
{F61AC179-156D-4075-BFEB-355862231F48} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD}
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
@@ -1143,6 +1142,7 @@ Global
{E7168B03-68E5-4285-BB95-5660F877577A} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{A49E1C5A-9489-451C-9CE6-CEA586234B84} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{099E047C-F40E-47A3-A5BA-81FC1500D5E8} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625}
{84B7D506-C720-4E67-A161-1E9A8E94B6EF} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC}


Loading…
Cancel
Save