From 6d92ff4f832bc1a71a69dded56abadff41522746 Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Tue, 18 Jul 2023 17:31:52 +0800 Subject: [PATCH] 1 --- .../APIServices/QiKu/ConsumableService.cs | 17 + .../APIServices/QiKu/PackDetailService.cs | 27 +- .../APIServices/QiKu/ProcessService.cs | 36 + BBWY.Client/App.xaml.cs | 2 +- .../APIModel/Request/ConsumableRequest.cs | 2 +- .../APIModel/Request/SetPackDetailRequest.cs | 115 +++ .../PackTask/GetConsumableTypeResponse.cs | 13 + .../PackTask/GetPackDetailResponse.cs | 42 + .../Process/DiscountFactoryResponse.cs | 21 + .../Process/GetProcessTypeResponse.cs | 63 ++ .../Models/PackTask/ConsumableModel.cs | 41 +- BBWY.Client/Models/PackTask/PackItemModel.cs | 118 +++ BBWY.Client/Models/PackTask/PackTaskModel.cs | 4 +- BBWY.Client/Models/PackTask/PackUser.cs | 47 +- .../Models/PackTask/ProcessComboModel.cs | 19 + .../PackTask/EditConsumableViewModel.cs | 11 + .../PackTask/PackDetailViewModel.cs | 963 ++++++++++++++++++ BBWY.Client/ViewModels/ViewModelLocator.cs | 8 + .../Views/PackTask/EditConsumable.xaml | 10 +- .../Views/PackTask/EditConsumable.xaml.cs | 2 +- .../PackTask/MinFeesExcelControl.xaml.cs | 5 +- .../Views/PackTask/PackDetailWindow.xaml | 709 +++++++++++++ .../Views/PackTask/PackDetailWindow.xaml.cs | 102 ++ 23 files changed, 2357 insertions(+), 20 deletions(-) create mode 100644 BBWY.Client/APIServices/QiKu/ProcessService.cs create mode 100644 BBWY.Client/Models/APIModel/Request/SetPackDetailRequest.cs create mode 100644 BBWY.Client/Models/APIModel/Response/PackTask/GetConsumableTypeResponse.cs create mode 100644 BBWY.Client/Models/APIModel/Response/PackTask/GetPackDetailResponse.cs create mode 100644 BBWY.Client/Models/APIModel/Response/Process/DiscountFactoryResponse.cs create mode 100644 BBWY.Client/Models/APIModel/Response/Process/GetProcessTypeResponse.cs create mode 100644 BBWY.Client/Models/PackTask/ProcessComboModel.cs create mode 100644 BBWY.Client/ViewModels/PackTask/EditConsumableViewModel.cs create mode 100644 BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs create mode 100644 BBWY.Client/Views/PackTask/PackDetailWindow.xaml create mode 100644 BBWY.Client/Views/PackTask/PackDetailWindow.xaml.cs diff --git a/BBWY.Client/APIServices/QiKu/ConsumableService.cs b/BBWY.Client/APIServices/QiKu/ConsumableService.cs index 56f56e3b..eb10a179 100644 --- a/BBWY.Client/APIServices/QiKu/ConsumableService.cs +++ b/BBWY.Client/APIServices/QiKu/ConsumableService.cs @@ -6,6 +6,7 @@ using BBWY.Common.Http; using BBWY.Common.Models; using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Net.Http; using System.Text; @@ -55,5 +56,21 @@ namespace BBWY.Client.APIServices , null, HttpMethod.Post); } + + + + public ApiResponse AddConsumableType(string ConsumableTypeName) + { + return SendRequest(globalContext.QKApiHost, "api/Consumable/AddConsumableType", + new { ConsumableTypeName } + , null, HttpMethod.Post); + } + + public ApiResponse> GetConsumableTypeList() + { + return SendRequest>(globalContext.QKApiHost, "api/Consumable/GetConsumableTypeList", + null + , null, HttpMethod.Get); + } } } diff --git a/BBWY.Client/APIServices/QiKu/PackDetailService.cs b/BBWY.Client/APIServices/QiKu/PackDetailService.cs index 91a25318..3fb6ce2f 100644 --- a/BBWY.Client/APIServices/QiKu/PackDetailService.cs +++ b/BBWY.Client/APIServices/QiKu/PackDetailService.cs @@ -1,4 +1,5 @@ -using BBWY.Client.Models.APIModel.Response.PackTask; +using BBWY.Client.Models; +using BBWY.Client.Models.APIModel.Response.PackTask; using BBWY.Common.Http; using BBWY.Common.Models; using System; @@ -28,5 +29,29 @@ namespace BBWY.Client.APIServices , null, HttpMethod.Post); } + + /// + /// 设置打包费用 + /// + /// + /// + public ApiResponse SetPackDetail(SetPackDetailRequest consumable) + { + return SendRequest(globalContext.QKApiHost, "api/PackDetail/SetPackDetail", + consumable + , null, HttpMethod.Post); + } + /// + /// 获取打包费用明细 + /// + /// + /// + public ApiResponse GetPackDetail(long taskId) + { + return SendRequest(globalContext.QKApiHost, $"api/PackDetail/GetPackDetail?taskId={taskId}", + null + , null, HttpMethod.Get); + } + } } diff --git a/BBWY.Client/APIServices/QiKu/ProcessService.cs b/BBWY.Client/APIServices/QiKu/ProcessService.cs new file mode 100644 index 00000000..e4cc0137 --- /dev/null +++ b/BBWY.Client/APIServices/QiKu/ProcessService.cs @@ -0,0 +1,36 @@ +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 ProcessService : BaseApiService, IDenpendency + { + public ProcessService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) + { + } + + public ApiResponse GetProcessTypeList() + { + return SendRequest(globalContext.QKApiHost, "api/Process/GetProcessTypeList", + null + , null, HttpMethod.Get); + } + + + public ApiResponse GetDiscountFactory(string ProcessTypeName, int TaskCount) + { + return SendRequest(globalContext.QKApiHost, "api/Process/GetDiscountFactory", + new + { + ProcessTypeName, + TaskCount + } + , null, HttpMethod.Post); + } + } +} diff --git a/BBWY.Client/App.xaml.cs b/BBWY.Client/App.xaml.cs index bc71d1f5..a719e121 100644 --- a/BBWY.Client/App.xaml.cs +++ b/BBWY.Client/App.xaml.cs @@ -127,7 +127,7 @@ namespace BBWY.Client serviceCollection.AddTransient(); serviceCollection.AddTransient(); serviceCollection.AddTransient(); - + serviceCollection.AddTransient(); serviceCollection.AddTransient(); #region 注册拳探SDK相关类 serviceCollection.AddSingleton(); diff --git a/BBWY.Client/Models/APIModel/Request/ConsumableRequest.cs b/BBWY.Client/Models/APIModel/Request/ConsumableRequest.cs index 5693a793..67307e0c 100644 --- a/BBWY.Client/Models/APIModel/Request/ConsumableRequest.cs +++ b/BBWY.Client/Models/APIModel/Request/ConsumableRequest.cs @@ -67,6 +67,6 @@ namespace BBWY.Client.Models.APIModel.Request /// /// 耗材归属 /// - public ConsumableType? ConsumableType { get; set; } + public long ConsumableTypeId { get; set; } } } diff --git a/BBWY.Client/Models/APIModel/Request/SetPackDetailRequest.cs b/BBWY.Client/Models/APIModel/Request/SetPackDetailRequest.cs new file mode 100644 index 00000000..cce72b10 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Request/SetPackDetailRequest.cs @@ -0,0 +1,115 @@ +using BBWY.Client.Models.APIModel.Request; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models +{ + public class SetPackDetailRequest + { + /// + /// 任务Id + /// + public long TaskId { get; set; } + + #region 工序收费 + /// + /// 套餐id + /// + public long ProcessComboId { get; set; } + + /// + /// 套餐任务量 + /// + public long ProcessComboCount { get; set; } + + /// + /// 折扣系数 + /// + public decimal DiscountFactory { get; set; } + /// + /// 打包原价 + /// + public decimal PackPrice { get; set; } + /// + /// 打包折扣价 + /// + public decimal PackDiscountPrice { get; set; } + /// + /// 定向单价 + /// + public decimal? DirectionalSingleFees { get; set; } + /// + /// 计费模式 + /// + public FeesMode FeesMode { get; set; } + #endregion + + + /// + /// 打包人员列表 + /// + public List PackUserList { get; set; } + + /// + /// 耗材列表 + /// + public List ConsumableList { get; set; } + + /// + /// 耗材费用(总) + /// + public decimal ConsumableFees { get; set; } + + /// + /// 任务总费用 + /// + public decimal AllFees { get; set; } + public string ProcessTypeName { get; set; } + } + public class ConsumableRequest + { + /// + /// 耗材id + /// + public long ConsumableId { get; set; } + /// + /// 任务量 + /// + public int TaskCount { get; set; } + /// + /// 耗材价格 + /// + public decimal ConsumablePrice { get; set; } + + /// + /// 耗材类型 + /// + public string ConsumableTypeName { get; set; } + } + public class PackUserModelRequest + { + /// + /// 打包人 + /// + public string UserId { get; set; } + + /// + /// 打包任务量 + /// + public int TaskCount { get; set; } + } + + public class TaskConsumableRequest + { + + /// + /// 耗材id + /// + public long ConsumableId { get; set; } + /// + /// 耗材任务量 + /// + public int TaskCount { get; set; } + } +} diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/GetConsumableTypeResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/GetConsumableTypeResponse.cs new file mode 100644 index 00000000..fb8a75ba --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/PackTask/GetConsumableTypeResponse.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel.Response.PackTask +{ + public class GetConsumableTypeResponse:NotifyObject + { + public string ConsumableTypeName { get; set; } + + public long ConsumableTypeId { get; set; } + } +} diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/GetPackDetailResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/GetPackDetailResponse.cs new file mode 100644 index 00000000..18eb2658 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/PackTask/GetPackDetailResponse.cs @@ -0,0 +1,42 @@ +using BBWY.Client.Models.APIModel.Request; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models +{ + public class GetPackDetailResponse + { + public string ProcessTypeName { get; set; } + + public string ProcessComboName { get; set; } + + public long ProcessComboId { get; set; } + + public int ProcessTaskCount { get; set; } + + public decimal? DirectionalSingleFees { get; set; } + + public List PackUserList { get; set; } + + public List ConsumableList { get; set; } + + public decimal? ConsumableFees { get; set; } + public FeesMode? FeesMode { get; set; } + public decimal? DiscountFactor { get; set; } + public string SuggestPackUserName { get; set; } + } + + public class PackUserResponse : PackUserModelRequest + { + + } + + + + public class TaskConsumableResponse : ConsumableRequest + { + + + } +} diff --git a/BBWY.Client/Models/APIModel/Response/Process/DiscountFactoryResponse.cs b/BBWY.Client/Models/APIModel/Response/Process/DiscountFactoryResponse.cs new file mode 100644 index 00000000..6db29206 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/Process/DiscountFactoryResponse.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models +{ + public class DiscountFactoryResponse + { + /// + /// 折扣系数 + /// + public decimal DiscountFactory { get; set; } + + /// + /// 计费类型 + /// + public Models.FeesMode FeesMode { get; set; } + + + } +} diff --git a/BBWY.Client/Models/APIModel/Response/Process/GetProcessTypeResponse.cs b/BBWY.Client/Models/APIModel/Response/Process/GetProcessTypeResponse.cs new file mode 100644 index 00000000..44caa3d4 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/Process/GetProcessTypeResponse.cs @@ -0,0 +1,63 @@ +using BBWY.Client.Models.PackTask; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; + +namespace BBWY.Client.Models +{ + public class GetProcessTypeResponse + { + public List ProcessTypeList { get; set; } + /// + /// 所有的耗材类型 + /// + public List ConsumableTypeList { get; set; } + } + + + public class ProcessTypeResponse + { + /// + /// 工序单价 + /// + public decimal ProcessTypePrice { get; set; } + /// + /// 工序类型 + /// + public string ProcessTypeName { get; set; } + /// + /// 套餐列表 + /// + public ObservableCollection ProcessComboList { get; set; } + } + + public class ProcessComboResponse + { + /// + /// 套餐id + /// + public long ProcessComboId { get; set; } + /// + /// 套餐名称 + /// + public string ProcessComboName { get; set; } + /// + /// 绑定的耗材类型 + /// + public ObservableCollection ConsumableTypeList { get; set; } + } + + public class ConsumableTypeResponse + { + /// + /// 耗材类型名称 + /// + public string ConsumableTypeName { get; set; } + + /// + /// 耗材列表 + /// + public ObservableCollection ConsumableList { get; set; } + } +} diff --git a/BBWY.Client/Models/PackTask/ConsumableModel.cs b/BBWY.Client/Models/PackTask/ConsumableModel.cs index 6a7b4977..576cf638 100644 --- a/BBWY.Client/Models/PackTask/ConsumableModel.cs +++ b/BBWY.Client/Models/PackTask/ConsumableModel.cs @@ -1,5 +1,6 @@ using BBWY.Client.APIServices; using BBWY.Client.Models.APIModel.Request; +using BBWY.Client.Models.APIModel.Response.PackTask; using BBWY.Client.ViewModels; using BBWY.Client.Views.PackTask; using BBWY.Common.Models; @@ -9,6 +10,7 @@ using NPOI.Util; using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Linq; using System.Resources; using System.Text; using System.Windows; @@ -19,11 +21,11 @@ namespace BBWY.Client.Models.PackTask { public class ConsumableModel : BaseVM, IDenpendency { - public ObservableCollection consumableTypeList = new ObservableCollection() + public ObservableCollection consumableTypeList = new ObservableCollection() { - "箱子", "气泡纸", "胶带", "其他" + }; - public ObservableCollection ConsumableTypeList { get => consumableTypeList; set { Set(ref consumableTypeList, value); } } + public ObservableCollection ConsumableTypeList { get => consumableTypeList; set { Set(ref consumableTypeList, value); } } private ConsumableType? consumableType; public ConsumableType? ConsumableType @@ -44,9 +46,18 @@ namespace BBWY.Client.Models.PackTask DeletedConsumableCommand = new RelayCommand>(DeletedConsumable); SaveConsumableCommand = new RelayCommand(SaveConsumable); + if (consumableService!=null) + { + GetConsumableTypeList(); + } } + private long consumableTypeId; + public long ConsumableTypeId + { get => consumableTypeId; set { Set(ref consumableTypeId, value); } } + + public void SaveConsumable(object obj) { if (string.IsNullOrEmpty(Name)) @@ -73,7 +84,7 @@ namespace BBWY.Client.Models.PackTask Remark = Remark, Weigth = Weigth, Width = Width, - ConsumableType= ConsumableType, + ConsumableTypeId = ConsumableTypeId, }); } @@ -89,7 +100,7 @@ namespace BBWY.Client.Models.PackTask Remark = Remark, Weigth = Weigth, Width = Width, - ConsumableType = ConsumableType, + ConsumableTypeId = ConsumableTypeId, }); } @@ -106,8 +117,8 @@ namespace BBWY.Client.Models.PackTask } else { - if(res!=null) - new TipsWindow(res.Msg).Show(); + if (res != null) + new TipsWindow(res.Msg).Show(); } } @@ -130,8 +141,20 @@ namespace BBWY.Client.Models.PackTask + void GetConsumableTypeList() + { + var res = consumableService.GetConsumableTypeList(); + if (res.Success && res.Data != null) + { + ConsumableTypeList = res.Data; + + } + } + + public void EditConsumable() { + GetConsumableTypeList(); EditConsumable add = new EditConsumable(new ConsumableModel(consumableService) { Heigth = this.Heigth, @@ -143,10 +166,12 @@ namespace BBWY.Client.Models.PackTask Width = this.Width, Price = this.Price, ConsumableType = this.ConsumableType, + ConsumableTypeList = this.ConsumableTypeList }); - add.Show(); + add.ShowDialog(); + } private long id; diff --git a/BBWY.Client/Models/PackTask/PackItemModel.cs b/BBWY.Client/Models/PackTask/PackItemModel.cs index 3ff03ec1..4bbdce2c 100644 --- a/BBWY.Client/Models/PackTask/PackItemModel.cs +++ b/BBWY.Client/Models/PackTask/PackItemModel.cs @@ -7,7 +7,9 @@ using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows; using System.Windows.Input; +using WebSocketSharp; namespace BBWY.Client.Models.PackTask { @@ -80,5 +82,121 @@ namespace BBWY.Client.Models.PackTask ObservableCollection list = obj as ObservableCollection; list.Remove(this); } + + + + + + + /// + /// 耗材类型 + /// + private ObservableCollection consumableTypeList; + public ObservableCollection ConsumableTypeList { get => consumableTypeList; set { Set(ref consumableTypeList, value); } } + + + + /// + /// 所有的耗材类型 + /// + public List AllConsumableTypeList { get; set; } + + private string consumableType; + /// + /// 耗材类型 + /// + public string ConsumableType + { + get => consumableType; set + { + Set(ref consumableType, value); + + OnConsumableTypeChanged(ConsumableType); + } + } + void OnConsumableTypeChanged(string ConsumableType) + { + if (AllConsumableTypeList == null || AllConsumableTypeList.Count <= 0 || ConsumableType .IsNullOrEmpty()) + { + return;//ConsumableList + } + + ConsumableItemList = AllConsumableTypeList.SingleOrDefault(a => a.ConsumableTypeName == ConsumableType)?.ConsumableList; + + + + } + + + private string consumableItem; + /// + /// 耗材型号 + /// + public string ConsumableItem + { + get => consumableItem; set + { + Set(ref consumableItem, value); + OnConsumableItemChanged(ConsumableItem); + + + } + } + + /// + /// 统计耗材收费 + /// + public Action TotalConsumableFees { get; set; } + + void OnConsumableItemChanged(string consumableItem) + { + if (ConsumableItemList == null || ConsumableItemList.Count <= 0 || consumableItem == null) + { + return; + } + ConsumablePrice = ConsumableItemList.SingleOrDefault(c => c.ConsumableName == consumableItem).ConsumablePrice; + if (TotalConsumableFees != null) TotalConsumableFees(); + + } + /// + /// 耗材型号 + /// + private ObservableCollection consumableItemList; + public ObservableCollection ConsumableItemList { get => consumableItemList; set { Set(ref consumableItemList, value); } } + + private decimal consumablePrice; + /// + /// 耗材单价 + /// + public decimal ConsumablePrice { get => consumablePrice; set { Set(ref consumablePrice, value); } } + + + private int taskCount; + /// + /// 耗材任务数 + /// + public int TaskCount { get => taskCount; set { Set(ref taskCount, value); OnConsumableItemChanged(ConsumableItem); } } + + + + } + + + public class ConsumableItemModel : NotifyObject + { + + + /// + /// 耗材id + /// + public long ConsumableId { get; set; } + /// + /// 耗材名称 + /// + public string ConsumableName { get; set; } + /// + /// 耗材价格 + /// + public decimal ConsumablePrice { get; set; } } } diff --git a/BBWY.Client/Models/PackTask/PackTaskModel.cs b/BBWY.Client/Models/PackTask/PackTaskModel.cs index 0ab16b04..cc0b685d 100644 --- a/BBWY.Client/Models/PackTask/PackTaskModel.cs +++ b/BBWY.Client/Models/PackTask/PackTaskModel.cs @@ -85,9 +85,9 @@ namespace BBWY.Client.Models private void SetService() { - - ServiceWindow service = new ServiceWindow(this, ReflashTask); + + PackDetailWindow service = new PackDetailWindow(this, ReflashTask); service.Show(); } diff --git a/BBWY.Client/Models/PackTask/PackUser.cs b/BBWY.Client/Models/PackTask/PackUser.cs index 850e0662..606df1e3 100644 --- a/BBWY.Client/Models/PackTask/PackUser.cs +++ b/BBWY.Client/Models/PackTask/PackUser.cs @@ -1,6 +1,10 @@ -using System; +using BBWY.Client.Models.APIModel.Response.PackTask; +using GalaSoft.MvvmLight.Command; +using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Text; +using System.Windows.Input; namespace BBWY.Client.Models.PackTask { @@ -24,4 +28,45 @@ namespace BBWY.Client.Models.PackTask /// public string UserNick { get; set; } } + + + public class PackUserModel:NotifyObject + { + + private string selectUserId; + /// + /// Member.userId + /// + public string SelectUserId { get => selectUserId; set { Set(ref selectUserId, value); } } + + private string memberName; + public string MemberName { get => memberName; set { Set(ref memberName, value); } } + + private int taskCount; + /// + /// 任务量 + /// + public int TaskCount { get => taskCount; set { Set(ref taskCount, value); } } + + private ObservableCollection memberList; + public ObservableCollection MemberList + { + get => memberList; set + { + Set(ref memberList, value); + } + } + public ICommand DeleteServiceCommand { get; set; } + + public PackUserModel() + { + DeleteServiceCommand = new RelayCommand(DeleteService); + } + + private void DeleteService(object obj) + { + ObservableCollection list = obj as ObservableCollection; + list.Remove(this); + } + } } diff --git a/BBWY.Client/Models/PackTask/ProcessComboModel.cs b/BBWY.Client/Models/PackTask/ProcessComboModel.cs new file mode 100644 index 00000000..089e8528 --- /dev/null +++ b/BBWY.Client/Models/PackTask/ProcessComboModel.cs @@ -0,0 +1,19 @@ +using BBWY.Client.Models; +using GalaSoft.MvvmLight.Command; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; +using System.Windows.Input; + +namespace BBWY.Client +{ + + public class ProcessComboModel : NotifyObject + { + + public long ProcessComboId { get; set; } + + public string ProcessComboName { get; set; } + } +} diff --git a/BBWY.Client/ViewModels/PackTask/EditConsumableViewModel.cs b/BBWY.Client/ViewModels/PackTask/EditConsumableViewModel.cs new file mode 100644 index 00000000..be3db589 --- /dev/null +++ b/BBWY.Client/ViewModels/PackTask/EditConsumableViewModel.cs @@ -0,0 +1,11 @@ +using BBWY.Common.Models; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.ViewModels.PackTask +{ + public class EditConsumableViewModel:BaseVM,IDenpendency + { + } +} diff --git a/BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs b/BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs new file mode 100644 index 00000000..e37aa440 --- /dev/null +++ b/BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs @@ -0,0 +1,963 @@ +using BBWY.Client.APIServices.QiKu; +using BBWY.Client.APIServices; +using BBWY.Client.Helpers; +using BBWY.Client.Models.APIModel.Response.PackTask; +using BBWY.Client.Models.PackTask; +using BBWY.Client.Models; +using BBWY.Client.Views.PackTask; +using GalaSoft.MvvmLight.Command; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Drawing.Printing; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Media.Imaging; +using WebSocketSharp; +using System.IO; +using BBWY.Client.Models.APIModel; +using Org.BouncyCastle.Bcpg; +using System.Threading; + +namespace BBWY.Client.ViewModels.PackTask +{ + public class PackDetailViewModel : BaseVM + { + + + private decimal allFees; + /// + /// 任务总费用 + /// + public decimal AllFees { get => allFees; set { Set(ref allFees, value); } } + + + private decimal processPrice; + /// + /// 工序单价 + /// + public decimal ProcessPrice { get => processPrice; set { Set(ref processPrice, value); } } + + private decimal consumableFees; + /// + /// 耗材费用 + /// + public decimal ConsumableFees { get => consumableFees; set { Set(ref consumableFees, value); } } + + public ObservableCollection packUserModelList; + public ObservableCollection PackUserModelList { get => packUserModelList; set { Set(ref packUserModelList, value); } } + + + + // private decimal? customProcessSinglePrice; + /// + /// 定制工序单价 + /// + public decimal? CustomProcessSinglePrice + { + get; set; + } + + private string directionalSingleFees; + + public string DirectionalSingleFees + { + get => directionalSingleFees; set + { + + Set(ref directionalSingleFees, value); + try + { + CustomProcessSinglePrice = decimal.Parse(DirectionalSingleFees); + } + catch + { + CustomProcessSinglePrice = null; + + + } + + } + } + + + + private decimal packFees; + /// + /// 打包原价 + /// + public decimal PackFees { get => packFees; set { Set(ref packFees, value); } } + + private decimal discountFactory; + /// + /// 折扣系数 + /// + public decimal DiscountFactory { get => discountFactory; set { Set(ref discountFactory, value); } } + + private decimal packDiscountFees; + /// + /// 打包折后价价 + /// + public decimal PackDiscountFees { get => packDiscountFees; set { Set(ref packDiscountFees, value); } } + + + + private int processTaskCount; + /// + /// 工序任务量 + /// + public int ProcessTaskCount + { + get => processTaskCount; set + { + Set(ref processTaskCount, value); + OnProcessTypeChanged(SelectProcessType, 1); + } + } + + void OnProcessTaskCountChanged() + { + PackFees = decimal.Parse((ProcessTaskCount * ProcessPrice).ToString("0.00")); ; + PackDiscountFees = decimal.Parse((PackFees * DiscountFactory).ToString("0.00")); + } + + + private List processComboList; + /// + /// 套餐类型列表 + /// + public List ProcessComboList { get => processComboList; set { Set(ref processComboList, value); } } + + + + private long selectProcessComboId; + /// + /// 选中套餐类型 + /// + public long SelectProcessComboId + { + get => selectProcessComboId; set + { + Set(ref selectProcessComboId, value); + + OnProcessComboChanged(SelectProcessComboId); + } + } + public bool isConsumableTypeListEnable; + public bool IsConsumableTypeListEnable { get => isConsumableTypeListEnable; set { Set(ref isConsumableTypeListEnable, value); } } + private void OnProcessComboChanged(long SelectProcessComboId) + { + if (SelectProcessComboId <= 0) + { + return; + } + + var selectProcessComboData = ProcessTypeResponseList.SingleOrDefault(p => p.ProcessTypeName == SelectProcessType).ProcessComboList. + SingleOrDefault(p => p.ProcessComboId == SelectProcessComboId); + App.Current.Dispatcher.Invoke(new Action(() => + { + ConsumableServiceList.Clear(); + })); + IsConsumableTypeListEnable = false; + if (SelectProcessType == "定制") + { + IsConsumableTypeListEnable = true; + + ConsumableServiceList = new ObservableCollection(); + + + } + ConsumableFees = 0; + AllFees = ConsumableFees + PackDiscountFees; + if (selectProcessComboData != null && selectProcessComboData.ConsumableTypeList != null && selectProcessComboData.ConsumableTypeList.Count > 0)//自动添加列表 + { + + foreach (var item in selectProcessComboData.ConsumableTypeList) + { + App.Current.Dispatcher.Invoke(new Action(() => + { + + ConsumableServiceList.Add(new PackItemModel + { + ConsumableTypeList = new ObservableCollection { item.ConsumableTypeName }, + ConsumableType = item.ConsumableTypeName, + ConsumableItemList = item.ConsumableList, + //ConsumableItem = item.ConsumableList.FirstOrDefault()?.ConsumableName, + //ConsumablePrice = item.ConsumableList.FirstOrDefault().ConsumablePrice, + TaskCount = ProcessTaskCount, + TotalConsumableFees = ToTalConsumableFees, + }); ; + })); + } + + } + + + } + + private List processTypeList; + /// + /// 工序类型列表 + /// + public List ProcessTypeList { get => processTypeList; set { Set(ref processTypeList, value); } } + + + private string selectProcessType; + /// + /// 选中工序类型 + /// + public string SelectProcessType + { + get => selectProcessType; set + { + Set(ref selectProcessType, value); + OnProcessTypeChanged(SelectProcessType); + } + } + private void OnProcessTypeChanged(string SelectProcessType, int isTaskCount = 0) + { + if (isTaskCount == 0) + { + if (ProcessTypeResponseList == null || ProcessTypeResponseList.Count <= 0 || SelectProcessType == null) return; + var processTypeData = ProcessTypeResponseList.SingleOrDefault(p => p.ProcessTypeName == SelectProcessType); + App.Current.Dispatcher.Invoke(new Action(() => + { + ProcessPrice = processTypeData.ProcessTypePrice; + ProcessComboList = processTypeData.ProcessComboList.Select(p => new ProcessComboModel { ProcessComboId = p.ProcessComboId, ProcessComboName = p.ProcessComboName }).ToList(); + })); + + } + + var discountRes = processService.GetDiscountFactory(SelectProcessType, ProcessTaskCount); + if (!discountRes.Success) + { + System.Windows.MessageBox.Show(discountRes.Msg); + return; + } + + if (discountRes.Success && discountRes.Data != null) + { + DiscountFactory = discountRes.Data.DiscountFactory; + if (FeesMode == FeesMode.定向收费 && CustomProcessSinglePrice != null) + { + PackFees = decimal.Parse((ProcessTaskCount * CustomProcessSinglePrice.Value).ToString("0.00")); + } + else + { + FeesMode = discountRes.Data.FeesMode; + PackFees = decimal.Parse((ProcessTaskCount * ProcessPrice).ToString("0.00")); + } + + + + PackDiscountFees = decimal.Parse((PackFees * DiscountFactory).ToString("0.00")); + AllFees = ConsumableFees + PackDiscountFees; + } + //统计打包费用 + } + + private string suggestPackUserName; + /// + /// 打包人 + /// + public string SuggestPackUserName { get => suggestPackUserName; set { Set(ref suggestPackUserName, value); } } + + private int? floorDragNumber; + public int? FloorDragNumber { get => floorDragNumber; set { Set(ref floorDragNumber, value); } } + + private string packUserName; + /// + /// 打包人 + /// + public string PackUserName { get => packUserName; set { Set(ref packUserName, value); } } + + + private int incrementPartTaskCount; + /// + /// 配件任务数量 + /// + public int IncrementPartTaskCount { get => incrementPartTaskCount; set { Set(ref incrementPartTaskCount, value); } } + + + private int incrementPartCount; + /// + /// 配件数量 + /// + public int IncrementPartCount { get => incrementPartCount; set { Set(ref incrementPartCount, value); } } + + private string directionalFees; + /// + /// 定向费用 + /// + public string DirectionalFees { get => directionalFees; set { Set(ref directionalFees, value); } } + + + private BitmapImage barcodeImage; + /// + /// 任务Id条形码 + /// + public BitmapImage BarcodeImage { get => barcodeImage; set { Set(ref barcodeImage, value); } } + + private BitmapImage taskImage; + /// + /// 任务Id条形码 + /// + public BitmapImage TaskImage { get => taskImage; set { Set(ref taskImage, value); } } + + private string printName; + + public string PrintName { get => printName; set { Set(ref printName, value); } } + + private ObservableCollection printList; + /// + /// 打印机列表 + /// + public ObservableCollection PrintList { get => printList; set { Set(ref printList, value); } } + + private ObservableCollection packTaskList; + /// + /// 动态数据表 + /// + public ObservableCollection PackTaskList { get => packTaskList; set { Set(ref packTaskList, value); } } + + + private PackTaskModel packTaskModel; + + public PackTaskModel PackTaskModel { get => packTaskModel; set { Set(ref packTaskModel, value); } } // + + + /// + /// 添加打包人 + /// + public ICommand AddPackUserCommand { get; set; } + + public ICommand AddPackServiceCommand { get; set; } + + public ICommand AddBasicPackServiceCommand { get; set; } + + public ICommand AddIncreateServiceCommand { get; set; } + + public ICommand AddConsumableCommand { get; set; } + + public ICommand UpLoadPackCommand { get; set; } + + public ICommand SetAllCountCommand { get; set; } + + + public ICommand PrintCommand { get; set; } + + public ICommand SetCustomProcessPriceCommand { get; set; } + readonly PackTaskService packTaskService; + readonly PackDetailService packDetailService; + readonly ProcessService processService; + private ObservableCollection increateList = new ObservableCollection(); + public ObservableCollection IncreateList { get => increateList; set { Set(ref increateList, value); } } // + + //private ObservableCollection + // packList = new ObservableCollection(); + //public ObservableCollection PackList { get => packList; set { Set(ref packList, value); } } // + + private ObservableCollection + consumableServiceList = new ObservableCollection(); + public ObservableCollection ConsumableServiceList { get => consumableServiceList; set { Set(ref consumableServiceList, value); } } // + + + + + private ObservableCollection basicPackProcessList = new ObservableCollection(); + private ObservableCollection incrementProcessList = new ObservableCollection(); + /// + ///增量工序 + /// + public ObservableCollection IncrementProcessList { get => incrementProcessList; set { Set(ref incrementProcessList, value); } } // + /// + /// 基础包装工序 + /// + public ObservableCollection BasicPackProcessList { get => basicPackProcessList; set { Set(ref basicPackProcessList, value); } } + + + + + + private string discount = "1"; + /// + /// 折扣 + /// + public string Discount { get => discount; set { Set(ref discount, value); } } // + + + public ObservableCollection IncreateServiceList { get; set; } = new ObservableCollection(); + public ObservableCollection MemberList { get; set; } = new ObservableCollection(); + public ObservableCollection ConsumableList { get; set; } = new ObservableCollection(); + public ObservableCollection PackServiceList { get; set; } = new ObservableCollection(); + + /// + /// 基础包装服务项目列表 + /// + public ObservableCollection BasicPackServiceList { get; set; } = new ObservableCollection(); + + + + /// + /// 加载原数据 + /// + public List LoadList = new List(); + + + + public void InitPrintList() + { + TaskImage = MyPrintHelper.GetBarcodeImage(TaskId.ToString(), 300, 60); + + BarcodeImage = MyPrintHelper.GetBarcodeImage(SkuId, 300, 60); + + + PrintList = new ObservableCollection(); + var printingNames = PrinterSettings.InstalledPrinters;//获取本机的打印机数据 + int index = -1; + int selectIndex = 0; + foreach (string name in printingNames) + { + if (name == "Microsoft XPS Document Writer" || name == "Microsoft Print to PDF" || name == "Fax") + { + continue; + } + index++; + if (name.Contains("Deli")) + { + selectIndex = index; + } + PrintList.Add(name); + } + try + { + var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + string printNames = Path.Combine(applicationPath, "printName.init"); + if (File.Exists(printNames)) + { + PrintName = File.ReadAllText(printNames); + } + else + { + if (PrintList.Count > 0) + { + PrintName = PrintList[0].ToString(); + } + } + } + catch (Exception) + { + + + } + + } + + public PackDetailViewModel(PackTaskService packTaskService, PackDetailService packDetailService, ProcessService processService)//, long taskId + { + this.processService = processService; + this.packTaskService = packTaskService; + this.packDetailService = packDetailService; + AddIncreateServiceCommand = new RelayCommand(AddIncreateService); + AddPackServiceCommand = new RelayCommand(AddPackService); + AddBasicPackServiceCommand = new RelayCommand(AddBasicPackService); + AddConsumableCommand = new RelayCommand(AddConsumable); + UpLoadPackCommand = new RelayCommand(UpLoadPack); + + + SetAllCountCommand = new RelayCommand(SetAllCount); + SetCustomProcessPriceCommand = new RelayCommand(SetCustomProcessPrice); + AddPackUserCommand = new RelayCommand(AddPackUser); + PackUserModelList = new ObservableCollection(); + } + + private void AddPackUser() + { + + App.Current.Dispatcher.Invoke(new Action(() => + { + PackUserModelList.Add(new PackUserModel() + { + TaskCount = ProcessTaskCount, + MemberList = MemberList, + }); + })); + } + + /// + /// 所有的耗材类型 + /// + public List ConsumableTypeList { get; set; } + /// + /// 设置定制工序单价 + /// + /// + private void SetCustomProcessPrice() + { + if (CustomProcessSinglePrice == null) + { + OnProcessTypeChanged(SelectProcessType, 1); + return; + } + if (SelectProcessType != "定制") + { + SelectProcessType = "定制"; + SelectProcessComboId = ProcessComboList.FirstOrDefault().ProcessComboId; + } + FeesMode = FeesMode.定向收费; + PackFees = decimal.Parse((ProcessTaskCount * CustomProcessSinglePrice.Value).ToString("0.00")); ; + PackDiscountFees = decimal.Parse((PackFees * DiscountFactory).ToString("0.00")); + AllFees = ConsumableFees + PackDiscountFees; + + + } + private List ProcessTypeResponseList { get; set; } + /// + /// 加载任务数据 + /// + public void LoadPackDatas() + { + IncrementPartTaskCount = TaskCount; + try + { + InitPrintList(); + } + catch (Exception) + { + + + } + + LoadList = new List(); + Task task = Task.Factory.StartNew(() => + { + var resMember = this.packTaskService.GetPackMembers();//成员表 + if (resMember.Success) + { + MemberList = new ObservableCollection(); + foreach (var item in resMember.Data) + { + App.Current.Dispatcher.Invoke(() => + { + MemberList.Add(item); + }); + } + } + var res = this.processService.GetProcessTypeList(); + if (!res.Success) + { + App.Current.Dispatcher.Invoke(() => + { + + MessageBox.Show(res.Msg); + }); + } + ProcessTaskCount = TaskCount; + if (res.Success && res.Data != null) + { + ProcessTypeResponseList = res.Data.ProcessTypeList; + ConsumableTypeList = res.Data.ConsumableTypeList; + App.Current.Dispatcher.Invoke(() => + { + ProcessTypeList = ProcessTypeResponseList.Select(p => p.ProcessTypeName).Distinct().ToList(); + }); + + } + + var packDetailRes = packDetailService.GetPackDetail(TaskId); + + if (!packDetailRes.Success) + { + App.Current.Dispatcher.Invoke(() => + { + MessageBox.Show(packDetailRes.Msg); + }); + } + if (packDetailRes.Success && packDetailRes.Data != null) + { + var resData = packDetailRes.Data; + + SuggestPackUserName = resData.SuggestPackUserName; + SelectProcessType = resData.ProcessTypeName; + SelectProcessComboId = resData.ProcessComboId; + TaskCount = resData.ProcessTaskCount; + DirectionalSingleFees = resData.DirectionalSingleFees?.ToString(); + if (resData.DirectionalSingleFees>0) + { + SetCustomProcessPrice(); + } + if (resData.PackUserList != null && resData.PackUserList.Count > 0) + { + foreach (var packuser in resData.PackUserList) + { + App.Current.Dispatcher.Invoke(() => + { + PackUserModelList.Add(new PackUserModel + { + MemberList = MemberList, + SelectUserId = packuser.UserId, + TaskCount = packuser.TaskCount + }); + }); + + } + + } + if (resData.ConsumableList != null && resData.ConsumableList.Count > 0) + { + + if (ConsumableServiceList != null && ConsumableServiceList.Count > 0) + { + foreach (var con in resData.ConsumableList) + { + var condate = ConsumableServiceList.FirstOrDefault(c => c.ConsumableItem.IsNullOrEmpty() && c.ConsumableType == con.ConsumableTypeName); + App.Current.Dispatcher.Invoke(() => + { + condate.ConsumablePrice = con.ConsumablePrice; + condate.SelectId = con.ConsumableId; + condate.TaskCount = con.TaskCount; + + }); + + } + } + else + { + ObservableCollection consumableTypeList = new ObservableCollection(); + + foreach (var item in ConsumableTypeList) + { + consumableTypeList.Add(item.ConsumableTypeName); + } + + + foreach (var con in resData.ConsumableList) + { + + + App.Current.Dispatcher.Invoke(new Action(() => + { + ConsumableServiceList.Add(new PackItemModel() + { + ItemCount = TaskCount, + ConsumableList = ConsumableList, + ConsumableTypeList = consumableTypeList, + AllConsumableTypeList = ConsumableTypeList, + ConsumableType = con.ConsumableTypeName, + ConsumablePrice = con.ConsumablePrice, + SelectId = con.ConsumableId, + TaskCount = con.TaskCount, + TotalConsumableFees = ToTalConsumableFees + + + }); + })); + + } + + + } + + + + } + } + + + }); + } + + private void ToTalConsumableFees() + { + + App.Current.Dispatcher.Invoke(new Action(() => + { + ConsumableFees = ConsumableServiceList.Select(c => c.ConsumablePrice * c.TaskCount).Sum(); + AllFees = ConsumableFees + PackDiscountFees; + })); + + } + + /// + /// 批量设置耗材数量 + /// + /// + private void SetAllCount(object obj) + { + if (ConsumableServiceList == null || ConsumableServiceList.Count <= 0) + { + return; + } + + SetCountWindow set = new SetCountWindow(); + set.SetCount = new Action((s) => + { + var lbox = obj as ListBox; + var serviceList = lbox.ItemsSource as ObservableCollection; + foreach (var item in serviceList) + { + if (item.ConsumableItem == null) + { + item.ConsumableItem = ConsumableServiceList.Select(c => c.ConsumableList).FirstOrDefault()?.Where(c => c.Id == item.SelectId).FirstOrDefault()?.Name; + } + + item.TaskCount = s; + } + lbox.ItemsSource = serviceList; + }); + set.Show(); + } + + private long taskId; + public long TaskId { get => taskId; set { Set(ref taskId, value); } } // + + + private int taskCount; + public int TaskCount { get => taskCount; set { Set(ref taskCount, value); } } // + public string OrderId { get; set; } + public string SkuId { get; set; } + + + + private List IsOverCount(ObservableCollection packItemModels, bool needUserId = true) + { + + + List disItems = new List(); + + foreach (var packItem in packItemModels)//增值服务上传 + { + var item = new PackItemModel + { + ItemCount = packItem.ItemCount, + SelectId = packItem.SelectId, + SelectUserId = packItem.SelectUserId, + ItemName = packItem.ItemName, + MemberName = packItem.MemberName + }; + if (needUserId) + if (item.SelectId <= 0 || string.IsNullOrEmpty(item.SelectUserId) || item.ItemCount <= 0) + { + System.Windows.MessageBox.Show($"数据输入有误"); + return null; + } + else + if (item.SelectId <= 0 || item.ItemCount <= 0) + { + System.Windows.MessageBox.Show($"数据输入有误"); + return null; + } + + if (item.ItemCount > TaskCount) + { + System.Windows.MessageBox.Show($"{item.ItemName}:{item.ItemCount}超出任务量{TaskCount}"); + return null; + } + + + + if (disItems.Select(a => a.SelectId).Contains(item.SelectId))//相同服务 存在累加 + { + + var data = disItems.SingleOrDefault(a => a.SelectId == item.SelectId); + + if (data != null) data.ItemCount += item.ItemCount; + + if (data.ItemCount > TaskCount)//累积超出任务量 + { + System.Windows.MessageBox.Show($"{item.ItemName}:{data.ItemCount}超出任务量{TaskCount}"); + return null; + } + + continue; + } + disItems.Add(item); + } + + + + return disItems; + } + /// + /// 计费模式 + /// + public FeesMode FeesMode { get; set; } + /// + /// 上传数据 (判断是否超量) 统一上传 + /// + private void UpLoadPack(object obj) + { + if (ProcessTaskCount > TaskCount) + { + System.Windows.MessageBox.Show($"工序任务数:{ProcessTaskCount}不能超过打包总任务数:{TaskCount}"); + return; + } + + if (PackUserModelList != null && PackUserModelList.Count > 0) + { + if (PackUserModelList.Any(p => p.SelectUserId.IsNullOrEmpty() || p.TaskCount <= 0)) + { + System.Windows.MessageBox.Show("信息不完整,打包人设置有误"); + return; + } + + var totalPackTaskCount = PackUserModelList.Select(p => p.TaskCount).Sum(); + if (totalPackTaskCount != ProcessTaskCount) + { + System.Windows.MessageBox.Show($"工序任务总量:{ProcessTaskCount},与打包人任务总量:{totalPackTaskCount} 不相等."); + return; + } + + if (PackUserModelList.Select(p => p.SelectUserId).Distinct().Count() != PackUserModelList.Count()) + { + System.Windows.MessageBox.Show($"请勿重复设置打包人任务."); + return; + } + + } + + + if (ConsumableServiceList != null && ConsumableServiceList.Count > 0) + { + if (ConsumableServiceList.Any(p => p.SelectId == null || p.TaskCount <= 0)) + { + System.Windows.MessageBox.Show("信息不完整,耗材设置有误"); + return; + } + foreach (var item in ConsumableServiceList) + { + if (item.TaskCount > ProcessTaskCount) + { + System.Windows.MessageBox.Show($"耗材分类:{item.ConsumableType}下,任务量:{item.TaskCount} 不能超过工序任务总量:{ProcessTaskCount}."); + return; + } + } + + + + } + if (CustomProcessSinglePrice != null) + { + FeesMode = FeesMode.定向收费; + } + + SetPackDetailRequest setPackDetailRequest = new SetPackDetailRequest() + { + DirectionalSingleFees = CustomProcessSinglePrice, + FeesMode = FeesMode, + AllFees = AllFees, + ConsumableFees = ConsumableFees, + TaskId = TaskId, + PackUserList = PackUserModelList?.Select(p => new PackUserModelRequest { TaskCount = p.TaskCount, UserId = p.SelectUserId }).ToList(), + ConsumableList = ConsumableServiceList?.Select(c => new ConsumableRequest { ConsumableId = c.SelectId.Value, TaskCount = c.TaskCount, ConsumableTypeName = c.ConsumableType, ConsumablePrice = c.ConsumablePrice }).ToList(), + DiscountFactory = DiscountFactory, + PackDiscountPrice = PackDiscountFees, + PackPrice = PackFees, + ProcessComboCount = ProcessTaskCount, + ProcessComboId = SelectProcessComboId, + ProcessTypeName = SelectProcessType + + }; + var res = packDetailService.SetPackDetail(setPackDetailRequest); + + if (res == null) + { + System.Windows.MessageBox.Show("网络异常!"); + return; + } + if (!res.Success) + { + System.Windows.MessageBox.Show(res.Msg); + return; + } + + + // new TipsWindow("上传成功!").Show(); + var win = obj as System.Windows.Window; + if (ReflashWindow != null) + ReflashWindow(); + win.Close(); + + } + /// + /// 刷新界面 + /// + public Action ReflashWindow { get; set; } + + private void AddPackService() + { + App.Current.Dispatcher.Invoke(new Action(() => + { + IncrementProcessList.Add(new PackItemModel() + { + ItemCount = TaskCount, + MemberList = MemberList, + PackServiceList = PackServiceList, + }); + })); + + } + + + private void AddBasicPackService() + { + App.Current.Dispatcher.Invoke(new Action(() => + { + BasicPackProcessList.Add(new PackItemModel() + { + ItemCount = TaskCount, + MemberList = MemberList, + PackServiceList = BasicPackServiceList, + }); + })); + + } + + private void AddIncreateService() + { + App.Current.Dispatcher.Invoke(new Action(() => + { + IncreateList.Add(new PackItemModel() + { + ItemCount = TaskCount, + IncreateServiceList = IncreateServiceList, + MemberList = MemberList, + }); + })); + } + + private void AddConsumable() + { + + ObservableCollection consumableTypeList = new ObservableCollection(); + + foreach (var item in ConsumableTypeList) + { + consumableTypeList.Add(item.ConsumableTypeName); + } + + App.Current.Dispatcher.Invoke(new Action(() => + { + + + + + ConsumableServiceList.Add(new PackItemModel() + { + TaskCount = ProcessTaskCount, + ConsumableTypeList = consumableTypeList, + AllConsumableTypeList = ConsumableTypeList, + TotalConsumableFees=ToTalConsumableFees + + + }); + })); + + } + } +} diff --git a/BBWY.Client/ViewModels/ViewModelLocator.cs b/BBWY.Client/ViewModels/ViewModelLocator.cs index 530defa4..15f647b0 100644 --- a/BBWY.Client/ViewModels/ViewModelLocator.cs +++ b/BBWY.Client/ViewModels/ViewModelLocator.cs @@ -347,6 +347,14 @@ namespace BBWY.Client.ViewModels } } + public PackDetailViewModel PackDetailVM + { + get + { + using var s = sp.CreateScope(); + return s.ServiceProvider.GetRequiredService(); + } + } //public ShopSealBoxListViewModel ShopSealBoxListVM //{ diff --git a/BBWY.Client/Views/PackTask/EditConsumable.xaml b/BBWY.Client/Views/PackTask/EditConsumable.xaml index 0c4b28d2..a68ba0f2 100644 --- a/BBWY.Client/Views/PackTask/EditConsumable.xaml +++ b/BBWY.Client/Views/PackTask/EditConsumable.xaml @@ -14,6 +14,7 @@ xmlns:sys="clr-namespace:System;assembly=mscorlib" CloseButtonVisibility="Visible" WindowStartupLocation="CenterScreen" + DataContext="{Binding Consumable,Source={StaticResource Locator}}" CloseButtonColor="{StaticResource WindowButtonColor}" MinButtonVisibility="Collapsed" MaxButtonVisibility="Collapsed" @@ -44,10 +45,13 @@ - - - + + + diff --git a/BBWY.Client/Views/PackTask/EditConsumable.xaml.cs b/BBWY.Client/Views/PackTask/EditConsumable.xaml.cs index 9b38d338..8d0b7801 100644 --- a/BBWY.Client/Views/PackTask/EditConsumable.xaml.cs +++ b/BBWY.Client/Views/PackTask/EditConsumable.xaml.cs @@ -21,7 +21,7 @@ namespace BBWY.Client.Views.PackTask { - public EditConsumable(ConsumableModel model) + public EditConsumable( ConsumableModel model) { InitializeComponent(); this.DataContext = model; diff --git a/BBWY.Client/Views/PackTask/MinFeesExcelControl.xaml.cs b/BBWY.Client/Views/PackTask/MinFeesExcelControl.xaml.cs index b77b05f8..09a23fe6 100644 --- a/BBWY.Client/Views/PackTask/MinFeesExcelControl.xaml.cs +++ b/BBWY.Client/Views/PackTask/MinFeesExcelControl.xaml.cs @@ -492,8 +492,9 @@ namespace BBWY.Client.Views.PackTask .Replace("[:TaskId:]", $"{FeesItem.TaskId}") .Replace("[:ListData:]", serviceData.ToString()) .Replace("[:AllFees:]", $"{FeesItem.PackFees}"); - //.Replace("[:Discount:]", $"{FeesItem.DiscountFoctor}") - //.Replace("[:DiscountFees:]", $"{discountFees.ToString(" 0.00")}"); + + + if (IsMin) { newGrid = newGrid.Replace(@"MinWidth=""84""", "").Replace(@"[:Visity:]", "Width=\"0\""); diff --git a/BBWY.Client/Views/PackTask/PackDetailWindow.xaml b/BBWY.Client/Views/PackTask/PackDetailWindow.xaml new file mode 100644 index 00000000..cf9c09ac --- /dev/null +++ b/BBWY.Client/Views/PackTask/PackDetailWindow.xaml @@ -0,0 +1,709 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +