liuwf 1 year ago
commit 59bb9e6821

@ -681,51 +681,6 @@
更新时间
</summary>
</member>
<member name="T:Admin.Core.Model.Model_New.PrintBarCode">
<summary>
打印条码信息
</summary>
</member>
<member name="P:Admin.Core.Model.Model_New.PrintBarCode.ObjId">
<summary>
主键
</summary>
</member>
<member name="P:Admin.Core.Model.Model_New.PrintBarCode.OrderCode">
<summary>
订单号
</summary>
</member>
<member name="P:Admin.Core.Model.Model_New.PrintBarCode.MaterialCode">
<summary>
物料编码
</summary>
</member>
<member name="P:Admin.Core.Model.Model_New.PrintBarCode.MaterialName">
<summary>
物料名称
</summary>
</member>
<member name="P:Admin.Core.Model.Model_New.PrintBarCode.MaterialBarcode">
<summary>
条码
</summary>
</member>
<member name="P:Admin.Core.Model.Model_New.PrintBarCode.PrintTime">
<summary>
打印时间
</summary>
</member>
<member name="P:Admin.Core.Model.Model_New.PrintBarCode.SupplementMaterial">
<summary>
补打个数
</summary>
</member>
<member name="P:Admin.Core.Model.Model_New.PrintBarCode.PrintBarType">
<summary>
打印类型:箱壳、内胆
</summary>
</member>
<member name="T:Admin.Core.Model.Model_New.PrintOrderInfo">
<summary>
打印信息表
@ -738,7 +693,7 @@
</member>
<member name="P:Admin.Core.Model.Model_New.PrintOrderInfo.OrderCode">
<summary>
工单编号
SAP计划编号
</summary>
</member>
<member name="P:Admin.Core.Model.Model_New.PrintOrderInfo.MaterialCode">
@ -1746,6 +1701,51 @@
更新时间
</summary>
</member>
<member name="T:Admin.Core.Model.PrintBarCode">
<summary>
打印条码信息
</summary>
</member>
<member name="P:Admin.Core.Model.PrintBarCode.ObjId">
<summary>
主键
</summary>
</member>
<member name="P:Admin.Core.Model.PrintBarCode.OrderCode">
<summary>
SAP计划编号
</summary>
</member>
<member name="P:Admin.Core.Model.PrintBarCode.MaterialCode">
<summary>
物料编码
</summary>
</member>
<member name="P:Admin.Core.Model.PrintBarCode.MaterialName">
<summary>
物料名称
</summary>
</member>
<member name="P:Admin.Core.Model.PrintBarCode.MaterialBarcode">
<summary>
条码
</summary>
</member>
<member name="P:Admin.Core.Model.PrintBarCode.PrintTime">
<summary>
打印时间
</summary>
</member>
<member name="P:Admin.Core.Model.PrintBarCode.SupplementMaterial">
<summary>
补打个数
</summary>
</member>
<member name="P:Admin.Core.Model.PrintBarCode.PrintBarType">
<summary>
打印类型:箱壳、内胆
</summary>
</member>
<member name="T:Admin.Core.Model.ProductOrderInfo">
<summary>
订单执行表

@ -21,6 +21,7 @@ namespace Admin.Core.Extensions
if (Appsettings.app("Middleware", "ScannerGun", "Enabled").ObjToBool())
{
scannerGun.ScannerGunAsync();
Console.WriteLine("扫码枪服务启动");
}
}
catch (Exception e)

