盘点单接口 报表优化

This commit is contained in:
2024-10-25 17:58:09 +08:00
parent 9fd13a55fc
commit 967055778f
6 changed files with 143 additions and 5 deletions

View File

@@ -2390,6 +2390,12 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
WmsCarryH wmsCarryH = items[0]; WmsCarryH wmsCarryH = items[0];
if (wmsCarryH.carry_status == "0")
{
LoggerFloor4DMJ2MJX.LogWarning($"【四楼待灭菌仓到灭菌线】 载具{wmsCarryH.carry_code}状态为空闲,而当前业务中载具应该为占用状态,请检查数据");
break;
}
//锁定起点库位 //锁定起点库位
await db_Floor4DMJ2MJX.Updateable<BasLocation>().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == wmsCarryH.location_id).ExecuteCommandAsync(); await db_Floor4DMJ2MJX.Updateable<BasLocation>().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == wmsCarryH.location_id).ExecuteCommandAsync();
//锁定终点库位 //锁定终点库位
@@ -2501,6 +2507,11 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
LoggerFloor4MJX2MJC.LogWarning($"【四楼灭菌线到解析仓】 托盘号{carry_code}在系统中不存在"); LoggerFloor4MJX2MJC.LogWarning($"【四楼灭菌线到解析仓】 托盘号{carry_code}在系统中不存在");
continue; continue;
} }
if (wmsCarryH.carry_status == "0")
{
LoggerFloor4DMJ2MJX.LogWarning($"【四楼灭菌线到解析仓】 载具{wmsCarryH.carry_code}状态为空闲,而当前业务中载具应该为占用状态,请检查数据");
break;
}
//锁定起点库位 //锁定起点库位
await db_Floor4MJX2MJC.Updateable<BasLocation>().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == startlocation.id).ExecuteCommandAsync(); await db_Floor4MJX2MJC.Updateable<BasLocation>().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == startlocation.id).ExecuteCommandAsync();
//锁定终点库位 //锁定终点库位
@@ -2634,7 +2645,11 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
await semaphoreSlim_CPK.WaitAsync(); await semaphoreSlim_CPK.WaitAsync();
WmsCarryH wmsCarryH = await db_Floor4DMC2CPK.Queryable<WmsCarryH>().Where(r => r.id == wmsSterilizationInstockH.carry_id).FirstAsync(); WmsCarryH wmsCarryH = await db_Floor4DMC2CPK.Queryable<WmsCarryH>().Where(r => r.id == wmsSterilizationInstockH.carry_id).FirstAsync();
if (wmsCarryH.carry_status == "0")
{
LoggerFloor4DMJ2MJX.LogWarning($"【四楼灭菌仓到成品库】 载具{wmsCarryH.carry_code}状态为空闲,而当前业务中载具应该为占用状态,请检查数据");
break;
}
if (wmsCarryH.location_id != wmsSterilizationInstockH.location_id) if (wmsCarryH.location_id != wmsSterilizationInstockH.location_id)
{ {
LoggerFloor4DMC2CPK.LogWarning($"【四楼灭菌仓到成品库】载具{wmsCarryH.carry_code}实际位置与灭菌入库记录位置不一致"); LoggerFloor4DMC2CPK.LogWarning($"【四楼灭菌仓到成品库】载具{wmsCarryH.carry_code}实际位置与灭菌入库记录位置不一致");

View File

@@ -119,7 +119,11 @@ public class ModuleConsts
/// <summary> /// <summary>
/// 模块标识-载具更换 /// 模块标识-载具更换
/// </summary> /// </summary>
public const string MODULE_WMSCARRYREPLACE_ID = "26188532491557";//26188532491557 public const string MODULE_WMSCARRYREPLACE_ID = "26188532491557";
/// <summary>
/// 模块标识-盘点
/// </summary>
public const string MODULE_WmsInventorycheck_ID = "37804588973589";
/// <summary> /// <summary>
/// 模块标识-人工扫码入库记录 todo /// 模块标识-人工扫码入库记录 todo
/// </summary> /// </summary>

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tnb.WarehouseMgr.Entities.Consts;
namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
{
public class WmsInventorycheckSubmitInput
{
public string erp_line_pk { get; set; }
public List<WmsInventorycheckSubmitDetailInput> details { get; set; }
}
public class WmsInventorycheckSubmitDetailInput
{
public string carry_code { get; set; }
public string material_id { get; set; }
public string code_batch { get; set; }
public string actual_qty { get; set; }
public string location_id { get; set; }
}
}

View File

@@ -0,0 +1,86 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JNPF.Common.Core.Manager;
using JNPF.Common.Enums;
using JNPF.EventBus;
using JNPF.FriendlyException;
using JNPF.Systems.Interfaces.System;
using JNPF.VisualDev;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Npgsql;
using SqlSugar;
using Tnb.BasicData.Interfaces;
using Tnb.ProductionMgr.Interfaces;
using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Consts;
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
using Tnb.WarehouseMgr.Entities.Entity;
using Tnb.WarehouseMgr.Entities.Enums;
using Tnb.WarehouseMgr.Interfaces;
namespace Tnb.WarehouseMgr
{
[OverideVisualDev(ModuleConsts.MODULE_WmsInventorycheck_ID)]
public class WmsInventorycheckService : BaseWareHouseService
{
private readonly ISqlSugarClient _db;
private readonly IDictionaryDataService _dictionaryDataService;
private readonly IUserManager _userManager;
private readonly IWareHouseService _wareHouseService;
private readonly IBillRullService _billRullService;
private readonly IPrdInstockService _prdInstockService;
private readonly IThirdApiRecordService _thirdApiRecordService;
private static Dictionary<string, object> _dicBillCodes = new();
public WmsInventorycheckService(
ISqlSugarRepository<WmsInventorycheckH> repository,
IDictionaryDataService dictionaryDataService,
IUserManager userManager,
IBillRullService billRullService,
IWareHouseService wareHouseService,
IPrdInstockService prdInstockService,
IThirdApiRecordService thirdApiRecordService,
IEventPublisher eventPublisher
)
{
_db = repository.AsSugarClient();
_dictionaryDataService = dictionaryDataService;
_userManager = userManager;
_billRullService = billRullService;
_wareHouseService = wareHouseService;
_thirdApiRecordService = thirdApiRecordService;
_prdInstockService = prdInstockService;
}
/// <summary>
/// 盘点单提交
/// </summary>
/// <param name="input"></param>
/// <exception cref="ArgumentNullException"></exception>
[HttpPost]
public async Task<dynamic> Submit(WmsInventorycheckSubmitInput input)
{
try
{
return await ToApiResult(HttpStatusCode.OK, "成功");
}
catch (PostgresException ex)
{
Logger.LogError(ex.Message);
Logger.LogError(ex.StackTrace);
throw new AppFriendlyException($"{ex.Message}", 500);
}
catch (Exception ex)
{
Logger.LogInformation(ex.Message);
Logger.LogInformation(ex.StackTrace);
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
}
}
}
}

View File

@@ -198,8 +198,9 @@ namespace Tnb.WarehouseMgr
} }
await _db.Ado.BeginTranAsync(); await _db.Ado.BeginTranAsync();
//入库取终点 //出库起点 //入库取终点 //出库起点
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_MJC_ID, Size = 1 }; InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_MJC_ID, Size = 9999 };
List<BasLocation> endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); List<BasLocation> endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
endLocations = endLocations.Where(r => r.location_code.Contains("MJWC-C")).ToList();
if (endLocations.Count == 0) if (endLocations.Count == 0)
{ {
throw new AppFriendlyException("没有可用的入库库位", 500); throw new AppFriendlyException("没有可用的入库库位", 500);

View File

@@ -218,11 +218,14 @@ namespace Tnb.WarehouseMgr
} }
IEnumerable<dynamic> result = null; IEnumerable<dynamic> result = null;
result = await _db.Queryable<WmsOutinStockDetail>() result = await _db.Queryable<WmsOutinStockDetail>()
.InnerJoin<WmsOutinStockCode>((a, b) => a.id == b.bill_d_id) .InnerJoin<WmsOutinStockCode>((a, b) => a.id == b.bill_d_id)
.InnerJoin<BasWarehouse>((a, b, c) => a.warehouse_id == c.id) .InnerJoin<BasWarehouse>((a, b, c) => a.warehouse_id == c.id)
.Select((a,b,c) => new .InnerJoin<BasMaterial>((a, b, c, d) => b.material_id == d.id)
.WhereIF(!string.IsNullOrEmpty(code_batch), (a, b, c, d) => b.code_batch.Contains(code_batch))
.WhereIF(!string.IsNullOrEmpty(material_specification), (a, b, c, d) => b.material_specification.Contains(material_specification))
.Select((a, b, c) => new
{ {
act_start_date = a.act_start_date, act_start_date = a.act_start_date,
act_end_date = a.act_end_date, act_end_date = a.act_end_date,