Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||
{
|
||||
public class CarryBarCodeInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 打印条码集合
|
||||
/// </summary>
|
||||
public List<string> barCodes { get; set; }
|
||||
/// <summary>
|
||||
/// 打印份数
|
||||
/// </summary>
|
||||
public int copies { get; set; } = 2;
|
||||
}
|
||||
}
|
||||
@@ -31,5 +31,13 @@
|
||||
public string? material_name { get; set; }
|
||||
|
||||
public string? material_id { get; set; }
|
||||
/// <summary>
|
||||
/// 规格型号
|
||||
/// </summary>
|
||||
public string? material_specification { get; set; }
|
||||
/// <summary>
|
||||
/// 箱号
|
||||
/// </summary>
|
||||
public string? container_no { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,9 +213,10 @@ namespace Tnb.WarehouseMgr
|
||||
/// 条码打印
|
||||
/// </summary>
|
||||
/// <param name="barCodes">条码</param>
|
||||
/// <param name="copies">打印份数</param>
|
||||
/// <returns></returns>
|
||||
[NonAction]
|
||||
protected void BarCodePrint(List<string> barCodes)
|
||||
protected void BarCodePrint(List<string> barCodes,int copies)
|
||||
{
|
||||
TaskCompletionSource tcs = new();
|
||||
// open port.
|
||||
@@ -308,18 +309,21 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
foreach (string code in barCodes)
|
||||
{
|
||||
//print text, true type text.
|
||||
_ = PPLBUtility.B_Prn_Text(200, 50, 0, 2, 2, 2, 'N', code);
|
||||
//barcode.
|
||||
_ = PPLBUtility.B_Prn_Barcode(50, 100, 0, "1", 3, 5, 70, 'B', code);//have a counter
|
||||
// output.
|
||||
_ = PPLBUtility.B_Print_Out(1);// copy 2.
|
||||
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.
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
tcs.SetException(ex);
|
||||
JNPF.Logging.Log.Error("条码打印时出现错误", ex);
|
||||
Logger.Error("条码打印时出现错误", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -307,13 +307,15 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost, NonUnify, AllowAnonymous]
|
||||
public async Task<Result> TaskCallback(TaskCallBackInput input)
|
||||
{
|
||||
Log.Information($"接收参数:{JsonConvert.SerializeObject(input)}");
|
||||
Log.Information($"任务状态上报->接收参数:{JsonConvert.SerializeObject(input)}");
|
||||
try
|
||||
{
|
||||
|
||||
List<WmsDistaskH> disTasks = await _db.Queryable<WmsDistaskH>().Where(it => it.bill_code.Contains(input.taskCode)).ToListAsync();
|
||||
if (input.action == "LOAD")
|
||||
{
|
||||
Logger.Information("----------Load Begin----------");
|
||||
|
||||
TaskExecuteAfterUpInput taskExecuteAfterUpInput = new()
|
||||
{
|
||||
disTaskIds = disTasks.Select(x => x.id).ToList()
|
||||
@@ -333,9 +335,13 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
|
||||
Logger.Information("----------Load End----------");
|
||||
|
||||
}
|
||||
else if (input.action == "UNLOAD")
|
||||
{
|
||||
Logger.Information("----------UnLoad Begin----------");
|
||||
|
||||
TaskCompleUpInput taskCompleUpInput = new()
|
||||
{
|
||||
disTaskIds = disTasks.Select(x => x.id).ToList()
|
||||
@@ -343,6 +349,7 @@ namespace Tnb.WarehouseMgr
|
||||
Logger.Information($"taskCompleUpInput json parameter:{JsonConvert.SerializeObject(taskCompleUpInput)}");
|
||||
await _wareHouseService.TaskComplate(taskCompleUpInput);
|
||||
|
||||
Logger.Information("----------UnLoad end----------");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -39,7 +39,8 @@ namespace Tnb.WarehouseMgr
|
||||
public async Task<dynamic> CallLiftTest(string devName, int floor)
|
||||
{
|
||||
bool isSuccefuly = false;
|
||||
(int sysStatus, int runStatus, _, int doorStatus, int agvStatus) = await GetElevatorStatus(devName, CancellationToken.None);
|
||||
var tags = new[] { "SysStatus", "RunStatus", "FloorNo", "DoorStatus", "AGVStatus" };
|
||||
(int sysStatus, int runStatus, _, int doorStatus, int agvStatus) = await GetElevatorStatus(devName, tags, CancellationToken.None);
|
||||
//判断当前楼层是否是放货楼层,如不是则呼叫电梯到当前楼层
|
||||
if (sysStatus.ToEnum<EnumSysStatus>() == EnumSysStatus.正常状态 && runStatus.ToEnum<EnumRunStatus>() == EnumRunStatus.停梯 &&
|
||||
agvStatus.ToEnum<EnumAgvStatus>() != EnumAgvStatus.AGV运行状态)
|
||||
@@ -364,7 +365,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
dynamic result = await WriteTagAsync(devName, ElevatorConsts.AGVControl, 1);
|
||||
JObject jo = JObject.Parse(result);
|
||||
if (jo != null && jo.Value<string>("Result").Equals("Ok", StringComparison.OrdinalIgnoreCase))
|
||||
if (jo != null && jo!.Value<string>("Result")!.Equals("Ok", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
isInAgvStatus = true;
|
||||
}
|
||||
@@ -402,10 +403,4 @@ namespace Tnb.WarehouseMgr
|
||||
return isSuccefuly;
|
||||
}
|
||||
}
|
||||
|
||||
public class ElevatorData
|
||||
{
|
||||
public string? name { get; set; }
|
||||
public string? value { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,8 +236,9 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost, AllowAnonymous]
|
||||
public async Task<dynamic> BatchAdd(CarryBatchAddInput input)
|
||||
{
|
||||
int i = 0, r = 0, num = 0;
|
||||
var nonZeroPattern = @"[1-9]+";
|
||||
int r = 0, num = 0;
|
||||
//var nonZeroPattern = @"[1-9]+";
|
||||
var nonZeroPattern = @"\d+";
|
||||
var code = input.carry_code.Match(@"\D+");
|
||||
if (input.carry_code.IsMatch(@"\d+"))
|
||||
{
|
||||
@@ -246,26 +247,33 @@ namespace Tnb.WarehouseMgr
|
||||
var carrys = await _db.Queryable<WmsCarryH>().Where(it => it.carry_code.Contains(code)).ToListAsync();
|
||||
if (carrys?.Count < 1)
|
||||
{
|
||||
i = Math.Max(num, 1);
|
||||
num = Math.Max(num, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
var lastCarry = carrys?.OrderByDescending(o => o.carry_code).FirstOrDefault() ?? default;
|
||||
num = lastCarry?.carry_code.Match(nonZeroPattern).ParseToInt() ?? -1;
|
||||
i = num + 1;
|
||||
num = num + 1;
|
||||
}
|
||||
|
||||
var batchCarrys = new List<WmsCarryH>();
|
||||
for (; i <= input.quantity; i++)
|
||||
var batchCarrys = new List<WmsCarryH>(input.quantity);
|
||||
|
||||
for (var i = 1; i <= input.quantity; i++)
|
||||
{
|
||||
if (i != 1)
|
||||
{
|
||||
num += 1;
|
||||
}
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(code);
|
||||
sb.Append(i.ToString().PadLeft(4, '0'));
|
||||
sb.Append(num.ToString().PadLeft(5, '0'));
|
||||
var carryCode = sb.ToString();
|
||||
WmsCarryH carry = input.Adapt<WmsCarryH>();
|
||||
carry.id = SnowflakeIdHelper.NextId();
|
||||
carry.carry_name = carryCode;
|
||||
carry.carry_code = carryCode;
|
||||
carry.is_check = 1;
|
||||
carry.status = 1;
|
||||
carry.create_id = "25398501929509";
|
||||
carry.create_time = DateTime.Now;
|
||||
batchCarrys.Add(carry);
|
||||
@@ -280,10 +288,11 @@ namespace Tnb.WarehouseMgr
|
||||
/// <param name="barCodes"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public new void BarCodePrint(List<string> barCodes)
|
||||
public new void BarCodePrint(CarryBarCodeInput input)
|
||||
{
|
||||
base.BarCodePrint(barCodes);
|
||||
|
||||
if (input.barCodes == null || input.barCodes.Count < 1) throw new ArgumentNullException(nameof(input.barCodes));
|
||||
input.barCodes = input.barCodes.OrderBy(o => o).ToList();
|
||||
base.BarCodePrint(input.barCodes, input.copies);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,7 @@ namespace Tnb.WarehouseMgr
|
||||
.Mapper(it => it.material_name = (it.material_id != null && dicMaterial.ContainsKey(it.material_id)) ? dicMaterial[it.material_id].ToString() : "")
|
||||
.ToListAsync();
|
||||
|
||||
return items ?? Enumerable.Empty<dynamic>();
|
||||
return items ?? Enumerable.Empty<CarryCodeDetailOutput>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@ namespace Tnb.WarehouseMgr
|
||||
if (input == null) throw new ArgumentNullException("input");
|
||||
if (input.details == null) throw new ArgumentNullException(nameof(input.details));
|
||||
|
||||
var materialIds = input.details.Select(x => x.material_id).ToList();
|
||||
var purchaseDs = await _db.Queryable<TSubEntity>().Where(it => materialIds.Contains(it.material_id)).ToListAsync();
|
||||
var ids = input.details.Select(x => x.id).ToList();
|
||||
var purchaseDs = await _db.Queryable<TSubEntity>().Where(it => ids.Contains(it.id)).ToListAsync();
|
||||
|
||||
if (purchaseDs?.Count > 0)
|
||||
{
|
||||
@@ -56,7 +56,7 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
foreach (var pd in purchaseDs)
|
||||
{
|
||||
var pdInput = input.details.Find(x => x.material_id == pd.material_id);
|
||||
var pdInput = input.details.Find(x => x.id == pd.id);
|
||||
if (pdInput != null)
|
||||
{
|
||||
pd.purchase_prqty += pdInput.purchase_arriveqty;
|
||||
@@ -112,7 +112,7 @@ namespace Tnb.WarehouseMgr
|
||||
if (s_materialMap.Count == 0)
|
||||
{
|
||||
//物料+规格型号+批次+箱号
|
||||
//s_materialMap = await _db.Queryable<BasMaterial>().ToDictionaryAsync(x => $"{}{}{}{}", x => x.name);
|
||||
////s_materialMap = await _db.Queryable<BasMaterial>().ToDictionaryAsync(x => x.id, x => x.name);
|
||||
}
|
||||
var list = await _db.Queryable<TSubEntity>().Where(it => it.bill_id == pkId)
|
||||
.Mapper(it => it.material_name = s_materialMap.ContainsKey(it.material_id) ? s_materialMap[it.material_id]?.ToString() ?? "" : "")
|
||||
|
||||
@@ -59,7 +59,7 @@ public class Startup : AppStartup
|
||||
services.AddHostedService<TimedTaskBackgroundService>();
|
||||
//services.AddHostedService<RedisBackGround>();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user