Browse Source

1

AddValidOverTime
506583276@qq.com 2 years ago
parent
commit
6d92ff4f83
  1. 17
      BBWY.Client/APIServices/QiKu/ConsumableService.cs
  2. 27
      BBWY.Client/APIServices/QiKu/PackDetailService.cs
  3. 36
      BBWY.Client/APIServices/QiKu/ProcessService.cs
  4. 2
      BBWY.Client/App.xaml.cs
  5. 2
      BBWY.Client/Models/APIModel/Request/ConsumableRequest.cs
  6. 115
      BBWY.Client/Models/APIModel/Request/SetPackDetailRequest.cs
  7. 13
      BBWY.Client/Models/APIModel/Response/PackTask/GetConsumableTypeResponse.cs
  8. 42
      BBWY.Client/Models/APIModel/Response/PackTask/GetPackDetailResponse.cs
  9. 21
      BBWY.Client/Models/APIModel/Response/Process/DiscountFactoryResponse.cs
  10. 63
      BBWY.Client/Models/APIModel/Response/Process/GetProcessTypeResponse.cs
  11. 37
      BBWY.Client/Models/PackTask/ConsumableModel.cs
  12. 118
      BBWY.Client/Models/PackTask/PackItemModel.cs
  13. 2
      BBWY.Client/Models/PackTask/PackTaskModel.cs
  14. 47
      BBWY.Client/Models/PackTask/PackUser.cs
  15. 19
      BBWY.Client/Models/PackTask/ProcessComboModel.cs
  16. 11
      BBWY.Client/ViewModels/PackTask/EditConsumableViewModel.cs
  17. 963
      BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs
  18. 8
      BBWY.Client/ViewModels/ViewModelLocator.cs
  19. 10
      BBWY.Client/Views/PackTask/EditConsumable.xaml
  20. 5
      BBWY.Client/Views/PackTask/MinFeesExcelControl.xaml.cs
  21. 709
      BBWY.Client/Views/PackTask/PackDetailWindow.xaml
  22. 102
      BBWY.Client/Views/PackTask/PackDetailWindow.xaml.cs

17
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<object> AddConsumableType(string ConsumableTypeName)
{
return SendRequest<object>(globalContext.QKApiHost, "api/Consumable/AddConsumableType",
new { ConsumableTypeName }
, null, HttpMethod.Post);
}
public ApiResponse<ObservableCollection<GetConsumableTypeResponse>> GetConsumableTypeList()
{
return SendRequest<ObservableCollection<GetConsumableTypeResponse>>(globalContext.QKApiHost, "api/Consumable/GetConsumableTypeList",
null
, null, HttpMethod.Get);
}
}
}

27
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);
}
/// <summary>
/// 设置打包费用
/// </summary>
/// <param name="consumable"></param>
/// <returns></returns>
public ApiResponse<object> SetPackDetail(SetPackDetailRequest consumable)
{
return SendRequest<object>(globalContext.QKApiHost, "api/PackDetail/SetPackDetail",
consumable
, null, HttpMethod.Post);
}
/// <summary>
/// 获取打包费用明细
/// </summary>
/// <param name="taskId"></param>
/// <returns></returns>
public ApiResponse<GetPackDetailResponse> GetPackDetail(long taskId)
{
return SendRequest<GetPackDetailResponse>(globalContext.QKApiHost, $"api/PackDetail/GetPackDetail?taskId={taskId}",
null
, null, HttpMethod.Get);
}
}
}

36
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<GetProcessTypeResponse> GetProcessTypeList()
{
return SendRequest<GetProcessTypeResponse>(globalContext.QKApiHost, "api/Process/GetProcessTypeList",
null
, null, HttpMethod.Get);
}
public ApiResponse<DiscountFactoryResponse> GetDiscountFactory(string ProcessTypeName, int TaskCount)
{
return SendRequest<DiscountFactoryResponse>(globalContext.QKApiHost, "api/Process/GetDiscountFactory",
new
{
ProcessTypeName,
TaskCount
}
, null, HttpMethod.Post);
}
}
}

2
BBWY.Client/App.xaml.cs

@ -127,7 +127,7 @@ namespace BBWY.Client
serviceCollection.AddTransient<PublishTaskViewModel>();
serviceCollection.AddTransient<QualityViewModel>();
serviceCollection.AddTransient<PackServiceViewModel>();
serviceCollection.AddTransient<PackDetailViewModel>();
serviceCollection.AddTransient<UpdatePurchaseTaskViewModel>();
#region 注册拳探SDK相关类
serviceCollection.AddSingleton<QuanTanProductClient>();

2
BBWY.Client/Models/APIModel/Request/ConsumableRequest.cs

@ -67,6 +67,6 @@ namespace BBWY.Client.Models.APIModel.Request
/// <summary>
/// 耗材归属
/// </summary>
public ConsumableType? ConsumableType { get; set; }
public long ConsumableTypeId { get; set; }
}
}

115
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
{
/// <summary>
/// 任务Id
/// </summary>
public long TaskId { get; set; }
#region 工序收费
/// <summary>
/// 套餐id
/// </summary>
public long ProcessComboId { get; set; }
/// <summary>
/// 套餐任务量
/// </summary>
public long ProcessComboCount { get; set; }
/// <summary>
/// 折扣系数
/// </summary>
public decimal DiscountFactory { get; set; }
/// <summary>
/// 打包原价
/// </summary>
public decimal PackPrice { get; set; }
/// <summary>
/// 打包折扣价
/// </summary>
public decimal PackDiscountPrice { get; set; }
/// <summary>
/// 定向单价
/// </summary>
public decimal? DirectionalSingleFees { get; set; }
/// <summary>
/// 计费模式
/// </summary>
public FeesMode FeesMode { get; set; }
#endregion
/// <summary>
/// 打包人员列表
/// </summary>
public List<PackUserModelRequest> PackUserList { get; set; }
/// <summary>
/// 耗材列表
/// </summary>
public List<ConsumableRequest> ConsumableList { get; set; }
/// <summary>
/// 耗材费用(总)
/// </summary>
public decimal ConsumableFees { get; set; }
/// <summary>
/// 任务总费用
/// </summary>
public decimal AllFees { get; set; }
public string ProcessTypeName { get; set; }
}
public class ConsumableRequest
{
/// <summary>
/// 耗材id
/// </summary>
public long ConsumableId { get; set; }
/// <summary>
/// 任务量
/// </summary>
public int TaskCount { get; set; }
/// <summary>
/// 耗材价格
/// </summary>
public decimal ConsumablePrice { get; set; }
/// <summary>
/// 耗材类型
/// </summary>
public string ConsumableTypeName { get; set; }
}
public class PackUserModelRequest
{
/// <summary>
/// 打包人
/// </summary>
public string UserId { get; set; }
/// <summary>
/// 打包任务量
/// </summary>
public int TaskCount { get; set; }
}
public class TaskConsumableRequest
{
/// <summary>
/// 耗材id
/// </summary>
public long ConsumableId { get; set; }
/// <summary>
/// 耗材任务量
/// </summary>
public int TaskCount { get; set; }
}
}

13
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; }
}
}

42
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<PackUserResponse> PackUserList { get; set; }
public List<TaskConsumableResponse> 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
{
}
}

21
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
{
/// <summary>
/// 折扣系数
/// </summary>
public decimal DiscountFactory { get; set; }
/// <summary>
/// 计费类型
/// </summary>
public Models.FeesMode FeesMode { get; set; }
}
}

63
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<ProcessTypeResponse> ProcessTypeList { get; set; }
/// <summary>
/// 所有的耗材类型
/// </summary>
public List<ConsumableTypeResponse> ConsumableTypeList { get; set; }
}
public class ProcessTypeResponse
{
/// <summary>
/// 工序单价
/// </summary>
public decimal ProcessTypePrice { get; set; }
/// <summary>
/// 工序类型
/// </summary>
public string ProcessTypeName { get; set; }
/// <summary>
/// 套餐列表
/// </summary>
public ObservableCollection<ProcessComboResponse> ProcessComboList { get; set; }
}
public class ProcessComboResponse
{
/// <summary>
/// 套餐id
/// </summary>
public long ProcessComboId { get; set; }
/// <summary>
/// 套餐名称
/// </summary>
public string ProcessComboName { get; set; }
/// <summary>
/// 绑定的耗材类型
/// </summary>
public ObservableCollection<ConsumableTypeResponse> ConsumableTypeList { get; set; }
}
public class ConsumableTypeResponse
{
/// <summary>
/// 耗材类型名称
/// </summary>
public string ConsumableTypeName { get; set; }
/// <summary>
/// 耗材列表
/// </summary>
public ObservableCollection<ConsumableItemModel> ConsumableList { get; set; }
}
}

37
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<string> consumableTypeList = new ObservableCollection<string>()
public ObservableCollection<GetConsumableTypeResponse> consumableTypeList = new ObservableCollection<GetConsumableTypeResponse>()
{
"箱子", "气泡纸", "胶带", "其他"
};
public ObservableCollection<string> ConsumableTypeList { get => consumableTypeList; set { Set(ref consumableTypeList, value); } }
public ObservableCollection<GetConsumableTypeResponse> ConsumableTypeList { get => consumableTypeList; set { Set(ref consumableTypeList, value); } }
private ConsumableType? consumableType;
public ConsumableType? ConsumableType
@ -44,7 +46,16 @@ namespace BBWY.Client.Models.PackTask
DeletedConsumableCommand = new RelayCommand<ObservableCollection<ConsumableModel>>(DeletedConsumable);
SaveConsumableCommand = new RelayCommand<object>(SaveConsumable);
if (consumableService!=null)
{
GetConsumableTypeList();
}
}
private long consumableTypeId;
public long ConsumableTypeId
{ get => consumableTypeId; set { Set(ref consumableTypeId, value); } }
public void SaveConsumable(object obj)
@ -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,
});
}
@ -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;

118
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<PackItemModel> list = obj as ObservableCollection<PackItemModel>;
list.Remove(this);
}
/// <summary>
/// 耗材类型
/// </summary>
private ObservableCollection<string> consumableTypeList;
public ObservableCollection<string> ConsumableTypeList { get => consumableTypeList; set { Set(ref consumableTypeList, value); } }
/// <summary>
/// 所有的耗材类型
/// </summary>
public List<ConsumableTypeResponse> AllConsumableTypeList { get; set; }
private string consumableType;
/// <summary>
/// 耗材类型
/// </summary>
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;
/// <summary>
/// 耗材型号
/// </summary>
public string ConsumableItem
{
get => consumableItem; set
{
Set(ref consumableItem, value);
OnConsumableItemChanged(ConsumableItem);
}
}
/// <summary>
/// 统计耗材收费
/// </summary>
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();
}
/// <summary>
/// 耗材型号
/// </summary>
private ObservableCollection<ConsumableItemModel> consumableItemList;
public ObservableCollection<ConsumableItemModel> ConsumableItemList { get => consumableItemList; set { Set(ref consumableItemList, value); } }
private decimal consumablePrice;
/// <summary>
/// 耗材单价
/// </summary>
public decimal ConsumablePrice { get => consumablePrice; set { Set(ref consumablePrice, value); } }
private int taskCount;
/// <summary>
/// 耗材任务数
/// </summary>
public int TaskCount { get => taskCount; set { Set(ref taskCount, value); OnConsumableItemChanged(ConsumableItem); } }
}
public class ConsumableItemModel : NotifyObject
{
/// <summary>
/// 耗材id
/// </summary>
public long ConsumableId { get; set; }
/// <summary>
/// 耗材名称
/// </summary>
public string ConsumableName { get; set; }
/// <summary>
/// 耗材价格
/// </summary>
public decimal ConsumablePrice { get; set; }
}
}

2
BBWY.Client/Models/PackTask/PackTaskModel.cs

@ -87,7 +87,7 @@ namespace BBWY.Client.Models
{
ServiceWindow service = new ServiceWindow(this, ReflashTask);
PackDetailWindow service = new PackDetailWindow(this, ReflashTask);
service.Show();
}

47
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
/// </summary>
public string UserNick { get; set; }
}
public class PackUserModel:NotifyObject
{
private string selectUserId;
/// <summary>
/// Member.userId
/// </summary>
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;
/// <summary>
/// 任务量
/// </summary>
public int TaskCount { get => taskCount; set { Set(ref taskCount, value); } }
private ObservableCollection<PackUser> memberList;
public ObservableCollection<PackUser> MemberList
{
get => memberList; set
{
Set(ref memberList, value);
}
}
public ICommand DeleteServiceCommand { get; set; }
public PackUserModel()
{
DeleteServiceCommand = new RelayCommand<object>(DeleteService);
}
private void DeleteService(object obj)
{
ObservableCollection<PackUserModel> list = obj as ObservableCollection<PackUserModel>;
list.Remove(this);
}
}
}

19
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; }
}
}

11
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
{
}
}

963
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;
/// <summary>
/// 任务总费用
/// </summary>
public decimal AllFees { get => allFees; set { Set(ref allFees, value); } }
private decimal processPrice;
/// <summary>
/// 工序单价
/// </summary>
public decimal ProcessPrice { get => processPrice; set { Set(ref processPrice, value); } }
private decimal consumableFees;
/// <summary>
/// 耗材费用
/// </summary>
public decimal ConsumableFees { get => consumableFees; set { Set(ref consumableFees, value); } }
public ObservableCollection<PackUserModel> packUserModelList;
public ObservableCollection<PackUserModel> PackUserModelList { get => packUserModelList; set { Set(ref packUserModelList, value); } }
// private decimal? customProcessSinglePrice;
/// <summary>
/// 定制工序单价
/// </summary>
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;
/// <summary>
/// 打包原价
/// </summary>
public decimal PackFees { get => packFees; set { Set(ref packFees, value); } }
private decimal discountFactory;
/// <summary>
/// 折扣系数
/// </summary>
public decimal DiscountFactory { get => discountFactory; set { Set(ref discountFactory, value); } }
private decimal packDiscountFees;
/// <summary>
/// 打包折后价价
/// </summary>
public decimal PackDiscountFees { get => packDiscountFees; set { Set(ref packDiscountFees, value); } }
private int processTaskCount;
/// <summary>
/// 工序任务量
/// </summary>
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<ProcessComboModel> processComboList;
/// <summary>
/// 套餐类型列表
/// </summary>
public List<ProcessComboModel> ProcessComboList { get => processComboList; set { Set(ref processComboList, value); } }
private long selectProcessComboId;
/// <summary>
/// 选中套餐类型
/// </summary>
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<PackItemModel>();
}
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<string> { item.ConsumableTypeName },
ConsumableType = item.ConsumableTypeName,
ConsumableItemList = item.ConsumableList,
//ConsumableItem = item.ConsumableList.FirstOrDefault()?.ConsumableName,
//ConsumablePrice = item.ConsumableList.FirstOrDefault().ConsumablePrice,
TaskCount = ProcessTaskCount,
TotalConsumableFees = ToTalConsumableFees,
}); ;
}));
}
}
}
private List<string> processTypeList;
/// <summary>
/// 工序类型列表
/// </summary>
public List<string> ProcessTypeList { get => processTypeList; set { Set(ref processTypeList, value); } }
private string selectProcessType;
/// <summary>
/// 选中工序类型
/// </summary>
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;
/// <summary>
/// 打包人
/// </summary>
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;
/// <summary>
/// 打包人
/// </summary>
public string PackUserName { get => packUserName; set { Set(ref packUserName, value); } }
private int incrementPartTaskCount;
/// <summary>
/// 配件任务数量
/// </summary>
public int IncrementPartTaskCount { get => incrementPartTaskCount; set { Set(ref incrementPartTaskCount, value); } }
private int incrementPartCount;
/// <summary>
/// 配件数量
/// </summary>
public int IncrementPartCount { get => incrementPartCount; set { Set(ref incrementPartCount, value); } }
private string directionalFees;
/// <summary>
/// 定向费用
/// </summary>
public string DirectionalFees { get => directionalFees; set { Set(ref directionalFees, value); } }
private BitmapImage barcodeImage;
/// <summary>
/// 任务Id条形码
/// </summary>
public BitmapImage BarcodeImage { get => barcodeImage; set { Set(ref barcodeImage, value); } }
private BitmapImage taskImage;
/// <summary>
/// 任务Id条形码
/// </summary>
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<string> printList;
/// <summary>
/// 打印机列表
/// </summary>
public ObservableCollection<string> PrintList { get => printList; set { Set(ref printList, value); } }
private ObservableCollection<PackTaskModel> packTaskList;
/// <summary>
/// 动态数据表
/// </summary>
public ObservableCollection<PackTaskModel> PackTaskList { get => packTaskList; set { Set(ref packTaskList, value); } }
private PackTaskModel packTaskModel;
public PackTaskModel PackTaskModel { get => packTaskModel; set { Set(ref packTaskModel, value); } } //
/// <summary>
/// 添加打包人
/// </summary>
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<PackItemModel> increateList = new ObservableCollection<PackItemModel>();
public ObservableCollection<PackItemModel> IncreateList { get => increateList; set { Set(ref increateList, value); } } //
//private ObservableCollection<PackItemModel>
// packList = new ObservableCollection<PackItemModel>();
//public ObservableCollection<PackItemModel> PackList { get => packList; set { Set(ref packList, value); } } //
private ObservableCollection<PackItemModel>
consumableServiceList = new ObservableCollection<PackItemModel>();
public ObservableCollection<PackItemModel> ConsumableServiceList { get => consumableServiceList; set { Set(ref consumableServiceList, value); } } //
private ObservableCollection<PackItemModel> basicPackProcessList = new ObservableCollection<PackItemModel>();
private ObservableCollection<PackItemModel> incrementProcessList = new ObservableCollection<PackItemModel>();
/// <summary>
///增量工序
/// </summary>
public ObservableCollection<PackItemModel> IncrementProcessList { get => incrementProcessList; set { Set(ref incrementProcessList, value); } } //
/// <summary>
/// 基础包装工序
/// </summary>
public ObservableCollection<PackItemModel> BasicPackProcessList { get => basicPackProcessList; set { Set(ref basicPackProcessList, value); } }
private string discount = "1";
/// <summary>
/// 折扣
/// </summary>
public string Discount { get => discount; set { Set(ref discount, value); } } //
public ObservableCollection<PackServiceDTO> IncreateServiceList { get; set; } = new ObservableCollection<PackServiceDTO>();
public ObservableCollection<PackUser> MemberList { get; set; } = new ObservableCollection<PackUser>();
public ObservableCollection<ConsumableModel> ConsumableList { get; set; } = new ObservableCollection<ConsumableModel>();
public ObservableCollection<PackServiceDTO> PackServiceList { get; set; } = new ObservableCollection<PackServiceDTO>();
/// <summary>
/// 基础包装服务项目列表
/// </summary>
public ObservableCollection<PackServiceDTO> BasicPackServiceList { get; set; } = new ObservableCollection<PackServiceDTO>();
/// <summary>
/// 加载原数据
/// </summary>
public List<PackItemModel> LoadList = new List<PackItemModel>();
public void InitPrintList()
{
TaskImage = MyPrintHelper.GetBarcodeImage(TaskId.ToString(), 300, 60);
BarcodeImage = MyPrintHelper.GetBarcodeImage(SkuId, 300, 60);
PrintList = new ObservableCollection<string>();
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<object>(UpLoadPack);
SetAllCountCommand = new RelayCommand<object>(SetAllCount);
SetCustomProcessPriceCommand = new RelayCommand(SetCustomProcessPrice);
AddPackUserCommand = new RelayCommand(AddPackUser);
PackUserModelList = new ObservableCollection<PackUserModel>();
}
private void AddPackUser()
{
App.Current.Dispatcher.Invoke(new Action(() =>
{
PackUserModelList.Add(new PackUserModel()
{
TaskCount = ProcessTaskCount,
MemberList = MemberList,
});
}));
}
/// <summary>
/// 所有的耗材类型
/// </summary>
public List<ConsumableTypeResponse> ConsumableTypeList { get; set; }
/// <summary>
/// 设置定制工序单价
/// </summary>
/// <exception cref="NotImplementedException"></exception>
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<ProcessTypeResponse> ProcessTypeResponseList { get; set; }
/// <summary>
/// 加载任务数据
/// </summary>
public void LoadPackDatas()
{
IncrementPartTaskCount = TaskCount;
try
{
InitPrintList();
}
catch (Exception)
{
}
LoadList = new List<PackItemModel>();
Task task = Task.Factory.StartNew(() =>
{
var resMember = this.packTaskService.GetPackMembers();//成员表
if (resMember.Success)
{
MemberList = new ObservableCollection<PackUser>();
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<string> consumableTypeList = new ObservableCollection<string>();
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;
}));
}
/// <summary>
/// 批量设置耗材数量
/// </summary>
/// <param name="obj"></param>
private void SetAllCount(object obj)
{
if (ConsumableServiceList == null || ConsumableServiceList.Count <= 0)
{
return;
}
SetCountWindow set = new SetCountWindow();
set.SetCount = new Action<int>((s) =>
{
var lbox = obj as ListBox;
var serviceList = lbox.ItemsSource as ObservableCollection<PackItemModel>;
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<PackItemModel> IsOverCount(ObservableCollection<PackItemModel> packItemModels, bool needUserId = true)
{
List<PackItemModel> disItems = new List<PackItemModel>();
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;
}
/// <summary>
/// 计费模式
/// </summary>
public FeesMode FeesMode { get; set; }
/// <summary>
/// 上传数据 (判断是否超量) 统一上传
/// </summary>
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();
}
/// <summary>
/// 刷新界面
/// </summary>
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<string> consumableTypeList = new ObservableCollection<string>();
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
});
}));
}
}
}

