From 8562c08ce8fb7ee9bce4ab049b7f1907b9417bb6 Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Fri, 19 May 2023 18:32:56 +0800 Subject: [PATCH] 1 --- .../APIServices/PackPurchaseTaskService.cs | 94 ++++ .../Request/UpdatePurchaseTaskRequest.cs | 139 +++++ .../PackPurchaseTask/ConfigPackResponse.cs | 62 +++ BBWY.Client/Models/Enums.cs | 4 + .../Models/PackTask/CertificateModel.cs | 10 +- BBWY.Client/Models/QualityTask/PurchaseSku.cs | 66 +++ .../PackTask/PublishTaskViewModel.cs | 5 +- .../QualityTask/QualityViewModel.cs | 476 ++++++++++++++++++ BBWY.Client/ViewModels/ViewModelLocator.cs | 10 + .../QualityTask/QualityLookCerWindow.xaml | 26 + .../QualityTask/QualityLookCerWindow.xaml.cs | 31 ++ .../QualityTask/QualitySetCerWindow.xaml | 52 ++ .../QualityTask/QualitySetCerWindow.xaml.cs | 122 +++++ .../Views/QualityTask/QualityWindow.xaml | 400 +++++++++++++++ .../Views/QualityTask/QualityWindow.xaml.cs | 16 + 15 files changed, 1508 insertions(+), 5 deletions(-) create mode 100644 BBWY.Client/APIServices/PackPurchaseTaskService.cs create mode 100644 BBWY.Client/Models/APIModel/Request/UpdatePurchaseTaskRequest.cs create mode 100644 BBWY.Client/Models/APIModel/Response/PackPurchaseTask/ConfigPackResponse.cs create mode 100644 BBWY.Client/Models/QualityTask/PurchaseSku.cs create mode 100644 BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs create mode 100644 BBWY.Client/Views/QualityTask/QualityLookCerWindow.xaml create mode 100644 BBWY.Client/Views/QualityTask/QualityLookCerWindow.xaml.cs create mode 100644 BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml create mode 100644 BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs create mode 100644 BBWY.Client/Views/QualityTask/QualityWindow.xaml create mode 100644 BBWY.Client/Views/QualityTask/QualityWindow.xaml.cs diff --git a/BBWY.Client/APIServices/PackPurchaseTaskService.cs b/BBWY.Client/APIServices/PackPurchaseTaskService.cs new file mode 100644 index 00000000..bfd26b7d --- /dev/null +++ b/BBWY.Client/APIServices/PackPurchaseTaskService.cs @@ -0,0 +1,94 @@ +using BBWY.Client.Models.APIModel; +using BBWY.Client.Models.APIModel.Request; +using BBWY.Client.Models.APIModel.Response.PackTask; +using BBWY.Common.Http; +using BBWY.Common.Models; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; + +namespace BBWY.Client.APIServices +{ + public class PackPurchaseTaskService : BaseApiService, IDenpendency + { + public PackPurchaseTaskService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) + { + } + public ApiResponse UpdatePurchaseTask(UpdatePurchaseTaskRequest updatePurchaseTaskRequest) + { + return SendRequest(globalContext.QKApiHost, "api/PackPurchaseTask/UpdatePurchaseTask", updatePurchaseTaskRequest, null, HttpMethod.Post); + } + + public ApiResponse GetConfigPack(string skuId, string skuPurchaseSchemeId, string orderId) + { + return SendRequest(globalContext.QKApiHost, "api/PackPurchaseTask/GetConfigPack", new + { + skuId, + skuPurchaseSchemeId, + orderId + } + , null, HttpMethod.Post); + } + /// + /// + /// + /// + /// + /// 到货情况(物流状态)(已到货 = 0,部分到货 = 1,未到货 = 2) + /// + public ApiResponse UpdateAvailabilityState(string orderId, string skuId, int availability) + { + return SendRequest(globalContext.QKApiHost, "api/PackPurchaseTask/UpdatePurchaseTask", new + { + orderId, + skuId, + availability + }, null, HttpMethod.Post); + } + + public ApiResponse SaveBarCode(BarCodeRequest barCodeModel) + { + return SendRequest(globalContext.QKApiHost, "api/PackTask/CommitBarCode", barCodeModel + , null, HttpMethod.Post); + } + + public ApiResponse SaveCer(CerRequest cerRequest) + { + return SendRequest(globalContext.QKApiHost, "api/Certificate/CommitSkuCer", cerRequest + , null, HttpMethod.Post); + } + + + public ApiResponse GetProductSku(string skuId) + { + + return SendRequest(globalContext.QKApiHost, $"api/PackTask/SearchProduct?skuId={skuId}&ShopId={globalContext.User.Shop.ShopId}", null, null, HttpMethod.Get); + + } + + public ApiResponse UpdateOrderPackState(string skuId, string orderId) + { + + return SendRequest(globalContext.QKApiHost, $"api/PackPurchaseTask/UpdateOrderPackState", new + { + skuId, + orderId + }, null, HttpMethod.Post); + + } + + public ApiResponse IsExitQikuTask(string skuId, string orderId) + { + + return SendRequest(globalContext.QKApiHost, $"api/PackPurchaseTask/IsExitQikuTask", new + { + skuId, + orderId + }, null, HttpMethod.Post); + + } + + + } +} diff --git a/BBWY.Client/Models/APIModel/Request/UpdatePurchaseTaskRequest.cs b/BBWY.Client/Models/APIModel/Request/UpdatePurchaseTaskRequest.cs new file mode 100644 index 00000000..09c44955 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Request/UpdatePurchaseTaskRequest.cs @@ -0,0 +1,139 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel.Request +{ + /// + /// 修改采购单任务 + /// + public class UpdatePurchaseTaskRequest + { + + /// + /// sku数量 + /// + public int SkuCount { get; set; } + /// + /// 到货情况(已到货 = 0,部分到货 = 1,未到货 = 2) + /// + public int Availability { get; set; } + /// + /// 落仓(本地仓=0,齐越仓=1,京东仓=2) + /// + public int PositionType { get; set; } + + /// + /// 打包类型(单件=0,多件=1) + /// + public int PackType { get; set; } + /// + /// 配件数量 + /// + public int GoodsNumber { get; set; } + /// + /// sku配件名称 + /// + public string SkuGoodsTitle { get; set; } + /// + /// 基础包装(快递袋=0,纸箱=1,麻袋=2) + /// + public int BasicPack { get; set; } + /// + /// 增量耗材 + /// + public string Increment1 { get; set; } + + /// + /// 注意事项 + /// + public string MarkMessage { get; set; } + + /// + ///条形码Id + /// + public long? BarCodeId { get; set; } + + /// + /// 合格证Id 格式: id,id 186,187 + /// + public string CerId { get; set; } + /// + /// 是否需要条形码 + /// + public bool? NeedBar { get; set; } + /// + /// 是否需要合格证 + /// + public bool? NeedCer { get; set; } + /// + /// 合格证位置 + /// + public int? CertificatePosition { get; set; } + + /// + /// 加急 + /// + public int IsWorry { get; set; } + + /// + /// 拳探订单id + /// + public string OrderId { get; set; } + + /// + /// skuId + /// + public string SkuId { get; set; } + + #region 更新数据 + /// + /// 品名 + /// + public string BrandName { get; set; } + /// + /// 货号 + /// + public string ProductNo { get; set; } + + /// + /// 图 + /// + public string Logo { get; set; } + + /// + /// 名称 + /// + public string SkuName { get; set; } + /// + /// 品牌 + /// + public string Brand { get; set; } + #endregion + + /// + /// 采购方案id + /// + public string SkuPurchaseSchemeId { get; set; } + + /// + /// 保存 配置商品合格证状态配置信息 + /// + public PurchaseSkuSpec[] PurchaseSkuSpecs { get; set; } + } + + /// + /// 配置商品合格证状态 + /// + public class PurchaseSkuSpec + { + /// + /// 商品配件id + /// + public string PurchaseSkuId { get; set; } + /// + /// 合格证配置状态 + /// + public bool IsNeedCer { get; set; } + } +} diff --git a/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/ConfigPackResponse.cs b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/ConfigPackResponse.cs new file mode 100644 index 00000000..f9005265 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/ConfigPackResponse.cs @@ -0,0 +1,62 @@ +using BBWY.Client.Models.APIModel.Response.PackTask; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel +{ + /// + /// 配置打包信息数据 + /// + public class ConfigPackResponse + { + + /// + /// 配件列表 + /// + public PurchaseSku[] PurchaseSkus { get; set; } + + /// + /// 采购方案id + /// + public string SkuPurchaseSchemeId { get; set; } + /// + /// 条形码 + /// + public BarCodeModel BarCode { get; set; } + + public PackConfig PackConfig { get; set; } + } + /// + /// 配件sku + /// + public class PurchaseSku + { + /// + /// 配件图 + /// + public string Logo { get; set; } + /// + /// 配件商品Id + /// + public string PurchaseSkuId { get; set; } + + /// + /// 配件商品spuId + /// + public string PurchaseProductId { get; set; } + /// + /// 配件名称 + /// + public string Title { get; set; } + /// + /// 是否需要配置合格证 + /// + public bool IsNeedCer { get; set; } + + /// + /// 合格证配置信息 + /// + public CertificateModel CerDTO { get; set; } + } +} diff --git a/BBWY.Client/Models/Enums.cs b/BBWY.Client/Models/Enums.cs index 3c353aee..61fd6544 100644 --- a/BBWY.Client/Models/Enums.cs +++ b/BBWY.Client/Models/Enums.cs @@ -402,4 +402,8 @@ 胶带 = 2, 其他 = 3 } + public enum PackCerState + { + 合格证信息 = 0, 无需合格证 = 1 + } } diff --git a/BBWY.Client/Models/PackTask/CertificateModel.cs b/BBWY.Client/Models/PackTask/CertificateModel.cs index cde4a7ad..437d9a1a 100644 --- a/BBWY.Client/Models/PackTask/CertificateModel.cs +++ b/BBWY.Client/Models/PackTask/CertificateModel.cs @@ -23,7 +23,7 @@ namespace BBWY.Client.Models private string spuId; /// - /// 品牌 + /// spu /// public string SpuId { get => spuId; set { Set(ref spuId, value); } } @@ -139,10 +139,10 @@ namespace BBWY.Client.Models } - - private int goodsNumber =1; + + private int goodsNumber = 1; /// /// 配件序号 /// @@ -154,5 +154,9 @@ namespace BBWY.Client.Models /// public string ProduceDate { get => produceDate; set { Set(ref produceDate, value); } } + /// + /// 配件商品Id + /// + public string PurchaseSkuId { get; set; } } } diff --git a/BBWY.Client/Models/QualityTask/PurchaseSku.cs b/BBWY.Client/Models/QualityTask/PurchaseSku.cs new file mode 100644 index 00000000..01693fe1 --- /dev/null +++ b/BBWY.Client/Models/QualityTask/PurchaseSku.cs @@ -0,0 +1,66 @@ +using GalaSoft.MvvmLight; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.QualityTask +{ + /// + /// 配件sku + /// + public class PurchaseSku : NotifyObject + { + + /// + /// 配件图 + /// + private string logo; + /// + /// 配件商品Id + /// + private string purchaseSkuId; + /// + /// 配件名称 + /// + private string title; + /// + /// 是否需要配置合格证 + /// + private bool isNeedCer; + /// + /// 配件图 + /// + public string Logo { get => logo; set { Set(ref logo, value); } } + /// + /// 配件商品Id + /// + public string PurchaseSkuId { get => purchaseSkuId; set { Set(ref purchaseSkuId, value); } } + /// + /// 配件名称 + /// + public string Title { get => title; set { Set(ref title, value); } } + /// + /// 是否需要配置合格证 + /// + public bool IsNeedCer { get => isNeedCer; set { Set(ref isNeedCer, value); } } + /// + /// 合格证配置信息 + /// + public CertificateModel CerDTO { get; set; } + + private bool isSetCertificate; + /// + /// 设置显示(合格证) + /// + public bool IsSetCertificate + { + get => isSetCertificate; set + { + + Set(ref isSetCertificate, value); + //IsNeedCertificateModel = IsSetCertificate ? Need.不需要 : Need.需要; + } + } + + } +} diff --git a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs index 4479d6eb..18170d99 100644 --- a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs @@ -631,13 +631,14 @@ namespace BBWY.Client.ViewModels.PackTask IsNeedCertificateModel = model.CertificateModel == null ? Need.不需要 : Need.需要; CertificatePosition = model.CertificatePosition; TaskId = model.TaskId; - string[] increateDatas = model.Increment1.Split(','); + + string[] increateDatas = model.Increment1?.Split(','); bool isTrue = false; foreach (var item in increates) { isTrue = false; - if (increateDatas.Contains(item)) + if (increateDatas!=null&& increateDatas .Count()>0&& increateDatas.Contains(item)) { isTrue = true; } diff --git a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs new file mode 100644 index 00000000..8ccfc59e --- /dev/null +++ b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs @@ -0,0 +1,476 @@ +using BBWY.Client.APIServices; +using BBWY.Client.Models.PackTask; +using BBWY.Client.Models; +using BBWY.Client.Views.PackTask; +using BBWY.Common.Models; +using GalaSoft.MvvmLight.Command; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Windows.Input; +using System.Windows; +using BBWY.Client.Models.QualityTask; +using BBWY.Client.Views.QualityTask; + +namespace BBWY.Client.ViewModels +{ + public class QualityViewModel:BaseVM,IDenpendency + { + #region 属性 + + private ObservableCollection purchaseSkuList; + public ObservableCollection PurchaseSkuList { get => purchaseSkuList; set { Set(ref purchaseSkuList, value); } } + + private string searchSkuId; + public string SearchSkuId { get => searchSkuId; set { Set(ref searchSkuId, value); } } + + // public long TaskId { get; set; } + //private bool isSelected; + //public bool IsSelected { get => isSelected; set { Set(ref isSelected, value); } } + + private ObservableCollection worryList = new ObservableCollection { + "否","是" + }; + public ObservableCollection WorryList { get => worryList; set { Set(ref worryList, value); } } + + private ObservableCollection positionTypeList = new ObservableCollection { + "商家仓","齐越仓", "京东仓","聚水潭仓"}; + public ObservableCollection PositionTypeList { get => positionTypeList; set { Set(ref positionTypeList, value); } } + + private ObservableCollection packTypeList = new ObservableCollection { + "单件","多件" + }; + public ObservableCollection PackTypeList { get => packTypeList; set { Set(ref packTypeList, value); } } + + private ObservableCollection basicPackList = new ObservableCollection { + "快递袋","纸箱","麻袋" + }; + public ObservableCollection BasicPackList { get => basicPackList; set { Set(ref basicPackList, value); } } + + private ObservableCollection isNeedBarCodeList = new ObservableCollection { + "需要", "不需要" }; + public ObservableCollection IsNeedBarCodeList { get => isNeedBarCodeList; set { Set(ref isNeedBarCodeList, value); } } + + private ObservableCollection isNeedCerList = new ObservableCollection { + "需要", "不需要" }; + public ObservableCollection IsNeedCerList { get => isNeedCerList; set { Set(ref isNeedCerList, value); } } + + + private ObservableCollection certificatePositionList = new ObservableCollection { + "无","外部包装","产品包装" + }; + public ObservableCollection CertificatePositionList { get => certificatePositionList; set { Set(ref certificatePositionList, value); } } + + private ObservableCollection availabilityList = new ObservableCollection { + "已到货","部分到货","未到货" + }; + public ObservableCollection AvailabilityList { get => availabilityList; set { Set(ref availabilityList, value); } } + + private int skuCount; + /// + /// Sku任务数 + /// + public int SkuCount { get => skuCount; set { Set(ref skuCount, value); } } + + private string skuId; + /// + /// Sku + /// + public string SkuId { get => skuId; set { Set(ref skuId, value); } } + + + + public string OrderId { get; set; } + + private string logo; + /// + /// 店铺Sku图链接 + /// + public string Logo { get => logo; set { Set(ref logo, value); } } + + private string skuName; + /// + /// 采购Sku名称 + /// + public string SkuName { get => skuName; set { Set(ref skuName, value); } } + + private string brand; + /// + /// 品牌 + /// + public string Brand { get => brand; set { Set(ref brand, value); } } + + + private string productNo; + /// + /// 货号 + /// + public string ProductNo { get => productNo; set { Set(ref productNo, value); } } + + private string brandName; + /// + /// 品名(手写上传) + /// + public string BrandName { get => brandName; set { Set(ref brandName, value); } } + + + private int goodsNumber; + /// + /// 配件数 + /// + public int GoodsNumber { get => goodsNumber; set { Set(ref goodsNumber, value); } } + private Worry isWorry; + /// + /// 是否加急 + /// + public Worry IsWorry { get => isWorry; set { Set(ref isWorry, value); } } + + private TaskState availability; + /// + /// 到货情况(待收货=0,部分收货=1,已到货=2) + /// + public TaskState Availability { get => availability; set { Set(ref availability, value); } } + + private PackType packType; + /// + /// 打包类型(单件=0,多件=1) + /// + public PackType PackType { get => packType; set { Set(ref packType, value); } } + + private BasicPack basicPack; + /// + /// 基础包装(快递袋=0,纸箱=1,麻袋=2) + /// + public BasicPack BasicPack { get => basicPack; set { Set(ref basicPack, value); } } + + private PositionType positionType; + /// + /// 落仓(商家仓=0,齐越仓=1,京东仓=2,聚水潭仓=3) + /// + public PositionType PositionType { get => positionType; set { Set(ref positionType, value); } } + + private string skuTitle; + /// + /// sku配件商品名称 + /// + public string SkuTitle { get => skuTitle; set { Set(ref skuTitle, value); } } + + private Need isNeedBarCode; + /// + /// 是否需要合格证 + /// + public Need IsNeedBarCode { get => isNeedBarCode; set { Set(ref isNeedBarCode, value); } } + + + private Need isNeedCertificateModel; + /// + /// 是否需要条形码 + /// + public Need IsNeedCertificateModel { get => isNeedCertificateModel; set { Set(ref isNeedCertificateModel, value); } } + + + private BarCodeModel barCodeModel; + /// + /// 条形码 + /// + public BarCodeModel BarCodeModel { get => barCodeModel; set { Set(ref barCodeModel, value); } } + + + private bool isSetBarCode; + /// + /// 设置显示(条形码) + /// + public bool IsSetBarCode + { + get => isSetBarCode; + set + { + + Set(ref isSetBarCode, value); + // IsNeedBarCode = IsSetBarCode ? Need.不需要 : Need.需要; + } + } + + private bool isSetCertificate; + /// + /// 设置显示(合格证) + /// + public bool IsSetCertificate + { + get => isSetCertificate; set + { + + Set(ref isSetCertificate, value); + //IsNeedCertificateModel = IsSetCertificate ? Need.不需要 : Need.需要; + } + } + private string setSpuCerStatus; + + public string SetSpuCerStatus { get => setSpuCerStatus; set { Set(ref setSpuCerStatus, value); } } + private bool isSetSpuCertificate = true; + + + /// + /// 设置spu显示(合格证) + /// + public bool IsSetSpuCertificate + { + get => isSetSpuCertificate; set + { + + Set(ref isSetSpuCertificate, value); + SetSpuCerStatus = IsSetSpuCertificate ? "设置spu模板" : "修改spu模板"; + } + } + + + private string saveTask; + + /// + /// 设置显示(合格证) + /// + public string SaveTask { get => saveTask; set { Set(ref saveTask, value); } } + + + private string spuId; + /// + /// 合格证 + /// + public string SpuId { get => spuId; set { Set(ref spuId, value); } } + + private CertificateModel spuCertificateModel; + /// + /// spu合格证 + /// + public CertificateModel SpuCertificateModel { get => spuCertificateModel; set { Set(ref spuCertificateModel, value); } } + + + + private CertificateModel certificateModel; + /// + /// 合格证 + /// + public CertificateModel CertificateModel { get => certificateModel; set { Set(ref certificateModel, value); } } + + /// + /// 合格证位置(外部包装=0,产品包装=1) + /// + private CertificatePosition certificatePosition; + /// + /// 合格证位置(外部包装=0,产品包装=1) + /// + public CertificatePosition CertificatePosition { get => certificatePosition; set { Set(ref certificatePosition, value); } } + + /// + /// 注意事项(对接备注) + /// + private string markMessage; + /// + /// 注意事项(对接备注) + /// + public string MarkMessage { get => markMessage; set { Set(ref markMessage, value); } } + + + private ObservableCollection increateList; + /// + /// 增量耗材查询关键字 + /// + public ObservableCollection IncreateList { get => increateList; set { Set(ref increateList, value); } } + string[] increates = new string[] { "气泡纸", "气泡袋", "POP袋", "折纸箱", "气泡纸封边", "彩盒", "剪胶", "剪彩带", "快递袋", "收纳盒", "纸箱子", "装纸箱", "封边", "胶带", "折彩盒" }; + + PackPurchaseTaskService packPurchaseTaskService; + + ProductService productService; + GlobalContext globalContext; + private bool isLoading = false; + public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } + #endregion + + public QualityViewModel(ProductService productService, GlobalContext globalContext, PackPurchaseTaskService packPurchaseTaskService, PurchaseService purchaseService) + { + this.packPurchaseTaskService = packPurchaseTaskService; + this.productService = productService; + this.globalContext = globalContext; + + OpenSkuDetailCommand = new RelayCommand(OpenSkuDetail); + SetBarCodeCommand = new RelayCommand(SetBarCode); + SetCertificateCommand = new RelayCommand(SetCertificate); + LookBarCommand = new RelayCommand(LookBar); + LookCerCommand = new RelayCommand(LookCer); + SearchSkuCommand = new RelayCommand(SearchSku); + IncreateList = new ObservableCollection(); + foreach (var item in increates) + { + IncreateList.Add(new IncreateModel + { + IncreateName = item, + IsSelected = false + }); + } + + this.purchaseService = purchaseService; +#if DEBUG + + //Test(); +#endif + } + PurchaseService purchaseService; + public string OriginShopName { get; set; } + public string SkuPurchaseSchemeId { get; set; } + public Platform Platform { get; set; } + public string ShopId { get; set; } + + public string UserName { get; set; } + public void Test(OrderSku order) + { + SearchSku(order); + + + } + + #region 方法 + public ICommand SetBarCodeCommand { get; set; } + public ICommand SetCertificateCommand { get; set; } + public ICommand LookBarCommand { get; set; } + public ICommand LookCerCommand { get; set; } + + public ICommand OpenSkuDetailCommand { get; set; } + public ICommand CreateTaskCommand { get; set; } + + public ICommand SearchSkuCommand { get; set; } + + private void SetBarCode() + { + if (string.IsNullOrEmpty(SkuId)) + { + return; + } + //if (TaskId > 0 && string.IsNullOrEmpty(SpuId))//修改界面刷新配置数据 + //{ + // SearchSku(SkuId); + //} + + if (BarCodeModel == null) + { + BarCodeModel = new BarCodeModel(); + BarCodeModel.ProductNo = ProductNo; + BarCodeModel.Brand = Brand; + BarCodeModel.SkuId = SkuId; + BarCodeModel.SkuName = SkuName; + } + if (!string.IsNullOrEmpty(BrandName)) + BarCodeModel.BrandName = BrandName; + + SetBarCodeWindow setBarCodeWindow = new SetBarCodeWindow(); + setBarCodeWindow.LoadData(BarCodeModel, packPurchaseTaskService); + setBarCodeWindow.SaveResult = b => + { + BarCodeModel = b; + IsSetBarCode = false; + IsNeedBarCode = Need.需要; + }; + setBarCodeWindow.Show(); + } + + /// + /// 设置合格证 + /// + private void SetCertificate(PurchaseSku model) + { + + if (model.CerDTO == null) + { + model.CerDTO = new CertificateModel + { + ProductNo = ProductNo, + Brand = Brand, + SkuId = SkuId, + PurchaseSkuId = model.PurchaseSkuId + + }; + } + if (!string.IsNullOrEmpty(BrandName)) + model.CerDTO.BrandName = BrandName; + + QualitySetCerWindow setCerWindow = new QualitySetCerWindow(); + setCerWindow.LoadData(model.IsNeedCer, model.CerDTO, packPurchaseTaskService, spuCertificateModel, IsSetSpuCertificate); + setCerWindow.SaveResult = (s, PackCerState) => + { + var skus = PurchaseSkuList.SingleOrDefault(p => p.PurchaseSkuId == s.PurchaseSkuId); + skus.CerDTO = s; + skus.IsSetCertificate = false; + skus.IsNeedCer = PackCerState == PackCerState.合格证信息; + IsNeedCertificateModel = Need.需要; + }; + setCerWindow.Show(); + } + + + /// + /// 查看合格证 + /// + private void LookCer(string id) + { + LookCerWindow lookCerWindow = new LookCerWindow(PurchaseSkuList.SingleOrDefault(p => p.PurchaseSkuId == id).CerDTO); + lookCerWindow.Show(); + } + /// + /// 查看条形码 + /// + private void LookBar() + { + LookBarCodeWindow look = new LookBarCodeWindow(); + look.SetData(BarCodeModel); + look.Show(); + } + + /// + /// 搜索 skuId(todo:) + /// + public void SearchSku(object obj) + { + InitData(); + } + public Action ReflashWindow { get; set; } + public void InitData() + { + + IsSetBarCode = true; + SkuTitle = ""; + BrandName = ""; + GoodsNumber = 0; + PackType = PackType.单件; + BasicPack = BasicPack.快递袋; + // Availability = (TaskState.)config.Availability; + //MarkMessage = config.MarkMessage; + CertificatePosition = CertificatePosition.无; + // Increment1 = config.Increment1; + + IsNeedBarCode = Need.需要; + IsNeedCertificateModel = Need.不需要; + } + private void OpenSkuDetail(object param) + { + var paramList = (object[])param; + // var orderId = paramList[0].ToString(); + var skuId = paramList[0].ToString(); + + + var url = $"https://item.jd.com/{skuId}.html"; + try + { + System.Diagnostics.Process.Start("explorer.exe", url); + } + catch (Exception ex) + { + Clipboard.SetText(url); + MessageBox.Show($"{ex.Message}\r\n调用浏览器失败,网页链接已复制到剪切板,请手动打开浏览器访问", "提示"); + } + + } + + #endregion + } +} diff --git a/BBWY.Client/ViewModels/ViewModelLocator.cs b/BBWY.Client/ViewModels/ViewModelLocator.cs index 7ccd0dad..7a3489c0 100644 --- a/BBWY.Client/ViewModels/ViewModelLocator.cs +++ b/BBWY.Client/ViewModels/ViewModelLocator.cs @@ -294,5 +294,15 @@ namespace BBWY.Client.ViewModels return s.ServiceProvider.GetRequiredService(); } } + + + public QualityViewModel QualityTask + { + get + { + using var s = sp.CreateScope(); + return s.ServiceProvider.GetRequiredService(); + } + } } } diff --git a/BBWY.Client/Views/QualityTask/QualityLookCerWindow.xaml b/BBWY.Client/Views/QualityTask/QualityLookCerWindow.xaml new file mode 100644 index 00000000..01c8f2fa --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualityLookCerWindow.xaml @@ -0,0 +1,26 @@ + + + + + + + + + + + + diff --git a/BBWY.Client/Views/QualityTask/QualityLookCerWindow.xaml.cs b/BBWY.Client/Views/QualityTask/QualityLookCerWindow.xaml.cs new file mode 100644 index 00000000..8bc37874 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualityLookCerWindow.xaml.cs @@ -0,0 +1,31 @@ +using BBWY.Client.Extensions; +using BBWY.Client.Models; +using BBWY.Controls; +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.QualityTask +{ + /// + /// QualityLookCerWindow.xaml 的交互逻辑 + /// + public partial class QualityLookCerWindow : BWindow + { + public QualityLookCerWindow(CertificateModel certificate) + { + CertificateModel = certificate.Copy(); + InitializeComponent(); + this.DataContext = this; + } + public CertificateModel CertificateModel { get; set; } + } +} diff --git a/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml new file mode 100644 index 00000000..5b587f02 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs new file mode 100644 index 00000000..ea3f0c79 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs @@ -0,0 +1,122 @@ +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; + +namespace BBWY.Client.Views.QualityTask +{ + /// + /// QualitySetCerWindow.xaml 的交互逻辑 + /// + public partial class QualitySetCerWindow : Window + { + public QualitySetCerWindow() + { + InitializeComponent(); + SetPackCerStateCommand = new RelayCommand(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 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(); + } + } +} diff --git a/BBWY.Client/Views/QualityTask/QualityWindow.xaml b/BBWY.Client/Views/QualityTask/QualityWindow.xaml new file mode 100644 index 00000000..3880d1c9 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualityWindow.xaml @@ -0,0 +1,400 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BBWY.Client/Views/QualityTask/QualityWindow.xaml.cs b/BBWY.Client/Views/QualityTask/QualityWindow.xaml.cs new file mode 100644 index 00000000..fadef789 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualityWindow.xaml.cs @@ -0,0 +1,16 @@ +using BBWY.Controls; + + +namespace BBWY.Client.Views.QualityTask +{ + /// + /// QualityWindow.xaml 的交互逻辑 + /// + public partial class QualityWindow : BWindow + { + public QualityWindow() + { + InitializeComponent(); + } + } +}