This commit is contained in:
qianjiawei
2023-12-22 14:27:17 +08:00
parent 5c9a27f848
commit 7ede7e4f08
2 changed files with 31 additions and 34 deletions

View File

@@ -222,7 +222,7 @@ namespace Tnb.WarehouseMgr
/// <param name="copies">打印份数</param>
/// <returns></returns>
[NonAction]
protected void BarCodePrint(List<string> barCodes,int copies)
protected void BarCodePrint(List<string> barCodes,int copies,string ip)
{
TaskCompletionSource tcs = new();
// open port.
@@ -281,28 +281,28 @@ namespace Tnb.WarehouseMgr
}
else
{
//ret = PPLBUtility.B_CreatePrn(13, "192.168.1.233");
_ = System.IO.Directory.CreateDirectory(PPLBUtility.szSavePath);
ret = PPLBUtility.B_CreatePrn(0, PPLBUtility.szSaveFile);// open file.
strmsg += "Open ";
strmsg += PPLBUtility.szSaveFile;
if (0 != ret)
{
strmsg += " file fail!";
}
else
{
strmsg += " file succeed!";
}
ret = PPLBUtility.B_CreatePrn(13, ip);
}
/* else
{
_ = System.IO.Directory.CreateDirectory(PPLBUtility.szSavePath);
ret = PPLBUtility.B_CreatePrn(0, PPLBUtility.szSaveFile);// open file.
strmsg += "Open ";
strmsg += PPLBUtility.szSaveFile;
if (0 != ret)
{
strmsg += " file fail!";
}
else
{
strmsg += " file succeed!";
}
}*/
if (0 != ret)
{
return;
}
// sample setting.
_ = PPLBUtility.B_Set_Originpoint(0, 0);
_ = PPLBUtility.B_Select_Option(2);
@@ -321,13 +321,15 @@ namespace Tnb.WarehouseMgr
{
for (int i = 0; i < copies; i++)
{
//print text, true type text.
_ = PPLBUtility.B_Prn_Text(150, 50, 0, 2, 2, 2, 'N', code);
//barcode.
_ = PPLBUtility.B_Prn_Barcode(50, 100, 0, "1", 3, 5, 70, 'N', code);//have a counter
// output.
_ = PPLBUtility.B_Print_Out(1);// copy 2.
}
// _ = PPLBUtility.B_Prn_Text(50, 90, 0, 2, 2, 2, 'N', code);
// _ = PPLBUtility.B_Prn_Barcode(50, 270, 0, "1", 3, 5, 70, 'N', code);
_ = PPLBUtility.B_Prn_Text(50, 100, 0, 2, 2, 2, 'N', code);
_ = PPLBUtility.B_Prn_Barcode(50, 150, 0, "1", 3, 5, 100, 'N', code);
_ = PPLBUtility.B_Prn_Text(50, 305, 0, 2, 2, 2, 'N', code);
_ = PPLBUtility.B_Print_Out(1);
}
}
}
catch (Exception ex)

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using JNPF.Common.Core.Manager;
@@ -16,6 +17,7 @@ using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using NPOI.OpenXmlFormats;
using NPOI.OpenXmlFormats.Dml.Diagram;
using Org.BouncyCastle.Utilities.Net;
using SqlSugar;
using Tnb.BasicData.Entities;
using Tnb.Common.Utils;
@@ -152,19 +154,11 @@ namespace Tnb.WarehouseMgr
[HttpPost]
public async Task BarCodePrint(BarCodeInput input)
{
;
if (input == null)
{
throw new AppFriendlyException(nameof(input), 500);
}
List<string> barcodes = new();
barcodes.Add("2300100051901001211210002");
barcodes.Add("2300100051901001211210008");
barcodes.Add("2300100051901001211210009");
base.BarCodePrint(barcodes, 1);
try
{
await _db.Ado.BeginTranAsync();
@@ -213,7 +207,8 @@ namespace Tnb.WarehouseMgr
barcodes.AddRange(wmsTempCodes.Select(p => p.barcode).ToList());
if (barcodes?.Count > 0)
{
base.BarCodePrint(barcodes, 1);
var ip= _db.Queryable<BasFactoryConfig>().Where(p=>p.key== "printerip").FirstAsync().Result.value;
base.BarCodePrint(barcodes, 1, ip);
}
}