25'ten fazla konu seçemezsiniz
Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
|
- using BPASmartClient.DRCoffee;
-
- using BPA.Helper;
- using BPASmartClient.Model;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace BPASmartClient.DRCoffee
- {
- public class MorkCStatus : Singleton<MorkCStatus>
- {
- private DRCoffee_CoffeEndCookEvent coffeEndCook = new DRCoffee_CoffeEndCookEvent();
- private DateTime lastRefreshTime = DateTime.MinValue;
- /// <summary>
- /// 是否在线
- /// </summary>
- public bool OnLine { get { return DateTime.Now.Subtract(lastRefreshTime).TotalSeconds <= 3; } }
- /// <summary>
- /// 咖啡机状态
- /// </summary>
- public DrCoffeeStatus CoffeeStatus { get; set; }
- /// <summary>
- /// 应用状态
- /// </summary>
- public DrCoffeeAppStatus AppStatus { get; set; }
- /// <summary>
- /// 警告信息
- /// </summary>
- public DrCoffeeWarning Warning { get; set; }
- /// <summary>
- /// 故障信息
- /// </summary>
- public DrCoffeeFault Fault { get; set; }
-
- public bool CanDo
- {
- get
-
- {
- if (!OnLine)
- return false;
- if (Warning != DrCoffeeWarning.无警告)
- return false;
- if (Fault != DrCoffeeFault.无故障)
- return false;
- return true;
- }
- }
-
- /// <summary>
- /// 咖啡机状态解析
- /// </summary>
- /// <param name="package"></param>
- public void ProcessPackage(DrCoffeePackage package)
- {
- if (CoffeeStatus == DrCoffeeStatus.Running && package.Status != DrCoffeeStatus.Running)
- {
- CoffeeStatus = package.Status;
- coffeEndCook.Publish();
- }
- else
- {
- CoffeeStatus = package.Status;
- }
-
- AppStatus = package.ApplicationStatus;
- Warning = package.Warning;
- Fault = package.Fault;
-
- lastRefreshTime = DateTime.Now;
- }
- }
- }
|