diff --git a/BPASmartClient.Business/Plugin/OrderProxy.cs b/BPASmartClient.Business/Plugin/OrderProxy.cs index 8b2611ae..3622772c 100644 --- a/BPASmartClient.Business/Plugin/OrderProxy.cs +++ b/BPASmartClient.Business/Plugin/OrderProxy.cs @@ -111,7 +111,7 @@ namespace BPASmartClient.Business var device = deviceMgr.GetDevices().FirstOrDefault(p => p.DeviceId == deviceId); while (running) { - if (device.IsBusy || !device.IsHealth) + if (device.IsBusy /*|| !device.IsHealth*/) { Thread.Sleep(100); continue; diff --git a/BPASmartClient.DRCoffee/CoffeeMachine.cs b/BPASmartClient.DRCoffee/CoffeeMachine.cs index d0cd6a9b..af8b0b66 100644 --- a/BPASmartClient.DRCoffee/CoffeeMachine.cs +++ b/BPASmartClient.DRCoffee/CoffeeMachine.cs @@ -38,6 +38,9 @@ namespace BPASmartClient.DRCoffee /// 是否在线 /// public bool OnLine { get { return DateTime.Now.Subtract(lastRefreshTime).TotalSeconds <= 3; } } + + //private volatile static CoffeeMachine _Instance; + //public static CoffeeMachine GetInstance => _Instance ?? (_Instance = new CoffeeMachine()); public CoffeeMachine() { DrCoffeePackage package = new DrCoffeePackage(); @@ -100,6 +103,7 @@ namespace BPASmartClient.DRCoffee //一系列解包 while (dataStorage.GetSize() > 0) { + byte item = dataStorage.GetData(); if (DrCoffee.HEADER == item) { @@ -137,9 +141,11 @@ namespace BPASmartClient.DRCoffee /// public void ProcessPackage(DrCoffeePackage package) { + if (((DrCoffeeStatus)status["Status"]) == DrCoffeeStatus.Running && package.Status != DrCoffeeStatus.Running) { status["Status"] = package.Status; + lastRefreshTime = DateTime.Now; new DRCoffee_CoffeEndCookEvent() { DeviceId = DeviceId }.Publish(); } @@ -147,7 +153,7 @@ namespace BPASmartClient.DRCoffee status["AppStatus"] = package.ApplicationStatus; status["Warning"] = package.Warning; status["Fault"] = package.Fault; - + if ((DrCoffeeStatus)status["Status"] == DrCoffeeStatus.Warning || (DrCoffeeStatus)status["Status"] == DrCoffeeStatus.Fault || (DrCoffeeWarning)status["Warning"] != DrCoffeeWarning.无警告 @@ -155,9 +161,10 @@ namespace BPASmartClient.DRCoffee ) { IsWork = false; + } else - IsWork = true; + IsWork = true; } protected override void InitStatus() @@ -229,6 +236,8 @@ namespace BPASmartClient.DRCoffee } }); InitStatus(); + //测试 + Start(); } } diff --git a/BPASmartClient.Device/BaseDevice.cs b/BPASmartClient.Device/BaseDevice.cs index b6b2f590..5bad77e9 100644 --- a/BPASmartClient.Device/BaseDevice.cs +++ b/BPASmartClient.Device/BaseDevice.cs @@ -129,7 +129,6 @@ namespace BPASmartClient.Device { p.DeviceId = this.DeviceId; p.Init(); - }); this.peripherals = peripherals; } diff --git a/BPASmartClient.GSIceCream/IceCreamMachine.cs b/BPASmartClient.GSIceCream/IceCreamMachine.cs index 3f62577b..49f97a36 100644 --- a/BPASmartClient.GSIceCream/IceCreamMachine.cs +++ b/BPASmartClient.GSIceCream/IceCreamMachine.cs @@ -32,7 +32,8 @@ namespace BPASmartClient.GSIceCream private DateTime lastRefreshTime = DateTime.MinValue; //是否在线 public bool OnLine { get { return DateTime.Now.Subtract(lastRefreshTime).TotalSeconds <= 3; } } - + //private volatile static IceCreamMachine _Instance; + //public static IceCreamMachine GetInstance => _Instance ?? (_Instance = new IceCreamMachine()); public IceCreamMachine() { ICMSG_Heart_DW heartDW = new ICMSG_Heart_DW(); @@ -330,6 +331,8 @@ namespace BPASmartClient.GSIceCream } }); InitStatus(); + //测试用 + Start(); } } diff --git a/BPASmartClient.Lebai/BPASmartClient.Lebai.csproj b/BPASmartClient.Lebai/BPASmartClient.Lebai.csproj index c1df8931..c39fa1e5 100644 --- a/BPASmartClient.Lebai/BPASmartClient.Lebai.csproj +++ b/BPASmartClient.Lebai/BPASmartClient.Lebai.csproj @@ -9,6 +9,7 @@ + diff --git a/BPASmartClient.Lebai/LebaiRobot.cs b/BPASmartClient.Lebai/LebaiRobot.cs index d65041b9..f5a72406 100644 --- a/BPASmartClient.Lebai/LebaiRobot.cs +++ b/BPASmartClient.Lebai/LebaiRobot.cs @@ -14,71 +14,17 @@ using BPASmartClient.Peripheral; using BPASmartClient.EventBus; using static BPASmartClient.EventBus.EventBus; using BPASmartClient.Model; +using BPASmartClient.LebaiRobot; namespace BPASmartClient.Lebai { public class LebaiRobot: BasePeripheral { - //public const int SENCE_自嗨 = 10008; - //public const int SENCE_接冰淇淋1 = 10004; - //public const int SENCE_接冰淇淋2 = 10003; - //public const int SENCE_接冰淇淋3 = 10005; - //public const int SENCE_咖啡 = 10006; - //#region 新增场景 - //public const int SENCE_取咖啡杯 = 10013; - //public const int SENCE_咖啡杯检测 = 10014; - //public const int SENCE_再次取杯 = 10017; - //public const int SENCE_接咖啡 = 10015; - //public const int SENCE_送咖啡 = 10016; //无取走咖啡检测配合场景 - //public const int SENCE_New送咖啡 = 10021;//有取走咖啡检测配合场景 - //public const int SENCE_有无咖啡检测 = 10019; - //public const int SENCE_再送咖啡 = 10020; - //public const int SENCE_复位 = 10018; - //#endregion - //public const int SENCE_欢迎 = 10002; - - - #region 且时且多设备 - //取咖啡杯 set:=1 get:=101 10031 - //取冰淇淋杯 set:=1 get:=101 10032 - //咖啡杯检测 set:=1 get:=101 10033 - //冰淇淋杯检测 set:=1 get:=101 10034 - //二次取咖啡杯 set:=1 get:=101 10035 - //二次取冰淇淋杯 set:=1 get:=101 10036 - //接咖啡 set:=1 get:=101 10037 - //接冰淇淋公共点 set:=1 get:=101 10038 - //接1号冰淇淋 set:=1 get:=101 10039 - //接2号冰淇淋 set:=1 get:=101 10040 - //接3号冰淇淋 set:=1 get:=101 10041 - //放咖啡位置 set:=1 get:=101 10042 - //放冰淇淋位置 set:=1 get:=101 10043 - - public const int SENCE_取咖啡杯 = 10031; - public const int SENCE_取冰淇淋杯 = 10032; - public const int SENCE_咖啡杯检测 = 10033; - public const int SENCE_冰淇淋杯检测 = 10034; - public const int SENCE_二次取咖啡杯 = 10035; - public const int SENCE_二次取冰淇淋杯 = 10036; - public const int SENCE_接咖啡 = 10037; - public const int SENCE_接冰淇淋公共点 = 10038; - public const int SENCE_接1号冰淇淋 = 10039; - public const int SENCE_接2号冰淇淋 = 10040; - public const int SENCE_接3号冰淇淋 = 10041; - public const int SENCE_放咖啡位置 = 10042; - public const int SENCE_放冰淇淋位置 = 10043; - - //add 新加场景 - public const int SENCE_接咖啡后回原点 = 10051; - public const int SENCE_咖啡杯回原点 = 10050; - public const int SENCE_冰淇淋杯回原点 = 10049; - public const int SENCE_取咖啡出餐 = 10052; - #endregion - /// /// IP地址 /// - public string IpAddress { get; set; } + public string IpAddress { get; set; } = "192.168.0.1"; /// /// 抓手上传感器输入位索引 /// @@ -88,281 +34,6 @@ namespace BPASmartClient.Lebai /// public int OutputSingalValue { get; set; } - - private volatile static LebaiRobot _Instance; - public static LebaiRobot GetInstance => _Instance ?? (_Instance = new LebaiRobot()); - private LebaiRobot() { } - private LebaiRobotClient client; - private RobotData robotData; - public bool IsIdle { get; set; } = false; - public bool IsConnected { get { return null != robotData; } } - - public void Connect(string ip) - { - bool ErrorFlag = false; - while (robotData == null) - { - try - { - client = new LebaiRobotClient(ip); - robotData = client.GetRobotData().Result; - } - catch (Exception ex) - { - if (!ErrorFlag) - { - MessageLog.GetInstance.ShowEx(ex.ToString()); - ErrorFlag = true; - } - Thread.Sleep(3000); - } - } - StartRobot(); - MessageLog.GetInstance.Show("乐百机器人连接成功!"); - } - /// - /// 机器人重连检测 - /// - /// - public void Reconnect(string ip) - { - if (client == null) - { - try - { - client = new LebaiRobotClient(ip); - } - catch (Exception) - { - - // throw; - } - } - check: - while (robotData != null) - { - - try - { - robotData = client.GetRobotData().Result; - } - catch (Exception) - { - robotData = null; - // throw; - } - } - MessageLog.GetInstance.Show("乐白机器人断开连接,准备重连"); - int num = 0; - while (num < 6 && robotData == null) - { - try - { - - robotData = client.GetRobotData().Result; - } - catch (Exception ex) - { - if (num == 5) - { - MessageLog.GetInstance.ShowEx(ex.ToString()); - } - } - - if (num < 5 && robotData == null) - { - Thread.Sleep(1000); - MessageLog.GetInstance.Show($"乐白机器人正在尝试第{num + 1}次重连...."); - } - else if (num >= 5 && robotData == null) - { - MessageLog.GetInstance.Show("乐白机器人重连失败,请检查硬件连接"); - //return; - } - num++; - } - if (robotData != null) - { - StartRobot(); - MessageLog.GetInstance.Show("乐白机器人重连成功"); - } - goto check; - } - - public void GetRobotModeStatus() - { - - if (robotData == null) return; - int mode = robotData.RobotMode.Mode; - IsIdle = mode == 5; - for (int i = 0; i < 14; i++) - { - if (RTrig.GetInstance(((ELebaiRModel)i).ToString()).Start(mode == i)) - MessageLog.GetInstance.Show(((ELebaiRModel)i).ToString()); - } - } - public void GetSpeed() - { - //client.StartSys().GetAwaiter(); - var aa = client.GetActualTcpSpeed().GetAwaiter(); - //robotData.RobotMode.Mode - } - - /// - /// 启动机器人 - /// - public async void StartRobot() - { - if (robotData != null) - { - await client.StartSys(); - await client.Sync(); - MessageLog.GetInstance.Show("机器人启动成功"); - } - } - - /// - /// 启动示教 - /// - public async void StartTeachMode() - { - try - { - if (robotData != null) - { - await client.TeachMode(); - MessageLog.GetInstance.Show("机器人切换为示教模式."); - } - } - catch (Exception ex) - { - MessageLog.GetInstance.ShowEx(ex.ToString()); - } - } - - /// - /// 结束示教 - /// - public async void EndtTeachMode() - { - try - { - if (robotData != null) - { - await client.EndTeachMode(); - MessageLog.GetInstance.Show("机器人切换为停止示教模式."); - } - } - catch (Exception ex) - { - MessageLog.GetInstance.ShowEx(ex.ToString()); - } - } - - /// - /// 机器人急停 - /// - public async void EStopRobot() - { - try - { - if (robotData != null) - { - await client.EStop(); - MessageLog.GetInstance.Show("机器人急停"); - } - } - catch (Exception ex) - { - MessageLog.GetInstance.ShowEx(ex.ToString()); - } - } - - /// - /// 获取抓手重量 - /// - /// - public double GetClawWdight() - { - if (robotData != null) - { - return client.GetClawWeight().Result.Weight_; - } - return 0; - } - - /// - /// 获取信号量 - /// - /// - /// - public SignalResult? GetValueAsync(int index = 0) - { - if (robotData == null) return default(SignalResult); - SignalValue signalValue = new SignalValue(); - signalValue.Index = index; - return client?.GetSignal(signalValue).Result; - } - - /// - /// 设置信号量 - /// - /// - /// - /// - public SignalResult? SetValue(int value, int index = 0) - { - if (robotData == null) return default; - SignalValue signalValue = new SignalValue(); - signalValue.Index = index; - signalValue.Value = value; - return client.SetSignal(signalValue).Result; - } - - /// - /// 获取输入DI状态 - /// - /// - /// - public bool GetInput(int pin = 0) - { - if (client == null) return false; - var res = client.GetDIO(new IOPin() { Pin = pin }).Result; - if (res != null) - { - return res.Value == 1 ? true : false; - } - return false; - } - - /// - /// 运行指定的场景 - /// - /// - public async void Scene(int id) - { - CancellationToken cancellationToken = default(CancellationToken); - var result = await client.GetTasks(new GetTasksInput { PageIndex = 1, PageSize = 1 }, cancellationToken); - var first = result?.Items?.FirstOrDefault(); - var r = first == null || first.Status != TaskStatus.Running && first.Status != TaskStatus.Pause; - while (!r) - { - Thread.Sleep(5); - result = await client.GetTasks(new GetTasksInput { PageIndex = 1, PageSize = 1 }, cancellationToken); - first = result?.Items?.FirstOrDefault(); - r = first == null || first.Status != TaskStatus.Running && first.Status != TaskStatus.Pause; - } - while (GetValueAsync().Value != 0) - { - Thread.Sleep(500); - } - Thread.Sleep(1000); - if (robotData == null || client == null) return; - //if (!client.GetIsCanRunTask().Result) return; - await client?.RunScene(id); - MessageLog.GetInstance.Show($"调用场景:{id}"); - } - protected override void InitStatus() { status["Connected"] = false; @@ -372,12 +43,18 @@ namespace BPASmartClient.Lebai public override void Start() { - Connect(IpAddress); - + LebaiHelper.GetInstance().Connect(IpAddress); + ThreadManage.GetInstance().StartLong(() => { LebaiHelper.GetInstance().Reconnect(IpAddress); Thread.Sleep(5000); }, "机器人重连检测"); + ThreadManage.GetInstance().StartLong(() => + { + status["Connected"] = LebaiHelper.GetInstance().IsConnected; + if (LebaiHelper.GetInstance().robotData != null) status["RobotMode"] = LebaiHelper.GetInstance().robotData.RobotMode.Mode; + },"获取乐白机器人数据"); } public override void Stop() { + } public override void Init() @@ -387,6 +64,9 @@ namespace BPASmartClient.Lebai }); InitStatus(); + Start(); } + + } } diff --git a/BPASmartClient.LebaiRobot/BPASmartClient.LebaiRobot.csproj b/BPASmartClient.LebaiRobot/BPASmartClient.LebaiRobot.csproj new file mode 100644 index 00000000..1ce18eb6 --- /dev/null +++ b/BPASmartClient.LebaiRobot/BPASmartClient.LebaiRobot.csproj @@ -0,0 +1,15 @@ + + + + net6.0 + enable + enable + + + + + + + + + diff --git a/BPASmartClient.Lebai/ELebaiRModel.cs b/BPASmartClient.LebaiRobot/ELebaiRModel.cs similarity index 93% rename from BPASmartClient.Lebai/ELebaiRModel.cs rename to BPASmartClient.LebaiRobot/ELebaiRModel.cs index acec6be9..3f0b1a52 100644 --- a/BPASmartClient.Lebai/ELebaiRModel.cs +++ b/BPASmartClient.LebaiRobot/ELebaiRModel.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BPASmartClient.Lebai +namespace BPASmartClient.LebaiRobot { public enum ELebaiRModel : int { diff --git a/BPASmartClient.LebaiRobot/LebaiHelper.cs b/BPASmartClient.LebaiRobot/LebaiHelper.cs new file mode 100644 index 00000000..64790e8c --- /dev/null +++ b/BPASmartClient.LebaiRobot/LebaiHelper.cs @@ -0,0 +1,333 @@ +using BPASmartClient.Helper; +using BPASmartClient.Message; +using BPASmartClient.Model; +using Lebai.SDK; +using Lebai.SDK.Dtos; +using Robotc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using TaskStatus = Lebai.SDK.Dtos.TaskStatus; + +namespace BPASmartClient.LebaiRobot +{ + public class LebaiHelper:Singleton + { + + #region 且时且多设备 + //取咖啡杯 set:=1 get:=101 10031 + //取冰淇淋杯 set:=1 get:=101 10032 + //咖啡杯检测 set:=1 get:=101 10033 + //冰淇淋杯检测 set:=1 get:=101 10034 + //二次取咖啡杯 set:=1 get:=101 10035 + //二次取冰淇淋杯 set:=1 get:=101 10036 + //接咖啡 set:=1 get:=101 10037 + //接冰淇淋公共点 set:=1 get:=101 10038 + //接1号冰淇淋 set:=1 get:=101 10039 + //接2号冰淇淋 set:=1 get:=101 10040 + //接3号冰淇淋 set:=1 get:=101 10041 + //放咖啡位置 set:=1 get:=101 10042 + //放冰淇淋位置 set:=1 get:=101 10043 + + public const int SENCE_取咖啡杯 = 10031; + public const int SENCE_取冰淇淋杯 = 10032; + public const int SENCE_咖啡杯检测 = 10033; + public const int SENCE_冰淇淋杯检测 = 10034; + public const int SENCE_二次取咖啡杯 = 10035; + public const int SENCE_二次取冰淇淋杯 = 10036; + public const int SENCE_接咖啡 = 10037; + public const int SENCE_接冰淇淋公共点 = 10038; + public const int SENCE_接1号冰淇淋 = 10039; + public const int SENCE_接2号冰淇淋 = 10040; + public const int SENCE_接3号冰淇淋 = 10041; + public const int SENCE_放咖啡位置 = 10042; + public const int SENCE_放冰淇淋位置 = 10043; + + //add 新加场景 + public const int SENCE_接咖啡后回原点 = 10051; + public const int SENCE_咖啡杯回原点 = 10050; + public const int SENCE_冰淇淋杯回原点 = 10049; + public const int SENCE_取咖啡出餐 = 10052; + #endregion + + + + + private LebaiRobotClient client; + public RobotData robotData; + public bool IsIdle { get; set; } = false; + public bool IsConnected { get { return null != robotData; } } + public void Connect(string ip) + { + MessageLog.GetInstance.Show($"机器人IP地址:{ip}"); + bool ErrorFlag = false; + while (robotData == null) + { + try + { + client = new LebaiRobotClient(ip); + robotData = client.GetRobotData().Result; + ActionManage.GetInstance.Send("乐白机器人数据"); + } + catch (Exception ex) + { + if (!ErrorFlag) + { + MessageLog.GetInstance.ShowEx(ex.ToString()); + ErrorFlag = true; + } + Thread.Sleep(3000); + } + } + StartRobot(); + + MessageLog.GetInstance.Show("乐百机器人连接成功!"); + } + /// + /// 机器人重连检测 + /// + /// + public void Reconnect(string ip) + { + if (client == null) + { + try + { + client = new LebaiRobotClient(ip); + } + catch (Exception) + { + + // throw; + } + } + check: + while (robotData != null) + { + + try + { + robotData = client.GetRobotData().Result; } + catch (Exception) + { + robotData = null; + // throw; + } + } + MessageLog.GetInstance.Show("乐白机器人断开连接,准备重连"); + int num = 0; + while (num < 6 && robotData == null) + { + try + { + robotData = client.GetRobotData().Result; + } + catch (Exception ex) + { + if (num == 5) + { + MessageLog.GetInstance.ShowEx(ex.ToString()); + } + } + + if (num < 5 && robotData == null) + { + Thread.Sleep(1000); + MessageLog.GetInstance.Show($"乐白机器人正在尝试第{num + 1}次重连...."); + } + else if (num >= 5 && robotData == null) + { + MessageLog.GetInstance.Show("乐白机器人重连失败,请检查硬件连接"); + //return; + } + num++; + } + if (robotData != null) + { + StartRobot(); + MessageLog.GetInstance.Show("乐白机器人重连成功"); + } + goto check; + } + + public void GetRobotModeStatus() + { + if (robotData == null) + { + + return; + } + int mode = robotData.RobotMode.Mode; + IsIdle = mode == 5; + + for (int i = 0; i < 14; i++) + { + if (RTrig.GetInstance(((ELebaiRModel)i).ToString()).Start(mode == i)) + MessageLog.GetInstance.Show(((ELebaiRModel)i).ToString()); + } + + } + public void GetSpeed() + { + //client.StartSys().GetAwaiter(); + var aa = client.GetActualTcpSpeed().GetAwaiter(); + //robotData.RobotMode.Mode + } + + /// + /// 启动机器人 + /// + public async void StartRobot() + { + if (robotData != null) + { + await client.StartSys(); + await client.Sync(); + MessageLog.GetInstance.Show("机器人启动成功"); + } + } + + /// + /// 启动示教 + /// + public async void StartTeachMode() + { + try + { + if (robotData != null) + { + await client.TeachMode(); + MessageLog.GetInstance.Show("机器人切换为示教模式."); + } + } + catch (Exception ex) + { + MessageLog.GetInstance.ShowEx(ex.ToString()); + } + } + + /// + /// 结束示教 + /// + public async void EndtTeachMode() + { + try + { + if (robotData != null) + { + await client.EndTeachMode(); + MessageLog.GetInstance.Show("机器人切换为停止示教模式."); + } + } + catch (Exception ex) + { + MessageLog.GetInstance.ShowEx(ex.ToString()); + } + } + + /// + /// 机器人急停 + /// + public async void EStopRobot() + { + try + { + if (robotData != null) + { + await client.EStop(); + MessageLog.GetInstance.Show("机器人急停"); + } + } + catch (Exception ex) + { + MessageLog.GetInstance.ShowEx(ex.ToString()); + } + } + + /// + /// 获取抓手重量 + /// + /// + public double GetClawWdight() + { + if (robotData != null) + { + return client.GetClawWeight().Result.Weight_; + } + return 0; + } + + /// + /// 获取信号量 + /// + /// + /// + public SignalResult? GetValueAsync(int index = 0) + { + if (robotData == null) return default(SignalResult); + SignalValue signalValue = new SignalValue(); + signalValue.Index = index; + return client?.GetSignal(signalValue).Result; + } + + /// + /// 设置信号量 + /// + /// + /// + /// + public SignalResult? SetValue(int value, int index = 0) + { + if (robotData == null) return default; + SignalValue signalValue = new SignalValue(); + signalValue.Index = index; + signalValue.Value = value; + return client.SetSignal(signalValue).Result; + } + + /// + /// 获取输入DI状态 + /// + /// + /// + public bool GetInput(int pin = 0) + { + if (client == null) return false; + var res = client.GetDIO(new IOPin() { Pin = pin }).Result; + if (res != null) + { + return res.Value == 1 ? true : false; + } + return false; + } + + /// + /// 运行指定的场景 + /// + /// + public async void Scene(int id) + { + CancellationToken cancellationToken = default(CancellationToken); + var result = await client.GetTasks(new GetTasksInput { PageIndex = 1, PageSize = 1 }, cancellationToken); + var first = result?.Items?.FirstOrDefault(); + var r = first == null || first.Status != Lebai.SDK.Dtos.TaskStatus.Running && first.Status != TaskStatus.Pause; + while (!r) + { + Thread.Sleep(5); + result = await client.GetTasks(new GetTasksInput { PageIndex = 1, PageSize = 1 }, cancellationToken); + first = result?.Items?.FirstOrDefault(); + r = first == null || first.Status != Lebai.SDK.Dtos.TaskStatus.Running && first.Status != Lebai.SDK.Dtos.TaskStatus.Pause; + } + while (GetValueAsync().Value != 0) + { + Thread.Sleep(500); + } + Thread.Sleep(1000); + if (robotData == null || client == null) return; + //if (!client.GetIsCanRunTask().Result) return; + await client?.RunScene(id); + MessageLog.GetInstance.Show($"调用场景:{id}"); + } + } +} diff --git a/BPASmartClient.MorkT/Control_MorkT.cs b/BPASmartClient.MorkT/Control_MorkT.cs index 09a87c9a..e91d9626 100644 --- a/BPASmartClient.MorkT/Control_MorkT.cs +++ b/BPASmartClient.MorkT/Control_MorkT.cs @@ -2,7 +2,9 @@ using BPASmartClient.Device; using BPASmartClient.EventBus; using BPASmartClient.GSIceCream; +using BPASmartClient.Helper; using BPASmartClient.Lebai; +using BPASmartClient.LebaiRobot; using BPASmartClient.Message; using BPASmartClient.Model; using BPASmartClient.Model.冰淇淋.Enum; @@ -25,9 +27,9 @@ namespace BPASmartClient.MorkT GLV_MorkT morkT = new GLV_MorkT(); - public override void DoMain() { + IsHealth = true; ServerInit(); DataParse(); EventBus.EventBus.GetInstance().Subscribe(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) @@ -35,7 +37,30 @@ namespace BPASmartClient.MorkT if (morkT.MakeCoffeeOrder != null) morkT.MakeCoffeeOrder.OrderStatus = 1; }); + + ActionManage.GetInstance.Register(new Action((o) => + { + switch (o) + { + case "机器人启动": + LebaiHelper.GetInstance().StartRobot(); + break; + case "启动示教": + LebaiHelper.GetInstance().StartTeachMode(); + break; + case "停止示教": + LebaiHelper.GetInstance().EndtTeachMode(); + break; + case "机器人急停": + LebaiHelper.GetInstance().EStopRobot(); + break; + default: + break; + } + }),"调试控制-机器人控制"); + MessageLog.GetInstance.Show("MORKT 设备初始化完成"); + } public override void ResetProgram() @@ -47,7 +72,7 @@ namespace BPASmartClient.MorkT public override void MainTask() { MakeCoffeeProcess(); - if(!LebaiRobot.GetInstance.GetInput())//取餐口有空余位置 + if(!LebaiHelper.GetInstance().GetInput())//取餐口有空余位置 { MakeIceCreamProcess(); MakeCoffeeComplete(); @@ -56,8 +81,8 @@ namespace BPASmartClient.MorkT public override void ReadData() { - morkT.lebai = LebaiRobot.GetInstance.GetValueAsync(); - LebaiRobot.GetInstance.GetRobotModeStatus(); + morkT.lebai = LebaiHelper.GetInstance().GetValueAsync(); + LebaiHelper.GetInstance().GetRobotModeStatus(); } @@ -211,9 +236,9 @@ namespace BPASmartClient.MorkT { DeviceProcessLogShow($"开始制作 [咖啡] 订单[{orderLoc.SortNum}]"); GetAndCheeckCoffe(orderLoc); - LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_接咖啡后回原点);//把咖啡杯放到咖啡机机的位置后回原点 + LebaiHelper.GetInstance().Scene(LebaiHelper.SENCE_接咖啡后回原点);//把咖啡杯放到咖啡机机的位置后回原点 Wait(); - LebaiRobot.GetInstance.SetValue(1); + LebaiHelper.GetInstance().SetValue(1); new DRCoffee_MakeCoffeeEvent() { DrinkCode = (Model.咖啡机.Enum.DrCoffeeDrinksCode)int.Parse(orderLoc.Loc) }.Publish(); //接咖啡控制 DeviceProcessLogShow($"发送咖啡机制作{orderLoc.Loc}!"); morkT.IsCoffeeMake = true; morkT.MakeCoffeeOrder = orderLoc; @@ -246,9 +271,9 @@ namespace BPASmartClient.MorkT /// private void DoCoffeeQC(OrderLocInfo order) { - LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_取咖啡出餐); + LebaiHelper.GetInstance().Scene(LebaiHelper.SENCE_取咖啡出餐); Wait(); - LebaiRobot.GetInstance.SetValue(1); + LebaiHelper.GetInstance().SetValue(1); //订单状态改变:完成 OrderChange(order.SuborderId, ORDER_STATUS.COMPLETED_COOK); DeviceProcessLogShow($"{order.GoodsName}等待取餐"); @@ -262,36 +287,36 @@ namespace BPASmartClient.MorkT /// private void GetAndCheeckCoffe(OrderLocInfo order) { - LebaiRobot.GetInstance.SetValue(0); + LebaiHelper.GetInstance().SetValue(0); OrderChange(order.SuborderId, ORDER_STATUS.COOKING); - LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_取咖啡杯); + LebaiHelper.GetInstance().Scene(LebaiHelper.SENCE_取咖啡杯); Wait(); new SCChip_TakeCupEvent() { Cup = IC_CUP.CUP_COFFEE }.Publish();//落碗控制 Thread.Sleep(500); DeviceProcessLogShow("尝试取咖啡杯!"); - LebaiRobot.GetInstance.SetValue(1); + LebaiHelper.GetInstance().SetValue(1); int count = 2; p: - LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_咖啡杯检测); + LebaiHelper.GetInstance().Scene(LebaiHelper.SENCE_咖啡杯检测); Wait(); - LebaiRobot.GetInstance.SetValue(1); + LebaiHelper.GetInstance().SetValue(1); - if (!LebaiRobot.GetInstance.GetInput()) + if (!LebaiHelper.GetInstance().GetInput()) { if (count >= 3) { //退出循环回到初始位置 DeviceProcessLogShow($"执行{count}次取咖啡杯,仍为成功,订单默认废弃,机器人回到初始位置!"); - LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_咖啡杯回原点); + LebaiHelper.GetInstance().Scene(LebaiHelper.SENCE_咖啡杯回原点); Wait(); - LebaiRobot.GetInstance.SetValue(1); + LebaiHelper.GetInstance().SetValue(1); return; } DeviceProcessLogShow("执行二次取咖啡杯"); - LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_二次取咖啡杯); + LebaiHelper.GetInstance().Scene(LebaiHelper.SENCE_二次取咖啡杯); Wait(); new SCChip_TakeCupEvent() { Cup = IC_CUP.CUP_COFFEE }.Publish();//落碗控制 - LebaiRobot.GetInstance.SetValue(1); + LebaiHelper.GetInstance().SetValue(1); count++; goto p; } @@ -315,22 +340,29 @@ namespace BPASmartClient.MorkT { if (IceCreamCanMake()) { - if (MorkIStatus.GetInstance().CurrentMode != MORKI_MODE.制冷模式) new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish(); - if (MorkIStatus.GetInstance().CXB >= 86 && morkT.morkOrderPushesIceCream.Count > 0)//成型比大于86才可以制作 + if(Status.status.ContainsKey("CurrentMode")) { - if (LebaiRobot.GetInstance.GetInput(3)) - { - if (morkT.IceIsOK) DeviceProcessLogShow("请检查冰淇淋出料口有无遮挡"); - morkT.IceIsOK = false; + if ((MORKI_MODE)Status.status["CurrentMode"] != MORKI_MODE.制冷模式) new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish(); + } - } - else if (morkT.morkOrderPushesIceCream.TryDequeue(out OrderLocInfo order)) + if(Status.status.ContainsKey("CBX")) + { + if ((short)Status.status["CBX"] >= 86 && morkT.morkOrderPushesIceCream.Count > 0)//成型比大于86才可以制作 { - morkT.IceIsOK = true; - DeviceProcessLogShow($"开始制作 [冰淇淋] 订单[{order.SortNum}]"); - DoIceCream(order); + if (LebaiHelper.GetInstance().GetInput(3)) + { + if (morkT.IceIsOK) DeviceProcessLogShow("请检查冰淇淋出料口有无遮挡"); + morkT.IceIsOK = false; + } + else if (morkT.morkOrderPushesIceCream.TryDequeue(out OrderLocInfo order)) + { + morkT.IceIsOK = true; + DeviceProcessLogShow($"开始制作 [冰淇淋] 订单[{order.SortNum}]"); + DoIceCream(order); + } } } + } } @@ -351,8 +383,8 @@ namespace BPASmartClient.MorkT /// private void GetIceCreamCup() { - LebaiRobot.GetInstance.SetValue(0); - LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_取冰淇淋杯); + LebaiHelper.GetInstance().SetValue(0); + LebaiHelper.GetInstance().Scene(LebaiHelper.SENCE_取冰淇淋杯); Wait(); new SCChip_TakeCupEvent() { Cup = IC_CUP.CUP_ICECREAM }.Publish();//落碗控制 Thread.Sleep(500); @@ -366,27 +398,27 @@ namespace BPASmartClient.MorkT private void CheckICeCreaCup() { int count = 2; - LebaiRobot.GetInstance.SetValue(1); + LebaiHelper.GetInstance().SetValue(1); p: - LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_冰淇淋杯检测); + LebaiHelper.GetInstance().Scene(LebaiHelper.SENCE_冰淇淋杯检测); Wait(); - LebaiRobot.GetInstance.SetValue(1); - if (!LebaiRobot.GetInstance.GetInput()) + LebaiHelper.GetInstance().SetValue(1); + if (!LebaiHelper.GetInstance().GetInput()) { if (count >= 3) { //退出循环回到初始位置 DeviceProcessLogShow($"执行{count}次取冰淇淋杯,仍未成功,订单默认废弃,机器人回到初始位置!"); - LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_冰淇淋杯回原点); + LebaiHelper.GetInstance().Scene(LebaiHelper.SENCE_冰淇淋杯回原点); Wait(); - LebaiRobot.GetInstance.SetValue(1); + LebaiHelper.GetInstance().SetValue(1); return; } DeviceProcessLogShow($"执行{count}次取冰淇淋杯!"); - LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_二次取冰淇淋杯); + LebaiHelper.GetInstance().Scene(LebaiHelper.SENCE_二次取冰淇淋杯); new SCChip_TakeCupEvent() { Cup = IC_CUP.CUP_ICECREAM }.Publish();//落碗控制 Wait(); - LebaiRobot.GetInstance.SetValue(1); + LebaiHelper.GetInstance().SetValue(1); count++; goto p; } @@ -401,9 +433,9 @@ namespace BPASmartClient.MorkT { //制冷模式 new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish(); - LebaiRobot.GetInstance.SetValue(0); + LebaiHelper.GetInstance().SetValue(0); OrderChange(order.SuborderId, ORDER_STATUS.COOKING); - LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_接1号冰淇淋); + LebaiHelper.GetInstance().Scene(LebaiHelper.SENCE_接1号冰淇淋); Wait(); bool doItResult = true; //出料 @@ -418,7 +450,8 @@ namespace BPASmartClient.MorkT else { int count_1 = 0; - while (MorkIStatus.GetInstance().CXB <= 86) + + while ((short)Status.status["CBX"] <= 86) { Thread.Sleep(5); count_1++; @@ -427,7 +460,7 @@ namespace BPASmartClient.MorkT } IceCreamCookCheck(); } - LebaiRobot.GetInstance.SetValue(1); + LebaiHelper.GetInstance().SetValue(1); } /// @@ -436,13 +469,13 @@ namespace BPASmartClient.MorkT /// private void PutIceCream(OrderLocInfo order) { - while (LebaiRobot.GetInstance.GetInput()) + while (LebaiHelper.GetInstance().GetInput()) { Thread.Sleep(500); } - LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_放冰淇淋位置); + LebaiHelper.GetInstance().Scene(LebaiHelper.SENCE_放冰淇淋位置); Wait(); - LebaiRobot.GetInstance.SetValue(1); + LebaiHelper.GetInstance().SetValue(1); //订单状态改变:完成 OrderChange(order.SuborderId, ORDER_STATUS.COMPLETED_COOK); DeviceProcessLogShow($"{order.GoodsName}等待取餐"); @@ -457,7 +490,7 @@ namespace BPASmartClient.MorkT { int retry = 3; DateTime beginTime = DateTime.Now; - while (!LebaiRobot.GetInstance.GetInput(3)) + while (!LebaiHelper.GetInstance().GetInput(3)) { if (retry <= 0 && DateTime.Now.Subtract(beginTime).TotalSeconds >= 10) { diff --git a/BPASmartClient.MorkT/PolymerBatching.cs b/BPASmartClient.MorkT/PolymerBatching.cs index 79fd574d..b010b66a 100644 --- a/BPASmartClient.MorkT/PolymerBatching.cs +++ b/BPASmartClient.MorkT/PolymerBatching.cs @@ -1,5 +1,6 @@  using BPASmartClient.Lebai; +using BPASmartClient.LebaiRobot; using BPASmartClient.Model.单片机.Enum; using System; using System.Collections.Generic; @@ -102,19 +103,19 @@ namespace BPASmartClient.MorkT switch (loc) { case ICE_MAIN_BATCHIN1_LOC: - sence = LebaiRobot.SENCE_接1号冰淇淋; + sence = LebaiHelper.SENCE_接1号冰淇淋; return IC_SE.SE_1; case ICE_MAIN_BATCHIN2_LOC: - sence = LebaiRobot.SENCE_接2号冰淇淋; + sence = LebaiHelper.SENCE_接2号冰淇淋; return IC_SE.SE_2; case ICE_MAIN_BATCHIN3_LOC: - sence = LebaiRobot.SENCE_接3号冰淇淋; + sence = LebaiHelper.SENCE_接3号冰淇淋; return IC_SE.SE_3; default: - sence = LebaiRobot.SENCE_接1号冰淇淋; + sence = LebaiHelper.SENCE_接1号冰淇淋; return IC_SE.SE_1; } } diff --git a/BPASmartClient.SCChip/ICChipMachine.cs b/BPASmartClient.SCChip/ICChipMachine.cs index 5bb0596c..f857abe6 100644 --- a/BPASmartClient.SCChip/ICChipMachine.cs +++ b/BPASmartClient.SCChip/ICChipMachine.cs @@ -378,6 +378,8 @@ namespace BPASmartClient.SCChip } }); InitStatus(); + //测试 + Start(); } } diff --git a/BPASmartClient.SerialPort/SerialPortClient.cs b/BPASmartClient.SerialPort/SerialPortClient.cs index 7ca8541a..27acc34c 100644 --- a/BPASmartClient.SerialPort/SerialPortClient.cs +++ b/BPASmartClient.SerialPort/SerialPortClient.cs @@ -1,4 +1,5 @@ using BPASmartClient.Helper; +using BPASmartClient.Message; using System; using System.IO.Ports; using System.Linq; @@ -99,7 +100,6 @@ namespace BPASmartClient.SerialPort { if (comPort.IsOpen) //判断是否打开串口 { - byte[] receivedData = new byte[comPort.BytesToRead]; //创建接收字节数组 comPort.Read(receivedData, 0, receivedData.Length); //读取数据 diff --git a/BPASmartClient.ViewModel/AdminstratorsViewModel.cs b/BPASmartClient.ViewModel/AdminstratorsViewModel.cs index 5f974b7e..4b069cfd 100644 --- a/BPASmartClient.ViewModel/AdminstratorsViewModel.cs +++ b/BPASmartClient.ViewModel/AdminstratorsViewModel.cs @@ -27,7 +27,7 @@ namespace BPASmartClient.ViewModel AdminLoginCommand = new RelayCommand(() => { - ActionManage.GetInstance.Send("Lonin"); + ActionManage.GetInstance.Send("LoginSuccess"); }); } diff --git a/BPASmartClient.ViewModel/BPASmartClient.ViewModel.csproj b/BPASmartClient.ViewModel/BPASmartClient.ViewModel.csproj index 69df2f85..aab4265c 100644 --- a/BPASmartClient.ViewModel/BPASmartClient.ViewModel.csproj +++ b/BPASmartClient.ViewModel/BPASmartClient.ViewModel.csproj @@ -15,9 +15,13 @@ + + + + diff --git a/BPASmartClient.ViewModel/MainViewModel.cs b/BPASmartClient.ViewModel/MainViewModel.cs index c6c4ea8c..19cd0f71 100644 --- a/BPASmartClient.ViewModel/MainViewModel.cs +++ b/BPASmartClient.ViewModel/MainViewModel.cs @@ -38,12 +38,6 @@ namespace BPASmartClient.ViewModel OnPropertyChanged("NetworkConnectState"); } } - //状态隐藏 - public Visibility VsMenuItem { get { return _vsMenuItem; } set { _vsMenuItem = value; OnPropertyChanged(); } } - private Visibility _vsMenuItem; - - public RelayCommand LogoutCommand { get; set; } - /// /// 是否告警 /// @@ -80,14 +74,7 @@ namespace BPASmartClient.ViewModel }; dispatcherTimer.Interval = TimeSpan.FromSeconds(1); dispatcherTimer.Start(); - ActionManage.GetInstance.Register(new Action(() => - { - VsMenuItem = Visibility.Hidden; - }),"Lonin"); - LogoutCommand = new RelayCommand(() => - { - VsMenuItem = Visibility.Visible; - }); + } diff --git a/BPASmartClient.ViewModel/MorkT_DebugViewModel.cs b/BPASmartClient.ViewModel/MorkT_DebugViewModel.cs new file mode 100644 index 00000000..0278370a --- /dev/null +++ b/BPASmartClient.ViewModel/MorkT_DebugViewModel.cs @@ -0,0 +1,212 @@ +using BPASmartClient.Business; +using BPASmartClient.Device; +using BPASmartClient.DRCoffee; +using BPASmartClient.EventBus; +using BPASmartClient.GSIceCream; +using BPASmartClient.Helper; +using BPASmartClient.Lebai; +using BPASmartClient.LebaiRobot; +using BPASmartClient.Model; +using BPASmartClient.Model.冰淇淋.Enum; +using BPASmartClient.Model.咖啡机.Enum; +using BPASmartClient.SCChip; +using Microsoft.Toolkit.Mvvm.ComponentModel; +using Microsoft.Toolkit.Mvvm.Input; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace BPASmartClient.ViewModel +{ + public class MorkT_DebugViewModel : ObservableObject + { + #region 乐白机器人 + /// + /// 乐白机器人连接状态 + /// + public string RobotConnected { get; set; } + /// + /// 乐白机器人的模式状态 + /// + public ELebaiRModel RobotMode { get; set; } + /// + /// 机器人控制指令 + /// + public RelayCommand Button_RobotControlCommand { get; set; } + /// + /// 机器人控制 + /// + /// + private void Button_RobotControl(object o) + { + ActionManage.GetInstance.Send("调试控制-机器人控制",o.ToString()); + } + + #endregion + + #region 冰淇淋机器 + /// + /// 制作冰淇淋 + /// + public RelayCommand Button_MakeIceCreamCommand { get; set; } + /// + /// 选择冰淇淋模式 + /// + public RelayCommand Button_SetIceCreamModelCommand { get; set; } + + /// + /// 冰淇淋连接状态 + /// + public string IceCreamConnected { get; set; } + /// + /// 预冷温度 + /// + public short YLWD { get; set; } + /// + /// 回气温度 + /// + public short HQWD { get; set; } + /// + /// 环境温度 + /// + public short HJWD { get; set; } + /// + /// 电流 + /// + public short DL { get; set; } + /// + /// 电压 + /// + public short DY { get; set; } + /// + /// 当前模式 + /// + public MORKI_MODE CurrentMode { get; set; } + /// + /// 故障 + /// + public MORKI_FAULT IceCreamFault { get; set; } + /// + /// 成型比 + /// + public byte CXB { get; set; } + /// + /// 打料完成状态 + /// + public string DLCompleted { get; set; } + + public List IceCreamModes { get; set; } = new List(); + public string SelecteIceCreamdMode { get; set; } + + private void Button_MakeIceCream() + { + + } + private void Button_SetIceCreamModel() + { + MORKI_MODE mORKI_MODE = (MORKI_MODE)Enum.Parse(typeof(MORKI_MODE), SelecteIceCreamdMode); + new GSIceCream_ModeSetEvent() { Mode = mORKI_MODE }.Publish(); + } + #endregion + + #region 咖啡机 + /// + /// 咖啡机连接状态 + /// + public string CoffeeConnected { get; set; } + /// + /// 咖啡机状态 + /// + public DrCoffeeStatus CoffeeStatus { get; set; } + /// + /// 应用状态 + /// + public DrCoffeeAppStatus AppStatus { get; set; } + /// + /// 告警 + /// + public DrCoffeeWarning Warning { get; set; } + /// + /// 故障信息 + /// + public DrCoffeeFault CaffeeFault { get; set; } + + public List Coffees { get; set; } = new List(); + public string SelectedCoffee { get; set; } + + public List CoffeeCmds { get; set; } = new List(); + public string SelectedCoffeeCmd { get; set; } + #endregion + + + Dictionary CurrentData { get; set; } + + public MorkT_DebugViewModel() + { + Button_RobotControlCommand = new RelayCommand(Button_RobotControl); + Button_MakeIceCreamCommand = new RelayCommand(Button_MakeIceCream); + Button_SetIceCreamModelCommand = new RelayCommand(Button_SetIceCreamModel); + + 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(() => + { + Plugin.GetInstance()?.GetPlugin()?.GetDevices().ForEach(device => + { + if (device.Name == "MorkT") CurrentData = device.Status.GetStatus(); + }); + if (CurrentData != null && CurrentData.Count != 0) + { + RobotConnected = (bool)CurrentData["Lebai.LebaiRobot.Connected"] ? "已连接" : "未连接"; + IceCreamConnected = (bool)CurrentData["GSIceCream.IceCreamMachine.IsConnected"] ? "已连接" : "未连接"; + CoffeeConnected = (bool)CurrentData["GSIceCream.IceCreamMachine.IsConnected"] ? "已连接" : "未连接"; + + RobotMode = (ELebaiRModel)CurrentData["Lebai.LebaiRobot.RobotMode"]; + + CoffeeStatus = (DrCoffeeStatus)CurrentData["DRCoffee.CoffeeMachine.Status"]; + AppStatus = (DrCoffeeAppStatus)CurrentData["DRCoffee.CoffeeMachine.AppStatus"]; + Warning = (DrCoffeeWarning)CurrentData["DRCoffee.CoffeeMachine.Warning"]; + CaffeeFault = (DrCoffeeFault)CurrentData["DRCoffee.CoffeeMachine.Fault"]; + + YLWD = (short)CurrentData["GSIceCream.IceCreamMachine.YLWD"]; + HQWD = (short)CurrentData["GSIceCream.IceCreamMachine.HQWD"]; + HJWD = (short)CurrentData["GSIceCream.IceCreamMachine.HJWD"]; + DL = (short)CurrentData["GSIceCream.IceCreamMachine.DL"]; + DY = (short)CurrentData["GSIceCream.IceCreamMachine.DY"]; + CurrentMode = (MORKI_MODE)CurrentData["GSIceCream.IceCreamMachine.CurrentMode"]; + IceCreamFault = (MORKI_FAULT)CurrentData["GSIceCream.IceCreamMachine.Fault"]; + CXB = (byte)CurrentData["GSIceCream.IceCreamMachine.CXB"]; + DLCompleted = (bool)CurrentData["GSIceCream.IceCreamMachine.DLCompleted"] ? "打料完成" : "打料中"; + } + + + + + + Thread.Sleep(500); + }), "MorkT-状态刷新"); + } + + } +} diff --git a/BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs b/BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs index 52291aba..9ff29912 100644 --- a/BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs +++ b/BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs @@ -213,7 +213,7 @@ namespace BPASmartClient.ViewModel private void DataListInit() { Ports.Clear(); - SerialPort.GetPortNames().ToList().ForEach((item) => { Ports.Add(item); }); + System.IO.Ports.SerialPort.GetPortNames().ToList().ForEach((item) => { Ports.Add(item); }); BaudRates.Clear(); int[] rb = new int[] { 110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 43000, 57600, 76800, 115200 }; diff --git a/BPASmartClient/App.config b/BPASmartClient/App.config index 0004434b..dd5e0a93 100644 --- a/BPASmartClient/App.config +++ b/BPASmartClient/App.config @@ -3,7 +3,7 @@ - + @@ -23,9 +23,6 @@ --> - - - - - --> diff --git a/BPASmartClient/MainWindow.xaml b/BPASmartClient/MainWindow.xaml index edb43a16..ced31313 100644 --- a/BPASmartClient/MainWindow.xaml +++ b/BPASmartClient/MainWindow.xaml @@ -49,8 +49,8 @@ Margin="20,0,0,0" VerticalAlignment="Center" Style="{DynamicResource imagetop_Title}" /> - - + + + Tag="MorkT_DebugView" /> -