diff --git a/BBWY.Client/APIServices/QiKu/PackTaskService.cs b/BBWY.Client/APIServices/QiKu/PackTaskService.cs index f6133700..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,32 +279,60 @@ 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, 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, OverTimeTaskType, PageIndex, - PageSize + PageSize, + overTimeTaskState }, 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 8febd8d2..2d93496c 100644 --- a/BBWY.Client/APIServices/QiKu/SealBoxService.cs +++ b/BBWY.Client/APIServices/QiKu/SealBoxService.cs @@ -88,7 +88,7 @@ namespace BBWY.Client.APIServices , null, HttpMethod.Post); } - public ApiResponse GetWareSealBoxList(string ShopName, long? TaskId, string SkuId, int? PageIndex, int? PageSize) + public ApiResponse GetWareSealBoxList(string ShopName, long? TaskId, string SkuId,long? SealBoxId, int? PageIndex, int? PageSize) { return SendRequest(globalContext.QKApiHost, $"api/SealBox/GetWareSealBoxList", new @@ -97,7 +97,8 @@ namespace BBWY.Client.APIServices TaskId, SkuId, PageIndex, - PageSize + PageSize, + SealBoxId } , null, HttpMethod.Post); } @@ -124,7 +125,7 @@ namespace BBWY.Client.APIServices /// /// /// - public ApiResponse SearchWareFallWareConfigureList(PositionState positionState, string ShopName = null, long? TaskId = null, string SkuId = null, int PageIndex = 1 + public ApiResponse SearchWareFallWareConfigureList(PositionState positionState, string ShopName = null, long? TaskId = null, string SkuId = null,long?sealBoxId=null, int PageIndex = 1 , int PageSize = 10) { return SendRequest(globalContext.QKApiHost, $"api/SealBox/SearchWareFallWareConfigureList", @@ -135,7 +136,8 @@ namespace BBWY.Client.APIServices SkuId, PageIndex, PageSize, - positionState + positionState, + sealBoxId } , null, HttpMethod.Post); } @@ -169,7 +171,7 @@ namespace BBWY.Client.APIServices - public ApiResponse SetFallWareConfigure(long SealBoxId, string ProductTitle, string PurchaseOrder, string PrewOrder, string WaybillNo, string providerName = "", string wareName = "") + 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 @@ -180,7 +182,9 @@ namespace BBWY.Client.APIServices PrewOrder, WaybillNo, providerName, - wareName + wareName, + WareCity, + TransportOverTime } , null, HttpMethod.Post); } @@ -264,13 +268,17 @@ namespace BBWY.Client.APIServices null, null, HttpMethod.Post); } - public ApiResponse GetWareWaitCompletedList(string shopId, int? PageIndex, int? PageSize) + public ApiResponse GetWareWaitCompletedList(string shopId, string ShopName , long? TaskId , string SkuId , long? sealBoxId , int? PageIndex, int? PageSize) { return SendRequest(globalContext.QKApiHost, $"api/SealBox/GetWareWaitCompletedList", new { shopId, PageIndex, - PageSize + PageSize, + ShopName, + TaskId, + SkuId, + sealBoxId }, null, HttpMethod.Post); } @@ -280,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 2643c69f..e6f8759e 100644 --- a/BBWY.Client/BBWY.Client.csproj +++ b/BBWY.Client/BBWY.Client.csproj @@ -17,10 +17,18 @@ x64 + + + + + + + + @@ -62,6 +70,7 @@ Never + diff --git a/BBWY.Client/GlobalContext.cs b/BBWY.Client/GlobalContext.cs index c69049d7..280cc5c6 100644 --- a/BBWY.Client/GlobalContext.cs +++ b/BBWY.Client/GlobalContext.cs @@ -13,7 +13,7 @@ namespace BBWY.Client { ShopServiceGroupList = new List(); ShopServiceGroupLowerList = new List(); - ClientVersion = "10143"; + ClientVersion = "10144"; } private User user; diff --git a/BBWY.Client/Helpers/MyPrintHelper.cs b/BBWY.Client/Helpers/MyPrintHelper.cs index d9fbd559..59a6e039 100644 --- a/BBWY.Client/Helpers/MyPrintHelper.cs +++ b/BBWY.Client/Helpers/MyPrintHelper.cs @@ -52,10 +52,7 @@ namespace BBWY.Client.Helpers default: break; } - } - - private static void SetBar(BarCodeModel barCode, ref PrintPageEventArgs args, Font font, int heightSpace) { @@ -64,7 +61,7 @@ namespace BBWY.Client.Helpers string barcodeSku = $"POP{barCode.SkuId}"; Barcode barcode = new Barcode(); System.Drawing.Image img = barcode.Encode(TYPE.CODE128, barcodeSku, 500, 40); - SizeF size = args.Graphics.MeasureString(barCode.BrandName, font); + SizeF size = args.Graphics.MeasureString("品牌", font); var sizeHeight = size.Height;//字体高度 topHeigth += 10; @@ -106,10 +103,6 @@ namespace BBWY.Client.Helpers topHeigth += (50 + 5); args.Graphics.DrawString(barcodeSku, font, System.Drawing.Brushes.Black, new PointF((236 - size.Width) / 2, topHeigth)); } - - - - /// /// 标准 /// @@ -159,7 +152,6 @@ namespace BBWY.Client.Helpers args.Graphics.DrawString(barcodeSku, font, System.Drawing.Brushes.Black, new PointF((236 - size.Width) / 2, 130)); args.Graphics.DrawImage(img, 1, 68, 234, 60); } - public static void PrintCertificate(ref PrintPageEventArgs args, CertificateModel certificate, Font font) { @@ -194,7 +186,6 @@ namespace BBWY.Client.Helpers } - private static void SetCerStander(ref PrintPageEventArgs args, CertificateModel certificate, Font font) { @@ -579,7 +570,6 @@ namespace BBWY.Client.Helpers } - public static void SaveImage(PrintPageEventArgs args) { args.Graphics.Save(); @@ -593,9 +583,13 @@ namespace BBWY.Client.Helpers } - - - + /// + /// 字符串生成条形码 图片 + /// + /// + /// + /// + /// public static BitmapImage GetBarcodeImage(string printStr, int width, int height) { Bitmap image = new Bitmap(width, height); @@ -606,6 +600,24 @@ namespace BBWY.Client.Helpers return bitmapToBitmapImage(image); } + /// + /// 字符串生成条形码 图片 + /// + /// + /// + /// + /// + public static BitmapImage GetBarcodeImageV2(string printStr, int width, int height) + { + Bitmap image = new Bitmap(width, height); + Graphics graphics2 = Graphics.FromImage(image); + Barcode barcode = new Barcode(); + System.Drawing.Image img = barcode.Encode(TYPE.CODE128, printStr, width, height); + graphics2.DrawImage(img, 0, 0, width, height); + return bitmapToBitmapImage(image); + } + + static BitmapImage bitmapToBitmapImage(Bitmap bitmap) { using (var stream = new MemoryStream()) 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/Enums.cs b/BBWY.Client/Models/Enums.cs index f6925590..24d5acd5 100644 --- a/BBWY.Client/Models/Enums.cs +++ b/BBWY.Client/Models/Enums.cs @@ -529,6 +529,17 @@ 待落仓 = 8, 待转运 = 11, } + + /// + /// 超时任务状态 + /// + public enum OverTimeTaskState + { + 未完成 = 0, + 已完成 = 1, + 全部=2 + + } public enum TaskMessageType { 任务ID = 0, 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/FallWare/JDWareBoxModel.cs b/BBWY.Client/Models/FallWare/JDWareBoxModel.cs index c3483d75..2f51f68d 100644 --- a/BBWY.Client/Models/FallWare/JDWareBoxModel.cs +++ b/BBWY.Client/Models/FallWare/JDWareBoxModel.cs @@ -58,5 +58,10 @@ namespace BBWY.Client.Models.FallWare /// 供应商 /// public string ProviderName { get; set; } + + /// + /// 仓库城市 + /// + public string WareCity { get; set; } } } 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/PackServiceViewModel.cs b/BBWY.Client/ViewModels/PackTask/PackServiceViewModel.cs index bc724769..d8512662 100644 --- a/BBWY.Client/ViewModels/PackTask/PackServiceViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/PackServiceViewModel.cs @@ -60,13 +60,6 @@ namespace BBWY.Client.ViewModels.PackTask public int IncrementPartTaskCount { get => incrementPartTaskCount; set { Set(ref incrementPartTaskCount, value); } } - - //public ObservableCollection incrementPartCountList = new ObservableCollection() { - //"0","1","2","3","4件以上" - //}; - - //public ObservableCollection IncrementPartCountList { get => incrementPartCountList; set { Set(ref incrementPartCountList, value); } } - private int incrementPartCount; /// /// 配件数量 diff --git a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs index 96b1d83c..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; } /// /// 设置落仓配置信息(上传材料) /// @@ -942,7 +960,7 @@ namespace BBWY.Client.ViewModels.PackTask Task.Factory.StartNew(() => { WaitCompletedList = new ObservableCollection(); - var datas = sealBoxService.GetWareWaitCompletedList(globalContext.User.Shop.ShopId.ToString(), PageIndex, PageSize); + var datas = sealBoxService.GetWareWaitCompletedList(globalContext.User.Shop.ShopId.ToString(), null, taskId, SearchSkuId, null, PageIndex, PageSize); if (datas != null && datas.Data != null && datas.Success) { var dataModel = datas.Data; diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index 6e657193..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; } @@ -64,11 +65,27 @@ namespace BBWY.Client.ViewModels.PackTask /// public ObservableCollection OverTimeTaskTypeList { get => overTimeTaskTypeList; set { Set(ref overTimeTaskTypeList, value); } } - private OverTimeTaskType overTimeTaskState = OverTimeTaskType.全部; + private ObservableCollection overTimeTaskStateList = new ObservableCollection { + Models.OverTimeTaskState.未完成 , Models.OverTimeTaskState.已完成, OverTimeTaskState.全部 + }; + /// + ///超时任务类型 + /// + public ObservableCollection OverTimeTaskStateList { get => overTimeTaskStateList; set { Set(ref overTimeTaskStateList, value); } } + + + + private OverTimeTaskType overTimeTaskType = OverTimeTaskType.全部; /// /// 任务类型(超时) /// - public OverTimeTaskType OverTimeTaskState { get => overTimeTaskState; set { Set(ref overTimeTaskState, value); } } + public OverTimeTaskType OverTimeTaskType { get => overTimeTaskType; set { Set(ref overTimeTaskType, value); } } + + private OverTimeTaskState overTimeTaskState = OverTimeTaskState.全部; + /// + /// 任务类型(超时) + /// + public OverTimeTaskState OverTimeTaskState { get => overTimeTaskState; set { Set(ref overTimeTaskState, value); } } @@ -171,6 +188,18 @@ namespace BBWY.Client.ViewModels.PackTask } } + /// + /// 查询任务id + /// + private string searchSealBoxId; + public string SearchSealBoxId + { + get => searchSealBoxId; set + { + Set(ref searchSealBoxId, value); + } + } + /// /// 查询Sku /// @@ -314,7 +343,7 @@ namespace BBWY.Client.ViewModels.PackTask SearchTaskCommand = new RelayCommand(() => { - SearchTaskList(); //手动点击查询订单 + SearchTaskList(); //手动点击查询订单 }); TaskPageIndexChangedCommand = new RelayCommand(p => { @@ -341,7 +370,7 @@ namespace BBWY.Client.ViewModels.PackTask PositionState = PositionState.待落仓; SetSealBoxConfigureTypeCommand = new RelayCommand(s => { - + SealBoxConfigureType = s; PositionState = s == SealBoxConfigureType.已配置 ? PositionState.已配置待落仓 : PositionState.待落仓; SearchTaskList(); @@ -361,7 +390,7 @@ namespace BBWY.Client.ViewModels.PackTask SetWareTypeCommand = new RelayCommand(s => { - + SelectWareType = s; SearchTaskList(); }); @@ -369,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) @@ -496,16 +661,14 @@ namespace BBWY.Client.ViewModels.PackTask PrewOrder = fallware.BoxConfigureData.PrewOrder, ProductTitle = fallware.BoxConfigureData.ProductTitle, PurchaseOrder = fallware.BoxConfigureData.PurchaseOrder, - WaybillNo = fallware.BoxConfigureData.WaybillNo + WaybillNo = fallware.BoxConfigureData.WaybillNo, + ProviderName = fallware.BoxConfigureData.ProviderName }; - if (fallware.WareType == WareType.京仓) - { - //加载模板数据 - } - if (fallware.WareType == WareType.云仓) - { - } + PrintBoxWindow printBox = new PrintBoxWindow(model, fallware.WareType, sealBoxService); + printBox.ShowDialog(); + //加载模板数据 + //打印 } @@ -527,14 +690,14 @@ namespace BBWY.Client.ViewModels.PackTask }; if (fallware.WareType == WareType.京仓) { - SetJDWareBoxWindow window = new SetJDWareBoxWindow(model, sealBoxService, fallware.WareType, ReflashTask, false); + SetJDWareBoxWindow window = new SetJDWareBoxWindow(model); window.Show(); //var w = new SetJDWareBoxWindow2(model, sealBoxService, fallware.WareType, ReflashTask, false); //w.ShowDialog(); } if (fallware.WareType == WareType.云仓 || fallware.WareType == WareType.聚水潭齐越仓) { - SetCloudWareBoxWindow window = new SetCloudWareBoxWindow(model, sealBoxService, fallware.WareType, ReflashTask, false); + SetCloudWareBoxWindow window = new SetCloudWareBoxWindow(model, fallware.WareType); window.Show(); } @@ -543,7 +706,7 @@ namespace BBWY.Client.ViewModels.PackTask public PositionState PositionState { get; set; } /// - /// 完成落仓(todo:) + /// 完成落仓 /// /// private void CompeteFallWare(object obj) @@ -578,7 +741,7 @@ namespace BBWY.Client.ViewModels.PackTask return; } - SetSealBoxWindow setSealBoxWindow = new SetSealBoxWindow(model); + SetSealBoxWindow setSealBoxWindow = new SetSealBoxWindow(); setSealBoxWindow.SendBoxCount = boxCount => { model.SealBoxCount = boxCount; @@ -588,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; } /// /// 待完结 完成事件 /// @@ -714,6 +894,24 @@ namespace BBWY.Client.ViewModels.PackTask case Models.TaskState.未到货: case Models.TaskState.部分到货: + + if (!model.OrderId.IsNullOrEmpty()) + { + 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, MessageBoxImage.Warning) != MessageBoxResult.Yes) @@ -755,11 +953,11 @@ namespace BBWY.Client.ViewModels.PackTask } - + public void SetTaskState(TaskState? taskState) { - - + + TaskState = taskState; if (PageIndex == 1) SearchTaskList(); @@ -782,10 +980,17 @@ namespace BBWY.Client.ViewModels.PackTask PageSize = 10; IsStartThread = false; long? taskId = null; + long? sealBoxId = null; try { if (SearchTaskId != null && !string.IsNullOrEmpty(SearchTaskId.Trim())) taskId = Convert.ToInt64(SearchTaskId); + + var istrue = long.TryParse(SearchSealBoxId, out long sealboxid); + if (istrue) + { + sealBoxId = sealboxid; + } } catch { @@ -794,13 +999,13 @@ namespace BBWY.Client.ViewModels.PackTask } IsLoading = true; - + if (TaskState == Models.TaskState.待出库) { Task.Factory.StartNew(() => { WaitCompletedList = new ObservableCollection(); - var datas = sealBoxService.GetWareWaitCompletedList(null, PageIndex, PageSize); + var datas = sealBoxService.GetWareWaitCompletedList(null, SearchShopName, taskId, SearchSkuId, sealBoxId, PageIndex, PageSize); if (datas != null && datas.Data != null && datas.Success) { var dataModel = datas.Data; @@ -822,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, 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; @@ -887,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); } } @@ -923,7 +1128,7 @@ namespace BBWY.Client.ViewModels.PackTask WaitFallWareList = new ObservableCollection(); - var datas = sealBoxService.SearchWareFallWareConfigureList(PositionState, SearchShopName, taskId, SearchSkuId, 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; @@ -946,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 { @@ -1014,7 +1219,7 @@ namespace BBWY.Client.ViewModels.PackTask { WaitSealBoxModels = new ObservableCollection(); - var datas = sealBoxService.GetWareSealBoxList(SearchShopName, taskId, SearchSkuId, PageIndex, PageSize); + var datas = sealBoxService.GetWareSealBoxList(SearchShopName, taskId, SearchSkuId, sealBoxId, PageIndex, PageSize); if (datas != null && datas.Data != null && datas.Success) { var dataModel = datas.Data; @@ -1039,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.待封箱) { @@ -1063,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) ; } } @@ -1176,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, }; @@ -1243,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) { @@ -1282,7 +1490,7 @@ namespace BBWY.Client.ViewModels.PackTask qualityOverTimeThread.IsBackground = true; qualityOverTimeThread.Start(); //任务状态为待验收 - + } if (TaskState == Models.TaskState.待打包) { @@ -1307,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); } } @@ -1328,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 new file mode 100644 index 00000000..6099f87b --- /dev/null +++ b/BBWY.Client/Views/FallWare/PrintBoxWindow.xaml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/FallWare/PrintBoxWindow.xaml.cs b/BBWY.Client/Views/FallWare/PrintBoxWindow.xaml.cs new file mode 100644 index 00000000..fc826570 --- /dev/null +++ b/BBWY.Client/Views/FallWare/PrintBoxWindow.xaml.cs @@ -0,0 +1,186 @@ +using BBWY.Client.APIServices; +using BBWY.Client.Models; +using BBWY.Client.Models.FallWare; +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.FallWare +{ + /// + /// PrintBoxWindow.xaml 的交互逻辑 + /// + public partial class PrintBoxWindow : BWindow + { + public PrintBoxWindow(JDWareBoxModel model, WareType WareType, SealBoxService sealBoxService) + { + JDWareBoxModel = model; this.WareType = WareType; this.sealBoxService = sealBoxService; + InitializeComponent(); + this.DataContext = this; + InitPrintList(); + + } + 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; + public SealBoxService sealBoxService { get; set; } + + + public JDWareBoxModel JDWareBoxModel { get; set; } + + /// + /// 箱唛类型 + /// + public WareType WareType { get; set; } + /// + /// 打印机列表 + /// + public ObservableCollection PrintList { get; set; } + + private void BButton_Click(object sender, RoutedEventArgs e) + { + bool isNeedPrintAllBox = false; + if (cbx_allsomebox.IsChecked != null && cbx_allsomebox.IsChecked.Value)//选择打印预约单的所有箱唛 + isNeedPrintAllBox = true; + Task.Factory.StartNew(() => + { + if (WareType == WareType.京仓) + { + + if (isNeedPrintAllBox)//选择打印预约单的所有箱唛 + { + var datas = sealBoxService.GetWareLSOrderPurchaseList(JDWareBoxModel.PrewOrder); + + 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(); + })); + + }); + + 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 + { + + + } + } + } +} 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..e86ed7c1 --- /dev/null +++ b/BBWY.Client/Views/FallWare/PrintLSOrderWindow.xaml.cs @@ -0,0 +1,163 @@ +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(); + }); + }); + 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 + { + + + } + } + + 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 edd95a9e..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" - Width="450" Height="330" - RightButtonGroupMargin="0,5,5,0"> + RightButtonGroupMargin="0,5,5,0" + Width="450" Height="380" + > - - - - - - - + @@ -45,58 +32,63 @@ Background="{StaticResource Border.Background}"> - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + - - + + + + - - - - + + - - - - - - - - - + + + + + - - - + + + + diff --git a/BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml.cs b/BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml.cs index cc441b07..db57a044 100644 --- a/BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml.cs +++ b/BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml.cs @@ -14,6 +14,11 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; using WebSocketSharp; +using BBWY.Client.Helpers; +using System.Printing; +using System.Reflection; +using System.IO; +using System.Threading; namespace BBWY.Client.Views.FallWare { @@ -22,51 +27,74 @@ namespace BBWY.Client.Views.FallWare /// public partial class SetCloudWareBoxWindow : BWindow { - public SetCloudWareBoxWindow(JDWareBoxModel model, SealBoxService sealBoxService, WareType wareType, Action reflashWindow, bool isEnabled = true) + public SetCloudWareBoxWindow(JDWareBoxModel model, WareType wareType) { - if (SealBoxService == null) this.SealBoxService = sealBoxService; - WareType = wareType; - ReflashWindow = reflashWindow; + WareType = wareType; JDWareBoxModel = model; InitializeComponent(); - this.DataContext =this ; - if (!isEnabled) - { - //this.jd_box.IsEnabled = isEnabled; - //this.btn_save.Visibility = Visibility.Collapsed; - } + PurchaseOrderImage = MyPrintHelper.GetBarcodeImageV2(model.PurchaseOrder, 420, 50); + this.DataContext = this; + this.Dispatcher.Invoke(() => { + tb_printcount.Text = "1"; + }); + this.UpdateLayout(); + } public JDWareBoxModel JDWareBoxModel { get; set; } - - private SealBoxService SealBoxService { get; set; } - - private Action ReflashWindow { get; set; } - + /// + /// 采购单号条形码 + /// + public BitmapImage PurchaseOrderImage { get; set; } public WareType WareType { get; set; } - private void BButton_Click(object sender, RoutedEventArgs e) - { - if (JDWareBoxModel.PurchaseOrder.IsNullOrEmpty()) + public void PrintBox(string printName) + { + var localPrintServer = new LocalPrintServer(); + if (string.IsNullOrEmpty(printName)) { - MessageBox.Show("采购单号不能为空"); return; } - if (JDWareBoxModel.PrewOrder.IsNullOrEmpty() && WareType == WareType.京仓) + var printQueue = localPrintServer.GetPrintQueue(printName); + if (printQueue.IsInError) { - MessageBox.Show("预约单号不能为空"); + System.Windows.MessageBox.Show("打印机处于错误状态"); return; } - var res = SealBoxService.SetFallWareConfigure(JDWareBoxModel.SealBoxId, JDWareBoxModel.ProductTitle, JDWareBoxModel.PurchaseOrder, JDWareBoxModel.PrewOrder, JDWareBoxModel.WaybillNo); + 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); + - if (res != null && res.Success) + 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++) { - if (ReflashWindow != null) ReflashWindow(); - this.Close(); + this.Dispatcher.Invoke(() => { + tb_printcount.Text =i.ToString(); + }); + this.Dispatcher.Invoke(() => { + this.UpdateLayout(); + }); + + - return; + printDialog.PrintVisual(this.jd_box, "打印任务"); + } + var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + string printNames = System.IO.Path.Combine(applicationPath, "printName.init"); + if (File.Exists(printNames)) + { + File.Delete(printNames); } - if (res != null) MessageBox.Show(res.Msg); + System.IO.File.WriteAllText(printNames, printName); + this.Close(); } } } diff --git a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml index eb41b156..df819c59 100644 --- a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml +++ b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml @@ -10,18 +10,17 @@ 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" WindowStartupLocation="CenterScreen" CloseButtonVisibility="Visible" CloseButtonColor="{StaticResource WindowButtonColor}" MinButtonVisibility="Collapsed" MaxButtonVisibility="Collapsed" - Width="450" Height="500" + Width="480" Height="480" RightButtonGroupMargin="0,5,5,0"> - - - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + - - + + + + + - - + + + + + - - - - + - + + - - + + - - + + + + + - - - - - - - - + + + + - - + diff --git a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml.cs b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml.cs index 1102aee2..7104a0e7 100644 --- a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml.cs +++ b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml.cs @@ -1,10 +1,18 @@ using BBWY.Client.APIServices; +using BBWY.Client.Helpers; using BBWY.Client.Models; using BBWY.Client.Models.FallWare; using BBWY.Controls; +using HandyControl.Controls; using System; using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Drawing.Printing; +using System.IO; +using System.Printing; +using System.Reflection; using System.Text; +using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; @@ -22,54 +30,81 @@ namespace BBWY.Client.Views.FallWare /// public partial class SetJDWareBoxWindow : BWindow { - public SetJDWareBoxWindow(JDWareBoxModel model, SealBoxService sealBoxService,WareType wareType, Action reflashWindow,bool isEnabled = true) + public SetJDWareBoxWindow(JDWareBoxModel model) { - if (SealBoxService == null) this.SealBoxService = sealBoxService; - WareType = wareType; - ReflashWindow = reflashWindow; - JDWareBoxModel = model; InitializeComponent(); - this.DataContext = JDWareBoxModel; - if (!isEnabled) - { - //this.jd_box.IsEnabled = isEnabled; - //this.btn_save.Visibility = Visibility.Collapsed; - } - - - + 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; } - private SealBoxService SealBoxService { get; set; } - private Action ReflashWindow { get; set; } + /// + /// 采购单号条形码 + /// + public BitmapImage PurchaseOrderImage { get; set; } + + + /// + /// 预约单号条形码 + /// + public BitmapImage PrewOrderImage { get; set; } + + - private WareType WareType { get; set; } - private void BButton_Click(object sender, RoutedEventArgs e) + + + + + public void PrintBox(string printName) { - if (JDWareBoxModel.PurchaseOrder.IsNullOrEmpty()) + var localPrintServer = new LocalPrintServer(); + if (string.IsNullOrEmpty(printName)) { - MessageBox.Show("采购单号不能为空"); return; } - if (JDWareBoxModel.PrewOrder.IsNullOrEmpty()&& WareType== WareType.京仓) + var printQueue = localPrintServer.GetPrintQueue(printName); + if (printQueue.IsInError) { - MessageBox.Show("预约单号不能为空"); + System.Windows.MessageBox.Show("打印机处于错误状态"); return; } - var res = SealBoxService.SetFallWareConfigure(JDWareBoxModel.SealBoxId, JDWareBoxModel.ProductTitle,JDWareBoxModel.PurchaseOrder,JDWareBoxModel.PrewOrder,JDWareBoxModel.WaybillNo); + MyPrintHelper.SetDefaultPrint(printName);//设置默认打印机 + PrintDialog printDialog = new PrintDialog(); - if (res!=null&&res.Success) + 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++) { - if (ReflashWindow != null) ReflashWindow(); - this.Close(); - - return; + 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"); + if (File.Exists(printNames)) + { + File.Delete(printNames); } - if (res != null) MessageBox.Show(res.Msg); + System.IO.File.WriteAllText(printNames, printName); + this.Close(); } } } 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 bf3d47d6..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,32 +244,60 @@ - + - + - - - + + + - + + + + + + + + + - + diff --git a/BBWY.Client/Views/FallWare/WareFallWareListControl.xaml b/BBWY.Client/Views/FallWare/WareFallWareListControl.xaml index 7e0c6619..02e0bebe 100644 --- a/BBWY.Client/Views/FallWare/WareFallWareListControl.xaml +++ b/BBWY.Client/Views/FallWare/WareFallWareListControl.xaml @@ -63,37 +63,91 @@ - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +