diff --git a/BBWY.Client/APIServices/QiKu/ConsumableService.cs b/BBWY.Client/APIServices/QiKu/ConsumableService.cs index 56f56e3b..1a12e525 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; @@ -40,20 +41,40 @@ namespace BBWY.Client.APIServices public ApiResponse Deleted(long id) { - return SendRequest(globalContext.QKApiHost, "api/Consumable/Deleted", - new - { - id = id - } - , null, HttpMethod.Get); + return SendRequest(globalContext.QKApiHost, $"api/Consumable/Deleted?id={id}", + null, null, HttpMethod.Get); } public ApiResponse Search(ConsumableSearchRequest consumable) { - return SendRequest(globalContext.QKApiHost, "api/Consumable/Search", + return SendRequest(globalContext.QKApiHost, "api/Consumable/SearchConsumableList", consumable , 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); + } + + + public ApiResponse DeletedConsumableType(long consumableTypeId) + { + return SendRequest(globalContext.QKApiHost, $"api/Consumable/DeletedConsumableType?consumableTypeId={consumableTypeId}", + null + , null, HttpMethod.Post); + } } } 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/PackTaskService.cs b/BBWY.Client/APIServices/QiKu/PackTaskService.cs index 5d293b82..8cf6aba5 100644 --- a/BBWY.Client/APIServices/QiKu/PackTaskService.cs +++ b/BBWY.Client/APIServices/QiKu/PackTaskService.cs @@ -321,9 +321,9 @@ namespace BBWY.Client.APIServices }, null, HttpMethod.Post); } - public ApiResponse SubmitOverTimeMarkMsg(OverTimeTaskType OverTimeTaskType, long Id, string MarkMsg) + public ApiResponse SubmitOverTimeMarkMsg(OverTimeTaskType OverTimeTaskType, long Id, string MarkMsg) { - return SendRequest(globalContext.QKApiHost, $"api/PackTask/SubmitOverTimeMarkMsg", new + return SendRequest(globalContext.QKApiHost, $"api/PackTask/SubmitOverTimeMarkMsg", new { OverTimeTaskType, Id, @@ -331,7 +331,20 @@ namespace BBWY.Client.APIServices }, null, HttpMethod.Post); } - + //public ApiResponse QikuPublishOrderSkuPackConfigState(string orderId, string skuId, PackConfigState packConfigState) + //{ + // return SendRequest("http://bbwyb.qiyue666.com", $"Api/Order/QikuPublishOrderSkuPackConfigState", new + // { + // orderId, + // skuId, + // packConfigState, + // }, null, HttpMethod.Post); + //} + + public ApiResponse SendToSetSkuConfigure(long taskId) + { + return SendRequest(globalContext.QKApiHost, $"api/PackTask/SendToSetSkuConfigure?taskid={taskId}",null, null, HttpMethod.Post); + } } diff --git a/BBWY.Client/APIServices/QiKu/ProcessService.cs b/BBWY.Client/APIServices/QiKu/ProcessService.cs new file mode 100644 index 00000000..1b2da984 --- /dev/null +++ b/BBWY.Client/APIServices/QiKu/ProcessService.cs @@ -0,0 +1,37 @@ +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,long? ProcessComboId=null) + { + return SendRequest(globalContext.QKApiHost, "api/Process/GetDiscountFactory", + new + { + ProcessTypeName, + TaskCount, + ProcessComboId + } + , 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..920e47ef 100644 --- a/BBWY.Client/Models/APIModel/Request/ConsumableRequest.cs +++ b/BBWY.Client/Models/APIModel/Request/ConsumableRequest.cs @@ -9,12 +9,14 @@ namespace BBWY.Client.Models.APIModel.Request public class ConsumableResponse { - public int OrderCount { get; set; } - public ConsumableModel[] Consumables { get; set; } + public int TotalCount { get; set; } + public ConsumableModel[] SearchConsumableList { get; set; } } public class ConsumableSearchRequest { + + public long? ConsumableTypeId { get; set; } /// /// 名称 /// @@ -67,6 +69,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..ffc62455 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Request/SetPackDetailRequest.cs @@ -0,0 +1,121 @@ +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 工序收费 + + public string ProductResistantName { get; set; } + /// + /// 打包工序类型(0=推荐工序,1=自定义工序) + /// + public PackProcessType PackProcessType { get; set; } + /// + /// 套餐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/FeesItemResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/FeesItemResponse.cs index bfd16785..b74a8b83 100644 --- a/BBWY.Client/Models/APIModel/Response/PackTask/FeesItemResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackTask/FeesItemResponse.cs @@ -10,22 +10,25 @@ namespace BBWY.Client.Models.APIModel.Response.PackTask /// public class FeesItemResponse : NotifyObject { - private List serviceList = new List(); + private List serviceList = new List(); public List ServiceList { get => serviceList; set { Set(ref serviceList, value); } } public decimal disCount; public decimal DisCount { get => disCount; set { Set(ref disCount, value); } } - public decimal AllFees { get=> allFees; set { Set(ref allFees, value); - - } } + public decimal AllFees { get => allFees; set { Set(ref allFees, value); } } private decimal allFees; private decimal discountAllFees; public decimal DiscountAllFees { get => discountAllFees; set { Set(ref discountAllFees, value); } } - public decimal SingleFees { get => singleFees; set { Set(ref singleFees, value); - - } } + public decimal SingleFees + { + get => singleFees; set + { + Set(ref singleFees, value); + + } + } private decimal singleFees; public decimal DiscountSingleFees { get => discountSingleFees; set { Set(ref discountSingleFees, value); } } @@ -36,8 +39,6 @@ namespace BBWY.Client.Models.APIModel.Response.PackTask private decimal taskId; - - /// /// 耗材费用价格 /// @@ -62,14 +63,14 @@ namespace BBWY.Client.Models.APIModel.Response.PackTask public decimal PackFees { get; set; } /// - /// 增值费用小计 + /// 增值费用小计(待移除) /// public decimal IncreateFees { get; set; } /// - /// 增值服务数据 + /// 增值服务数据(待移除) /// - public List IncreateList { get; set; } + public List IncreateList { get; set; } /// /// 耗材服务数据 @@ -78,38 +79,55 @@ namespace BBWY.Client.Models.APIModel.Response.PackTask /// - /// 打包服务 + /// 打包服务(待移除) /// public List PackItemList { get; set; } /// - /// 增量配件数 + /// 增量配件数(待移除) /// public int? IncrementPartCount { get; set; } /// - /// 增量配件任务数 + /// 增量配件任务数(待移除) /// public int? IncrementPartTaskCount { get; set; } /// - /// 增量配件单价 + /// 增量配件单价(待移除) /// public decimal? IncrementPartPrice { get; set; } /// - /// 基础包装费 + /// 基础包装费(待移除) /// public decimal? BasicProcessPrice { get; set; } /// - /// 基础包装数 + /// 基础包装数(待移除) /// public int? BasicProcessCount { get; set; } + /// + /// 工序类型名称 + /// + public string ProcessTypeName { get; set; } + /// + /// 工序套餐名称 + /// + public string ProcessComboName { get; set; } + + /// + /// 工序套餐单价 + /// + public decimal ProcessComboPrice { get; set; } + /// + /// 工序套餐任务量 + /// + public int ProcessComboTaskCount { get; set; } } public class PackItemResponse 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..7a31baad --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/PackTask/GetConsumableTypeResponse.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel.Response.PackTask +{ + public class GetConsumableTypeResponse:NotifyObject + { + + private string consumableTypeName; + + public string ConsumableTypeName { get => consumableTypeName; set { Set(ref consumableTypeName, value); } } + + + private long? consumableTypeId; + + public long? ConsumableTypeId { get => consumableTypeId; set { Set(ref consumableTypeId, value); } } + } +} 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..fdc49def --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/PackTask/GetPackDetailResponse.cs @@ -0,0 +1,48 @@ +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 string ProductResistantName { get; set; } + /// + /// 打包工序类型(0=推荐工序,1=自定义工序) + /// + public PackProcessType PackProcessType { get; set; } + } + + public class PackUserResponse : PackUserModelRequest + { + + } + + + + public class TaskConsumableResponse : ConsumableRequest + { + + + } +} diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs index e6a6ec24..9d2a3140 100644 --- a/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs @@ -205,6 +205,20 @@ namespace BBWY.Client.Models.APIModel /// 排单超时时间 /// public DateTime? ScheduleOverTime { get; set; } + + /// + /// 打包工序类型(0=推荐工序,1=自定义工序) NULL 金额不为0则为旧版本结算 + /// + public PackProcessType? PackProcessType { get; set; } + + /// + /// + /// + public string ShopId { get; set; } + /// + /// 发送信息不全时间 + /// + public DateTime? SendToSetSkuConfigureTime { get; set; } } public class ExpressOrderResponse { 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..f5f3bc0a --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/Process/GetProcessTypeResponse.cs @@ -0,0 +1,87 @@ +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 List ProductResistantList { get; set; } + } + public class ProductResistantResponse : NotifyObject + { + + + + + private string productResistantName; + /// + /// 名称 + /// + public string ProductResistantName { get => productResistantName; set { Set(ref productResistantName, value); } } // + /// + /// 套餐列表 + /// + public ObservableCollection ProcessComboList { get; set; } + } + + + public class ProcessTypeResponse : NotifyObject + { + /// + /// 工序单价 + /// + public decimal ProcessTypePrice { get; set; } + /// + /// 工序类型 + /// + public string ProcessTypeName { get; set; } + /// + /// 套餐列表 + /// + public ObservableCollection ProcessComboList { get; set; } + } + + public class ProcessComboResponse : NotifyObject + { + + private decimal processComboNamePrice; + /// + /// 套餐费用 + /// + public decimal ProcessComboNamePrice { get => processComboNamePrice; set { Set(ref processComboNamePrice, value); } } // + /// + /// 套餐id + /// + public long ProcessComboId { get; set; } + /// + /// 套餐名称 + /// + public string ProcessComboName { get; set; } + /// + /// 绑定的耗材类型 + /// + public ObservableCollection ConsumableTypeList { get; set; } + } + + public class ConsumableTypeResponse : NotifyObject + { + /// + /// 耗材类型名称 + /// + public string ConsumableTypeName { get; set; } + + /// + /// 耗材列表 + /// + public ObservableCollection ConsumableList { get; set; } + } +} diff --git a/BBWY.Client/Models/Enums.cs b/BBWY.Client/Models/Enums.cs index 3a5c88dc..1398e4e4 100644 --- a/BBWY.Client/Models/Enums.cs +++ b/BBWY.Client/Models/Enums.cs @@ -537,4 +537,21 @@ 封箱ID=1 } + /// + /// 推荐工序=0,自定义工序=1 + /// + public enum PackProcessType + { + 推荐工序 = 0, 自定义工序 = 1 + } + /// + /// 打包配置状态( 待配置 = 0,已配置 = 1, 需修改=2) + /// + public enum PackConfigState + { + 待配置 = 0, + 已配置 = 1, + 需修改 = 2 + + } } diff --git a/BBWY.Client/Models/PackTask/ConsumableModel.cs b/BBWY.Client/Models/PackTask/ConsumableModel.cs index 6a7b4977..cc2bc6c9 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,15 +21,20 @@ 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 string consumableTypeName; + public string ConsumableTypeName + { get => consumableTypeName; set { Set(ref consumableTypeName, value); } } + - private ConsumableType? consumableType; - public ConsumableType? ConsumableType - { get => consumableType; set { Set(ref consumableType, value); } } + private string addConsumableTypeName; + public string AddConsumableTypeName + { get => addConsumableTypeName; set { Set(ref addConsumableTypeName, value); } } @@ -35,6 +42,9 @@ namespace BBWY.Client.Models.PackTask public ICommand EditConsumableCommand { get; set; } public ICommand DeletedConsumableCommand { get; set; } public ICommand SaveConsumableCommand { get; set; } + public ICommand AddConsumableTypeCommand { get; set; } + public ICommand DeletedConsumableTypeCommand { get; set; } + public Action ReflashDatas { get; set; } public ConsumableModel(ConsumableService consumableService) @@ -44,8 +54,51 @@ namespace BBWY.Client.Models.PackTask DeletedConsumableCommand = new RelayCommand>(DeletedConsumable); SaveConsumableCommand = new RelayCommand(SaveConsumable); + if (consumableService != null) + { + GetConsumableTypeList(); + } + AddConsumableTypeCommand = new RelayCommand(AddConsumableType); + DeletedConsumableTypeCommand = new RelayCommand(DeletedConsumableType); + } + + private void DeletedConsumableType() + { + MessageBoxResult result = System.Windows.MessageBox.Show($"是否移除耗材类别:{ConsumableTypeName}?", "提示", + MessageBoxButton.YesNo, + MessageBoxImage.Warning); + if (result != MessageBoxResult.Yes) return; + + var res = consumableService.DeletedConsumableType(ConsumableTypeId.Value); + if (!res.Success) + { + System.Windows.MessageBox.Show(res.Msg); + return; + } + if (res.Success) + { + GetConsumableTypeList(); + } + } + + private void AddConsumableType() + { + var res = consumableService.AddConsumableType(AddConsumableTypeName); + if (!res.Success) + { + System.Windows.MessageBox.Show(res.Msg); + return; + } + if (res.Success) + { + GetConsumableTypeList(); + } } + private long? consumableTypeId; + public long? ConsumableTypeId + { get => consumableTypeId; set { Set(ref consumableTypeId, value); } } + public void SaveConsumable(object obj) { @@ -73,7 +126,8 @@ namespace BBWY.Client.Models.PackTask Remark = Remark, Weigth = Weigth, Width = Width, - ConsumableType= ConsumableType, + ConsumableTypeId = ConsumableTypeId, + }); } @@ -89,7 +143,7 @@ namespace BBWY.Client.Models.PackTask Remark = Remark, Weigth = Weigth, Width = Width, - ConsumableType = ConsumableType, + ConsumableTypeId = ConsumableTypeId, }); } @@ -106,8 +160,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 +184,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, @@ -142,11 +208,14 @@ namespace BBWY.Client.Models.PackTask Remark = this.Remark, Width = this.Width, Price = this.Price, - ConsumableType = this.ConsumableType, + ConsumableTypeList = this.ConsumableTypeList, + ConsumableTypeName = this.ConsumableTypeName, + ConsumableTypeId = this.ConsumableTypeId, }); - 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..49b64298 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,124 @@ 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; + + if (ConsumableItemList == null || ConsumableItemList.Count <= 0 ) + { + return; + } + ConsumableItem = ConsumableItemList.FirstOrDefault()?.ConsumableName; + } + + + 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 .IsNullOrEmpty()) + { + 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..00884eed 100644 --- a/BBWY.Client/Models/PackTask/PackTaskModel.cs +++ b/BBWY.Client/Models/PackTask/PackTaskModel.cs @@ -44,23 +44,33 @@ namespace BBWY.Client.Models private void UpdateTask() { - - if (!this.SkuPurchaseSchemeId.IsNullOrEmpty())//B端有采购方案 + try { - UpdatePurchaseTaskWindow updatePurchaseWindow = new UpdatePurchaseTaskWindow(this,ReflashTask); - updatePurchaseWindow.ShowDialog(); - return; - } + if (!this.SkuPurchaseSchemeId.IsNullOrEmpty())//B端有采购方案 + { + UpdatePurchaseTaskWindow updatePurchaseWindow = new UpdatePurchaseTaskWindow(this, ReflashTask); + updatePurchaseWindow.ShowDialog(); + return; + } - if (!OrderId.IsNullOrEmpty()&& SkuPurchaseSchemeId.IsNullOrEmpty())//B端无采购方案 ,手动添加合格证 - { - PublishTaskWindow publishB = new PublishTaskWindow(ReflashTask, this,SaveType.B端); - publishB.ShowDialog(); - return; + if (!OrderId.IsNullOrEmpty() && SkuPurchaseSchemeId.IsNullOrEmpty())//B端无采购方案 ,手动添加合格证 + { + + + PublishTaskWindow publishB = new PublishTaskWindow(ReflashTask, this, SaveType.B端); + publishB.ShowDialog(); + return; + } + + PublishTaskWindow publish = new PublishTaskWindow(ReflashTask, this, SaveType.C端); + publish.ShowDialog(); } + catch (Exception) + { - PublishTaskWindow publish = new PublishTaskWindow(ReflashTask, this, SaveType.C端); - publish.ShowDialog(); + + } + } @@ -85,10 +95,16 @@ namespace BBWY.Client.Models private void SetService() { - - ServiceWindow service = new ServiceWindow(this, ReflashTask); - service.Show(); + if (this.PackProcessType==null&&this.FeesMoney>0) + { + ServiceWindow window = new ServiceWindow(this, ReflashTask); + window.ShowDialog(); + return;//旧版本 + + } + PackDetailWindow service = new PackDetailWindow(this, ReflashTask); + service.ShowDialog(); } /// @@ -459,6 +475,19 @@ namespace BBWY.Client.Models /// public DateTime? ScheduleOverTime { get; set; } + private PackProcessType? packProcessType; + /// + /// 打包工序类型(0=推荐工序,1=自定义工序) NULL 金额不为0则为旧版本结算 + /// + public PackProcessType? PackProcessType { get => packProcessType; set { Set(ref packProcessType, value); } } + + + public string ShopId { get; set; } + + /// + /// 发送信息不全时间 + /// + public DateTime? SendToSetSkuConfigureTime { get; set; } } public class SkuMessage : NotifyObject 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/ConsumableViewModel.cs b/BBWY.Client/ViewModels/PackTask/ConsumableViewModel.cs index 50ab6337..7e760144 100644 --- a/BBWY.Client/ViewModels/PackTask/ConsumableViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/ConsumableViewModel.cs @@ -1,4 +1,5 @@ using BBWY.Client.APIServices; +using BBWY.Client.Models.APIModel.Response.PackTask; using BBWY.Client.Models.PackTask; using BBWY.Client.Views.PackTask; using BBWY.Common.Models; @@ -18,8 +19,18 @@ namespace BBWY.Client.ViewModels.PackTask { public class ConsumableViewModel : BaseVM, IDenpendency { + private string consumableTypeName; + public string ConsumableTypeName + { get => consumableTypeName; set { Set(ref consumableTypeName, value); } } + private long? consumableTypeId; + public long? ConsumableTypeId + { get => consumableTypeId; set { Set(ref consumableTypeId, value); } } + + public ObservableCollection consumableTypeList = new ObservableCollection() + { - + }; + public ObservableCollection ConsumableTypeList { get => consumableTypeList; set { Set(ref consumableTypeList, value); } } private bool isOpenAdd = true; public bool IsOpenAdd { get => isOpenAdd; set { Set(ref isOpenAdd, value); } } @@ -52,6 +63,7 @@ namespace BBWY.Client.ViewModels.PackTask public ICommand TaskPageIndexChangedCommand { get; set; } public ICommand AddConsumableCommand { get; set; } public ICommand SearchConsumableCommand { get; set; } + private readonly ConsumableService consumableService; public ConsumableViewModel(ConsumableService consumableService) @@ -68,7 +80,24 @@ namespace BBWY.Client.ViewModels.PackTask LoadIndex(p.PageIndex); }); SearchConsumable(); + GetConsumableTypeList(); } + + void GetConsumableTypeList() + { + ConsumableTypeList = new ObservableCollection(); + var res = consumableService.GetConsumableTypeList(); + if (res.Success && res.Data != null) + { + ConsumableTypeList.Add(new GetConsumableTypeResponse { ConsumableTypeId = null, ConsumableTypeName = "全部" }); + foreach (var item in res.Data) + { + ConsumableTypeList.Add(item); + } + + } + } + private void LoadIndex(int pageIndex) { PageIndex = pageIndex;// @@ -86,14 +115,16 @@ namespace BBWY.Client.ViewModels.PackTask Name = searchName, PageIndex = PageIndex, PageSize = PageSize, + ConsumableTypeId = ConsumableTypeId, + }); if (res.Success) { ConsumableList = new ObservableCollection(); - if (res.Data != null && res.Data.Consumables != null && res.Data.Consumables.Count() > 0) + if (res.Data != null && res.Data.SearchConsumableList != null && res.Data.SearchConsumableList.Count() > 0) { - OrderCount = res.Data.OrderCount; - foreach (var item in res.Data.Consumables) + OrderCount = res.Data.TotalCount; + foreach (var item in res.Data.SearchConsumableList) { App.Current.Dispatcher.Invoke(() => { @@ -107,8 +138,8 @@ namespace BBWY.Client.ViewModels.PackTask Remark = item.Remark, Weigth = item.Weigth, Width = item.Width, - ConsumableType = item.ConsumableType, - + ConsumableTypeName =item.ConsumableTypeName, + ConsumableTypeId = item.ConsumableTypeId, }); }); } diff --git a/BBWY.Client/ViewModels/PackTask/EditConsumableViewModel.cs b/BBWY.Client/ViewModels/PackTask/EditConsumableViewModel.cs new file mode 100644 index 00000000..f6a3f4ac --- /dev/null +++ b/BBWY.Client/ViewModels/PackTask/EditConsumableViewModel.cs @@ -0,0 +1,207 @@ +using BBWY.Client.APIServices; +using BBWY.Client.Models.APIModel.Request; +using BBWY.Client.Models; +using BBWY.Client.Models.PackTask; +using BBWY.Client.Views.PackTask; +using BBWY.Common.Models; +using GalaSoft.MvvmLight.Command; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; +using System.Windows; +using System.Windows.Input; +using BBWY.Client.Models.APIModel.Response.PackTask; + +namespace BBWY.Client.ViewModels.PackTask +{ + public class EditConsumableViewModel:BaseVM,IDenpendency + { + public ObservableCollection consumableTypeList = new ObservableCollection() + { + + }; + public ObservableCollection ConsumableTypeList { get => consumableTypeList; set { Set(ref consumableTypeList, value); } } + + private string consumableTypeName; + public string ConsumableTypeName + { get => consumableTypeName; set { Set(ref consumableTypeName, value); } } + + + private string addConsumableTypeName; + public string AddConsumableTypeName + { get => addConsumableTypeName; set { Set(ref addConsumableTypeName, value); } } + + + + public ConsumableService consumableService; + public ICommand EditConsumableCommand { get; set; } + public ICommand DeletedConsumableCommand { get; set; } + public ICommand SaveConsumableCommand { get; set; } + public ICommand AddConsumableTypeCommand { get; set; } + public Action ReflashDatas { get; set; } + + public EditConsumableViewModel(ConsumableService consumableService) + { + this.consumableService = consumableService; + EditConsumableCommand = new RelayCommand(EditConsumable); + + DeletedConsumableCommand = new RelayCommand>(DeletedConsumable); + SaveConsumableCommand = new RelayCommand(SaveConsumable); + if (consumableService != null) + { + GetConsumableTypeList(); + } + AddConsumableTypeCommand = new RelayCommand(AddConsumableType); + } + + private void AddConsumableType() + { + var res = consumableService.AddConsumableType(AddConsumableTypeName); + if (res.Success) + { + GetConsumableTypeList(); + } + } + + private long consumableTypeId; + public long ConsumableTypeId + { get => consumableTypeId; set { Set(ref consumableTypeId, value); } } + + + public void SaveConsumable(object obj) + { + if (string.IsNullOrEmpty(Name)) + { + new TipsWindow("耗材品名不能为空!").Show(); + return; + } + + if (this.Price == null) + { + new TipsWindow("价格不能为空!").Show(); + return; + } + ApiResponse res = null; + if (Id > 0)//修改 + { + res = consumableService.Edit(new ConsuableRequest + { + Id = Id, + Heigth = Heigth, + Length = Length, + Name = Name, + Price = Price.Value, + Remark = Remark, + Weigth = Weigth, + Width = Width, + ConsumableTypeId = ConsumableTypeId, + }); + + } + else + { + res = consumableService.Add(new ConsuableRequest + { + + Heigth = Heigth, + Length = Length, + Name = Name, + Price = Price.Value, + Remark = Remark, + Weigth = Weigth, + Width = Width, + ConsumableTypeId = ConsumableTypeId, + }); + + } + + if (res != null && res.Success) + { + var win = obj as System.Windows.Window; + + ViewModelLocator viewModel = new ViewModelLocator(); + var con = viewModel.Consumable; + con.SearchConsumable(); + //if (ReflashDatas != null) ReflashDatas(); + win.Close(); + } + else + { + if (res != null) + new TipsWindow(res.Msg).Show(); + } + } + public ConsumableModel model; + + public void DeletedConsumable(ObservableCollection list) + { + MessageBoxResult result = System.Windows.MessageBox.Show("是否删除?", "提示", + MessageBoxButton.YesNo, + MessageBoxImage.Warning); + if (result != MessageBoxResult.Yes) return; + + var res = consumableService.Deleted(Id); + if (res.Success) + { + ViewModelLocator viewModel = new ViewModelLocator(); + var con = viewModel.Consumable; + con.SearchConsumable(); + list.Remove(model); + } + } + + + + 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, + Length = this.Length, + Id = this.Id, + Name = this.Name, + Weigth = this.Weigth, + Remark = this.Remark, + Width = this.Width, + Price = this.Price, + ConsumableTypeId = this.ConsumableTypeId, + ConsumableTypeList = this.ConsumableTypeList, + ConsumableTypeName = this.ConsumableTypeName, + + }); + + add.ShowDialog(); + + } + + private long id; + public long Id { get => id; set { Set(ref id, value); } } + private string name; + public string Name { get => name; set { Set(ref name, value); } } + private decimal? price; + public decimal? Price { get => price; set { Set(ref price, value); } } + private double? weigth; + public double? Weigth { get => weigth; set { Set(ref weigth, value); } } + private double? length; + public double? Length { get => length; set { Set(ref length, value); } } + private double? width; + public double? Width { get => width; set { Set(ref width, value); } } + private double? heigth; + public double? Heigth { get => heigth; set { Set(ref heigth, value); } } + private string remark; + public string Remark { get => remark; set { Set(ref remark, value); } } + } +} diff --git a/BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs b/BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs new file mode 100644 index 00000000..a4986502 --- /dev/null +++ b/BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs @@ -0,0 +1,1044 @@ +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 PackProcessType packProcessType; + /// + /// 推荐工序=0,自定义工序=1 + /// + public PackProcessType PackProcessType { get => packProcessType; set { Set(ref packProcessType, value); } } + + 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); + if (PackProcessType == PackProcessType.推荐工序&& SelectProcessComboIdV2>0&& ProcessTaskCount>0) + + TotalPackFeesDetail(null, ProcessTaskCount, SelectProcessComboIdV2); + if (PackProcessType == PackProcessType.自定义工序&& !SelectProcessType.IsNullOrEmpty()&& ProcessTaskCount>0) + TotalPackFeesDetail(SelectProcessType, ProcessTaskCount, null); + } + } + + //void OnProcessTaskCountChanged() + //{ + // PackFees = decimal.Parse((ProcessTaskCount * ProcessPrice).ToString("0.00")); ; + // PackDiscountFees = decimal.Parse((PackFees * DiscountFactory).ToString("0.00")); + //} + + + private ObservableCollection processComboList; + /// + /// 套餐类型列表 + /// + public ObservableCollection ProcessComboList { get => processComboList; set { Set(ref processComboList, value); } } + + private ObservableCollection processComboListV2; + /// + /// 套餐类型列表 + /// + public ObservableCollection ProcessComboListV2 { get => processComboListV2; set { Set(ref processComboListV2, value); } } + + + + private long selectProcessComboId; + /// + /// 选中套餐类型 + /// + public long SelectProcessComboId + { + get => selectProcessComboId; set + { + Set(ref selectProcessComboId, value); + + OnProcessComboChanged(SelectProcessComboId); + } + } + + + private long selectProcessComboIdV2; + /// + /// 选中套餐类型(推荐工序) + /// + public long SelectProcessComboIdV2 + { + get => selectProcessComboIdV2; set + { + Set(ref selectProcessComboIdV2, value); + + OnProcessComboChanged(SelectProcessComboIdV2); + } + } + + + + + + public bool isConsumableTypeListEnable; + public bool IsConsumableTypeListEnable { get => isConsumableTypeListEnable; set { Set(ref isConsumableTypeListEnable, value); } } + private void OnProcessComboChanged(long SelectProcessComboId, int type = 1) + { + if (SelectProcessComboId <= 0) + { + return; + } + if (PackProcessType == PackProcessType.推荐工序) + { + if (ProcessComboListV2 == null || ProcessComboListV2.Count <= 0) + { + return; + } + + if (!DirectionalSingleFees.IsNullOrEmpty()) + DirectionalSingleFees = string.Empty;// + + var selectProcessComboData = ProcessComboListV2. + SingleOrDefault(p => p.ProcessComboId == SelectProcessComboId); + App.Current.Dispatcher.Invoke(new Action(() => + { + ConsumableServiceList.Clear(); + })); + IsConsumableTypeListEnable = false; + ProcessPrice = selectProcessComboData.ProcessComboNamePrice; + + 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, + }); ; + })); + } + + } + //关联工序类型名 + + var discountRes = processService.GetDiscountFactory(SelectProcessType, ProcessTaskCount, SelectProcessComboIdV2); + 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; + } + + } + if (PackProcessType == PackProcessType.自定义工序) + { + var selectProcessComboData = ProcessComboList. + SingleOrDefault(p => p.ProcessComboId == SelectProcessComboId); + + + App.Current.Dispatcher.Invoke(new Action(() => + { + ConsumableServiceList.Clear(); + })); + IsConsumableTypeListEnable = false; + if (SelectProcessType == "定制") + { + IsConsumableTypeListEnable = true; + + ConsumableServiceList = new ObservableCollection(); + + + } + else + { + if (!DirectionalSingleFees.IsNullOrEmpty()) + DirectionalSingleFees = string.Empty; + } + 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, + }); ; + })); + } + + } + } + + if (PackProcessType == PackProcessType.推荐工序 && SelectProcessComboIdV2 > 0 && ProcessTaskCount > 0) + TotalPackFeesDetail(null, ProcessTaskCount, SelectProcessComboIdV2); + if (PackProcessType == PackProcessType.自定义工序 && !SelectProcessType.IsNullOrEmpty() && ProcessTaskCount > 0) + TotalPackFeesDetail(SelectProcessType, ProcessTaskCount, null); + + + } + private void TotalPackFeesDetail(string processType, int taskCount, long? processComboId) + { + + + var discountRes = processService.GetDiscountFactory(processType, taskCount, processComboId); + 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((taskCount * CustomProcessSinglePrice.Value).ToString("0.00")); + } + else + { + FeesMode = discountRes.Data.FeesMode; + PackFees = decimal.Parse((taskCount * ProcessPrice).ToString("0.00")); + } + + + + PackDiscountFees = decimal.Parse((PackFees * DiscountFactory).ToString("0.00")); + AllFees = ConsumableFees + PackDiscountFees; + } + //统计打包费用 + + + } + + + + 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) + { + + if (SelectProcessType.IsNullOrEmpty()) return; + + var processTypeData = ProcessTypeList.SingleOrDefault(p => p.ProcessTypeName == SelectProcessType); + App.Current.Dispatcher.Invoke(new Action(() => + { + ProcessPrice = processTypeData.ProcessTypePrice; + ProcessComboList = processTypeData.ProcessComboList; + + })); + if (ProcessComboList != null || ProcessComboList.Count() > 0) + { + SelectProcessComboId = ProcessComboList.FirstOrDefault().ProcessComboId; + } + + + } + + private string selectProductResistant; + /// + /// 选中易碎等级 + /// + public string SelectProductResistant + { + get => selectProductResistant; set + { + Set(ref selectProductResistant, value); + OnProductResistantChanged(SelectProductResistant); + } + } + private void OnProductResistantChanged(string SelectProductResistant, int isTaskCount = 0) + { + if (SelectProductResistant.IsNullOrEmpty()) + { + + return; + } + + if (isTaskCount == 0)//获取绑定的耗材列表 + { + if (ProductResistantList == null || ProductResistantList.Count <= 0 || SelectProductResistant == null) return; + var processTypeData = ProductResistantList.SingleOrDefault(p => p.ProductResistantName == SelectProductResistant); + App.Current.Dispatcher.Invoke(new Action(() => + { + //ProcessPrice = processTypeData.ProcessTypePrice; + ProcessComboListV2 = processTypeData.ProcessComboList; + })); + if (ProcessComboListV2 != null || ProcessComboListV2.Count() > 0) + { + SelectProcessComboIdV2 = ProcessComboListV2.FirstOrDefault().ProcessComboId; + } + + } + } + + 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 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 MemberList { get; set; } = new ObservableCollection(); + public ObservableCollection ConsumableList { 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; + + + PackUserModelList = new ObservableCollection(); + AddConsumableCommand = new RelayCommand(AddConsumable); + UpLoadPackCommand = new RelayCommand(UpLoadPack); + SetAllCountCommand = new RelayCommand(SetAllCount); + SetCustomProcessPriceCommand = new RelayCommand(SetCustomProcessPrice); + AddPackUserCommand = new RelayCommand(AddPackUser); + + } + + 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) + { + TotalPackFeesDetail(null, ProcessTaskCount, SelectProcessComboIdV2); + return; + } + if (SelectProcessType != "定制") + { + SelectProcessType = "定制"; + SelectProcessComboId = ProcessComboList.FirstOrDefault().ProcessComboId; + } + FeesMode = FeesMode.定向收费; + + ProcessPrice = CustomProcessSinglePrice.Value; + PackFees = decimal.Parse((ProcessTaskCount * CustomProcessSinglePrice.Value).ToString("0.00")); ; + PackDiscountFees = decimal.Parse((PackFees * DiscountFactory).ToString("0.00")); + AllFees = ConsumableFees + PackDiscountFees; + + + } + + private List productResistantList; + public List ProductResistantList { get => productResistantList; set { Set(ref productResistantList, value); } } + /// + /// 加载任务数据 + /// + 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) + { + + ConsumableTypeList = res.Data.ConsumableTypeList; + App.Current.Dispatcher.Invoke(() => + { + ProcessTypeList = res.Data.ProcessTypeList; + ProductResistantList = res.Data.ProductResistantList; + }); + + } + + 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; + + PackProcessType = resData.PackProcessType; + + switch (PackProcessType) + { + case PackProcessType.推荐工序: + SelectProductResistant = resData.ProductResistantName; + SelectProcessComboIdV2 = resData.ProcessComboId; + break; + case PackProcessType.自定义工序: + SelectProcessType = resData.ProcessTypeName; + SelectProcessComboId = resData.ProcessComboId; + break; + default: + break; + } + SuggestPackUserName = resData.SuggestPackUserName; + + + 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; } + + + /// + /// 计费模式 + /// + 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 = PackProcessType == PackProcessType.推荐工序 ? SelectProcessComboIdV2 : SelectProcessComboId, + ProcessTypeName = SelectProcessType, + PackProcessType = PackProcessType, + ProductResistantName = SelectProductResistant, + + }; + + + 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 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/PackTask/TaskListViewModel.cs b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs index ac5651dd..090af060 100644 --- a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs @@ -239,7 +239,7 @@ namespace BBWY.Client.ViewModels.PackTask - public TaskListViewModel(PackTaskService packTaskService, GlobalContext globalContext, SealBoxService sealBoxService) + public TaskListViewModel(PackTaskService packTaskService, GlobalContext globalContext, SealBoxService sealBoxService) { this.globalContext = globalContext; @@ -289,7 +289,7 @@ namespace BBWY.Client.ViewModels.PackTask var paramList = (object[])param; var id = (long)paramList[0]; var markMsg = paramList[1].ToString(); - SubmitOverTimeMarkMsgWindow submitOverTimeMarkMsgWindow = new SubmitOverTimeMarkMsgWindow(OverTimeTaskType.待落仓, id, markMsg, packTaskService, ReflashTask) ; + SubmitOverTimeMarkMsgWindow submitOverTimeMarkMsgWindow = new SubmitOverTimeMarkMsgWindow(OverTimeTaskType.待落仓, id, markMsg, packTaskService, ReflashTask); submitOverTimeMarkMsgWindow.ShowDialog(); } @@ -307,15 +307,15 @@ namespace BBWY.Client.ViewModels.PackTask ProductTitle = fallware.ProductTitle, PurchaseOrder = fallware.PurchaseOrder, WaybillNo = fallware.WaybillNo - + }; //if (fallware.WareType== WareType.京仓) //{ - //SetJDWareBoxWindow window = new SetJDWareBoxWindow(model,sealBoxService,fallware.WareType.Value,ReflashTask); - //window.Show(); - var w = new SetJDWareBoxWindow2(model, sealBoxService, fallware.WareType.Value, ReflashTask,fallware.TransportOverTime); - w.ShowDialog(); + //SetJDWareBoxWindow window = new SetJDWareBoxWindow(model,sealBoxService,fallware.WareType.Value,ReflashTask); + //window.Show(); + var w = new SetJDWareBoxWindow2(model, sealBoxService, fallware.WareType.Value, ReflashTask, fallware.TransportOverTime); + w.ShowDialog(); //} //if (fallware.WareType == WareType.云仓) //{ @@ -522,7 +522,7 @@ namespace BBWY.Client.ViewModels.PackTask try { if (SearchTaskId != null && !string.IsNullOrEmpty(SearchTaskId.Trim())) - taskId= Convert.ToInt64(SearchTaskId); + taskId = Convert.ToInt64(SearchTaskId); } catch { @@ -540,7 +540,7 @@ namespace BBWY.Client.ViewModels.PackTask try { PackTaskList = new ObservableCollection();//初始化数据 - var datas = packTaskService.SearchTaskList(SearchSkuId, SearchTaskId,SearchSpuId,SearchOrderSn, this.TaskState, + var datas = packTaskService.SearchTaskList(SearchSkuId, SearchTaskId, SearchSpuId, SearchOrderSn, this.TaskState, PageIndex, PageSize); if (datas != null && datas.Data != null && datas.Success) { @@ -563,7 +563,7 @@ namespace BBWY.Client.ViewModels.PackTask GoodsNo = item.ProductItemNum, Logo= item.Logo, SkuName = item.SkuName, SkuId = item.SkuId, - + } }, ShowMarkMessage = item.ShowMarkMessage, @@ -583,7 +583,9 @@ namespace BBWY.Client.ViewModels.PackTask ShopName = item.ShopName, SkuPurchaseSchemeId = item.SkuPurchaseSchemeId, ScheduleOverTimeMarkMsg = item.ScheduleOverTimeMarkMsg, - ScheduleOverTime = item.ScheduleOverTime + ScheduleOverTime = item.ScheduleOverTime, + PackProcessType = item.PackProcessType, + SendToSetSkuConfigureTime = item.SendToSetSkuConfigureTime, }; if (!item.OrderId.IsNullOrEmpty() && !item.SkuId.IsNullOrEmpty())//加载物流信息 @@ -591,7 +593,8 @@ namespace BBWY.Client.ViewModels.PackTask var expressData = packTaskService.GetPurchaseExpressOrderList(item.OrderId, item.SkuId); if (expressData != null && expressData.Success && expressData.Data != null) { - expressData.Data.ForEach(e => { + expressData.Data.ForEach(e => + { e.ExpressState = ExpressOrderHelper.GetExpressStateName(e.ExpressState); }); data.ExpressOrderList = expressData.Data; @@ -656,19 +659,18 @@ namespace BBWY.Client.ViewModels.PackTask { foreach (var item in packtasks) { - var datetime = item.QualityCompletionOverTime.Value.Subtract(DateTime.Now); + 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; - //item.QualityRemainTime = $"{datetime.Days}天{datetime.Hours}小时{datetime.Minutes}分{datetime.Seconds}秒"; - item.QualityRemainTime = $"{datetime.Days}天{datetime.Hours}小时{datetime.Minutes}分"; - } else - { item.IsQualityOverTime = true; - //item.QualityRemainTime = $"{-datetime.Days}天{-datetime.Hours}小时{-datetime.Minutes}分{-datetime.Seconds}秒"; - item.QualityRemainTime = $"{-datetime.Days}天{-datetime.Hours}小时{-datetime.Minutes}分"; - } + + } })); @@ -798,7 +800,7 @@ namespace BBWY.Client.ViewModels.PackTask if (SealBoxConfigureType == SealBoxConfigureType.待配置) { SealBoxWaitConfigureList = new ObservableCollection(); - ApiResponse sealBoxWaitRes = sealBoxService.GetSealBoxWaitConfigureList(SearchSkuId, SearchTaskId, PageSize, PageIndex,SearchSpuId); + ApiResponse sealBoxWaitRes = sealBoxService.GetSealBoxWaitConfigureList(SearchSkuId, SearchTaskId, PageSize, PageIndex, SearchSpuId); if (sealBoxWaitRes == null) { @@ -934,9 +936,9 @@ namespace BBWY.Client.ViewModels.PackTask })); } - + var fallWareTasks = FallWareWaitConfigureList.Where(p => p.SetPurchaseOrderOverTime != null).ToList(); - if (fallWareTasks.Count() > 0 && TaskState == Models.TaskState.待落仓&& SealBoxConfigureType == SealBoxConfigureType.待配置) + if (fallWareTasks.Count() > 0 && TaskState == Models.TaskState.待落仓 && SealBoxConfigureType == SealBoxConfigureType.待配置) { //if (packOverTimeThread!=null) //{ @@ -1099,7 +1101,7 @@ namespace BBWY.Client.ViewModels.PackTask public void ShowCertificateWindow() { } - + #endregion private void OpenSkuDetail(object param) { diff --git a/BBWY.Client/ViewModels/PackTask/UpdatePurchaseTaskViewModel.cs b/BBWY.Client/ViewModels/PackTask/UpdatePurchaseTaskViewModel.cs index b03fc3e8..305ab8bb 100644 --- a/BBWY.Client/ViewModels/PackTask/UpdatePurchaseTaskViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/UpdatePurchaseTaskViewModel.cs @@ -66,14 +66,14 @@ namespace BBWY.Client.ViewModels.PackTask private ObservableCollection certificatePositionList = new ObservableCollection { - "无","外部包装","产品包装" + "无需合格证","外部包装","产品包装" }; public ObservableCollection CertificatePositionList { get => certificatePositionList; set { Set(ref certificatePositionList, value); } } - private ObservableCollection availabilityList = new ObservableCollection { - "已到货","部分到货","未到货" - }; - public ObservableCollection AvailabilityList { get => availabilityList; set { Set(ref availabilityList, value); } } + //private ObservableCollection availabilityList = new ObservableCollection { + // "已到货","部分到货","未到货" + // }; + //public ObservableCollection AvailabilityList { get => availabilityList; set { Set(ref availabilityList, value); } } private int skuCount; /// @@ -631,39 +631,6 @@ namespace BBWY.Client.ViewModels.PackTask //加载配置文件 } - //public void SearSpuCer() - //{ - // if (string.IsNullOrEmpty(SpuId)) - // { - // SearchSku(SkuId); - // return; - // } - // SpuId = SpuId.Trim();//去掉空格 避免数据异常 - - - // var productSku = packPurchaseTaskService.GetSpuCer(SpuId); - // if (productSku == null || !productSku.Success) - // { - // IsSetSpuCertificate = true; - - // return; - // } - // SpuCertificateModel = productSku.Data; - // IsSetSpuCertificate = false; - // if (SpuCertificateModel == null) - // { - // SpuCertificateModel = new CertificateModel(); - // IsSetSpuCertificate = true; - // SpuCertificateModel.Brand = Brand; - // SpuCertificateModel.BrandName = BrandName; - // SpuCertificateModel.ProductNo = ProductNo; - // SpuCertificateModel.SpuId = SpuId; - - // } - - - //} - public Action ReflashWindow { get; set; } public void InitData() { @@ -679,15 +646,11 @@ namespace BBWY.Client.ViewModels.PackTask BarCodeModel = null; OriginShopName = ""; - // Availability = (TaskState.)config.Availability; MarkMessage = ""; CertificatePosition = CertificatePosition.产品包装; - // Increment1 = config.Increment1; IsNeedBarCode = Need.需要; IsNeedCertificateModel = Need.不需要; - - bool isSelected; IncreateList = new ObservableCollection(); foreach (var item in increates) @@ -738,57 +701,57 @@ namespace BBWY.Client.ViewModels.PackTask SkuName = SkuName, OrderId = OrderId, BrandName = BrandName, - Availability = (int)Availability, BasicPack = (int)BasicPack, SkuId = SkuId, Increment1 = increateStr, - CertificatePosition = (int)CertificatePosition, PackType = (int)PackType, - MarkMessage = MarkMessage, PositionType = (int)PositionType, GoodsNumber = GoodsNumber, SkuGoodsTitle = SkuTitle, SkuCount = SkuCount, NeedBar = IsNeedBarCode == Need.需要, - NeedCer = IsNeedCertificateModel == Need.需要, SkuPurchaseSchemeId = SkuPurchaseSchemeId, Brand = Brand, PurchaseSkuSpecs = PurchaseSkuList.Select(p => new PurchaseSkuSpec { IsNeedCer = p.IsNeedCer, PurchaseSkuId = p.PurchaseSkuId, - }).ToArray() - - //IsWorry = IsWorry + }).ToArray(), + }; if (IsNeedBarCode == Need.需要) { if (BarCodeModel == null || IsSetBarCode || BarCodeModel.Id <= 0) { MessageBox.Show("请设置条形码模板"); - //new TipsWindow("请设置条形码模板").Show(); return; } createTaskModel.BarCodeId = BarCodeModel.Id; } - if (IsNeedCertificateModel == Need.需要) - { - - if (purchaseSkuList.Any(p => p.IsNeedCer && p.CerDTO == null)) - { - MessageBox.Show("有未设置的合格证,请设置完所有的合格证再保存"); - return; - } - var cerList = purchaseSkuList.Where(p => p.IsNeedCer).Select(p => p.CerDTO).Select(c => c.Id).Where(c => c > 0).ToList(); - if (purchaseSkuList.Count() <= 0 || cerList.Count <= 0) + if (CertificatePosition!= CertificatePosition.无需合格证)//需要合格证 + { + if (PurchaseSkuList != null && PurchaseSkuList.Count > 0 && purchaseSkuList.Any(p => p.IsNeedCer)) { - MessageBox.Show("请设置合格证模板"); - return; + if (purchaseSkuList.Any(p => p.IsNeedCer && p.CerDTO == null)) + { + MessageBox.Show("有未设置的合格证,请设置完所有的合格证再保存"); + return; + } + var cerList = purchaseSkuList.Where(p => p.IsNeedCer).Select(p => p.CerDTO).Select(c => c.Id).Where(c => c > 0).ToList(); + if (purchaseSkuList.Count() <= 0 || cerList.Count <= 0) + { + MessageBox.Show("请设置合格证模板"); + return; + } + createTaskModel.CerId = string.Join(",", cerList);// } - createTaskModel.CerId = string.Join(",", cerList);// + } + + + ApiResponse res = null; res = packPurchaseTaskService.UpdatePurchaseTask(createTaskModel); diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index 77aa310f..dbbdb1fb 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs @@ -119,14 +119,14 @@ namespace BBWY.Client.ViewModels.PackTask { SearchWayBillNo = null; } - + } /// /// 查询物流 /// - private string selectTaskId= "任务ID"; + private string selectTaskId = "任务ID"; public string SelectTaskId { get => selectTaskId; @@ -175,7 +175,7 @@ namespace BBWY.Client.ViewModels.PackTask { SearchSkuId = null; } - + } @@ -406,7 +406,7 @@ namespace BBWY.Client.ViewModels.PackTask /// public string ArrivedCount { get => arrivedCount; set { Set(ref arrivedCount, value); } } - + @@ -570,11 +570,31 @@ namespace BBWY.Client.ViewModels.PackTask LookLSOrderConfigureCommand = new RelayCommand(LookLSOrderConfigure); SubmitOverTimeMarkMsgCommand = new RelayCommand(SubmitOverTimeMarkMsg); - + SendToSetSkuConfigureCommand = new RelayCommand(SendToSetSkuConfigure); SelectSku = "SKU"; SelectExpress = "物流单号"; } + private void SendToSetSkuConfigure(PackTaskModel model) + { + if (model.SendToSetSkuConfigureTime!=null) + { + System.Windows.MessageBox.Show($"已提醒配置,提醒时间:{model.SendToSetSkuConfigureTime},请耐心等待"); + return; + } + + + var res = packTaskService.SendToSetSkuConfigure(model.TaskId); + if (!res.Success) + { + System.Windows.MessageBox.Show(res.Msg); + } + if (res.Success) + { + SearchTaskList(); + } + } + private void SubmitOverTimeMarkMsg(object param) { @@ -919,6 +939,10 @@ namespace BBWY.Client.ViewModels.PackTask #region 事件绑定 + /// + /// 推送sku配置状态 + /// + public ICommand SendToSetSkuConfigureCommand { get; set; } /// /// 提交超时原因 /// @@ -1340,7 +1364,7 @@ namespace BBWY.Client.ViewModels.PackTask else if (TaskState == Models.TaskState.待封箱) Task.Factory.StartNew(() => { - + if (SealBoxConfigureType == SealBoxConfigureType.已配置) { @@ -1511,7 +1535,10 @@ namespace BBWY.Client.ViewModels.PackTask ShowMarkMessage = item.ShowMarkMessage, SkuPurchaseSchemeId = item.SkuPurchaseSchemeId, ScheduleOverTimeMarkMsg = item.ScheduleOverTimeMarkMsg, - ScheduleOverTime = item.ScheduleOverTime + ScheduleOverTime = item.ScheduleOverTime, + PackProcessType = item.PackProcessType, + ShopId = item.ShopId, + SendToSetSkuConfigureTime= item.SendToSetSkuConfigureTime, }; @@ -1552,7 +1579,7 @@ namespace BBWY.Client.ViewModels.PackTask if (item.FeesItemResponse != null) { data.FeesItemResponse = item.FeesItemResponse; - data.FeesMoney = item.FeesItemResponse.SingleFees; + data.FeesMoney = item.FeesItemResponse.AllFees; data.FeesItemResponse.DiscountAllFees = item.FeesItemResponse.AllFees * item.FeesItemResponse.disCount; @@ -1592,7 +1619,11 @@ namespace BBWY.Client.ViewModels.PackTask { foreach (var item in packtasks) { - var datetime = item.QualityCompletionOverTime.Value.Subtract(DateTime.Now); + 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) { @@ -1627,7 +1658,7 @@ namespace BBWY.Client.ViewModels.PackTask var packCompletedTasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待打包 && p.PackCompletionOverTime != null).ToList(); if (packCompletedTasks.Count() > 0) { - + packOverTimeThread = new Thread(() => { IsStartThread = true; 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/FallWare/SetJDWareBoxWindow.xaml.cs b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml.cs index 7104a0e7..7f072968 100644 --- a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml.cs +++ b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml.cs @@ -32,9 +32,10 @@ namespace BBWY.Client.Views.FallWare { public SetJDWareBoxWindow(JDWareBoxModel model) { - JDWareBoxModel = model; + InitializeComponent(); - PurchaseOrderImage= MyPrintHelper.GetBarcodeImageV2(model.PurchaseOrder, 420, 50); + JDWareBoxModel = model; + PurchaseOrderImage = MyPrintHelper.GetBarcodeImageV2(model.PurchaseOrder, 420, 50); PrewOrderImage = MyPrintHelper.GetBarcodeImageV2(model.PrewOrder, 350, 50); this.DataContext =this; this.Dispatcher.Invoke(() => { @@ -86,8 +87,9 @@ namespace BBWY.Client.Views.FallWare printDialog.PrintTicket.PageMediaSize = new PageMediaSize(pageWidth, pageHeight); this.Height = pageHeight + 39;//833 this.Width = pageWidth;//1123 - this.FontSize = 30; + this.FontSize = 30; box_margin.Margin = new Thickness(50, 50, 50, 50); + //box_margin.Margin = new Thickness(10); this.jd_box.Arrange(new Rect(new Point(0, 0), new Size(pageWidth, pageHeight))); for (int i = 1; i <= JDWareBoxModel.BoxCount; i++) { diff --git a/BBWY.Client/Views/Order/OrderList.xaml b/BBWY.Client/Views/Order/OrderList.xaml index 5ba2ce63..95287ad2 100644 --- a/BBWY.Client/Views/Order/OrderList.xaml +++ b/BBWY.Client/Views/Order/OrderList.xaml @@ -135,7 +135,7 @@ - diff --git a/BBWY.Client/Views/PackTask/Consumable.xaml b/BBWY.Client/Views/PackTask/Consumable.xaml index 5c8ddb4d..845710f9 100644 --- a/BBWY.Client/Views/PackTask/Consumable.xaml +++ b/BBWY.Client/Views/PackTask/Consumable.xaml @@ -41,7 +41,7 @@ - + @@ -50,11 +50,27 @@ Background="{StaticResource Button.Selected.Background}" BorderThickness="0" Foreground="White"> - - -