定时服务启动方式调整,并调整相关业务代码

This commit is contained in:
alex
2023-09-18 10:12:37 +08:00
parent 465f6b0bdd
commit 79731d6c67
14 changed files with 1483 additions and 31 deletions

View File

@@ -33,6 +33,8 @@ using Tnb.WarehouseMgr.Entities.Dto.Inputs;
using Tnb.WarehouseMgr.Entities.Enums;
using Tnb.WarehouseMgr.Interfaces;
using System.Reflection;
using Tnb.WarehouseMgr.Print;
using System.Runtime.InteropServices;
namespace Tnb.WarehouseMgr
{
@@ -161,12 +163,12 @@ namespace Tnb.WarehouseMgr
? (a, b) => a.id == input.data[nameof(WmsOutstockH.carry_id)].ToString()
: (a, b) => outStkCarrys.Select(x => x.id).Contains(b.carry_id);
carryCodesPart = await _db.Queryable<WmsCarryH>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id).InnerJoin<BasLocation>((a, b, c) => a.location_id == c.id)
.Where(whereExp)
.Select<WmsCarryCode>()
.MergeTable()
.OrderBy(it=>it.create_time)
.ToListAsync();
carryCodesPart = await _db.Queryable<WmsCarryH>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id).InnerJoin<BasLocation>((a, b, c) => a.location_id == c.id)
.Where(whereExp)
.Select<WmsCarryCode>()
.MergeTable()
.OrderBy(it => it.create_time)
.ToListAsync();
if (carryCodesPart?.Count > 0)
{
@@ -375,6 +377,146 @@ namespace Tnb.WarehouseMgr
return Task.FromResult(true);
}
/// <summary>
/// 测试获取路径
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<dynamic> GetTest()
{
//D:\Workspce\tianyi\TuoTong-LowCodePlatform-BackEnd\apihost\Tnb.API.Entry\bin\Debug\net6.0\
var dllPath = Path.Combine(AppContext.BaseDirectory, @"Library\x64");
var files = Directory.GetFiles(dllPath);
return dllPath;
}
public async Task<dynamic> PrintTest(List<string> barCodes)
{
// open port.
int nLen, ret, sw;
byte[] pbuf = new byte[128];
string strmsg;
IntPtr ver;
System.Text.Encoding encAscII = System.Text.Encoding.ASCII;
System.Text.Encoding encUnicode = System.Text.Encoding.Unicode;
// dll version.
ver = PPLBUtility.B_Get_DLL_Version(0);
// search port.
nLen = PPLBUtility.B_GetUSBBufferLen() + 1;
strmsg = "DLL ";
strmsg += Marshal.PtrToStringAnsi(ver);
strmsg += "\r\n";
if (nLen > 1)
{
byte[] buf1, buf2;
int len1 = 128, len2 = 128;
buf1 = new byte[len1];
buf2 = new byte[len2];
PPLBUtility.B_EnumUSB(pbuf);
PPLBUtility.B_GetUSBDeviceInfo(1, buf1, out len1, buf2, out len2);
sw = 1;
if (1 == sw)
{
ret = PPLBUtility.B_CreatePrn(12, encAscII.GetString(buf2, 0, len2));// open usb.
}
else
{
ret = PPLBUtility.B_CreateUSBPort(1);// must call B_GetUSBBufferLen() function fisrt.
}
if (0 != ret)
{
strmsg += "Open USB fail!";
}
else
{
strmsg += "Open USB:\r\nDevice name: ";
strmsg += encAscII.GetString(buf1, 0, len1);
strmsg += "\r\nDevice path: ";
strmsg += encAscII.GetString(buf2, 0, len2);
//sw = 2;
if (2 == sw)
{
//Immediate Error Report.
PPLBUtility.B_WriteData(1, encAscII.GetBytes("^ee\r\n"), 5);//^ee
ret = PPLBUtility.B_ReadData(pbuf, 4, 1000);
}
}
}
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 null;
// sample setting.
//B_Set_DebugDialog(1);
//var sznop2 = "测试";
//var sznop1 = "测试2";
PPLBUtility.B_Set_Originpoint(0, 0);
PPLBUtility.B_Select_Option(2);
PPLBUtility.B_Set_Darkness(8);
PPLBUtility.B_Del_Pcx("*");// delete all picture.
//PPLBUtility.B_WriteData(0, encAscII.GetBytes(sznop2), sznop2.Length);
//PPLBUtility.B_WriteData(1, encAscII.GetBytes(sznop1), sznop1.Length);
//When using standard label, and the printer is Intelli Print mode or Smart Print mode,
//When calling this function and giving the correct label information,
//the immediate print function will be enabled according to the label length setting.
PPLBUtility.B_Set_LabelForSmartPrint(254 * 3, 30);//label information: length= 3 * 25.4 mm, gap= 3 mm.
//draw box.
//PPLBUtility.B_Draw_Box(20, 20, 4, 760, 560);
//PPLBUtility.B_Draw_Line('O', 400, 20, 4, 540);
//print text, true type text.
PPLBUtility.B_Prn_Text(250, 50, 0, 2, 2, 2, 'N', "PPLB Lib Example");
//PPLBUtility.B_Prn_Text_TrueType(30, 100, 30, "Arial", 1, 400, 0, 0, 0, "AA", "TrueType Font");//save in printer.
//PPLBUtility.B_Prn_Text_TrueType_W(30, 160, 20, 20, "Times New Roman", 1, 400, 0, 0, 0, "AB", "TT_W: 多字元測試");
//PPLBUtility.B_Prn_Text_TrueType_Uni(30, 220, 30, "Times New Roman", 1, 400, 0, 0, 0, "AC", Encoding.Unicode.GetBytes("TT_Uni: 多字元測試"), 1);//UTF-16
//encUnicode.GetBytes("\xFEFF", 0, 1, pbuf, 0);//UTF-16.//pbuf[0]=0xFF,pbuf[1]=0xFE;
//encUnicode.GetBytes("TT_UniB: 多字元測試", 0, 14, pbuf, 2);//copy mutil byte.
//encUnicode.GetBytes("\x0000", 0, 1, pbuf, 30);//null.//pbuf[30]=0x00,pbuf[31]=0x00;
//PPLBUtility.B_Prn_Text_TrueType_UniB(30, 280, 30, "Times New Roman", 1, 400, 0, 0, 0, "AD", pbuf, 0);//Byte Order Mark.
var labelWth = 800;
var barcodeWth = 508;
var x = (labelWth - barcodeWth) / 2;
//barcode.
PPLBUtility.B_Prn_Barcode(150, 100, 0, "E80", 8, 500, 70, 'N', "1234<+10>");//have a counter
//PPLBUtility.B_Bar2d_QR(420, 200, 1, 3, 'M', 'A', 0, 0, 0, "QR CODE");
//picture.
//PPLBUtility.B_Get_Graphic_ColorBMP(420, 280, "bb.bmp");// Color bmp file.
//PPLBUtility.B_Get_Graphic_ColorBMPEx(420, 320, 200, 150, 2, "bb1", "bb.bmp");//180 angle.
//IntPtr himage = LoadImage(IntPtr.Zero, "bb.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
//PPLBUtility.B_Get_Graphic_ColorBMP_HBitmap(630, 280, 250, 80, 1, "bb2", himage);//90 angle.
//if (IntPtr.Zero != himage)
// DeleteObject(himage);
// output.
PPLBUtility.B_Print_Out(1);// copy 2.
// close port.
PPLBUtility.B_ClosePrn();
return "success";
}
/// <summary>
/// 根据出库申请单ID获取申请单明细信息
/// </summary>