|
- using BPA.Utility;
- using HBLConsole.Communication;
- using HBLConsole.Service;
- using HBLDevice.Coffee;
- using HBLDevice.ICChip;
- using HBLDevice.IceCream;
- using PropertyChanged;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using HBLConsole.Service;
-
- namespace HBLConsole.Debug
- {
- [AddINotifyPropertyChangedInterface]
- internal class ViewModel_MORKIC
- {
- public string RobotConnected { get; set; }
- public string IceCreamConnected { get; set; }
- public string CoffeeConnected { get; set; }
-
- public void SimCoffee()
- {
- Task.Run(new Action(() =>
- {
- ActionManage.GetInstance.Send("SimCoffee", (DrCoffeeDrinksCode)Enum.Parse(typeof(DrCoffeeDrinksCode), SelectedCoffee));
- }));
-
- }
-
- public void SimIceCream()
- {
- ActionManage.GetInstance.Send("SimIceCream");
- }
-
- #region 咖啡机
- /// <summary>
- /// 咖啡机状态
- /// </summary>
- public DrCoffeeStatus CoffeeStatus { get; set; }
- /// <summary>
- /// 应用状态
- /// </summary>
- public DrCoffeeAppStatus AppStatus { get; set; }
- public DrCoffeeWarning Warning { get; set; }
- /// <summary>
- /// 故障信息
- /// </summary>
- public DrCoffeeFault CaffeeFault { get; set; }
-
- public List<string> Coffees { get; set; } = new List<string>();
- public string SelectedCoffee { get; set; }
-
- public List<string> CoffeeCmds { get; set; } = new List<string>();
- public string SelectedCoffeeCmd { get; set; }
- #endregion
-
- #region 冰淇淋
- ///// <summary>
- ///// 预冷温度
- ///// </summary>
- //public short YLWD { get; set; }
- ///// <summary>
- ///// 回气温度
- ///// </summary>
- //public short HQWD { get; set; }
- ///// <summary>
- ///// 环境温度
- ///// </summary>
- //public short HJWD { get; set; }
- ///// <summary>
- ///// 电流
- ///// </summary>
- //public short DL { get; set; }
- ///// <summary>
- ///// 电压
- ///// </summary>
- //public short DY { get; set; }
- ///// <summary>
- ///// 当前模式
- ///// </summary>
- //public MORKI_MODE CurrentMode { get; set; }
- ///// <summary>
- ///// 故障
- ///// </summary>
- //public MORKI_FAULT IceCreamFault { get; set; }
- ///// <summary>
- ///// 成型比
- ///// </summary>
- //public byte CXB { get; set; }
- ///// <summary>
- ///// 打料完成状态
- ///// </summary>
- //public string DLCompleted { get; set; }
-
- public string HasArticle { get; set; }
- public byte ArticleDist { get; set; } = 0;
-
- public List<string> IceCreamModes { get; set; } = new List<string>();
- public string SelecteIceCreamdMode { get; set; }
- #endregion
-
- public ViewModel_MORKIC()
- {
- foreach (DrCoffeeDrinksCode code in Enum.GetValues(typeof(DrCoffeeDrinksCode)))
- {
- Coffees.Add(code.ToString());
- }
- SelectedCoffee = Coffees[0];
- foreach (DrCoffeeCommCmd code in Enum.GetValues(typeof(DrCoffeeCommCmd)))
- {
- CoffeeCmds.Add(code.ToString());
- }
- SelectedCoffeeCmd = CoffeeCmds[0];
-
- foreach (MORKI_MODE code in Enum.GetValues(typeof(MORKI_MODE)))
- {
- IceCreamModes.Add(code.ToString());
- }
- SelecteIceCreamdMode = IceCreamModes[0];
-
-
-
- ThreadManage.GetInstance.StartLong(new Action(() =>
- {
- RobotConnected = LebaiHelper.GetInstance.IsConnected ? "已连接" : "未连接";
- IceCreamConnected = ChipStatus.GetInstance().OnLine ? "已连接" : "未连接";
- CoffeeConnected = MorkCStatus.GetInstance().OnLine ? "已连接" : "未连接";
-
-
-
- CoffeeStatus = MorkCStatus.GetInstance().CoffeeStatus;
- AppStatus = MorkCStatus.GetInstance().AppStatus;
- Warning = MorkCStatus.GetInstance().Warning;
- CaffeeFault = MorkCStatus.GetInstance().Fault;
-
- //YLWD = MorkIStatus.GetInstance().YLWD;
- //HQWD = MorkIStatus.GetInstance().HQWD;
- //HJWD = MorkIStatus.GetInstance().HJWD;
- //DL = MorkIStatus.GetInstance().DL;
- //DY = MorkIStatus.GetInstance().DY;
- //CurrentMode = MorkIStatus.GetInstance().CurrentMode;
- //IceCreamFault = MorkIStatus.GetInstance().Fault;
- //CXB = MorkIStatus.GetInstance().CXB;
- //DLCompleted = MorkIStatus.GetInstance().DLCompleted ? "打料完成" : "打料中";
-
- HasArticle = ChipStatus.GetInstance().ArticleExits ? "存在" : "无";
- ArticleDist = ChipStatus.GetInstance().ArticleDist;
- Thread.Sleep(500);
- }), "MORK IC-状态刷新");
- }
-
- public void MakeIceCream()
- {
- DischargeEvent dischargeEvent = new DischargeEvent();
- dischargeEvent.Publish();
- }
-
- public void SetIceCreamModel()
- {
- ModeSetEvent modeSetEvent = new ModeSetEvent();
- modeSetEvent.Mode = (MORKI_MODE)Enum.Parse(typeof(MORKI_MODE), SelecteIceCreamdMode);
- modeSetEvent.Publish();
- }
-
- public void MakeCoffee()
- {
- new MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)Enum.Parse(typeof(DrCoffeeDrinksCode), SelectedCoffee) }.Publish();
- }
-
- public void StopMakeCoffee()
- {
- new CancelMakeCoffeeEvent().Publish();
- }
-
- public void SetCoffeeModel()
- {
- new CoffeeCommCmdEvent() { CommCmd = (DrCoffeeCommCmd)Enum.Parse(typeof(DrCoffeeCommCmd), SelectedCoffeeCmd) }.Publish();
- }
-
- public void OpenSE1()
- {
- new SESwitchCreamEvent() { SteeringEngine = IC_SE.SE_1, IsOpen = true }.Publish();
- }
-
- public void CloseSE1()
- {
- new SESwitchCreamEvent() { SteeringEngine = IC_SE.SE_1, IsOpen = false }.Publish();
- }
-
- public void OpenSE2()
- {
- new SESwitchCreamEvent() { SteeringEngine = IC_SE.SE_2, IsOpen = true }.Publish();
-
- }
-
- public void CloseSE2()
- {
- new SESwitchCreamEvent() { SteeringEngine = IC_SE.SE_2, IsOpen = false }.Publish();
-
- }
-
- public void OpenSE3()
- {
- new SESwitchCreamEvent() { SteeringEngine = IC_SE.SE_3, IsOpen = true }.Publish();
-
- }
-
- public void CloseSE3()
- {
- new SESwitchCreamEvent() { SteeringEngine = IC_SE.SE_3, IsOpen = false }.Publish();
-
- }
-
- public void TurnRoll()
- {
- new RotorSwitchEvent() { TurnOn = true }.Publish();
- }
-
- public void StopTurnRoll()
- {
- new RotorSwitchEvent() { TurnOn = false }.Publish();
- }
-
- public void MakeIceCreamBySE1()
- {
- new MakeIceCreamEvent() { SteeringEngine = IC_SE.SE_1 }.Publish();
- }
-
- public void DoHasArticle()
- {
- new ArticleExitsEvent().Publish();
- }
-
- public void DoArticleDist()
- {
- new ArticleDistEvent().Publish();
- }
- }
- }
|