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] 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(); + } + } +}