@ -1,4 +1,5 @@
using Admin.Core.Model.Model_New;
using Admin.Core.Model;
using Admin.Core.Model.Model_New;
namespace Admin.Core.IRepository
{

@ -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
{
/// <summary>
/// 打印条码信息
@ -18,9 +14,9 @@ namespace Admin.Core.Model.Model_New
/// </summary>
[SugarColumn(ColumnName = "OBJ_ID", IsIdentity = true, IsPrimaryKey = true)]
public int ObjId { get; set; }
/// <summary>
/// 订单
/// SAP计划编
/// </summary>
[SugarColumn(ColumnName = "ORDER_CODE")]
public string OrderCode { get; set; }

@ -21,7 +21,7 @@ namespace Admin.Core.Model.Model_New
public int ObjId { get; set; }
/// <summary>
/// 工单编号
/// SAP计划编号
/// </summary>
[SugarColumn(ColumnName = "ORDER_CODE")]
public string OrderCode { get; set; }

@ -2,6 +2,7 @@ using Admin.Core.Common;
using Admin.Core.Extensions;
using Admin.Core.IService.ISys;
using Admin.Core.Tasks;
using Aucma.Core.ScannerGun;
using Aucma.Core.Tasks;
using Autofac;
using Microsoft.AspNetCore.Builder;
@ -54,10 +55,10 @@ namespace Admin.Core.RealTimeService
services.AddAutoMapperSetup();
//任务调度
services.AddJobSetup();
//services.AddJobSetup();
//任务
// services.AddAucmaTaskSetup();
services.AddScannerGunSetup();
//支持编码大全 例如:支持 System.Text.Encoding.GetEncoding("GB2312") System.Text.Encoding.GetEncoding("GB18030")
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
}
@ -78,13 +79,14 @@ namespace Admin.Core.RealTimeService
/// </summary>
/// <param name="app"></param>
/// <param name="env"></param>
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 注册服务

@ -17,7 +17,7 @@ namespace Admin.Core.Repository
public async Task<List<BaseOrderInfo>> 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<BaseOrderInfo>(sql);
}
}

@ -1,5 +1,6 @@
using Admin.Core.Model.Model_New;
using Admin.Core.IRepository;
using Admin.Core.Model;
namespace Admin.Core.Repository
{

@ -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<BaseBomInfo> tmpList = new List<BaseBomInfo>();
public BaseOrderInfoServices(IBaseRepository<BaseOrderInfo> 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<List<BaseOrderInfo>> GetOrderInfoData()
@ -57,36 +60,55 @@ namespace Admin.Core.Service
{
List<PrintPlanInfoView> list = new List<PrintPlanInfoView>();
List<BaseBomInfo> baseBomList = await _baseBomInfoRepository.QueryAsync();
List<PrintBarCode> printBarCodeList = await _printBarCodeServices.QueryAsync();
List<BaseOrderInfo> orderList = await this.GetOrderInfoData();
List<PrintOrderInfo> 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;
}
});

@ -41,5 +41,9 @@ namespace Aucma.Core.PrintTo.Models
/// 补打个数SuppleMetNum
/// </summary>
public int SuppleMetNum { get; set; }
/// <summary>
/// 打印类型
/// </summary>
public int PrintType { get; set; }
}
}

