|
|
|
using BBWY.Client.Models.APIModel.Request;
|
|
|
|
using BBWY.Client.Models;
|
|
|
|
using BBWY.Client.Views.PackTask;
|
|
|
|
using GalaSoft.MvvmLight.Command;
|
|
|
|
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;
|
|
|
|
using BBWY.Client.Extensions;
|
|
|
|
using BBWY.Client.APIServices;
|
|
|
|
using BBWY.Controls;
|
|
|
|
|
|
|
|
namespace BBWY.Client.Views.QualityTask
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// QualitySetCerWindow.xaml 的交互逻辑
|
|
|
|
/// </summary>
|
|
|
|
public partial class QualitySetCerWindow : BWindow
|
|
|
|
{
|
|
|
|
public QualitySetCerWindow()
|
|
|
|
{
|
|
|
|
InitializeComponent();
|
|
|
|
SetPackCerStateCommand = new RelayCommand<PackCerState>(SetPackCerState);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void SetPackCerState(PackCerState obj)
|
|
|
|
{
|
|
|
|
PackCerState = obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void LoadData(bool isNeedCer, CertificateModel CertificateModel, PackPurchaseTaskService packTaskService, CertificateModel SpuCertificateModel, bool IsSetSpuCertificate)
|
|
|
|
{
|
|
|
|
this.CertificateModel = CertificateModel.Copy();
|
|
|
|
this.packTaskService = packTaskService;
|
|
|
|
PackCerState = isNeedCer ? PackCerState.合格证信息 : PackCerState.无需合格证;
|
|
|
|
this.DataContext = this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ICommand SetPackCerStateCommand { get; set; }
|
|
|
|
//public PackCerState PackCerState { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public PackCerState PackCerState
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return (PackCerState)GetValue(PackCerStateProperty);
|
|
|
|
|
|
|
|
}
|
|
|
|
set
|
|
|
|
{
|
|
|
|
SetValue(PackCerStateProperty, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty PackCerStateProperty =
|
|
|
|
DependencyProperty.Register("PackCerState", typeof(PackCerState), typeof(SetCerWindow));
|
|
|
|
|
|
|
|
public bool IsSetSpuCertificate { get; set; }
|
|
|
|
public PackPurchaseTaskService packTaskService { get; set; }
|
|
|
|
public CertificateModel CertificateModel { get; set; }
|
|
|
|
public CertificateModel SpuCertificateModel { get; set; }
|
|
|
|
|
|
|
|
public Action<CertificateModel, PackCerState> SaveResult { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
private void save_btn_Click(object sender, RoutedEventArgs e)
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(CertificateModel.ExcuteStander)
|
|
|
|
|| string.IsNullOrEmpty(CertificateModel.Shader) || string.IsNullOrEmpty(CertificateModel.BrandName)
|
|
|
|
|| string.IsNullOrEmpty(CertificateModel.Brand) || string.IsNullOrEmpty(CertificateModel.ProductShop)
|
|
|
|
|| string.IsNullOrEmpty(CertificateModel.ProductAdress))
|
|
|
|
{
|
|
|
|
//new TipsWindow("参数出错!请重新填写!").Show();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var standers = CertificateModel.ExcuteStander.Split(',', StringSplitOptions.RemoveEmptyEntries);
|
|
|
|
|
|
|
|
var resData = packTaskService.SaveCer(new CerRequest
|
|
|
|
{
|
|
|
|
Brand = CertificateModel.Brand,
|
|
|
|
BrandName = CertificateModel.BrandName,
|
|
|
|
ProductNo = CertificateModel.ProductNo,
|
|
|
|
SkuId = CertificateModel.SkuId,
|
|
|
|
ExcuteStander = CertificateModel.ExcuteStander,
|
|
|
|
LabelModel = (int)CertificateModel.LabelModel,
|
|
|
|
FactoryNumber = CertificateModel.FactoryNumber,
|
|
|
|
IsLogo = CertificateModel.IsLogo,
|
|
|
|
ProductAdress = CertificateModel.ProductAdress,
|
|
|
|
ProductShop = CertificateModel.ProductShop,
|
|
|
|
Shader = CertificateModel.Shader,
|
|
|
|
ApplyAge = CertificateModel.ApplyAge,
|
|
|
|
GoodsNumber = CertificateModel.GoodsNumber,
|
|
|
|
ProduceDate = CertificateModel.ProduceDate,
|
|
|
|
PurchaseSkuId = CertificateModel.PurchaseSkuId
|
|
|
|
|
|
|
|
});
|
|
|
|
if (resData == null || !resData.Success)
|
|
|
|
{
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
CertificateModel.Id = resData.Data;
|
|
|
|
if (SaveResult != null) SaveResult(CertificateModel, PackCerState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.Close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|