You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
3.1 KiB
98 lines
3.1 KiB
using BBWY.Client.APIServices;
|
|
using BBWY.Client.Models;
|
|
using BBWY.Controls;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Shapes;
|
|
using WebSocketSharp;
|
|
|
|
namespace BBWY.Client.Views.SealBox
|
|
{
|
|
/// <summary>
|
|
/// AddProductWindow.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class AddProductWindow : BWindow
|
|
{
|
|
public AddProductWindow(PackTaskService packTaskService, ProductService productService, Action ReflashTask)
|
|
{
|
|
this.packTaskService = packTaskService;
|
|
this.productService = productService;
|
|
this.ReflashTask = ReflashTask;
|
|
InitializeComponent();
|
|
this.DataContext = this;
|
|
}
|
|
ProductService productService;
|
|
PackTaskService packTaskService;
|
|
Action ReflashTask;
|
|
private int count;
|
|
public int Count { get => count; set { Set(ref count, value); } }
|
|
|
|
private string skuId;
|
|
public string SkuId { get => skuId; set { Set(ref skuId, value); } }
|
|
|
|
private string logo;
|
|
public string Logo { get => logo; set { Set(ref logo, value); } }
|
|
|
|
private string skuTitle;
|
|
public string SkuTitle { get => skuTitle; set { Set(ref skuTitle, value); } }
|
|
|
|
|
|
public ObservableCollection<PositionType> PositionTypes { get; set; } = new ObservableCollection<PositionType>() {
|
|
PositionType.商家仓, PositionType.云仓, PositionType.京仓, PositionType.聚水潭
|
|
};
|
|
|
|
private PositionType positionType;
|
|
public PositionType PositionType { get => positionType; set { Set(ref positionType, value); } }
|
|
|
|
private void BButton_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (Count <= 0)
|
|
{
|
|
MessageBox.Show("请输入任务数"); return;
|
|
}
|
|
var res = packTaskService.AddSealBoxProduct(SkuId, PositionType, Count);
|
|
|
|
if (res == null || !res.Success)
|
|
{
|
|
MessageBox.Show(res?.Msg); return;
|
|
}
|
|
|
|
this.Close();
|
|
if (ReflashTask != null)
|
|
ReflashTask();
|
|
}
|
|
|
|
private void BButton_Click_1(object sender, RoutedEventArgs e)
|
|
{
|
|
if (SkuId.IsNullOrEmpty())
|
|
{
|
|
MessageBox.Show("请输入SkuId"); return;
|
|
}
|
|
SkuId = SkuId.Trim();
|
|
var res = productService.GetProductSkuList(null, SkuId);
|
|
if (res == null || !res.Success)
|
|
{
|
|
MessageBox.Show(res?.Msg); return;
|
|
}
|
|
var productSku = res.Data.SingleOrDefault(d => d.Id == SkuId);
|
|
|
|
if (productSku == null)
|
|
{
|
|
MessageBox.Show("不存在对应的sku商品数据."); return;
|
|
}
|
|
SkuTitle = productSku.Title;
|
|
Logo = productSku.Logo.Replace("80x80", "150x150");
|
|
|
|
}
|
|
}
|
|
}
|
|
|