修复工单Bug
This commit is contained in:
1 parent
7982f7e348
commit
8e0cc20649
12 files changed
+602
-236
No files matched your search
@@ -1,4 +1,4 @@
|
||||
using _29WxOrderWpf.BaseWindows;
|
||||
using _29WxOrderWpf.BaseWindows;
|
||||
using _29WxOrderWpf.Ctrls.BuyerCtrls;
|
||||
using _29WxOrderWpf.Ctrls.OrderCtrls;
|
||||
using _29WxOrderWpf.Ctrls.Settings;
|
||||
@@ -59,6 +59,7 @@ namespace _29WxOrderWpf
|
||||
public static MainWindow Instance { get; private set; }
|
||||
|
||||
private readonly TicketRealtimeMonitor _ticketMonitor = TicketRealtimeMonitor.Current;
|
||||
private readonly WorkOrderUnreadService _workOrderUnreadService = new WorkOrderUnreadService();
|
||||
private TicketClientOptions _ticketOptions;
|
||||
private OrderSupportTicketView _orderSupportView;
|
||||
|
||||
@@ -597,8 +598,10 @@ namespace _29WxOrderWpf
|
||||
{
|
||||
try
|
||||
{
|
||||
_ticketMonitor.Start(GetTicketOptions().Clone());
|
||||
var options = GetTicketOptions().Clone();
|
||||
_ticketMonitor.Start(options);
|
||||
UpdateOrderSupportBadge();
|
||||
_ = LoadHistoricalTicketUnreadAsync(options);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -606,6 +609,23 @@ namespace _29WxOrderWpf
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 启动后根据服务端工单列表和历史缓存补齐未读角标。
|
||||
/// </summary>
|
||||
private async Task LoadHistoricalTicketUnreadAsync(TicketClientOptions options)
|
||||
{
|
||||
try
|
||||
{
|
||||
var unreadByTicket = await _workOrderUnreadService
|
||||
.GetUnreadByTicketAsync(options);
|
||||
_ticketMonitor.MergeUnread(unreadByTicket);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogSave.Add("TicketUnreadLoadError:" + ex);
|
||||
}
|
||||
}
|
||||
|
||||
private TicketClientOptions GetTicketOptions()
|
||||
{
|
||||
if (_ticketOptions != null)
|
||||
@@ -614,7 +634,7 @@ namespace _29WxOrderWpf
|
||||
_ticketOptions = new TicketClientOptions
|
||||
{
|
||||
UserName = BaseClass.UserName,
|
||||
AppIds = GlobalConfig.ShopLoginList.Select(a=>a.ShopId).ToList(),
|
||||
AppIds = GlobalConfig.ShopLoginList.Select(a => a.ShopId).ToList(),
|
||||
Orders = []
|
||||
};
|
||||
|
||||
@@ -673,10 +693,11 @@ namespace _29WxOrderWpf
|
||||
if (_orderSupportView == null)
|
||||
{
|
||||
_orderSupportView = new OrderSupportTicketView(
|
||||
new TicketApiService(),
|
||||
_ticketMonitor.RealtimeService,
|
||||
GetTicketOptions().Clone(),
|
||||
ownsRealtime: false);
|
||||
new TicketService(
|
||||
new TicketApiService(),
|
||||
_ticketMonitor.RealtimeService,
|
||||
ownsRealtime: false),
|
||||
GetTicketOptions().Clone());
|
||||
}
|
||||
|
||||
return _orderSupportView;
|
||||
@@ -722,16 +743,18 @@ namespace _29WxOrderWpf
|
||||
{
|
||||
if (borderOrderSupportUnread == null)
|
||||
return;
|
||||
|
||||
borderOrderSupportUnread.Visibility = unreadCount > 0
|
||||
? Visibility.Visible
|
||||
: Visibility.Collapsed;
|
||||
tbOrderSupportUnread.Text = unreadCount > 99
|
||||
? "99+"
|
||||
: unreadCount.ToString();
|
||||
btOrderSupport.ToolTip = unreadCount > 0
|
||||
? $"客户工单({unreadCount} 条未读消息)"
|
||||
: "客户工单";
|
||||
this.Dispatcher.Invoke(() =>
|
||||
{
|
||||
borderOrderSupportUnread.Visibility = unreadCount > 0
|
||||
? Visibility.Visible
|
||||
: Visibility.Collapsed;
|
||||
tbOrderSupportUnread.Text = unreadCount > 99
|
||||
? "99+"
|
||||
: unreadCount.ToString();
|
||||
btOrderSupport.ToolTip = unreadCount > 0
|
||||
? $"客户工单({unreadCount} 条未读消息)"
|
||||
: "客户工单";
|
||||
});
|
||||
}
|
||||
|
||||
private void MainWindow_Closed(object sender, EventArgs e)
|
||||
|
||||
Reference in new issue
Block a user