|
|
|
using BBWYB.Client.APIServices;
|
|
|
|
using BBWYB.Client.Models;
|
|
|
|
using BBWYB.Client.ViewModels;
|
|
|
|
using BBWYB.Client.Views.PackPurchaseTaska;
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
using System.Windows;
|
|
|
|
|
|
|
|
namespace BBWYB.Client
|
|
|
|
{
|
|
|
|
|
|
|
|
[ClassInterface(ClassInterfaceType.AutoDual)]
|
|
|
|
[ComVisible(true)]
|
|
|
|
public class GlobalContext : ObservableObject
|
|
|
|
{
|
|
|
|
public GlobalContext()
|
|
|
|
{
|
|
|
|
BBWYBApiVersion = "10021";
|
|
|
|
}
|
|
|
|
|
|
|
|
private User user;
|
|
|
|
|
|
|
|
public User User { get => user; set { SetProperty(ref user, value); } }
|
|
|
|
|
|
|
|
public string UserToken { get; set; }
|
|
|
|
|
|
|
|
public IList<LogisticsResponse> LogisticsResponseList { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// JD客户端
|
|
|
|
/// </summary>
|
|
|
|
//public IJdClient JdClient { get; set; }
|
|
|
|
|
|
|
|
#region APIHost
|
|
|
|
public string BBWYApiHost { get; set; }
|
|
|
|
|
|
|
|
public string MDSApiHost { get; set; }
|
|
|
|
public string BBWYCApiHost { get; set; }
|
|
|
|
public string QKApiHost { get; set; }
|
|
|
|
|
|
|
|
public string BBWYBApiVersion { get; set; }
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region Web
|
|
|
|
public string GetUserString()
|
|
|
|
{
|
|
|
|
return JsonConvert.SerializeObject(User);
|
|
|
|
}
|
|
|
|
|
|
|
|
public string GetBBWYBApiVersion()
|
|
|
|
{
|
|
|
|
return BBWYBApiVersion;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 对web版提供的修改打包任务方法
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="belongSkuId">订单sku归属的来源sku(JD)</param>
|
|
|
|
/// <param name="orderId">订单Id</param>
|
|
|
|
/// <param name="skuLogo">sku图片</param>
|
|
|
|
/// <param name="skuTitle">sku标题</param>
|
|
|
|
/// <param name="originShopName">订单来源店铺名称</param>
|
|
|
|
public void OpenUpdatePurchaseTask(string belongSkuId, string orderId, string skuLogo, string skuTitle, string originShopName)
|
|
|
|
{
|
|
|
|
var app = App.Current as App;
|
|
|
|
var sp = app.ServiceProvider;
|
|
|
|
|
|
|
|
PackPurchaseTaskService packPurchaseTaskService = null;
|
|
|
|
using (var s = sp.CreateScope())
|
|
|
|
{
|
|
|
|
packPurchaseTaskService = s.ServiceProvider.GetRequiredService<PackPurchaseTaskService>();
|
|
|
|
}
|
|
|
|
|
|
|
|
var orderSku = new OrderSku()
|
|
|
|
{
|
|
|
|
OrderId = orderId,
|
|
|
|
BelongSkuId = belongSkuId,
|
|
|
|
Title = skuTitle,
|
|
|
|
Logo = skuLogo,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
var res = packPurchaseTaskService.GetOrderTask(orderSku.BelongSkuId, orderSku.OrderId);
|
|
|
|
if (res == null || !res.Success)
|
|
|
|
{
|
|
|
|
MessageBox.Show("网络异常!查不到任务");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (res.Data == null)
|
|
|
|
{
|
|
|
|
MessageBox.Show("打包任务,不存在或已被删除,请重新发起任务!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
UpdatePurchaseTaskWindow packTask = new();
|
|
|
|
|
|
|
|
ViewModelLocator view = new();
|
|
|
|
var updatePackTask = view.UpdatePurchaseTask;
|
|
|
|
var show = updatePackTask.SearchSku(res.Data, originShopName, orderSku);
|
|
|
|
|
|
|
|
|
|
|
|
if (!show) return;
|
|
|
|
|
|
|
|
//updatePackTask.ReflashWindow = () =>
|
|
|
|
//{
|
|
|
|
// Task.Factory.StartNew(() => LoadOrder(PageIndex));
|
|
|
|
|
|
|
|
//};
|
|
|
|
|
|
|
|
|
|
|
|
packTask.ShowDialog();
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|