diff --git a/BBWY.Client/APIServices/QiKu/QualityTaskService.cs b/BBWY.Client/APIServices/QiKu/QualityTaskService.cs index 5a113f14..a093c742 100644 --- a/BBWY.Client/APIServices/QiKu/QualityTaskService.cs +++ b/BBWY.Client/APIServices/QiKu/QualityTaskService.cs @@ -52,7 +52,7 @@ namespace BBWY.Client.APIServices.QiKu public ApiResponse QualityTaskException(long TaskId, TaskExceptionType TaskExceptionType, string RemarkMsg) { - return SendRequest(globalContext.QKApiHost, $"api/QualityTask/QualityTaskException?TaskId={TaskId}", + return SendRequest(globalContext.QKApiHost, $"api/QualityTask/QualityTaskException", new { TaskId, TaskExceptionType, @@ -61,5 +61,21 @@ namespace BBWY.Client.APIServices.QiKu } , null, HttpMethod.Post); } + + + + public ApiResponse SearchProductAttrsBySkuId(string SkuId, string AppKey, string AppSecret, string AppToken, Platform platform) + { + return SendRequest(globalContext.QKApiHost, $"api/Product/SearchProductAttrsBySkuId", + new + { + SkuId, + AppKey, + AppSecret, + AppToken, + platform + } + , null, HttpMethod.Post); + } } } diff --git a/BBWY.Client/Models/APIModel/Response/QualityTask/SearchProductAttrsBySkuIdResponse.cs b/BBWY.Client/Models/APIModel/Response/QualityTask/SearchProductAttrsBySkuIdResponse.cs new file mode 100644 index 00000000..cf2405cf --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/QualityTask/SearchProductAttrsBySkuIdResponse.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel +{ + /// + /// + /// + public class SearchProductAttrsBySkuIdResponse + { + /// + /// 品牌 + /// + public string Brand { get; set; } + + /// + /// 是否在集团品牌列表 + /// + public bool IsTeamBrand { get; set; } + + + /// + /// 适用年龄 + /// + public string ApplyAge { get; set; } + + /// + /// 适用年龄是否大于14 + /// + public bool? IsApplyAgeOver14 { get; set; } + } +} diff --git a/BBWY.Client/Models/PackTask/PackTaskModel.cs b/BBWY.Client/Models/PackTask/PackTaskModel.cs index ad2c28ff..ba53944c 100644 --- a/BBWY.Client/Models/PackTask/PackTaskModel.cs +++ b/BBWY.Client/Models/PackTask/PackTaskModel.cs @@ -60,7 +60,7 @@ namespace BBWY.Client.Models /// 修改任务 /// public ICommand UpdateTaskCommand { get; set; } - public ICommand QualityTaskCommand { get; set; } + public Action ReflashTask { get; set; } private void UpdateTask() { @@ -104,60 +104,11 @@ namespace BBWY.Client.Models LookCerCommand = new RelayCommand(LookCer); SetServiceCommand = new RelayCommand(SetService); UpdateTaskCommand = new RelayCommand(UpdateTask); - QualityTaskCommand = new RelayCommand(QualityTask); - } - - private void QualityTask() - { - //加载数据 - QualityWindow service = new QualityWindow(this, ReflashTask); - service.Show(); - QualityProductWindow qualityProduct = new QualityProductWindow("商品合格证情况", "商品包装有合格证信息", "商品包装无合格证信息", (isTrue) => { - - if (isTrue) - { - QualityProductWindow qualityProduct = new QualityProductWindow("商品品牌情况", "商品包装有品牌信息", "商品包装无品牌信息", (isTrue) => { - - if (isTrue) - { - - } - else - { - - } - - - - }); - qualityProduct.ShowDialog(); - } - else - { - if (this.CertificateModel==null|| !this.CertificateModel.Any())//未配置 - { - - } - else - { - - } - - - - } - - - }); - - qualityProduct.ShowDialog(); - - - - } + + private void SetService() { diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index 79a10807..23eaafed 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs @@ -30,6 +30,9 @@ using BBWY.Client.APIServices.QiKu; using BBWY.Client.Views.PackerTask; using BBWY.Client.Models.QualityTask; using BBWY.Client.Views.QualityTask; +using BBWY.Client.Views.QualityTipWindows; +using System.Windows.Interop; +using NPOI.SS.Formula.Functions; namespace BBWY.Client.ViewModels.PackTask { @@ -753,6 +756,10 @@ namespace BBWY.Client.ViewModels.PackTask public ICommand QualityTaskExceptionCommand { get; set; } + /// + /// 验收任务 + /// + public ICommand QualityTaskCommand { get; set; } public WareHouseListViewModel(PackTaskService packTaskService, GlobalContext globalContext, SealBoxService sealBoxService, PackUserService packUserService, MarkMessageService markMessageService, QualityTaskService qualityTaskService) { @@ -859,6 +866,181 @@ namespace BBWY.Client.ViewModels.PackTask this.qualityTaskService = qualityTaskService; QualityTaskExceptionCommand = new RelayCommand(QualityTaskException); + + QualityTaskCommand = new RelayCommand(QualityTask); + } + + private void QualityTask(long taskId) + { + var model = PackTaskList?.SingleOrDefault(p => p.TaskId == taskId); + + if (model == null) { MessageBox.Show($"任务不存在,任务id:{taskId}"); return; } + + var shopList = globalContext.User.ShopList; + var shop = shopList.FirstOrDefault(s => s.ShopName == model.ShopName); + if (shop == null) + { + MessageBox.Show($"查找不到店铺信息, {model.ShopName}"); + return; + } + var skuAttsDetailRes = qualityTaskService.SearchProductAttrsBySkuId(model.SkuId, shop.AppKey, shop.AppSecret, shop.AppToken, shop.Platform); + if (skuAttsDetailRes == null || !skuAttsDetailRes.Success) + { + MessageBox.Show(skuAttsDetailRes?.Msg); + return; + } + var skuAttsDetail = skuAttsDetailRes.Data; + + + + bool isqualityCer = false; //验收合格证 + + + + + + + new QualityProductWindow("商品合格证情况", "商品包装有合格证信息", "商品包装无合格证信息", (ishaveCer) => + { + if (ishaveCer)//验收商品 有合格证 + { + if (skuAttsDetail.ApplyAge.IsNullOrEmpty() || (skuAttsDetail.IsApplyAgeOver14 != null && skuAttsDetail.IsApplyAgeOver14.Value))//不存在使用年龄 或者适用年龄大于14 + { + //todo: 判断是否首次验收 只支持供应链 有采购方案的 + new QualityProductWindow("商品合格证情况", "商品合格证类型有3C标", "商品合格证类型无3C标", (ishave3c) => + { + if (ishave3c) + { + //todo: 存配置 只支持供应链 有采购方案的 + + + //验收有效性 + + new QualityProductWindow("商品合格证情况", "商品合格证类型有3C标", "商品合格证类型无3C标", (iscanuser) => + { + + if (iscanuser) + { + isqualityCer = true;//验收正常 + return; + } + //当前合格证3c无效 + //todo: + // 通知采购方问题 咨询是否可替款 + MessageBox.Show("提示采购部门,当前任务详情页展示适用年龄为14岁以下, 实物商品配置的合格证当前合格证3c无效,任务已挂起"); + + }).ShowDialog(); + + + return; + } + + //todo: + // 通知采购方问题 咨询是否可替款 + MessageBox.Show("提示采购部门,当前任务详情页展示适用年龄为14岁以下, 实物商品配置的合格证没有3C,咨询是否可替款,任务已挂起"); + + + }).ShowDialog(); + } + + //验收商品合格证是否有品牌 + + new QualityProductWindow("商品合格证情况", "商品包装合格证上有品牌信息", "商品包装合格证上无品牌信息", (iscerhavebrand) => + { + + if (iscerhavebrand) + { + + new QualityProductWindow("商品合格证情况", $"商品包装合格证上的品牌是{skuAttsDetail.Brand}", $"商品包装合格证上的品牌不是{skuAttsDetail.Brand}", (istruebrand) => + { + if (!istruebrand) + { + //需要合格证 + if (model.CertificateModel == null || !model.CertificateModel.Any())//未配置 + { + //未配置 todo: 写接口通知采购方问题 + MessageBox.Show("提示采购部门,当前任务未配置合格证,赶紧配置,任务已挂起"); + return; + } + //打印合格证 完全遮盖包装合格证信息 + } + isqualityCer = true;//验收合格证完毕 + }).ShowDialog(); + } + + }).ShowDialog(); + } + else + { + //需要合格证 + if (model.CertificateModel == null || !model.CertificateModel.Any())//未配置 + { + //未配置 todo: 写接口通知采购方问题 + MessageBox.Show("提示采购部门,当前任务未配置合格证,赶紧配置,任务已挂起"); + return; + } + + if (skuAttsDetail.ApplyAge.IsNullOrEmpty() || (skuAttsDetail.IsApplyAgeOver14 != null && skuAttsDetail.IsApplyAgeOver14.Value))//不存在使用年龄 或者适用年龄大于14 + { + isqualityCer = true;//验收正常 + return; + } + //年龄低于14 + + if (!model.CertificateModel.Any(c => c.LabelModel != CertificateLabelModel.标准有3c))//所有配置的合格证都是标准3c + { + isqualityCer = true;//验收正常 + return; + } + //不存在 3c 通知采购方问题 + MessageBox.Show("提示采购部门,当前任务配置的合格证没有3C,赶紧配置,任务已挂起"); + return; + } + + }).ShowDialog(); + + if (isqualityCer)//合格证验收完毕 + { + + new QualityProductWindow("商品品牌情况", "商品包装有品牌信息", "商品包装无品牌信息", (ishavebrand) => + { + + if (ishavebrand && !skuAttsDetail.IsTeamBrand)//有品牌且品牌不是集团的 + { + new QualityProductWindow($"商品品牌情况", $"商品包装品牌是{skuAttsDetail.Brand}", $"商品包装品牌不是{skuAttsDetail.Brand}", (istruebrand) => { + + + if (istruebrand) + { + //无需贴商标 + } + else + { + //需覆盖商标 + } + + }).ShowDialog(); + + + } + else + { + //需贴商标 + } + + + + }).ShowDialog(); + + + + QualityWindow service = new QualityWindow(model, ReflashTask); + service.Show(); + } + + + + } private void QualityTaskException(long taskId) diff --git a/BBWY.Client/Views/QualityTask/QualityControl.xaml b/BBWY.Client/Views/QualityTask/QualityControl.xaml index 26174a1a..5b5d15ce 100644 --- a/BBWY.Client/Views/QualityTask/QualityControl.xaml +++ b/BBWY.Client/Views/QualityTask/QualityControl.xaml @@ -353,7 +353,8 @@ diff --git a/BBWY.Client/Views/QualityTask/WaitQualityControl.xaml b/BBWY.Client/Views/QualityTask/WaitQualityControl.xaml index 3b716116..a93d2db1 100644 --- a/BBWY.Client/Views/QualityTask/WaitQualityControl.xaml +++ b/BBWY.Client/Views/QualityTask/WaitQualityControl.xaml @@ -580,7 +580,8 @@ diff --git a/BBWY.Client/Views/QualityTipWindows/QualityProductWindow.xaml b/BBWY.Client/Views/QualityTipWindows/QualityProductWindow.xaml index 4ad2ae3b..f07330be 100644 --- a/BBWY.Client/Views/QualityTipWindows/QualityProductWindow.xaml +++ b/BBWY.Client/Views/QualityTipWindows/QualityProductWindow.xaml @@ -23,7 +23,7 @@ - + diff --git a/BBWY.Client/Views/QualityTipWindows/QualityProductWindow.xaml.cs b/BBWY.Client/Views/QualityTipWindows/QualityProductWindow.xaml.cs index 8811bd1d..31d254d2 100644 --- a/BBWY.Client/Views/QualityTipWindows/QualityProductWindow.xaml.cs +++ b/BBWY.Client/Views/QualityTipWindows/QualityProductWindow.xaml.cs @@ -22,18 +22,19 @@ namespace BBWY.Client.Views.QualityTipWindows public QualityProductWindow(string title, string isTrueMsg, string isFalseMsg, Action clickReturn) { InitializeComponent(); - this.DataContext = this; - Title = title; + + MsgTitle = title; IsTrueMsg = isTrueMsg; IsFalseMsg = isFalseMsg; ClickReturn = clickReturn; + this.DataContext = this; } - private string title; + private string msgTitle; /// /// 封箱配置状态 /// - public string Title { get => title; set { Set(ref title, value); } } + public string MsgTitle { get => msgTitle; set { Set(ref msgTitle, value); } } private string isTrueMsg;