Browse Source

将合格证配置窗口暴露给web

updatebug
shanji 2 years ago
parent
commit
d7ede04f8a
  1. 6
      BBWYB.Client/APIServices/OrderService.cs
  2. 69
      BBWYB.Client/GlobalContext.cs
  3. 8
      BBWYB.Client/ViewModels/MainViewModel.cs
  4. 91
      BBWYB.Client/ViewModels/Order/OrderViewModel.cs
  5. 16
      BBWYB.Client/Views/MainWindow.xaml.cs
  6. 29
      BBWYB.Client/Views/Order/OrderList.xaml
  7. 5
      BBWYB.Client/appsettings.json

6
BBWYB.Client/APIServices/OrderService.cs

@ -27,7 +27,8 @@ namespace BBWYB.Client.APIServices
int pageIndex,
int pageSize,
long? shopId,
bool excludeCanceled)
bool excludeCanceled,
bool isWaitConfig)
{
return SendRequest<OrderListResponse>(globalContext.BBWYApiHost, "api/order/getorderlist", new
{
@ -43,7 +44,8 @@ namespace BBWYB.Client.APIServices
clientOrderId,
purchaseOrderId,
sourceShopName,
sourceSku
sourceSku,
isWaitConfig
}, null, HttpMethod.Post);
}

69
BBWYB.Client/GlobalContext.cs

@ -1,8 +1,13 @@
using BBWYB.Client.Models;
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
{
@ -13,7 +18,7 @@ namespace BBWYB.Client
{
public GlobalContext()
{
BBWYBApiVersion = "10020";
BBWYBApiVersion = "10021";
}
private User user;
@ -37,7 +42,9 @@ namespace BBWYB.Client
public string QKApiHost { get; set; }
public string BBWYBApiVersion { get; set; }
#endregion
#region Web
public string GetUserString()
{
return JsonConvert.SerializeObject(User);
@ -47,6 +54,64 @@ namespace BBWYB.Client
{
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
}
}

8
BBWYB.Client/ViewModels/MainViewModel.cs

@ -1,9 +1,11 @@
using BBWYB.Client.APIServices;
using BBWYB.Client.Models;
using BBWYB.Client.Views;
using BBWYB.Client.Views.SelectShop;
using BBWYB.Common.Extensions;
using BBWYB.Common.Models;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
@ -153,7 +155,7 @@ namespace BBWYB.Client.ViewModels
var res = shopService.GetDepartmentList();
if (!res.Success)
throw new Exception(res.Msg);
var allDepartmentList = res.Data.Map<IList<Department>>();
var allDepartmentList = res.Data.Map<IList<Department>>();
//if (GlobalContext.User.TeamName == "刷单组")
//{
@ -231,6 +233,10 @@ namespace BBWYB.Client.ViewModels
vm.OrderVM.Refresh();
if (vm.IsCreateWareManager)
vm.WareManager.Refresh();
if (SelectedMenuModel.Name == "订单列表Bata")
{
WeakReferenceMessenger.Default.Send(new Message_Frame_Refresh(null));
}
}
}
catch (Exception ex)

91
BBWYB.Client/ViewModels/Order/OrderViewModel.cs