8
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<PackDetailViewModel>();
}
}
//public ShopSealBoxListViewModel ShopSealBoxListVM
//{

10
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 @@
<TextBlock Text="所属分类:" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="30 0 5 0" />
<Border CornerRadius="0" BorderThickness="1" BorderBrush="{StaticResource Border.Brush}">
<ComboBox BorderThickness="0" Width="88" VerticalContentAlignment="Center" ItemsSource="{Binding ConsumableTypeList}" Text="{Binding ConsumableType}" >
</ComboBox>
<ComboBox BorderThickness="0" Width="88" VerticalContentAlignment="Center" ItemsSource="{Binding ConsumableTypeList}"
DisplayMemberPath="ConsumableTypeName"
SelectedValuePath="ConsumableTypeId" SelectedValue="{Binding ConsumableTypeId}"
/>
</Border>
<c:BTextBox Margin="30 0 5 0" Width="100" Text="{Binding ConsumableTypeName}"/>
<c:BButton Content="添加分类" Width="80" Command="{Binding AddConsumableTypeCommand}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0 10 0 10">

5
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\"");

709
BBWY.Client/Views/PackTask/PackDetailWindow.xaml

@ -0,0 +1,709 @@
<c:BWindow x:Class="BBWY.Client.Views.PackTask.PackDetailWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BBWY.Client.Views.PackTask"
mc:Ignorable="d"
Title="PackDetailWindow" Height="844" Width="480"
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:ctr="clr-namespace:BBWY.Client.Converters"
xmlns:cmodel="clr-namespace:BBWY.Client.Models"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:hc="https://handyorg.github.io/handycontrol"
CloseButtonVisibility="Visible"
WindowStartupLocation="CenterScreen"
CloseButtonColor="{StaticResource WindowButtonColor}"
DataContext="{Binding PackDetailVM,Source={StaticResource Locator}}"
MinButtonVisibility="Collapsed"
MaxButtonVisibility="Collapsed"
RightButtonGroupMargin="0,5,5,0">
<!--ResizeMode="NoResize"-->
<Window.Resources>
<Style TargetType="ComboBox">
<Style.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries >
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Style.Resources>
</Style>
<DrawingBrush x:Key="DashBorderBrush">
<DrawingBrush.Drawing>
<GeometryDrawing Brush="Transparent">
<GeometryDrawing.Geometry>
<RectangleGeometry Rect="0,0,100,100"/>
</GeometryDrawing.Geometry>
<GeometryDrawing.Pen>
<Pen Thickness="2" Brush="Black"/>
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingBrush.Drawing>
</DrawingBrush>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="480"/>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Border BorderThickness="0,0,0,1" BorderBrush="{StaticResource MainMenu.BorderBrush}"
Background="{StaticResource Border.Background}">
<TextBlock Text="打包任务配置" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<Grid Grid.Row="1" >
<Grid.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries >
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<ScrollViewer x:Name="scrolls" Grid.Row="0" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" Height="740">
<ScrollViewer.Content>
<StackPanel Orientation="Vertical" Grid.Row="1">
<Grid Margin="20 10 20 10" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="打包工序" Margin="0 0 5 0" Style="{StaticResource middleTextBlock}" />
<Border Background="Black" Grid.Column="1" VerticalAlignment="Center" Height="1"/>
</Grid>
<Grid Margin="20 5 20 0">
<Grid Height="60" >
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition MinWidth="84"/>
<ColumnDefinition Width="66"/>
<ColumnDefinition Width="66"/>
</Grid.ColumnDefinitions>
<TextBlock Background="{StaticResource Border.Background}" Grid.ColumnSpan="4"/>
<TextBlock Text="工序类型" Style="{StaticResource middleTextBlock}" />
<TextBlock Text="套餐类型" Style="{StaticResource middleTextBlock}" Grid.Column="1" />
<TextBlock Text="工序单价" Style="{StaticResource middleTextBlock}" Grid.Column="2" />
<TextBlock Text="任务量" Style="{StaticResource middleTextBlock}" Grid.Column="3"/>
<Border VerticalAlignment="Top" Grid.ColumnSpan="4" Height="1" Background="{StaticResource Border.Brush}" Grid.Row="0" />
<Border VerticalAlignment="Bottom" Grid.ColumnSpan="4" Height="1" Background="{StaticResource Border.Brush}" />
<Border VerticalAlignment="Bottom" Grid.ColumnSpan="4" Height="1" Background="{StaticResource Border.Brush}" Grid.Row="1"/>
<Border HorizontalAlignment="Left" Grid.Column="0" Width="1" Background="{StaticResource Border.Brush}" Grid.RowSpan="2"/>
<Border HorizontalAlignment="Left" Grid.Column="1" Width="1" Background="{StaticResource Border.Brush}" Grid.RowSpan="2"/>
<Border HorizontalAlignment="Left" Grid.Column="2" Width="1" Background="{StaticResource Border.Brush}" Grid.RowSpan="2"/>
<Border HorizontalAlignment="Left" Grid.Column="3" Width="1" Background="{StaticResource Border.Brush}" Grid.RowSpan="2"/>
<Border HorizontalAlignment="Right" Grid.Column="3" Width="1" Background="{StaticResource Border.Brush}" Grid.RowSpan="2"/>
<ComboBox Margin="1" BorderThickness="0" Grid.Row="1" ItemsSource="{Binding ProcessTypeList}" Text="{Binding SelectProcessType}" />
<ComboBox Margin="1" BorderThickness="0" Grid.Row="1" Grid.Column="1" ItemsSource="{Binding ProcessComboList}" DisplayMemberPath="ProcessComboName"
SelectedValuePath="ProcessComboId" SelectedValue="{Binding SelectProcessComboId}"
Text="{Binding SelectProcessCombo}"/>
<Grid Grid.Row="1" Grid.Column="2" Margin="1 0 1 1" Background="{StaticResource Border.Background}" >
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding ProcessPrice}" />
</Grid>
<TextBox BorderBrush="Transparent" BorderThickness="0" Margin="1" Grid.Row="1" Grid.Column="3" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding ProcessTaskCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
</Grid>
</Grid>
<Border BorderThickness="1" Height="40" Margin="20,10,20,10" BorderBrush="{StaticResource Border.Brush}">
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource middleTextBlock}" Margin="10 0 0 0">
<Run Text="原价:"/>
<Run Text="{Binding PackFees}"/>
</TextBlock>
<TextBlock Style="{StaticResource middleTextBlock}" Margin="30 0 0 0">
<Run Text="折扣系数:"/>
<Run Text="{Binding DiscountFactory}"/>
</TextBlock>
<TextBlock Style="{StaticResource middleTextBlock}" Margin="30 0 0 0">
<Run Text="折后价:"/>
<Run Text="{Binding PackDiscountFees}"/>
</TextBlock>
</StackPanel>
</Border>
<StackPanel Orientation="Horizontal" Margin="20 0 0 10">
<TextBlock Style="{StaticResource middleTextBlock}" Text="定制工序单价:"/>
<Border BorderThickness="1" CornerRadius="0" BorderBrush="{StaticResource Border.Brush}">
<TextBox BorderThickness="0" Width="100" Text="{Binding DirectionalSingleFees,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
</Border>
<c:BButton Content="确定" Width="60" Command="{Binding SetCustomProcessPriceCommand}"/>
</StackPanel>
<Grid Margin="20 10 20 0" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="打包人" Margin="0 0 5 0" Style="{StaticResource middleTextBlock}" />
<Border Background="Black" Grid.Column="1" VerticalAlignment="Center" Height="1"/>
</Grid>
<TextBlock Margin="20 10 20 10">
<Run Text="推荐打包人:"/>
<Run Text="{Binding SuggestPackUserName}" Foreground="Red"/>
</TextBlock>
<Grid Margin="20 10 20 0">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid Height="30" Background="{StaticResource Border.Background}" >
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="80"/>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="80"/>
</Grid.ColumnDefinitions>
<Border VerticalAlignment="Top" Grid.ColumnSpan="4" Height="1" Background="{StaticResource Border.Brush}" Grid.Row="0" />
<Border VerticalAlignment="Bottom" Grid.ColumnSpan="4" Height="1" Background="{StaticResource Border.Brush}" />
<Border HorizontalAlignment="Left" Background="{StaticResource Border.Brush}" Width="1" Grid.Column="0" />
<Border HorizontalAlignment="Left" Background="{StaticResource Border.Brush}" Width="1" Grid.Column="1" />
<Border HorizontalAlignment="Left" Background="{StaticResource Border.Brush}" Width="1" Grid.Column="2"/>
<Border HorizontalAlignment="Left" Background="{StaticResource Border.Brush}" Width="1" Grid.Column="3"/>
<Border HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Width="1" Grid.Column="3"/>
<TextBlock Grid.Column="0" Text="打包人" Style="{StaticResource middleTextBlock}"/>
<TextBlock Grid.Column="1" Text="任务量" Style="{StaticResource middleTextBlock}"/>
<TextBlock Grid.Column="2" Text="操作" Style="{StaticResource middleTextBlock}"/>
</Grid>
<StackPanel Grid.Row="1" Orientation="Vertical" Background="Transparent">
<ListBox Name="basic_Listbox"
ItemsSource="{Binding PackUserModelList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}"
BorderBrush="{StaticResource Border.Brush}"
BorderThickness="1,1,1,1"
Foreground="{StaticResource Text.Color}"
ScrollViewer.VerticalScrollBarVisibility="Auto"
>
<ListBox.ItemTemplate >
<DataTemplate>
<Grid Width="{Binding ActualWidth,ElementName=basic_Listbox,Converter={StaticResource widthConverter},ConverterParameter=-0}"
>
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="80"/>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="80"/>
</Grid.ColumnDefinitions>
<ComboBox BorderThickness="0" VerticalContentAlignment="Center" Grid.Column="0" ItemsSource="{Binding MemberList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="UserName" SelectedValuePath="Id" SelectedValue="{Binding SelectUserId}" Height="30"/>
<TextBox BorderThickness="0" VerticalContentAlignment="Center" Grid.Column="1" Height="30" Text="{Binding TaskCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
<c:BButton Foreground="Blue" BorderBrush="{StaticResource Border.Brush}" Background="Transparent" HorizontalAlignment="Stretch"
Command="{Binding DeleteServiceCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}, Path=ItemsSource}" Content="删除" Grid.Column="2"/>
<Border HorizontalAlignment="Left" Margin="-1 0 0 0" Grid.Column="1" Width="1" Background="{StaticResource Border.Brush}"/>
<Border HorizontalAlignment="Left" Margin="-1 0 0 0" Grid.Column="2" Width="1" Background="{StaticResource Border.Brush}"/>
<Border HorizontalAlignment="Left" Margin="-1 0 0 0" Grid.Column="3" Width="1" Background="{StaticResource Border.Brush}"/>
<Border VerticalAlignment="Bottom" Grid.ColumnSpan="4" Height="1" Background="{StaticResource Border.Brush}" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<c:BButton Content="添加" Foreground="Blue" BorderThickness="1" BorderBrush="{StaticResource Border.Brush}" Background="Transparent" HorizontalAlignment="Stretch"
Command="{Binding AddPackUserCommand}"
/>
</StackPanel>
</Grid>
<Grid Margin="20 10 20 0" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="耗材项目" Margin="0 0 5 0" Style="{StaticResource middleTextBlock}" />
<Border Background="Black" Grid.Column="1" VerticalAlignment="Center" Height="1"/>
</Grid>
<Grid Margin=" 20 10 20 0">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid Height="30" Background="{StaticResource Border.Background}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"/>
<ColumnDefinition/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="60"/>
</Grid.ColumnDefinitions>
<Border VerticalAlignment="Top" Grid.ColumnSpan="5" Height="1" Background="{StaticResource Border.Brush}" Grid.Row="0" />
<Border VerticalAlignment="Bottom" Grid.ColumnSpan="5" Height="1" Background="{StaticResource Border.Brush}" />
<Border HorizontalAlignment="Left" Background="{StaticResource Border.Brush}" Width="1" Grid.Column="0" />
<Border HorizontalAlignment="Left" Background="{StaticResource Border.Brush}" Width="1" Grid.Column="1" />
<Border HorizontalAlignment="Left" Background="{StaticResource Border.Brush}" Width="1" Grid.Column="2"/>
<Border HorizontalAlignment="Left" Background="{StaticResource Border.Brush}" Width="1" Grid.Column="3"/>
<Border HorizontalAlignment="Left" Background="{StaticResource Border.Brush}" Width="1" Grid.Column="4"/>
<Border HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Width="1" Grid.Column="4"/>
<TextBlock Grid.Column="0" Text="耗材类型" Style="{StaticResource middleTextBlock}"/>
<TextBlock Grid.Column="1" Text="耗材型号" Style="{StaticResource middleTextBlock}"/>
<TextBlock Grid.Column="2" Text="单价" Style="{StaticResource middleTextBlock}"/>
<StackPanel Orientation="Horizontal" Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="数量" Style="{StaticResource middleTextBlock}" />
<Button BorderThickness="0" Content="批量" Margin="5 0 0 0" VerticalAlignment="Center" Background="Transparent" Foreground="Blue"
Command="{Binding SetAllCountCommand}"
CommandParameter="{Binding ElementName=consumable_listBox}"
/>
</StackPanel>
<TextBlock Grid.Column="4" Text="操作" Style="{StaticResource middleTextBlock}"/>
</Grid>
<StackPanel Grid.Row="1" Grid.ColumnSpan="3" Orientation="Vertical" >
<ListBox Name="consumable_listBox"
ItemsSource="{Binding ConsumableServiceList}"
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}"
BorderBrush="{StaticResource Border.Brush}"
BorderThickness="1,1,1,0"
Foreground="{StaticResource Text.Color}"
ScrollViewer.VerticalScrollBarVisibility="Auto"
>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Width="{Binding ActualWidth,ElementName=consumable_listBox,Converter={StaticResource widthConverter},ConverterParameter=-0}"
>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"/>
<ColumnDefinition/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="60"/>
</Grid.ColumnDefinitions>
<ComboBox Margin="1" Grid.Column="0" BorderThickness="0" VerticalContentAlignment="Center" ItemsSource="{Binding ConsumableTypeList}" Text="{Binding ConsumableType}" Height="30"/>
<ComboBox Margin="1" Grid.Column="1" BorderThickness="0" VerticalContentAlignment="Center"
ItemsSource="{Binding ConsumableItemList}" Text="{Binding ConsumableItem}" DisplayMemberPath="ConsumableName"
SelectedValue="{Binding SelectId}" SelectedValuePath="ConsumableId" Height="30"/>
<Grid Grid.Column="2" Background="{StaticResource Border.Background}">
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding ConsumablePrice}"/>
</Grid>
<TextBox Margin="1" BorderThickness="0" VerticalContentAlignment="Center" Grid.Column="3" Height="30" Text="{Binding TaskCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
<c:BButton Foreground="Blue" BorderBrush="{StaticResource Border.Brush}" Background="Transparent" HorizontalAlignment="Stretch"
Command="{Binding DeleteServiceCommand}"
Visibility="{Binding DataContext.IsConsumableTypeListEnable,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type c:BWindow}},Converter={StaticResource objConverter},ConverterParameter=true:Visible:Collapsed}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}, Path=ItemsSource}" Content="删除" Grid.Column="4"/>
<Border HorizontalAlignment="Left" Margin="-1 0 0 0" Grid.Column="1" Width="1" Background="{StaticResource Border.Brush}"/>
<Border HorizontalAlignment="Left" Margin="-1 0 0 0" Grid.Column="2" Width="1" Background="{StaticResource Border.Brush}"/>
<Border HorizontalAlignment="Left" Margin="-1 0 0 0" Grid.Column="3" Width="1" Background="{StaticResource Border.Brush}"/>
<Border HorizontalAlignment="Left" Margin="-1 0 0 0" Grid.Column="4" Width="1" Background="{StaticResource Border.Brush}"/>
<Border Visibility="Visible" VerticalAlignment="Bottom" Grid.ColumnSpan="5" Height="1" Background="{StaticResource Border.Brush}" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<c:BButton Content="添加" Foreground="Blue" BorderThickness="1" BorderBrush="{StaticResource Border.Brush}" Background="Transparent" HorizontalAlignment="Stretch"
Visibility="{Binding IsConsumableTypeListEnable,Converter={StaticResource objConverter},ConverterParameter=true:Visible:Collapsed}" Command="{Binding AddConsumableCommand}"
/>
</StackPanel>
</Grid>
<Border BorderThickness="1" Height="40" Margin="20,10,20,10" BorderBrush="{StaticResource Border.Brush}">
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource middleTextBlock}" Margin="10 0 0 0">
<Run Text="耗材收费:"/>
<Run Text="{Binding ConsumableFees}"/>
</TextBlock>
</StackPanel>
</Border>
<Grid Margin="20 10 20 0" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="其他设置" Margin="0 0 5 0" Style="{StaticResource middleTextBlock}" />
<Border Background="Black" Grid.Column="1" VerticalAlignment="Center" Height="1"/>
</Grid>
<Grid Grid.Row="1" HorizontalAlignment="Stretch" Margin="20 10 20 10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition/>
<ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions>
<TextBlock Text="打印机: " VerticalAlignment="Center" HorizontalAlignment="Right"/>
<Border BorderThickness="1" CornerRadius="0" Grid.Column="1" BorderBrush="{StaticResource Border.Brush}" Height="30" >
<ComboBox Name="cbPrintName" BorderThickness="0" Width="270" Height="30" HorizontalAlignment="Stretch" ItemsSource="{Binding PrintList}" Text="{Binding PrintName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
</Border>
<c:BButton Grid.Column="2" Content="打印" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch"
Click="BButton_Click"
/>
</Grid>
</StackPanel>
</ScrollViewer.Content>
</ScrollViewer>
</Grid>
<Grid Grid.Row="1" Grid.Column="1" Visibility="Hidden">
<StackPanel Orientation="Vertical" Name="printArea" Width="1065" Height="800">
<StackPanel Orientation="Horizontal">
<Grid Margin="20 5 0 0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="200">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Image Height="60" Width="200" Source="{Binding TaskImage}"/>
<TextBlock Grid.Row="1" FontSize="18" Style="{StaticResource middleTextBlock}" Text="{Binding TaskId}"/>
</Grid>
<TextBlock Text="摆放地托编号:" FontSize="24" FontWeight="Bold" Style="{StaticResource middleTextBlock}" Margin="20 0 0 0"/>
<TextBlock Text="{Binding FloorDragNumber}" FontSize="24" FontWeight="Bold" Style="{StaticResource middleTextBlock}" Margin="20 0 0 0"/>
<TextBlock Text="打包人:" FontSize="24" FontWeight="Bold" Style="{StaticResource middleTextBlock}" Margin="20 0 0 0"/>
<TextBlock Text="{Binding PackUserName}" FontSize="24" FontWeight="Bold" Style="{StaticResource middleTextBlock}" Margin="20 0 0 0"/>
<TextBlock Text="截止时间:" FontSize="24" FontWeight="Bold" Style="{StaticResource middleTextBlock}" Margin="20 0 0 0"/>
<TextBlock Text="{Binding PackTaskModel.PackCompletionOverTime,StringFormat=yyyy-MM-dd HH:mm}" FontSize="24" FontWeight="Bold" Style="{StaticResource middleTextBlock}" Margin="20 0 0 0"/>
</StackPanel>
<Grid Margin="20 5 20 5">
<Grid.RowDefinitions>
<RowDefinition Height="35"/>
<RowDefinition />
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="280"/>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="90"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition MinWidth="100"/>
</Grid.ColumnDefinitions>
<TextBlock Text="商品信息" Style="{StaticResource middleTextBlock}"/>
<TextBlock Text="数量" Grid.Column="1" Style="{StaticResource middleTextBlock}"/>
<TextBlock Text="组合类型" Grid.Column="2" Style="{StaticResource middleTextBlock}"/>
<TextBlock Text="SKU配件商品" Grid.Column="3" Style="{StaticResource middleTextBlock}"/>
<TextBlock Text="打包需求" Grid.Column="4" Style="{StaticResource middleTextBlock}"/>
<TextBlock Text="落仓" Grid.Column="5" Style="{StaticResource middleTextBlock}"/>
<TextBlock Text="合格证位置" Grid.Column="6" Style="{StaticResource middleTextBlock}"/>
<TextBlock Text="注意事项/对接备注" Grid.Column="7" Style="{StaticResource middleTextBlock}"/>
<Border Width="1" HorizontalAlignment="Left" Background="{StaticResource Border.Brush}" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="1" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="2" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="3" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="4" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="5" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="6" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="7" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="8" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="9" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="10"/>
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="11" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="12"/>
<Border Height="1" VerticalAlignment="Top " Background="{StaticResource Border.Brush}" Grid.ColumnSpan="9"/>
</Grid>
<!--ItemsSource="{Binding OrderList}"-->
<ListBox x:Name="listbox_order"
Grid.Row="7"
ItemsSource="{Binding PackTaskList}"
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}"
BorderBrush="{StaticResource Border.Brush}"
BorderThickness="0,1,0,0"
Foreground="{StaticResource Text.Color}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Width="{Binding ActualWidth,ElementName=listbox_order,Converter={StaticResource widthConverter},ConverterParameter=-0}"
MinHeight="100">
<Grid.RowDefinitions>
<RowDefinition MinHeight="90"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="280"/>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="90"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition MinWidth="100"/>
</Grid.ColumnDefinitions>
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="90"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<!--{Binding Logo}-->
<c:BAsyncImage UrlSource="{Binding ItemList[0].Logo}"
Width="80" DecodePixelWidth="80"
VerticalAlignment="Top" Margin="11,9,0,10"
Cursor="Hand">
</c:BAsyncImage>
<StackPanel Grid.Column="1" Orientation="Vertical" Margin="8,9,0,10">
<TextBlock Foreground="{StaticResource Text.Gray}" TextWrapping="Wrap">
<TextBlock.ToolTip>
<ToolTip Style="{StaticResource OrderCouponToolipStyle}">
<TextBlock Text="{Binding ItemList[0].SkuName}"/>
</ToolTip>
</TextBlock.ToolTip>
<Run Text="SKU名称:"/>
<Run Text="{Binding ItemList[0].SkuName}"/>
</TextBlock>
<TextBlock Foreground="{StaticResource Text.Gray}" TextWrapping="Wrap" Margin="0,11">
<Run Text="品名:"/>
<Run Text="{Binding ItemList[0].BrandName}"/>
</TextBlock>
<StackPanel Orientation="Horizontal">
<TextBlock Text="店铺:"/>
<c:BButton Content="{Binding ShopName}" Style="{StaticResource LinkButton}" HorizontalAlignment="Left" VerticalAlignment="Center"
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Page}}}"
CommandParameter="{Binding ShopName}"
Margin=" 5,0,7,0"/>
</StackPanel>
</StackPanel>
</Grid>
<Grid Grid.Column="1" >
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock x:Name="txt_storeName"
Text="{Binding SkuCount}"
TextWrapping="Wrap"
HorizontalAlignment="Center"
/>
</StackPanel>
</Grid>
<Grid Grid.Column="2" >
<StackPanel VerticalAlignment="Center" >
<StackPanel Margin="5" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" >
<TextBlock Text="组合类型:"/>
<TextBlock Text="{Binding PackType}"/>
</StackPanel>
<StackPanel Margin="5" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" >
<TextBlock Text="配件数量:"/>
<TextBlock Text="{Binding GoodsNumber}"/>
</StackPanel>
</StackPanel>
</Grid>
<Grid Grid.Column="3" >
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock
Text="{Binding SkuTitle}"
TextWrapping="Wrap"
HorizontalAlignment="Center"
/>
</StackPanel>
</Grid>
<Grid Grid.Column="4" >
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Left">
<StackPanel Margin="5" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" >
<TextBlock Text="基础打包:"/>
<TextBlock Text="{Binding BasicPack}"/>
</StackPanel>
<Grid Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left" >
<TextBlock TextWrapping="Wrap">
<Run Text="增量耗材:"/>
<Run Text="{Binding Increment1}"/>
</TextBlock>
</Grid>
</StackPanel>
</Grid>
<Grid Grid.Column="5" >
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock
Text="{Binding PositionType}"
TextWrapping="Wrap"
HorizontalAlignment="Center"
/>
</StackPanel>
</Grid>
<Grid Grid.Column="6" >
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock
Text="{Binding CertificatePosition}"
TextWrapping="Wrap"
HorizontalAlignment="Center"
/>
</StackPanel>
</Grid>
<Grid Grid.Column="7" >
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock
Text="{Binding MarkMessage}"
TextWrapping="Wrap"
HorizontalAlignment="Center"
/>
</StackPanel>
</Grid>
<Border Width="1" HorizontalAlignment="Left" Background="{StaticResource Border.Brush}" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="1" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="2" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="3" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="4" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="5" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="6" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="7" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="8" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="9" />
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="10" />
</Grid>
<Border Grid.Row="1" VerticalAlignment="Bottom" Height="1" Background="{StaticResource Border.Brush}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
<local:MinFeesExcelControl Margin="20 0 20 0" IsMin="true"
Visibility="{Binding PackTaskModel.IsShowFees,Converter={StaticResource objConverter},ConverterParameter=false:Collapsed:Visible}"
FeesItem="{Binding PackTaskModel.FeesItemResponse,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
/>
<StackPanel Orientation="Horizontal" Margin="20 0 0 0" Visibility="{Binding PackTaskModel.CertificateModel,Mode=TwoWay,Converter={StaticResource objConverter},ConverterParameter=#null:Collapsed:Visible}">
<ListBox ItemsSource="{Binding PackTaskModel.CertificateModel,Mode=TwoWay}"
Style="{StaticResource NoScrollViewListBoxStyle}"
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}"
>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<local:MinCerControl model="{Binding }"
Visibility="{Binding Id ,Mode=TwoWay,Converter={StaticResource objConverter},ConverterParameter=0:Collapsed:Visible}"
/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
<local:MinBarcodeControl Grid.Row="1" BarcodeImage="{Binding BarcodeImage,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" model="{Binding PackTaskModel.BarCodeModel, Mode=TwoWay}" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="20 0 0 0" Width="250" Height="190"
Visibility="{Binding PackTaskModel.BarCodeModel,Mode=TwoWay,Converter={StaticResource objConverter},ConverterParameter=#null:Collapsed:Visible}"
/>
</StackPanel>
</Grid>
<Border Height="1" Background="{StaticResource Border.Brush}" VerticalAlignment="Top" Grid.Row="2"/>
<Grid Grid.Row="2" >
<StackPanel HorizontalAlignment="Left" Margin="20 0 0 0" VerticalAlignment="Center" >
<TextBlock Style="{StaticResource middleTextBlock}">
<Run Text="总收费:"/>
<Run Text="{Binding AllFees}"/>
</TextBlock>
</StackPanel>
<c:BButton Grid.Row="2" Content="确定" Margin="0 0 20 0" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch"
Command="{Binding UpLoadPackCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"
/>
</Grid>
</Grid>
</c:BWindow>

102
BBWY.Client/Views/PackTask/PackDetailWindow.xaml.cs

@ -0,0 +1,102 @@
using BBWY.Client.Helpers;
using BBWY.Client.Models;
using BBWY.Client.ViewModels.PackTask;
using BBWY.Controls;
using System;
using System.Collections.Generic;
using System.IO;
using System.Printing;
using System.Reflection;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace BBWY.Client.Views.PackTask
{
/// <summary>
/// PackDetailWindow.xaml 的交互逻辑
/// </summary>
public partial class PackDetailWindow : BWindow
{
public PackDetailWindow(PackTaskModel model, Action reflashWindow)
{
InitializeComponent();
var serviceViewModel = this.DataContext as PackDetailViewModel;
//加载数据
if (model.BarCodeModel != null)
{
model.BarCodeModel.ShopName = model.ShopName;
}
serviceViewModel.PackTaskModel = model;
serviceViewModel.PackTaskList = new System.Collections.ObjectModel.ObservableCollection<PackTaskModel> { model};
serviceViewModel.FloorDragNumber = model.FloorDragNumber;
serviceViewModel.TaskCount = model.SkuCount;
serviceViewModel.TaskId = model.TaskId;
serviceViewModel.OrderId = model.OrderId;
serviceViewModel.SkuId = model.SkuId;
serviceViewModel.PackUserName = model.PackUser?.Replace("\r\n", ",")?.Replace("\n", ",")?.Replace("\r", ",");
serviceViewModel.LoadPackDatas();
if (reflashWindow != null)
serviceViewModel.ReflashWindow = reflashWindow;
}
private void BButton_Click(object sender, RoutedEventArgs e)
{
var localPrintServer = new LocalPrintServer();
string printName = cbPrintName.Text.Trim();
if (string.IsNullOrEmpty(printName))
{
System.Windows.MessageBox.Show("选择打印机");
return;
}
var printQueue = localPrintServer.GetPrintQueue(printName);
if (printQueue.IsInError)
{
System.Windows.MessageBox.Show("打印机处于错误状态");
return;
}
MyPrintHelper.SetDefaultPrint(printName);//设置默认打印机
this.printArea.Arrange(new Rect(new Point(0, 0), new Size(printArea.ActualWidth, printArea.ActualHeight)));
System.Windows.Controls.PrintDialog printDialog = new PrintDialog();
//设置纸张大小
var pageWidth = (int)Math.Ceiling(printDialog.PrintableAreaWidth);
var pageHeight = (int)Math.Ceiling(printDialog.PrintableAreaHeight);
printDialog.PrintTicket.PageMediaSize = new PageMediaSize(pageWidth, pageHeight);
printDialog.PrintVisual(this.printArea, "打印任务");
var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string printNames = System.IO.Path.Combine(applicationPath, "printName.init");
try
{
if (File.Exists(printNames))
{
File.Delete(printNames);
}
}
catch
{
}
File.WriteAllText(printNames, cbPrintName.Text);
}
}
}
Loading…
Cancel
Save