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.
139 lines
4.5 KiB
139 lines
4.5 KiB
using BBWYB.Client.APIServices;
|
|
using BBWYB.Client.Extensions;
|
|
using BBWYB.Client.Models;
|
|
using BBWYB.Client.Models.APIModel;
|
|
using BBWYB.Client.Models.PackPurchaseTask;
|
|
using CommunityToolkit.Mvvm.Input;
|
|
using SJ.Controls;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
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 BBWYB.Client.Views.PackPurchaseTask
|
|
{
|
|
/// <summary>
|
|
/// SetCerWindow.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class SetCerWindow : BWindow
|
|
{
|
|
public SetCerWindow()
|
|
{
|
|
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();
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
public class GoodsNumberCer
|
|
{
|
|
/// <summary>
|
|
/// 配件序号
|
|
/// </summary>
|
|
// public int GoodsNumber { get; set; }
|
|
public CertificateModel CertificateModel { get; set; }
|
|
}
|
|
}
|
|
|