@ -36,6 +36,7 @@ namespace BBWYB.Client.ViewModels
private bool excludeCanceled;
private GlobalContext globalContext;
private OrderService orderService;
private bool isWaitConfig;
public bool IsLoading { get => isLoading; set { SetProperty(ref isLoading, value); } }
@ -55,8 +56,16 @@ namespace BBWYB.Client.ViewModels
public bool ExcludeCanceled { get => excludeCanceled; set { SetProperty(ref excludeCanceled, value); } }
public IList<Order> OrderList { get; set; }
/// <summary>
/// 是否为待配置
/// </summary>
public bool IsWaitConfig { get => isWaitConfig; set { SetProperty(ref isWaitConfig, value); } }
public ICommand SetSearchDateCommand { get; set; }
public ICommand SetOrderStateCommand { get; set; }
public ICommand SetWaitConfigCommand { get; set; }
public ICommand OrderPageIndexChangedCommand { get; set; }
public ICommand SearchOrderCommand { get; set; }
@ -68,6 +77,7 @@ namespace BBWYB.Client.ViewModels
public ICommand EditPackConfigCommand { get; set; }
public OrderViewModel(GlobalContext globalContext, OrderService orderService, PackPurchaseTaskService packPurchaseTaskService)
{
OrderList = new ObservableCollection<Order>();
@ -92,6 +102,7 @@ namespace BBWYB.Client.ViewModels
CancelOrderCommand = new RelayCommand<string>(CancelOrder);
EditPriceCommand = new RelayCommand<Order>(OpenEditPrice);
EditPackConfigCommand = new RelayCommand<Object>(EditPackConfig);
SetWaitConfigCommand = new RelayCommand(SetWaitConfig);
PageIndex = 1;
PageSize = 10;
EndDate = DateTime.Now;
@ -114,7 +125,7 @@ namespace BBWYB.Client.ViewModels
MessageBox.Show("网络异常!查不到任务");
return;
}
if (res.Data==null)
if (res.Data == null)
{
MessageBox.Show("打包任务,不存在或已被删除,请重新发起任务!");
return;
@ -129,7 +140,8 @@ namespace BBWYB.Client.ViewModels
if (!show) return;
updatePackTask.ReflashWindow = () => {
updatePackTask.ReflashWindow = () =>
{
Task.Factory.StartNew(() => LoadOrder(PageIndex));
};
@ -139,6 +151,52 @@ namespace BBWYB.Client.ViewModels
}
private void EditPackConfigForWeb(string belongSkuId, string orderId, string skuLogo, string skuTitle, string originShopName)
{
//var objList = (object[])obj;
//var OriginShopName = (string)objList[0];
//OrderSku order = (OrderSku)objList[1];
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();
}
/// <summary>
///
/// </summary>
@ -146,7 +204,21 @@ namespace BBWYB.Client.ViewModels
private void LoadOrder(int pageIndex)
{
IsLoading = true;
var response = orderService.GetOrderList(SearchOrderId, StartDate, EndDate, OrderState, SearchProductId, SearchSku, string.Empty, SearchPurchaseOrderId, SearchSourceShopName, SearchSourceSku, pageIndex, PageSize, globalContext.User.Shop.ShopId, ExcludeCanceled);
var response = orderService.GetOrderList(SearchOrderId,
StartDate,
EndDate,
OrderState,
SearchProductId,
SearchSku,
string.Empty,
SearchPurchaseOrderId,
SearchSourceShopName,
SearchSourceSku,
pageIndex,
PageSize,
globalContext.User.Shop.ShopId,
ExcludeCanceled,
IsWaitConfig);
if (!response.Success)
{
@ -179,13 +251,21 @@ namespace BBWYB.Client.ViewModels
/// 通过订单状态 筛选订单数据
/// </summary>
/// <param name="orderState">订单状态</param>
public void SetOrderState(OrderState? orderState)
private void SetOrderState(OrderState? orderState)
{
InitSearchParam(orderState == null); //初始化查询参数 orderState == null 全部
this.OrderState = orderState;
Task.Factory.StartNew(() => LoadOrder(1)); //选择状态查询订单
}
private void SetWaitConfig()
{
this.OrderState = null;
InitSearchParam(true);
this.IsWaitConfig = true;
Task.Factory.StartNew(() => LoadOrder(1)); //选择状态查询订单
}
/// <summary>
/// 初始化查询参数
/// </summary>
@ -193,6 +273,7 @@ namespace BBWYB.Client.ViewModels
private void InitSearchParam(bool isInitDate = false)
{
this.OrderState = null;
IsWaitConfig = false;
SearchOrderId = string.Empty;
SearchSku = string.Empty;
SearchProductId = string.Empty;
@ -245,7 +326,7 @@ namespace BBWYB.Client.ViewModels
return;
}
var orderResponse = orderService.GetOrderList(orderId, StartDate, EndDate, null, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, 1, 10, globalContext.User.Shop.ShopId, true);
var orderResponse = orderService.GetOrderList(orderId, StartDate, EndDate, null, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, 1, 10, globalContext.User.Shop.ShopId, true, IsWaitConfig);
IsLoading = false;
if (!orderResponse.Success)
{

16
BBWYB.Client/Views/MainWindow.xaml.cs

@ -1,4 +1,5 @@
using CommunityToolkit.Mvvm.Messaging;
using CommunityToolkit.Mvvm.Messaging.Messages;
using Microsoft.Web.WebView2.Core;
using SJ.Controls;
using System;
@ -18,6 +19,14 @@ namespace BBWYB.Client.Views
this.Width = SystemParameters.WorkArea.Size.Width * 0.8;
this.Height = SystemParameters.WorkArea.Size.Height * 0.7;
this.Loaded += MainWindow_Loaded;
WeakReferenceMessenger.Default.Register<Message_Frame_Refresh>(this, (o, x) =>
{
this.Dispatcher.Invoke(() =>
{
frame.Refresh();
});
});
}
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
@ -66,4 +75,11 @@ namespace BBWYB.Client.Views
return isInstall;
}
}
public class Message_Frame_Refresh : ValueChangedMessage<object>
{
public Message_Frame_Refresh(object value) : base(value)
{
}
}
}

