From 2e3dba49fe7fd48980fa4041795a00cd7b017f6e Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Fri, 3 Nov 2023 21:58:57 +0800 Subject: [PATCH 1/7] 1 --- .../PackTask/WareHouseListViewModel.cs | 44 +++++++++- .../Views/QualityTask/WaitQualityControl.xaml | 2 +- .../SealBox/SealBoxNoConfigureControl.xaml | 26 ++++-- .../QualityStorePickProductWindow.xaml | 83 +++++++++++++++++++ .../QualityStorePickProductWindow.xaml.cs | 56 +++++++++++++ .../StorePickSelf/StorePickProductWindow.xaml | 8 +- .../StorePickProductWindow.xaml.cs | 12 ++- 7 files changed, 215 insertions(+), 16 deletions(-) create mode 100644 BBWY.Client/Views/StorePickSelf/QualityStorePickProductWindow.xaml create mode 100644 BBWY.Client/Views/StorePickSelf/QualityStorePickProductWindow.xaml.cs diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index f7cfd837..78c7ffac 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs @@ -654,6 +654,8 @@ namespace BBWY.Client.ViewModels.PackTask StoreGetBySelfCommand = new RelayCommand(StoreGetBySelf); + QualityStoreGetBySelfCommand = new RelayCommand(QualityStoreGetBySelf); + CompletedPackTaskCommand = new RelayCommand(CompletedPackTask); SetWareTypeCommand = new RelayCommand(s => @@ -992,7 +994,6 @@ namespace BBWY.Client.ViewModels.PackTask //Task.Factory.StartNew(() => SearchTaskList()); } - private void StoreGetBySelf(long taskId) { @@ -1026,7 +1027,40 @@ namespace BBWY.Client.ViewModels.PackTask Task.Factory.StartNew(() => SearchTaskList()); return true; - }); + },false); + sorePickProductWindow.ShowDialog(); + + + + } + + private void QualityStoreGetBySelf(long taskId) + { + var data = packTaskService.GetStoreGetSelfData(taskId); + if (!data.Success) + { + MessageBox.Show(data?.Msg); + return; + } + StorePickProductWindow sorePickProductWindow = new StorePickProductWindow(data.Data, (count, UserName) => + { + + var res = packTaskService.StoreGetBySelfV2(taskId, count, UserName); + if (res == null) + { + return false; + } + if (!res.Success) + { + System.Windows.MessageBox.Show(res.Msg, "错误信息"); + return false; + } + + + Task.Factory.StartNew(() => SearchTaskList()); + + return true; + },true); sorePickProductWindow.ShowDialog(); @@ -1252,6 +1286,12 @@ namespace BBWY.Client.ViewModels.PackTask public ICommand StoreGetBySelfCommand { get; set; } + /// + /// 商家自取(未验收) + /// + public ICommand QualityStoreGetBySelfCommand { get; set; } + + /// /// 加载事件(待封箱) /// diff --git a/BBWY.Client/Views/QualityTask/WaitQualityControl.xaml b/BBWY.Client/Views/QualityTask/WaitQualityControl.xaml index 386a9875..94ab3e64 100644 --- a/BBWY.Client/Views/QualityTask/WaitQualityControl.xaml +++ b/BBWY.Client/Views/QualityTask/WaitQualityControl.xaml @@ -613,7 +613,7 @@ diff --git a/BBWY.Client/Views/SealBox/SealBoxNoConfigureControl.xaml b/BBWY.Client/Views/SealBox/SealBoxNoConfigureControl.xaml index bf2cd02f..e2ead9d4 100644 --- a/BBWY.Client/Views/SealBox/SealBoxNoConfigureControl.xaml +++ b/BBWY.Client/Views/SealBox/SealBoxNoConfigureControl.xaml @@ -38,16 +38,16 @@ - + - - - + + + @@ -86,7 +86,7 @@ - + @@ -112,7 +112,7 @@ Command="{Binding DataContext.LoadSkuDataCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}" CommandParameter="{Binding}" /> - + @@ -125,12 +125,12 @@ - + - @@ -141,6 +141,7 @@ + @@ -226,6 +227,13 @@ HorizontalAlignment="Center" VerticalAlignment="Center" /> + + + + @@ -236,7 +244,7 @@ - + diff --git a/BBWY.Client/Views/StorePickSelf/QualityStorePickProductWindow.xaml b/BBWY.Client/Views/StorePickSelf/QualityStorePickProductWindow.xaml new file mode 100644 index 00000000..f244f785 --- /dev/null +++ b/BBWY.Client/Views/StorePickSelf/QualityStorePickProductWindow.xaml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BBWY.Client/Views/StorePickSelf/QualityStorePickProductWindow.xaml.cs b/BBWY.Client/Views/StorePickSelf/QualityStorePickProductWindow.xaml.cs new file mode 100644 index 00000000..0c365241 --- /dev/null +++ b/BBWY.Client/Views/StorePickSelf/QualityStorePickProductWindow.xaml.cs @@ -0,0 +1,56 @@ +using BBWY.Client.Models.PackTask; +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.StorePickSelf +{ + /// + /// QualityStorePickProductWindow.xaml 的交互逻辑 + /// + public partial class QualityStorePickProductWindow : BWindow + { + public QualityStorePickProductWindow(StoreGetSelfResponse model, Func SaveData) + { + InitializeComponent(); + StoreGetSelfResponse = model; + InitializeComponent(); + this.DataContext = this; + } + private string userName; + /// + /// 用户名 + /// + public string UserName { get => userName; set { Set(ref userName, value); } } + + private int count; + + public int Count { get => count; set { Set(ref count, value); } } + + private StoreGetSelfResponse storeGetSelfResponse; + + public StoreGetSelfResponse StoreGetSelfResponse { get => storeGetSelfResponse; set { Set(ref storeGetSelfResponse, value); } } + private void BButton_Click(object sender, RoutedEventArgs e) + { + if (SaveData != null && SaveData.Invoke(Count, UserName)) + { + this.Close(); + } + + } + private Func SaveData { get; set; } + private void BButton_Click_1(object sender, RoutedEventArgs e) + { + Count = StoreGetSelfResponse.PickMaxCount; + } + } +} diff --git a/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml b/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml index 183ce15a..671a191c 100644 --- a/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml +++ b/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml @@ -22,8 +22,8 @@ - + Background="{StaticResource Button.Background}"> + @@ -33,7 +33,9 @@ - + + + diff --git a/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml.cs b/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml.cs index 6ce46085..f2f3b603 100644 --- a/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml.cs +++ b/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml.cs @@ -22,13 +22,23 @@ namespace BBWY.Client.Views.StorePickSelf /// public partial class StorePickProductWindow : BWindow { - public StorePickProductWindow(StoreGetSelfResponse model, Func SaveData) + public StorePickProductWindow(StoreGetSelfResponse model, Func SaveData,bool _isQuality) { this. SaveData=SaveData; StoreGetSelfResponse =model; InitializeComponent(); this.DataContext = this; + + IsQuality = _isQuality; } + + private bool isQuality; + + public bool IsQuality { get => isQuality; set { Set(ref isQuality, value); } } + + + + private string userName; /// /// 用户名 From bef2cbc643d6d5626bd568c927e48403a3feddfb Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Tue, 7 Nov 2023 15:44:49 +0800 Subject: [PATCH 2/7] 1 --- .../PackPurchaseTask/QualityTaskResponse.cs | 4 + .../PackTask/WareHouseListViewModel.cs | 126 ------------------ .../QualityTask/QualityViewModel.cs | 11 +- .../Views/QualityTask/QualityWindow.xaml | 85 ++++++------ .../Views/QualityTask/QualityWindow.xaml.cs | 1 + 5 files changed, 54 insertions(+), 173 deletions(-) diff --git a/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs index 1a7c7571..debf0ee6 100644 --- a/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs @@ -99,6 +99,10 @@ namespace BBWY.Client.Models.APIModel.Response.PackPurchaseTask /// /// public SaveType? SaveType { get; set; } + /// + /// 商家自取数 + /// + public int? StoreGetSelfCount { get; set; } } public class WareHourseDTO { diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index a3723fe8..1a1ba198 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs @@ -1353,138 +1353,12 @@ namespace BBWY.Client.ViewModels.PackTask #region 事件绑定 - /// - /// 推送sku配置状态 - /// - public ICommand SendToSetSkuConfigureCommand { get; set; } - /// - /// 提交超时原因 - /// - public ICommand SubmitOverTimeMarkMsgCommand { get; set; } - /// - /// 查看揽收单 - /// - public ICommand LookLSOrderConfigureCommand { get; set; } - /// - /// 打印揽收单 - /// - public ICommand PrintLSOrderConfigureCommand { get; set; } - /// - /// 打印封箱明细 - /// - public ICommand PrintSealBoxDetailsCommand { get; set; } - /// - /// 待完结 完成事件 - /// - public ICommand CompeteWaitCompletedCommand { get; set; } - - /// - /// 待转运 完成事件 - /// - public ICommand CompeteWaitTransportCommand { get; set; } - - /// - /// 设置仓库类型 - /// - public ICommand SetWareTypeCommand { get; set; } - - /// - /// 查看箱唛配置 - /// - public ICommand LookBoxConfigureCommand { get; set; } - /// - /// 待配置 /已配置 - /// - public ICommand SetSealBoxConfigureTypeCommand { get; set; } - public ICommand CompeteFallWareCommand { get; set; } - public ICommand CompeteSealBoxCommand { get; set; } - - public ICommand CompletedPackTaskCommand { get; set; } - - - /// - /// 打开图片链接 - /// - public ICommand OpenSkuDetailCommand { get; set; } - - - /// - /// 筛选数据 - /// - public ICommand SetTaskStateCommand { get; set; } - - /// - /// 修改任务状态 - /// - public ICommand UpdateTaskStateCommand { get; set; } - /// - /// 搜索数据 - /// - public ICommand SearchTaskCommand { get; set; } - - /// - /// 创建任务 - /// - public ICommand CreateTaskCommand { get; set; } - - /// - /// 页面改变事件 - /// - public ICommand TaskPageIndexChangedCommand { get; set; } - - /// - /// 设置分箱数量 - /// - public ICommand SetSealBoxCommand { get; set; } - - - /// - /// 打印封箱数据 - /// - public ICommand PrintBoxConfigureCommand { get; set; } - - - /// - /// 删除任务 - /// - public ICommand DeletedTaskCommand { get; set; } - - - /// - /// 商家自取 - /// - public ICommand StoreGetBySelfCommand { get; set; } - - /// /// 商家自取(未验收) /// public ICommand QualityStoreGetBySelfCommand { get; set; } - /// - /// 加载事件(待封箱) - /// - public ICommand LoadSkuDataCommand { get; set; } - - /// - /// 加载事件(封箱已配置) - /// - public ICommand LoadSealBoxSkuDataCommand { get; set; } - - /// - /// 落仓 - /// - public ICommand LoadFallWareSkuDataCommand { get; set; } - - /// - /// 转运 - /// - public ICommand LoadTransportSkuDataCommand { get; set; } - - - - /// /// 完成封箱 /// diff --git a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs index 8e72a7f2..eed8c773 100644 --- a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs +++ b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs @@ -114,6 +114,12 @@ namespace BBWY.Client.ViewModels public int WareHourseCount { get => wareHourseCount; set { Set(ref wareHourseCount, value); } } + private int? storeGetSelfCount; + /// + /// 商家自取数 + /// + public int? StoreGetSelfCount { get => storeGetSelfCount; set { Set(ref storeGetSelfCount, value); } } + private int skuCount; /// @@ -688,6 +694,7 @@ namespace BBWY.Client.ViewModels SkuTitle = model.SkuTitle; BasicPack = model.BasicPack; CertificatePosition = model.CertificatePosition; + //ArrivalQuantity = 0; //GoodProductQuantity = 0; @@ -734,7 +741,9 @@ namespace BBWY.Client.ViewModels MessageBox.Show(packTaskRes.Msg); return; } - SkuPurchaseSchemeId = packTaskRes.Data.SkuPurchaseSchemeId; + StoreGetSelfCount = packTaskRes.Data.StoreGetSelfCount; + + SkuPurchaseSchemeId = packTaskRes.Data.SkuPurchaseSchemeId; saveType = packTaskRes.Data.SaveType; if (saveType == null) { diff --git a/BBWY.Client/Views/QualityTask/QualityWindow.xaml b/BBWY.Client/Views/QualityTask/QualityWindow.xaml index f3fa5925..5478e66b 100644 --- a/BBWY.Client/Views/QualityTask/QualityWindow.xaml +++ b/BBWY.Client/Views/QualityTask/QualityWindow.xaml @@ -109,64 +109,48 @@ - - - - - - + + - - + + - - - - - + + + + + - - + + - - + + - + --> + + + + + + - + + + - - - - + + + - - - + + + - + Background=" #ec808d" BorderThickness="0" Foreground="White"/> + + \ No newline at end of file diff --git a/BBWY.Client/Views/QualityTask/QualityWindow.xaml.cs b/BBWY.Client/Views/QualityTask/QualityWindow.xaml.cs index 97e9a9e0..950b840e 100644 --- a/BBWY.Client/Views/QualityTask/QualityWindow.xaml.cs +++ b/BBWY.Client/Views/QualityTask/QualityWindow.xaml.cs @@ -12,6 +12,7 @@ namespace BBWY.Client.Views.QualityTask { public QualityWindow(PackTaskModel model,Action ReflashTask) { + InitializeComponent(); var qualityViewModel =(QualityViewModel)this.DataContext; if (qualityViewModel.ReflashWindow == null) From 2711dd879f7bc02ab963441496f5042d5342bcad Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Wed, 8 Nov 2023 19:40:50 +0800 Subject: [PATCH 3/7] 1 --- .../APIServices/QiKu/QualityTaskService.cs | 65 +++ .../SearchQualityTaskListResponse.cs | 195 +++++++ BBWY.Client/Models/Enums.cs | 15 +- BBWY.Client/Models/PackTask/PackTaskModel.cs | 70 ++- .../QualityTask/QualityPackTaskModel.cs | 40 ++ .../PackTask/CreatePackTaskViewModel.cs | 1 - .../PackTask/PublishTaskViewModel.cs | 1 - .../ViewModels/PackTask/TaskListViewModel.cs | 21 +- .../PackTask/WareHouseListViewModel.cs | 250 ++++++++- .../QualityTask/QualityViewModel.cs | 4 + BBWY.Client/Views/PackTask/WareHouseList.xaml | 2 +- .../Views/QualityTask/AddExceptionWindow.xaml | 70 +++ .../QualityTask/AddExceptionWindow.xaml.cs | 84 +++ .../Views/QualityTask/QualityControl.xaml | 500 ++++++++++++++++++ .../Views/QualityTask/QualityControl.xaml.cs | 26 + .../Views/QualityTask/QualityWindow.xaml | 5 +- .../Views/QualityTask/WaitQualityControl.xaml | 8 +- .../Views/QualityTask/WaitQualityList.xaml | 224 ++++++++ .../Views/QualityTask/WaitQualityList.xaml.cs | 245 +++++++++ .../QualityProductWindow.xaml | 38 ++ .../QualityProductWindow.xaml.cs | 68 +++ 21 files changed, 1887 insertions(+), 45 deletions(-) create mode 100644 BBWY.Client/APIServices/QiKu/QualityTaskService.cs create mode 100644 BBWY.Client/Models/APIModel/Response/QualityTask/SearchQualityTaskListResponse.cs create mode 100644 BBWY.Client/Models/QualityTask/QualityPackTaskModel.cs create mode 100644 BBWY.Client/Views/QualityTask/AddExceptionWindow.xaml create mode 100644 BBWY.Client/Views/QualityTask/AddExceptionWindow.xaml.cs create mode 100644 BBWY.Client/Views/QualityTask/QualityControl.xaml create mode 100644 BBWY.Client/Views/QualityTask/QualityControl.xaml.cs create mode 100644 BBWY.Client/Views/QualityTask/WaitQualityList.xaml create mode 100644 BBWY.Client/Views/QualityTask/WaitQualityList.xaml.cs create mode 100644 BBWY.Client/Views/QualityTipWindows/QualityProductWindow.xaml create mode 100644 BBWY.Client/Views/QualityTipWindows/QualityProductWindow.xaml.cs diff --git a/BBWY.Client/APIServices/QiKu/QualityTaskService.cs b/BBWY.Client/APIServices/QiKu/QualityTaskService.cs new file mode 100644 index 00000000..5a113f14 --- /dev/null +++ b/BBWY.Client/APIServices/QiKu/QualityTaskService.cs @@ -0,0 +1,65 @@ +using BBWY.Client.Models; +using BBWY.Client.Models.APIModel; +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.QiKu +{ + public class QualityTaskService : BaseApiService, IDenpendency + { + public QualityTaskService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) + { + } + + public ApiResponse SearchQualityTaskList(string WayBillNo = null, string SourceExpressName = null, string departmentName = null, string skuId = null, string taskId = null, + string spuId = null, string orderSn = null, + QualityTaskExceptionState? QualityTaskExceptionState = null, + string ShopName = null, + int pageIndex = 1, + int pageSize = 10, + string SkuTitle = null, + string SpuTitle = null, + string PackUserName = null + ) + { + + return SendRequest(globalContext.QKApiHost, "api/QualityTask/SearchQualityTaskList", new + { + SkuTitle, + SpuTitle, + DepartmentName = departmentName, + SkuId = skuId, + TaskId = taskId, + QualityTaskExceptionState, + PageIndex = pageIndex, + PageSize = pageSize, + ShopName = ShopName, + WayBillNo = WayBillNo, + SourceExpressName = SourceExpressName, + spuId, + orderSn, + PackUserName + }, null, HttpMethod.Post); + } + + + + + + public ApiResponse QualityTaskException(long TaskId, TaskExceptionType TaskExceptionType, string RemarkMsg) + { + return SendRequest(globalContext.QKApiHost, $"api/QualityTask/QualityTaskException?TaskId={TaskId}", + new { + TaskId, + TaskExceptionType, + RemarkMsg, + UserName=globalContext.User.Name + } + , null, HttpMethod.Post); + } + } +} diff --git a/BBWY.Client/Models/APIModel/Response/QualityTask/SearchQualityTaskListResponse.cs b/BBWY.Client/Models/APIModel/Response/QualityTask/SearchQualityTaskListResponse.cs new file mode 100644 index 00000000..df409e7d --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/QualityTask/SearchQualityTaskListResponse.cs @@ -0,0 +1,195 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel +{ + public class SearchQualityTaskListResponse + { + /// + /// 验收异常总数 + /// + public int QualityExceptionCount { get; set; } + + /// + /// 查询总数据(判断总页数) + /// + public int TotalCount { get; set; } + + /// + /// 页面返回的数据 + /// + public List Items { get; set; } + } + + /// + /// 待验收数据 + /// + public class QualityPackTaskData:NotifyObject + { + /// + /// 图片链接 + /// + public string Logo { get; set; } + + /// + /// 任务id + /// + public long TaskId { get; set; } + + /// + /// 需求方创建日期 + /// + public DateTime CreateTime { get; set; } + + /// + /// 任务状态 + /// + public TaskState TaskState { get; set; } + + /// + /// 需求方团队 + /// + public string DepartmentName { get; set; } + + /// + /// 需求方店铺 + /// + public string ShopName { get; set; } + + + /// + /// 货号品名 + /// + public string BrandName { get; set; } + + /// + /// 对接人 + /// + public string UserName { get; set; } + + /// + /// skuid + /// + public string SkuId { get; set; } + /// + /// SKU标题 + /// + public string SkuName { get; set; } + /// + /// sku数量 + /// + public int SkuCount { get; set; } + /// + /// 打包类型(单件=0,多件=1) + /// + public int PackType { get; set; } + + ///// + ///// 落仓(本地仓=0,齐越仓=1,京东仓=2,聚水潭=3) + ///// + //public string PositionType { get; set; } + + /// + /// 基础包装(快递袋=0,纸箱=1,麻袋=2) + /// + public int BasicPack { get; set; } + + /// + /// 增量1() + /// + public string Increment1 { get; set; } + + + ///// + ///// 合格证位置(外部包装=0,产品包装=1) + ///// + //public int? CertificatePosition { get; set; } + + + /// + /// sku配件名称 + /// + public string SkuGoodsTitle { get; set; } + + /// + /// 配件数 + /// + public int GoodsNumber { get; set; } + + + + + ///// + ///// 条形码数据 + ///// + //public BarCodeDTO BarCodeDTO { get; set; } + + ///// + ///// 合格证数据 + ///// + //public CerDTO[] Cers { get; set; } + + /// + /// 品牌 + /// + public string Brand { get; set; } + + public string OrderId { get; set; } + + /// + /// 增量配件数(旧版计费)移除 + /// + public int? IncrementPartCount { get; set; } + + + /// + /// 质检超时时间 + /// + public DateTime? QualityCompletionOverTime { get; set; } + + + /// + /// 质检超时备注信息 + /// + public string QualityOverTimeMarkMsg { get; set; } + + /// + /// 打包超时备注信息 + /// + public string PackOverTimeMarkMsg { get; set; } + + + /// + /// 消息列表 + /// + public List MarkMessageModelList { get; set; } + + /// + /// 采购方案 + /// + public string SkuPurchaseSchemeId { get; set; } + + + /// + /// 店铺id(采购店铺) + /// + public string ShopId { get; set; } + + /// + /// 排单超时时间 + /// + public DateTime? SendToSetSkuConfigureTime { get; set; } + + + /// + /// 物流状态 + /// + public List ExpressOrderResponses { get; set; } + + /// + /// 任务挂起时间 + /// + public DateTime? TaskAbortTime { get; set; } + } +} diff --git a/BBWY.Client/Models/Enums.cs b/BBWY.Client/Models/Enums.cs index fb89d0a8..012a80aa 100644 --- a/BBWY.Client/Models/Enums.cs +++ b/BBWY.Client/Models/Enums.cs @@ -555,10 +555,7 @@ } - public enum QualityLookState - { - } /// /// 配送方式(自送=1,快递配送=2) @@ -577,4 +574,16 @@ 待包装 = 1, 已完成 = 2 } + public enum TaskExceptionType + { + 配件未到齐 = 0, + } + + /// + /// 验收状态 ( 待验收=1,验收异常 =2) + /// + public enum QualityTaskExceptionState + { + 待验收 = 1, 验收异常 = 2 + } } diff --git a/BBWY.Client/Models/PackTask/PackTaskModel.cs b/BBWY.Client/Models/PackTask/PackTaskModel.cs index 84c80bc1..ad2c28ff 100644 --- a/BBWY.Client/Models/PackTask/PackTaskModel.cs +++ b/BBWY.Client/Models/PackTask/PackTaskModel.cs @@ -5,6 +5,7 @@ using BBWY.Client.ViewModels; using BBWY.Client.ViewModels.PackTask; using BBWY.Client.Views.PackTask; using BBWY.Client.Views.QualityTask; +using BBWY.Client.Views.QualityTipWindows; using GalaSoft.MvvmLight.Command; using NPOI.Util; using System; @@ -88,9 +89,9 @@ namespace BBWY.Client.Models catch (Exception) { - + } - + } @@ -111,12 +112,56 @@ namespace BBWY.Client.Models //加载数据 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() { - if (this.PackProcessType==null&&this.FeesMoney>0) + if (this.PackProcessType == null && this.FeesMoney > 0) { ServiceWindow window = new ServiceWindow(this, ReflashTask); window.ShowDialog(); @@ -237,16 +282,6 @@ namespace BBWY.Client.Models public int SkuCount { get => skuCount; set { Set(ref skuCount, value); } } - private Availability availability; - /// - /// 到货情况(待收货=0,部分收货=1,已到货=2) - /// - public Availability Availability { get => availability; set { Set(ref availability, value); } } - - - - - private TaskState taskState; /// @@ -417,7 +452,10 @@ namespace BBWY.Client.Models public DateTime? QualityCompletionOverTime { get; set; } - + /// + /// 任务挂起时间 + /// + public DateTime? TaskAbortTime { get; set; } private string packRemainTime; /// @@ -503,7 +541,7 @@ namespace BBWY.Client.Models public PackProcessType? PackProcessType { get => packProcessType; set { Set(ref packProcessType, value); } } - public string ShopId { get; set; } + public string ShopId { get; set; } /// /// 发送信息不全时间 @@ -555,7 +593,7 @@ namespace BBWY.Client.Models - + } diff --git a/BBWY.Client/Models/QualityTask/QualityPackTaskModel.cs b/BBWY.Client/Models/QualityTask/QualityPackTaskModel.cs new file mode 100644 index 00000000..47b88e6d --- /dev/null +++ b/BBWY.Client/Models/QualityTask/QualityPackTaskModel.cs @@ -0,0 +1,40 @@ +using BBWY.Client.Models.APIModel; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.QualityTask +{ + public class QualityPackTaskModel : QualityPackTaskData + { + private string qualityRemainTime; + /// + /// 质检剩余时间 + /// + public string QualityRemainTime { get => qualityRemainTime; set { Set(ref qualityRemainTime, value); } } + + private bool isQualityOverTime; + public bool IsQualityOverTime { get => isQualityOverTime; set { Set(ref isQualityOverTime, value); } } + + private bool showSendMsg = false; + /// + /// 展示留言信息 + /// + public bool ShowSendMsg { get => showSendMsg; set { Set(ref showSendMsg, value); } } + + + private string taskMarkMsg; + /// + /// 展示留言信息 + /// + public string TaskMarkMsg { get => taskMarkMsg; set { Set(ref taskMarkMsg, value); } } + + + + private bool showMoreMsg = true; + /// + /// 展示留言信息 + /// + public bool ShowMoreMsg { get => showMoreMsg; set { Set(ref showMoreMsg, value); } } + } +} diff --git a/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs b/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs index ebf37214..d279f94c 100644 --- a/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs @@ -426,7 +426,6 @@ namespace BBWY.Client.ViewModels.PackTask CertificateModel = model.CertificateModel; SkuTitle = model.SkuTitle; GoodsNumber = model.GoodsNumber; - Availability = model.Availability; if (string.IsNullOrEmpty(model.OrderId)) diff --git a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs index 9c62e0fe..7d443b51 100644 --- a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs @@ -769,7 +769,6 @@ namespace BBWY.Client.ViewModels.PackTask CertificateModel = model.CertificateModel; SkuTitle = model.SkuTitle; GoodsNumber = model.GoodsNumber; - Availability = model.Availability; if (model.ExpressOrderList!=null&&model.ExpressOrderList.Any()) { diff --git a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs index d32a3904..0cbe4e6f 100644 --- a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs @@ -40,7 +40,17 @@ namespace BBWY.Client.ViewModels.PackTask public partial class TaskListViewModel : BaseVM, IDenpendency//注入服务 { - + private QualityTaskExceptionState? qualityTaskExceptionState; + /// + /// 任务状态 + /// + public QualityTaskExceptionState? QualityTaskExceptionState + { + get => qualityTaskExceptionState; set + { + Set(ref qualityTaskExceptionState, value); + } + } #region 属性绑定 @@ -348,7 +358,9 @@ namespace BBWY.Client.ViewModels.PackTask public ICommand AppendMarkMessageCommand { get; set; } - public TaskListViewModel(PackTaskService packTaskService, GlobalContext globalContext, SealBoxService sealBoxService, ProductService productService, MarkMessageService markMessageService) + public ICommand SetQualityTaskExceptionStateCommand { get; set; } + + public TaskListViewModel(PackTaskService packTaskService, GlobalContext globalContext, SealBoxService sealBoxService, ProductService productService, MarkMessageService markMessageService) { this.globalContext = globalContext; this.markMessageService = markMessageService; @@ -415,6 +427,11 @@ namespace BBWY.Client.ViewModels.PackTask AppendMarkMessageCommand = new RelayCommand(AppendMarkMessage); + + SetQualityTaskExceptionStateCommand = new RelayCommand(() => { + SearchTaskList(); + }); + } MarkMessageService markMessageService; diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index 1a1ba198..79a10807 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs @@ -28,6 +28,8 @@ using System.Diagnostics; using BBWY.Client.Extensions; using BBWY.Client.APIServices.QiKu; using BBWY.Client.Views.PackerTask; +using BBWY.Client.Models.QualityTask; +using BBWY.Client.Views.QualityTask; namespace BBWY.Client.ViewModels.PackTask { @@ -292,7 +294,7 @@ namespace BBWY.Client.ViewModels.PackTask } } - + private string searchExpressName; public string SearchExpressName { @@ -386,7 +388,6 @@ namespace BBWY.Client.ViewModels.PackTask public ObservableCollection PackTaskList { get => packTaskList; set { Set(ref packTaskList, value); } } - private ObservableCollection storeGetSelfDataList; /// /// 商家自取记录任务列表 @@ -590,6 +591,19 @@ namespace BBWY.Client.ViewModels.PackTask private WareType selectWareType; public WareType SelectWareType { get => selectWareType; set { Set(ref selectWareType, value); } } + + + private QualityTaskExceptionState? qualityTaskExceptionState = Models.QualityTaskExceptionState.待验收; + /// + /// 任务状态 + /// + public QualityTaskExceptionState? QualityTaskExceptionState + { + get => qualityTaskExceptionState; set + { + Set(ref qualityTaskExceptionState, value); + } + } #endregion private readonly PackTaskService packTaskService; @@ -734,7 +748,12 @@ namespace BBWY.Client.ViewModels.PackTask public ICommand PackTaskMarkMessageCommand { get; set; } public ICommand AppendMarkMessageCommand { get; set; } - public WareHouseListViewModel(PackTaskService packTaskService, GlobalContext globalContext, SealBoxService sealBoxService, PackUserService packUserService, MarkMessageService markMessageService) + + public ICommand SetQualityTaskExceptionStateCommand { get; set; } + + + public ICommand QualityTaskExceptionCommand { get; set; } + public WareHouseListViewModel(PackTaskService packTaskService, GlobalContext globalContext, SealBoxService sealBoxService, PackUserService packUserService, MarkMessageService markMessageService, QualityTaskService qualityTaskService) { @@ -833,8 +852,22 @@ namespace BBWY.Client.ViewModels.PackTask PackTaskMarkMessageCommand = new RelayCommand(PackTaskMarkMessage); AppendMarkMessageCommand = new RelayCommand(AppendMarkMessage); + SetQualityTaskExceptionStateCommand = new RelayCommand(() => + { + SearchTaskList(); + }); + this.qualityTaskService = qualityTaskService; + QualityTaskExceptionCommand = new RelayCommand(QualityTaskException); } + + private void QualityTaskException(long taskId) + { + + AddExceptionWindow addExceptionWindow = new AddExceptionWindow(qualityTaskService, taskId); + addExceptionWindow.ShowDialog(); + } + MarkMessageService markMessageService; private void AppendMarkMessage(long taskId) { @@ -875,6 +908,8 @@ namespace BBWY.Client.ViewModels.PackTask } private void ShowMoreMessage(long taskId) { + + var model = PackTaskList?.SingleOrDefault(p => p.TaskId == taskId); if (model != null) { @@ -883,6 +918,9 @@ namespace BBWY.Client.ViewModels.PackTask } + + + } private void LoadCompletedSkuData(WareWaitCompleted model) @@ -1043,7 +1081,7 @@ namespace BBWY.Client.ViewModels.PackTask return; } - + var data = LSOrderPurchaseListRes.Data; lsdTaskMsg.CustomerName = model.ShopName; lsdTaskMsg.CustomerUserName = model.ShopName; @@ -1197,13 +1235,13 @@ namespace BBWY.Client.ViewModels.PackTask Task.Factory.StartNew(() => SearchTaskList()); return true; - },false); + }, false); sorePickProductWindow.ShowDialog(); } - + private void QualityStoreGetBySelf(long taskId) { var data = packTaskService.GetStoreGetSelfData(taskId); @@ -1230,7 +1268,7 @@ namespace BBWY.Client.ViewModels.PackTask Task.Factory.StartNew(() => SearchTaskList()); return true; - },true); + }, true); sorePickProductWindow.ShowDialog(); @@ -1346,7 +1384,7 @@ namespace BBWY.Client.ViewModels.PackTask private void SetSealBox(object obj) { - + } @@ -1373,7 +1411,8 @@ namespace BBWY.Client.ViewModels.PackTask return; } - SetSealBoxWindow setSealBoxWindow = new SetSealBoxWindow(new Action((boxCount) => { + SetSealBoxWindow setSealBoxWindow = new SetSealBoxWindow(new Action((boxCount) => + { @@ -1508,6 +1547,13 @@ namespace BBWY.Client.ViewModels.PackTask private Thread fallwareOverTimeThread = null; private Thread waitTransportOverTimeThread = null; + QualityTaskService qualityTaskService; + + private string qualityExceptionCount; + /// + /// 验收异常总数 + /// + public string QualityExceptionCount { get => qualityExceptionCount; set { Set(ref qualityExceptionCount, value); } } /// /// 搜索任务列表 /// @@ -1834,7 +1880,7 @@ namespace BBWY.Client.ViewModels.PackTask }); } - else if (taskState == Models.TaskState.商家自取) + else if (TaskState == Models.TaskState.商家自取) { StoreGetSelfDataList = new ObservableCollection(); var datas = packTaskService.SearchStoreGetSelfList(SearchTaskId, SearchOrderSn, SearchSpuId, SearchSkuId, SearchDepartment, SearchShopName, PageIndex, PageSize, null); @@ -1858,6 +1904,177 @@ namespace BBWY.Client.ViewModels.PackTask } } + else if (TaskState == Models.TaskState.待验收) + { + PackTaskList = new ObservableCollection();//初始化数据 + var datas = qualityTaskService.SearchQualityTaskList(SearchWayBillNo, SearchExpressName, SearchDepartment, SearchSkuId, SearchTaskId, SearchSpuId, SearchOrderSn, this.QualityTaskExceptionState, SearchShopName, + PageIndex, PageSize, SearchSkuTitle, SearchSpuTitle, SearchPackUserName); + stopwatch.Stop(); + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + Debug.WriteLine($"查询接口耗时:{stopwatch.ElapsedMilliseconds}毫秒"); + })); + stopwatch.Restart(); + if (datas != null && datas.Data != null && datas.Success) + { + var dataModel = datas.Data; + OrderCount = dataModel.TotalCount; + QualityExceptionCount = dataModel.QualityExceptionCount.ToString(); + foreach (var item in dataModel.Items) + { + + var data = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(item)); + data.ItemList = new List() { new SkuMessage + { BrandName = item.BrandName, + Logo= item.Logo, + SkuName = item.SkuName, + SkuId = item.SkuId + } }; + data.ExpressOrderList = item.ExpressOrderResponses; + data.EndTime = item.CreateTime; + data.SkuTitle = item.SkuGoodsTitle; + data.AcceptName = item.UserName; + //if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0) + //{ + + // data.BarCodeModel = item.BarCodeDTO; + // if (data.BarCodeModel.LabelModel == BarcodeLabelModel.无型号模板) + // data.BarCodeModel.LabelModel = BarcodeLabelModel.精简模板; + + //} + //if (item.Cers != null) + //{ + // data.CertificateModel = item.Cers; + + //} + data.ReflashTask = ReflashTask; + + App.Current.Dispatcher.Invoke(new Action(() => + { + PackTaskList.Add(data); + })); + + + } + + + if (TaskState == Models.TaskState.待验收) + { + if (QualityTaskExceptionState == Models.QualityTaskExceptionState.待验收) + { + qualityOverTimeThread = new Thread(() => + { + var packtasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待验收 && p.QualityCompletionOverTime != null).ToList(); + if (packtasks.Count() > 0) + { + IsStartThread = true; + while (IsStartThread) + { + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + foreach (var item in packtasks) + { + TimeSpan datetime; + if (item.SendToSetSkuConfigureTime != null) + datetime = item.QualityCompletionOverTime.Value.Subtract(item.SendToSetSkuConfigureTime.Value); + else + datetime = item.QualityCompletionOverTime.Value.Subtract(DateTime.Now); + item.QualityRemainTime = OverTimeHelper.GetTimeString(datetime); + if (datetime.TotalMilliseconds > 0) + { + item.IsQualityOverTime = false; + + } + else + { + item.IsQualityOverTime = true; + } + + } + })); + Thread.Sleep(1000); + } + } + + + + + + + }); + //任务倒计时数据 + qualityOverTimeThread.IsBackground = true; + qualityOverTimeThread.Start(); + //任务状态为待验收 + } + + if (QualityTaskExceptionState == Models.QualityTaskExceptionState.验收异常) + { + var packtasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待验收 && p.TaskAbortTime != null).ToList(); + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + foreach (var item in packtasks) + { + TimeSpan datetime; + datetime = item.QualityCompletionOverTime.Value.Subtract(item.TaskAbortTime.Value); + item.QualityRemainTime = OverTimeHelper.GetTimeString(datetime); + if (datetime.TotalMilliseconds > 0) + { + item.IsQualityOverTime = false; + + } + else + { + item.IsQualityOverTime = true; + } + + } + })); + } + + } + + //任务状态为待打包 + + + + Task.Factory.StartNew(() => + { + foreach (var item in PackTaskList) + { + if (!item.OrderId.IsNullOrEmpty() && !item.SkuId.IsNullOrEmpty()) + { + var expressData = packTaskService.GetPurchaseExpressOrderList(item.OrderId, item.SkuId); + if (expressData != null && expressData.Success && expressData.Data != null) + { + + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + expressData.Data.ForEach(e => + { + e.ExpressState = ExpressOrderHelper.GetExpressStateName(e.ExpressState); + + + }); + item.ExpressOrderList = expressData.Data; + })); + + + + + } + } + } + + + + + }); + } + else + { + } + } else { PackTaskList = new ObservableCollection();//初始化数据 @@ -1876,7 +2093,7 @@ namespace BBWY.Client.ViewModels.PackTask foreach (var item in dataModel.Items) { - var data = JsonConvert.DeserializeObject( JsonConvert.SerializeObject(item)); + var data = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(item)); data.ItemList = new List() { new SkuMessage @@ -2062,7 +2279,8 @@ namespace BBWY.Client.ViewModels.PackTask - Task.Factory.StartNew(() => { + Task.Factory.StartNew(() => + { foreach (var item in PackTaskList) { if (!item.OrderId.IsNullOrEmpty() && !item.SkuId.IsNullOrEmpty()) @@ -2070,7 +2288,7 @@ namespace BBWY.Client.ViewModels.PackTask var expressData = packTaskService.GetPurchaseExpressOrderList(item.OrderId, item.SkuId); if (expressData != null && expressData.Success && expressData.Data != null) { - + App.Current.Dispatcher.BeginInvoke(new Action(() => { expressData.Data.ForEach(e => @@ -2081,14 +2299,14 @@ namespace BBWY.Client.ViewModels.PackTask }); item.ExpressOrderList = expressData.Data; })); - + } } } - + @@ -2113,7 +2331,7 @@ namespace BBWY.Client.ViewModels.PackTask Debug.WriteLine($"查询耗时:{stopwatch.ElapsedMilliseconds}毫秒"); })); - + }); } diff --git a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs index eed8c773..b2ff65af 100644 --- a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs +++ b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs @@ -855,6 +855,10 @@ namespace BBWY.Client.ViewModels }); + + + + } public Action ReflashWindow { get; set; } diff --git a/BBWY.Client/Views/PackTask/WareHouseList.xaml b/BBWY.Client/Views/PackTask/WareHouseList.xaml index 602e21e0..74573db5 100644 --- a/BBWY.Client/Views/PackTask/WareHouseList.xaml +++ b/BBWY.Client/Views/PackTask/WareHouseList.xaml @@ -149,7 +149,7 @@ - + diff --git a/BBWY.Client/Views/QualityTask/AddExceptionWindow.xaml b/BBWY.Client/Views/QualityTask/AddExceptionWindow.xaml new file mode 100644 index 00000000..654eb380 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/AddExceptionWindow.xaml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/QualityTask/AddExceptionWindow.xaml.cs b/BBWY.Client/Views/QualityTask/AddExceptionWindow.xaml.cs new file mode 100644 index 00000000..db229358 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/AddExceptionWindow.xaml.cs @@ -0,0 +1,84 @@ +using BBWY.Client.APIServices.QiKu; +using BBWY.Client.Models; +using BBWY.Controls; +using EnumsNET; +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 WebSocketSharp; + +namespace BBWY.Client.Views.QualityTask +{ + /// + /// AddExceptionWindow.xaml 的交互逻辑 + /// + public partial class AddExceptionWindow : BWindow + { + public AddExceptionWindow(QualityTaskService qualityTaskService, long taskId) + { + InitializeComponent(); + this.qualityTaskService = qualityTaskService; + this.TaskId = taskId; + this.DataContext = this; + + } + QualityTaskService qualityTaskService; + + + private long taskId; + /// + /// 任务id + /// + public long TaskId { get=> taskId; set {Set(ref taskId,value); } } + + + private TaskExceptionType taskExceptionType; + /// + /// 验收异常类型 + /// + public TaskExceptionType TaskExceptionType { get => taskExceptionType; set { Set(ref taskExceptionType, value); } } + + + private List taskExceptionTypeList=new List { + TaskExceptionType.配件未到齐 + }; + /// + /// 验收异常类型 + /// + public List< TaskExceptionType> TaskExceptionTypeList { get => taskExceptionTypeList; set { Set(ref taskExceptionTypeList, value); } } + + + private string remarkMsg; + /// + /// 备注消息 + /// + public string RemarkMsg { get => remarkMsg; set { Set(ref remarkMsg, value); } } + + private void BButton_Click(object sender, RoutedEventArgs e) + { + + if (RemarkMsg.IsNullOrEmpty()) + { + MessageBox.Show("请输入具体问题描述."); + return; + } + + var res = qualityTaskService.QualityTaskException(TaskId, TaskExceptionType, RemarkMsg); + if (res==null||!res.Success) + { + MessageBox.Show(res?.Msg); + return; + } + + this.Close(); + } + } +} diff --git a/BBWY.Client/Views/QualityTask/QualityControl.xaml b/BBWY.Client/Views/QualityTask/QualityControl.xaml new file mode 100644 index 00000000..26174a1a --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualityControl.xaml @@ -0,0 +1,500 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/QualityTask/QualityControl.xaml.cs b/BBWY.Client/Views/QualityTask/QualityControl.xaml.cs new file mode 100644 index 00000000..4ec67ca0 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualityControl.xaml.cs @@ -0,0 +1,26 @@ +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.Navigation; +using System.Windows.Shapes; + +namespace BBWY.Client.Views.QualityTask +{ + /// + /// QualityControl.xaml 的交互逻辑 + /// + public partial class QualityControl : UserControl + { + public QualityControl() + { + InitializeComponent(); + } + } +} diff --git a/BBWY.Client/Views/QualityTask/QualityWindow.xaml b/BBWY.Client/Views/QualityTask/QualityWindow.xaml index 5478e66b..31a3a749 100644 --- a/BBWY.Client/Views/QualityTask/QualityWindow.xaml +++ b/BBWY.Client/Views/QualityTask/QualityWindow.xaml @@ -471,10 +471,7 @@ Command="{Binding CompeteQualityTaskCommand}" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type c:BWindow}}}" Background="{StaticResource Button.Selected.Background}" BorderThickness="0" Foreground="White"/> - + diff --git a/BBWY.Client/Views/QualityTask/WaitQualityControl.xaml b/BBWY.Client/Views/QualityTask/WaitQualityControl.xaml index 15dd02f7..3b716116 100644 --- a/BBWY.Client/Views/QualityTask/WaitQualityControl.xaml +++ b/BBWY.Client/Views/QualityTask/WaitQualityControl.xaml @@ -579,10 +579,16 @@ - + + + diff --git a/BBWY.Client/Views/QualityTask/WaitQualityList.xaml b/BBWY.Client/Views/QualityTask/WaitQualityList.xaml new file mode 100644 index 00000000..31df1b21 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/WaitQualityList.xaml @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/QualityTask/WaitQualityList.xaml.cs b/BBWY.Client/Views/QualityTask/WaitQualityList.xaml.cs new file mode 100644 index 00000000..fa6fc7a3 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/WaitQualityList.xaml.cs @@ -0,0 +1,245 @@ +using BBWY.Client.Helpers; +using BBWY.Client.Models.PackTask; +using BBWY.Client.ViewModels; +using BBWY.Common.Models; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using WebSocketSharp; + +namespace BBWY.Client.Views.QualityTask +{ + /// + /// WaitQualityList.xaml 的交互逻辑 + /// + public partial class WaitQualityList : UserControl + { + public WaitQualityList() + { + InitializeComponent(); + this.Loaded += Load; + } + GlobalContext globalContext; + + public void LoadShops(GlobalContext globalContext) + { + this.globalContext = globalContext; + shops = globalContext.User.ShopList.Select(s => s.ShopName).ToList(); + departments = globalContext.User.DepartmentList.Select(s => s.Name).ToList(); + + } + + private void Load(object sender, RoutedEventArgs e) + { + + try + { + var model = (App.Current.Resources["Locator"] as ViewModelLocator).Main; + + LoadShops(model.GlobalContext); + } + catch + { + + + } + } + public string QKApiHost { get; set; } + public void SelectionChangeCommand(object sender, SelectionChangedEventArgs e) + { + try + { + var list = (ListBox)sender; + if (list.Items.Count <= 0) + { + return; + } + var value = (ListBoxItem)list.SelectedValue; + var content = (Label)value.Content; + tb.Text = content.Content.ToString(); + tipBox.Visibility = Visibility.Collapsed; + } + catch (Exception) + { + + + } + + } + List departments = new List(); + + List shops = new List(); + private void tb_TextChanged(object sender, TextChangedEventArgs e) + { + + if (tipBox != null) + try + { + var textBoxt = (TextBox)sender; + //创建一个ListBox + + if (tipBox != null && tipBox.Items.Count > 0) + { + tipBox.Items.Clear(); + + } + + if (departments.Count <= 0) + { + if (QKApiHost.IsNullOrEmpty()) QKApiHost = "http://qiku.qiyue666.com"; + HttpClientHelper helper = new HttpClientHelper(QKApiHost); + + string url = $"{QKApiHost}/api/PackTask/GetAllDepartment";//获取所有数据 + var data = helper.Get(url); + + var res = JsonConvert.DeserializeObject>(data); + //创建一个ListBoxIem + if (res.Success) + { + if (res.Data != null && res.Data.Count() > 0) + { + foreach (var department in res.Data) + { + if (!departments.Contains(department.DePartmentName)) + { + departments.Add(department.DePartmentName); + } + + } + } + } + } + + if (string.IsNullOrEmpty(textBoxt.Text)) + { + tipBox.Visibility = Visibility.Collapsed; + return; + } + foreach (var department in departments) + { + if (department.Contains(textBoxt.Text)) + { + ListBoxItem item = new ListBoxItem(); + Label lb = new Label(); + lb.Content = department; + item.Content = lb; + tipBox.Items.Add(item); + } + + } + + tipBox.Visibility = Visibility.Visible; + } + catch (Exception) + { + + + } + + } + + private void tbShop_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + var textBoxt = (TextBox)sender; + //创建一个ListBox + + if (tipBoxShop != null && tipBoxShop.Items.Count > 0) + { + tipBoxShop.Items.Clear(); + + } + + if (shops.Count <= 0) + { + if (globalContext != null) + LoadShops(globalContext); + } + + if (string.IsNullOrEmpty(textBoxt.Text)) + { + tipBoxShop.Visibility = Visibility.Collapsed; + return; + } + foreach (var department in shops) + { + if (department.Contains(textBoxt.Text)) + { + ListBoxItem item = new ListBoxItem(); + Label lb = new Label(); + lb.Content = department; + item.Content = lb; + tipBoxShop.Items.Add(item); + } + + } + if (tipBoxShop != null) + tipBoxShop.Visibility = Visibility.Visible; + } + catch (Exception) + { + + + } + } + + private void tipBoxShop_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + try + { + var list = (ListBox)sender; + if (list.Items.Count <= 0) + { + return; + } + var value = (ListBoxItem)list.SelectedValue; + var content = (Label)value.Content; + tbShop.Text = content.Content.ToString(); + tipBoxShop.Visibility = Visibility.Collapsed; + } + catch (Exception) + { + + + } + } + + private void tb_LostFocus(object sender, RoutedEventArgs e) + { + try + { + if (tipBox != null && tipBox.Items.Count > 0) + { + tipBox.Items.Clear(); + + } + } + catch (Exception) + { + + + } + } + + private void tbShop_LostFocus(object sender, RoutedEventArgs e) + { + try + { + if (tipBoxShop != null && tipBoxShop.Items.Count > 0) + { + tipBoxShop.Items.Clear(); + + } + } + catch (Exception) + { + + + } + } + } +} diff --git a/BBWY.Client/Views/QualityTipWindows/QualityProductWindow.xaml b/BBWY.Client/Views/QualityTipWindows/QualityProductWindow.xaml new file mode 100644 index 00000000..4ad2ae3b --- /dev/null +++ b/BBWY.Client/Views/QualityTipWindows/QualityProductWindow.xaml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/QualityTipWindows/QualityProductWindow.xaml.cs b/BBWY.Client/Views/QualityTipWindows/QualityProductWindow.xaml.cs new file mode 100644 index 00000000..8811bd1d --- /dev/null +++ b/BBWY.Client/Views/QualityTipWindows/QualityProductWindow.xaml.cs @@ -0,0 +1,68 @@ +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.QualityTipWindows +{ + /// + /// ProductCerWindow.xaml 的交互逻辑 + /// + public partial class QualityProductWindow : BWindow + { + public QualityProductWindow(string title, string isTrueMsg, string isFalseMsg, Action clickReturn) + { + InitializeComponent(); + this.DataContext = this; + Title = title; + IsTrueMsg = isTrueMsg; + IsFalseMsg = isFalseMsg; + ClickReturn = clickReturn; + } + + private string title; + /// + /// 封箱配置状态 + /// + public string Title { get => title; set { Set(ref title, value); } } + + + private string isTrueMsg; + /// + /// 封箱配置状态 + /// + public string IsTrueMsg { get => isTrueMsg; set { Set(ref isTrueMsg, value); } } + + private string isFalseMsg; + /// + /// 封箱配置状态 + /// + public string IsFalseMsg { get => isFalseMsg; set { Set(ref isFalseMsg, value); } } + + + public Action ClickReturn { get; set; } + + private void btn_true_Click(object sender, RoutedEventArgs e) + { + this.Visibility = Visibility.Collapsed; + ClickReturn?.Invoke(true); + this.Close(); + } + + private void btn_false_Click(object sender, RoutedEventArgs e) + { + this.Visibility = Visibility.Collapsed; + ClickReturn.Invoke(false); + this.Close(); + } + } +} From 6fb50175828e67e012ac8474679455f105d8fd57 Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Fri, 10 Nov 2023 14:27:03 +0800 Subject: [PATCH 4/7] 1 --- .../APIServices/QiKu/QualityTaskService.cs | 18 +- .../SearchProductAttrsBySkuIdResponse.cs | 33 ++++ BBWY.Client/Models/PackTask/PackTaskModel.cs | 55 +----- .../PackTask/WareHouseListViewModel.cs | 182 ++++++++++++++++++ .../Views/QualityTask/QualityControl.xaml | 3 +- .../Views/QualityTask/WaitQualityControl.xaml | 3 +- .../QualityProductWindow.xaml | 2 +- .../QualityProductWindow.xaml.cs | 9 +- 8 files changed, 245 insertions(+), 60 deletions(-) create mode 100644 BBWY.Client/Models/APIModel/Response/QualityTask/SearchProductAttrsBySkuIdResponse.cs 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; From 44d0ed4d12b830d8acf5862d92e5795a1b796976 Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Sun, 12 Nov 2023 10:36:51 +0800 Subject: [PATCH 5/7] 1 --- .../APIServices/QiKu/QualityTaskService.cs | 39 ++- .../Request/CreatePackTaskV2Request.cs | 2 + .../APIModel/Request/QualityTaskRequest.cs | 8 +- .../Request/UpdatePackTaskV2Request.cs | 4 + .../PackPurchaseTask/QualityTaskResponse.cs | 6 + .../SearchQualityTaskListResponse.cs | 16 +- BBWY.Client/Models/Enums.cs | 7 + .../PackTask/PublishTaskViewModel.cs | 3 +- .../PackTask/WareHouseListViewModel.cs | 306 +++++++++++------- .../QualityTask/QualityViewModel.cs | 119 ++++--- .../Views/PackTask/WareHouseListControl.xaml | 2 +- .../Views/QualityTask/QualityWindow.xaml | 8 +- .../Views/QualityTask/QualityWindow.xaml.cs | 12 +- 13 files changed, 327 insertions(+), 205 deletions(-) diff --git a/BBWY.Client/APIServices/QiKu/QualityTaskService.cs b/BBWY.Client/APIServices/QiKu/QualityTaskService.cs index a093c742..a9384426 100644 --- a/BBWY.Client/APIServices/QiKu/QualityTaskService.cs +++ b/BBWY.Client/APIServices/QiKu/QualityTaskService.cs @@ -1,5 +1,7 @@ using BBWY.Client.Models; using BBWY.Client.Models.APIModel; +using BBWY.Client.Models.APIModel.Request; +using BBWY.Client.Models.APIModel.Response.PackPurchaseTask; using BBWY.Common.Http; using BBWY.Common.Models; using System; @@ -46,18 +48,19 @@ namespace BBWY.Client.APIServices.QiKu }, null, HttpMethod.Post); } - + public ApiResponse QualityTaskException(long TaskId, TaskExceptionType TaskExceptionType, string RemarkMsg) { return SendRequest(globalContext.QKApiHost, $"api/QualityTask/QualityTaskException", - new { + new + { TaskId, TaskExceptionType, RemarkMsg, - UserName=globalContext.User.Name + UserName = globalContext.User.Name } , null, HttpMethod.Post); } @@ -77,5 +80,35 @@ namespace BBWY.Client.APIServices.QiKu } , null, HttpMethod.Post); } + + + public ApiResponse SendMsgToPurchaseDepartment(long TaskId, string ModelTitle, string TipMsg) + { + return SendRequest(globalContext.QKApiHost, $"api/QualityTask/SendMsgToPurchaseDepartment", + new + { + TaskId, + ModelTitle, + TipMsg, + UserName = globalContext.User.Name + } + , null, HttpMethod.Post); + } + + + public ApiResponse GetQualityTask(long taskId) + { + + return SendRequest(globalContext.QKApiHost, $"api/QualityTask/GetQualityTask?taskId={taskId}", null, null, HttpMethod.Post); + + } + + public ApiResponse CompeteQualityTask(QualityTaskRequest competeQualityTask) + { + + return SendRequest(globalContext.QKApiHost, $"api/QualityTask/CompeteQualityTask", competeQualityTask, null, HttpMethod.Post); + + } + } } diff --git a/BBWY.Client/Models/APIModel/Request/CreatePackTaskV2Request.cs b/BBWY.Client/Models/APIModel/Request/CreatePackTaskV2Request.cs index 6955a210..65725ff7 100644 --- a/BBWY.Client/Models/APIModel/Request/CreatePackTaskV2Request.cs +++ b/BBWY.Client/Models/APIModel/Request/CreatePackTaskV2Request.cs @@ -115,6 +115,8 @@ namespace BBWY.Client.Models.APIModel.Request /// public List WayBillNoList { get; set; } + + } diff --git a/BBWY.Client/Models/APIModel/Request/QualityTaskRequest.cs b/BBWY.Client/Models/APIModel/Request/QualityTaskRequest.cs index 9dfb4894..482278f4 100644 --- a/BBWY.Client/Models/APIModel/Request/QualityTaskRequest.cs +++ b/BBWY.Client/Models/APIModel/Request/QualityTaskRequest.cs @@ -93,10 +93,10 @@ namespace BBWY.Client.Models.APIModel.Request ///// //public DateTime? PreCompeteTime { get; set; } - /// - /// 地拖摆放编号 - /// - public int? FloorDragNumber { get; set; } + ///// + ///// 地拖摆放编号 + ///// + //public int? FloorDragNumber { get; set; } } } diff --git a/BBWY.Client/Models/APIModel/Request/UpdatePackTaskV2Request.cs b/BBWY.Client/Models/APIModel/Request/UpdatePackTaskV2Request.cs index 3e9d4374..72eada8d 100644 --- a/BBWY.Client/Models/APIModel/Request/UpdatePackTaskV2Request.cs +++ b/BBWY.Client/Models/APIModel/Request/UpdatePackTaskV2Request.cs @@ -105,5 +105,9 @@ namespace BBWY.Client.Models.APIModel.Request /// 绑定快递单号 /// public List WayBillNoList { get; set; } + /// + /// + /// + public SaveType? SaveType { get; set; } } } diff --git a/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs index debf0ee6..51bb0e8f 100644 --- a/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs @@ -103,6 +103,12 @@ namespace BBWY.Client.Models.APIModel.Response.PackPurchaseTask /// 商家自取数 /// public int? StoreGetSelfCount { get; set; } + + + /// + /// 是否首次验收 + /// + public bool IsPassInspection { get; set; } } public class WareHourseDTO { diff --git a/BBWY.Client/Models/APIModel/Response/QualityTask/SearchQualityTaskListResponse.cs b/BBWY.Client/Models/APIModel/Response/QualityTask/SearchQualityTaskListResponse.cs index df409e7d..76ee6f9f 100644 --- a/BBWY.Client/Models/APIModel/Response/QualityTask/SearchQualityTaskListResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/QualityTask/SearchQualityTaskListResponse.cs @@ -120,15 +120,15 @@ namespace BBWY.Client.Models.APIModel - ///// - ///// 条形码数据 - ///// - //public BarCodeDTO BarCodeDTO { get; set; } + /// + /// 条形码数据 + /// + public BarCodeModel BarCodeDTO { get; set; } - ///// - ///// 合格证数据 - ///// - //public CerDTO[] Cers { get; set; } + /// + /// 合格证数据 + /// + public CertificateModel[] Cers { get; set; } /// /// 品牌 diff --git a/BBWY.Client/Models/Enums.cs b/BBWY.Client/Models/Enums.cs index 012a80aa..a8ac66c0 100644 --- a/BBWY.Client/Models/Enums.cs +++ b/BBWY.Client/Models/Enums.cs @@ -586,4 +586,11 @@ { 待验收 = 1, 验收异常 = 2 } + + + + public enum BrandMarkType + { + 无需遮盖 = 1, 需遮盖 = 2, 无需贴商标=3 + } } diff --git a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs index 7d443b51..4c936b06 100644 --- a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs @@ -897,7 +897,7 @@ namespace BBWY.Client.ViewModels.PackTask NeedCer = IsNeedCertificateModel == Need.需要, DistributionMode = DistributionMode, WayBillNoList = PackTaskExpressList?.Select(p => p.WaybillNo)?.ToList() - + }; @@ -929,6 +929,7 @@ namespace BBWY.Client.ViewModels.PackTask var updateTaskModel = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(createTaskModel)); updateTaskModel.TaskId = TaskId; + updateTaskModel.SaveType = SaveType; res = packTaskService.UpdatePackTaskV2(updateTaskModel); } else diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index 23eaafed..fa52bfd5 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs @@ -33,6 +33,8 @@ using BBWY.Client.Views.QualityTask; using BBWY.Client.Views.QualityTipWindows; using System.Windows.Interop; using NPOI.SS.Formula.Functions; +using NPOI.SS.Util; +using System.Text; namespace BBWY.Client.ViewModels.PackTask { @@ -883,141 +885,210 @@ namespace BBWY.Client.ViewModels.PackTask MessageBox.Show($"查找不到店铺信息, {model.ShopName}"); return; } + + var packTaskRes = qualityTaskService.GetQualityTask(model.TaskId);//获取任务详情 + + if (packTaskRes == null) + { + MessageBox.Show("网络异常!"); + return; + } + if (!packTaskRes.Success || packTaskRes.Data == null) + { + MessageBox.Show(packTaskRes.Msg); + return; + } + if (packTaskRes == null || !packTaskRes.Success) 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; + var IsPassInspection = packTaskRes.Data.IsPassInspection; + + + + var skuAttsDetail = skuAttsDetailRes.Data; + bool isqualityCer = false; //验收合格证 + StringBuilder sb = null; + Need IsNeedCer = Need.不需要; + BrandMarkType markType = BrandMarkType.无需遮盖; + bool? isCer3CValid = null; + + new QualityProductWindow("商品合格证情况", "商品包装有合格证信息", "商品包装无合格证信息", (ishaveCer) => + { + if (ishaveCer)//验收商品 有合格证 + { + if (skuAttsDetail.ApplyAge.IsNullOrEmpty() || (skuAttsDetail.IsApplyAgeOver14 != null && skuAttsDetail.IsApplyAgeOver14.Value))//不存在使用年龄 或者适用年龄大于14 + { + new QualityProductWindow("商品合格证情况", "商品包装合格证上有品牌信息", "商品包装合格证上无品牌信息", (iscerhavebrand) => + { + + if (iscerhavebrand) + { + + new QualityProductWindow("商品合格证情况", $"商品包装合格证上的品牌是{skuAttsDetail.Brand}", $"商品包装合格证上的品牌不是{skuAttsDetail.Brand}", (istruebrand) => + { + if (!istruebrand) + { + //需要合格证 + if (model.CertificateModel == null || !model.CertificateModel.Any())//未配置 + { + sb = new StringBuilder(); + sb.AppendLine("该任务未配置合格证,商品包装合格证上的品牌与详情页的品牌不符"); + if (skuAttsDetail.ApplyAge.IsNullOrEmpty()) + sb.Append("详情页未展示适用年龄"); + else + sb.Append("详情页展示适用年龄为14岁以上"); + sb.Append("请立即配置合格证信息,包装任务已被挂起."); + var res = qualityTaskService.SendMsgToPurchaseDepartment(model.TaskId, "任务未配置合格证", sb.ToString()); + if (res.Success) + { + ReflashTask();//刷新任务 + } + return; + } + //打印合格证 完全遮盖包装合格证信息 + } + isqualityCer = true;//验收合格证完毕 + }).ShowDialog(); + return; + } + isqualityCer = true;//验收合格证完毕 + }).ShowDialog(); + } + else + { - 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 (IsPassInspection)//验收过 跳过询问 + { + isqualityCer = true; + return; + } + //todo: 判断是否首次验收 只支持供应链 有采购方案的 + new QualityProductWindow("商品合格证情况", "商品合格证类型有3C标", "商品合格证类型无3C标", (ishave3c) => + { + if (ishave3c) + { + sb = new StringBuilder(); + sb.Append("该任务商品适用年龄为14岁以下,请验证合格证上的3C信息是否有效,包装任务已被挂起."); + var res = qualityTaskService.SendMsgToPurchaseDepartment(model.TaskId, "包装合格证有3C信息且详情页适用年龄小于14岁", sb.ToString()); + if (res.Success) + { + ReflashTask();//刷新任务 + } + return; + } + else + { + //todo: + // 通知采购方问题 咨询是否可替款 + // MessageBox.Show("提示采购部门,当前任务详情页展示适用年龄为14岁以下, 实物商品配置的合格证没有3C,咨询是否可替款,任务已挂起"); + sb = new StringBuilder(); + sb.AppendLine("该任务商品包装有合格证信息"); + sb.Append("详情页展示适用年龄为14岁以下,但是商品包装合格证无3C标"); + sb.Append("请立即配置3C类型的合格证信息"); + var res = qualityTaskService.SendMsgToPurchaseDepartment(model.TaskId, "包装有合格证信息且详情页适用年龄小于14岁", sb.ToString()); + if (res.Success) + { + ReflashTask();//刷新任务 + } + } + + + + }).ShowDialog(); + } + + //验收商品合格证是否有品牌 + + + } + else + { + IsNeedCer = Need.需要;//需要合格证 + //需要合格证 + if (model.CertificateModel == null || !model.CertificateModel.Any())//未配置 + { + sb = new StringBuilder(); + sb.AppendLine("该任务未配置合格证,请立即配置合格证信息"); + var res1 = qualityTaskService.SendMsgToPurchaseDepartment(model.TaskId, "任务未配置合格证", sb.ToString()); + if (res1.Success) + { + ReflashTask();//刷新任务 + } + 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,赶紧配置,任务已挂起"); + + sb = new StringBuilder(); + sb.AppendLine("该任务商品包装无合格证信息"); + + sb.Append("详情页展示适用年龄为14岁以下,"); + sb.Append("请立即配置3C类型的合格证信息"); + var res = qualityTaskService.SendMsgToPurchaseDepartment(model.TaskId, "包装无合格证信息且详情页适用年龄小于14岁", sb.ToString()); + if (res.Success) + { + ReflashTask();//刷新任务 + } + + + return; + } + + }).ShowDialog(); if (isqualityCer)//合格证验收完毕 { - + bool isqualityBrand = false; new QualityProductWindow("商品品牌情况", "商品包装有品牌信息", "商品包装无品牌信息", (ishavebrand) => { if (ishavebrand && !skuAttsDetail.IsTeamBrand)//有品牌且品牌不是集团的 { - new QualityProductWindow($"商品品牌情况", $"商品包装品牌是{skuAttsDetail.Brand}", $"商品包装品牌不是{skuAttsDetail.Brand}", (istruebrand) => { + new QualityProductWindow($"商品品牌情况", $"商品包装品牌是{skuAttsDetail.Brand}", $"商品包装品牌不是{skuAttsDetail.Brand}", (istruebrand) => + { if (istruebrand) { //无需贴商标 + + markType = BrandMarkType.无需贴商标; } else { + markType = BrandMarkType.无需遮盖; //需覆盖商标 } + isqualityBrand = true; }).ShowDialog(); @@ -1025,17 +1096,20 @@ namespace BBWY.Client.ViewModels.PackTask } else { + isqualityBrand = true; //需贴商标 - } - - + markType = BrandMarkType.无需遮盖; + } }).ShowDialog(); + if (isqualityBrand) + { + QualityWindow service = new QualityWindow(model, ReflashTask, IsNeedCer, markType, packTaskRes.Data); + service.Show(); + } - QualityWindow service = new QualityWindow(model, ReflashTask); - service.Show(); } @@ -2116,19 +2190,19 @@ namespace BBWY.Client.ViewModels.PackTask data.EndTime = item.CreateTime; data.SkuTitle = item.SkuGoodsTitle; data.AcceptName = item.UserName; - //if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0) - //{ + if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0) + { - // data.BarCodeModel = item.BarCodeDTO; - // if (data.BarCodeModel.LabelModel == BarcodeLabelModel.无型号模板) - // data.BarCodeModel.LabelModel = BarcodeLabelModel.精简模板; + data.BarCodeModel = item.BarCodeDTO; + if (data.BarCodeModel.LabelModel == BarcodeLabelModel.无型号模板) + data.BarCodeModel.LabelModel = BarcodeLabelModel.精简模板; - //} - //if (item.Cers != null) - //{ - // data.CertificateModel = item.Cers; + } + if (item.Cers != null) + { + data.CertificateModel = item.Cers; - //} + } data.ReflashTask = ReflashTask; App.Current.Dispatcher.Invoke(new Action(() => diff --git a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs index b2ff65af..0b6396bf 100644 --- a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs +++ b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs @@ -98,14 +98,14 @@ namespace BBWY.Client.ViewModels public ObservableCollection AvailabilityList { get => availabilityList; set { Set(ref availabilityList, value); } } - private int floorDragNumber; - public int FloorDragNumber { get => floorDragNumber; set { Set(ref floorDragNumber, value); } } + //private int floorDragNumber; + //public int FloorDragNumber { get => floorDragNumber; set { Set(ref floorDragNumber, value); } } - private ObservableCollection floorDragNumberList = new ObservableCollection - { + //private ObservableCollection floorDragNumberList = new ObservableCollection + //{ - }; - public ObservableCollection FloorDragNumberList { get => floorDragNumberList; set { Set(ref floorDragNumberList, value); } } + //}; + //public ObservableCollection FloorDragNumberList { get => floorDragNumberList; set { Set(ref floorDragNumberList, value); } } private ObservableCollection wareHourseList = new ObservableCollection { }; public ObservableCollection WareHourseList { get => wareHourseList; set { Set(ref wareHourseList, value); } } @@ -224,6 +224,21 @@ namespace BBWY.Client.ViewModels public Need IsNeedCertificateModel { get => isNeedCertificateModel; set { Set(ref isNeedCertificateModel, value); } } + private BrandMarkType brandMarkType; + /// + /// 是否需要条形码 + /// + public BrandMarkType BrandMarkType { get => brandMarkType; set { Set(ref brandMarkType, value); } } + + + + private List brandMarkTypeList = new List { BrandMarkType.无需遮盖, BrandMarkType.需遮盖, BrandMarkType.无需贴商标 }; + /// + /// 是否需要条形码 + /// + public List BrandMarkTypeList { get => brandMarkTypeList; set { Set(ref brandMarkTypeList, value); } } + + private BarCodeModel barCodeModel; /// /// 条形码 @@ -405,7 +420,7 @@ namespace BBWY.Client.ViewModels #region 方法 private void CompeteQualityTask(object obj) { - if (ArrivalQuantity==null) + if (ArrivalQuantity == null) { MessageBox.Show($"请输入到货数量"); return; @@ -416,11 +431,11 @@ namespace BBWY.Client.ViewModels return; } - if (FloorDragNumber <= 0) - { - MessageBox.Show($"请选择摆放地拖编号"); - return; - } + //if (FloorDragNumber <= 0) + //{ + // MessageBox.Show($"请选择摆放地拖编号"); + // return; + //} if (GoodProductQuantity > ArrivalQuantity) { @@ -455,11 +470,11 @@ namespace BBWY.Client.ViewModels IsNeedBar = IsNeedBarCode == Need.需要, IsNeedCer = IsNeedCertificateModel == Need.需要, TaskId = TaskId, - FloorDragNumber = FloorDragNumber + //FloorDragNumber = FloorDragNumber }; - if (CreateTime>Convert.ToDateTime("2023-08-21")) + if (CreateTime > Convert.ToDateTime("2023-08-21")) { if (IsNeedBarCode == Need.需要) { @@ -497,7 +512,7 @@ namespace BBWY.Client.ViewModels } } - + try { var competeRes = packPurchaseTaskService.CompeteQualityTask(request); @@ -519,7 +534,7 @@ namespace BBWY.Client.ViewModels // BarCodeModel.ShopName = OriginShopName; //} batchPrint.SetData(GoodProductQuantity.Value, - PurchaseSkuList.Where(p => p.IsNeedCer&& p.CerDTO!=null && p.CerDTO.Id > 0).Select(p => p.CerDTO).ToArray() + PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO != null && p.CerDTO.Id > 0).Select(p => p.CerDTO).ToArray() , BarCodeModel); batchPrint.ShowDialog(); @@ -603,16 +618,16 @@ namespace BBWY.Client.ViewModels bool isNeedClick = true; - if (CreateTime { @@ -660,26 +675,14 @@ namespace BBWY.Client.ViewModels /// /// 搜索 skuId(todo:) /// - public void SearchSku(PackTaskModel model) + public void LoadData(PackTaskModel model, Need cer, BrandMarkType brandMarkType, QualityTaskResponse qualityTaskResponse) { - CreateTime = model.EndTime; + CreateTime = model.EndTime; OriginShopName = model.ShopName; - - FloorDragNumber = 0; + // FloorDragNumber = 0; PurchaseSkuList = new ObservableCollection(); WareHourseList = new ObservableCollection(); - - FloorDragNumberList = new ObservableCollection(); - - for (int i = 0; i < 30; i++) - { - App.Current.Dispatcher.Invoke((Action)(() => - { - - FloorDragNumberList.Add(i + 1); - })); - } TaskId = model.TaskId; OrderId = model.OrderId; SkuId = model.SkuId; @@ -694,10 +697,6 @@ namespace BBWY.Client.ViewModels SkuTitle = model.SkuTitle; BasicPack = model.BasicPack; CertificatePosition = model.CertificatePosition; - - //ArrivalQuantity = 0; - //GoodProductQuantity = 0; - IncreateList = new ObservableCollection(); string[] increateDatas = model.Increment1?.Split(','); bool isSelected = false; @@ -729,46 +728,34 @@ namespace BBWY.Client.ViewModels ShowMarkMessage = string.Join("\r\n", resShow.Data.Select(d => d.ToString())); } - var packTaskRes = packPurchaseTaskService.GetQualityTask(model.TaskId); - - if (packTaskRes == null) - { - MessageBox.Show("网络异常!"); - return; - } - if (!packTaskRes.Success || packTaskRes.Data == null) - { - MessageBox.Show(packTaskRes.Msg); - return; - } - StoreGetSelfCount = packTaskRes.Data.StoreGetSelfCount; + + StoreGetSelfCount = qualityTaskResponse.StoreGetSelfCount; - SkuPurchaseSchemeId = packTaskRes.Data.SkuPurchaseSchemeId; - saveType = packTaskRes.Data.SaveType; + SkuPurchaseSchemeId = qualityTaskResponse.SkuPurchaseSchemeId; + saveType = qualityTaskResponse.SaveType; if (saveType == null) { saveType = OrderId.IsNullOrEmpty() ? SaveType.C端 : SaveType.B端; } - if (packTaskRes == null || !packTaskRes.Success) return; - BarCodeModel = packTaskRes.Data.BarCodeDTO; - IsNeedBarCode = packTaskRes.Data.IsNeedBar ? Need.需要 : Need.不需要; - IsSetBarCode = packTaskRes.Data.BarCodeDTO == null ? true : false; - IsNeedCertificateModel = packTaskRes.Data.IsNeedCer ? Need.需要 : Need.不需要; - if (packTaskRes.Data.WareHourses != null) - packTaskRes.Data.WareHourses.ToList().ForEach(w => + BarCodeModel = qualityTaskResponse.BarCodeDTO; + IsNeedBarCode = qualityTaskResponse.IsNeedBar ? Need.需要 : Need.不需要; + IsSetBarCode = qualityTaskResponse.BarCodeDTO == null ? true : false; + IsNeedCertificateModel = qualityTaskResponse.IsNeedCer ? Need.需要 : Need.不需要; + if (qualityTaskResponse.WareHourses != null) + qualityTaskResponse.WareHourses.ToList().ForEach(w => { App.Current.Dispatcher.Invoke(new Action(() => { WareHourseList.Add(w); })); - + }); WareHourseCount = WareHourseList.Count(); - if (packTaskRes.Data.PurchaseSkus != null) + if (qualityTaskResponse.PurchaseSkus != null) { int goodsIndex = 0; - foreach (var item in packTaskRes.Data.PurchaseSkus) + foreach (var item in qualityTaskResponse.PurchaseSkus) { goodsIndex++; if (item.CerDTO != null) item.CerDTO.GoodsNumberIndex = goodsIndex; @@ -852,8 +839,12 @@ namespace BBWY.Client.ViewModels } } + if (cer == Need.不需要) + { + CertificatePosition = CertificatePosition.无需合格证; + } - + BrandMarkType = brandMarkType; }); diff --git a/BBWY.Client/Views/PackTask/WareHouseListControl.xaml b/BBWY.Client/Views/PackTask/WareHouseListControl.xaml index ab657dd2..79147d15 100644 --- a/BBWY.Client/Views/PackTask/WareHouseListControl.xaml +++ b/BBWY.Client/Views/PackTask/WareHouseListControl.xaml @@ -270,7 +270,7 @@ diff --git a/BBWY.Client/Views/QualityTask/QualityWindow.xaml b/BBWY.Client/Views/QualityTask/QualityWindow.xaml index 31a3a749..d168c01e 100644 --- a/BBWY.Client/Views/QualityTask/QualityWindow.xaml +++ b/BBWY.Client/Views/QualityTask/QualityWindow.xaml @@ -373,8 +373,8 @@ - - + + @@ -400,7 +400,7 @@ - + @@ -445,7 +445,7 @@ - + diff --git a/BBWY.Client/Views/QualityTask/QualityWindow.xaml.cs b/BBWY.Client/Views/QualityTask/QualityWindow.xaml.cs index 950b840e..202c64db 100644 --- a/BBWY.Client/Views/QualityTask/QualityWindow.xaml.cs +++ b/BBWY.Client/Views/QualityTask/QualityWindow.xaml.cs @@ -1,6 +1,8 @@ using BBWY.Client.Models; +using BBWY.Client.Models.APIModel.Response.PackPurchaseTask; using BBWY.Client.ViewModels; using BBWY.Controls; +using NPOI.HSSF.Record.Chart; using System; namespace BBWY.Client.Views.QualityTask @@ -10,14 +12,16 @@ namespace BBWY.Client.Views.QualityTask /// public partial class QualityWindow : BWindow { - public QualityWindow(PackTaskModel model,Action ReflashTask) + public QualityWindow(PackTaskModel model, Action ReflashTask, Need IsNeedCer, BrandMarkType markType, QualityTaskResponse qualityTaskResponse) { - + InitializeComponent(); - var qualityViewModel =(QualityViewModel)this.DataContext; + var qualityViewModel = (QualityViewModel)this.DataContext; if (qualityViewModel.ReflashWindow == null) qualityViewModel.ReflashWindow = ReflashTask; - qualityViewModel.SearchSku(model); + qualityViewModel.LoadData(model, IsNeedCer, markType, qualityTaskResponse); } + + } } From a8f144bd60df6ada67fc1a49519d9f7112192300 Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Thu, 16 Nov 2023 16:26:54 +0800 Subject: [PATCH 6/7] 1 --- .../APIServices/QiKu/PackTaskService.cs | 42 +- .../APIServices/QiKu/PackUserService.cs | 5 +- .../APIServices/QiKu/PackagingTaskService.cs | 53 + .../APIServices/QiKu/QualityTaskService.cs | 16 +- .../APIServices/QiKu/SealBoxService.cs | 10 +- BBWY.Client/App.xaml.cs | 15 +- BBWY.Client/BBWY.Client.csproj | 5 + .../APIModel/Request/QualityTaskRequest.cs | 29 +- .../PackTask/SearchTaskListResponse.cs | 4 + .../PackTask/SearchWaitFallWareResponse.cs | 2 + .../PackUser/SearchPackerSalaryResponse.cs | 1 + .../PackUser/SearchPackerTaskResponse.cs | 22 +- .../SearchPackagingTaskListResponse.cs | 227 +++ .../SearchQualityTaskListResponse.cs | 11 +- .../SealBox/GetWareSealBoxResponse.cs | 10 +- .../GetWareSealBoxWaitConfigureResponse.cs | 3 + .../SealBox/GetWareWaitTransportResponse.cs | 1 + BBWY.Client/Models/Enums.cs | 26 +- BBWY.Client/Models/PackTask/PackTaskModel.cs | 49 +- BBWY.Client/Models/PackTask/SealBoxModel.cs | 9 +- .../Models/SealBox/SealBoxConfigureModel.cs | 6 + .../Models/SealBox/SealBoxConfiguredModel.cs | 1 + .../SealBox/SealBoxWaitConfigureModel.cs | 2 + .../Models/SealBox/WareNoSealBoxModel.cs | 2 + .../PackTask/PublishTaskViewModel.cs | 2 +- .../ViewModels/PackTask/TaskListViewModel.cs | 700 ++++++-- .../PackTask/WareHouseListViewModel.cs | 1513 +++++++++-------- .../PackerTask/PackerTaskViewModel.cs | 178 +- .../QualityTask/QualityViewModel.cs | 65 +- .../SealBox/SealBoxConfigureViewModel.cs | 14 +- .../FallWare/FallWareConfiguredControl.xaml | 4 +- .../FallWareWaitConfigureControl.xaml | 4 +- .../Views/FallWare/WaitFallWareControl.xaml | 8 +- .../FallWare/WareFallWareListControl.xaml | 5 - .../Views/PackTask/PackDetailWindow.xaml | 4 - .../PackTask/ShopWaitPackageControl.xaml | 4 +- BBWY.Client/Views/PackTask/TaskList.xaml | 5 +- .../Views/PackTask/TaskListControl.xaml | 4 +- .../Views/PackTask/WaitPackageControl.xaml | 15 +- BBWY.Client/Views/PackTask/WareHouseList.xaml | 3 +- .../Views/PackTask/WareHouseListControl.xaml | 11 +- .../PackagingTask/PackagingTaskList.xaml | 228 +++ .../PackagingTask/PackagingTaskList.xaml.cs | 245 +++ .../PackagingTask/ShopPackagingTaskList.xaml | 89 + .../ShopPackagingTaskList.xaml.cs | 26 + .../ShopWaitPackingTaskControl.xaml | 502 ++++++ .../ShopWaitPackingTaskControl.xaml.cs | 26 + .../PackagingTask/WaitPackingTaskControl.xaml | 566 ++++++ .../WaitPackingTaskControl.xaml.cs | 26 + .../PackerPackCompletedControl.xaml | 4 +- .../Views/PackerTask/PackerSalaryControl.xaml | 4 +- .../Views/PackerTask/PackerTaskList.xaml | 2 +- .../PackerTask/PackerWaitPackageControl.xaml | 14 +- .../PackerTask/PackerWaitPackageList.xaml | 89 + .../PackerTask/PackerWaitPackageList.xaml.cs | 26 + .../Views/QualityTask/AddExceptionWindow.xaml | 10 +- .../QualityTask/AddExceptionWindow.xaml.cs | 20 +- .../Views/QualityTask/BatchPrintWindow.xaml | 28 +- .../QualityTask/BatchPrintWindow.xaml.cs | 52 +- .../Views/QualityTask/QualityControl.xaml | 63 +- .../Views/QualityTask/QualityControl.xaml.cs | 6 +- .../Views/QualityTask/QualityWindow.xaml | 9 +- .../QualityTask/ShopWaitQualityControl.xaml | 6 +- .../QualityTask/ShopWaitQualityList.xaml | 85 + .../QualityTask/ShopWaitQualityList.xaml.cs | 25 + .../Views/QualityTask/WaitQualityList.xaml | 7 +- .../SealBox/SealBoxConfiguredControl.xaml | 4 +- .../SealBox/SealBoxNoConfigureControl.xaml | 8 +- .../SealBox/SealBoxWaitConfigureControl.xaml | 4 +- .../Views/SealBox/SetSealBoxPolicyWindow.xaml | 8 +- .../SealBox/SetSealBoxPolicyWindow.xaml.cs | 2 + .../Views/SealBox/WaitSealBoxControl.xaml | 8 +- .../Views/SplitTask/SplitTaskWindow.xaml | 92 + .../Views/SplitTask/SplitTaskWindow.xaml.cs | 104 ++ .../TeamWaitTransportControl.xaml | 4 +- .../WareWaitTransportControl.xaml | 8 +- 76 files changed, 4365 insertions(+), 1125 deletions(-) create mode 100644 BBWY.Client/APIServices/QiKu/PackagingTaskService.cs create mode 100644 BBWY.Client/Models/APIModel/Response/PackagingTask/SearchPackagingTaskListResponse.cs create mode 100644 BBWY.Client/Views/PackagingTask/PackagingTaskList.xaml create mode 100644 BBWY.Client/Views/PackagingTask/PackagingTaskList.xaml.cs create mode 100644 BBWY.Client/Views/PackagingTask/ShopPackagingTaskList.xaml create mode 100644 BBWY.Client/Views/PackagingTask/ShopPackagingTaskList.xaml.cs create mode 100644 BBWY.Client/Views/PackagingTask/ShopWaitPackingTaskControl.xaml create mode 100644 BBWY.Client/Views/PackagingTask/ShopWaitPackingTaskControl.xaml.cs create mode 100644 BBWY.Client/Views/PackagingTask/WaitPackingTaskControl.xaml create mode 100644 BBWY.Client/Views/PackagingTask/WaitPackingTaskControl.xaml.cs create mode 100644 BBWY.Client/Views/PackerTask/PackerWaitPackageList.xaml create mode 100644 BBWY.Client/Views/PackerTask/PackerWaitPackageList.xaml.cs create mode 100644 BBWY.Client/Views/QualityTask/ShopWaitQualityList.xaml create mode 100644 BBWY.Client/Views/QualityTask/ShopWaitQualityList.xaml.cs create mode 100644 BBWY.Client/Views/SplitTask/SplitTaskWindow.xaml create mode 100644 BBWY.Client/Views/SplitTask/SplitTaskWindow.xaml.cs diff --git a/BBWY.Client/APIServices/QiKu/PackTaskService.cs b/BBWY.Client/APIServices/QiKu/PackTaskService.cs index 94a3794a..adfeac47 100644 --- a/BBWY.Client/APIServices/QiKu/PackTaskService.cs +++ b/BBWY.Client/APIServices/QiKu/PackTaskService.cs @@ -30,14 +30,14 @@ namespace BBWY.Client.APIServices TaskState? TaskState = null, int pageIndex = 1, int pageSize = 10 - + ) { return SendRequest(globalContext.QKApiHost, "api/PackTask/SearchTaskList", new { - + orderSn, spuId, skuId, @@ -57,7 +57,7 @@ namespace BBWY.Client.APIServices int pageSize = 10, string SkuTitle = null, string SpuTitle = null, - string PackUserName=null + string PackUserName = null ) { @@ -373,18 +373,19 @@ namespace BBWY.Client.APIServices } - public ApiResponse StoreGetBySelfV2(long taskId, int storeGetCount, string PickerUserName) + public ApiResponse StoreGetBySelfV3(long taskId, int storeGetCount, string PickerUserName) { - return SendRequest(globalContext.QKApiHost, $"api/PackTask/StoreGetBySelfV2", new { + return SendRequest(globalContext.QKApiHost, $"api/PackTask/StoreGetBySelfV3", new + { taskId, storeGetCount, PickerUserName, - OperatorUserName= globalContext.User.Name + OperatorUserName = globalContext.User.Name }, null, HttpMethod.Post); } - public ApiResponse SearchStoreGetSelfList(string taskId, string OrderSn, string SpuId, string SkuId,string DepartmentName, string ShopName, int? pageIndex, int pageSize, string ShopId) + public ApiResponse SearchStoreGetSelfList(string taskId, string OrderSn, string SpuId, string SkuId, string DepartmentName, string ShopName, int? pageIndex, int pageSize, string ShopId) { return SendRequest(globalContext.QKApiHost, $"api/PackTask/SearchStoreGetSelfList", new @@ -393,8 +394,11 @@ namespace BBWY.Client.APIServices OrderSn, SpuId, SkuId, - DepartmentName, ShopName, - ShopId , pageIndex, pageSize, + DepartmentName, + ShopName, + ShopId, + pageIndex, + pageSize, }, null, HttpMethod.Post); } @@ -438,6 +442,26 @@ namespace BBWY.Client.APIServices } + public ApiResponse SplitPackTask(long nowTaskId, int ExceptionCount, TaskExceptionType TaskExceptionType, string RemarkMsg, TaskState AbortTaskState) + { + return SendRequest(globalContext.QKApiHost, "api/PackTask/SplitPackTask", + new + { + UserName = globalContext.User.Name, + nowTaskId, + ExceptionCount, + TaskExceptionType, + RemarkMsg, + AbortTaskState + + } + , null, HttpMethod.Post); + } + + + + + } public class CompeteSealBox diff --git a/BBWY.Client/APIServices/QiKu/PackUserService.cs b/BBWY.Client/APIServices/QiKu/PackUserService.cs index c838f402..db9f4991 100644 --- a/BBWY.Client/APIServices/QiKu/PackUserService.cs +++ b/BBWY.Client/APIServices/QiKu/PackUserService.cs @@ -25,7 +25,9 @@ namespace BBWY.Client.APIServices.QiKu int pageIndex = 1, int pageSize = 10, string SkuTitle = null, - string SpuTitle = null) + string SpuTitle = null, + PackagingTaskExceptionState? PackagingTaskExceptionState =null + ) { return SendRequest(globalContext.QKApiHost, $"api/PackUser/SearchPackerTask", new @@ -44,6 +46,7 @@ namespace BBWY.Client.APIServices.QiKu SkuTitle, SpuTitle, UserId = globalContext.User.Id.ToString(), + PackagingTaskExceptionState } , null, HttpMethod.Post); } diff --git a/BBWY.Client/APIServices/QiKu/PackagingTaskService.cs b/BBWY.Client/APIServices/QiKu/PackagingTaskService.cs new file mode 100644 index 00000000..de23a09b --- /dev/null +++ b/BBWY.Client/APIServices/QiKu/PackagingTaskService.cs @@ -0,0 +1,53 @@ +using BBWY.Client.Models.APIModel; +using BBWY.Client.Models; +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.QiKu +{ + public class PackagingTaskService : BaseApiService,IDenpendency + { + public PackagingTaskService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) + { + } + + + public ApiResponse SearchPackagingTaskList(string WayBillNo = null, string SourceExpressName = null, string departmentName = null, string skuId = null, string taskId = null, + string spuId = null, string orderSn = null, + PackagingTaskExceptionState? PackagingTaskExceptionState = null, + string ShopName = null, + int pageIndex = 1, + int pageSize = 10, + string SkuTitle = null, + string SpuTitle = null, + string PackUserName = null, + string shopId =null + ) + { + + return SendRequest(globalContext.QKApiHost, "api/PackagingTask/SearchPackagingTaskList", new + { + SkuTitle, + SpuTitle, + DepartmentName = departmentName, + SkuId = skuId, + TaskId = taskId, + PackagingTaskExceptionState, + PageIndex = pageIndex, + PageSize = pageSize, + ShopName = ShopName, + WayBillNo = WayBillNo, + SourceExpressName = SourceExpressName, + spuId, + orderSn, + PackUserName, + shopId + }, null, HttpMethod.Post); + } + + } +} diff --git a/BBWY.Client/APIServices/QiKu/QualityTaskService.cs b/BBWY.Client/APIServices/QiKu/QualityTaskService.cs index a9384426..dec66c46 100644 --- a/BBWY.Client/APIServices/QiKu/QualityTaskService.cs +++ b/BBWY.Client/APIServices/QiKu/QualityTaskService.cs @@ -25,7 +25,8 @@ namespace BBWY.Client.APIServices.QiKu int pageSize = 10, string SkuTitle = null, string SpuTitle = null, - string PackUserName = null + string PackUserName = null, + string shopId = null ) { @@ -44,7 +45,8 @@ namespace BBWY.Client.APIServices.QiKu SourceExpressName = SourceExpressName, spuId, orderSn, - PackUserName + PackUserName, + shopId }, null, HttpMethod.Post); } @@ -52,7 +54,7 @@ namespace BBWY.Client.APIServices.QiKu - public ApiResponse QualityTaskException(long TaskId, TaskExceptionType TaskExceptionType, string RemarkMsg) + public ApiResponse QualityTaskException(long TaskId, TaskExceptionType TaskExceptionType, string RemarkMsg, TaskState AbortTaskState) { return SendRequest(globalContext.QKApiHost, $"api/QualityTask/QualityTaskException", new @@ -60,7 +62,8 @@ namespace BBWY.Client.APIServices.QiKu TaskId, TaskExceptionType, RemarkMsg, - UserName = globalContext.User.Name + UserName = globalContext.User.Name, + AbortTaskState } , null, HttpMethod.Post); } @@ -82,14 +85,13 @@ namespace BBWY.Client.APIServices.QiKu } - public ApiResponse SendMsgToPurchaseDepartment(long TaskId, string ModelTitle, string TipMsg) + public ApiResponse SendMsgToPurchaseDepartment(long TaskId, SendCer3CValidMsgModel SendCer3CValidMsgModel) { return SendRequest(globalContext.QKApiHost, $"api/QualityTask/SendMsgToPurchaseDepartment", new { TaskId, - ModelTitle, - TipMsg, + SendCer3CValidMsgModel, UserName = globalContext.User.Name } , null, HttpMethod.Post); diff --git a/BBWY.Client/APIServices/QiKu/SealBoxService.cs b/BBWY.Client/APIServices/QiKu/SealBoxService.cs index 85a8993b..0b10ccd6 100644 --- a/BBWY.Client/APIServices/QiKu/SealBoxService.cs +++ b/BBWY.Client/APIServices/QiKu/SealBoxService.cs @@ -91,7 +91,7 @@ namespace BBWY.Client.APIServices , null, HttpMethod.Post); } - public ApiResponse GetWareSealBoxList(string ShopName, long? TaskId, string SkuId,long? SealBoxId, int? PageIndex, int? PageSize) + public ApiResponse GetWareSealBoxList(string ShopName, string TaskId, string SkuId,long? SealBoxId, int? PageIndex, int? PageSize) { return SendRequest(globalContext.QKApiHost, $"api/SealBox/GetWareSealBoxList", new @@ -128,7 +128,7 @@ namespace BBWY.Client.APIServices /// /// /// - public ApiResponse SearchWareFallWareConfigureList(PositionState positionState, string ShopName = null, long? TaskId = null, string SkuId = null,long?sealBoxId=null, int PageIndex = 1 + public ApiResponse SearchWareFallWareConfigureList(PositionState positionState, string ShopName = null, string TaskId = null, string SkuId = null,long?sealBoxId=null, int PageIndex = 1 , int PageSize = 10) { return SendRequest(globalContext.QKApiHost, $"api/SealBox/SearchWareFallWareConfigureList", @@ -155,7 +155,7 @@ namespace BBWY.Client.APIServices /// /// /// - public ApiResponse SearchFallWareConfiguredList(PositionState positionState, long? TaskId = null, string SkuId = null, int PageIndex = 1 + public ApiResponse SearchFallWareConfiguredList(PositionState positionState, string TaskId = null, string SkuId = null, int PageIndex = 1 , int PageSize = 10) { return SendRequest(globalContext.QKApiHost, $"api/SealBox/SearchFallWareConfiguredList", @@ -222,7 +222,7 @@ namespace BBWY.Client.APIServices } - public ApiResponse GetWareSealBoxWaitConfigureList(string ShopName, long? TaskId, string SkuId, int? PageIndex, int? PageSize) + public ApiResponse GetWareSealBoxWaitConfigureList(string ShopName, string TaskId, string SkuId, int? PageIndex, int? PageSize) { return SendRequest(globalContext.QKApiHost, $"api/SealBox/GetWareSealBoxWaitConfigureList", new @@ -273,7 +273,7 @@ namespace BBWY.Client.APIServices null, null, HttpMethod.Post); } - public ApiResponse GetWareWaitCompletedList(string shopId, string ShopName , long? TaskId , string SkuId , long? sealBoxId , int? PageIndex, int? PageSize) + public ApiResponse GetWareWaitCompletedList(string shopId, string ShopName , string TaskId , string SkuId , long? sealBoxId , int? PageIndex, int? PageSize) { return SendRequest(globalContext.QKApiHost, $"api/SealBox/GetWareWaitCompletedList", new { diff --git a/BBWY.Client/App.xaml.cs b/BBWY.Client/App.xaml.cs index b086b6d8..dd2644bb 100644 --- a/BBWY.Client/App.xaml.cs +++ b/BBWY.Client/App.xaml.cs @@ -56,7 +56,7 @@ namespace BBWY.Client //userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNjY1ODk1OTgzMzc4MDc1NjQ4IiwidGVhbUlkIjoiMTUxNjcxNTM3MjQ0NTcwMDA5NiIsInNvblRlYW1JZHMiOiIxNTQwODg1NTcwNjI3MDQ3NDI0LDE1MTY3MTUzNzI0NDU3MDAwOTYiLCJleHAiOjE3MjQyOTE2MDZ9.NG6wDqHJ5ozmEDcAt2duJ50IcGarygrQ2bmiP4TGNRE"; //齐越山鸡 - userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTM1MzMwMzI4ODkyMTQ5NzYwIiwidGVhbUlkIjoiMTUxNjk3NDI1MDU0MjUwMTg4OCIsInNvblRlYW1JZHMiOiIxNDM2Mjg4NTAwMjM1MjQzNTIwIiwiZXhwIjoxNzI2MzAwNjY0fQ.hPSbgJEuTt0MLy_7YkSJX4rRG3drJAfso-5IS8ZlOkY"; + // userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTM1MzMwMzI4ODkyMTQ5NzYwIiwidGVhbUlkIjoiMTUxNjk3NDI1MDU0MjUwMTg4OCIsInNvblRlYW1JZHMiOiIxNDM2Mjg4NTAwMjM1MjQzNTIwIiwiZXhwIjoxNzI2MzAwNjY0fQ.hPSbgJEuTt0MLy_7YkSJX4rRG3drJAfso-5IS8ZlOkY"; //飞鱼 userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNjI3NDg2MDI0Mjk0NzMxNzc2IiwidGVhbUlkIjoiMTUxNjk3NDI1MDU0MjUwMTg4OCIsInNvblRlYW1JZHMiOiIxNTE2OTc0MjUwNTQyNTAxODg4IiwiZXhwIjoxNzI0NTY1ODU5fQ._ezJmsvaStab8nDPB7qeoc2aakWfhHbeqq_X_RQsc4s"; @@ -68,15 +68,18 @@ namespace BBWY.Client // userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNjI0OTUxNjgzNTc2NTAwMjI0IiwidGVhbUlkIjoiMTYyMDM0MjAxNDcwNjk3ODgxNiIsInNvblRlYW1JZHMiOiIxNjIwMzQyMDE0NzA2OTc4ODE2LDE2MjAzNDQxNDA4NTAwMDgwNjQsMTQxMDk1NTYwNDYxMjA5MTkwNCIsImV4cCI6MTcyNDkxNDM5M30.tIgo70tzRxZyUQkX1Jsh9I4ySciX0VC9HMMOoTnwVtM"; //包装组 - /// userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMzk1NzA4MjA4NjU1MzcyMjg4IiwidGVhbUlkIjoiMTcxODU0MTA2MzM5NzgzODg0OCIsInNvblRlYW1JZHMiOiIiLCJleHAiOjE3MzAyODcxNjh9.lpiLJjP0prtQgZZfpG0NN6n60LNKstbFCJc-nLgb62A"; + /// userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMzk1NzA4MjA4NjU1MzcyMjg4IiwidGVhbUlkIjoiMTcxODU0MTA2MzM5NzgzODg0OCIsInNvblRlYW1JZHMiOiIiLCJleHAiOjE3MzAyODcxNjh9.lpiLJjP0prtQgZZfpG0NN6n60LNKstbFCJc-nLgb62A"; //齐越琳琳 - - // userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNjY4NDI2OTQyNTY0NTM2MzIwIiwidGVhbUlkIjoiMTUxNjcxNTM3MjQ0NTcwMDA5NiIsInNvblRlYW1JZHMiOiIxNzE4NTQxMDYzMzk3ODM4ODQ4LDE1MTY3MTUzNzI0NDU3MDAwOTYiLCJleHAiOjE3MzAyODcxNjh9.6vXadZWQfhnxbR3320RloKv3LqqbNdZ7wDDfO3tY_5U"; + + // userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNjY4NDI2OTQyNTY0NTM2MzIwIiwidGVhbUlkIjoiMTUxNjcxNTM3MjQ0NTcwMDA5NiIsInNvblRlYW1JZHMiOiIxNzE4NTQxMDYzMzk3ODM4ODQ4LDE1MTY3MTUzNzI0NDU3MDAwOTYiLCJleHAiOjE3MzAyODcxNjh9.6vXadZWQfhnxbR3320RloKv3LqqbNdZ7wDDfO3tY_5U"; //齐越季夏 - // userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNjIyNzY3NTkzODM0MTU2MDMyIiwidGVhbUlkIjoiMTUxNjcxNTM3MjQ0NTcwMDA5NiIsInNvblRlYW1JZHMiOiIxNTE2NzE1MzcyNDQ1NzAwMDk2LDE3MTg1NDEwNjMzOTc4Mzg4NDgiLCJleHAiOjE3MzAyODcxNjh9.ZGBU0MoJbKdkgqe9x2e3l6q-AVZwfAkUwa3oB47PWhY"; - #else + // userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNjIyNzY3NTkzODM0MTU2MDMyIiwidGVhbUlkIjoiMTUxNjcxNTM3MjQ0NTcwMDA5NiIsInNvblRlYW1JZHMiOiIxNTE2NzE1MzcyNDQ1NzAwMDk2LDE3MTg1NDEwNjMzOTc4Mzg4NDgiLCJleHAiOjE3MzAyODcxNjh9.ZGBU0MoJbKdkgqe9x2e3l6q-AVZwfAkUwa3oB47PWhY"; + + //店铺自打包 + //userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNzE5Nzc5OTU4MTYwNjI1NjY0IiwidGVhbUlkIjoiMTU0MDg4NTU3MDYyNzA0NzQyNCIsInNvblRlYW1JZHMiOiIxNzE4NTQxMDYzMzk3ODM4ODQ4IiwiZXhwIjoxNzMxNzI1NDA2fQ.VV6k8nDqTtQOY6_ma6QcX6geMU_kaswl16BGXF89so8"; +#else //var uid = e.Args.Count() > 0 ? e.Args.LastOrDefault(args => args.StartsWith("uid:")) : string.Empty; //if (string.IsNullOrEmpty(uid)) //{ diff --git a/BBWY.Client/BBWY.Client.csproj b/BBWY.Client/BBWY.Client.csproj index 760a73f2..dc02d1e7 100644 --- a/BBWY.Client/BBWY.Client.csproj +++ b/BBWY.Client/BBWY.Client.csproj @@ -95,6 +95,11 @@ + + + + + diff --git a/BBWY.Client/Models/APIModel/Request/QualityTaskRequest.cs b/BBWY.Client/Models/APIModel/Request/QualityTaskRequest.cs index 482278f4..bc347744 100644 --- a/BBWY.Client/Models/APIModel/Request/QualityTaskRequest.cs +++ b/BBWY.Client/Models/APIModel/Request/QualityTaskRequest.cs @@ -63,21 +63,6 @@ namespace BBWY.Client.Models.APIModel.Request /// 显示的条码Id /// public long? BarcodeId { get; set; } - //public BarCodeDTO BarCodeDTO { get; set; } - /// - /// 是否需要合格证 - /// - public bool IsNeedBar { get; set; } - /// - /// 是否需要合格证 - /// - public bool IsNeedCer { get; set; } - - ///// - ///// 配件列表 - ///// - //public PurchaseSku[] PurchaseSkus { get; set; } - /// /// 到货数量 /// @@ -88,15 +73,9 @@ namespace BBWY.Client.Models.APIModel.Request /// public int GoodProductQuantity { get; set; } - ///// - ///// 预计完成时间 - ///// - //public DateTime? PreCompeteTime { get; set; } - - ///// - ///// 地拖摆放编号 - ///// - //public int? FloorDragNumber { get; set; } - + /// + /// 品牌标签类型 + /// + public BrandMarkType? BrandMarkType { get; set; } } } diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs index a6bdcd72..83516da6 100644 --- a/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs @@ -22,6 +22,10 @@ namespace BBWY.Client.Models.APIModel public class PackTaskData { + /// + /// 任务备注(原任务:10000 子任务:10000-1) + /// + public string TaskIdRemark { get; set; } /// /// 图片链接 /// diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/SearchWaitFallWareResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/SearchWaitFallWareResponse.cs index 93f35947..fe8800a4 100644 --- a/BBWY.Client/Models/APIModel/Response/PackTask/SearchWaitFallWareResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackTask/SearchWaitFallWareResponse.cs @@ -82,6 +82,8 @@ namespace BBWY.Client.Models.APIModel public class WaitFallWareModel:NotifyObject { + private bool isHideSkuList = true;//默认隐藏 + public bool IsHideSkuList { get => isHideSkuList; set { Set(ref isHideSkuList, value); } } /// /// 仓库类型 /// diff --git a/BBWY.Client/Models/APIModel/Response/PackUser/SearchPackerSalaryResponse.cs b/BBWY.Client/Models/APIModel/Response/PackUser/SearchPackerSalaryResponse.cs index d61d2298..31f2da55 100644 --- a/BBWY.Client/Models/APIModel/Response/PackUser/SearchPackerSalaryResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackUser/SearchPackerSalaryResponse.cs @@ -81,6 +81,7 @@ namespace BBWY.Client.Models.APIModel public class PackerTaskSalary { + public string TaskIdRemark { get; set; } /// /// 任务收益 /// diff --git a/BBWY.Client/Models/APIModel/Response/PackUser/SearchPackerTaskResponse.cs b/BBWY.Client/Models/APIModel/Response/PackUser/SearchPackerTaskResponse.cs index ec75adfc..88e645b0 100644 --- a/BBWY.Client/Models/APIModel/Response/PackUser/SearchPackerTaskResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackUser/SearchPackerTaskResponse.cs @@ -8,6 +8,14 @@ namespace BBWY.Client.Models.APIModel { public class SearchPackerTaskResponse { + /// + /// 待包装异常总数 + /// + public string PackagingTaskExceptionCount { get; set; } + /// + /// 待包装数 + /// + public string PackagingTaskCount { get; set; } /// /// 任务总量 /// @@ -23,9 +31,9 @@ namespace BBWY.Client.Models.APIModel public string WaitPackCount { get; set; } } - public class PackerTaskData:NotifyObject + public class PackerTaskData : NotifyObject { - + public string TaskIdRemark { get; set; } /// /// 图片链接 @@ -161,6 +169,16 @@ namespace BBWY.Client.Models.APIModel /// public bool? IsOverTimeTomorrow { get; set; } + /// + /// 任务挂起时间 + /// + public DateTime? TaskAbortTime { get; set; } + + /// + /// 包装任务状态 + /// + public Models.PackagingTaskExceptionState PackagingTaskExceptionState { get; set; } + } public class MarkMessageModel diff --git a/BBWY.Client/Models/APIModel/Response/PackagingTask/SearchPackagingTaskListResponse.cs b/BBWY.Client/Models/APIModel/Response/PackagingTask/SearchPackagingTaskListResponse.cs new file mode 100644 index 00000000..f5842864 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/PackagingTask/SearchPackagingTaskListResponse.cs @@ -0,0 +1,227 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel +{ + public class SearchPackagingTaskListResponse + { + /// + /// 待包装异常总数 + /// + public int PackagingTaskExceptionCount { get; set; } + /// + /// 待包装数 + /// + public int PackagingTaskCount { get; set; } + + /// + /// 查询总数据(判断总页数) + /// + public int TotalCount { get; set; } + + /// + /// 页面返回的数据 + /// + public List Items { get; set; } + } + + /// + /// 包装任务数据 + /// + public class PackagingTaskData + { + /// + /// 任务备注(原任务:10000 子任务:10000-1) + /// + public string TaskIdRemark { get; set; } + /// + /// 图片链接 + /// + public string Logo { get; set; } + + /// + /// 任务id + /// + public long TaskId { get; set; } + + /// + /// 需求方创建日期 + /// + public DateTime CreateTime { get; set; } + + /// + /// 任务状态 + /// + public TaskState TaskState { get; set; } + + /// + /// 需求方团队 + /// + public string DepartmentName { get; set; } + + /// + /// 需求方店铺 + /// + public string ShopName { get; set; } + + + /// + /// 货号品名 + /// + public string BrandName { get; set; } + + /// + /// 对接人 + /// + public string UserName { get; set; } + + /// + /// skuid + /// + public string SkuId { get; set; } + /// + /// SKU标题 + /// + public string SkuName { get; set; } + /// + /// sku数量 + /// + public int SkuCount { get; set; } + /// + /// 打包类型(单件=0,多件=1) + /// + public int PackType { get; set; } + + /// + /// 落仓(本地仓=0,齐越仓=1,京东仓=2,聚水潭=3) + /// + public string PositionType { get; set; } + + /// + /// 基础包装(快递袋=0,纸箱=1,麻袋=2) + /// + public int BasicPack { get; set; } + + /// + /// 增量1() + /// + public string Increment1 { get; set; } + + + /// + /// 合格证位置(外部包装=0,产品包装=1) + /// + public int? CertificatePosition { get; set; } + + + /// + /// sku配件名称 + /// + public string SkuGoodsTitle { get; set; } + + /// + /// 配件数 + /// + public int GoodsNumber { get; set; } + + + + + /// + /// 条形码数据 + /// + public BarCodeModel BarCodeDTO { get; set; } + + /// + /// 合格证数据 + /// + public CertificateModel[] Cers { get; set; } + + /// + /// 品牌 + /// + public string Brand { get; set; } + + + /// + /// 打包超时时间 + /// + public DateTime? PackCompletionOverTime { get; set; } + + /// + /// 打包完成时间 + /// + public DateTime? PackCompeteTime { get; set; } + + /// + /// 设置打包时间 + /// + public DateTime? SetPackUserTaskTime { get; set; } + + /// + /// 打包超时备注信息 + /// + public string PackOverTimeMarkMsg { get; set; } + + + /// + /// 消息列表 + /// + public List MarkMessageModelList { get; set; } + + /// + /// 采购方案 + /// + public string SkuPurchaseSchemeId { get; set; } + + + /// + /// 店铺id(采购店铺) + /// + public string ShopId { get; set; } + + /// + /// 设置sku配置时间(信息不全,待移除) + /// + public DateTime? SendToSetSkuConfigureTime { get; set; } + + + /// + /// 任务挂起时间 + /// + public DateTime? TaskAbortTime { get; set; } + + /// + /// 包装任务状态 + /// + public Models.PackagingTaskExceptionState PackagingTaskExceptionState { get; set; } + + + /// + /// 包装人收益(默认0.85折) + /// + public decimal PackagerFees { get; set; } + + + /// + /// 包装费用(包装原价) + /// + public decimal PackageFees { get; set; } + + /// + /// 耗材费用 + /// + public decimal ConsumableFees { get; set; } + + /// + /// 总计 + /// + public decimal PackTotalFees { get; set; } + + /// + /// 包装人 + /// + public string[] PackUserName { get; set; } + } +} diff --git a/BBWY.Client/Models/APIModel/Response/QualityTask/SearchQualityTaskListResponse.cs b/BBWY.Client/Models/APIModel/Response/QualityTask/SearchQualityTaskListResponse.cs index 76ee6f9f..da16dd3c 100644 --- a/BBWY.Client/Models/APIModel/Response/QualityTask/SearchQualityTaskListResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/QualityTask/SearchQualityTaskListResponse.cs @@ -11,6 +11,11 @@ namespace BBWY.Client.Models.APIModel /// public int QualityExceptionCount { get; set; } + /// + /// 待验收数量 + /// + public int QualityTaskCount { get; set; } + /// /// 查询总数据(判断总页数) /// @@ -25,8 +30,12 @@ namespace BBWY.Client.Models.APIModel /// /// 待验收数据 /// - public class QualityPackTaskData:NotifyObject + public class QualityPackTaskData : NotifyObject { + /// + /// 任务备注(原任务:10000 子任务:10000-1) + /// + public string TaskIdRemark { get; set; } /// /// 图片链接 /// diff --git a/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxResponse.cs b/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxResponse.cs index cc19678e..7000d4df 100644 --- a/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxResponse.cs @@ -1,4 +1,5 @@ -using System; +using BBWY.Client.Models.PackTask; +using System; using System.Collections.Generic; using System.Text; @@ -14,7 +15,7 @@ namespace BBWY.Client.Models.APIModel /// /// 分箱列表 /// - public List WaitSealBoxModels { get; set; } + public List WaitSealBoxModels { get; set; } } public class WareSealBoxData @@ -70,6 +71,11 @@ namespace BBWY.Client.Models.APIModel public DateTime? CreateTime { get; set; } public TaskState TaskState { get; set; } + + /// + /// 新任务Id + /// + public string TaskIdRemark { get; set; } /// /// 任务Id /// diff --git a/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxWaitConfigureResponse.cs b/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxWaitConfigureResponse.cs index 7f8425d2..062673ce 100644 --- a/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxWaitConfigureResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxWaitConfigureResponse.cs @@ -52,6 +52,9 @@ namespace BBWY.Client.Models.APIModel public class WareNoSealBoxSku { + + public string TaskIdRemark { get; set; } + public DateTime? CreateTime { get; set; } /// diff --git a/BBWY.Client/Models/APIModel/Response/SealBox/GetWareWaitTransportResponse.cs b/BBWY.Client/Models/APIModel/Response/SealBox/GetWareWaitTransportResponse.cs index bf386efc..df4cae97 100644 --- a/BBWY.Client/Models/APIModel/Response/SealBox/GetWareWaitTransportResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/SealBox/GetWareWaitTransportResponse.cs @@ -75,6 +75,7 @@ namespace BBWY.Client.Models.APIModel } public class WaitTransportSku { + public string TaskIdRemark { get; set; } public DateTime? CreateTime { get; set; } /// /// 任务状态 diff --git a/BBWY.Client/Models/Enums.cs b/BBWY.Client/Models/Enums.cs index a8ac66c0..60a92508 100644 --- a/BBWY.Client/Models/Enums.cs +++ b/BBWY.Client/Models/Enums.cs @@ -236,6 +236,7 @@ 待转运=11, 已超时=12, 待排单 =13, + 已拆分=14 } @@ -576,7 +577,7 @@ public enum TaskExceptionType { - 配件未到齐 = 0, + 配件未到齐 = 0,数量不对=1 } /// @@ -588,9 +589,30 @@ } - + /// + /// 品牌标签类型(无需遮盖 = 1, 需遮盖 = 2, 无需贴商标=3) + /// public enum BrandMarkType { 无需遮盖 = 1, 需遮盖 = 2, 无需贴商标=3 } + + + + + /// + /// 推送合格证验证(3C验证) 消息模板(任务未配置合格证=1, 包装无合格证=2, 验证3C有效性=3, 配置的合格证不是3c=4) + /// + public enum SendCer3CValidMsgModel + { + 任务未配置合格证 = 1, 包装无合格证 = 2, 验证3C有效性 = 3, 配置的合格证不是3c = 4 + } + + /// + /// 待包装任务状态( 待包装 = 0, 挂起任务 = 1,) + /// + public enum PackagingTaskExceptionState + { + 待包装 = 0, 挂起任务 = 1, + } } diff --git a/BBWY.Client/Models/PackTask/PackTaskModel.cs b/BBWY.Client/Models/PackTask/PackTaskModel.cs index ba53944c..28efbdf0 100644 --- a/BBWY.Client/Models/PackTask/PackTaskModel.cs +++ b/BBWY.Client/Models/PackTask/PackTaskModel.cs @@ -26,6 +26,17 @@ namespace BBWY.Client.Models /// public class PackTaskModel : BaseVM { + + + + + private string taskIdRemark; + /// + ///任务备注(原任务:10000 子任务:10000-1) + /// + public string TaskIdRemark { get => taskIdRemark; set { Set(ref taskIdRemark, value); } } + + private bool showSendMsg = false; /// /// 展示留言信息 @@ -104,10 +115,10 @@ namespace BBWY.Client.Models LookCerCommand = new RelayCommand(LookCer); SetServiceCommand = new RelayCommand(SetService); UpdateTaskCommand = new RelayCommand(UpdateTask); - + } - + private void SetService() { @@ -382,6 +393,40 @@ namespace BBWY.Client.Models public FeesItemResponse FeesItemResponse { get => feesItemResponse; set { Set(ref feesItemResponse, value); } } + + /// + /// 包装任务状态 + /// + public Models.PackagingTaskExceptionState PackagingTaskExceptionState { get; set; } + + + /// + /// 包装人收益(默认0.85折) + /// + public decimal PackagerFees { get; set; } + + + /// + /// 包装费用(包装原价) + /// + public decimal PackageFees { get; set; } + + /// + /// 耗材费用 + /// + public decimal ConsumableFees { get; set; } + + + /// + /// 总计 + /// + public decimal PackTotalFees { get; set; } + + + + + + public IList ItemList { get; set; } public string OrderId { get; set; } diff --git a/BBWY.Client/Models/PackTask/SealBoxModel.cs b/BBWY.Client/Models/PackTask/SealBoxModel.cs index c064e1bb..9e9cc3d8 100644 --- a/BBWY.Client/Models/PackTask/SealBoxModel.cs +++ b/BBWY.Client/Models/PackTask/SealBoxModel.cs @@ -6,9 +6,12 @@ using System.Text; namespace BBWY.Client.Models.PackTask { public class SealBoxModel : NotifyObject - { /// - /// 过期时间 - /// + { + private bool isHideSkuList = true;//默认隐藏 + public bool IsHideSkuList { get => isHideSkuList; set { Set(ref isHideSkuList, value); } } + /// + /// 过期时间 + /// public DateTime? SealBoxPackOverTime { get; set; } /// /// /封箱id diff --git a/BBWY.Client/Models/SealBox/SealBoxConfigureModel.cs b/BBWY.Client/Models/SealBox/SealBoxConfigureModel.cs index b0a12b40..9b6330b9 100644 --- a/BBWY.Client/Models/SealBox/SealBoxConfigureModel.cs +++ b/BBWY.Client/Models/SealBox/SealBoxConfigureModel.cs @@ -12,6 +12,11 @@ namespace BBWY.Client.Models.SealBox /// public class SealBoxConfigureModel : NotifyObject { + + /// + /// 任务id + /// + public string TaskIdRemark { get; set; } /// /// skuid /// @@ -84,6 +89,7 @@ namespace BBWY.Client.Models.SealBox /// public class SealBoxConfigureWareHourseModel : NotifyObject { + public string TaskIdRemark { get; set; } public long TaskId { get; set; } public Action TotalWareCount { get; set; } diff --git a/BBWY.Client/Models/SealBox/SealBoxConfiguredModel.cs b/BBWY.Client/Models/SealBox/SealBoxConfiguredModel.cs index eafa994e..c30531d5 100644 --- a/BBWY.Client/Models/SealBox/SealBoxConfiguredModel.cs +++ b/BBWY.Client/Models/SealBox/SealBoxConfiguredModel.cs @@ -51,6 +51,7 @@ namespace BBWY.Client.Models.SealBox } public class SealBoxConfigureTask:NotifyObject { + public string TaskIdRemark { get; set; } /// /// skuid /// diff --git a/BBWY.Client/Models/SealBox/SealBoxWaitConfigureModel.cs b/BBWY.Client/Models/SealBox/SealBoxWaitConfigureModel.cs index e7f1583f..5ab9c81e 100644 --- a/BBWY.Client/Models/SealBox/SealBoxWaitConfigureModel.cs +++ b/BBWY.Client/Models/SealBox/SealBoxWaitConfigureModel.cs @@ -6,6 +6,8 @@ namespace BBWY.Client.Models { public class SealBoxWaitConfigureModel : NotifyObject { + + public string TaskIdRemark { get; set; } /// /// skuid /// diff --git a/BBWY.Client/Models/SealBox/WareNoSealBoxModel.cs b/BBWY.Client/Models/SealBox/WareNoSealBoxModel.cs index 2f1deee5..956c7b5d 100644 --- a/BBWY.Client/Models/SealBox/WareNoSealBoxModel.cs +++ b/BBWY.Client/Models/SealBox/WareNoSealBoxModel.cs @@ -7,6 +7,8 @@ namespace BBWY.Client.Models { public class WareNoSealBoxModel:NotifyObject { + private bool isHideSkuList = true;//默认隐藏 + public bool IsHideSkuList { get => isHideSkuList; set { Set(ref isHideSkuList, value); } } /// /// 店铺Id /// diff --git a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs index 4c936b06..6337bb46 100644 --- a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs @@ -929,7 +929,7 @@ namespace BBWY.Client.ViewModels.PackTask var updateTaskModel = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(createTaskModel)); updateTaskModel.TaskId = TaskId; - updateTaskModel.SaveType = SaveType; + updateTaskModel.SaveType = SaveType;//任务类型 修改操作 res = packTaskService.UpdatePackTaskV2(updateTaskModel); } else diff --git a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs index 0cbe4e6f..9aba16e5 100644 --- a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs @@ -40,7 +40,7 @@ namespace BBWY.Client.ViewModels.PackTask public partial class TaskListViewModel : BaseVM, IDenpendency//注入服务 { - private QualityTaskExceptionState? qualityTaskExceptionState; + private QualityTaskExceptionState? qualityTaskExceptionState= Models.QualityTaskExceptionState.待验收; /// /// 任务状态 /// @@ -282,6 +282,48 @@ namespace BBWY.Client.ViewModels.PackTask public ObservableCollection StoreGetSelfDataList { get => storeGetSelfDataList; set { Set(ref storeGetSelfDataList, value); } } + QualityTaskService qualityTaskService; + + + private string packagingTaskExceptionCount; + /// + /// 验收异常总数 + /// + public string PackagingTaskExceptionCount { get => packagingTaskExceptionCount; set { Set(ref packagingTaskExceptionCount, value); } } + + private string packagingTaskCount; + /// + /// 待包装总数 + /// + public string PackagingTaskCount { get => packagingTaskCount; set { Set(ref packagingTaskCount, value); } } + + private string qualityExceptionCount; + /// + /// 验收异常总数 + /// + public string QualityExceptionCount { get => qualityExceptionCount; set { Set(ref qualityExceptionCount, value); } } + + private string qualityTaskCount; + /// + /// 验收异常总数 + /// + public string QualityTaskCount { get => qualityTaskCount; set { Set(ref qualityTaskCount, value); } } + + + + + private PackagingTaskExceptionState? packagingTaskExceptionState; + /// + /// 任务状态 + /// + public PackagingTaskExceptionState? PackagingTaskExceptionState + { + get => packagingTaskExceptionState; set + { + Set(ref packagingTaskExceptionState, value); + } + } + /// @@ -360,7 +402,11 @@ namespace BBWY.Client.ViewModels.PackTask public ICommand SetQualityTaskExceptionStateCommand { get; set; } - public TaskListViewModel(PackTaskService packTaskService, GlobalContext globalContext, SealBoxService sealBoxService, ProductService productService, MarkMessageService markMessageService) + public ICommand SetPackagingTaskExceptionStateCommand { get; set; } + + + + public TaskListViewModel(PackTaskService packTaskService, GlobalContext globalContext, SealBoxService sealBoxService, ProductService productService, MarkMessageService markMessageService, PackagingTaskService packagingTaskService, QualityTaskService qualityTaskService) { this.globalContext = globalContext; this.markMessageService = markMessageService; @@ -419,7 +465,10 @@ namespace BBWY.Client.ViewModels.PackTask { SelectWareType = s; - SearchTaskList(); + if (PageIndex == 1) + SearchTaskList(); + else + PageIndex = 1; }); ShowMoreMessageCommand = new RelayCommand(ShowMoreMessage); @@ -428,10 +477,23 @@ namespace BBWY.Client.ViewModels.PackTask AppendMarkMessageCommand = new RelayCommand(AppendMarkMessage); - SetQualityTaskExceptionStateCommand = new RelayCommand(() => { - SearchTaskList(); + SetQualityTaskExceptionStateCommand = new RelayCommand(() => + { + if (PageIndex == 1) + SearchTaskList(); + else + PageIndex = 1; }); + this.packagingTaskService = packagingTaskService; + this.qualityTaskService = qualityTaskService; + SetPackagingTaskExceptionStateCommand = new RelayCommand(() => + { + if (PageIndex == 1) + SearchTaskList(); + else + PageIndex = 1; + }); } MarkMessageService markMessageService; @@ -722,6 +784,8 @@ namespace BBWY.Client.ViewModels.PackTask TaskId = x.TaskId, TaskState = x.TaskState, WaitConfigureCount = x.SkuCount, + TaskIdRemark = x.TaskIdRemark + }).ToList(); SetSealBoxPolicyWindow setSealBoxPolicyWindow = new SetSealBoxPolicyWindow(data, ReflashTask, 0); @@ -800,7 +864,7 @@ namespace BBWY.Client.ViewModels.PackTask - + PackagingTaskService packagingTaskService; @@ -817,18 +881,8 @@ namespace BBWY.Client.ViewModels.PackTask public void SearchTaskList() { IsStartThread = false; - long? taskId = null; - try - { - if (SearchTaskId != null && !string.IsNullOrEmpty(SearchTaskId.Trim())) - taskId = Convert.ToInt64(SearchTaskId); - } - catch - { - System.Windows.MessageBox.Show("任务id必须为数字"); - return; + - } IsLoading = true; @@ -836,223 +890,537 @@ namespace BBWY.Client.ViewModels.PackTask Task.Factory.StartNew(() => { + + + try { - PackTaskList = new ObservableCollection();//初始化数据 - var datas = packTaskService.SearchTaskList(SearchSkuId, SearchTaskId, SearchSpuId, SearchOrderSn, this.TaskState, - PageIndex, PageSize); - if (datas != null && datas.Data != null && datas.Success) + if (TaskState == Models.TaskState.待验收) { - var dataModel = datas.Data; - OrderCount = dataModel.TotalCount; - foreach (var item in dataModel.Items) - { + PackTaskList = new ObservableCollection();//初始化数据 + var datas = qualityTaskService.SearchQualityTaskList( skuId:SearchSkuId,taskId: SearchTaskId,spuId: SearchSpuId, orderSn: SearchOrderSn, QualityTaskExceptionState: this.QualityTaskExceptionState, shopId: globalContext.User.Shop.ShopId.ToString(), + pageIndex: PageIndex,pageSize: PageSize); - var data = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(item)); - data.ItemList = new List() { new SkuMessage + + if (datas != null && datas.Data != null && datas.Success) + { + var dataModel = datas.Data; + OrderCount = dataModel.TotalCount; + QualityExceptionCount = dataModel.QualityExceptionCount.ToString(); + QualityTaskCount = dataModel.QualityTaskCount.ToString(); + foreach (var item in dataModel.Items) + { + + var data = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(item)); + data.ItemList = new List() { new SkuMessage { BrandName = item.BrandName, - GoodsNo = item.ProductItemNum, Logo= item.Logo, + Logo= item.Logo, SkuName = item.SkuName, SkuId = item.SkuId } }; - data.ExpressOrderList = item.ExpressOrderResponses; - data.EndTime = item.CreateTime; - data.SkuTitle = item.SkuGoodsTitle; - data.AcceptName = item.UserName; + data.ExpressOrderList = item.ExpressOrderResponses; + data.EndTime = item.CreateTime; + data.SkuTitle = item.SkuGoodsTitle; + data.AcceptName = item.UserName; + if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0) + { + + data.BarCodeModel = item.BarCodeDTO; + if (data.BarCodeModel.LabelModel == BarcodeLabelModel.无型号模板) + data.BarCodeModel.LabelModel = BarcodeLabelModel.精简模板; - if (!item.OrderId.IsNullOrEmpty() && !item.SkuId.IsNullOrEmpty())//加载物流信息 + } + if (item.Cers != null) + { + data.CertificateModel = item.Cers; + + } + data.ReflashTask = ReflashTask; + + App.Current.Dispatcher.Invoke(new Action(() => + { + PackTaskList.Add(data); + })); + + + } + + + if (TaskState == Models.TaskState.待验收) { - var expressData = packTaskService.GetPurchaseExpressOrderList(item.OrderId, item.SkuId); - if (expressData != null && expressData.Success && expressData.Data != null) + if (QualityTaskExceptionState == Models.QualityTaskExceptionState.待验收) { - expressData.Data.ForEach(e => + qualityOverTimeThread = new Thread(() => { - e.ExpressState = ExpressOrderHelper.GetExpressStateName(e.ExpressState); + var packtasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待验收 && p.QualityCompletionOverTime != null).ToList(); + if (packtasks.Count() > 0) + { + IsStartThread = true; + while (IsStartThread) + { + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + foreach (var item in packtasks) + { + TimeSpan datetime; + if (item.SendToSetSkuConfigureTime != null) + datetime = item.QualityCompletionOverTime.Value.Subtract(item.SendToSetSkuConfigureTime.Value); + else + datetime = item.QualityCompletionOverTime.Value.Subtract(DateTime.Now); + item.QualityRemainTime = OverTimeHelper.GetTimeString(datetime); + if (datetime.TotalMilliseconds > 0) + { + item.IsQualityOverTime = false; + + } + else + { + item.IsQualityOverTime = true; + } + + } + })); + Thread.Sleep(1000); + } + } + + + + + + }); - data.ExpressOrderList = expressData.Data; + //任务倒计时数据 + qualityOverTimeThread.IsBackground = true; + qualityOverTimeThread.Start(); + //任务状态为待验收 } - } - if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0) - { - data.BarCodeModel = item.BarCodeDTO; - if (data.BarCodeModel.LabelModel == BarcodeLabelModel.无型号模板) - data.BarCodeModel.LabelModel = BarcodeLabelModel.精简模板; - } - if (item.Cers != null) - { - data.CertificateModel = item.Cers; - } - if (item.FeesItemResponse != null) - { - data.FeesItemResponse = item.FeesItemResponse; - data.FeesMoney = item.FeesItemResponse.AllFees; - data.IsShowFees = item.FeesItemResponse.AllFees > 0 ? true : false; - data.FeesItemResponse.DiscountSingleFees = item.FeesItemResponse.SingleFees * item.FeesItemResponse.disCount; - data.FeesItemResponse.DiscountAllFees = item.FeesItemResponse.AllFees * item.FeesItemResponse.disCount; - } - else - { - data.IsShowFees = false; - } - if (item.PackUserName != null && item.PackUserName.Count() > 0) - { - data.PackUser = string.Join("\r\n", item.PackUserName); - } + if (QualityTaskExceptionState == Models.QualityTaskExceptionState.验收异常) + { + var packtasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待验收 && p.TaskAbortTime != null).ToList(); + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + foreach (var item in packtasks) + { + TimeSpan datetime; + datetime = item.QualityCompletionOverTime.Value.Subtract(item.TaskAbortTime.Value); + item.QualityRemainTime = OverTimeHelper.GetTimeString(datetime); + if (datetime.TotalMilliseconds > 0) + { + item.IsQualityOverTime = false; - data.ReflashTask = ReflashTask; + } + else + { + item.IsQualityOverTime = true; + } - App.Current.Dispatcher.Invoke(new Action(() => - { - PackTaskList.Add(data); - })); + } + })); + } - } + } + //任务状态为待打包 - //任务状态为待验收 - if (TaskState == Models.TaskState.待验收) - { - var packtasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待验收 && p.QualityCompletionOverTime != null).ToList(); - if (packtasks.Count() > 0) - { - //if (qualityOverTimeThread!=null) - //{ - // qualityOverTimeThread.Abort(); - //} - qualityOverTimeThread = new Thread(() => + Task.Factory.StartNew(() => + { + foreach (var item in PackTaskList) { - IsStartThread = true; - while (IsStartThread) + if (!item.OrderId.IsNullOrEmpty() && !item.SkuId.IsNullOrEmpty()) { - App.Current.Dispatcher.BeginInvoke(new Action(() => + var expressData = packTaskService.GetPurchaseExpressOrderList(item.OrderId, item.SkuId); + if (expressData != null && expressData.Success && expressData.Data != null) { - foreach (var item in packtasks) + + App.Current.Dispatcher.BeginInvoke(new Action(() => { - TimeSpan datetime; - if (item.SendToSetSkuConfigureTime != null) - datetime = item.QualityCompletionOverTime.Value.Subtract(item.SendToSetSkuConfigureTime.Value); - else - datetime = item.QualityCompletionOverTime.Value.Subtract(DateTime.Now); - item.QualityRemainTime = OverTimeHelper.GetTimeString(datetime); - if (datetime.TotalMilliseconds > 0) - item.IsQualityOverTime = false; - else - item.IsQualityOverTime = true; + expressData.Data.ForEach(e => + { + e.ExpressState = ExpressOrderHelper.GetExpressStateName(e.ExpressState); + }); + item.ExpressOrderList = expressData.Data; + })); - } - })); - Thread.Sleep(1000); + + + + } } + } - }); - //任务倒计时数据 - qualityOverTimeThread.IsBackground = true; - qualityOverTimeThread.Start(); - } + + }); } + else + { + } + } + else if (TaskState == Models.TaskState.待包装) { + PackTaskList = new ObservableCollection();//初始化数据 + var datas = packagingTaskService.SearchPackagingTaskList(skuId: SearchSkuId, taskId: SearchTaskId, spuId: SearchSpuId, orderSn: SearchOrderSn, PackagingTaskExceptionState: this.PackagingTaskExceptionState, shopId: globalContext.User.Shop.ShopId.ToString(), + pageIndex: PageIndex, pageSize: PageSize); + - //任务状态为待打包 - if (TaskState == Models.TaskState.待包装) + if (datas != null && datas.Data != null && datas.Success) { - var packCompletedTasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待包装 && p.PackCompletionOverTime != null).ToList(); - if (packCompletedTasks.Count() > 0) + var dataModel = datas.Data; + OrderCount = dataModel.TotalCount; + PackagingTaskCount = dataModel.PackagingTaskCount.ToString(); + PackagingTaskExceptionCount = dataModel.PackagingTaskExceptionCount.ToString(); + foreach (var item in dataModel.Items) { - packOverTimeThread = new Thread(() => + var data = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(item)); + + + data.ItemList = new List() { new SkuMessage + { BrandName = item.BrandName, + Logo= item.Logo, + SkuName = item.SkuName, + SkuId = item.SkuId + } }; + data.EndTime = item.CreateTime; + data.SkuTitle = item.SkuGoodsTitle; + data.AcceptName = item.UserName; + if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0) { - IsStartThread = true; - while (IsStartThread) + + data.BarCodeModel = item.BarCodeDTO; + if (data.BarCodeModel.LabelModel == BarcodeLabelModel.无型号模板) + data.BarCodeModel.LabelModel = BarcodeLabelModel.精简模板; + + } + if (item.Cers != null) + { + data.CertificateModel = item.Cers; + + } + data.ReflashTask = ReflashTask; + + if (item.PackUserName != null) + data.PackUser = string.Join("\r\n", item.PackUserName); + + if (item.PackUserName != null && item.PackUserName.Count() > 0) + { + data.PackUser = string.Join("\r\n", item.PackUserName); + } + + App.Current.Dispatcher.Invoke(new Action(() => + { + PackTaskList.Add(data); + })); + + + } + + if (TaskState == Models.TaskState.待包装) + { + var packCompletedTasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待包装 && p.PackCompletionOverTime != null).ToList(); + if (packCompletedTasks.Count() > 0) + { + + packOverTimeThread = new Thread(() => { - App.Current.Dispatcher.BeginInvoke(new Action(() => + IsStartThread = true; + while (IsStartThread) { - foreach (var item in packCompletedTasks) + App.Current.Dispatcher.BeginInvoke(new Action(() => { - var datetime = item.PackCompletionOverTime.Value.Subtract(DateTime.Now); - if (datetime.TotalMilliseconds > 0) + foreach (var item in packCompletedTasks) { - item.IsPackOverTime = false; - item.PackRemainTime = $"{datetime.Days}天{datetime.Hours}小时{datetime.Minutes}分"; + var datetime = item.PackCompletionOverTime.Value.Subtract(DateTime.Now); + if (datetime.TotalMilliseconds > 0) + { + item.IsPackOverTime = false; + item.PackRemainTime = OverTimeHelper.GetTimeString(datetime); + } + else + { + item.IsPackOverTime = true; + item.PackRemainTime = OverTimeHelper.GetTimeString(datetime); + } + } - else + })); + Thread.Sleep(1000); + } + + }); + //任务倒计时数据 + packOverTimeThread.IsBackground = true; + packOverTimeThread.Start(); + + + } + } + //任务状态为待打包 + + + + Task.Factory.StartNew(() => + { + foreach (var item in PackTaskList) + { + if (!item.OrderId.IsNullOrEmpty() && !item.SkuId.IsNullOrEmpty()) + { + var expressData = packTaskService.GetPurchaseExpressOrderList(item.OrderId, item.SkuId); + if (expressData != null && expressData.Success && expressData.Data != null) + { + + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + expressData.Data.ForEach(e => { - item.IsPackOverTime = true; - item.PackRemainTime = $"{-datetime.Days}天{-datetime.Hours}小时{-datetime.Minutes}分"; - } + e.ExpressState = ExpressOrderHelper.GetExpressStateName(e.ExpressState); - } - })); - Thread.Sleep(1000); + + }); + item.ExpressOrderList = expressData.Data; + })); + + + + + } } + } - }); - //任务倒计时数据 - packOverTimeThread.IsBackground = true; - packOverTimeThread.Start(); - } - } - if (TaskState == Models.TaskState.待排单) + }); + } + else { - var packCompletedTasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待排单 && p.ScheduleOverTime != null).ToList(); - if (packCompletedTasks.Count() > 0) + } + } + else + { + PackTaskList = new ObservableCollection();//初始化数据 + var datas = packTaskService.SearchTaskList(SearchSkuId, SearchTaskId, SearchSpuId, SearchOrderSn, this.TaskState, + PageIndex, PageSize); + if (datas != null && datas.Data != null && datas.Success) + { + var dataModel = datas.Data; + OrderCount = dataModel.TotalCount; + foreach (var item in dataModel.Items) { - //if (packOverTimeThread!=null) - //{ - // packOverTimeThread.Abort(); - //} - scheduleOverTimeThread = new Thread(() => + var data = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(item)); + + data.ItemList = new List() { new SkuMessage + { BrandName = item.BrandName, + GoodsNo = item.ProductItemNum, Logo= item.Logo, + SkuName = item.SkuName, + SkuId = item.SkuId + } }; + data.ExpressOrderList = item.ExpressOrderResponses; + data.EndTime = item.CreateTime; + data.SkuTitle = item.SkuGoodsTitle; + data.AcceptName = item.UserName; + + if (!item.OrderId.IsNullOrEmpty() && !item.SkuId.IsNullOrEmpty())//加载物流信息 { - IsStartThread = true; - while (IsStartThread) + var expressData = packTaskService.GetPurchaseExpressOrderList(item.OrderId, item.SkuId); + if (expressData != null && expressData.Success && expressData.Data != null) { - App.Current.Dispatcher.BeginInvoke(new Action(() => + expressData.Data.ForEach(e => + { + e.ExpressState = ExpressOrderHelper.GetExpressStateName(e.ExpressState); + }); + data.ExpressOrderList = expressData.Data; + } + } + if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0) + { + data.BarCodeModel = item.BarCodeDTO; + if (data.BarCodeModel.LabelModel == BarcodeLabelModel.无型号模板) + data.BarCodeModel.LabelModel = BarcodeLabelModel.精简模板; + } + if (item.Cers != null) + { + data.CertificateModel = item.Cers; + } + if (item.FeesItemResponse != null) + { + data.FeesItemResponse = item.FeesItemResponse; + data.FeesMoney = item.FeesItemResponse.AllFees; + data.IsShowFees = item.FeesItemResponse.AllFees > 0 ? true : false; + data.FeesItemResponse.DiscountSingleFees = item.FeesItemResponse.SingleFees * item.FeesItemResponse.disCount; + data.FeesItemResponse.DiscountAllFees = item.FeesItemResponse.AllFees * item.FeesItemResponse.disCount; + + } + else + { + data.IsShowFees = false; + } + if (item.PackUserName != null && item.PackUserName.Count() > 0) + { + data.PackUser = string.Join("\r\n", item.PackUserName); + } + + data.ReflashTask = ReflashTask; + + App.Current.Dispatcher.Invoke(new Action(() => + { + PackTaskList.Add(data); + })); + + } + + + + //任务状态为待验收 + if (TaskState == Models.TaskState.待验收) + { + var packtasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待验收 && p.QualityCompletionOverTime != null).ToList(); + if (packtasks.Count() > 0) + { + //if (qualityOverTimeThread!=null) + //{ + // qualityOverTimeThread.Abort(); + //} + + qualityOverTimeThread = new Thread(() => + { + IsStartThread = true; + while (IsStartThread) { - foreach (var item in packCompletedTasks) + App.Current.Dispatcher.BeginInvoke(new Action(() => { - var datetime = item.ScheduleOverTime.Value.Subtract(DateTime.Now); - if (datetime.TotalMilliseconds > 0) + foreach (var item in packtasks) { - item.IsScheduleOverTime = false; - item.ScheduleRemainTime = OverTimeHelper.GetTimeString(datetime); + TimeSpan datetime; + if (item.SendToSetSkuConfigureTime != null) + datetime = item.QualityCompletionOverTime.Value.Subtract(item.SendToSetSkuConfigureTime.Value); + else + datetime = item.QualityCompletionOverTime.Value.Subtract(DateTime.Now); + item.QualityRemainTime = OverTimeHelper.GetTimeString(datetime); + if (datetime.TotalMilliseconds > 0) + item.IsQualityOverTime = false; + else + item.IsQualityOverTime = true; + + + } - else + })); + Thread.Sleep(1000); + } + + }); + //任务倒计时数据 + qualityOverTimeThread.IsBackground = true; + qualityOverTimeThread.Start(); + + + } + } + + //任务状态为待打包 + if (TaskState == Models.TaskState.待包装) + { + var packCompletedTasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待包装 && p.PackCompletionOverTime != null).ToList(); + if (packCompletedTasks.Count() > 0) + { + + packOverTimeThread = new Thread(() => + { + IsStartThread = true; + while (IsStartThread) + { + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + foreach (var item in packCompletedTasks) { - item.IsScheduleOverTime = true; - item.ScheduleRemainTime = OverTimeHelper.GetTimeString(datetime); + var datetime = item.PackCompletionOverTime.Value.Subtract(DateTime.Now); + if (datetime.TotalMilliseconds > 0) + { + item.IsPackOverTime = false; + item.PackRemainTime = $"{datetime.Days}天{datetime.Hours}小时{datetime.Minutes}分"; + } + else + { + item.IsPackOverTime = true; + item.PackRemainTime = $"{-datetime.Days}天{-datetime.Hours}小时{-datetime.Minutes}分"; + } + } + })); + Thread.Sleep(1000); + } - } - })); - Thread.Sleep(1000); - } + }); + //任务倒计时数据 + packOverTimeThread.IsBackground = true; + packOverTimeThread.Start(); - }); - //任务倒计时数据 - scheduleOverTimeThread.IsBackground = true; - scheduleOverTimeThread.Start(); + } + } + + if (TaskState == Models.TaskState.待排单) + { + var packCompletedTasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待排单 && p.ScheduleOverTime != null).ToList(); + if (packCompletedTasks.Count() > 0) + { + //if (packOverTimeThread!=null) + //{ + // packOverTimeThread.Abort(); + //} + scheduleOverTimeThread = new Thread(() => + { + IsStartThread = true; + while (IsStartThread) + { + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + foreach (var item in packCompletedTasks) + { + var datetime = item.ScheduleOverTime.Value.Subtract(DateTime.Now); + if (datetime.TotalMilliseconds > 0) + { + item.IsScheduleOverTime = false; + item.ScheduleRemainTime = OverTimeHelper.GetTimeString(datetime); + } + else + { + item.IsScheduleOverTime = true; + item.ScheduleRemainTime = OverTimeHelper.GetTimeString(datetime); + } + + } + })); + Thread.Sleep(1000); + } + + }); + //任务倒计时数据 + scheduleOverTimeThread.IsBackground = true; + scheduleOverTimeThread.Start(); + + + } } - } + } + else + { + if (datas != null) System.Windows.MessageBox.Show(datas.Msg); + } + IsLoadCount(); } - else - { - if (datas != null) System.Windows.MessageBox.Show(datas.Msg); - } - IsLoadCount(); } catch (Exception ex) @@ -1185,7 +1553,7 @@ namespace BBWY.Client.ViewModels.PackTask if (SealBoxConfigureType == SealBoxConfigureType.待配置) { FallWareWaitConfigureList = new ObservableCollection(); - var fallWareRes = sealBoxService.SearchFallWareConfiguredList(PositionState.待落仓, taskId, SearchSkuId, PageIndex, PageSize); + var fallWareRes = sealBoxService.SearchFallWareConfiguredList(PositionState.待落仓, SearchTaskId, SearchSkuId, PageIndex, PageSize); if (fallWareRes == null) { @@ -1256,7 +1624,7 @@ namespace BBWY.Client.ViewModels.PackTask if (SealBoxConfigureType == SealBoxConfigureType.已配置) { FallWareConfiguredList = new ObservableCollection(); - var fallWareRes = sealBoxService.SearchFallWareConfiguredList(PositionState.已配置待落仓, taskId, SearchSkuId, PageIndex, PageSize); + var fallWareRes = sealBoxService.SearchFallWareConfiguredList(PositionState.已配置待落仓, SearchTaskId, SearchSkuId, PageIndex, PageSize); if (fallWareRes == null) { @@ -1299,7 +1667,7 @@ namespace BBWY.Client.ViewModels.PackTask Task.Factory.StartNew(() => { WaitCompletedList = new ObservableCollection(); - var datas = sealBoxService.GetWareWaitCompletedList(globalContext.User.Shop.ShopId.ToString(), null, taskId, SearchSkuId, null, PageIndex, PageSize); + var datas = sealBoxService.GetWareWaitCompletedList(globalContext.User.Shop.ShopId.ToString(), null, SearchTaskId, SearchSkuId, null, PageIndex, PageSize); if (datas != null && datas.Data != null && datas.Success) { var dataModel = datas.Data; diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index fa52bfd5..1300b9c7 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs @@ -25,7 +25,6 @@ using System.Diagnostics.Eventing.Reader; using BBWY.Client.Models.SealBox; using Newtonsoft.Json; using System.Diagnostics; -using BBWY.Client.Extensions; using BBWY.Client.APIServices.QiKu; using BBWY.Client.Views.PackerTask; using BBWY.Client.Models.QualityTask; @@ -35,6 +34,8 @@ using System.Windows.Interop; using NPOI.SS.Formula.Functions; using NPOI.SS.Util; using System.Text; +using BBWY.Client.Views.SplitTask; +using BBWY.Client.Extensions; namespace BBWY.Client.ViewModels.PackTask { @@ -380,7 +381,7 @@ namespace BBWY.Client.ViewModels.PackTask /// /// 分箱列表(已配置) /// - public List SealBoxModelList { get; set; } + public List SealBoxModelList { get; set; } @@ -609,12 +610,26 @@ namespace BBWY.Client.ViewModels.PackTask Set(ref qualityTaskExceptionState, value); } } + + + private PackagingTaskExceptionState? packagingTaskExceptionState; + /// + /// 任务状态 + /// + public PackagingTaskExceptionState? PackagingTaskExceptionState + { + get => packagingTaskExceptionState; set + { + Set(ref packagingTaskExceptionState, value); + } + } #endregion private readonly PackTaskService packTaskService; private readonly SealBoxService sealBoxService; public GlobalContext globalContext; + private readonly PackagingTaskService packagingTaskService; /// /// 推送sku配置状态 @@ -756,13 +771,19 @@ namespace BBWY.Client.ViewModels.PackTask public ICommand SetQualityTaskExceptionStateCommand { get; set; } - + public ICommand SetPackagingTaskExceptionStateCommand { get; set; } public ICommand QualityTaskExceptionCommand { get; set; } /// /// 验收任务 /// public ICommand QualityTaskCommand { get; set; } - public WareHouseListViewModel(PackTaskService packTaskService, GlobalContext globalContext, SealBoxService sealBoxService, PackUserService packUserService, MarkMessageService markMessageService, QualityTaskService qualityTaskService) + + public ICommand TaskSplitCommand { get; set; } + + public ICommand PackagingTaskExceptionCommand { get; set; } + + + public WareHouseListViewModel(PackTaskService packTaskService, GlobalContext globalContext, SealBoxService sealBoxService, PackUserService packUserService, MarkMessageService markMessageService, QualityTaskService qualityTaskService, PackagingTaskService packagingTaskService) { @@ -772,6 +793,8 @@ namespace BBWY.Client.ViewModels.PackTask this.packTaskService = packTaskService; this.packUserService = packUserService; this.markMessageService = markMessageService; + this.packagingTaskService = packagingTaskService; + this.qualityTaskService = qualityTaskService; //Messenger.Default.Send(globalContext, "AcceptGlobalContext"); PackTaskList = new ObservableCollection();//初始化数据 @@ -829,9 +852,13 @@ namespace BBWY.Client.ViewModels.PackTask SetWareTypeCommand = new RelayCommand(s => { - SelectWareType = s; - SearchTaskList(); + if (PageIndex == 1) + SearchTaskList(); + else + PageIndex = 1; + + }); CompeteWaitTransportCommand = new RelayCommand(CompeteWaitTransport); @@ -863,13 +890,45 @@ namespace BBWY.Client.ViewModels.PackTask AppendMarkMessageCommand = new RelayCommand(AppendMarkMessage); SetQualityTaskExceptionStateCommand = new RelayCommand(() => { - SearchTaskList(); + if (PageIndex == 1) + SearchTaskList(); + else + PageIndex = 1; }); - this.qualityTaskService = qualityTaskService; + + SetPackagingTaskExceptionStateCommand = new RelayCommand(() => + { + if (PageIndex == 1) + SearchTaskList(); + else + PageIndex = 1; + }); + + QualityTaskExceptionCommand = new RelayCommand(QualityTaskException); QualityTaskCommand = new RelayCommand(QualityTask); + + + TaskSplitCommand = new RelayCommand(TaskSplit); + + PackagingTaskExceptionCommand = new RelayCommand(PackagingTaskException); + + } + + private void PackagingTaskException(long taskId) + { + + AddExceptionWindow addExceptionWindow = new AddExceptionWindow(qualityTaskService, taskId, Models.TaskState.待包装, ReflashTask); + addExceptionWindow.ShowDialog(); + } + + private void TaskSplit(PackTaskModel model) + { + + SplitTaskWindow addExceptionWindow = new SplitTaskWindow(packTaskService, model.TaskId, model.TaskState, ReflashTask); + addExceptionWindow.ShowDialog(); } private void QualityTask(long taskId) @@ -919,151 +978,138 @@ namespace BBWY.Client.ViewModels.PackTask bool isqualityCer = false; //验收合格证 StringBuilder sb = null; - Need IsNeedCer = Need.不需要; - BrandMarkType markType = BrandMarkType.无需遮盖; + Need IsNeedCer = Need.不需要; + BrandMarkType markType = BrandMarkType.无需遮盖; + + SendCer3CValidMsgModel? sendCer3CValidMsgModel = null; + bool? isCer3CValid = null; - new QualityProductWindow("商品合格证情况", "商品包装有合格证信息", "商品包装无合格证信息", (ishaveCer) => - { - if (ishaveCer)//验收商品 有合格证 + new QualityProductWindow("商品合格证情况", "商品包装有合格证信息", "商品包装无合格证信息", (ishaveCer) => { - if (skuAttsDetail.ApplyAge.IsNullOrEmpty() || (skuAttsDetail.IsApplyAgeOver14 != null && skuAttsDetail.IsApplyAgeOver14.Value))//不存在使用年龄 或者适用年龄大于14 + if (ishaveCer)//验收商品 有合格证 { - new QualityProductWindow("商品合格证情况", "商品包装合格证上有品牌信息", "商品包装合格证上无品牌信息", (iscerhavebrand) => + if (skuAttsDetail.ApplyAge.IsNullOrEmpty() || (skuAttsDetail.IsApplyAgeOver14 != null && skuAttsDetail.IsApplyAgeOver14.Value))//不存在使用年龄 或者适用年龄大于14 { - - if (iscerhavebrand) + new QualityProductWindow("商品合格证情况", "商品包装合格证上有品牌信息", "商品包装合格证上无品牌信息", (iscerhavebrand) => { - new QualityProductWindow("商品合格证情况", $"商品包装合格证上的品牌是{skuAttsDetail.Brand}", $"商品包装合格证上的品牌不是{skuAttsDetail.Brand}", (istruebrand) => + if (iscerhavebrand) { - if (!istruebrand) + + new QualityProductWindow("商品合格证情况", $"商品包装合格证上的品牌是{skuAttsDetail.Brand}", $"商品包装合格证上的品牌不是{skuAttsDetail.Brand}", (istruebrand) => { - //需要合格证 - if (model.CertificateModel == null || !model.CertificateModel.Any())//未配置 + if (!istruebrand) { - sb = new StringBuilder(); - sb.AppendLine("该任务未配置合格证,商品包装合格证上的品牌与详情页的品牌不符"); - if (skuAttsDetail.ApplyAge.IsNullOrEmpty()) - sb.Append("详情页未展示适用年龄"); - else - sb.Append("详情页展示适用年龄为14岁以上"); - sb.Append("请立即配置合格证信息,包装任务已被挂起."); - var res = qualityTaskService.SendMsgToPurchaseDepartment(model.TaskId, "任务未配置合格证", sb.ToString()); - if (res.Success) + //需要合格证 + if (model.CertificateModel == null || !model.CertificateModel.Any())//未配置 { - ReflashTask();//刷新任务 + sendCer3CValidMsgModel = SendCer3CValidMsgModel.任务未配置合格证; + return; } + //todo:打印合格证 完全遮盖包装合格证信息 - return; - } - //打印合格证 完全遮盖包装合格证信息 - } - isqualityCer = true;//验收合格证完毕 - }).ShowDialog(); - return; - } - - isqualityCer = true;//验收合格证完毕 - }).ShowDialog(); + } + isqualityCer = true;//验收合格证完毕 + }).ShowDialog(); + return; + } - } - else - { + isqualityCer = true;//验收合格证完毕 + }).ShowDialog(); - if (IsPassInspection)//验收过 跳过询问 - { - isqualityCer = true; - return; } - //todo: 判断是否首次验收 只支持供应链 有采购方案的 - new QualityProductWindow("商品合格证情况", "商品合格证类型有3C标", "商品合格证类型无3C标", (ishave3c) => + else { - if (ishave3c) + + + if (IsPassInspection)//验收过 跳过询问 { - sb = new StringBuilder(); - sb.Append("该任务商品适用年龄为14岁以下,请验证合格证上的3C信息是否有效,包装任务已被挂起."); - var res = qualityTaskService.SendMsgToPurchaseDepartment(model.TaskId, "包装合格证有3C信息且详情页适用年龄小于14岁", sb.ToString()); - if (res.Success) - { - ReflashTask();//刷新任务 - } + isqualityCer = true; return; } - else + //todo: 判断是否首次验收 只支持供应链 有采购方案的 + new QualityProductWindow("商品合格证情况", "商品合格证类型有3C标", "商品合格证类型无3C标", (ishave3c) => { - //todo: - // 通知采购方问题 咨询是否可替款 - // MessageBox.Show("提示采购部门,当前任务详情页展示适用年龄为14岁以下, 实物商品配置的合格证没有3C,咨询是否可替款,任务已挂起"); - sb = new StringBuilder(); - sb.AppendLine("该任务商品包装有合格证信息"); - sb.Append("详情页展示适用年龄为14岁以下,但是商品包装合格证无3C标"); - sb.Append("请立即配置3C类型的合格证信息"); - var res = qualityTaskService.SendMsgToPurchaseDepartment(model.TaskId, "包装有合格证信息且详情页适用年龄小于14岁", sb.ToString()); - if (res.Success) + if (ishave3c) { - ReflashTask();//刷新任务 + sendCer3CValidMsgModel = SendCer3CValidMsgModel.验证3C有效性; + return; } - } + else + { + if (!model.CertificateModel.Any(c => c.LabelModel != CertificateLabelModel.标准有3c))//所有有配置的合格证都是标准3c + { + isqualityCer = true;//验收正常 + return; + } + sendCer3CValidMsgModel = SendCer3CValidMsgModel.配置的合格证不是3c; - + //todo:需遮盖 原合格证 + } - }).ShowDialog(); - } - //验收商品合格证是否有品牌 + }).ShowDialog(); + } - } - else - { - IsNeedCer = Need.需要;//需要合格证 - //需要合格证 - if (model.CertificateModel == null || !model.CertificateModel.Any())//未配置 + //验收商品合格证是否有品牌 + + + } + else { - sb = new StringBuilder(); - sb.AppendLine("该任务未配置合格证,请立即配置合格证信息"); - var res1 = qualityTaskService.SendMsgToPurchaseDepartment(model.TaskId, "任务未配置合格证", sb.ToString()); - if (res1.Success) + IsNeedCer = Need.需要;//需要合格证 + //需要合格证 + if (model.CertificateModel == null || !model.CertificateModel.Any())//未配置 { - ReflashTask();//刷新任务 + sendCer3CValidMsgModel = SendCer3CValidMsgModel.任务未配置合格证; + return; } - return; - } - if (skuAttsDetail.ApplyAge.IsNullOrEmpty() || (skuAttsDetail.IsApplyAgeOver14 != null && skuAttsDetail.IsApplyAgeOver14.Value))//不存在使用年龄 或者适用年龄大于14 - { - isqualityCer = true;//验收正常 - return; - } - //年龄低于14 + 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;//验收正常 + if (!model.CertificateModel.Any(c => c.LabelModel != CertificateLabelModel.标准有3c))//所有有配置的合格证都是标准3c + { + isqualityCer = true;//验收正常 + return; + } + //不存在 3c 通知采购方问题 + // MessageBox.Show("提示采购部门,当前任务配置的合格证没有3C,赶紧配置,任务已挂起"); + + //todo:无需遮盖 + sendCer3CValidMsgModel = SendCer3CValidMsgModel.配置的合格证不是3c; return; } - //不存在 3c 通知采购方问题 - // MessageBox.Show("提示采购部门,当前任务配置的合格证没有3C,赶紧配置,任务已挂起"); - sb = new StringBuilder(); - sb.AppendLine("该任务商品包装无合格证信息"); - - sb.Append("详情页展示适用年龄为14岁以下,"); - sb.Append("请立即配置3C类型的合格证信息"); - var res = qualityTaskService.SendMsgToPurchaseDepartment(model.TaskId, "包装无合格证信息且详情页适用年龄小于14岁", sb.ToString()); - if (res.Success) - { - ReflashTask();//刷新任务 - } + }).ShowDialog(); + if (sendCer3CValidMsgModel != null) + { + var res = qualityTaskService.SendMsgToPurchaseDepartment(model.TaskId, sendCer3CValidMsgModel.Value); + if (res == null || !res.Success) + { + MessageBox.Show(res?.Msg); return; } - }).ShowDialog(); + if (res.Success) + { + if (!res.Msg.IsNullOrEmpty()) + MessageBox.Show(res.Msg); + ReflashTask();//刷新任务 + } + + } + if (isqualityCer)//合格证验收完毕 { @@ -1071,26 +1117,35 @@ namespace BBWY.Client.ViewModels.PackTask new QualityProductWindow("商品品牌情况", "商品包装有品牌信息", "商品包装无品牌信息", (ishavebrand) => { - if (ishavebrand && !skuAttsDetail.IsTeamBrand)//有品牌且品牌不是集团的 + if (ishavebrand)//有品牌且品牌不是集团的 { - new QualityProductWindow($"商品品牌情况", $"商品包装品牌是{skuAttsDetail.Brand}", $"商品包装品牌不是{skuAttsDetail.Brand}", (istruebrand) => + if (!skuAttsDetail.IsTeamBrand) { + new QualityProductWindow($"商品品牌情况", $"商品包装品牌是{skuAttsDetail.Brand}", $"商品包装品牌不是{skuAttsDetail.Brand}", (istruebrand) => + { - if (istruebrand) - { - //无需贴商标 + if (istruebrand) + { + //无需贴商标 - markType = BrandMarkType.无需贴商标; - } - else - { - markType = BrandMarkType.无需遮盖; - //需覆盖商标 - } + markType = BrandMarkType.无需贴商标; + } + else + { + markType = BrandMarkType.需遮盖; + //需覆盖商标 + } + isqualityBrand = true; + + }).ShowDialog(); + } + else + { + markType = BrandMarkType.需遮盖;//有品牌 但任务sku所属的品牌是集团品牌 isqualityBrand = true; + } - }).ShowDialog(); } @@ -1106,7 +1161,7 @@ namespace BBWY.Client.ViewModels.PackTask { QualityWindow service = new QualityWindow(model, ReflashTask, IsNeedCer, markType, packTaskRes.Data); - service.Show(); + service.ShowDialog(); } @@ -1120,7 +1175,7 @@ namespace BBWY.Client.ViewModels.PackTask private void QualityTaskException(long taskId) { - AddExceptionWindow addExceptionWindow = new AddExceptionWindow(qualityTaskService, taskId); + AddExceptionWindow addExceptionWindow = new AddExceptionWindow(qualityTaskService, taskId, Models.TaskState.待验收, ReflashTask); addExceptionWindow.ShowDialog(); } @@ -1181,70 +1236,36 @@ namespace BBWY.Client.ViewModels.PackTask private void LoadCompletedSkuData(WareWaitCompleted model) { - if (model.WaitTransportSkus == null || model.WaitTransportSkus.Count <= 0) - { - var skuDatas = WaitCompleteds.SingleOrDefault(w => w.SealBoxId == model.SealBoxId); - WaitCompletedList.SingleOrDefault(w => w.SealBoxId == model.SealBoxId).WaitTransportSkus = skuDatas.WaitTransportSkus; - } - else - { - WaitCompletedList.SingleOrDefault(w => w.SealBoxId == model.SealBoxId).WaitTransportSkus = null; - } + model.IsHideSkuList = !model.IsHideSkuList; + } private void LoadTransportSkuData(WareWaitTransport model) { - if (model.WaitTransportSkus == null || model.WaitTransportSkus.Count <= 0) - { - var skuDatas = WareWaitTransports.SingleOrDefault(w => w.SealBoxId == model.SealBoxId); - WaitTransportList.SingleOrDefault(w => w.SealBoxId == model.SealBoxId).WaitTransportSkus = skuDatas.WaitTransportSkus; - } - else - { - WaitTransportList.SingleOrDefault(w => w.SealBoxId == model.SealBoxId).WaitTransportSkus = null; - } + + model.IsHideSkuList = !model.IsHideSkuList; + + } private void LoadFallWareSkuData(WaitFallWareModel model) { - if (model.SealBoxSkus == null || model.SealBoxSkus.Count <= 0) - { - var skuDatas = WaitFallWareLists.SingleOrDefault(w => w.SealBoxId == model.SealBoxId); - WaitFallWareList.SingleOrDefault(w => w.SealBoxId == model.SealBoxId).SealBoxSkus = skuDatas.SealBoxSkus; - } - else - { - WaitFallWareList.SingleOrDefault(w => w.SealBoxId == model.SealBoxId).SealBoxSkus = null; - } + model.IsHideSkuList = !model.IsHideSkuList; + } private void LoadSealBoxSkuData(SealBoxModel model) { - if (model.SealBoxSkus == null || model.SealBoxSkus.Count <= 0) - { - var skuDatas = SealBoxModelList.SingleOrDefault(w => w.SealBoxId == model.SealBoxId); - WaitSealBoxModels.SingleOrDefault(w => w.SealBoxId == model.SealBoxId).SealBoxSkus = skuDatas.SealBoxSkus; - } - else - { - WaitSealBoxModels.SingleOrDefault(w => w.SealBoxId == model.SealBoxId).SealBoxSkus = null; - } + model.IsHideSkuList = !model.IsHideSkuList; + } private void LoadSkuData(WareNoSealBoxModel model) { + model.IsHideSkuList = !model.IsHideSkuList; - if (model.SealBoxSkus == null || model.SealBoxSkus.Count <= 0) - { - var skuDatas = WaitSealBoxModelList.SingleOrDefault(w => w.ShopId == model.ShopId); - WareNoSealBoxModels.SingleOrDefault(w => w.ShopId == model.ShopId).SealBoxSkus = skuDatas.SealBoxSkus; - } - else - { - WareNoSealBoxModels.SingleOrDefault(w => w.ShopId == model.ShopId).SealBoxSkus = new List(); - } @@ -1476,7 +1497,7 @@ namespace BBWY.Client.ViewModels.PackTask StorePickProductWindow sorePickProductWindow = new StorePickProductWindow(data.Data, (count, UserName) => { - var res = packTaskService.StoreGetBySelfV2(taskId, count, UserName); + var res = packTaskService.StoreGetBySelfV3(taskId, count, UserName); if (res == null) { return false; @@ -1509,7 +1530,7 @@ namespace BBWY.Client.ViewModels.PackTask StorePickProductWindow sorePickProductWindow = new StorePickProductWindow(data.Data, (count, UserName) => { - var res = packTaskService.StoreGetBySelfV2(taskId, count, UserName); + var res = packTaskService.StoreGetBySelfV3(taskId, count, UserName); if (res == null) { return false; @@ -1779,16 +1800,6 @@ namespace BBWY.Client.ViewModels.PackTask public void SetTaskState(TaskState? taskState) { - - if (!(TaskState == Models.TaskState.未到货 && TaskState == Models.TaskState.待验收)) - { - SearchSkuTitle = ""; - SearchSpuTitle = ""; - } - - - - TaskState = taskState; if (PageIndex == 1) SearchTaskList(); @@ -1805,11 +1816,32 @@ namespace BBWY.Client.ViewModels.PackTask QualityTaskService qualityTaskService; + + private string packagingTaskExceptionCount; + /// + /// 验收异常总数 + /// + public string PackagingTaskExceptionCount { get => packagingTaskExceptionCount; set { Set(ref packagingTaskExceptionCount, value); } } + + private string packagingTaskCount; + /// + /// 待包装总数 + /// + public string PackagingTaskCount { get => packagingTaskCount; set { Set(ref packagingTaskCount, value); } } + private string qualityExceptionCount; /// /// 验收异常总数 /// public string QualityExceptionCount { get => qualityExceptionCount; set { Set(ref qualityExceptionCount, value); } } + + private string qualityTaskCount; + /// + /// 验收异常总数 + /// + public string QualityTaskCount { get => qualityTaskCount; set { Set(ref qualityTaskCount, value); } } + + /// /// 搜索任务列表 /// @@ -1820,13 +1852,9 @@ namespace BBWY.Client.ViewModels.PackTask IsLoading = true; PageSize = 10; IsStartThread = false; - long? taskId = null; long? sealBoxId = null; try { - if (SearchTaskId != null && !string.IsNullOrEmpty(SearchTaskId.Trim())) - taskId = Convert.ToInt64(SearchTaskId); - var istrue = long.TryParse(SearchSealBoxId, out long sealboxid); if (istrue) { @@ -1835,759 +1863,904 @@ namespace BBWY.Client.ViewModels.PackTask } catch { - taskId = null; - } Task.Factory.StartNew(() => { - - Stopwatch stopwatch = new Stopwatch(); - stopwatch.Start(); - if (TaskState == Models.TaskState.待出库) + try { - PageSize = 20; - WaitCompletedList = new ObservableCollection(); - var datas = sealBoxService.GetWareWaitCompletedList(null, SearchShopName, taskId, SearchSkuId, sealBoxId, PageIndex, PageSize); - if (datas != null && datas.Data != null && datas.Success) + if (TaskState == Models.TaskState.待出库) { - var dataModel = datas.Data; - OrderCount = dataModel.TotalCount; - WaitCompleteds = dataModel.WareWaitCompleteds; - foreach (var item in dataModel.WareWaitCompleteds) + PageSize = 20; + WaitCompletedList = new ObservableCollection(); + var datas = sealBoxService.GetWareWaitCompletedList(null, SearchShopName, SearchTaskId, SearchSkuId, sealBoxId, PageIndex, PageSize); + if (datas != null && datas.Data != null && datas.Success) { - var skuItem = item.Copy(); - skuItem.WaitTransportSkus = null;//默认不加载 - App.Current.Dispatcher.BeginInvoke(new Action(() => + var dataModel = datas.Data; + OrderCount = dataModel.TotalCount; + WaitCompleteds = dataModel.WareWaitCompleteds; + foreach (var item in dataModel.WareWaitCompleteds) { - WaitCompletedList.Add(skuItem); - })); + var skuItem = item.Copy(); + skuItem.WaitTransportSkus = null;//默认不加载 + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + WaitCompletedList.Add(skuItem); + })); + } + } + else + { + if (datas != null) System.Windows.MessageBox.Show(datas.Msg); } - } - else - { - if (datas != null) System.Windows.MessageBox.Show(datas.Msg); - } - } - else if (TaskState == Models.TaskState.已超时) - { - PageSize = 20; - OverTimeTaskList = new ObservableCollection(); - var datas = packTaskService.SearchOverTimeTaskList(null, StartTime, EndTime, OverTimeTaskState, OverTimeTaskType, PageIndex, PageSize); - if (datas != null && datas.Data != null && datas.Success) + } + else if (TaskState == Models.TaskState.已超时) { - var dataModel = datas.Data; - OrderCount = dataModel.TotalCount; - foreach (var item in dataModel.OverTimeTaskResponses) + PageSize = 20; + OverTimeTaskList = new ObservableCollection(); + var datas = packTaskService.SearchOverTimeTaskList(null, StartTime, EndTime, OverTimeTaskState, OverTimeTaskType, PageIndex, PageSize); + if (datas != null && datas.Data != null && datas.Success) { - App.Current.Dispatcher.BeginInvoke(new Action(() => + var dataModel = datas.Data; + OrderCount = dataModel.TotalCount; + foreach (var item in dataModel.OverTimeTaskResponses) { - OverTimeTaskList.Add(item); - })); + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + OverTimeTaskList.Add(item); + })); + } + } + else + { + if (datas != null) System.Windows.MessageBox.Show(datas.Msg); } - } - else - { - if (datas != null) System.Windows.MessageBox.Show(datas.Msg); - } - - } - else if (TaskState == Models.TaskState.待转运) - { - PageSize = 20; - WaitTransportList = new ObservableCollection(); - var datas = sealBoxService.GetWareWaitTransportList(SelectWareType, PageSize, PageIndex); - if (datas != null && datas.Data != null && datas.Success) + } + else if (TaskState == Models.TaskState.待转运) { - var dataModel = datas.Data; - OrderCount = dataModel.TotalCount; - WareWaitTransports = dataModel.WareWaitTransports; - foreach (var item in dataModel.WareWaitTransports) - { + PageSize = 20; - var skuItem = item.Copy(); - skuItem.WaitTransportSkus = null;//默认不加载 - App.Current.Dispatcher.Invoke(new Action(() => + WaitTransportList = new ObservableCollection(); + var datas = sealBoxService.GetWareWaitTransportList(SelectWareType, PageSize, PageIndex); + if (datas != null && datas.Data != null && datas.Success) + { + var dataModel = datas.Data; + OrderCount = dataModel.TotalCount; + WareWaitTransports = dataModel.WareWaitTransports; + foreach (var item in dataModel.WareWaitTransports) { - WaitTransportList.Add(skuItem); - })); + App.Current.Dispatcher.Invoke(new Action(() => + { + WaitTransportList.Add(item); + })); - } + } - var sealboxTasks = WaitTransportList.Where(p => p.TransportOverTime != null).ToList(); - if (sealboxTasks.Count() > 0 && TaskState == Models.TaskState.待转运) - { + var sealboxTasks = WaitTransportList.Where(p => p.TransportOverTime != null).ToList(); + if (sealboxTasks.Count() > 0 && TaskState == Models.TaskState.待转运) + { - waitTransportOverTimeThread = new Thread(() => - { - IsStartThread = true; - while (IsStartThread) + waitTransportOverTimeThread = new Thread(() => { - App.Current.Dispatcher.BeginInvoke(new Action(() => + IsStartThread = true; + while (IsStartThread) { - foreach (var item in sealboxTasks) + App.Current.Dispatcher.BeginInvoke(new Action(() => { - var datetime = item.TransportOverTime.Value.Subtract(DateTime.Now); - if (datetime.TotalMilliseconds > 0) - { - item.IsWaitTransportOverTime = false; - item.WaitTransportRemainTime = OverTimeHelper.GetTimeString(datetime); - } - else + foreach (var item in sealboxTasks) { - item.IsWaitTransportOverTime = true; - item.WaitTransportRemainTime = OverTimeHelper.GetTimeString(datetime); - } + var datetime = item.TransportOverTime.Value.Subtract(DateTime.Now); + if (datetime.TotalMilliseconds > 0) + { + item.IsWaitTransportOverTime = false; + item.WaitTransportRemainTime = OverTimeHelper.GetTimeString(datetime); + } + else + { + item.IsWaitTransportOverTime = true; + item.WaitTransportRemainTime = OverTimeHelper.GetTimeString(datetime); + } - } - })); - Thread.Sleep(1000); - } + } + })); + Thread.Sleep(1000); + } - }); - //任务倒计时数据 - waitTransportOverTimeThread.IsBackground = true; - waitTransportOverTimeThread.Start(); + }); + //任务倒计时数据 + waitTransportOverTimeThread.IsBackground = true; + waitTransportOverTimeThread.Start(); + } } - } - else - { - if (datas != null) System.Windows.MessageBox.Show(datas.Msg); - } - - - Task.Factory.StartNew(() => - { - IsLoadWaitTransportCount(); - }); - } - else if (TaskState == Models.TaskState.待落仓) - { - PageSize = 20; - - WaitFallWareList = new ObservableCollection(); - var datas = sealBoxService.SearchWareFallWareConfigureList(PositionState, SearchShopName, taskId, SearchSkuId, sealBoxId, PageIndex, PageSize); - if (datas != null && datas.Data != null && datas.Success) - { - var dataModel = datas.Data; - OrderCount = dataModel.TotalCount; - WaitFallWareLists = dataModel.WaitFallWareList; - foreach (var item in dataModel.WaitFallWareList) + else { - App.Current.Dispatcher.Invoke(new Action(() => - { - WaitFallWareList.Add(new WaitFallWareModel - { - AcceptUserNames = string.Join("|", item.AcceptUserNames), - DepartmentName = item.DepartmentName, - SealBoxSkus = null, - ShopId = item.ShopId, - ShopName = item.ShopName, - WareId = item.WareId, - WareName = item.WareName, - SealBoxCount = item.SealBoxCount, - SealBoxId = item.SealBoxId, - BoxConfigureData = item.BoxConfigureData, - ProductCount = item.ProductCount, - WareType = item.WareType, - SetPurchaseOrderOverTime = item.SetPurchaseOrderOverTime - - }); - })); + if (datas != null) System.Windows.MessageBox.Show(datas.Msg); } - } - else - { - if (datas != null) System.Windows.MessageBox.Show(datas.Msg); - } - Task.Factory.StartNew(() => - { - IsLoadFallWareCount(); - }); - } - else if (TaskState == Models.TaskState.待封箱) - { - - PageSize = 20; - if (SealBoxConfigureType == SealBoxConfigureType.已配置) + Task.Factory.StartNew(() => + { + IsLoadWaitTransportCount(); + }); + } + else if (TaskState == Models.TaskState.待落仓) { - WaitSealBoxModels = new ObservableCollection(); + PageSize = 20; - var datas = sealBoxService.GetWareSealBoxList(SearchShopName, taskId, SearchSkuId, sealBoxId, PageIndex, PageSize); + WaitFallWareList = new ObservableCollection(); + var datas = sealBoxService.SearchWareFallWareConfigureList(PositionState, SearchShopName, SearchTaskId, SearchSkuId, sealBoxId, PageIndex, PageSize); if (datas != null && datas.Data != null && datas.Success) { var dataModel = datas.Data; OrderCount = dataModel.TotalCount; - - SealBoxModelList = dataModel.WaitSealBoxModels; - foreach (var item in dataModel.WaitSealBoxModels) + WaitFallWareLists = dataModel.WaitFallWareList; + foreach (var item in dataModel.WaitFallWareList) { - App.Current.Dispatcher.Invoke(new Action(() => { - WaitSealBoxModels.Add(new SealBoxModel + WaitFallWareList.Add(new WaitFallWareModel { - AcceptUserName = string.Join("|", item.AcceptUserNames), + AcceptUserNames = string.Join("|", item.AcceptUserNames), DepartmentName = item.DepartmentName, - SealBoxSkus = null, + SealBoxSkus = item.SealBoxSkus, ShopId = item.ShopId, ShopName = item.ShopName, WareId = item.WareId, WareName = item.WareName, + SealBoxCount = item.SealBoxCount, SealBoxId = item.SealBoxId, - SealBoxPackOverTime = item.SealBoxPackOverTime, - SealBoxPackOverTimeMarkMsg = item.SealBoxPackOverTimeMarkMsg + BoxConfigureData = item.BoxConfigureData, + ProductCount = item.ProductCount, + WareType = item.WareType, + SetPurchaseOrderOverTime = item.SetPurchaseOrderOverTime + }); })); - } + } + else + { + if (datas != null) System.Windows.MessageBox.Show(datas.Msg); + } + + + Task.Factory.StartNew(() => + { + IsLoadFallWareCount(); + }); + } + else if (TaskState == Models.TaskState.待封箱) + { + + PageSize = 20; + if (SealBoxConfigureType == SealBoxConfigureType.已配置) + { + WaitSealBoxModels = new ObservableCollection(); - var sealboxTasks = WaitSealBoxModels.Where(p => p.SealBoxPackOverTime != null).ToList(); - if (sealboxTasks.Count() > 0 && TaskState == Models.TaskState.待封箱) + var datas = sealBoxService.GetWareSealBoxList(SearchShopName, SearchTaskId, SearchSkuId, sealBoxId, PageIndex, PageSize); + if (datas != null && datas.Data != null && datas.Success) { + var dataModel = datas.Data; + OrderCount = dataModel.TotalCount; + SealBoxModelList = dataModel.WaitSealBoxModels; + foreach (var item in dataModel.WaitSealBoxModels) + { + App.Current.Dispatcher.Invoke(new Action(() => + { + WaitSealBoxModels.Add(item); + })); - sealboxOverTimeThread = new Thread(() => + } + + var sealboxTasks = WaitSealBoxModels.Where(p => p.SealBoxPackOverTime != null).ToList(); + if (sealboxTasks.Count() > 0 && TaskState == Models.TaskState.待封箱) { - IsStartThread = true; - while (IsStartThread) + + + sealboxOverTimeThread = new Thread(() => { - App.Current.Dispatcher.BeginInvoke(new Action(() => + IsStartThread = true; + while (IsStartThread) { - foreach (var item in sealboxTasks) + App.Current.Dispatcher.BeginInvoke(new Action(() => { - var datetime = item.SealBoxPackOverTime.Value.Subtract(DateTime.Now); - if (datetime.TotalMilliseconds > 0) + foreach (var item in sealboxTasks) { - item.IsSealBoxOverTime = false; - item.SealBoxRemainTime = OverTimeHelper.GetTimeString(datetime); - } - else - { - item.IsSealBoxOverTime = true; - item.SealBoxRemainTime = OverTimeHelper.GetTimeString(datetime); - } + var datetime = item.SealBoxPackOverTime.Value.Subtract(DateTime.Now); + if (datetime.TotalMilliseconds > 0) + { + item.IsSealBoxOverTime = false; + item.SealBoxRemainTime = OverTimeHelper.GetTimeString(datetime); + } + else + { + item.IsSealBoxOverTime = true; + item.SealBoxRemainTime = OverTimeHelper.GetTimeString(datetime); + } - } - })); - Thread.Sleep(1000); - } + } + })); + Thread.Sleep(1000); + } - }); - //任务倒计时数据 - sealboxOverTimeThread.IsBackground = true; - sealboxOverTimeThread.Start(); + }); + //任务倒计时数据 + sealboxOverTimeThread.IsBackground = true; + sealboxOverTimeThread.Start(); + } + } + else + { + if (datas != null) System.Windows.MessageBox.Show(datas.Msg); } } - else + if (SealBoxConfigureType == SealBoxConfigureType.待配置) { - if (datas != null) System.Windows.MessageBox.Show(datas.Msg); + + WareNoSealBoxModels = new ObservableCollection(); + var datas = sealBoxService.GetWareSealBoxWaitConfigureList(SearchShopName, SearchTaskId, SearchSkuId, PageIndex, PageSize); + if (datas != null && datas.Data != null && datas.Success) + { + var dataModel = datas.Data; + OrderCount = dataModel.TotalCount; + WaitSealBoxModelList = dataModel.WaitSealBoxModels; + + foreach (var item in WaitSealBoxModelList) + { + App.Current.Dispatcher.Invoke(new Action(() => + { + WareNoSealBoxModels.Add(new WareNoSealBoxModel + { + AcceptUserName = string.Join("|", item.AcceptUserNames), + DepartmentName = item.DepartmentName, + SealBoxSkus = item.SealBoxSkus, + ShopId = item.ShopId, + ShopName = item.ShopName, + + }); + })); + } + } + else + { + if (datas != null) System.Windows.MessageBox.Show(datas.Msg); + } } + + Task.Factory.StartNew(() => + { + IsLoadSealBoxCount(); + }); + } - if (SealBoxConfigureType == SealBoxConfigureType.待配置) + else if (TaskState == Models.TaskState.商家自取) { - - WareNoSealBoxModels = new ObservableCollection(); - var datas = sealBoxService.GetWareSealBoxWaitConfigureList(SearchShopName, taskId, SearchSkuId, PageIndex, PageSize); + StoreGetSelfDataList = new ObservableCollection(); + var datas = packTaskService.SearchStoreGetSelfList(SearchTaskId, SearchOrderSn, SearchSpuId, SearchSkuId, SearchDepartment, SearchShopName, PageIndex, PageSize, null); if (datas != null && datas.Data != null && datas.Success) { var dataModel = datas.Data; OrderCount = dataModel.TotalCount; - WaitSealBoxModelList = dataModel.WaitSealBoxModels; - - foreach (var item in WaitSealBoxModelList) + foreach (var item in dataModel.StoreGetSelfResponseList) { App.Current.Dispatcher.Invoke(new Action(() => { - WareNoSealBoxModels.Add(new WareNoSealBoxModel - { - AcceptUserName = string.Join("|", item.AcceptUserNames), - DepartmentName = item.DepartmentName, - SealBoxSkus = new List(), - // SealBoxSkus = item.SealBoxSkus, - ShopId = item.ShopId, - ShopName = item.ShopName, - - }); + StoreGetSelfDataList.Add(item); })); + } + } else { - if (datas != null) System.Windows.MessageBox.Show(datas.Msg); + MessageBox.Show(datas?.Msg); } - } - - Task.Factory.StartNew(() => - { - IsLoadSealBoxCount(); - }); - } - else if (TaskState == Models.TaskState.商家自取) - { - StoreGetSelfDataList = new ObservableCollection(); - var datas = packTaskService.SearchStoreGetSelfList(SearchTaskId, SearchOrderSn, SearchSpuId, SearchSkuId, SearchDepartment, SearchShopName, PageIndex, PageSize, null); - if (datas != null && datas.Data != null && datas.Success) + } + else if (TaskState == Models.TaskState.待验收) { - var dataModel = datas.Data; - OrderCount = dataModel.TotalCount; - foreach (var item in dataModel.StoreGetSelfResponseList) - { - App.Current.Dispatcher.Invoke(new Action(() => - { - StoreGetSelfDataList.Add(item); - })); + PackTaskList = new ObservableCollection();//初始化数据 + var datas = qualityTaskService.SearchQualityTaskList(SearchWayBillNo, SearchExpressName, SearchDepartment, SearchSkuId, SearchTaskId, SearchSpuId, SearchOrderSn, this.QualityTaskExceptionState, SearchShopName, + PageIndex, PageSize, SearchSkuTitle, SearchSpuTitle, SearchPackUserName); - } - } - else - { - MessageBox.Show(datas?.Msg); - } - } - else if (TaskState == Models.TaskState.待验收) - { - PackTaskList = new ObservableCollection();//初始化数据 - var datas = qualityTaskService.SearchQualityTaskList(SearchWayBillNo, SearchExpressName, SearchDepartment, SearchSkuId, SearchTaskId, SearchSpuId, SearchOrderSn, this.QualityTaskExceptionState, SearchShopName, - PageIndex, PageSize, SearchSkuTitle, SearchSpuTitle, SearchPackUserName); - stopwatch.Stop(); - App.Current.Dispatcher.BeginInvoke(new Action(() => - { - Debug.WriteLine($"查询接口耗时:{stopwatch.ElapsedMilliseconds}毫秒"); - })); - stopwatch.Restart(); - if (datas != null && datas.Data != null && datas.Success) - { - var dataModel = datas.Data; - OrderCount = dataModel.TotalCount; - QualityExceptionCount = dataModel.QualityExceptionCount.ToString(); - foreach (var item in dataModel.Items) + if (datas != null && datas.Data != null && datas.Success) { + var dataModel = datas.Data; + OrderCount = dataModel.TotalCount; + QualityExceptionCount = dataModel.QualityExceptionCount.ToString(); + QualityTaskCount = dataModel.QualityTaskCount.ToString(); + foreach (var item in dataModel.Items) + { - var data = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(item)); - data.ItemList = new List() { new SkuMessage + var data = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(item)); + data.ItemList = new List() { new SkuMessage { BrandName = item.BrandName, Logo= item.Logo, SkuName = item.SkuName, SkuId = item.SkuId } }; - data.ExpressOrderList = item.ExpressOrderResponses; - data.EndTime = item.CreateTime; - data.SkuTitle = item.SkuGoodsTitle; - data.AcceptName = item.UserName; - if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0) - { + data.ExpressOrderList = item.ExpressOrderResponses; + data.EndTime = item.CreateTime; + data.SkuTitle = item.SkuGoodsTitle; + data.AcceptName = item.UserName; + if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0) + { + + data.BarCodeModel = item.BarCodeDTO; + if (data.BarCodeModel.LabelModel == BarcodeLabelModel.无型号模板) + data.BarCodeModel.LabelModel = BarcodeLabelModel.精简模板; + + } + if (item.Cers != null) + { + data.CertificateModel = item.Cers; + + } + data.ReflashTask = ReflashTask; + + App.Current.Dispatcher.Invoke(new Action(() => + { + PackTaskList.Add(data); + })); - data.BarCodeModel = item.BarCodeDTO; - if (data.BarCodeModel.LabelModel == BarcodeLabelModel.无型号模板) - data.BarCodeModel.LabelModel = BarcodeLabelModel.精简模板; } - if (item.Cers != null) + + + if (TaskState == Models.TaskState.待验收) { - data.CertificateModel = item.Cers; + if (QualityTaskExceptionState == Models.QualityTaskExceptionState.待验收) + { + qualityOverTimeThread = new Thread(() => + { + var packtasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待验收 && p.QualityCompletionOverTime != null && p.TaskAbortTime == null).ToList(); + if (packtasks.Count() > 0) + { + IsStartThread = true; + while (IsStartThread) + { + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + foreach (var item in packtasks) + { + TimeSpan datetime; + if (item.SendToSetSkuConfigureTime != null) + datetime = item.QualityCompletionOverTime.Value.Subtract(item.SendToSetSkuConfigureTime.Value); + else + datetime = item.QualityCompletionOverTime.Value.Subtract(DateTime.Now); + item.QualityRemainTime = OverTimeHelper.GetTimeString(datetime); + if (datetime.TotalMilliseconds > 0) + { + item.IsQualityOverTime = false; + + } + else + { + item.IsQualityOverTime = true; + } + + } + })); + Thread.Sleep(1000); + } + } + + + + + + + }); + //任务倒计时数据 + qualityOverTimeThread.IsBackground = true; + qualityOverTimeThread.Start(); + //任务状态为待验收 + } + + if (QualityTaskExceptionState == Models.QualityTaskExceptionState.验收异常) + { + var packtasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待验收 && p.TaskAbortTime != null).ToList(); + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + foreach (var item in packtasks) + { + TimeSpan datetime; + datetime = item.QualityCompletionOverTime.Value.Subtract(item.TaskAbortTime.Value); + item.QualityRemainTime = OverTimeHelper.GetTimeString(datetime); + if (datetime.TotalMilliseconds > 0) + { + item.IsQualityOverTime = false; + + } + else + { + item.IsQualityOverTime = true; + } + + } + })); + } } - data.ReflashTask = ReflashTask; - App.Current.Dispatcher.Invoke(new Action(() => + //任务状态为待打包 + + + + Task.Factory.StartNew(() => { - PackTaskList.Add(data); - })); + foreach (var item in PackTaskList) + { + if (!item.OrderId.IsNullOrEmpty() && !item.SkuId.IsNullOrEmpty()) + { + var expressData = packTaskService.GetPurchaseExpressOrderList(item.OrderId, item.SkuId); + if (expressData != null && expressData.Success && expressData.Data != null) + { + + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + expressData.Data.ForEach(e => + { + e.ExpressState = ExpressOrderHelper.GetExpressStateName(e.ExpressState); + }); + item.ExpressOrderList = expressData.Data; + })); + + + + + } + } + } + + + + + }); + } + else + { } + } + else if (TaskState == Models.TaskState.待包装) + { + PackTaskList = new ObservableCollection();//初始化数据 + var datas = packagingTaskService.SearchPackagingTaskList(SearchWayBillNo, SearchExpressName, SearchDepartment, SearchSkuId, SearchTaskId, SearchSpuId, SearchOrderSn, this.PackagingTaskExceptionState, SearchShopName, + PageIndex, PageSize, SearchSkuTitle, SearchSpuTitle, SearchPackUserName); - if (TaskState == Models.TaskState.待验收) + if (datas != null && datas.Data != null && datas.Success) { - if (QualityTaskExceptionState == Models.QualityTaskExceptionState.待验收) + var dataModel = datas.Data; + OrderCount = dataModel.TotalCount; + PackagingTaskCount = dataModel.PackagingTaskCount.ToString(); + PackagingTaskExceptionCount = dataModel.PackagingTaskExceptionCount.ToString(); + foreach (var item in dataModel.Items) { - qualityOverTimeThread = new Thread(() => + + var data = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(item)); + + + data.ItemList = new List() { new SkuMessage + { BrandName = item.BrandName, + Logo= item.Logo, + SkuName = item.SkuName, + SkuId = item.SkuId + } }; + data.EndTime = item.CreateTime; + data.SkuTitle = item.SkuGoodsTitle; + data.AcceptName = item.UserName; + if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0) { - var packtasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待验收 && p.QualityCompletionOverTime != null).ToList(); - if (packtasks.Count() > 0) + + data.BarCodeModel = item.BarCodeDTO; + if (data.BarCodeModel.LabelModel == BarcodeLabelModel.无型号模板) + data.BarCodeModel.LabelModel = BarcodeLabelModel.精简模板; + + } + if (item.Cers != null) + { + data.CertificateModel = item.Cers; + + } + data.ReflashTask = ReflashTask; + + if (item.PackUserName != null) + data.PackUser = string.Join("\r\n", item.PackUserName); + + if (item.PackUserName != null && item.PackUserName.Count() > 0) + { + data.PackUser = string.Join("\r\n", item.PackUserName); + } + + App.Current.Dispatcher.Invoke(new Action(() => + { + PackTaskList.Add(data); + })); + + + } + + if (PackagingTaskExceptionState == Models.PackagingTaskExceptionState.待包装) + { + var packCompletedTasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待包装 && p.PackCompletionOverTime != null && p.TaskAbortTime == null).ToList(); + if (packCompletedTasks.Count() > 0) + { + + packOverTimeThread = new Thread(() => { IsStartThread = true; while (IsStartThread) { App.Current.Dispatcher.BeginInvoke(new Action(() => { - foreach (var item in packtasks) + foreach (var item in packCompletedTasks) { - TimeSpan datetime; - if (item.SendToSetSkuConfigureTime != null) - datetime = item.QualityCompletionOverTime.Value.Subtract(item.SendToSetSkuConfigureTime.Value); - else - datetime = item.QualityCompletionOverTime.Value.Subtract(DateTime.Now); - item.QualityRemainTime = OverTimeHelper.GetTimeString(datetime); + var datetime = item.PackCompletionOverTime.Value.Subtract(DateTime.Now); if (datetime.TotalMilliseconds > 0) { - item.IsQualityOverTime = false; - + item.IsPackOverTime = false; + item.PackRemainTime = OverTimeHelper.GetTimeString(datetime); } else { - item.IsQualityOverTime = true; + item.IsPackOverTime = true; + item.PackRemainTime = OverTimeHelper.GetTimeString(datetime); } } })); Thread.Sleep(1000); } - } + + }); + //任务倒计时数据 + packOverTimeThread.IsBackground = true; + packOverTimeThread.Start(); + } + } - }); - //任务倒计时数据 - qualityOverTimeThread.IsBackground = true; - qualityOverTimeThread.Start(); - //任务状态为待验收 - } - if (QualityTaskExceptionState == Models.QualityTaskExceptionState.验收异常) + if (PackagingTaskExceptionState == Models.PackagingTaskExceptionState.挂起任务) { - var packtasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待验收 && p.TaskAbortTime != null).ToList(); + var packtasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待包装 && p.TaskAbortTime != null).ToList(); App.Current.Dispatcher.BeginInvoke(new Action(() => { foreach (var item in packtasks) { TimeSpan datetime; - datetime = item.QualityCompletionOverTime.Value.Subtract(item.TaskAbortTime.Value); - item.QualityRemainTime = OverTimeHelper.GetTimeString(datetime); + datetime = item.PackCompletionOverTime.Value.Subtract(item.TaskAbortTime.Value); + item.PackRemainTime = OverTimeHelper.GetTimeString(datetime); if (datetime.TotalMilliseconds > 0) { - item.IsQualityOverTime = false; + item.IsPackOverTime = false; } else { - item.IsQualityOverTime = true; + item.IsPackOverTime = true; } } })); } - } - //任务状态为待打包 - Task.Factory.StartNew(() => - { - foreach (var item in PackTaskList) + Task.Factory.StartNew(() => { - if (!item.OrderId.IsNullOrEmpty() && !item.SkuId.IsNullOrEmpty()) + foreach (var item in PackTaskList) { - var expressData = packTaskService.GetPurchaseExpressOrderList(item.OrderId, item.SkuId); - if (expressData != null && expressData.Success && expressData.Data != null) + if (!item.OrderId.IsNullOrEmpty() && !item.SkuId.IsNullOrEmpty()) { - - App.Current.Dispatcher.BeginInvoke(new Action(() => + var expressData = packTaskService.GetPurchaseExpressOrderList(item.OrderId, item.SkuId); + if (expressData != null && expressData.Success && expressData.Data != null) { - expressData.Data.ForEach(e => + + App.Current.Dispatcher.BeginInvoke(new Action(() => { - e.ExpressState = ExpressOrderHelper.GetExpressStateName(e.ExpressState); + expressData.Data.ForEach(e => + { + e.ExpressState = ExpressOrderHelper.GetExpressStateName(e.ExpressState); - }); - item.ExpressOrderList = expressData.Data; - })); + }); + item.ExpressOrderList = expressData.Data; + })); + } } } - } - }); + }); + } + else + { + } + + } else { - } - } - else - { - PackTaskList = new ObservableCollection();//初始化数据 - var datas = packTaskService.SearchTaskList(SearchWayBillNo, SearchExpressName, SearchDepartment, SearchSkuId, SearchTaskId, SearchSpuId, SearchOrderSn, this.TaskState, SearchShopName, - PageIndex, PageSize, SearchSkuTitle, SearchSpuTitle, SearchPackUserName); - stopwatch.Stop(); - App.Current.Dispatcher.BeginInvoke(new Action(() => - { - Debug.WriteLine($"查询接口耗时:{stopwatch.ElapsedMilliseconds}毫秒"); - })); - stopwatch.Restart(); - if (datas != null && datas.Data != null && datas.Success) - { - var dataModel = datas.Data; - OrderCount = dataModel.TotalCount; - foreach (var item in dataModel.Items) + PackTaskList = new ObservableCollection();//初始化数据 + var datas = packTaskService.SearchTaskList(SearchWayBillNo, SearchExpressName, SearchDepartment, SearchSkuId, SearchTaskId, SearchSpuId, SearchOrderSn, this.TaskState, SearchShopName, + PageIndex, PageSize, SearchSkuTitle, SearchSpuTitle, SearchPackUserName); + + if (datas != null && datas.Data != null && datas.Success) { + var dataModel = datas.Data; + OrderCount = dataModel.TotalCount; + foreach (var item in dataModel.Items) + { - var data = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(item)); + var data = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(item)); - data.ItemList = new List() { new SkuMessage + data.ItemList = new List() { new SkuMessage { BrandName = item.BrandName, GoodsNo = item.ProductItemNum, Logo= item.Logo, SkuName = item.SkuName, SkuId = item.SkuId } }; - data.ExpressOrderList = item.ExpressOrderResponses; - data.EndTime = item.CreateTime; - data.SkuTitle = item.SkuGoodsTitle; - data.AcceptName = item.UserName; - if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0) - { + data.ExpressOrderList = item.ExpressOrderResponses; + data.EndTime = item.CreateTime; + data.SkuTitle = item.SkuGoodsTitle; + data.AcceptName = item.UserName; + if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0) + { - data.BarCodeModel = item.BarCodeDTO; - if (data.BarCodeModel.LabelModel == BarcodeLabelModel.无型号模板) - data.BarCodeModel.LabelModel = BarcodeLabelModel.精简模板; + data.BarCodeModel = item.BarCodeDTO; + if (data.BarCodeModel.LabelModel == BarcodeLabelModel.无型号模板) + data.BarCodeModel.LabelModel = BarcodeLabelModel.精简模板; - } - if (item.Cers != null) - { - data.CertificateModel = item.Cers; + } + if (item.Cers != null) + { + data.CertificateModel = item.Cers; - } - data.ReflashTask = ReflashTask; + } + data.ReflashTask = ReflashTask; - if (item.FeesItemResponse != null) - { - data.FeesItemResponse = item.FeesItemResponse; - data.FeesMoney = item.FeesItemResponse.AllFees; + if (item.FeesItemResponse != null) + { + data.FeesItemResponse = item.FeesItemResponse; + data.FeesMoney = item.FeesItemResponse.AllFees; - data.FeesItemResponse.DiscountAllFees = item.FeesItemResponse.AllFees * - item.FeesItemResponse.disCount; - data.IsShowFees = data.FeesMoney > 0 ? true : false; + data.FeesItemResponse.DiscountAllFees = item.FeesItemResponse.AllFees * + item.FeesItemResponse.disCount; + data.IsShowFees = data.FeesMoney > 0 ? true : false; - } - else - { - data.IsShowFees = false; - } + } + else + { + data.IsShowFees = false; + } - if (item.PackUserName != null && item.PackUserName.Count() > 0) - { - data.PackUser = string.Join("\r\n", item.PackUserName); - } + if (item.PackUserName != null && item.PackUserName.Count() > 0) + { + data.PackUser = string.Join("\r\n", item.PackUserName); + } - App.Current.Dispatcher.Invoke(new Action(() => - { - PackTaskList.Add(data); - })); + App.Current.Dispatcher.Invoke(new Action(() => + { + PackTaskList.Add(data); + })); - } - if (TaskState == Models.TaskState.待验收) - { - qualityOverTimeThread = new Thread(() => + } + if (TaskState == Models.TaskState.待验收) { - var packtasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待验收 && p.QualityCompletionOverTime != null).ToList(); - if (packtasks.Count() > 0) + qualityOverTimeThread = new Thread(() => { - IsStartThread = true; - while (IsStartThread) + var packtasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待验收 && p.QualityCompletionOverTime != null).ToList(); + if (packtasks.Count() > 0) { - App.Current.Dispatcher.BeginInvoke(new Action(() => + IsStartThread = true; + while (IsStartThread) { - foreach (var item in packtasks) + App.Current.Dispatcher.BeginInvoke(new Action(() => { - TimeSpan datetime; - if (item.SendToSetSkuConfigureTime != null) - datetime = item.QualityCompletionOverTime.Value.Subtract(item.SendToSetSkuConfigureTime.Value); - else - datetime = item.QualityCompletionOverTime.Value.Subtract(DateTime.Now); - item.QualityRemainTime = OverTimeHelper.GetTimeString(datetime); - if (datetime.TotalMilliseconds > 0) + foreach (var item in packtasks) { - item.IsQualityOverTime = false; + TimeSpan datetime; + if (item.SendToSetSkuConfigureTime != null) + datetime = item.QualityCompletionOverTime.Value.Subtract(item.SendToSetSkuConfigureTime.Value); + else + datetime = item.QualityCompletionOverTime.Value.Subtract(DateTime.Now); + item.QualityRemainTime = OverTimeHelper.GetTimeString(datetime); + if (datetime.TotalMilliseconds > 0) + { + item.IsQualityOverTime = false; - } - else - { - item.IsQualityOverTime = true; - } + } + else + { + item.IsQualityOverTime = true; + } - } - })); - Thread.Sleep(1000); + } + })); + Thread.Sleep(1000); + } } - } - }); - //任务倒计时数据 - qualityOverTimeThread.IsBackground = true; - qualityOverTimeThread.Start(); - //任务状态为待验收 + }); + //任务倒计时数据 + qualityOverTimeThread.IsBackground = true; + qualityOverTimeThread.Start(); + //任务状态为待验收 - } - if (TaskState == Models.TaskState.待包装) - { - var packCompletedTasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待包装 && p.PackCompletionOverTime != null).ToList(); - if (packCompletedTasks.Count() > 0) + } + if (TaskState == Models.TaskState.待包装) { - - packOverTimeThread = new Thread(() => + var packCompletedTasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待包装 && p.PackCompletionOverTime != null).ToList(); + if (packCompletedTasks.Count() > 0) { - IsStartThread = true; - while (IsStartThread) + + packOverTimeThread = new Thread(() => { - App.Current.Dispatcher.BeginInvoke(new Action(() => + IsStartThread = true; + while (IsStartThread) { - foreach (var item in packCompletedTasks) + App.Current.Dispatcher.BeginInvoke(new Action(() => { - var datetime = item.PackCompletionOverTime.Value.Subtract(DateTime.Now); - if (datetime.TotalMilliseconds > 0) - { - item.IsPackOverTime = false; - item.PackRemainTime = OverTimeHelper.GetTimeString(datetime); - } - else + foreach (var item in packCompletedTasks) { - item.IsPackOverTime = true; - item.PackRemainTime = OverTimeHelper.GetTimeString(datetime); - } + var datetime = item.PackCompletionOverTime.Value.Subtract(DateTime.Now); + if (datetime.TotalMilliseconds > 0) + { + item.IsPackOverTime = false; + item.PackRemainTime = OverTimeHelper.GetTimeString(datetime); + } + else + { + item.IsPackOverTime = true; + item.PackRemainTime = OverTimeHelper.GetTimeString(datetime); + } - } - })); - Thread.Sleep(1000); - } + } + })); + Thread.Sleep(1000); + } - }); - //任务倒计时数据 - packOverTimeThread.IsBackground = true; - packOverTimeThread.Start(); + }); + //任务倒计时数据 + packOverTimeThread.IsBackground = true; + packOverTimeThread.Start(); + } } - } - if (TaskState == Models.TaskState.待排单) - { - var packCompletedTasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待排单 && p.ScheduleOverTime != null).ToList(); - if (packCompletedTasks.Count() > 0) + if (TaskState == Models.TaskState.待排单) { - scheduleOverTimeThread = new Thread(() => + var packCompletedTasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待排单 && p.ScheduleOverTime != null).ToList(); + if (packCompletedTasks.Count() > 0) { - IsStartThread = true; - while (IsStartThread) + scheduleOverTimeThread = new Thread(() => { - App.Current.Dispatcher.BeginInvoke(new Action(() => + IsStartThread = true; + while (IsStartThread) { - foreach (var item in packCompletedTasks) + App.Current.Dispatcher.BeginInvoke(new Action(() => { - var datetime = item.ScheduleOverTime.Value.Subtract(DateTime.Now); - if (datetime.TotalMilliseconds > 0) + foreach (var item in packCompletedTasks) { - item.IsScheduleOverTime = false; - item.ScheduleRemainTime = OverTimeHelper.GetTimeString(datetime); - } - else - { - item.IsScheduleOverTime = true; - item.ScheduleRemainTime = OverTimeHelper.GetTimeString(datetime); - } + var datetime = item.ScheduleOverTime.Value.Subtract(DateTime.Now); + if (datetime.TotalMilliseconds > 0) + { + item.IsScheduleOverTime = false; + item.ScheduleRemainTime = OverTimeHelper.GetTimeString(datetime); + } + else + { + item.IsScheduleOverTime = true; + item.ScheduleRemainTime = OverTimeHelper.GetTimeString(datetime); + } - } - })); - Thread.Sleep(1000); - } + } + })); + Thread.Sleep(1000); + } - }); - //任务倒计时数据 - scheduleOverTimeThread.IsBackground = true; - scheduleOverTimeThread.Start(); + }); + //任务倒计时数据 + scheduleOverTimeThread.IsBackground = true; + scheduleOverTimeThread.Start(); + } } - } - //任务状态为待打包 + //任务状态为待打包 - Task.Factory.StartNew(() => - { - foreach (var item in PackTaskList) + Task.Factory.StartNew(() => { - if (!item.OrderId.IsNullOrEmpty() && !item.SkuId.IsNullOrEmpty()) + foreach (var item in PackTaskList) { - var expressData = packTaskService.GetPurchaseExpressOrderList(item.OrderId, item.SkuId); - if (expressData != null && expressData.Success && expressData.Data != null) + if (!item.OrderId.IsNullOrEmpty() && !item.SkuId.IsNullOrEmpty()) { - - App.Current.Dispatcher.BeginInvoke(new Action(() => + var expressData = packTaskService.GetPurchaseExpressOrderList(item.OrderId, item.SkuId); + if (expressData != null && expressData.Success && expressData.Data != null) { - expressData.Data.ForEach(e => + + App.Current.Dispatcher.BeginInvoke(new Action(() => { - e.ExpressState = ExpressOrderHelper.GetExpressStateName(e.ExpressState); + expressData.Data.ForEach(e => + { + e.ExpressState = ExpressOrderHelper.GetExpressStateName(e.ExpressState); - }); - item.ExpressOrderList = expressData.Data; - })); + }); + item.ExpressOrderList = expressData.Data; + })); + } } } - } - }); - } - else - { + }); + } + else + { + } + } + + Task.Factory.StartNew(() => + { + IsLoadCount(); + }); } + catch + { - Task.Factory.StartNew(() => - { - IsLoadCount(); - }); + } - IsLoading = false; - stopwatch.Stop(); - App.Current.Dispatcher.BeginInvoke(new Action(() => - { - Debug.WriteLine($"查询耗时:{stopwatch.ElapsedMilliseconds}毫秒"); - })); + IsLoading = false; }); } diff --git a/BBWY.Client/ViewModels/PackerTask/PackerTaskViewModel.cs b/BBWY.Client/ViewModels/PackerTask/PackerTaskViewModel.cs index fe86fa6a..baf07cd8 100644 --- a/BBWY.Client/ViewModels/PackerTask/PackerTaskViewModel.cs +++ b/BBWY.Client/ViewModels/PackerTask/PackerTaskViewModel.cs @@ -7,6 +7,8 @@ using BBWY.Client.Models.PackUser; using BBWY.Client.Views.BillCorrection; using BBWY.Client.Views.PackerTask; using BBWY.Client.Views.PackTask; +using BBWY.Client.Views.QualityTask; +using BBWY.Client.Views.SplitTask; using BBWY.Client.Views.TaskOverTime; using BBWY.Common.Models; using BBWY.Controls; @@ -219,7 +221,7 @@ namespace BBWY.Client.ViewModels.PackerTask /// /// 查询物流 /// - private string selectExpress= "物流单号"; + private string selectExpress = "物流单号"; public string SelectExpress { get => selectExpress; @@ -328,11 +330,31 @@ namespace BBWY.Client.ViewModels.PackerTask public ObservableCollection PackerTaskModelList { get => packerTaskModelList; set { Set(ref packerTaskModelList, value); } } + private PackagingTaskExceptionState? packagingTaskExceptionState = Models.PackagingTaskExceptionState.待包装; + /// + /// 任务状态 + /// + public PackagingTaskExceptionState? PackagingTaskExceptionState + { + get => packagingTaskExceptionState; set + { + Set(ref packagingTaskExceptionState, value); + } + } + private string packagingTaskExceptionCount; + /// + /// 包装异常总数 + /// + public string PackagingTaskExceptionCount { get => packagingTaskExceptionCount; set { Set(ref packagingTaskExceptionCount, value); } } - + private string packagingTaskCount; + /// + /// 待包装总数 + /// + public string PackagingTaskCount { get => packagingTaskCount; set { Set(ref packagingTaskCount, value); } } @@ -376,11 +398,17 @@ namespace BBWY.Client.ViewModels.PackerTask public ICommand PrintCerCommand { get; set; } + public ICommand SetPackagingTaskExceptionStateCommand { get; set; } + + public ICommand TaskSplitCommand { get; set; } + + public ICommand PackagingTaskExceptionCommand { get; set; } + /// /// 构造函数 /// - public PackerTaskViewModel(PackUserService packUserService, PackTaskService packTaskService, MarkMessageService markMessageService, GlobalContext globalContext) + public PackerTaskViewModel(PackUserService packUserService, PackTaskService packTaskService, MarkMessageService markMessageService, GlobalContext globalContext, QualityTaskService qualityTaskService) { this.packUserService = packUserService; @@ -421,6 +449,31 @@ namespace BBWY.Client.ViewModels.PackerTask PrintBarcodeCommand = new RelayCommand(PrintBarcode); PrintCerCommand = new RelayCommand(PrintCer); + + SetPackagingTaskExceptionStateCommand = new RelayCommand(() => + { + this.SearchTaskList(); + }); + + + TaskSplitCommand = new RelayCommand(TaskSplit); + + PackagingTaskExceptionCommand = new RelayCommand(PackagingTaskException); + this.qualityTaskService = qualityTaskService; + } + QualityTaskService qualityTaskService; + private void PackagingTaskException(long taskId) + { + + AddExceptionWindow addExceptionWindow = new AddExceptionWindow(qualityTaskService, taskId, Models.TaskState.待包装, ReflashTask); + addExceptionWindow.ShowDialog(); + } + + private void TaskSplit(PackerTaskModel model) + { + + SplitTaskWindow addExceptionWindow = new SplitTaskWindow(packTaskService, model.TaskId, model.TaskState.Value, ReflashTask); + addExceptionWindow.ShowDialog(); } private void PrintCer(CertificateModel[] certificateModel) @@ -473,7 +526,7 @@ namespace BBWY.Client.ViewModels.PackerTask { model.ShowMoreMsg = !model.ShowMoreMsg; - + } } @@ -485,8 +538,8 @@ namespace BBWY.Client.ViewModels.PackerTask var model = PackerTaskModelList?.SingleOrDefault(p => p.TaskId == taskId); if (model != null) { - - var res = markMessageService.AppendMarkMessage(taskId, model.TaskMarkMsg,globalContext.User.Name); + + var res = markMessageService.AppendMarkMessage(taskId, model.TaskMarkMsg, globalContext.User.Name); if (res == null) { @@ -505,15 +558,15 @@ namespace BBWY.Client.ViewModels.PackerTask ReflashTask(); } - + } private void PackTaskMarkMessage(long taskId) { - var model = PackerTaskModelList?.SingleOrDefault(p => p.TaskId == taskId); - if (model!=null) + var model = PackerTaskModelList?.SingleOrDefault(p => p.TaskId == taskId); + if (model != null) { model.ShowSendMsg = !model.ShowSendMsg; } @@ -521,7 +574,7 @@ namespace BBWY.Client.ViewModels.PackerTask private void CompletedPackTask(long taskId) { - AddOneItemWeightWindow addOneItemWeightWindow = new AddOneItemWeightWindow(ReflashTask,packUserService,taskId); + AddOneItemWeightWindow addOneItemWeightWindow = new AddOneItemWeightWindow(ReflashTask, packUserService, taskId); addOneItemWeightWindow.ShowDialog(); } @@ -575,7 +628,7 @@ namespace BBWY.Client.ViewModels.PackerTask private Thread packOverTimeThread = null; - bool IsStartThread = false; + bool IsStartThread = false; private void SearchTaskList() { @@ -590,11 +643,15 @@ namespace BBWY.Client.ViewModels.PackerTask { var res = packUserService.SearchPackerTask(PackTaskState: PackTaskState, WayBillNo: SearchWayBillNo, SourceExpressName: SearchExpressName, - departmentName: SearchDepartment, SearchSkuId, SearchTaskId, SearchSpuId, SearchOrderSn, SearchShopName, PageIndex, PageSize, SearchSkuTitle, SearchSpuTitle); + departmentName: SearchDepartment, SearchSkuId, SearchTaskId, SearchSpuId, SearchOrderSn, SearchShopName, PageIndex, PageSize, SearchSkuTitle, SearchSpuTitle, + PackagingTaskExceptionState + ); if (res.Success) { WaitPackCount = res.Data.WaitPackCount; OrderCount = res.Data.TotalCount; + PackagingTaskExceptionCount = res.Data.PackagingTaskExceptionCount; + packagingTaskCount = res.Data.PackagingTaskCount; PackerTaskModelList = new ObservableCollection(); res.Data.Items.ForEach(item => { @@ -602,10 +659,10 @@ namespace BBWY.Client.ViewModels.PackerTask var data = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(item)); - if (PackTaskState== Models.PackTaskState.已完成) + if (PackTaskState == Models.PackTaskState.已完成) { - if (item.PackCompletionOverTime p.TaskState == Models.TaskState.待包装 && p.PackCompletionOverTime != null).ToList(); - if (packCompletedTasks.Count() > 0) - { - packOverTimeThread = new Thread(() => + + + + + + if (PackagingTaskExceptionState == Models.PackagingTaskExceptionState.待包装) + { + var packCompletedTasks = PackerTaskModelList.Where(p => p.TaskState == Models.TaskState.待包装 && p.PackCompletionOverTime != null && p.TaskAbortTime == null).ToList(); + if (packCompletedTasks.Count() > 0) { - IsStartThread = true; - while (IsStartThread) + + packOverTimeThread = new Thread(() => { - App.Current.Dispatcher.BeginInvoke(new Action(() => + IsStartThread = true; + while (IsStartThread) { - foreach (var item in packCompletedTasks) + App.Current.Dispatcher.BeginInvoke(new Action(() => { - var datetime = item.PackCompletionOverTime.Value.Subtract(DateTime.Now); - if (datetime.TotalMilliseconds > 0) - { - item.IsPackOverTime = false; - item.PackRemainTime = OverTimeHelper.GetTimeString(datetime); - } - else + foreach (var item in packCompletedTasks) { - item.IsPackOverTime = true; - item.PackRemainTime = OverTimeHelper.GetTimeString(datetime); + var datetime = item.PackCompletionOverTime.Value.Subtract(DateTime.Now); + if (datetime.TotalMilliseconds > 0) + { + item.IsPackOverTime = false; + item.PackRemainTime = OverTimeHelper.GetTimeString(datetime); + } + else + { + item.IsPackOverTime = true; + item.PackRemainTime = OverTimeHelper.GetTimeString(datetime); + } + } + })); + Thread.Sleep(1000); + } - } - })); - Thread.Sleep(1000); - } + }); + //任务倒计时数据 + packOverTimeThread.IsBackground = true; + packOverTimeThread.Start(); - }); - //任务倒计时数据 - packOverTimeThread.IsBackground = true; - packOverTimeThread.Start(); + } + } + + + + + + if (PackagingTaskExceptionState == Models.PackagingTaskExceptionState.挂起任务) + { + var packtasks = PackerTaskModelList.Where(p => p.TaskState == Models.TaskState.待包装 && p.TaskAbortTime != null).ToList(); + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + foreach (var item in packtasks) + { + TimeSpan datetime; + datetime = item.PackCompletionOverTime.Value.Subtract(item.TaskAbortTime.Value); + item.PackRemainTime = OverTimeHelper.GetTimeString(datetime); + if (datetime.TotalMilliseconds > 0) + { + item.IsPackOverTime = false; + } + else + { + item.IsPackOverTime = true; + } + + } + })); } } } @@ -701,8 +795,8 @@ namespace BBWY.Client.ViewModels.PackerTask var id = (long)paramList[0]; var markMsg = paramList[1]?.ToString(); - var overTimeTaskType = Models.OverTimeTaskType.待打包; - + var overTimeTaskType = Models.OverTimeTaskType.待打包; + SubmitOverTimeMarkMsgWindow submitOverTimeMarkMsgWindow = new SubmitOverTimeMarkMsgWindow(overTimeTaskType, id, markMsg, packTaskService, ReflashTask); submitOverTimeMarkMsgWindow.ShowDialog(); diff --git a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs index 0b6396bf..727e4e89 100644 --- a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs +++ b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs @@ -23,6 +23,7 @@ using BBWY.Controls; using WebSocketSharp; using BBWY.Client.APIServices.QiKu; using BarcodeLib; +using System.Runtime.ConstrainedExecution; namespace BBWY.Client.ViewModels { @@ -369,6 +370,11 @@ namespace BBWY.Client.ViewModels public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } PurchaseService purchaseService; + MarkMessageService markMessageService; + QualityTaskService qualityTaskService; + SaveType? saveType; + + public string OriginShopName { get; set; } @@ -387,14 +393,21 @@ namespace BBWY.Client.ViewModels public ICommand OpenSkuDetailCommand { get; set; } public ICommand CompeteQualityTaskCommand { get; set; } public ICommand SearchSkuCommand { get; set; } + + public ICommand QualityTaskExceptionCommand { get; set; } #endregion - public QualityViewModel(ProductService productService, GlobalContext globalContext, PackPurchaseTaskService packPurchaseTaskService, PurchaseService purchaseService, PackTaskService packTaskService, MarkMessageService markMessageService) + public QualityViewModel(ProductService productService, GlobalContext globalContext, PackPurchaseTaskService packPurchaseTaskService, PurchaseService purchaseService, PackTaskService packTaskService, MarkMessageService markMessageService, QualityTaskService qualityTaskService) { this.packPurchaseTaskService = packPurchaseTaskService; this.productService = productService; this.globalContext = globalContext; + this.purchaseService = purchaseService; + this.packTaskService = packTaskService; + this.markMessageService = markMessageService; + this.qualityTaskService = qualityTaskService; + OpenSkuDetailCommand = new RelayCommand(OpenSkuDetail); SetBarCodeCommand = new RelayCommand(SetBarCode); SetCertificateCommand = new RelayCommand(SetCertificate); @@ -411,13 +424,25 @@ namespace BBWY.Client.ViewModels }); } - this.purchaseService = purchaseService; - this.packTaskService = packTaskService; - this.markMessageService = markMessageService; + QualityTaskExceptionCommand = new RelayCommand(QualityTaskException); } #region 方法 + private void QualityTaskException(object obj) + { + AddExceptionWindow addExceptionWindow = new AddExceptionWindow(qualityTaskService, TaskId, Models.TaskState.待验收, () => { + + var window = obj as BWindow; + App.Current.Dispatcher.Invoke(new Action(() => + { + window.Close(); + })); + ReflashWindow?.Invoke(); + }); + addExceptionWindow.ShowDialog(); + } + private void CompeteQualityTask(object obj) { if (ArrivalQuantity == null) @@ -448,11 +473,6 @@ namespace BBWY.Client.ViewModels MessageBox.Show($"到货数量不能:{ArrivalQuantity}!"); return; } - - - - - var request = new Models.APIModel.Request.QualityTaskRequest { BasicPack = BasicPack, @@ -461,19 +481,15 @@ namespace BBWY.Client.ViewModels Increment1 = string.Join(",", IncreateList.Where(i => i.IsSelected).Select(i => i.IncreateName)), BrandName = BrandName, CertificatePosition = CertificatePosition, - MarkMessage = MarkMessage, OrderId = OrderId, PackType = PackType, GoodsNumber = GoodsNumber, SkuGoodsTitle = SkuTitle, SkuId = SkuId, - IsNeedBar = IsNeedBarCode == Need.需要, - IsNeedCer = IsNeedCertificateModel == Need.需要, TaskId = TaskId, - //FloorDragNumber = FloorDragNumber + BrandMarkType= BrandMarkType }; - if (CreateTime > Convert.ToDateTime("2023-08-21")) { if (IsNeedBarCode == Need.需要) @@ -515,7 +531,7 @@ namespace BBWY.Client.ViewModels try { - var competeRes = packPurchaseTaskService.CompeteQualityTask(request); + var competeRes = qualityTaskService.CompeteQualityTask(request); if (competeRes == null) { MessageBox.Show("网络异常"); @@ -526,23 +542,16 @@ namespace BBWY.Client.ViewModels MessageBox.Show(competeRes.Msg); return; } - BatchPrintWindow batchPrint = new BatchPrintWindow(); - - - //if (BarCodeModel!=null) - //{ - // BarCodeModel.ShopName = OriginShopName; - //} - batchPrint.SetData(GoodProductQuantity.Value, + BatchPrintWindow batchPrint = new BatchPrintWindow(BrandMarkType, IsNeedPrintCer, GoodProductQuantity.Value, PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO != null && p.CerDTO.Id > 0).Select(p => p.CerDTO).ToArray() , BarCodeModel); + batchPrint.ShowDialog(); if (ReflashWindow != null) ReflashWindow(); var window = obj as BWindow; App.Current.Dispatcher.Invoke(new Action(() => { - window.Close(); })); @@ -669,9 +678,6 @@ namespace BBWY.Client.ViewModels look.Show(); } - MarkMessageService markMessageService; - - SaveType? saveType; /// /// 搜索 skuId(todo:) /// @@ -845,12 +851,17 @@ namespace BBWY.Client.ViewModels } BrandMarkType = brandMarkType; + IsNeedPrintCer = cer; }); } + + private Need IsNeedPrintCer; + + public Action ReflashWindow { get; set; } diff --git a/BBWY.Client/ViewModels/SealBox/SealBoxConfigureViewModel.cs b/BBWY.Client/ViewModels/SealBox/SealBoxConfigureViewModel.cs index 07a495ef..ed36a0f3 100644 --- a/BBWY.Client/ViewModels/SealBox/SealBoxConfigureViewModel.cs +++ b/BBWY.Client/ViewModels/SealBox/SealBoxConfigureViewModel.cs @@ -499,6 +499,7 @@ namespace BBWY.Client.ViewModels.SealBox TaskId = model.TaskId, TaskState = model.TaskState, WaitConfigureCount = count, + TaskIdRemark= model.TaskIdRemark, }; data.WareHourseDatas = new ObservableCollection(); switch (waretype) @@ -516,7 +517,8 @@ namespace BBWY.Client.ViewModels.SealBox WareId = item.WareId, WareName = item.WareName, //WareType = s.WareType, - WareState = item.WareState + WareState = item.WareState, + TaskIdRemark = item.TaskIdRemark, }); } break; @@ -532,7 +534,9 @@ namespace BBWY.Client.ViewModels.SealBox WareId = item.WareId, WareName = item.WareName, //WareType = s.WareType, - WareState = item.WareState + WareState = item.WareState, + TaskIdRemark = item.TaskIdRemark, + }); } @@ -549,7 +553,8 @@ namespace BBWY.Client.ViewModels.SealBox WareId = item.WareId, WareName = item.WareName, //WareType = s.WareType, - WareState = item.WareState + WareState = item.WareState, + TaskIdRemark = item.TaskIdRemark, }); } @@ -566,7 +571,8 @@ namespace BBWY.Client.ViewModels.SealBox WareId = item.WareId, WareName = item.WareName, //WareType = s.WareType, - WareState = item.WareState + WareState = item.WareState, + TaskIdRemark = item.TaskIdRemark, }); } diff --git a/BBWY.Client/Views/FallWare/FallWareConfiguredControl.xaml b/BBWY.Client/Views/FallWare/FallWareConfiguredControl.xaml index 44480b66..1f9be40c 100644 --- a/BBWY.Client/Views/FallWare/FallWareConfiguredControl.xaml +++ b/BBWY.Client/Views/FallWare/FallWareConfiguredControl.xaml @@ -199,9 +199,9 @@ Foreground="{StaticResource Text.Link.Color}" FontSize="18" HorizontalAlignment= - diff --git a/BBWY.Client/Views/FallWare/FallWareWaitConfigureControl.xaml b/BBWY.Client/Views/FallWare/FallWareWaitConfigureControl.xaml index 8679d86c..280ad784 100644 --- a/BBWY.Client/Views/FallWare/FallWareWaitConfigureControl.xaml +++ b/BBWY.Client/Views/FallWare/FallWareWaitConfigureControl.xaml @@ -227,9 +227,9 @@ Foreground="{StaticResource Text.Link.Color}" FontSize="18" HorizontalAlignment= - diff --git a/BBWY.Client/Views/FallWare/WaitFallWareControl.xaml b/BBWY.Client/Views/FallWare/WaitFallWareControl.xaml index 4eae0b49..0a20efed 100644 --- a/BBWY.Client/Views/FallWare/WaitFallWareControl.xaml +++ b/BBWY.Client/Views/FallWare/WaitFallWareControl.xaml @@ -124,7 +124,7 @@ CommandParameter="{Binding}" /> - @@ -132,7 +132,7 @@ @@ -217,9 +217,9 @@ - diff --git a/BBWY.Client/Views/FallWare/WareFallWareListControl.xaml b/BBWY.Client/Views/FallWare/WareFallWareListControl.xaml index 7d489710..95a2e6b6 100644 --- a/BBWY.Client/Views/FallWare/WareFallWareListControl.xaml +++ b/BBWY.Client/Views/FallWare/WareFallWareListControl.xaml @@ -87,11 +87,6 @@ - - - - - diff --git a/BBWY.Client/Views/PackTask/PackDetailWindow.xaml b/BBWY.Client/Views/PackTask/PackDetailWindow.xaml index 56529189..62968e2f 100644 --- a/BBWY.Client/Views/PackTask/PackDetailWindow.xaml +++ b/BBWY.Client/Views/PackTask/PackDetailWindow.xaml @@ -529,10 +529,6 @@ - - - - diff --git a/BBWY.Client/Views/PackTask/ShopWaitPackageControl.xaml b/BBWY.Client/Views/PackTask/ShopWaitPackageControl.xaml index 9df4b1f1..96adeeef 100644 --- a/BBWY.Client/Views/PackTask/ShopWaitPackageControl.xaml +++ b/BBWY.Client/Views/PackTask/ShopWaitPackageControl.xaml @@ -108,9 +108,9 @@ - diff --git a/BBWY.Client/Views/QualityTask/ShopWaitQualityControl.xaml b/BBWY.Client/Views/QualityTask/ShopWaitQualityControl.xaml index b9b8d2bd..2ae39357 100644 --- a/BBWY.Client/Views/QualityTask/ShopWaitQualityControl.xaml +++ b/BBWY.Client/Views/QualityTask/ShopWaitQualityControl.xaml @@ -56,7 +56,7 @@ --> - + @@ -105,9 +105,9 @@ - - + @@ -207,9 +207,9 @@ - diff --git a/BBWY.Client/Views/SealBox/SealBoxWaitConfigureControl.xaml b/BBWY.Client/Views/SealBox/SealBoxWaitConfigureControl.xaml index e40ac636..51441acd 100644 --- a/BBWY.Client/Views/SealBox/SealBoxWaitConfigureControl.xaml +++ b/BBWY.Client/Views/SealBox/SealBoxWaitConfigureControl.xaml @@ -151,9 +151,9 @@ - diff --git a/BBWY.Client/Views/SealBox/SetSealBoxPolicyWindow.xaml b/BBWY.Client/Views/SealBox/SetSealBoxPolicyWindow.xaml index 5fce213e..ebd2deab 100644 --- a/BBWY.Client/Views/SealBox/SetSealBoxPolicyWindow.xaml +++ b/BBWY.Client/Views/SealBox/SetSealBoxPolicyWindow.xaml @@ -158,7 +158,7 @@ Foreground="{StaticResource Text.Color}"> - + - + - + - + - @@ -346,9 +346,9 @@ - diff --git a/BBWY.Client/Views/SplitTask/SplitTaskWindow.xaml b/BBWY.Client/Views/SplitTask/SplitTaskWindow.xaml new file mode 100644 index 00000000..556fedb8 --- /dev/null +++ b/BBWY.Client/Views/SplitTask/SplitTaskWindow.xaml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/SplitTask/SplitTaskWindow.xaml.cs b/BBWY.Client/Views/SplitTask/SplitTaskWindow.xaml.cs new file mode 100644 index 00000000..68d32262 --- /dev/null +++ b/BBWY.Client/Views/SplitTask/SplitTaskWindow.xaml.cs @@ -0,0 +1,104 @@ +using BBWY.Client.APIServices; +using BBWY.Client.APIServices.QiKu; +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; +using WebSocketSharp; + +namespace BBWY.Client.Views.SplitTask +{ + /// + /// SplitTaskWindow.xaml 的交互逻辑 + /// + public partial class SplitTaskWindow : BWindow + { + public SplitTaskWindow(PackTaskService packTaskService, long taskId, TaskState abortTaskState, Action splitTask) + { + InitializeComponent(); + + this.TaskId = taskId; + this.DataContext = this; + AbortTaskState = abortTaskState; + this.packTaskService = packTaskService; + TaskId = taskId; + SplitTask = splitTask; + } + + private Action SplitTask { get; set; } + + /// + /// 任务挂起类型 + /// + public TaskState AbortTaskState { get; set; } + + + PackTaskService packTaskService; + + + private long taskId; + /// + /// 任务id + /// + public long TaskId { get => taskId; set { Set(ref taskId, value); } } + + + private TaskExceptionType taskExceptionType; + /// + /// 验收异常类型 + /// + public TaskExceptionType TaskExceptionType { get => taskExceptionType; set { Set(ref taskExceptionType, value); } } + + + private int exceptionCount; + /// + /// 验收异常类型 + /// + public int ExceptionCount { get => exceptionCount; set { Set(ref exceptionCount, value); } } + + + private List taskExceptionTypeList = new List { + TaskExceptionType.配件未到齐, TaskExceptionType.数量不对 + }; + /// + /// 验收异常类型 + /// + public List TaskExceptionTypeList { get => taskExceptionTypeList; set { Set(ref taskExceptionTypeList, value); } } + + + private string remarkMsg; + /// + /// 备注消息 + /// + public string RemarkMsg { get => remarkMsg; set { Set(ref remarkMsg, value); } } + + private void BButton_Click(object sender, RoutedEventArgs e) + { + + if (RemarkMsg.IsNullOrEmpty()) + { + MessageBox.Show("请输入具体问题描述."); + return; + } + + var res = packTaskService.SplitPackTask(TaskId, ExceptionCount, TaskExceptionType, RemarkMsg, AbortTaskState); + if (res == null || !res.Success) + { + MessageBox.Show(res?.Msg); + return; + } + SplitTask?.Invoke(); + this.Close(); + } + + } +} diff --git a/BBWY.Client/Views/WaitTransport/TeamWaitTransportControl.xaml b/BBWY.Client/Views/WaitTransport/TeamWaitTransportControl.xaml index b058f4ac..f3319946 100644 --- a/BBWY.Client/Views/WaitTransport/TeamWaitTransportControl.xaml +++ b/BBWY.Client/Views/WaitTransport/TeamWaitTransportControl.xaml @@ -247,9 +247,9 @@ Foreground="{StaticResource Text.Link.Color}" FontSize="18" - @@ -177,7 +177,7 @@