diff --git a/BBWY.Client/APIServices/QiKu/PackDetailService.cs b/BBWY.Client/APIServices/QiKu/PackDetailService.cs index 3fb6ce2f..98f383f6 100644 --- a/BBWY.Client/APIServices/QiKu/PackDetailService.cs +++ b/BBWY.Client/APIServices/QiKu/PackDetailService.cs @@ -1,4 +1,5 @@ using BBWY.Client.Models; +using BBWY.Client.Models.APIModel; using BBWY.Client.Models.APIModel.Response.PackTask; using BBWY.Common.Http; using BBWY.Common.Models; @@ -35,9 +36,9 @@ namespace BBWY.Client.APIServices /// /// /// - public ApiResponse SetPackDetail(SetPackDetailRequest consumable) + public ApiResponse SetPackDetailV2(SetPackDetailRequest consumable) { - return SendRequest(globalContext.QKApiHost, "api/PackDetail/SetPackDetail", + return SendRequest(globalContext.QKApiHost, "api/PackDetail/SetPackDetailV2", consumable , null, HttpMethod.Post); } diff --git a/BBWY.Client/APIServices/QiKu/PackTaskAbortService.cs b/BBWY.Client/APIServices/QiKu/PackTaskAbortService.cs index 385468a5..cc805055 100644 --- a/BBWY.Client/APIServices/QiKu/PackTaskAbortService.cs +++ b/BBWY.Client/APIServices/QiKu/PackTaskAbortService.cs @@ -58,5 +58,19 @@ namespace BBWY.Client.APIServices.QiKu } , null, HttpMethod.Post); } + + public ApiResponse SaveTaskShelves(long TaskId, string ShelvesNumber, int? FloorNumber, string RemarkMsg) + { + return SendRequest(globalContext.QKApiHost, $"api/PackTaskAbort/SaveTaskShelves", + new + { + TaskId, + ShelvesNumber, + FloorNumber, + UserName = globalContext.User.Name, + RemarkMsg + } + , null, HttpMethod.Post); + } } } diff --git a/BBWY.Client/BBWYAppSettings.json b/BBWY.Client/BBWYAppSettings.json index b8c053dc..197f2c55 100644 --- a/BBWY.Client/BBWYAppSettings.json +++ b/BBWY.Client/BBWYAppSettings.json @@ -4,6 +4,6 @@ "MDSApiHost": "http://mdsapi.qiyue666.com", "JOSApiHost": "", "1688ApiHost": "", - "QKApiHost": "http://localhost:8080" - // "QKApiHost": "http://qiku.qiyue666.com" + //"QKApiHost": "http://localhost:8080" + "QKApiHost": "http://qiku.qiyue666.com" } \ No newline at end of file diff --git a/BBWY.Client/GlobalContext.cs b/BBWY.Client/GlobalContext.cs index 7d7f200b..ef71e519 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 = "10210"; + ClientVersion = "10211"; } diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs index 3345dcc1..20bde40f 100644 --- a/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs @@ -142,15 +142,6 @@ namespace BBWY.Client.Models.APIModel public string OrderId { get; set; } - ///// - /////分箱情况 - ///// - //public WareHourseDTO[] WareHourses { get; set; } - /// - /// 地托编号 - /// - public int? FloorDragNumber { get; set; } - /// /// 质检超时时间 /// @@ -161,8 +152,6 @@ namespace BBWY.Client.Models.APIModel /// public DateTime? PackCompletionOverTime { get; set; } - - /// /// 质检超时备注信息 /// @@ -201,7 +190,6 @@ namespace BBWY.Client.Models.APIModel /// public DateTime? SendToSetSkuConfigureTime { get; set; } - /// /// 物流状态 /// @@ -211,6 +199,27 @@ namespace BBWY.Client.Models.APIModel /// 消息列表 /// public List MarkMessageModelList { get; set; } + + + /// + /// 异常类型 + /// + public string TaskExceptionType { get; set; } + + /// + /// 货架编号 + /// + public string ShelvesNumber { get; set; } + + /// + /// 货架层数 + /// + public int? FloorNumber { get; set; } + + /// + /// 挂起异常备注 + /// + public string AbortRemark { get; set; } public DateTime? TaskAbortTime { get; set; } } public class ExpressOrderResponse diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/SetPackDetailV2Response.cs b/BBWY.Client/Models/APIModel/Response/PackTask/SetPackDetailV2Response.cs new file mode 100644 index 00000000..ec64cec7 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/PackTask/SetPackDetailV2Response.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel +{ + public class SetPackDetailV2Response + { + /// + /// 套餐任务量 + /// + public int ProcessTaskCount { get; set; } + + /// + /// 打包完成时间(超时时间) + /// + public DateTime? PackCompletionOverTime { get; set; } + + /// + /// 包装收益 + /// + public decimal PackerFees { get; set; } + + /// + /// 工序套餐名称 + /// + public string ProcessComboName { get; set; } + + /// + /// 耗材名称列表 + /// + public List ConsumableNameList { get; set; } + } +} diff --git a/BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs b/BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs index 028b07f9..fd8402d5 100644 --- a/BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs @@ -24,6 +24,7 @@ using BBWY.Client.Models.APIModel; using Org.BouncyCastle.Bcpg; using System.Threading; using Org.BouncyCastle.Ocsp; +using BBWY.Client.Views.PackagingTask; namespace BBWY.Client.ViewModels.PackTask { @@ -446,6 +447,15 @@ namespace BBWY.Client.ViewModels.PackTask public string PackUserName { get => packUserName; set { Set(ref packUserName, value); } } + private string processComboName; + /// + /// 工序套餐名称 + /// + public string ProcessComboName { get => processComboName; set { Set(ref processComboName, value); } } + + + + private decimal? packerFee; /// /// 包装员费用 @@ -755,7 +765,7 @@ namespace BBWY.Client.ViewModels.PackTask var resData = packDetailRes.Data; - + PackProcessType = resData.PackProcessType; switch (PackProcessType) @@ -839,7 +849,7 @@ namespace BBWY.Client.ViewModels.PackTask }); }); - + } } @@ -945,6 +955,22 @@ namespace BBWY.Client.ViewModels.PackTask /// 计费模式 /// public FeesMode FeesMode { get; set; } + + public DateTime? packCompletionOverTime; + /// + /// 打包完成时间(超时时间) + /// + public DateTime? PackCompletionOverTime { get => packCompletionOverTime; set { Set(ref packCompletionOverTime, value); } } // + + + public List consumableNameList; + /// + /// 耗材名称列表 + /// + public List ConsumableNameList { get => consumableNameList; set { Set(ref consumableNameList, value); } } // + + + /// /// 上传数据 (判断是否超量) 统一上传 /// @@ -955,8 +981,6 @@ namespace BBWY.Client.ViewModels.PackTask System.Windows.MessageBox.Show("信息不完整,打包人设置有误"); return; } - - if (PackUserModelList != null && PackUserModelList.Count > 0) { if (PackUserModelList.Any(p => p.SelectUserId.IsNullOrEmpty() || p.TaskCount <= 0)) @@ -979,8 +1003,6 @@ namespace BBWY.Client.ViewModels.PackTask } } - - if (ConsumableServiceList != null && ConsumableServiceList.Count > 0) { if (ConsumableServiceList.Any(p => p.SelectId == null || p.TaskCount <= 0)) @@ -1004,7 +1026,6 @@ namespace BBWY.Client.ViewModels.PackTask { FeesMode = FeesMode.定向收费; } - SetPackDetailRequest setPackDetailRequest = new SetPackDetailRequest() { DirectionalSingleFees = CustomProcessSinglePrice, @@ -1013,7 +1034,7 @@ namespace BBWY.Client.ViewModels.PackTask ConsumableFees = ConsumableFees, TaskId = TaskId, PackUserList = PackUserModelList?.Select(p => new PackUserModelRequest { TaskCount = p.TaskCount, UserId = p.SelectUserId }).ToList(), - ConsumableList = ConsumableServiceList?.Select(c => new ConsumableRequest { ConsumableId = c.SelectId.Value, TaskCount = c.TaskCount, ConsumableTypeName = c.ConsumableType, ConsumablePrice = c.ConsumablePrice,IsSaveConfig=c.IsHideDelete }).ToList(), + ConsumableList = ConsumableServiceList?.Select(c => new ConsumableRequest { ConsumableId = c.SelectId.Value, TaskCount = c.TaskCount, ConsumableTypeName = c.ConsumableType, ConsumablePrice = c.ConsumablePrice, IsSaveConfig = c.IsHideDelete }).ToList(), DiscountFactory = DiscountFactory, PackDiscountPrice = PackDiscountFees, PackPrice = PackFees, @@ -1026,7 +1047,7 @@ namespace BBWY.Client.ViewModels.PackTask }; - var res = packDetailService.SetPackDetail(setPackDetailRequest); + var res = packDetailService.SetPackDetailV2(setPackDetailRequest); if (res == null) { @@ -1039,9 +1060,22 @@ namespace BBWY.Client.ViewModels.PackTask return; } + var names = PackUserModelList.Select(c => c.MemberList.SingleOrDefault(s => s.Id == c.SelectUserId)?.UserName); + PackUserName = string.Join(",",names); + + ProcessTaskCount = res.Data.ProcessTaskCount; + PackerFee = res.Data.PackerFees; + ProcessComboName = res.Data.ProcessComboName; + ConsumableNameList = res.Data.ConsumableNameList; + PackCompletionOverTime = res.Data.PackCompletionOverTime; // new TipsWindow("上传成功!").Show(); - var win = obj as System.Windows.Window; + var win = obj as PackDetailWindow; + + + PrintPackDetailWindow print = new PrintPackDetailWindow(win); + print.ShowDialog(); + if (ReflashWindow != null) ReflashWindow(); win.Close(); diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index e896543e..17938dc4 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs @@ -38,6 +38,7 @@ using BBWY.Client.Views.SplitTask; using BBWY.Client.Extensions; using BBWY.Client.Views.PackTaskAbort; using System.Windows.Controls; +using BBWY.Client.Views.SomeArrival; namespace BBWY.Client.ViewModels.PackTask { @@ -805,6 +806,12 @@ namespace BBWY.Client.ViewModels.PackTask /// public ICommand PrintShelvesNumberCommand { get; set; } + + /// + /// 打印部分到货任务信息 + /// + public ICommand PrintShelvesCommand { get; set; } + public WareHouseListViewModel(PackTaskService packTaskService, GlobalContext globalContext, SealBoxService sealBoxService, PackUserService packUserService, MarkMessageService markMessageService, QualityTaskService qualityTaskService, PackagingTaskService packagingTaskService, PackTaskAbortService packTaskAbortService) { @@ -947,6 +954,8 @@ namespace BBWY.Client.ViewModels.PackTask PrintShelvesNumberCommand = new RelayCommand(PrintShelvesNumber); + + PrintShelvesCommand = new RelayCommand(PrintShelves); LoadSplitDatas(); } @@ -963,7 +972,11 @@ namespace BBWY.Client.ViewModels.PackTask } } } - + private void PrintShelves(PackTaskModel model) + { + PrintSomeArrivalWindow window = new PrintSomeArrivalWindow(packTaskAbortService, model, ReflashTask, ShelvesNumberList, FloorNumberList); + window.ShowDialog(); + } private void PrintShelvesNumber(PackTaskModel model) @@ -1262,20 +1275,21 @@ namespace BBWY.Client.ViewModels.PackTask if (isqualityBrand) { - - - if (IsNeedCer == Need.需要) - { - QualityWindow service = new QualityWindow(model, ReflashTask, IsNeedCer, markType, packTaskRes.Data); - service.ShowDialog(); - } - else - { - BatchPrintWindow window = new BatchPrintWindow(markType, IsNeedCer, model.TaskId, model.BrandName, model.SkuCount, model.CertificateModel, model.BarCodeModel, qualityTaskService, - ReflashTask - ); - window.ShowDialog(); - } + QualityWindow service = new QualityWindow(model, ReflashTask, IsNeedCer, markType, packTaskRes.Data); + service.ShowDialog(); + + //if (IsNeedCer == Need.需要 || !packTaskRes.Data.SkuPurchaseSchemeId.IsNullOrEmpty())//查看配件配件 + //{ + // QualityWindow service = new QualityWindow(model, ReflashTask, IsNeedCer, markType, packTaskRes.Data); + // service.ShowDialog(); + //} + //else + //{ + // BatchPrintWindow window = new BatchPrintWindow(markType, IsNeedCer, model.TaskId, model.BrandName, model.SkuCount, model.CertificateModel, model.BarCodeModel, qualityTaskService, + // ReflashTask + // ); + // window.ShowDialog(); + //} diff --git a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs index ba651146..2b26481f 100644 --- a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs +++ b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs @@ -512,9 +512,9 @@ namespace BBWY.Client.ViewModels var request = new Models.APIModel.Request.QualityTaskRequest { //BasicPack = BasicPack, - // ArrivalQuantity = SkuCount, - // GoodProductQuantity = SkuCount, - // Increment1 = string.Join(",", IncreateList.Where(i => i.IsSelected).Select(i => i.IncreateName)), + // ArrivalQuantity = SkuCount, + // GoodProductQuantity = SkuCount, + // Increment1 = string.Join(",", IncreateList.Where(i => i.IsSelected).Select(i => i.IncreateName)), BrandName = BrandName, //CertificatePosition = CertificatePosition, //OrderId = OrderId, @@ -535,50 +535,36 @@ namespace BBWY.Client.ViewModels } request.BarcodeId = BarCodeModel.Id; } - if (IsNeedPrintCer == Need.需要) - if (PurchaseSkuList != null && PurchaseSkuList.Count > 0 && purchaseSkuList.Any(p => p.IsNeedCer)) + IsNeedPrintCer = Need.不需要; + if (PurchaseSkuList != null && PurchaseSkuList.Count > 0 && purchaseSkuList.Any(p => p.IsNeedCer)) + { + if (PurchaseSkuList.Where(p => p.IsSetCertificate).Count() > 0) { - //if () - //{ - // MessageBox.Show("无可用的合格证打印!"); - // return; - //} - if (PurchaseSkuList.Where(p => p.IsSetCertificate).Count() > 0) - { - MessageBox.Show("存在未确认的合格证,请先完成确认!"); - return; - } - - if (purchaseSkuList.Any(p => p.IsNeedCer && p.CerDTO == null)) - { - MessageBox.Show("有未设置的合格证,请设置完所有的合格证再保存"); - return; - } - if (PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Count() <= 0) - { - MessageBox.Show("无可选的合格证打印!"); - return; - } - request.CerId = string.Join(",", PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Select(p => p.CerDTO.Id)); - + MessageBox.Show("存在未确认的合格证,请先完成确认!"); + return; } - try - { - var competeRes = qualityTaskService.CompeteQualityTask(request); - if (competeRes == null) + if (purchaseSkuList.Any(p => p.IsNeedCer && p.CerDTO == null)) { - MessageBox.Show("网络异常"); + MessageBox.Show("有未设置的合格证,请设置完所有的合格证再保存"); return; } - if (!competeRes.Success) + if (PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Count() <= 0) { - MessageBox.Show(competeRes.Msg); + MessageBox.Show("无可选的合格证打印!"); return; } - BatchPrintWindow batchPrint = new BatchPrintWindow(BrandMarkType, IsNeedPrintCer, TaskId,BrandName, SkuCount, + request.CerId = string.Join(",", PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Select(p => p.CerDTO.Id)); + IsNeedPrintCer = Need.需要; + } + + try + { + + BatchPrintWindow batchPrint = new BatchPrintWindow(BrandMarkType, IsNeedPrintCer, TaskId, BrandName, SkuCount, PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO != null && p.CerDTO.Id > 0).Select(p => p.CerDTO).ToArray() - , BarCodeModel, qualityTaskService,()=> { + , BarCodeModel, qualityTaskService, () => + { ReflashWindow?.Invoke(); var window = obj as BWindow; @@ -590,8 +576,8 @@ namespace BBWY.Client.ViewModels batchPrint.ShowDialog(); - - + + } catch (Exception ex) @@ -840,6 +826,12 @@ namespace BBWY.Client.ViewModels })); //PurchaseSkuList.Add(item); } + + //if (cer == Need.不需要 && PurchaseSkuList != null) + // foreach (var item in PurchaseSkuList) + // { + // item.IsNeedCer = false; + // } } if (BarCodeModel == null) { diff --git a/BBWY.Client/Views/PackTask/PackDetailWindow.xaml b/BBWY.Client/Views/PackTask/PackDetailWindow.xaml index 72d0b5dc..fbc9da88 100644 --- a/BBWY.Client/Views/PackTask/PackDetailWindow.xaml +++ b/BBWY.Client/Views/PackTask/PackDetailWindow.xaml @@ -69,7 +69,6 @@ - @@ -81,7 +80,7 @@ - @@ -508,7 +507,7 @@ - + @@ -589,7 +588,7 @@ - + @@ -615,7 +614,7 @@ - + @@ -624,22 +623,22 @@ - + - + + > - - + + @@ -668,9 +667,10 @@ + diff --git a/BBWY.Client/Views/PackTask/PackDetailWindow.xaml.cs b/BBWY.Client/Views/PackTask/PackDetailWindow.xaml.cs index c9b7a61d..3e491976 100644 --- a/BBWY.Client/Views/PackTask/PackDetailWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/PackDetailWindow.xaml.cs @@ -2,6 +2,7 @@ using BBWY.Client.Helpers; using BBWY.Client.Models; using BBWY.Client.ViewModels.PackTask; +using BBWY.Client.Views.PackagingTask; using BBWY.Controls; using System; using System.Collections.Generic; @@ -40,7 +41,7 @@ namespace BBWY.Client.Views.PackTask var serviceViewModel = this.DataContext as PackDetailViewModel; if (model.Brand.IsNullOrEmpty()) { - if (model.BarCodeModel!=null&&!model.BarCodeModel.Brand.IsNullOrEmpty()) + if (model.BarCodeModel != null && !model.BarCodeModel.Brand.IsNullOrEmpty()) model.Brand = model.BarCodeModel.Brand; else if (model.CertificateModel != null && model.CertificateModel.Any(c => c.Brand != null)) model.Brand = model.CertificateModel.FirstOrDefault(c => c.Brand != null)?.Brand; @@ -65,8 +66,14 @@ namespace BBWY.Client.Views.PackTask serviceViewModel.OrderId = model.OrderId; serviceViewModel.SkuId = model.SkuId; serviceViewModel.PackUserName = model.PackUser?.Replace("\r\n", ",")?.Replace("\n", ",")?.Replace("\r", ","); + serviceViewModel.ProcessComboName = model.FeesItemResponse?.ProcessComboName; + serviceViewModel.PackCompletionOverTime = model.PackCompletionOverTime; + serviceViewModel.ConsumableNameList = model.FeesItemResponse?.ConsumableList?.Select(c => + { + return $"{c.ItemName}"; + })?.ToList(); - serviceViewModel.PackerFee = model.FeesItemResponse?.PackFees*(model.FeesItemResponse?.PackerDiscount??0.85m) ; + serviceViewModel.PackerFee = model.FeesItemResponse?.PackFees * (model.FeesItemResponse?.PackerDiscount ?? 0.85m); serviceViewModel.LoadPackDatas(); if (reflashWindow != null) serviceViewModel.ReflashWindow = reflashWindow; @@ -94,24 +101,27 @@ namespace BBWY.Client.Views.PackTask // MessageBox.Show("页面加载中,请重试!"); // return; //} - string printName = cbPrintName.Text.Trim(); - PrintBox(printName); - 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 - { + //string printName = cbPrintName.Text.Trim(); + //PrintBox(printName); + //var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + //string printNames = System.IO.Path.Combine(applicationPath, "printName.init"); + //try + //{ + // if (File.Exists(printNames)) + // { + // File.Delete(printNames); + // } + //} + //catch + //{ - } + //} - File.WriteAllText(printNames, cbPrintName.Text); + //File.WriteAllText(printNames, cbPrintName.Text); + //var serviceViewModel = this.DataContext as PackDetailViewModel; + + //serviceViewModel?.ReflashWindow?.Invoke(); return; } @@ -229,5 +239,19 @@ namespace BBWY.Client.Views.PackTask } } + private void BButton_Click_1(object sender, RoutedEventArgs e) + { + var serviceViewModel = this.DataContext as PackDetailViewModel; + + serviceViewModel.UpLoadPackCommand.Execute(this); + + + + + + + + + } } } diff --git a/BBWY.Client/Views/PackTask/WareHouseListControl.xaml b/BBWY.Client/Views/PackTask/WareHouseListControl.xaml index 0639bddc..a9ab31c0 100644 --- a/BBWY.Client/Views/PackTask/WareHouseListControl.xaml +++ b/BBWY.Client/Views/PackTask/WareHouseListControl.xaml @@ -185,7 +185,8 @@ - + + @@ -408,7 +409,7 @@ - + @@ -423,6 +424,37 @@ + + + + + + + + + + + + + + + + + + + + + + - - - + /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/PackagingTask/PrintPackDetailWindow.xaml.cs b/BBWY.Client/Views/PackagingTask/PrintPackDetailWindow.xaml.cs new file mode 100644 index 00000000..655e135f --- /dev/null +++ b/BBWY.Client/Views/PackagingTask/PrintPackDetailWindow.xaml.cs @@ -0,0 +1,131 @@ +using BBWY.Client.Models; +using BBWY.Client.Views.PackTask; +using BBWY.Client.Views.SplitTask; +using BBWY.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.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; +using WebSocketSharp; + +namespace BBWY.Client.Views.PackagingTask +{ + /// + /// PrintPackDetailWindow.xaml 的交互逻辑 + /// + public partial class PrintPackDetailWindow : BWindow + { + public PrintPackDetailWindow(PackDetailWindow printWindow) + { + InitializeComponent(); + InitPrintList(); + this.DataContext = this; + this.printWindow = printWindow; + } + + private PackTaskModel model; + PackDetailWindow printWindow; + + + /// + /// 打印机列表 + /// + public ObservableCollection PrintList { get; set; } + public string PrintName { get; set; } + public int PrintCount { get => printCount; set { Set(ref printCount, value); } } + private int printCount = 1; + + + public void InitPrintList() + { + + 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) + { + + + } + + } + private void BButton_Click(object sender, System.Windows.RoutedEventArgs e) + { + + + + + + + + if (PrintName.IsNullOrEmpty()) + { + MessageBox.Show("请选择打印设备"); + return; + } + + if (string.IsNullOrEmpty(PrintName)) + { + return; + } + var localPrintServer = new LocalPrintServer(); + var printQueue = localPrintServer.GetPrintQueue(PrintName); + if (printQueue.IsInError) + { + System.Windows.MessageBox.Show("打印机处于错误状态"); + return; + } + + for (int i = 0; i < PrintCount; i++) + { + printWindow.PrintBox(PrintName); + } + + this.Close(); + + + } + } +} diff --git a/BBWY.Client/Views/SomeArrival/PrintSomeArrivalWindow.xaml b/BBWY.Client/Views/SomeArrival/PrintSomeArrivalWindow.xaml new file mode 100644 index 00000000..90e5dacf --- /dev/null +++ b/BBWY.Client/Views/SomeArrival/PrintSomeArrivalWindow.xaml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/SomeArrival/PrintSomeArrivalWindow.xaml.cs b/BBWY.Client/Views/SomeArrival/PrintSomeArrivalWindow.xaml.cs new file mode 100644 index 00000000..4d4c6e8c --- /dev/null +++ b/BBWY.Client/Views/SomeArrival/PrintSomeArrivalWindow.xaml.cs @@ -0,0 +1,230 @@ +using BBWY.Client.APIServices.QiKu; +using BBWY.Client.Extensions; +using BBWY.Client.Models; +using BBWY.Client.Views.SplitTask; +using BBWY.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.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; +using WebSocketSharp; + +namespace BBWY.Client.Views.SomeArrival +{ + /// + /// PrintSomeArrivalWindow.xaml 的交互逻辑 + /// + public partial class PrintSomeArrivalWindow : BWindow + { + public PrintSomeArrivalWindow(PackTaskAbortService packTaskAbortService, PackTaskModel model, Action reFlashWindow, List shelvesNumberList, List floorNumberList) + { + InitializeComponent(); + InitPrintList(); + this.DataContext = this; + this.model = model; + this.packTaskAbortService = packTaskAbortService; + + if (!model.ShelvesNumber.IsNullOrEmpty()) + ShelvesNumber = model.ShelvesNumber; + + if (model.FloorNumber != null) FloorNumber = model.FloorNumber; + + if (model.AbortRemark != null) RemarkMsg = model.AbortRemark; + FloorNumberList = floorNumberList; + ShelvesNumberList = shelvesNumberList; + ReFlashWindow = reFlashWindow; + } + + + private string remarkMsg; + /// + /// 货架 + /// + public string RemarkMsg { get => remarkMsg; set { Set(ref remarkMsg, value); } } + + + + + + Action ReFlashWindow; + PackTaskAbortService packTaskAbortService; + + private List floorNumberList = new List { 1, 2, 3, 4 }; + /// + /// 层数列表 + /// + public List FloorNumberList { get => floorNumberList; set { Set(ref floorNumberList, value); } } + + private int? floorNumber; + /// + ///层数 + /// + public int? FloorNumber { get => floorNumber; set { Set(ref floorNumber, value); } } + + + private List shelvesNumberList; + /// + /// 货架列表 + /// + public List ShelvesNumberList { get => shelvesNumberList; set { Set(ref shelvesNumberList, value); } } + + private string shelvesNumber; + /// + /// 货架 + /// + public string ShelvesNumber { get => shelvesNumber; set { Set(ref shelvesNumber, value); } } + + + + private PackTaskModel model; + + + + /// + /// 打印机列表 + /// + public ObservableCollection PrintList { get; set; } + public string PrintName { get; set; } + public int PrintCount { get => printCount; set { Set(ref printCount, value); } } + private int printCount = 1; + + + public void InitPrintList() + { + + 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 void PrintBox() + { + } + + private void BButton_Click(object sender, System.Windows.RoutedEventArgs e) + { + if (PrintName.IsNullOrEmpty()) + { + MessageBox.Show("请选择打印设备"); + return; + } + + if (string.IsNullOrEmpty(PrintName)) + { + return; + } + var localPrintServer = new LocalPrintServer(); + var printQueue = localPrintServer.GetPrintQueue(PrintName); + if (printQueue.IsInError) + { + System.Windows.MessageBox.Show("打印机处于错误状态"); + return; + } + + if (ShelvesNumber.IsNullOrEmpty() || FloorNumber==null ) + { + MessageBox.Show("请输入摆放货架位置"); + return; + } + + var res = packTaskAbortService.SaveTaskShelves(model.TaskId, ShelvesNumber, FloorNumber,remarkMsg); + + if (res==null||!res.Success) + { + MessageBox.Show(res.Msg ?? "未知错误!"); + return; + } + + model.ShelvesNumber = ShelvesNumber; + model.FloorNumber = FloorNumber; + model.AbortRemark = RemarkMsg; + + + SomeArrivalWindow window = new SomeArrivalWindow(model); + //window.ShowDialog(); + for (int i = 0; i < PrintCount; i++) + { + window.Print(PrintName); + } + this.Close(); + + ReFlashWindow?.Invoke(); + + + try + { + var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + string printNames = System.IO.Path.Combine(applicationPath, "printName.init"); + try + { + if (File.Exists(printNames)) + { + File.Delete(printNames); + } + } + catch + { + + + } + + File.WriteAllText(printNames, PrintName); + } + catch (Exception) + { + + + } + } + } +} diff --git a/BBWY.Client/Views/SomeArrival/SomeArrivalWindow.xaml b/BBWY.Client/Views/SomeArrival/SomeArrivalWindow.xaml new file mode 100644 index 00000000..1fc3e1d7 --- /dev/null +++ b/BBWY.Client/Views/SomeArrival/SomeArrivalWindow.xaml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/SomeArrival/SomeArrivalWindow.xaml.cs b/BBWY.Client/Views/SomeArrival/SomeArrivalWindow.xaml.cs new file mode 100644 index 00000000..2b773741 --- /dev/null +++ b/BBWY.Client/Views/SomeArrival/SomeArrivalWindow.xaml.cs @@ -0,0 +1,62 @@ +using BBWY.Client.Helpers; +using BBWY.Client.Models; +using BBWY.Controls; +using System; +using System.Collections.Generic; +using System.Printing; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace BBWY.Client.Views.SomeArrival +{ + /// + /// SomeArrivalWindow.xaml 的交互逻辑 + /// + public partial class SomeArrivalWindow : BWindow + { + public SomeArrivalWindow(PackTaskModel model) + { + InitializeComponent(); + + this.DataContext = this; + Model = model; + } + private PackTaskModel model; + + public PackTaskModel Model { get => model; set { Set(ref model, value); } } + + public string taskIdRemark; + public string TaskIdRemark { get => taskIdRemark; set { Set(ref taskIdRemark, value); } } + + + public string remarkMsg; + public string RemarkMsg { get => remarkMsg; set { Set(ref remarkMsg, value); } } + + public string exceptType; + public string ExceptType { get => exceptType; set { Set(ref exceptType, value); } } + public void Print(string printName) + { + + MyPrintHelper.SetDefaultPrint(printName);//设置默认打印机 + PrintDialog printDialog = new PrintDialog(); + //Height="492" Width="272" 567 388 + printDialog.PrintTicket.PageOrientation = PageOrientation.ReversePortrait;//设置为横向打印 PageOrientation.Landscape Portrait为纵向 //设置纸张大小 + var pageWidth = (int)Math.Ceiling(printDialog.PrintableAreaWidth); + var pageHeight = (int)Math.Ceiling(printDialog.PrintableAreaHeight); + printDialog.PrintTicket.PageMediaSize = new PageMediaSize(pageWidth, pageHeight); + print_box.Height = pageHeight; + print_box.Width = pageWidth; + this.print_box.Arrange(new Rect(new System.Windows.Point(0, 0), new System.Windows.Size(pageWidth, pageHeight))); + this.UpdateLayout(); //刷新界面 + printDialog.PrintVisual(this.print_box, "打印任务"); + this.Close(); + } + } +} diff --git a/BBWY.Client/Views/SplitTask/PrintExceptionTaskWindow.xaml b/BBWY.Client/Views/SplitTask/PrintExceptionTaskWindow.xaml index 04e24f58..16caf010 100644 --- a/BBWY.Client/Views/SplitTask/PrintExceptionTaskWindow.xaml +++ b/BBWY.Client/Views/SplitTask/PrintExceptionTaskWindow.xaml @@ -37,7 +37,6 @@ Style="{StaticResource bwstyle}" Background="{StaticResource Border.Background}"> - @@ -58,9 +57,6 @@ Style="{StaticResource bwstyle}" - - - diff --git a/BBWY.Client/Views/SplitTask/PrintExceptionTaskWindow.xaml.cs b/BBWY.Client/Views/SplitTask/PrintExceptionTaskWindow.xaml.cs index 6a7e36ec..a2225e82 100644 --- a/BBWY.Client/Views/SplitTask/PrintExceptionTaskWindow.xaml.cs +++ b/BBWY.Client/Views/SplitTask/PrintExceptionTaskWindow.xaml.cs @@ -1,6 +1,7 @@ using BBWY.Client.Models; using BBWY.Client.Models.APIModel; using BBWY.Client.Views.FallWare; +using BBWY.Client.Views.PackTask; using BBWY.Controls; using System; using System.Collections.Generic; @@ -116,8 +117,12 @@ namespace BBWY.Client.Views.SplitTask } ExceptionTaskWindow window = new ExceptionTaskWindow(model); - //window.ShowDialog(); - window.Print(PrintName); + for (int i = 0; i < PrintCount; i++) + { + window.Print(PrintName); + } + + this.Close();