29
BBWYB.Client/Views/Order/OrderList.xaml

@ -132,10 +132,25 @@
<StackPanel Grid.Row="2" HorizontalAlignment="Left" Orientation="Horizontal">
<!--Background="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=#null:#8080FF:#F2F2F2}"-->
<!--{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=#null:White:#4A4A4A}"-->
<c:BButton Content="全部订单" Width="100"
Command="{Binding SetOrderStateCommand}" CommandParameter="{x:Null}"
Background="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=#null:#8080FF:#F2F2F2}"
Foreground="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=#null:White:#4A4A4A}"/>
Command="{Binding SetOrderStateCommand}" CommandParameter="{x:Null}">
<c:BButton.Background>
<MultiBinding Converter="{StaticResource mobjConverter}"
ConverterParameter=";false:&amp;:#8080FF:#F2F2F2:6">
<Binding Path="OrderState"/>
<Binding Path="IsWaitConfig"/>
</MultiBinding>
</c:BButton.Background>
<c:BButton.Foreground>
<MultiBinding Converter="{StaticResource mobjConverter}"
ConverterParameter=";false:&amp;:White:#4A4A4A:6">
<Binding Path="OrderState"/>
<Binding Path="IsWaitConfig"/>
</MultiBinding>
</c:BButton.Foreground>
</c:BButton>
<c:BButton Width="100"
Background="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=待付款:#8080FF:#F2F2F2}"
Foreground="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=待付款:White:#4A4A4A}"
@ -162,9 +177,9 @@
</c:BButton>
<c:BButton Width="100"
Background="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=待配置:#8080FF:#F2F2F2}"
Foreground="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=待配置:White:#4A4A4A}"
Command="{Binding SetOrderStateCommand}" CommandParameter="{x:Static cmodel:OrderState.待配置}">
Background="{Binding IsWaitConfig,Converter={StaticResource objConverter},ConverterParameter=true:#8080FF:#F2F2F2}"
Foreground="{Binding IsWaitConfig,Converter={StaticResource objConverter},ConverterParameter=true:White:#4A4A4A}"
Command="{Binding SetWaitConfigCommand}">
<c:BButton.Content>
<TextBlock>
<Run Text="待配置"/>
@ -745,7 +760,7 @@
<DataTemplate>
<Grid Width="{Binding ActualWidth,ElementName=lbSet}" MinHeight="90">
<StackPanel Orientation="Vertical" Grid.Column="7" VerticalAlignment="Center" HorizontalAlignment="Center">
<StackPanel Margin="0 5 0 0" Visibility="{Binding DataContext.OrderState,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}},Converter={StaticResource objConverter},ConverterParameter=待配置:Visible:Collapsed}">
<StackPanel Margin="0 5 0 0" Visibility="{Binding DataContext.IsWaitConfig,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}},Converter={StaticResource objConverter},ConverterParameter=true:Visible:Collapsed}">
<c:BButton Content="{Binding PackConfigState,Converter={StaticResource objConverter},ConverterParameter=已配置:修改配置:配置}" Margin="5,0,0,0"
Command="{Binding DataContext.EditPackConfigCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}"

5
BBWYB.Client/appsettings.json

@ -3,7 +3,6 @@
"BBWYApiHost": "http://bbwyb.qiyue666.com",
"MDSApiHost": "http://mdsapi.qiyue666.com",
"BBWYCApiHost": "http://bbwytest.qiyue666.com",
"QKApiHost": "http://localhost:8080"
//"QKApiHost": "http://qiku.qiyue666.com"
//"QKApiHost": "http://localhost:8080"
"QKApiHost": "http://qiku.qiyue666.com"
}
Loading…
Cancel
Save