diff --git a/BBWY.Client/APIServices/QiKu/PackTaskService.cs b/BBWY.Client/APIServices/QiKu/PackTaskService.cs index 4a4fedb1..ab5511d9 100644 --- a/BBWY.Client/APIServices/QiKu/PackTaskService.cs +++ b/BBWY.Client/APIServices/QiKu/PackTaskService.cs @@ -25,10 +25,10 @@ namespace BBWY.Client.APIServices { } - + public ApiResponse GetTaskList(string skuId = null, string taskId = null, - + TaskState? TaskState = null, int pageIndex = 1, int pageSize = 10 @@ -56,7 +56,7 @@ namespace BBWY.Client.APIServices ShopId = globalContext.User.Shop.ShopId.ToString() }, null, HttpMethod.Post); } - public ApiResponse GetWareHouseList(string WayBillNo = null, string SourceExpressName = null, string departmentName = null, string skuId = null, string taskId = null, + public ApiResponse GetWareHouseList(string WayBillNo = null, string SourceExpressName = null, string departmentName = null, string skuId = null, string taskId = null, TaskState? TaskState = null, string ShopName = null, @@ -161,7 +161,7 @@ namespace BBWY.Client.APIServices , null, HttpMethod.Post); } - + public ApiResponse SaveBarCode(BarCodeRequest barCodeModel) { @@ -279,23 +279,39 @@ namespace BBWY.Client.APIServices /// /// /// - public ApiResponse> GetPurchaseExpressOrderList(string orderId,string sourceSkuId) + public ApiResponse> GetPurchaseExpressOrderList(string orderId, string sourceSkuId) { - return SendRequest>("http://bbwyb.qiyue666.com", $"Api/Order/GetPurchaseExpressOrderList", new { + return SendRequest>("http://bbwyb.qiyue666.com", $"Api/Order/GetPurchaseExpressOrderList", new + { orderId, sourceSkuId }, null, HttpMethod.Post); } + /// + /// 批量手动发货 + /// + /// + /// + /// + public ApiResponse> BatchManualSign(string[] wayBillNoList) + { + return SendRequest>("http://bbwyb.qiyue666.com", $"Api​/PurchaseOrder​/BatchManualSign", new + { + wayBillNoList + }, null, HttpMethod.Post); + } + /// /// 查询超时任务列表 /// /// /// - public ApiResponse SearchOverTimeTaskList(string ShopId, DateTime? StartTime, DateTime? EndTime,OverTimeTaskState overTimeTaskState, OverTimeTaskType? OverTimeTaskType, int? PageIndex, int? PageSize=20) + public ApiResponse SearchOverTimeTaskList(string ShopId, DateTime? StartTime, DateTime? EndTime, OverTimeTaskState overTimeTaskState, OverTimeTaskType? OverTimeTaskType, int? PageIndex, int? PageSize = 20) { - return SendRequest(globalContext.QKApiHost, $"api/PackTask/SearchOverTimeTaskList", new { + return SendRequest(globalContext.QKApiHost, $"api/PackTask/SearchOverTimeTaskList", new + { ShopId, StartTime, EndTime, @@ -306,6 +322,17 @@ namespace BBWY.Client.APIServices }, null, HttpMethod.Post); } + public ApiResponse SubmitOverTimeMarkMsg(OverTimeTaskType OverTimeTaskType, long Id, string MarkMsg) + { + return SendRequest(globalContext.QKApiHost, $"api/PackTask/SubmitOverTimeMarkMsg", new + { + OverTimeTaskType, + Id, + MarkMsg, + }, null, HttpMethod.Post); + } + + } public class CompeteSealBox diff --git a/BBWY.Client/APIServices/QiKu/SealBoxService.cs b/BBWY.Client/APIServices/QiKu/SealBoxService.cs index c66b54c0..2d93496c 100644 --- a/BBWY.Client/APIServices/QiKu/SealBoxService.cs +++ b/BBWY.Client/APIServices/QiKu/SealBoxService.cs @@ -171,7 +171,7 @@ namespace BBWY.Client.APIServices - public ApiResponse SetFallWareConfigure(long SealBoxId, string ProductTitle, string PurchaseOrder, string PrewOrder, string WaybillNo, string providerName = "", string wareName = "",string WareCity="") + public ApiResponse SetFallWareConfigure(long SealBoxId, string ProductTitle, string PurchaseOrder, string PrewOrder, string WaybillNo, string providerName = "", string wareName = "",string WareCity="",DateTime? TransportOverTime=null) { return SendRequest(globalContext.QKApiHost, $"api/SealBox/SetFallWareConfigure", new @@ -183,7 +183,8 @@ namespace BBWY.Client.APIServices WaybillNo, providerName, wareName, - WareCity + WareCity, + TransportOverTime } , null, HttpMethod.Post); } @@ -287,5 +288,21 @@ namespace BBWY.Client.APIServices return SendRequest(globalContext.QKApiHost, $"api/SealBox/WareCompetedWaitCompleted?sealBoxId={sealBoxId}", null, null, HttpMethod.Post); } + + /// + /// 获取揽收单信息 + /// + /// + public ApiResponse GetWareLSAcceptOrder() + { + return SendRequest(globalContext.QKApiHost, $"api/WareLSAcceptOrder/GetWareLSAcceptOrder", + null, null, HttpMethod.Get); + } + + public ApiResponse GetWareLSOrderPurchaseList(string PrewOrder) + { + return SendRequest(globalContext.QKApiHost, $"api/WareLSAcceptOrder/GetWareLSOrderPurchaseList?PrewOrder={PrewOrder}", + null, null, HttpMethod.Get); + } } } diff --git a/BBWY.Client/BBWY.Client.csproj b/BBWY.Client/BBWY.Client.csproj index 36e0e5dc..e6f8759e 100644 --- a/BBWY.Client/BBWY.Client.csproj +++ b/BBWY.Client/BBWY.Client.csproj @@ -17,10 +17,18 @@ x64 + + + + + + + + @@ -62,6 +70,7 @@ Never + @@ -84,18 +93,6 @@ - - - - - - - - - - - - diff --git a/BBWY.Client/Models/APIModel/Request/BatchUpdateSealBoxConfiguredRequest.cs b/BBWY.Client/Models/APIModel/Request/BatchUpdateSealBoxConfiguredRequest.cs index 642e94b4..f96493f6 100644 --- a/BBWY.Client/Models/APIModel/Request/BatchUpdateSealBoxConfiguredRequest.cs +++ b/BBWY.Client/Models/APIModel/Request/BatchUpdateSealBoxConfiguredRequest.cs @@ -30,6 +30,11 @@ namespace BBWY.Client.Models.APIModel public class SealBoxConfiguredWareHourseRequest : WareHourseData { + + /// + ///封箱id + /// + public long? SealBoxId { get; set; } /// ///待封箱 = 0, 待落仓 = 1, 待完结 = 2 /// diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs index b669a320..9484ab38 100644 --- a/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs @@ -178,10 +178,16 @@ namespace BBWY.Client.Models.APIModel public DateTime? PackCompletionOverTime { get; set; } - ///// - ///// 物流信息 - ///// - //public List ExpressOrderList { get; set; } + + /// + /// 质检超时备注信息 + /// + public string QualityOverTimeMarkMsg { get; set; } + + /// + /// 打包超时备注信息 + /// + public string PackOverTimeMarkMsg { get; set; } } public class ExpressOrderResponse { diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/SearchWaitFallWareResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/SearchWaitFallWareResponse.cs index 3e9f1bb6..19e76826 100644 --- a/BBWY.Client/Models/APIModel/Response/PackTask/SearchWaitFallWareResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackTask/SearchWaitFallWareResponse.cs @@ -173,6 +173,11 @@ namespace BBWY.Client.Models.APIModel /// public string ProviderName { get; set; } + /// + /// 仓库所在的城市 + /// + public string WareCity { get; set; } + } } diff --git a/BBWY.Client/Models/APIModel/Response/SealBox/GetJDSupplierNameAndStoreNameResponse.cs b/BBWY.Client/Models/APIModel/Response/SealBox/GetJDSupplierNameAndStoreNameResponse.cs index 53ec68e1..0958605d 100644 --- a/BBWY.Client/Models/APIModel/Response/SealBox/GetJDSupplierNameAndStoreNameResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/SealBox/GetJDSupplierNameAndStoreNameResponse.cs @@ -7,5 +7,7 @@ public string StoreId { get; set; } public string StoreName { get; set; } + + public string City { get; set; } } } diff --git a/BBWY.Client/Models/APIModel/Response/SealBox/GetWareLSAcceptOrderResponse.cs b/BBWY.Client/Models/APIModel/Response/SealBox/GetWareLSAcceptOrderResponse.cs new file mode 100644 index 00000000..bff8ee99 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/SealBox/GetWareLSAcceptOrderResponse.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel +{ + public class GetWareLSAcceptOrderResponse + { + /// + /// 客户名称 + /// + public string CustomerName { get; set; } + /// + /// 提货地址 + /// + public string AcceptAdress { get; set; } + /// + /// 客户联系人 + /// + public string CustomerUserName { get; set; } + /// + /// 客户电话 + /// + public string CustomerPhoneNumber { get; set; } + /// + /// 揽收任务号 + /// + public string LSTaskNumber { get; set; } + /// + /// 始发TC + /// + public string StartTC { get; set; } + + /// + /// JD运输联系人 + /// + public string JDTransportUserName { get; set; } + } +} diff --git a/BBWY.Client/Models/APIModel/Response/SealBox/GetWareLSOrderPurchaseResponse.cs b/BBWY.Client/Models/APIModel/Response/SealBox/GetWareLSOrderPurchaseResponse.cs new file mode 100644 index 00000000..31af4963 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/SealBox/GetWareLSOrderPurchaseResponse.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel +{ + public class GetWareLSOrderPurchaseResponse + { + /// + /// 总封箱数 + /// + public int TotalSealBoxCount { get; set; } + + /// + /// TC收货总箱数 + /// + public int TotalTCAcceptBoxCount { get; set; } + + /// + /// 采购单列表 + /// + public IList GetWareLSOrderPurchases { get; set; } + } + + public class GetWareLSOrderPurchase + { + /// + /// 序号(1-10) + /// + public int Index { get; set; } + + /// + /// 采购订单号 + /// + public string PurchaseOrder { get; set; } + + /// + /// 封箱数 + /// + public int? SealBoxCount { get; set; } + + /// + /// 目的城市 + /// + public string WareCity { get; set; } + + /// + /// TC收货箱数 + /// + public int? TCAcceptBoxCount { get; set; } + + + /// + /// 供应商 + /// + public string ProviderName { get; set; } + + /// + /// 预约单号 + /// + public string PrewOrder { get; set; } + + /// + /// 目的城市-仓库 + /// + public string WareName { get; set; } + + /// + /// 商品数量 + /// + public int ProductCount { get; set; } + + /// + /// 商品名称 + /// + public string ProductTitle { get; set; } + + } +} diff --git a/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxResponse.cs b/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxResponse.cs index 092cb437..a42d459d 100644 --- a/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxResponse.cs @@ -57,6 +57,11 @@ namespace BBWY.Client.Models.APIModel /// public List SealBoxSkus { get; set; } + /// + /// 封箱超时备注 + /// + public string SealBoxPackOverTimeMarkMsg { get; set; } + } public class WareSealBoxSku diff --git a/BBWY.Client/Models/APIModel/Response/SealBox/GetWareWaitTransportResponse.cs b/BBWY.Client/Models/APIModel/Response/SealBox/GetWareWaitTransportResponse.cs index b521b9e4..3577158a 100644 --- a/BBWY.Client/Models/APIModel/Response/SealBox/GetWareWaitTransportResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/SealBox/GetWareWaitTransportResponse.cs @@ -15,6 +15,11 @@ namespace BBWY.Client.Models.APIModel } public class WareWaitTransport:NotifyObject { + + private string transportOverTimeMarkMsg; + public string TransportOverTimeMarkMsg { get => transportOverTimeMarkMsg; set { Set(ref transportOverTimeMarkMsg, value); } } + + private string waitTransportRemainTime; public string WaitTransportRemainTime { get => waitTransportRemainTime; set { Set(ref waitTransportRemainTime, value); } } diff --git a/BBWY.Client/Models/FallWare/FallWareConfiguredModel.cs b/BBWY.Client/Models/FallWare/FallWareConfiguredModel.cs index 27948b13..039788c2 100644 --- a/BBWY.Client/Models/FallWare/FallWareConfiguredModel.cs +++ b/BBWY.Client/Models/FallWare/FallWareConfiguredModel.cs @@ -56,15 +56,20 @@ namespace BBWY.Client.Models.FallWare /// 仓库任务列表 /// public IList SealBoxConfigureTasks { get; set; } + private string setPurchaseOrderOverTimeMarkMsg; + public string SetPurchaseOrderOverTimeMarkMsg { get => setPurchaseOrderOverTimeMarkMsg; set { Set(ref setPurchaseOrderOverTimeMarkMsg, value); } } - - - + private string fallWareRemainTime; public string FallWareRemainTime { get => fallWareRemainTime; set { Set(ref fallWareRemainTime, value); } } private bool isFallWareOverTime; public bool IsFallWareOverTime { get => isFallWareOverTime; set { Set(ref isFallWareOverTime, value); } } + + /// + /// 预约时间 + /// + public DateTime? TransportOverTime { get; set; } } public class FallWareConfigureTask : SealBoxConfigureTask { diff --git a/BBWY.Client/Models/PackTask/PackTaskModel.cs b/BBWY.Client/Models/PackTask/PackTaskModel.cs index 63bb718d..239593f7 100644 --- a/BBWY.Client/Models/PackTask/PackTaskModel.cs +++ b/BBWY.Client/Models/PackTask/PackTaskModel.cs @@ -420,6 +420,19 @@ namespace BBWY.Client.Models public string ShopName { get => shopName; set { Set(ref shopName, value); } } + private string qualityOverTimeMarkMsg; + /// + /// 质检超时备注信息 + /// + public string QualityOverTimeMarkMsg { get => qualityOverTimeMarkMsg; set { Set(ref qualityOverTimeMarkMsg, value); } } + + private string packOverTimeMarkMsg; + /// + /// 打包超时备注信息 + /// + public string PackOverTimeMarkMsg { get => packOverTimeMarkMsg; set { Set(ref packOverTimeMarkMsg, value); } } + + } public class SkuMessage : NotifyObject diff --git a/BBWY.Client/Models/PackTask/SealBoxModel.cs b/BBWY.Client/Models/PackTask/SealBoxModel.cs index 075d2c6e..27915440 100644 --- a/BBWY.Client/Models/PackTask/SealBoxModel.cs +++ b/BBWY.Client/Models/PackTask/SealBoxModel.cs @@ -60,5 +60,13 @@ namespace BBWY.Client.Models.PackTask private bool isSealBoxOverTime; public bool IsSealBoxOverTime { get => isSealBoxOverTime; set { Set(ref isSealBoxOverTime, value); } } + + + private string sealBoxPackOverTimeMarkMsg; + + /// + /// 封箱超时备注 + /// + public string SealBoxPackOverTimeMarkMsg { get => sealBoxPackOverTimeMarkMsg; set { Set(ref sealBoxPackOverTimeMarkMsg, value); } } } } diff --git a/BBWY.Client/Models/SealBox/SealBoxConfigureModel.cs b/BBWY.Client/Models/SealBox/SealBoxConfigureModel.cs index eb384976..bf1b757a 100644 --- a/BBWY.Client/Models/SealBox/SealBoxConfigureModel.cs +++ b/BBWY.Client/Models/SealBox/SealBoxConfigureModel.cs @@ -72,6 +72,11 @@ namespace BBWY.Client.Models.SealBox /// public PositionState? WareState { get; set; } + /// + ///封箱id + /// + public long? SealBoxId { get; set; } + } diff --git a/BBWY.Client/Resources/Images/jdwl.png b/BBWY.Client/Resources/Images/jdwl.png new file mode 100644 index 00000000..c1c96239 Binary files /dev/null and b/BBWY.Client/Resources/Images/jdwl.png differ diff --git a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs index ac7e5f88..d66ed015 100644 --- a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs @@ -29,6 +29,7 @@ using BBWY.Client.Models.SealBox; using BBWY.Client.ViewModels.SealBox; using BBWY.Client.Views.FallWare; using BBWY.Client.Models.FallWare; +using BBWY.Client.Views.TaskOverTime; namespace BBWY.Client.ViewModels.PackTask { @@ -258,6 +259,17 @@ namespace BBWY.Client.ViewModels.PackTask SealBoxConfigureType = SealBoxConfigureType.待配置; SetFallWareConfiguredCommand = new RelayCommand(SetFallWareConfigured); + + SubmitOverTimeMarkMsgCommand = new RelayCommand(SubmitOverTimeMarkMsg); + } + + private void SubmitOverTimeMarkMsg(object param) + { + var paramList = (object[])param; + var id = (long)paramList[0]; + var markMsg = paramList[1].ToString(); + SubmitOverTimeMarkMsgWindow submitOverTimeMarkMsgWindow = new SubmitOverTimeMarkMsgWindow(OverTimeTaskType.待落仓, id, markMsg, packTaskService, ReflashTask) ; + submitOverTimeMarkMsgWindow.Show(); } private void SetFallWareConfigured(object obj) @@ -274,13 +286,14 @@ 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); + var w = new SetJDWareBoxWindow2(model, sealBoxService, fallware.WareType.Value, ReflashTask,fallware.TransportOverTime); w.ShowDialog(); //} //if (fallware.WareType == WareType.云仓) @@ -399,6 +412,11 @@ namespace BBWY.Client.ViewModels.PackTask #region 事件绑定 + + /// + /// 提交过期时间数据 + /// + public ICommand SubmitOverTimeMarkMsgCommand { get; set; } /// /// 设置落仓配置信息(上传材料) /// diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index 06b1adba..48fcd228 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs @@ -28,6 +28,7 @@ using WebSocketSharp; using System.Threading; using BBWY.Client.Helpers; using System.Diagnostics.Eventing.Reader; +using BBWY.Client.Views.TaskOverTime; namespace BBWY.Client.ViewModels.PackTask { @@ -45,7 +46,7 @@ namespace BBWY.Client.ViewModels.PackTask private DateTime endTime; public DateTime EndTime { get => endTime; set { Set(ref endTime, value); } } - + public IList OverTimeTaskResponses { get; set; } @@ -72,7 +73,7 @@ namespace BBWY.Client.ViewModels.PackTask /// public ObservableCollection OverTimeTaskStateList { get => overTimeTaskStateList; set { Set(ref overTimeTaskStateList, value); } } - + private OverTimeTaskType overTimeTaskType = OverTimeTaskType.全部; /// @@ -80,7 +81,7 @@ namespace BBWY.Client.ViewModels.PackTask /// public OverTimeTaskType OverTimeTaskType { get => overTimeTaskType; set { Set(ref overTimeTaskType, value); } } - private OverTimeTaskState overTimeTaskState = OverTimeTaskState.全部; + private OverTimeTaskState overTimeTaskState = OverTimeTaskState.全部; /// /// 任务类型(超时) /// @@ -342,7 +343,7 @@ namespace BBWY.Client.ViewModels.PackTask SearchTaskCommand = new RelayCommand(() => { - SearchTaskList(); //手动点击查询订单 + SearchTaskList(); //手动点击查询订单 }); TaskPageIndexChangedCommand = new RelayCommand(p => { @@ -369,7 +370,7 @@ namespace BBWY.Client.ViewModels.PackTask PositionState = PositionState.待落仓; SetSealBoxConfigureTypeCommand = new RelayCommand(s => { - + SealBoxConfigureType = s; PositionState = s == SealBoxConfigureType.已配置 ? PositionState.已配置待落仓 : PositionState.待落仓; SearchTaskList(); @@ -389,7 +390,7 @@ namespace BBWY.Client.ViewModels.PackTask SetWareTypeCommand = new RelayCommand(s => { - + SelectWareType = s; SearchTaskList(); }); @@ -397,7 +398,143 @@ namespace BBWY.Client.ViewModels.PackTask CompeteWaitTransportCommand = new RelayCommand(CompeteWaitTransport); CompeteWaitCompletedCommand = new RelayCommand(CompeteWaitCompleted); + PrintSealBoxDetailsCommand = new RelayCommand(PrintSealBoxDetails); + + PrintLSOrderConfigureCommand = new RelayCommand(PrintLSOrderConfigure); + + LookLSOrderConfigureCommand = new RelayCommand(LookLSOrderConfigure); + SubmitOverTimeMarkMsgCommand = new RelayCommand(SubmitOverTimeMarkMsg); + } + + private void SubmitOverTimeMarkMsg(object param) + { + + var paramList = (object[])param; + var id = (long)paramList[0]; + var markMsg = paramList[1]?.ToString(); + + + OverTimeTaskType overTimeTaskType= OverTimeTaskType.待验收; + switch (TaskState.Value) + { + case Models.TaskState.待验收: + overTimeTaskType = Models.OverTimeTaskType.待验收; + break; + case Models.TaskState.待打包: + overTimeTaskType = Models.OverTimeTaskType.待打包; + break; + case Models.TaskState.待封箱: + overTimeTaskType = Models.OverTimeTaskType.待封箱; + break; + case Models.TaskState.待落仓: + overTimeTaskType = Models.OverTimeTaskType.待落仓; + break; + case Models.TaskState.待转运: + overTimeTaskType = Models.OverTimeTaskType.待转运; + break; + } + + SubmitOverTimeMarkMsgWindow submitOverTimeMarkMsgWindow = new SubmitOverTimeMarkMsgWindow(overTimeTaskType, id, markMsg, packTaskService, ReflashTask); + submitOverTimeMarkMsgWindow.Show(); + } + + private void LookLSOrderConfigure(object obj) + { + var model = obj as WaitFallWareModel; + + if (model.WareType != WareType.京仓) + { + System.Windows.MessageBox.Show($"{model.WareType}没有揽收单,只有京仓才有揽收单."); + return; + } + + if (model.BoxConfigureData == null || model.BoxConfigureData.PrewOrder.IsNullOrEmpty()) + { + System.Windows.MessageBox.Show($"预约单号为空,无法查看"); + return; + } + + var lsdTaskMsgRes = sealBoxService.GetWareLSAcceptOrder(); + if (!lsdTaskMsgRes.Success) + { + System.Windows.MessageBox.Show($"获取任务信息失败,原因:{lsdTaskMsgRes.Msg}"); + return; + + } + var lsdTaskMsg = lsdTaskMsgRes.Data; + + var LSOrderPurchaseListRes = sealBoxService.GetWareLSOrderPurchaseList(model.BoxConfigureData.PrewOrder); + if (!LSOrderPurchaseListRes.Success) + { + System.Windows.MessageBox.Show($"获取货物信息失败,原因:{LSOrderPurchaseListRes.Msg}"); + return; + + } + + var data = LSOrderPurchaseListRes.Data; + + + List lookData = null; + if (data.GetWareLSOrderPurchases.Count > 10) + { + lookData = data.GetWareLSOrderPurchases.ToList().GetRange(0, 10); + } + else + { + lookData = data.GetWareLSOrderPurchases.ToList(); + } + + var totalPageIndex = data.GetWareLSOrderPurchases.Count() % 10 == 0 ? data.GetWareLSOrderPurchases.Count() / 10 : data.GetWareLSOrderPurchases.Count() / 10 + 1; + + WareLSAcceptOrderWindow wareLSAcceptOrderWindow = new WareLSAcceptOrderWindow(lsdTaskMsg, lookData, 1, totalPageIndex, model.BoxConfigureData.PrewOrder); + wareLSAcceptOrderWindow.Show(); + } + + private void PrintLSOrderConfigure(object obj) + { + var model = obj as WaitFallWareModel; + + if (model.WareType != WareType.京仓) + { + System.Windows.MessageBox.Show($"{model.WareType}没有揽收单,只有京仓才有揽收单."); + return; + } + + if (model.BoxConfigureData == null || model.BoxConfigureData.PrewOrder.IsNullOrEmpty()) + { + System.Windows.MessageBox.Show($"预约单号为空,无法查看"); + return; + } + var lsdTaskMsgRes = sealBoxService.GetWareLSAcceptOrder(); + if (!lsdTaskMsgRes.Success) + { + System.Windows.MessageBox.Show($"获取任务信息失败,原因:{lsdTaskMsgRes.Msg}"); + return; + + } + var lsdTaskMsg = lsdTaskMsgRes.Data; + + var LSOrderPurchaseListRes = sealBoxService.GetWareLSOrderPurchaseList(model.BoxConfigureData.PrewOrder); + if (!LSOrderPurchaseListRes.Success) + { + System.Windows.MessageBox.Show($"获取货物信息失败,原因:{LSOrderPurchaseListRes.Msg}"); + return; + + } + + var data = LSOrderPurchaseListRes.Data; + + PrintLSOrderWindow printLS = new PrintLSOrderWindow(data.GetWareLSOrderPurchases.ToList(), model.BoxConfigureData.PrewOrder, lsdTaskMsg); + printLS.ShowDialog(); + } + + private void PrintSealBoxDetails(object obj) + { + var model = (SealBoxModel)obj; + + SealBoxPrintDetailsWindow printDetailsWindow = new SealBoxPrintDetailsWindow(model); + printDetailsWindow.ShowDialog(); } private void CompeteWaitCompleted(object obj) @@ -527,11 +664,11 @@ namespace BBWY.Client.ViewModels.PackTask WaybillNo = fallware.BoxConfigureData.WaybillNo, ProviderName = fallware.BoxConfigureData.ProviderName }; - - PrintBoxWindow printBox = new PrintBoxWindow(model, fallware.WareType); - printBox.ShowDialog(); - //加载模板数据 - + + PrintBoxWindow printBox = new PrintBoxWindow(model, fallware.WareType, sealBoxService); + printBox.ShowDialog(); + //加载模板数据 + //打印 } @@ -560,7 +697,7 @@ namespace BBWY.Client.ViewModels.PackTask } if (fallware.WareType == WareType.云仓 || fallware.WareType == WareType.聚水潭齐越仓) { - SetCloudWareBoxWindow window = new SetCloudWareBoxWindow(model, fallware.WareType); + SetCloudWareBoxWindow window = new SetCloudWareBoxWindow(model, fallware.WareType); window.Show(); } @@ -569,7 +706,7 @@ namespace BBWY.Client.ViewModels.PackTask public PositionState PositionState { get; set; } /// - /// 完成落仓(todo:) + /// 完成落仓 /// /// private void CompeteFallWare(object obj) @@ -604,7 +741,7 @@ namespace BBWY.Client.ViewModels.PackTask return; } - SetSealBoxWindow setSealBoxWindow = new SetSealBoxWindow(model); + SetSealBoxWindow setSealBoxWindow = new SetSealBoxWindow(); setSealBoxWindow.SendBoxCount = boxCount => { model.SealBoxCount = boxCount; @@ -614,6 +751,23 @@ namespace BBWY.Client.ViewModels.PackTask #region 事件绑定 + + /// + /// 提交超时原因 + /// + public ICommand SubmitOverTimeMarkMsgCommand { get; set; } + /// + /// 查看揽收单 + /// + public ICommand LookLSOrderConfigureCommand { get; set; } + /// + /// 打印揽收单 + /// + public ICommand PrintLSOrderConfigureCommand { get; set; } + /// + /// 打印封箱明细 + /// + public ICommand PrintSealBoxDetailsCommand { get; set; } /// /// 待完结 完成事件 /// @@ -743,11 +897,20 @@ namespace BBWY.Client.ViewModels.PackTask if (!model.OrderId.IsNullOrEmpty()) { - if (model.ExpressOrderList==null||model.ExpressOrderList.Count<=0) + if (model.ExpressOrderList == null || model.ExpressOrderList.Count <= 0) { System.Windows.MessageBox.Show("该任务采购单未进行发货,请联系业务进行发货后在确认收货", "提示"); return; } + var manualSigns = packTaskService.BatchManualSign(model.ExpressOrderList.Select(e => e.WaybillNo).ToArray()); + if (manualSigns == null || !manualSigns.Success) + { + if (!manualSigns.Success) + { + System.Windows.MessageBox.Show($"B端确认收货失败,{manualSigns.Msg}"); + return; + } + } } if (System.Windows.MessageBox.Show("是否确认收货?", "提示", MessageBoxButton.YesNo, @@ -755,11 +918,6 @@ namespace BBWY.Client.ViewModels.PackTask return; res = packTaskService.SetPackTaskState(taskId, Models.TaskState.待验收); - if (res != null && res.Success) - { - - //todo:手动发货上传B端数据 - } break; case Models.TaskState.待验收: break; @@ -795,11 +953,11 @@ namespace BBWY.Client.ViewModels.PackTask } - + public void SetTaskState(TaskState? taskState) { - - + + TaskState = taskState; if (PageIndex == 1) SearchTaskList(); @@ -828,7 +986,7 @@ namespace BBWY.Client.ViewModels.PackTask if (SearchTaskId != null && !string.IsNullOrEmpty(SearchTaskId.Trim())) taskId = Convert.ToInt64(SearchTaskId); - var istrue = long.TryParse(SearchSealBoxId, out long sealboxid); + var istrue = long.TryParse(SearchSealBoxId, out long sealboxid); if (istrue) { sealBoxId = sealboxid; @@ -841,7 +999,7 @@ namespace BBWY.Client.ViewModels.PackTask } IsLoading = true; - + if (TaskState == Models.TaskState.待出库) { Task.Factory.StartNew(() => @@ -869,13 +1027,13 @@ namespace BBWY.Client.ViewModels.PackTask IsLoading = false; }); } - else if (TaskState == Models.TaskState.已超时) + else if (TaskState == Models.TaskState.已超时) { PageSize = 20; Task.Factory.StartNew(() => { OverTimeTaskList = new ObservableCollection(); - var datas = packTaskService.SearchOverTimeTaskList(null, StartTime, EndTime, OverTimeTaskState,OverTimeTaskType, PageIndex, PageSize); + var datas = packTaskService.SearchOverTimeTaskList(null, StartTime, EndTime, OverTimeTaskState, OverTimeTaskType, PageIndex, PageSize); if (datas != null && datas.Data != null && datas.Success) { var dataModel = datas.Data; @@ -934,12 +1092,12 @@ namespace BBWY.Client.ViewModels.PackTask if (datetime.TotalMilliseconds > 0) { item.IsWaitTransportOverTime = false; - item.WaitTransportRemainTime = $"{datetime.Hours}小时{datetime.Minutes}分"; + item.WaitTransportRemainTime = OverTimeHelper.GetTimeString(datetime); } else { item.IsWaitTransportOverTime = true; - item.WaitTransportRemainTime = datetime.Days == 0 ? $"{-datetime.Hours}小时{-datetime.Minutes}分" : $"{-datetime.Days}天{-datetime.Hours}小时{-datetime.Minutes}分"; + item.WaitTransportRemainTime = OverTimeHelper.GetTimeString(datetime); } } @@ -970,7 +1128,7 @@ namespace BBWY.Client.ViewModels.PackTask WaitFallWareList = new ObservableCollection(); - var datas = sealBoxService.SearchWareFallWareConfigureList(PositionState, SearchShopName, taskId, SearchSkuId,sealBoxId, PageIndex, PageSize); + var datas = sealBoxService.SearchWareFallWareConfigureList(PositionState, SearchShopName, taskId, SearchSkuId, sealBoxId, PageIndex, PageSize); if (datas != null && datas.Data != null && datas.Success) { var dataModel = datas.Data; @@ -993,54 +1151,54 @@ namespace BBWY.Client.ViewModels.PackTask BoxConfigureData = item.BoxConfigureData, ProductCount = item.ProductCount, WareType = item.WareType, - SetPurchaseOrderOverTime=item.SetPurchaseOrderOverTime + SetPurchaseOrderOverTime = item.SetPurchaseOrderOverTime }); })); } - var fallWareTasks = WaitFallWareList.Where(p => p.SetPurchaseOrderOverTime != null).ToList(); - if (fallWareTasks.Count() > 0 && TaskState == Models.TaskState.待落仓 && SealBoxConfigureType == SealBoxConfigureType.待配置) - { - //if (packOverTimeThread!=null) - //{ - // packOverTimeThread.Abort(); - //} - - fallwareOverTimeThread = new Thread(() => - { - IsStartThread = true; - while (IsStartThread) - { - App.Current.Dispatcher.BeginInvoke(new Action(() => - { - foreach (var item in fallWareTasks) - { - var datetime = item.SetPurchaseOrderOverTime.Value.Subtract(DateTime.Now); - if (datetime.TotalMilliseconds > 0) - { - item.IsFallWareOverTime = false; - item.FallWareRemainTime = $"{datetime.Hours}小时{datetime.Minutes}分"; - } - else - { - item.IsFallWareOverTime = true; - item.FallWareRemainTime = datetime.Days == 0 ? $"{-datetime.Hours}小时{-datetime.Minutes}分" : $"{-datetime.Days}天{-datetime.Hours}小时{-datetime.Minutes}分"; - } - - } - })); - Thread.Sleep(1000); - } - - }); - //任务倒计时数据 - fallwareOverTimeThread.IsBackground = true; - fallwareOverTimeThread.Start(); - - - } + //var fallWareTasks = WaitFallWareList.Where(p => p.SetPurchaseOrderOverTime != null).ToList(); + //if (fallWareTasks.Count() > 0 && TaskState == Models.TaskState.待落仓 && SealBoxConfigureType == SealBoxConfigureType.待配置) + //{ + // //if (packOverTimeThread!=null) + // //{ + // // packOverTimeThread.Abort(); + // //} + + // fallwareOverTimeThread = new Thread(() => + // { + // IsStartThread = true; + // while (IsStartThread) + // { + // App.Current.Dispatcher.BeginInvoke(new Action(() => + // { + // foreach (var item in fallWareTasks) + // { + // var datetime = item.SetPurchaseOrderOverTime.Value.Subtract(DateTime.Now); + // if (datetime.TotalMilliseconds > 0) + // { + // item.IsFallWareOverTime = false; + // item.FallWareRemainTime = $"{datetime.Hours}小时{datetime.Minutes}分"; + // } + // else + // { + // item.IsFallWareOverTime = true; + // item.FallWareRemainTime = datetime.Days == 0 ? $"{-datetime.Hours}小时{-datetime.Minutes}分" : $"{-datetime.Days}天{-datetime.Hours}小时{-datetime.Minutes}分"; + // } + + // } + // })); + // Thread.Sleep(1000); + // } + + // }); + // //任务倒计时数据 + // fallwareOverTimeThread.IsBackground = true; + // fallwareOverTimeThread.Start(); + + + //} } else { @@ -1061,7 +1219,7 @@ namespace BBWY.Client.ViewModels.PackTask { WaitSealBoxModels = new ObservableCollection(); - var datas = sealBoxService.GetWareSealBoxList(SearchShopName, taskId, SearchSkuId, sealBoxId, PageIndex, PageSize); + var datas = sealBoxService.GetWareSealBoxList(SearchShopName, taskId, SearchSkuId, sealBoxId, PageIndex, PageSize); if (datas != null && datas.Data != null && datas.Success) { var dataModel = datas.Data; @@ -1086,12 +1244,13 @@ namespace BBWY.Client.ViewModels.PackTask WareId = item.WareId, WareName = item.WareName, SealBoxId = item.SealBoxId, - SealBoxPackOverTime = item.SealBoxPackOverTime + SealBoxPackOverTime = item.SealBoxPackOverTime, + SealBoxPackOverTimeMarkMsg = item.SealBoxPackOverTimeMarkMsg }); })); } - + var sealboxTasks = WaitSealBoxModels.Where(p => p.SealBoxPackOverTime != null).ToList(); if (sealboxTasks.Count() > 0 && TaskState == Models.TaskState.待封箱) { @@ -1110,12 +1269,12 @@ namespace BBWY.Client.ViewModels.PackTask if (datetime.TotalMilliseconds > 0) { item.IsSealBoxOverTime = false; - item.SealBoxRemainTime = $"{datetime.Hours}小时{datetime.Minutes}分"; + item.SealBoxRemainTime = OverTimeHelper.GetTimeString(datetime); } else { item.IsSealBoxOverTime = true; - item.SealBoxRemainTime = datetime.Days == 0 ? $"{-datetime.Hours}小时{-datetime.Minutes}分" : $"{-datetime.Days}天{-datetime.Hours}小时{-datetime.Minutes}分"; + item.SealBoxRemainTime = OverTimeHelper.GetTimeString(datetime) ; } } @@ -1223,6 +1382,8 @@ namespace BBWY.Client.ViewModels.PackTask QualityCompletionOverTime = item.QualityCompletionOverTime, PackCompletionOverTime = item.PackCompletionOverTime, ShopName = item.ShopName, + QualityOverTimeMarkMsg = item.QualityOverTimeMarkMsg, + PackOverTimeMarkMsg = item.PackOverTimeMarkMsg //ExpressOrderList = item.ExpressOrderList, }; @@ -1290,7 +1451,7 @@ namespace BBWY.Client.ViewModels.PackTask { qualityOverTimeThread = new Thread(() => { - + var packtasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待验收 && p.QualityCompletionOverTime != null).ToList(); if (packtasks.Count() > 0) { @@ -1329,7 +1490,7 @@ namespace BBWY.Client.ViewModels.PackTask qualityOverTimeThread.IsBackground = true; qualityOverTimeThread.Start(); //任务状态为待验收 - + } if (TaskState == Models.TaskState.待打包) { @@ -1354,12 +1515,12 @@ namespace BBWY.Client.ViewModels.PackTask if (datetime.TotalMilliseconds > 0) { item.IsPackOverTime = false; - item.PackRemainTime = datetime.Days == 0 ? $"{datetime.Hours}小时{datetime.Minutes}分" : $"{datetime.Days}天{datetime.Hours}小时{datetime.Minutes}分"; + item.PackRemainTime = OverTimeHelper.GetTimeString(datetime); } else { item.IsPackOverTime = true; - item.PackRemainTime = datetime.Days == 0 ? $"{-datetime.Hours}小时{-datetime.Minutes}分" : $"{-datetime.Days}天{-datetime.Hours}小时{-datetime.Minutes}分"; + item.PackRemainTime = OverTimeHelper.GetTimeString(datetime); } } @@ -1375,7 +1536,7 @@ namespace BBWY.Client.ViewModels.PackTask } } - + //任务状态为待打包 diff --git a/BBWY.Client/ViewModels/SealBox/SealBoxConfigureViewModel.cs b/BBWY.Client/ViewModels/SealBox/SealBoxConfigureViewModel.cs index 7d6554fe..651e4c8d 100644 --- a/BBWY.Client/ViewModels/SealBox/SealBoxConfigureViewModel.cs +++ b/BBWY.Client/ViewModels/SealBox/SealBoxConfigureViewModel.cs @@ -289,6 +289,7 @@ namespace BBWY.Client.ViewModels.SealBox WareName = x.WareName, WareType = x.WareType.Value, WareState = x.WareState, + SealBoxId=x.SealBoxId }).ToList(), }); diff --git a/BBWY.Client/Views/FallWare/FallWareWaitConfigureControl.xaml b/BBWY.Client/Views/FallWare/FallWareWaitConfigureControl.xaml index 65f655e6..5e702f09 100644 --- a/BBWY.Client/Views/FallWare/FallWareWaitConfigureControl.xaml +++ b/BBWY.Client/Views/FallWare/FallWareWaitConfigureControl.xaml @@ -223,11 +223,33 @@ - - + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/FallWare/PrintBoxWindow.xaml b/BBWY.Client/Views/FallWare/PrintBoxWindow.xaml index 0dbcf4ce..6099f87b 100644 --- a/BBWY.Client/Views/FallWare/PrintBoxWindow.xaml +++ b/BBWY.Client/Views/FallWare/PrintBoxWindow.xaml @@ -42,12 +42,16 @@ - + - + diff --git a/BBWY.Client/Views/FallWare/PrintBoxWindow.xaml.cs b/BBWY.Client/Views/FallWare/PrintBoxWindow.xaml.cs index 9d55e9a1..8c001a1f 100644 --- a/BBWY.Client/Views/FallWare/PrintBoxWindow.xaml.cs +++ b/BBWY.Client/Views/FallWare/PrintBoxWindow.xaml.cs @@ -10,6 +10,7 @@ using System.Drawing.Printing; using System.IO; using System.Reflection; using System.Text; +using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; @@ -26,12 +27,13 @@ namespace BBWY.Client.Views.FallWare /// public partial class PrintBoxWindow : BWindow { - public PrintBoxWindow(JDWareBoxModel model, WareType WareType) + public PrintBoxWindow(JDWareBoxModel model, WareType WareType, SealBoxService sealBoxService) { - JDWareBoxModel =model ; this.WareType = WareType; + JDWareBoxModel = model; this.WareType = WareType; this.sealBoxService = sealBoxService; InitializeComponent(); this.DataContext = this; InitPrintList(); + } public void InitPrintList() { @@ -83,10 +85,10 @@ namespace BBWY.Client.Views.FallWare public string PrintName { get; set; } public int PrintCount { get; set; } = 1; + public SealBoxService sealBoxService { get; set; } - - public JDWareBoxModel JDWareBoxModel { get; set; } + public JDWareBoxModel JDWareBoxModel { get; set; } /// /// 箱唛类型 @@ -99,22 +101,71 @@ namespace BBWY.Client.Views.FallWare private void BButton_Click(object sender, RoutedEventArgs e) { - if (WareType== WareType.京仓) + bool isNeedPrintAllBox = false; + if (cbx_allsomebox.IsChecked != null && cbx_allsomebox.IsChecked.Value)//选择打印预约单的所有箱唛 + isNeedPrintAllBox = true; + Task.Factory.StartNew(() => { - SetJDWareBoxWindow jdWindow = new SetJDWareBoxWindow(JDWareBoxModel); - jdWindow.Show(); - //jdWindow.WindowState = WindowState.Maximized; - jdWindow.PrintBox(PrintName); - } + if (WareType == WareType.京仓) + { - if (WareType== WareType.云仓|| WareType== WareType.聚水潭齐越仓) - { - SetCloudWareBoxWindow cloudWareWindow = new SetCloudWareBoxWindow(JDWareBoxModel, WareType); - cloudWareWindow.Visibility = Visibility.Hidden; - cloudWareWindow.Show(); + if (isNeedPrintAllBox)//选择打印预约单的所有箱唛 + { + var datas = sealBoxService.GetWareLSOrderPurchaseList(JDWareBoxModel.PrewOrder); - cloudWareWindow.PrintBox(PrintName); - } + foreach (var item in datas.Data.GetWareLSOrderPurchases) + { + + App.Current.Dispatcher.Invoke(new Action(() => + { + + SetJDWareBoxWindow jdWindow = new SetJDWareBoxWindow(new JDWareBoxModel + { + BoxCount = item.SealBoxCount.Value, + PrewOrder = item.PrewOrder, + ProductCount = item.ProductCount, + ProductTitle = item.ProductTitle, + ProviderName = item.ProviderName, + PurchaseOrder = item.PurchaseOrder, + WareName = item.WareName, + }); + jdWindow.PrintBox(PrintName); + })); + + + } + } + else + { + App.Current.Dispatcher.Invoke(new Action(() => + { + + SetJDWareBoxWindow jdWindow = new SetJDWareBoxWindow(JDWareBoxModel); + jdWindow.PrintBox(PrintName); + })); + } + + + + + } + + if (WareType == WareType.云仓 || WareType == WareType.聚水潭齐越仓) + { + App.Current.Dispatcher.Invoke(new Action(() => + { + SetCloudWareBoxWindow cloudWareWindow = new SetCloudWareBoxWindow(JDWareBoxModel, WareType); + cloudWareWindow.PrintBox(PrintName); + })); + } + + App.Current.Dispatcher.Invoke(new Action(() => + { + + this.Close(); + })); + + }); } } } diff --git a/BBWY.Client/Views/FallWare/PrintLSOrderWindow.xaml b/BBWY.Client/Views/FallWare/PrintLSOrderWindow.xaml new file mode 100644 index 00000000..2fb63cd0 --- /dev/null +++ b/BBWY.Client/Views/FallWare/PrintLSOrderWindow.xaml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/FallWare/PrintLSOrderWindow.xaml.cs b/BBWY.Client/Views/FallWare/PrintLSOrderWindow.xaml.cs new file mode 100644 index 00000000..04077ab6 --- /dev/null +++ b/BBWY.Client/Views/FallWare/PrintLSOrderWindow.xaml.cs @@ -0,0 +1,149 @@ +using BBWY.Client.Models.APIModel; +using BBWY.Client.Models.PackTask; +using BBWY.Client.Views.SealBox; +using BBWY.Controls; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Drawing.Printing; +using System.IO; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +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.FallWare +{ + /// + /// PrintLSOrderWindow.xaml 的交互逻辑 + /// + public partial class PrintLSOrderWindow : BWindow + { + public PrintLSOrderWindow(List getWareLSOrderPurchases, string prewOrder, GetWareLSAcceptOrderResponse getWareLSAcceptOrderResponse) + { + InitializeComponent(); + InitPrintList(); + + this.DataContext = this; + GetWareLSOrderPurchases = getWareLSOrderPurchases; + PrewOrder = prewOrder; + GetWareLSAcceptOrderResponse = getWareLSAcceptOrderResponse; + } + /// + /// 打印机列表 + /// + public ObservableCollection PrintList { get; set; } + public string PrintName { get; set; } + public int PrintCount { get; set; } = 1; + 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 = System.IO.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 List GetWareLSOrderPurchases { get; set; } + public string PrewOrder { get; set; } + public GetWareLSAcceptOrderResponse GetWareLSAcceptOrderResponse { get; set; } + + + + private void BButton_Click(object sender, RoutedEventArgs e) + { + int limitIndex = 10;//单页限制数量 + + int totalPageIndex = GetWareLSOrderPurchases.Count % 10 == 0 ? GetWareLSOrderPurchases.Count / 10 : GetWareLSOrderPurchases.Count / 10 + 1; + + + Task.Factory.StartNew(() => + { + + for (int i = 0; i < PrintCount; i++)//打印份数 + { + int nowPageIndex = 0; + again: + nowPageIndex++; + if (GetWareLSOrderPurchases.Count > limitIndex) + { + PrintBox(GetWareLSOrderPurchases.GetRange(0, limitIndex), nowPageIndex, totalPageIndex); + + GetWareLSOrderPurchases.RemoveRange(0, limitIndex); + goto again; + } + else + { + PrintBox(GetWareLSOrderPurchases, nowPageIndex, totalPageIndex); + } + } + App.Current.Dispatcher.Invoke(() => { + this.Close(); + }); + }); + } + + public void PrintBox(List GetWareLSOrderPurchases, int nowPageIndex, int totalPageIndex) + { + + App.Current.Dispatcher.Invoke(() => { + + WareLSAcceptOrderWindow lSAcceptOrderWindow = new WareLSAcceptOrderWindow(GetWareLSAcceptOrderResponse, GetWareLSOrderPurchases, nowPageIndex, totalPageIndex, PrewOrder); + //lSAcceptOrderWindow.Show(); + lSAcceptOrderWindow.PrintLSOrder(PrintName); + }); + + //SealBoxPolicyDetailsWindow policyDetailsWindow = new SealBoxPolicyDetailsWindow(sealBoxSkus, SealBoxModel.ShopName, SealBoxModel.WareName, SealBoxModel.SealBoxId); + //policyDetailsWindow.PrintBox(PrintName); + } + } +} diff --git a/BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml b/BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml index 7e472bd0..004b7825 100644 --- a/BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml +++ b/BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:BBWY.Client.Views.FallWare" mc:Ignorable="d" - xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" + 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" @@ -16,24 +16,11 @@ CloseButtonColor="{StaticResource WindowButtonColor}" MinButtonVisibility="Collapsed" MaxButtonVisibility="Collapsed" + RightButtonGroupMargin="0,5,5,0" Width="450" Height="380" - RightButtonGroupMargin="0,5,5,0"> + > - - - - - - - + @@ -46,7 +33,7 @@ - + @@ -92,7 +79,7 @@ - + diff --git a/BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml.cs b/BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml.cs index 4db8ee84..db57a044 100644 --- a/BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml.cs +++ b/BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml.cs @@ -18,6 +18,7 @@ using BBWY.Client.Helpers; using System.Printing; using System.Reflection; using System.IO; +using System.Threading; namespace BBWY.Client.Views.FallWare { @@ -34,6 +35,10 @@ namespace BBWY.Client.Views.FallWare InitializeComponent(); PurchaseOrderImage = MyPrintHelper.GetBarcodeImageV2(model.PurchaseOrder, 420, 50); this.DataContext = this; + this.Dispatcher.Invoke(() => { + tb_printcount.Text = "1"; + }); + this.UpdateLayout(); } public JDWareBoxModel JDWareBoxModel { get; set; } @@ -42,11 +47,9 @@ namespace BBWY.Client.Views.FallWare /// public BitmapImage PurchaseOrderImage { get; set; } public WareType WareType { get; set; } - public int PrintCount { get; set; } = 1; public void PrintBox(string printName) { - var localPrintServer = new LocalPrintServer(); if (string.IsNullOrEmpty(printName)) { @@ -60,22 +63,28 @@ namespace BBWY.Client.Views.FallWare } MyPrintHelper.SetDefaultPrint(printName);//设置默认打印机 PrintDialog printDialog = new PrintDialog(); - printDialog.PrintTicket.PageOrientation = PageOrientation.Landscape;//设置为横向打印 PageOrientation.Landscape Portrait为纵向 + var pageWidth = (int)Math.Ceiling(printDialog.PrintableAreaWidth); + var pageHeight = (int)Math.Ceiling(printDialog.PrintableAreaHeight); + printDialog.PrintTicket.PageMediaSize = new PageMediaSize(pageWidth, pageHeight); + + this.Height = pageHeight + 39; + this.Width = pageWidth; + this.FontSize = 30; + box_margin.Margin = new Thickness(50, 50, 50, 50); + this.jd_box.Arrange(new Rect(new Point(0, 0), new Size(pageWidth, pageHeight))); for (int i = 1; i <= JDWareBoxModel.BoxCount; i++) { - PrintCount = i; - //设置纸张大小 - var pageWidth = (int)Math.Ceiling(printDialog.PrintableAreaWidth); - var pageHeight = (int)Math.Ceiling(printDialog.PrintableAreaHeight); - printDialog.PrintTicket.PageMediaSize = new PageMediaSize(pageWidth, pageHeight); - + this.Dispatcher.Invoke(() => { + tb_printcount.Text =i.ToString(); + }); + this.Dispatcher.Invoke(() => { + this.UpdateLayout(); + }); + + - this.Height = pageHeight + 39; - this.Width = pageWidth; - this.FontSize = 30; - this.jd_box.Arrange(new Rect(new Point(0, 0), new Size(pageWidth, pageHeight))); printDialog.PrintVisual(this.jd_box, "打印任务"); } var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); diff --git a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml index e28f58f3..df819c59 100644 --- a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml +++ b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml @@ -43,7 +43,7 @@ - + @@ -103,7 +103,7 @@ - + diff --git a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml.cs b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml.cs index 048c89a0..7104a0e7 100644 --- a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml.cs +++ b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml.cs @@ -37,6 +37,10 @@ namespace BBWY.Client.Views.FallWare PurchaseOrderImage= MyPrintHelper.GetBarcodeImageV2(model.PurchaseOrder, 420, 50); PrewOrderImage = MyPrintHelper.GetBarcodeImageV2(model.PrewOrder, 350, 50); this.DataContext =this; + this.Dispatcher.Invoke(() => { + tb_printcount.Text = "1"; + }); + this.UpdateLayout(); } public JDWareBoxModel JDWareBoxModel { get; set; } @@ -53,7 +57,6 @@ namespace BBWY.Client.Views.FallWare public BitmapImage PrewOrderImage { get; set; } - public int PrintCount { get; set; } = 1; @@ -77,26 +80,22 @@ namespace BBWY.Client.Views.FallWare PrintDialog printDialog = new PrintDialog(); printDialog.PrintTicket.PageOrientation = PageOrientation.Landscape;//设置为横向打印 PageOrientation.Landscape Portrait为纵向 - + //设置纸张大小 + var pageWidth = (int)Math.Ceiling(printDialog.PrintableAreaWidth); + var pageHeight = (int)Math.Ceiling(printDialog.PrintableAreaHeight); + printDialog.PrintTicket.PageMediaSize = new PageMediaSize(pageWidth, pageHeight); + this.Height = pageHeight + 39;//833 + this.Width = pageWidth;//1123 + this.FontSize = 30; + box_margin.Margin = new Thickness(50, 50, 50, 50); + this.jd_box.Arrange(new Rect(new Point(0, 0), new Size(pageWidth, pageHeight))); for (int i = 1; i <= JDWareBoxModel.BoxCount; i++) { - PrintCount = i; - //设置纸张大小 - var pageWidth = (int)Math.Ceiling(printDialog.PrintableAreaWidth); - var pageHeight = (int)Math.Ceiling(printDialog.PrintableAreaHeight); - printDialog.PrintTicket.PageMediaSize = new PageMediaSize(pageWidth, pageHeight); - - - this.Height = pageHeight + 39;//833 - this.Width = pageWidth;//1123 - this.FontSize = 30; - this.jd_box.Arrange(new Rect(new Point(0, 0), new Size(pageWidth, pageHeight))); - //794 429 Width="478" Height="440" - //this.jd_box.Arrange(new Rect(new Point((pageWidth - jd_box.DesiredSize.Width) / 2, (pageHeight - jd_box.DesiredSize.Height) / 2), new Size(jd_box.DesiredSize.Width, jd_box.DesiredSize.Height))); - + this.Dispatcher.Invoke(() => { + tb_printcount.Text =i.ToString(); + }); + this.UpdateLayout(); //刷新界面 printDialog.PrintVisual(this.jd_box, "打印任务"); - - } var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string printNames = System.IO.Path.Combine(applicationPath, "printName.init"); diff --git a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow2.xaml b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow2.xaml index ccf7177f..dc9755aa 100644 --- a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow2.xaml +++ b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow2.xaml @@ -7,7 +7,8 @@ mc:Ignorable="d" xmlns:cmodel="clr-namespace:BBWY.Client.Models" xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" - Title="SetJDWareBoxWindow2" Height="250" Width="300" + Title="SetJDWareBoxWindow2" + Height="280" Width="300" MinButtonVisibility="Collapsed" MaxButtonVisibility="Collapsed" CloseButtonVisibility="Visible" @@ -75,7 +76,7 @@ /> - + @@ -105,8 +106,23 @@ + + + + + + + + + + + + + + - + diff --git a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow2.xaml.cs b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow2.xaml.cs index 54587bf6..3eca7928 100644 --- a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow2.xaml.cs +++ b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow2.xaml.cs @@ -23,12 +23,22 @@ namespace BBWY.Client.Views.FallWare public WareType wareType { get; set; } + /// + /// 预约时间(日期) + /// + public DateTime PrewDate { get; set; } + + /// + /// 预约时间(小时:分钟) + /// + public string PrewTime { get; set; } + public bool IsEnabled { get; set; } public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } private bool isLoading; - public SetJDWareBoxWindow2(JDWareBoxModel model, SealBoxService sealBoxService, WareType wareType, Action reflashWindow, bool isEnabled = true) + public SetJDWareBoxWindow2(JDWareBoxModel model, SealBoxService sealBoxService, WareType wareType, Action reflashWindow,DateTime? TransportOverTime=null) { InitializeComponent(); @@ -36,7 +46,7 @@ namespace BBWY.Client.Views.FallWare this.wareType = wareType; this.reflashWindow = reflashWindow; JDWareBoxModel = model; - this.IsEnabled = isEnabled; + this.DataContext = this; switch (wareType) @@ -47,6 +57,14 @@ namespace BBWY.Client.Views.FallWare panel_jingcang.Visibility= Visibility.Visible; panel_yuncang.Visibility= Visibility.Collapsed; panel_jst.Visibility= Visibility.Collapsed; + + PrewDate = DateTime.Now; + PrewTime = "17:30"; + if (TransportOverTime != null) + { + PrewDate = TransportOverTime.Value.Date; + PrewTime = TransportOverTime?.ToString("HH:mm"); + } break; case WareType.云仓: btn_jingcang.IsEnabled = false; @@ -84,6 +102,23 @@ namespace BBWY.Client.Views.FallWare MessageBox.Show("信息不完整", "提示"); return; } + + DateTime? PrewDateTime = null; + + try + { + PrewDateTime = DateTime.Parse((PrewDate.ToString("yyyy-MM-dd ") + PrewTime)); + + + } + catch + { + MessageBox.Show("输入的时间有误", "提示"); + return; + } + + + IsLoading = true; Task.Factory.StartNew(() => { @@ -95,7 +130,14 @@ namespace BBWY.Client.Views.FallWare return; } - var res = sealBoxService.SetFallWareConfigure(JDWareBoxModel.SealBoxId, JDWareBoxModel.ProductTitle, JDWareBoxModel.PurchaseOrder, JDWareBoxModel.PrewOrder, JDWareBoxModel.WaybillNo, getDetailResponse.Data.SupplierName, getDetailResponse.Data.StoreName); + if (getDetailResponse.Data.StoreName!= JDWareBoxModel.WareName) + { + IsLoading = false; + this.Dispatcher.Invoke(() => MessageBox.Show($"采购单对应的仓库名:{getDetailResponse.Data.StoreName}与当前仓库:{JDWareBoxModel.WareName}不符", "提示")); + return; + } + + var res = sealBoxService.SetFallWareConfigure(JDWareBoxModel.SealBoxId, JDWareBoxModel.ProductTitle, JDWareBoxModel.PurchaseOrder, JDWareBoxModel.PrewOrder, JDWareBoxModel.WaybillNo, getDetailResponse.Data.SupplierName, getDetailResponse.Data.StoreName, getDetailResponse.Data.City, PrewDateTime); if (!res.Success) { IsLoading = false; diff --git a/BBWY.Client/Views/FallWare/WaitFallWareControl.xaml b/BBWY.Client/Views/FallWare/WaitFallWareControl.xaml index fda3766c..c657bbbc 100644 --- a/BBWY.Client/Views/FallWare/WaitFallWareControl.xaml +++ b/BBWY.Client/Views/FallWare/WaitFallWareControl.xaml @@ -36,7 +36,8 @@ - + + @@ -124,7 +125,8 @@ - + + @@ -242,31 +244,60 @@ - + - + - - - + + + - + + + + + + + + + - + diff --git a/BBWY.Client/Views/FallWare/WareLSAcceptOrderWindow.xaml b/BBWY.Client/Views/FallWare/WareLSAcceptOrderWindow.xaml new file mode 100644 index 00000000..5b747000 --- /dev/null +++ b/BBWY.Client/Views/FallWare/WareLSAcceptOrderWindow.xaml @@ -0,0 +1,317 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/FallWare/WareLSAcceptOrderWindow.xaml.cs b/BBWY.Client/Views/FallWare/WareLSAcceptOrderWindow.xaml.cs new file mode 100644 index 00000000..f1bf3e3d --- /dev/null +++ b/BBWY.Client/Views/FallWare/WareLSAcceptOrderWindow.xaml.cs @@ -0,0 +1,92 @@ +using BBWY.Client.Helpers; +using BBWY.Client.Models.APIModel; +using BBWY.Client.Models.APIModel.Response; +using BBWY.Client.Models.FallWare; +using BBWY.Controls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Printing; +using System.Reflection; +using System.Text; +using System.Threading; +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.FallWare +{ + /// + /// WareLSAcceptOrderWindow.xaml 的交互逻辑 + /// + public partial class WareLSAcceptOrderWindow : BWindow + { + public WareLSAcceptOrderWindow(GetWareLSAcceptOrderResponse GetWareLSAcceptOrderResponse, List GetWareLSOrderPurchases, int nowPageIndex, int totalPageIndex, string prewOrder + + ) + { + InitializeComponent(); + this.GetWareLSAcceptOrderResponse = GetWareLSAcceptOrderResponse; + this.GetWareLSOrderPurchases = GetWareLSOrderPurchases; + this.NowPageIndex = nowPageIndex; + this.TotalPageIndex = totalPageIndex; + this.DataContext = this; + PrewOrder = prewOrder; + TotalSealBoxCount = GetWareLSOrderPurchases.Select(w=>w.SealBoxCount).Sum().Value; + this.UpdateLayout(); + } + + public GetWareLSAcceptOrderResponse GetWareLSAcceptOrderResponse { get; set; } + public List GetWareLSOrderPurchases { get; set; } + public int NowPageIndex { get; set; } + public int TotalPageIndex { get; set; } + public string PrewOrder { get; set; } + + /// + /// 总封箱数 + /// + public int TotalSealBoxCount { get; set; } + + ///// + ///// TC收货总箱数 + ///// + //public int TotalTCAcceptBoxCount { get; set; } + + + public void PrintLSOrder(string printName) + { + var localPrintServer = new LocalPrintServer(); + if (string.IsNullOrEmpty(printName)) + { + return; + } + var printQueue = localPrintServer.GetPrintQueue(printName); + if (printQueue.IsInError) + { + System.Windows.MessageBox.Show("打印机处于错误状态"); + return; + } + MyPrintHelper.SetDefaultPrint(printName);//设置默认打印机 + PrintDialog printDialog = new PrintDialog(); + printDialog.PrintTicket.PageOrientation = PageOrientation.Portrait;//设置为横向打印 PageOrientation.Landscape Portrait为纵向 + var pageWidth = (int)Math.Ceiling(printDialog.PrintableAreaWidth); + var pageHeight = (int)Math.Ceiling(printDialog.PrintableAreaHeight); + // printDialog.PrintTicket.PageMediaSize = new PageMediaSize(pageWidth, pageHeight); + + //835 1166 + this.Height = pageHeight+39; + this.Width = pageWidth; + this.print_lsOrder.Arrange(new Rect(new Point(0, 0), new Size(pageWidth, pageHeight))); + this.UpdateLayout(); + printDialog.PrintVisual(this.print_lsOrder, "打印任务"); + this.Close(); + } + } + + +} diff --git a/BBWY.Client/Views/PackTask/FeesExcelControl.xaml b/BBWY.Client/Views/PackTask/FeesExcelControl.xaml index 49edbf0c..dfa33e31 100644 --- a/BBWY.Client/Views/PackTask/FeesExcelControl.xaml +++ b/BBWY.Client/Views/PackTask/FeesExcelControl.xaml @@ -8,6 +8,8 @@ d:DesignHeight="150" d:DesignWidth="1800"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/SealBox/SealBoxPolicyDetailsWindow.xaml.cs b/BBWY.Client/Views/SealBox/SealBoxPolicyDetailsWindow.xaml.cs new file mode 100644 index 00000000..9b068701 --- /dev/null +++ b/BBWY.Client/Views/SealBox/SealBoxPolicyDetailsWindow.xaml.cs @@ -0,0 +1,76 @@ +using BBWY.Client.Helpers; +using BBWY.Client.Models.APIModel; +using BBWY.Client.Models.FallWare; +using BBWY.Controls; +using System; +using System.Collections.Generic; +using System.Printing; +using System.Reflection; +using System.Text; +using System.Threading; +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.SealBox +{ + /// + /// SealBoxPolicyDetailsWindow.xaml 的交互逻辑 + /// + public partial class SealBoxPolicyDetailsWindow : BWindow + { + public SealBoxPolicyDetailsWindow(List sealBoxSkus, string shopName, string wareName, long sealBoxId) + { + InitializeComponent(); + this.DataContext = this; + SealBoxSkus = sealBoxSkus; + ShopName = shopName; + WareName = wareName; + SealBoxId = sealBoxId; + this.UpdateLayout(); + } + + /// + /// 封箱sku列表 + /// + public List SealBoxSkus { get; set; } + + public string ShopName { get; set; } + public string WareName { get; set; } + + public long SealBoxId { get; set; } + + public void PrintBox(string printName) + { + var localPrintServer = new LocalPrintServer(); + if (string.IsNullOrEmpty(printName)) + { + return; + } + var printQueue = localPrintServer.GetPrintQueue(printName); + if (printQueue.IsInError) + { + System.Windows.MessageBox.Show("打印机处于错误状态"); + return; + } + MyPrintHelper.SetDefaultPrint(printName);//设置默认打印机 + PrintDialog printDialog = new PrintDialog(); + printDialog.PrintTicket.PageOrientation = PageOrientation.Portrait;//设置为横向打印 PageOrientation.Landscape Portrait为纵向 + var pageWidth = (int)Math.Ceiling(printDialog.PrintableAreaWidth); + var pageHeight = (int)Math.Ceiling(printDialog.PrintableAreaHeight); + printDialog.PrintTicket.PageMediaSize = new PageMediaSize(pageWidth, pageHeight); + this.Height = pageHeight; + this.Width = pageWidth; + // this.FontSize = 30; + this.print_sealbox.Arrange(new Rect(new Point(0, 0), new Size(pageWidth, pageHeight))); + this.UpdateLayout(); + printDialog.PrintVisual(this.print_sealbox, "打印任务"); + this.Close(); + } + } +} diff --git a/BBWY.Client/Views/SealBox/SealBoxPrintDetailsWindow.xaml b/BBWY.Client/Views/SealBox/SealBoxPrintDetailsWindow.xaml new file mode 100644 index 00000000..711ef15a --- /dev/null +++ b/BBWY.Client/Views/SealBox/SealBoxPrintDetailsWindow.xaml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/SealBox/SealBoxPrintDetailsWindow.xaml.cs b/BBWY.Client/Views/SealBox/SealBoxPrintDetailsWindow.xaml.cs new file mode 100644 index 00000000..f7c09356 --- /dev/null +++ b/BBWY.Client/Views/SealBox/SealBoxPrintDetailsWindow.xaml.cs @@ -0,0 +1,141 @@ +using BBWY.Client.Models.APIModel; +using BBWY.Client.Models.PackTask; +using BBWY.Controls; +using NPOI.Util; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Drawing.Printing; +using System.IO; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +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.SealBox +{ + /// + /// SealBoxPrintDetailsWindow.xaml 的交互逻辑 + /// + public partial class SealBoxPrintDetailsWindow : BWindow + { + public SealBoxPrintDetailsWindow(SealBoxModel sealBox) + { + InitializeComponent(); + InitPrintList(); + SealBoxModel = sealBox.Copy(); + this.DataContext = this; + } + /// + /// 打印机列表 + /// + public ObservableCollection PrintList { get; set; } + 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 = System.IO.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 string PrintName { get; set; } + public int PrintCount { get; set; } = 1; + + + /// + /// 封箱sku列表 + /// + public SealBoxModel SealBoxModel { get; set; } + + public string ShopName { get; set; } + public string WareName { get; set; } + + public long SealBoxId { get; set; } + private void BButton_Click(object sender, RoutedEventArgs e) + { + + + int limitIndex = 15;//单页限制数量 + + Task.Factory.StartNew(() => + { + for (int i = 0; i < PrintCount; i++)//打印份数 + { + again: + if (SealBoxModel.SealBoxSkus.Count > limitIndex) + { + PrintBox(SealBoxModel.SealBoxSkus.GetRange(0, limitIndex)); + + SealBoxModel.SealBoxSkus.RemoveRange(0, limitIndex); + goto again; + } + else + { + PrintBox(SealBoxModel.SealBoxSkus); + } + } + App.Current.Dispatcher.Invoke(new Action(() => + { + this.Close(); + })); + }); + } + + public void PrintBox(List sealBoxSkus) + { + App.Current.Dispatcher.Invoke(new Action(() => + { + SealBoxPolicyDetailsWindow policyDetailsWindow = new SealBoxPolicyDetailsWindow(sealBoxSkus, SealBoxModel.ShopName, SealBoxModel.WareName, SealBoxModel.SealBoxId); + policyDetailsWindow.PrintBox(PrintName); + })); + + } + } +} diff --git a/BBWY.Client/Views/SealBox/SetSealBoxWindow.xaml b/BBWY.Client/Views/SealBox/SetSealBoxWindow.xaml index cfc870c4..7ceb3a19 100644 --- a/BBWY.Client/Views/SealBox/SetSealBoxWindow.xaml +++ b/BBWY.Client/Views/SealBox/SetSealBoxWindow.xaml @@ -31,22 +31,17 @@ - - + + - - - - - - + diff --git a/BBWY.Client/Views/SealBox/SetSealBoxWindow.xaml.cs b/BBWY.Client/Views/SealBox/SetSealBoxWindow.xaml.cs index f3a04100..5aab0828 100644 --- a/BBWY.Client/Views/SealBox/SetSealBoxWindow.xaml.cs +++ b/BBWY.Client/Views/SealBox/SetSealBoxWindow.xaml.cs @@ -28,49 +28,11 @@ namespace BBWY.Client.Views.SealBox /// public partial class SetSealBoxWindow : BWindow { - public SetSealBoxWindow(SealBoxModel sealBoxModel) + public SetSealBoxWindow() { - SealBoxModel = sealBoxModel; - InitializeComponent(); - LoadPrints(); - } - - SealBoxModel SealBoxModel { get; set; } - /// - /// 获取打印机名称 - /// - private void LoadPrints() - { - 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; - //} - cbPrint.Items.Add(name); - } - //if (cbPrint.Items.Count > selectIndex) - //{ - // cbPrint.SelectedIndex = selectIndex; - //} - var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - string printNamePath = $"{applicationPath}/printSealName.init"; - if (File.Exists(printNamePath)) - { - cbPrint.Text = File.ReadAllText(printNamePath); - } + InitializeComponent(); } - - public Action SendBoxCount { get; set; } private void BButton_Click(object sender, RoutedEventArgs e) { @@ -84,103 +46,10 @@ namespace BBWY.Client.Views.SealBox MessageBox.Show("请输入数字!"); return; } - //string printName = cbPrint.Text; - //var localPrintServer = new LocalPrintServer(); - //var printQueue = localPrintServer.GetPrintQueue(printName); - //if (printQueue.IsInError) - //{ - // MessageBox.Show("打印机处于错误状态"); - // return; - //} - - ////PrintSealboxModel(printName, boxCount); - - //MyPrintHelper.PrintSealBoxData(SealBoxModel, printName, boxCount, 1); - ////todo: 打印单子 if (SendBoxCount != null) SendBoxCount(boxCount); this.Close(); } - - private void PrintSealboxModel(string printName, int boxCount, int printCount = 1) - { - - - // - - } - private void PrintSealboxModel1(string printName, int boxCount) - { - var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - string printNamePath = $"{applicationPath}/printSealName.init"; - if (File.Exists(printNamePath)) - { - File.Delete(printNamePath); - } - File.WriteAllText(printNamePath, printName); - - var excel = $"{applicationPath}/Resources/ExccelModel/sealbox.xlsx"; - - var newExccel = $"{applicationPath}/Resources/ExccelModel/newsealbox.xlsx"; - if (File.Exists(newExccel)) - { - File.Delete(newExccel); - } - FileStream fs = new FileStream(excel, FileMode.Open, FileAccess.Read); - XSSFWorkbook wb = new XSSFWorkbook(fs); - var sheet = wb.GetSheetAt(0); // 得到第一个sheet - - var nameCell = sheet.GetRow(0).GetCell(0); // name列,第2行 - var ageCell = sheet.GetRow(3).GetCell(0); // age列,第2行 - - - XSSFWorkbook wb2 = new XSSFWorkbook(); - //wb2.CreateSheet("Sheet1"); - sheet.CopyTo(wb2, "Sheet1", true, false); - var sheet2 = wb2.GetSheet("Sheet1"); - - - var nameCell2 = sheet2.GetRow(0).GetCell(1); - nameCell2.SetCellValue(SealBoxModel.ShopName); - - sheet2.GetRow(3).GetCell(1).SetCellValue(SealBoxModel.WareName); - - StringBuilder sb = new StringBuilder(); - int totalCount = 0; - for (int i = 0; i < SealBoxModel.SealBoxSkus.Count; i++) - { - var title = SealBoxModel.SealBoxSkus[i].SkuTitle; - //if (title.Length>5) - //{ - // title = title.Substring(0,5); - //} - totalCount += SealBoxModel.SealBoxSkus[i].WareHourseSkuCount; - sheet2.GetRow(i + 6).GetCell(1).SetCellValue($"名称:{title}"); - sheet2.GetRow(i + 6).GetCell(2).SetCellValue($"SKU:{SealBoxModel.SealBoxSkus[i].SkuId}"); - sheet2.GetRow(i + 6).GetCell(3).SetCellValue($"数量:{SealBoxModel.SealBoxSkus[i].WareHourseSkuCount}"); - - } - sheet2.GetRow(25).GetCell(1).SetCellValue(totalCount); - sheet2.GetRow(28).GetCell(1).SetCellValue(boxCount); - FileStream fs1 = new FileStream(newExccel, FileMode.OpenOrCreate, FileAccess.ReadWrite); - wb2.Write(fs1); - fs1.Close(); - fs1.Dispose(); - //Workbook workbook = new Workbook(); - //workbook.loa - //workbook.LoadFromFile(newExccel); - //var print = workbook.PrintDocument; - //print.PrinterSettings.PrinterName = printName; - //print.Print(); - - // - - } - - void SpirePrint() - { - - } } diff --git a/BBWY.Client/Views/SealBox/WaitSealBoxControl.xaml b/BBWY.Client/Views/SealBox/WaitSealBoxControl.xaml index 5be54b0c..f0efdf81 100644 --- a/BBWY.Client/Views/SealBox/WaitSealBoxControl.xaml +++ b/BBWY.Client/Views/SealBox/WaitSealBoxControl.xaml @@ -38,7 +38,7 @@ - + @@ -92,14 +92,14 @@ - - - + - + - + - + @@ -214,9 +214,9 @@ - + - + @@ -240,7 +240,7 @@ - + @@ -266,18 +266,39 @@ Visibility="{Binding IsSealBoxOverTime,Converter={StaticResource objConverter},ConverterParameter=false:Visible:Collapsed}" > - + - + - - + + + + + + + + + + + + + + + + + + + - + @@ -285,18 +306,20 @@ Content="{Binding SealBoxCount,Converter={StaticResource objConverter},ConverterParameter=#null:设置:修改}" Command="{Binding DataContext.SetSealBoxCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}}}" CommandParameter="{Binding}" - > + /> + - + + - - - - + /> diff --git a/BBWY.Client/Views/TaskOverTime/SubmitOverTimeMarkMsgWindow.xaml b/BBWY.Client/Views/TaskOverTime/SubmitOverTimeMarkMsgWindow.xaml new file mode 100644 index 00000000..283f1ea1 --- /dev/null +++ b/BBWY.Client/Views/TaskOverTime/SubmitOverTimeMarkMsgWindow.xaml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/TaskOverTime/SubmitOverTimeMarkMsgWindow.xaml.cs b/BBWY.Client/Views/TaskOverTime/SubmitOverTimeMarkMsgWindow.xaml.cs new file mode 100644 index 00000000..fffc7131 --- /dev/null +++ b/BBWY.Client/Views/TaskOverTime/SubmitOverTimeMarkMsgWindow.xaml.cs @@ -0,0 +1,74 @@ +using BBWY.Client.APIServices; +using BBWY.Client.Models; +using BBWY.Controls; +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Interop; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using WebSocketSharp; + +namespace BBWY.Client.Views.TaskOverTime +{ + /// + /// SubmitOverTimeMarkMsgWindow.xaml 的交互逻辑 + /// + public partial class SubmitOverTimeMarkMsgWindow : BWindow + { + public SubmitOverTimeMarkMsgWindow(OverTimeTaskType overTimeTaskType, long id, string msg, PackTaskService packTaskService, Action reflashWindow) + { + InitializeComponent(); + this.OverTimeTaskType = overTimeTaskType; + this.Id = id; + MarkMsg = msg; + this.reflashWindow = reflashWindow; + this.packTaskService = packTaskService; + this.DataContext = this; + } + Action reflashWindow; + PackTaskService packTaskService { get; set; } + /// + /// 超时任务类型(待验收 = 2,待打包 = 3,待封箱 = 4, 待落仓 = 8,待转运 = 11,) + /// + public OverTimeTaskType OverTimeTaskType { get; set; } + + /// + /// 任务id 或者 封箱id + /// + public long Id { get; set; } + /// + /// 备注信息 + /// + public string MarkMsg { get; set; } + + private void BButton_Click(object sender, RoutedEventArgs e) + { + if (MarkMsg.IsNullOrEmpty()) + { + MessageBox.Show("请输入超时原因"); + return; + } + + var res = packTaskService.SubmitOverTimeMarkMsg(OverTimeTaskType, Id, MarkMsg); + if (res == null) + { + MessageBox.Show("网络异常"); + return; + } + if (!res.Success) + { + MessageBox.Show(res.Msg); + return; + } + if (reflashWindow != null) reflashWindow(); + this.Close(); + } + } +} diff --git a/BBWY.Client/Views/WaitTransport/WareWaitTransportControl.xaml b/BBWY.Client/Views/WaitTransport/WareWaitTransportControl.xaml index 65d04de0..c426eabe 100644 --- a/BBWY.Client/Views/WaitTransport/WareWaitTransportControl.xaml +++ b/BBWY.Client/Views/WaitTransport/WareWaitTransportControl.xaml @@ -268,11 +268,28 @@ - + - - + + + + + + + + + + + + + + + + +