库存报表,日志完善
This commit is contained in:
@@ -13,6 +13,7 @@ using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NPOI.HSSF.Record;
|
||||
using NPOI.SS.Formula;
|
||||
using SqlSugar;
|
||||
@@ -133,6 +134,7 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost, NonUnify, AllowAnonymous]
|
||||
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> Distribute(SaleReleaseDistributeInput input)
|
||||
{
|
||||
Logger.LogInformation($"【Distribute】 销售出库下发");
|
||||
try
|
||||
{
|
||||
if (input.qty <= 0)
|
||||
@@ -160,6 +162,7 @@ namespace Tnb.WarehouseMgr
|
||||
List<Tuple<string, WmsCarryH, WmsCarryCode, BasLocation>> items_sorttask = items.Where(r => r.Item1 == "分拣任务").ToList();
|
||||
List<Tuple<string, WmsCarryH, WmsCarryCode, BasLocation>> items_pretask = items.Where(r => r.Item1 == "预任务").ToList();
|
||||
|
||||
Logger.LogInformation($"【Distribute】 预计生成{items_pretask.Count}条预任务");
|
||||
// 预任务逻辑
|
||||
foreach (Tuple<string, WmsCarryH, WmsCarryCode, BasLocation> item in items_pretask)
|
||||
{
|
||||
@@ -167,8 +170,12 @@ namespace Tnb.WarehouseMgr
|
||||
WmsCarryCode carryCode = item.Item3;
|
||||
BasLocation startLocation = item.Item4;
|
||||
// 根据一楼工位任务数平均分配任务 确定一楼工位
|
||||
BasLocation endLocation = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1OutstockLocation().Contains(r.id)).OrderBy("is_lock, task_nums, location_code").FirstAsync();
|
||||
BasLocation endLocation = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1OutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0").OrderBy("is_lock, task_nums, location_code").FirstAsync();
|
||||
|
||||
if (endLocation == null)
|
||||
{
|
||||
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
|
||||
}
|
||||
WmsPointH sPoint = null!;
|
||||
WmsPointH ePoint = null!;
|
||||
|
||||
@@ -281,6 +288,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
|
||||
Logger.LogInformation($"【Distribute】 预计生成{items_sorttask.Count}条分拣任务");
|
||||
// 分拣任务逻辑
|
||||
foreach (Tuple<string, WmsCarryH, WmsCarryCode, BasLocation> item in items_sorttask)
|
||||
{
|
||||
@@ -321,10 +329,13 @@ namespace Tnb.WarehouseMgr
|
||||
await _db.Updateable<WmsSaleD>().SetColumns(r => r.purchase_arriveqty == r.purchase_arriveqty + input.qty).Where(r => r.id == input.source_id).ExecuteCommandAsync();
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
Logger.LogInformation($"【Distribute】 销售出库下发完成");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
Logger.LogError($"【Distribute】 {ex.Message}");
|
||||
Logger.LogError($"【Distribute】 {ex.StackTrace}");
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
|
||||
}
|
||||
finally
|
||||
|
||||
Reference in New Issue
Block a user