From 363ae4004523e6d77df895885bd13515405fabe2 Mon Sep 17 00:00:00 2001 From: "liulb@mesnac.com" Date: Wed, 20 Dec 2023 23:24:10 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Admin.Core.Api/Admin.Core.Model.xml | 92 ++++++------ .../IPrintBarCodeRepository.cs | 3 +- Admin.Core.Model/Model_New/PrintBarCode.cs | 10 +- Admin.Core.Model/Model_New/PrintOrderInfo.cs | 2 +- .../Repository_New/BaseOrderInfoRepository.cs | 2 +- .../Repository_New/PrintBarCodeRepository.cs | 1 + .../Service_New/BaseOrderInfoServices.cs | 74 ++++++---- Aucma.Core.PrintTo/Models/BarCodeModel.cs | 4 + .../ViewModels/IndexPageViewModel.cs | 134 ++++++++---------- .../ViewModels/PrintToDevViewModel.cs | 98 ++++++++++--- .../SupplementPrintPageViewModel.cs | 4 +- Aucma.Core.PrintTo/Views/IndexPageView.xaml | 35 ++--- .../Views/PrintToDevView.xaml.cs | 4 +- Aucma.Core.PrintTo/appsettings.json | 4 +- 14 files changed, 262 insertions(+), 205 deletions(-) diff --git a/Admin.Core.Api/Admin.Core.Model.xml b/Admin.Core.Api/Admin.Core.Model.xml index 1a9bf96c..56079ce8 100644 --- a/Admin.Core.Api/Admin.Core.Model.xml +++ b/Admin.Core.Api/Admin.Core.Model.xml @@ -681,51 +681,6 @@ 更新时间 - - - 打印条码信息 - - - - - 主键 - - - - - 订单号 - - - - - 物料编码 - - - - - 物料名称 - - - - - 条码 - - - - - 打印时间 - - - - - 补打个数 - - - - - 打印类型:箱壳、内胆 - - 打印信息表 @@ -738,7 +693,7 @@ - 工单编号 + SAP计划编号 @@ -1746,6 +1701,51 @@ 更新时间 + + + 打印条码信息 + + + + + 主键 + + + + + SAP计划编号 + + + + + 物料编码 + + + + + 物料名称 + + + + + 条码 + + + + + 打印时间 + + + + + 补打个数 + + + + + 打印类型:箱壳、内胆 + + 订单执行表 diff --git a/Admin.Core.IRepository/IRepository_New/IPrintBarCodeRepository.cs b/Admin.Core.IRepository/IRepository_New/IPrintBarCodeRepository.cs index c16102a6..1874fce0 100644 --- a/Admin.Core.IRepository/IRepository_New/IPrintBarCodeRepository.cs +++ b/Admin.Core.IRepository/IRepository_New/IPrintBarCodeRepository.cs @@ -1,4 +1,5 @@ -using Admin.Core.Model.Model_New; +using Admin.Core.Model; +using Admin.Core.Model.Model_New; namespace Admin.Core.IRepository { diff --git a/Admin.Core.Model/Model_New/PrintBarCode.cs b/Admin.Core.Model/Model_New/PrintBarCode.cs index 57341f6d..6d46a5a0 100644 --- a/Admin.Core.Model/Model_New/PrintBarCode.cs +++ b/Admin.Core.Model/Model_New/PrintBarCode.cs @@ -1,11 +1,7 @@ using SqlSugar; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -namespace Admin.Core.Model.Model_New +namespace Admin.Core.Model { /// /// 打印条码信息 @@ -18,9 +14,9 @@ namespace Admin.Core.Model.Model_New /// [SugarColumn(ColumnName = "OBJ_ID", IsIdentity = true, IsPrimaryKey = true)] public int ObjId { get; set; } - + /// - /// 订单号 + /// SAP计划编号 /// [SugarColumn(ColumnName = "ORDER_CODE")] public string OrderCode { get; set; } diff --git a/Admin.Core.Model/Model_New/PrintOrderInfo.cs b/Admin.Core.Model/Model_New/PrintOrderInfo.cs index 8fc93833..f368ba9e 100644 --- a/Admin.Core.Model/Model_New/PrintOrderInfo.cs +++ b/Admin.Core.Model/Model_New/PrintOrderInfo.cs @@ -21,7 +21,7 @@ namespace Admin.Core.Model.Model_New public int ObjId { get; set; } /// - /// 工单编号 + /// SAP计划编号 /// [SugarColumn(ColumnName = "ORDER_CODE")] public string OrderCode { get; set; } diff --git a/Admin.Core.Repository/Repository_New/BaseOrderInfoRepository.cs b/Admin.Core.Repository/Repository_New/BaseOrderInfoRepository.cs index 7f3f7b9b..d35e191c 100644 --- a/Admin.Core.Repository/Repository_New/BaseOrderInfoRepository.cs +++ b/Admin.Core.Repository/Repository_New/BaseOrderInfoRepository.cs @@ -17,7 +17,7 @@ namespace Admin.Core.Repository public async Task> GetOrderInfoData() { - string sql = $"select o.* from BASE_ORDERINFO o inner join BASE_BOMINFO b on o.MATERIAL_CODE=b.PARENT_ID "; + string sql = $"select DISTINCT o.* from (select r.* from BASE_ORDERINFO r left join BASE_MATERIALINFO m on r.MATERIAL_CODE=m.MATERIAL_CODE where MATERIAL_SUBCLASS='100') o left join BASE_BOMINFO b on o.MATERIAL_CODE=b.PARENT_ID "; return await Db.Ado.SqlQueryAsync(sql); } } diff --git a/Admin.Core.Repository/Repository_New/PrintBarCodeRepository.cs b/Admin.Core.Repository/Repository_New/PrintBarCodeRepository.cs index ef9f2301..88db4d49 100644 --- a/Admin.Core.Repository/Repository_New/PrintBarCodeRepository.cs +++ b/Admin.Core.Repository/Repository_New/PrintBarCodeRepository.cs @@ -1,5 +1,6 @@ using Admin.Core.Model.Model_New; using Admin.Core.IRepository; +using Admin.Core.Model; namespace Admin.Core.Repository { diff --git a/Admin.Core.Service/Service_New/BaseOrderInfoServices.cs b/Admin.Core.Service/Service_New/BaseOrderInfoServices.cs index e195d782..506b9bce 100644 --- a/Admin.Core.Service/Service_New/BaseOrderInfoServices.cs +++ b/Admin.Core.Service/Service_New/BaseOrderInfoServices.cs @@ -5,6 +5,7 @@ using Admin.Core.Model; using Admin.Core.Model.Model_New; using Admin.Core.Model.ViewModels; using Castle.Core.Internal; +using Dm.filter.log; using Microsoft.Extensions.Hosting; using NPOI.POIFS.FileSystem; using NPOI.POIFS.Properties; @@ -29,17 +30,19 @@ namespace Admin.Core.Service private readonly IPrintOrderInfoRepository _printOrderInfoRepository; private readonly IBaseOrderInfoRepository _baseOrderInfoRepository; private readonly IBaseBomInfoRepository _baseBomInfoRepository; - + private readonly IPrintBarCodeServices _printBarCodeServices; + static List tmpList = new List(); public BaseOrderInfoServices(IBaseRepository dal, IBaseOrderInfoRepository baseOrderInfoRepository, IPrintOrderInfoRepository printOrderInfoRepository, - IBaseBomInfoRepository baseBomInfoRepository) + IBaseBomInfoRepository baseBomInfoRepository, IPrintBarCodeServices printBarCodeServices) { this._dal = dal; base.BaseDal = dal; _baseBomInfoRepository = baseBomInfoRepository; _baseOrderInfoRepository = baseOrderInfoRepository; _printOrderInfoRepository = printOrderInfoRepository; + _printBarCodeServices = printBarCodeServices; } public async Task> GetOrderInfoData() @@ -57,36 +60,55 @@ namespace Admin.Core.Service { List list = new List(); List baseBomList = await _baseBomInfoRepository.QueryAsync(); + List printBarCodeList = await _printBarCodeServices.QueryAsync(); List orderList = await this.GetOrderInfoData(); List printOrderInfoList = await _printOrderInfoRepository.QueryAsync(); - tmpList.Clear(); + if (orderList == null) return null; - orderList.ForEach( bb => + orderList.ForEach(bb => { - GetParentID(baseBomList, bb.MaterialCode); - if (tmpList.Count > 0) + //GetParentID(baseBomList, bb.MaterialCode); + //tmpList = tmpList.Where(d => d.MaterialType.Equals("500") || d.MaterialType.Equals("200")).ToList(); + //if (tmpList.Count > 0) + //{ + // foreach (var bomInfo in tmpList) + // { + var objBox = printBarCodeList.Where(d => d.PrintBarType==1&&d.OrderCode==bb.OrderCode); + var objLiner = printBarCodeList.Where(d => d.PrintBarType == 2&& d.OrderCode == bb.OrderCode); + + PrintPlanInfoView view = new PrintPlanInfoView(); + view.OrderCode = bb.OrderCode; + view.ProductCode = bb.MaterialCode; + view.ProductName = bb.MaterialName; + view.PlanAmount = bb.OrderAmount; + //view.MaterialCode = bomInfo.MaterialCode; + //view.MaterialName = bomInfo.MaterialName; + //view.LinerAmount = bomInfo.StandardAmount; + if (objLiner.Count() > 0) { - foreach (var bomInfo in tmpList.Where(d=>d.MaterialType.Equals("500")|| d.MaterialType.Equals("200"))) - { - list.Add(new PrintPlanInfoView() - { - OrderCode = bb.OrderCode, - ProductCode = bb.MaterialCode, - ProductName = bb.MaterialName, - PlanAmount = bb.OrderAmount, - MaterialCode = bomInfo.MaterialCode, - MaterialName = bomInfo.MaterialName, - LinerAmount = bomInfo.StandardAmount, - BoxAmount = bomInfo.StandardAmount, - StandardAmount = bomInfo.StandardAmount, - PrintName = bb.PrintName, - CreateTime = bb.CreatedTime - }); - } + view.LinerAmount = objLiner.Count(); + } + else + { + view.LinerAmount = 0; + } + if (objBox.Count() > 0) + { + view.BoxAmount = objBox.Count(); + } + else + { + view.BoxAmount = 0; } - }); - + //view.StandardAmount = bomInfo.StandardAmount; + view.PrintName = bb.PrintName; + view.CreateTime = bb.CreatedTime; + list.Add(view); + // } + // tmpList.Clear(); + //} + }); list.ForEach(b => { if (printOrderInfoList != null) @@ -100,7 +122,7 @@ namespace Admin.Core.Service } else { - b.LinerAmount =0; + b.LinerAmount = 0; b.BoxAmount = 0; } }); diff --git a/Aucma.Core.PrintTo/Models/BarCodeModel.cs b/Aucma.Core.PrintTo/Models/BarCodeModel.cs index f902874a..f53807cf 100644 --- a/Aucma.Core.PrintTo/Models/BarCodeModel.cs +++ b/Aucma.Core.PrintTo/Models/BarCodeModel.cs @@ -41,5 +41,9 @@ namespace Aucma.Core.PrintTo.Models /// 补打个数SuppleMetNum /// public int SuppleMetNum { get; set; } + /// + /// 打印类型 + /// + public int PrintType { get; set; } } } diff --git a/Aucma.Core.PrintTo/ViewModels/IndexPageViewModel.cs b/Aucma.Core.PrintTo/ViewModels/IndexPageViewModel.cs index 37ada2ee..ab54e394 100644 --- a/Aucma.Core.PrintTo/ViewModels/IndexPageViewModel.cs +++ b/Aucma.Core.PrintTo/ViewModels/IndexPageViewModel.cs @@ -24,6 +24,10 @@ namespace Aucma.Core.PrintTo.ViewModels { private static readonly log4net.ILog log = LogManager.GetLogger(typeof(IndexPageViewModel)); protected readonly IBaseOrderInfoServices _baseOrderInfoServices; + /// + /// 打印类型 + /// + public int printType { get; set; } public IndexPageViewModel() { @@ -37,55 +41,64 @@ namespace Aucma.Core.PrintTo.ViewModels #region 加载DataGrid数据 private async void LoadData() - { - Datalist.Clear(); - List list = await _baseOrderInfoServices.QueryPrintInfo(); - if (list == null) return; - foreach (var item in list) + { + try { - datalist.Add(new OrderInfo() + Datalist.Clear(); + List list = await _baseOrderInfoServices.QueryPrintInfo(); + if (list == null) return; + list= list.OrderBy(d => d.CreateTime).ToList(); + foreach (var item in list) { - CreatedTime = item.CreateTime, - OrderCode = item.OrderCode, - ProductCode = item.ProductCode, - ProductName = item.ProductName, - PlanAmount = item.PlanAmount, - CompleteAmount = item.CompleteAmount, - MaterialCode = item.MaterialCode, - MaterialName = item.MaterialName, - StandardAmount = item.StandardAmount, - LinerAmount = item.LinerAmount, - BoxAmount = item.StandardAmount, - ErrorNum = item.ErrorAmount, - LinerCodeNum = item.LinerAmount, - BoxCodeNum = item.BoxAmount - }); + OrderInfo order = new OrderInfo(); + order.CreatedTime = item.CreateTime; + order.OrderCode = item.OrderCode; + order.ProductCode = item.ProductCode; + order.ProductName = item.ProductName; + order.PlanAmount = item.PlanAmount; + order.CompleteAmount = item.CompleteAmount; + order.MaterialCode = item.MaterialCode; + order.MaterialName = item.MaterialName; + order.StandardAmount = item.StandardAmount; + order.LinerAmount = item.LinerAmount; + order.BoxAmount = item.StandardAmount; + order.ErrorNum = item.ErrorAmount; + order.LinerCodeNum = item.LinerAmount; + order.BoxCodeNum = item.BoxAmount; + order.PrintName = item.PrintName; + datalist.Add(order); + } + } + catch (Exception ex) + { + log.Error(ex.Message); } } private async void LoadData(string queryStr) { Datalist.Clear(); List list = await _baseOrderInfoServices.QueryPrintInfo(); - if (list == null) return; - foreach (var item in list.Where(d => d.OrderCode.Contains(queryStr) || d.ProductCode.Contains(queryStr) || d.ProductName.Contains(queryStr) || d.MaterialCode.Contains(queryStr) || d.MaterialName.Contains(queryStr))) + if (list.Count() == 0) return; + List pintList = list.Where(d => d.OrderCode.Contains(queryStr) || d.ProductCode.Contains(queryStr) || d.ProductName.Contains(queryStr)).ToList(); + foreach (var item in pintList) { - Datalist.Add(new OrderInfo() - { - CreatedTime = item.CreateTime, - OrderCode = item.OrderCode, - ProductCode = item.ProductCode, - ProductName = item.ProductName, - PlanAmount = item.PlanAmount, - CompleteAmount = item.CompleteAmount, - MaterialCode = item.MaterialCode, - MaterialName = item.MaterialName, - StandardAmount = item.StandardAmount, - LinerAmount = item.LinerAmount, - BoxAmount = item.StandardAmount, - ErrorNum = item.ErrorAmount, - LinerCodeNum = item.LinerAmount, - BoxCodeNum = item.BoxAmount - }); + OrderInfo order = new OrderInfo(); + order.CreatedTime = item.CreateTime; + order.OrderCode = item.OrderCode; + order.ProductCode = item.ProductCode; + order.ProductName = item.ProductName; + order.PlanAmount = item.PlanAmount; + order.CompleteAmount = item.CompleteAmount; + order.MaterialCode = item.MaterialCode; + order.MaterialName = item.MaterialName; + order.StandardAmount = item.StandardAmount; + order.LinerAmount = item.LinerAmount; + order.BoxAmount = item.StandardAmount; + order.ErrorNum = item.ErrorAmount; + order.LinerCodeNum = item.LinerAmount; + order.BoxCodeNum = item.BoxAmount; + order.PrintName = item.PrintName; + datalist.Add(order); } } #endregion @@ -119,7 +132,7 @@ namespace Aucma.Core.PrintTo.ViewModels log.Error("QueryString方法出现异常"); } } - + #endregion #region radio查询按钮 @@ -127,36 +140,15 @@ namespace Aucma.Core.PrintTo.ViewModels /// 查询 /// [RelayCommand] - private async Task RadioQuery(string query) + private void RadioQuery(string type) { - try + if (type== "内胆") { - string materialName= string.Empty; - - Datalist.Clear(); - var list = await _baseOrderInfoServices.QueryPrintInfo(); - var orderList = list.Where(d => d.MaterialName.Contains(query) ); - foreach (var item in orderList) - { - OrderInfo info = new OrderInfo(); - info.CreatedTime = item.CreateTime; - info.OrderCode = item.OrderCode; - info.ProductCode = item.ProductCode; - info.ProductName = item.ProductName; - info.PlanAmount = item.PlanAmount; - info.CompleteAmount = item.CompleteAmount; - info.MaterialCode = item.MaterialCode; - info.MaterialName = item.MaterialName; - info.StandardAmount = item.StandardAmount; - info.ErrorNum = item.ErrorAmount; - info.LinerCodeNum = item.LinerAmount; - info.BoxCodeNum = item.BoxAmount; - Datalist.Add(info); - } + printType = 200; } - catch (Exception ex) + if (type == "箱体") { - log.Error("查询数据异常", ex); + printType = 500; } } #endregion @@ -188,13 +180,13 @@ namespace Aucma.Core.PrintTo.ViewModels string order_code = SelectedCells.OrderCode; string product_code = SelectedCells.ProductCode; string product_name = SelectedCells.ProductName; - string material_code = SelectedCells.MaterialCode; - string material_name = SelectedCells.MaterialName; + //string material_code = SelectedCells.MaterialCode; + //string material_name = SelectedCells.MaterialName; int standard_amount = SelectedCells.StandardAmount; string printName = SelectedCells.PrintName; PrintIsEnabled = "False"; - PrintToDevView printToDev = new PrintToDevView(product_code, material_code, material_name, standard_amount, printName); + PrintToDevView printToDev = new PrintToDevView(order_code,product_code, product_name, standard_amount, printName,printType); printToDev.ShowDialog(); } catch (Exception ex) @@ -255,7 +247,7 @@ namespace Aucma.Core.PrintTo.ViewModels int standard_amount = SelectedCells.StandardAmount; string printName = SelectedCells.PrintName; PrintIsEnabled = "False"; - PrintToDevView printToDev = new PrintToDevView(product_code, material_code, material_name, standard_amount, printName); + PrintToDevView printToDev = new PrintToDevView(order_code, product_code, product_name, standard_amount, printName, printType); printToDev.ShowDialog(); } catch (Exception ex) diff --git a/Aucma.Core.PrintTo/ViewModels/PrintToDevViewModel.cs b/Aucma.Core.PrintTo/ViewModels/PrintToDevViewModel.cs index 16460378..12fd4a93 100644 --- a/Aucma.Core.PrintTo/ViewModels/PrintToDevViewModel.cs +++ b/Aucma.Core.PrintTo/ViewModels/PrintToDevViewModel.cs @@ -1,21 +1,17 @@ using Admin.Core.Common; using Admin.Core.IService; +using Admin.Core.Model; using Admin.Core.Model.Model_New; -using Admin.Core.Model.ViewModels; -using Admin.Core.Service; using Aucma.Core.PrintTo.Common; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Messaging; using FastReport; -using FastReport.DevComponents.DotNetBar; using log4net; using Microsoft.Extensions.DependencyInjection; -using NPOI.SS.Formula.Functions; using StackExchange.Profiling.Internal; using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -29,13 +25,15 @@ namespace Aucma.Core.PrintTo.ViewModels protected readonly IOrderBomInfoServices _orderBomInfoServices; protected readonly IPrintBarCodeServices _printBarCodeServices; + protected readonly IBaseBomInfoServices _baseBomInfoServices; + static List tmpList = new List(); - private List items { get; } - private Queue BarcodesUnprinted { get; } = new Queue(); - private Queue BarcodesPrinted { get; } = new Queue(); + private List items { get; } + private Queue BarcodesUnprinted { get; } = new Queue(); + private Queue BarcodesPrinted { get; } = new Queue(); private PrintState printState { get; set; } = PrintState.Idle;//打印状态 protected bool isPrint { get; set; } = true;//打印标志 - + public int _printType { get; set; }//打印类型 #region 构造函数 /// /// 构造函数 @@ -44,13 +42,16 @@ namespace Aucma.Core.PrintTo.ViewModels /// 物料编码 /// 型号简码 /// 打印数量 - public PrintToDevViewModel(string productCode, string materialCode, string materialName, int printAmount,string printName) + public PrintToDevViewModel(string order_code,string productCode, string productName, int printAmount,string printName,int printType) { _orderBomInfoServices = App.ServiceProvider.GetService(); _printBarCodeServices = App.ServiceProvider.GetService(); + _baseBomInfoServices = App.ServiceProvider.GetService(); + + _orderCode = order_code; ProductCode = productCode; - MaterialName = materialName; - MaterialCode= materialCode; + //MaterialName = materialName; + //MaterialCode= materialCode; PrintAmount = printAmount; PrintName = printName; Progress = 0; @@ -60,16 +61,23 @@ namespace Aucma.Core.PrintTo.ViewModels printState = PrintState.Printing; SuspendEnabled = "False";//暂停打印 OperateEnabled = "True";//打印 + _printType = printType; // 非阻塞打印 Task.Run(async () => { - await ExecPrintAsync(productCode, materialCode, printAmount); + await ExecPrintAsync(productCode, printType, printAmount); }); - } + } #endregion #region 选中订单参数 + #region 订单编码 + private string _orderCode; + + public string OrderCode { get => _orderCode; set => SetProperty(ref _orderCode, value); } + #endregion + #region 订单编码 private string _orderNo; @@ -240,16 +248,40 @@ namespace Aucma.Core.PrintTo.ViewModels /// 订单号 /// 物料码 /// 打印数量 - public async Task ExecPrintAsync(string orderNo, string materialCode, int planAmount) + public async Task ExecPrintAsync(string productCode, int printType, int planAmount) { - var obj = await _orderBomInfoServices.FirstAsync(d => d.MaterialCode == materialCode); - if (obj == null) + tmpList.Clear(); + BaseBomInfo baseBomInfo = null; + List orderBomInfoList = await _baseBomInfoServices.QueryAsync(); + if (printType==1)//箱壳 { - MessageBox.Show("无法查询打印条码数据", "系统提醒"); + GetParentID(orderBomInfoList, productCode); + //OrderBomInfo obj = await _orderBomInfoServices.FirstAsync(d => d.MaterialCode == materialCode); + if (tmpList.Count() == 0) + { + MessageBox.Show("无法查询打印条码数据", "系统提醒"); + return; + } + baseBomInfo= tmpList.FirstOrDefault(d=>d.MaterialType=="200"); + } + if (printType == 2)//内胆 + { + GetParentID(orderBomInfoList, productCode); + + if (tmpList.Count() == 0) + { + MessageBox.Show("无法查询打印条码数据,数据为空!", "系统提醒"); + return; + } + baseBomInfo = tmpList.FirstOrDefault(d => d.MaterialType == "500"); + } + + if (baseBomInfo == null) + { + MessageBox.Show("无法查询打印条码数据,数据为空", "系统提醒"); return; } - - for (int i = 0; i < planAmount; i++) { BarcodesUnprinted.Enqueue(obj); } + for (int i = 0; i < planAmount; i++) { BarcodesUnprinted.Enqueue(baseBomInfo); } } #endregion @@ -274,7 +306,7 @@ namespace Aucma.Core.PrintTo.ViewModels { var item = BarcodesUnprinted.Peek(); string barCode = string.Empty; - if (item.MaterialName.Contains("U壳")) + if (_printType== 500) { string rowNum = await GetMaxNumAsync(item.MaterialCode,"B");//最大值+1 barCode = $"B{DateTime.Now.ToString("yyMMdd")}{item.MaterialCode}{rowNum}"; @@ -283,7 +315,7 @@ namespace Aucma.Core.PrintTo.ViewModels printBarCode.PrintBarType = 1; Console.WriteLine($"B{DateTime.Now.ToString("yyMMdd")}{item.MaterialCode}{rowNum}"); } - if (item.MaterialName.Contains("内胆")) + if (_printType == 200) { string rowNum = await GetMaxNumAsync(item.MaterialCode, "L");//最大值+1 barCode = $"L{DateTime.Now.ToString("yyMMdd")}{item.MaterialCode}{rowNum}"; @@ -305,7 +337,7 @@ namespace Aucma.Core.PrintTo.ViewModels //barReport.PrintSettings.PageRange = "1-3"; // 设置打印页范围 barReport.SetParameterValue("BoxBarData.Id", barCode); - barReport.SetParameterValue("BoxBarData.Order_No", ProductCode);//订单号 + barReport.SetParameterValue("BoxBarData.Order_No", _orderCode);//订单号 barReport.SetParameterValue("BoxBarData.Order_Material_Name", PrintName);//物料简码 barReport.SetParameterValue("BoxBarData.Bar_Code", barCode);//二维码 @@ -423,5 +455,25 @@ namespace Aucma.Core.PrintTo.ViewModels OperateEnabled = "True"; } #endregion + + + #region 递归 + public static void GetParentID(List treeNodes, string materialCode) + { + if (string.IsNullOrEmpty(materialCode)) + { + return; + } + var query = from c in treeNodes + where c.ParentId == materialCode + select c; + foreach (var item in query) + { + GetParentID(treeNodes, item.MaterialCode); + tmpList.Add(item); + } + } + + #endregion } } diff --git a/Aucma.Core.PrintTo/ViewModels/SupplementPrintPageViewModel.cs b/Aucma.Core.PrintTo/ViewModels/SupplementPrintPageViewModel.cs index 83a866e2..6c6ebcec 100644 --- a/Aucma.Core.PrintTo/ViewModels/SupplementPrintPageViewModel.cs +++ b/Aucma.Core.PrintTo/ViewModels/SupplementPrintPageViewModel.cs @@ -83,8 +83,8 @@ namespace Aucma.Core.PrintTo.ViewModels var materialName = SelectedCells.MaterialName; var printName = SelectedCells.PrintName; var barCode = SelectedCells.BarCode; - - PrintToDevView printToDev = new PrintToDevView(productCode, materialCode, materialName, 1, printName); + var printType= SelectedCells.PrintType; + PrintToDevView printToDev = new PrintToDevView(productCode, materialCode, materialName, 1, printName,printType); printToDev.ShowDialog(); } #endregion diff --git a/Aucma.Core.PrintTo/Views/IndexPageView.xaml b/Aucma.Core.PrintTo/Views/IndexPageView.xaml index 8bd6b676..818a50c1 100644 --- a/Aucma.Core.PrintTo/Views/IndexPageView.xaml +++ b/Aucma.Core.PrintTo/Views/IndexPageView.xaml @@ -181,15 +181,15 @@ - - - - - - - - - + + + + + + + + + @@ -208,7 +208,6 @@ - @@ -228,27 +227,17 @@ materialDesign:HintAssist.Hint="产品型号" /> - - - - - - - - - + - + @@ -257,7 +246,7 @@ - + /// /// - public void Configure(IApplicationBuilder app, ISysTasksQzService tasksQzService, ISchedulerCenter schedulerCenter) + public void Configure(IApplicationBuilder app,IScannerGunService scannerGun) { // ʹþ̬ļ app.UseStaticFiles(); //app.AucmaTaskMildds(aucamTaskService); // QuartzNetJobȷ - app.UseQuartzJobMildd(tasksQzService, schedulerCenter); + //app.UseQuartzJobMildd(tasksQzService, schedulerCenter); + app.UseScannerGunMildd(scannerGun); } #region ע diff --git a/Aucma.Core.ScannerGun/ScannerGunService.cs b/Aucma.Core.ScannerGun/ScannerGunService.cs index 9b814ac5..456b960a 100644 --- a/Aucma.Core.ScannerGun/ScannerGunService.cs +++ b/Aucma.Core.ScannerGun/ScannerGunService.cs @@ -17,7 +17,7 @@ namespace Aucma.Core.ScannerGun /// public static void InitScanCode() { - string COM1 = "com3"; + string COM1 = "COM4"; InstanceSerialPort3(COM1); }