@ -24,6 +24,10 @@ namespace Aucma.Core.PrintTo.ViewModels
{
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(IndexPageViewModel));
protected readonly IBaseOrderInfoServices _baseOrderInfoServices;
/// <summary>
/// 打印类型
/// </summary>
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<PrintPlanInfoView> list = await _baseOrderInfoServices.QueryPrintInfo();
if (list == null) return;
foreach (var item in list)
{
try
{
datalist.Add(new OrderInfo()
Datalist.Clear();
List<PrintPlanInfoView> 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<PrintPlanInfoView> 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<PrintPlanInfoView> 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
/// 查询
/// </summary>
[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)

@ -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<BaseBomInfo> tmpList = new List<BaseBomInfo>();
private List<OrderBomInfo> items { get; }
private Queue<OrderBomInfo> BarcodesUnprinted { get; } = new Queue<OrderBomInfo>();
private Queue<OrderBomInfo> BarcodesPrinted { get; } = new Queue<OrderBomInfo>();
private List<BaseBomInfo> items { get; }
private Queue<BaseBomInfo> BarcodesUnprinted { get; } = new Queue<BaseBomInfo>();
private Queue<BaseBomInfo> BarcodesPrinted { get; } = new Queue<BaseBomInfo>();
private PrintState printState { get; set; } = PrintState.Idle;//打印状态
protected bool isPrint { get; set; } = true;//打印标志
public int _printType { get; set; }//打印类型
#region 构造函数
/// <summary>
/// 构造函数
@ -44,13 +42,16 @@ namespace Aucma.Core.PrintTo.ViewModels
/// <param name="materialCode">物料编码</param>
/// <param name="materialName">型号简码</param>
/// <param name="printAmount">打印数量</param>
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<IOrderBomInfoServices>();
_printBarCodeServices = App.ServiceProvider.GetService<IPrintBarCodeServices>();
_baseBomInfoServices = App.ServiceProvider.GetService<IBaseBomInfoServices>();
_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
/// <param name="orderNo">订单号</param>
/// <param name="materialCode">物料码</param>
/// <param name="planAmount">打印数量</param>
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<BaseBomInfo> 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<BaseBomInfo> 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
}
}

@ -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

@ -181,15 +181,15 @@
<DataGridTextColumn Width="1.2*" Binding="{Binding CreatedTime, StringFormat=\{0:yyy-MM-dd\}}" Header="订单日期" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="1.2*" Binding="{Binding OrderCode}" Header="订单编号" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="1.2*" Binding="{Binding ProductCode}" Header="产品编码" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="5.5*" Binding="{Binding ProductName}" Header="产品型号" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="*" Binding="{Binding PlanAmount}" Header="订单数量" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="*" Binding="{Binding LinerAmount}" Header="内胆编码" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="*" Binding="{Binding BoxAmount}" Header="箱体编码" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="*" Binding="{Binding PrintLinerAmount}" Header="内胆码&#x0a;已打数量" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="*" Binding="{Binding PrintBoxAmount}" Header="箱体码&#x0a;已打数量" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="*" Binding="{Binding ErrorNum}" Header="异常量" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="*" Binding="{Binding PrintName}" Header="打印名称" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" />
<DataGridTextColumn Width="*" Binding="{Binding CompleteAmount}" Header="剩余" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" Visibility="Collapsed" />
<DataGridTextColumn Width="3*" Binding="{Binding ProductName}" Header="产品型号" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="*" Binding="{Binding PlanAmount}" Header="订单数量" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="*" Binding="{Binding CompleteAmount}" Header="完成数量" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="*" Binding="{Binding LinerAmount}" Header="内胆编码" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" Visibility="Collapsed"/>
<DataGridTextColumn Width="*" Binding="{Binding BoxAmount}" Header="箱体编码" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" Visibility="Collapsed"/>
<DataGridTextColumn Width="*" Binding="{Binding LinerCodeNum}" Header="内胆码&#x0a;已打数量" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="*" Binding="{Binding BoxCodeNum}" Header="箱体码&#x0a;已打数量" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="*" Binding="{Binding ErrorNum}" Header="异常量" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="*" Binding="{Binding PrintName}" Header="打印名称" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" />
</DataGrid.Columns>
</DataGrid>
</UniformGrid>
@ -208,7 +208,6 @@
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<WrapPanel Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 15">
@ -228,27 +227,17 @@
materialDesign:HintAssist.Hint="产品型号" />
</WrapPanel>
<WrapPanel Grid.Row="3" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 15">
<TextBlock Text="物料编码" FontSize="18" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" />
<TextBox x:Name="MaterialCode" Foreground="white" BorderBrush="White" Text="{Binding SelectedItem.MaterialCode, ElementName=dgvMH}" IsReadOnly="True" Margin="15 0 0 0" FontSize="18" VerticalContentAlignment="Center" HorizontalContentAlignment="Left" Width="{Binding Path=ActualWidth, ElementName=ProductNo}"
materialDesign:HintAssist.Hint="物料编码" />
</WrapPanel>
<WrapPanel Grid.Row="4" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 15">
<TextBlock Text="物料名称" FontSize="18" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" />
<TextBox x:Name="MaterialName" Foreground="white" BorderBrush="White" Text="{Binding SelectedItem.MaterialName, ElementName=dgvMH}" IsReadOnly="True" Margin="15 0 0 0" FontSize="18" VerticalContentAlignment="Center" HorizontalContentAlignment="Left" Width="{Binding Path=ActualWidth, ElementName=ProductNo}"
materialDesign:HintAssist.Hint="物料名称" />
</WrapPanel>
<WrapPanel Grid.Row="5" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 15">
<TextBlock Text="打印名称" FontSize="18" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" />
<TextBox x:Name="PrintName" Foreground="white" BorderBrush="White" Text="{Binding SelectedItem.PrintName, ElementName=dgvMH}" Margin="15 0 0 0" FontSize="18" VerticalContentAlignment="Center" HorizontalContentAlignment="Left" Width="{Binding Path=ActualWidth, ElementName=ProductNo}"
materialDesign:HintAssist.Hint="打印名称" />
</WrapPanel>
<WrapPanel Grid.Row="6" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 15">
<WrapPanel Grid.Row="4" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 15">
<TextBlock Text="打印数量" FontSize="18" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" />
<Slider x:Name="PlanAmount" FontSize="18" Minimum="0" Maximum="500" BorderBrush="White" Value="{Binding SelectedItem.CompleteAmount, ElementName=dgvMH}" Foreground="White" Height="30" VerticalContentAlignment="Center"
HorizontalContentAlignment="Left" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="15 0 0 0" Width="{Binding Path=ActualWidth, ElementName=ProductNo}"/>
<!--<TextBlock Text="1~500" Width="60" Margin="10 0 0 0" Foreground="White" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center" />-->
</WrapPanel>
<Border Grid.Row="7" BorderBrush="#0288d1" BorderThickness="1" CornerRadius="5" Width="400" >
<Border Grid.Row="5" BorderBrush="#0288d1" BorderThickness="1" CornerRadius="5" Width="420" >
<StackPanel >
<WrapPanel Height="300">
<RadioButton Content="内胆码-L" Foreground="White" FontSize="18" BorderBrush="White" x:Name="内胆" Margin="30 15" Command="{Binding RadioQueryCommand}" CommandParameter="{Binding Name, ElementName=内胆}"/>
@ -257,7 +246,7 @@
<!--<Button Content="添加" Foreground="White" BorderBrush="#0288d1" Background="#4285DE" HorizontalAlignment="Right" VerticalAlignment="Bottom" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />-->
</StackPanel>
</Border>
<WrapPanel Grid.Row="8" HorizontalAlignment="Center">
<WrapPanel Grid.Row="6" HorizontalAlignment="Center">
<Button
Background="#4285DE" Height="40"
Content="常规" Width="100" Margin="0 10 0 0" Command="{Binding PrintCommand}" IsEnabled="{Binding PrintIsEnabled}" CommandParameter="{Binding ElementName=ProductNo,Path=Text}"/>

@ -17,10 +17,10 @@ namespace Aucma.Core.PrintTo.Views
/// <param name="materialName">产品名称</param>
/// <param name="printAmount">打印数量</param>
/// <param name="barCode"></param>
public PrintToDevView(string productCode, string materialCode, string materialName, int printAmount,string printName)
public PrintToDevView(string order_code,string productCode, string productName, int printAmount,string printName,int printType)
{
InitializeComponent();
this.DataContext = new PrintToDevViewModel(productCode, materialCode, materialName, printAmount, printName);
this.DataContext = new PrintToDevViewModel(order_code,productCode, productName, printAmount, printName, printType);
}
#endregion

@ -43,14 +43,14 @@
"DBType": 3,
"Enabled": true,
"HitRate": 50,
"Connection": "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.100.72.20)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ORCLCDB)));User ID=c##aucma_sacda;Password=aucma;",
"Connection": "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.100.72.20)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ORCLCDB)));User ID=c##aucma_scada;Password=aucma;",
"ProviderName": "System.Data.SqlClient"
},
{
"ConnId": "AUCMA_MES",
"DBType": 3,
"Enabled": true,
"HitRate": 40,
"HitRate": 30,
"Connection": "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.100.72.20)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ORCLCDB)));User ID=c##aucma_mes;Password=aucma;",
"ProviderName": "System.Data.SqlClient"
}

@ -17,7 +17,7 @@ namespace Aucma.Core.ScannerGun
/// </summary>
public static void InitScanCode()
{
string COM1 = "com3";
string COM1 = "COM4";
InstanceSerialPort3(COM1);
}

Loading…
Cancel
Save