From 355c74a02b64c0640c29ab79a88cfa3cccf00603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com> Date: Fri, 15 Apr 2022 11:14:23 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HBLConsole.Abstract/AbstractMessageServer.cs | 2 + HBLConsole.Business/AbstractServer/Base.cs | 20 ++++++++-- HBLConsole.MainConsole/Main.cs | 1 + HBLConsole/App.config | 9 +++-- HBLConsole/ViewModel/ViewModelBase.cs | 39 ++++++++++++-------- 5 files changed, 48 insertions(+), 23 deletions(-) diff --git a/HBLConsole.Abstract/AbstractMessageServer.cs b/HBLConsole.Abstract/AbstractMessageServer.cs index b103319..f094e30 100644 --- a/HBLConsole.Abstract/AbstractMessageServer.cs +++ b/HBLConsole.Abstract/AbstractMessageServer.cs @@ -15,5 +15,7 @@ namespace HBLConsole.Abstract public abstract bool OrderStatusChange(string subOrderId, ORDER_STATUS status); + public abstract void Chargeback(T chargebackInfo); + } } diff --git a/HBLConsole.Business/AbstractServer/Base.cs b/HBLConsole.Business/AbstractServer/Base.cs index b0a3210..d43e962 100644 --- a/HBLConsole.Business/AbstractServer/Base.cs +++ b/HBLConsole.Business/AbstractServer/Base.cs @@ -117,10 +117,6 @@ namespace HBLConsole.Business.AbstractServer { //MessageLog.GetInstance.Show($"辅料ID:=[{x.RecipeBomId}],{x.RecipeBomLoc}号位置:{x.RecipeBomCount}"); }); - - - - } } @@ -147,6 +143,22 @@ namespace HBLConsole.Business.AbstractServer var res = JsonConvert.DeserializeObject(result); return res == null ? false : res.isSuccess; } + + /// + /// 退单消息 + /// + /// + /// + /// + public override void Chargeback(T chargebackInfo) + { + if (chargebackInfo == null) return; + if (chargebackInfo is Chargeback chargeback) + { + ActionManage.GetInstance.Send("chargeback", chargeback.SubOrderId); + } + } + public class OrderStatusRsp { /// diff --git a/HBLConsole.MainConsole/Main.cs b/HBLConsole.MainConsole/Main.cs index 119bfaa..3172616 100644 --- a/HBLConsole.MainConsole/Main.cs +++ b/HBLConsole.MainConsole/Main.cs @@ -74,6 +74,7 @@ namespace HBLConsole.MainConsole Topics.Clear(); Topics.Add(TOPIC.GetInstance.GetOrderPushTopic(GeneralConfig.DeviceType, InternetInfo.ClientId)); Topics.Add(TOPIC.GetInstance.GetBusinessTopic(GeneralConfig.DeviceType, InternetInfo.ClientId)); + Topics.Add(TOPIC.GetInstance.GetChargebackTopic(GeneralConfig.DeviceType, InternetInfo.ClientId)); //MQTT 连接成功 MqttHelper.GetInstance.ConnectOk = new Action(() => diff --git a/HBLConsole/App.config b/HBLConsole/App.config index acb9fdf..baf00ff 100644 --- a/HBLConsole/App.config +++ b/HBLConsole/App.config @@ -3,15 +3,16 @@ + + + - + - - - + diff --git a/HBLConsole/ViewModel/ViewModelBase.cs b/HBLConsole/ViewModel/ViewModelBase.cs index ce432e2..82b97cf 100644 --- a/HBLConsole/ViewModel/ViewModelBase.cs +++ b/HBLConsole/ViewModel/ViewModelBase.cs @@ -1,4 +1,4 @@ -//#define test +#define test using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -148,20 +148,20 @@ namespace HBLConsole.ViewModel { while (GeneralConfig.morkOrderPushes.Count > 0) { - if (GeneralConfig.morkOrderPushes.TryDequeue(out MorkOrderPush morkOrder)) - { - SimpleFactory.GetInstance.OrderChanged(morkOrder.SuborderId, ORDER_STATUS.COOKING); - MessageLog.GetInstance.Show($"{morkOrder.GoodsName},{ORDER_STATUS.COOKING}"); - Thread.Sleep(5000); - - SimpleFactory.GetInstance.OrderChanged(morkOrder.SuborderId, ORDER_STATUS.COMPLETED_COOK); - MessageLog.GetInstance.Show($"{morkOrder.GoodsName},{ORDER_STATUS.COMPLETED_COOK}"); - Thread.Sleep(5000); - - SimpleFactory.GetInstance.OrderChanged(morkOrder.SuborderId, ORDER_STATUS.COMPLETED_TAKE); - MessageLog.GetInstance.Show($"{morkOrder.GoodsName},{ORDER_STATUS.COMPLETED_TAKE}"); - Thread.Sleep(5000); - } + //if (GeneralConfig.morkOrderPushes.TryDequeue(out MorkOrderPush morkOrder)) + //{ + // SimpleFactory.GetInstance.OrderChanged(morkOrder.SuborderId, ORDER_STATUS.COOKING); + // MessageLog.GetInstance.Show($"{morkOrder.GoodsName},{ORDER_STATUS.COOKING}"); + // Thread.Sleep(5000); + + // SimpleFactory.GetInstance.OrderChanged(morkOrder.SuborderId, ORDER_STATUS.COMPLETED_COOK); + // MessageLog.GetInstance.Show($"{morkOrder.GoodsName},{ORDER_STATUS.COMPLETED_COOK}"); + // Thread.Sleep(5000); + + // SimpleFactory.GetInstance.OrderChanged(morkOrder.SuborderId, ORDER_STATUS.COMPLETED_TAKE); + // MessageLog.GetInstance.Show($"{morkOrder.GoodsName},{ORDER_STATUS.COMPLETED_TAKE}"); + // Thread.Sleep(5000); + //} } Thread.Sleep(500); }), "test"); @@ -176,6 +176,15 @@ namespace HBLConsole.ViewModel { Test(); + ActionManage.GetInstance.Register(new Action((o) => + { + if (o == null) return; + if (o is string id) + { + SimpleFactory.GetInstance.OrderChanged(id, ORDER_STATUS.ABANDONED); + } + }), "chargeback"); + //清除订单数据 ActionManage.GetInstance.Register(new Action(() => {