步步为盈
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.

99 lines
3.3 KiB

2 years ago
using BBWY.Client.APIServices;
using BBWY.Client.Models;
using BBWY.Client.Models.APIModel.Request;
2 years ago
using BBWY.Controls;
2 years ago
using GalaSoft.MvvmLight.Command;
2 years ago
using System;
using System.Collections.Generic;
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;
namespace BBWY.Client.Views.PackTask
{
/// <summary>
/// SetBarCode.xaml 的交互逻辑
/// </summary>
2 years ago
public partial class SetBarCodeWindow : BWindow
2 years ago
{
2 years ago
public SetBarCodeWindow()
2 years ago
{
InitializeComponent();
2 years ago
BarLabelCheckCommand = new RelayCommand<BarcodeLabelModel>(BarLabelCheck);
2 years ago
}
2 years ago
public void LoadData(BarCodeModel barCodeModel, PackTaskService PackTaskService)
2 years ago
{
BarCodeModel = barCodeModel; packTaskService = PackTaskService;
this.DataContext = this;
}
public BarCodeModel BarCodeModel { get; set; }
public PackTaskService packTaskService { get; set; }
public Action<BarCodeModel> SaveResult { get; set; }
2 years ago
2 years ago
private void BButton_Click(object sender, RoutedEventArgs e)
{
if (BarCodeModel.LabelModel == BarcodeLabelModel.)//标准版 判断数据是否异常
{
if (string.IsNullOrEmpty(BarCodeModel.ProductNo) || BarCodeModel.ProductNo == "待填写")
{
TipsWindow tips = new TipsWindow("该SKU无货号信息,将影响条形码打印\r\n请先设置好货号信息或调整打印模板类型");
tips.Show();
return;
}
}
//保存到服务器中 返回id
var resData = packTaskService.SaveBarCode(new BarCodeRequest
{
Brand = BarCodeModel.Brand,
BrandName = BarCodeModel.BrandName,
ProductNo = BarCodeModel.ProductNo,
SkuId = BarCodeModel.SkuId,
SkuName = BarCodeModel.SkuName,
2 years ago
LabelModel = BarCodeModel.LabelModel,
ShopName = BarCodeModel.ShopName,
2 years ago
});
2 years ago
if (resData == null)
2 years ago
{
2 years ago
MessageBox.Show("网络异常!");
return;
}
if (!resData.Success)
{
MessageBox.Show(resData.Msg);
2 years ago
return;
}
BarCodeModel.Id = resData.Data;
if (SaveResult != null)
SaveResult(BarCodeModel);
this.Close();
}
2 years ago
public ICommand BarLabelCheckCommand { get; set; }
public void BarLabelCheck(BarcodeLabelModel labelModel)
{
if (BarCodeModel != null && labelModel == BarcodeLabelModel.)//标准版 判断数据是否异常
2 years ago
{
if (string.IsNullOrEmpty(BarCodeModel.ProductNo) || BarCodeModel.ProductNo == "待填写")
{
TipsWindow tips = new TipsWindow("该SKU无货号信息,将影响条形码打印\r\n请先设置好货号信息或调整打印模板类型");
tips.ShowDialog();
}
}
2 years ago
2 years ago
}
2 years ago
}
}