重写在库物料维护
This commit is contained in:
@@ -191,4 +191,8 @@ public class ModuleConsts
|
|||||||
/// 模块标识-采购收货
|
/// 模块标识-采购收货
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string MODULE_WMSPURCHASE_ID = "29975280336405";
|
public const string MODULE_WMSPURCHASE_ID = "29975280336405";
|
||||||
|
/// <summary>
|
||||||
|
/// 模块标识-在库物料维护
|
||||||
|
/// </summary>
|
||||||
|
public const string MODULE_WMSINSTKMIN_ID = "27124095468309";
|
||||||
}
|
}
|
||||||
106
WarehouseMgr/Tnb.WarehouseMgr/WmsInStkMinService.cs
Normal file
106
WarehouseMgr/Tnb.WarehouseMgr/WmsInStkMinService.cs
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.Common.Dtos.VisualDev;
|
||||||
|
using JNPF.Common.Extension;
|
||||||
|
using JNPF.EventBus;
|
||||||
|
using JNPF.Systems.Interfaces.System;
|
||||||
|
using JNPF.VisualDev;
|
||||||
|
using JNPF.VisualDev.Interfaces;
|
||||||
|
using SqlSugar;
|
||||||
|
using Tnb.BasicData.Entities;
|
||||||
|
using Tnb.WarehouseMgr.Entities;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Enums;
|
||||||
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
|
|
||||||
|
namespace Tnb.WarehouseMgr
|
||||||
|
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 在库物料维护
|
||||||
|
/// </summary>
|
||||||
|
[OverideVisualDev(ModuleConsts.MODULE_WMSINSTKMIN_ID)]
|
||||||
|
|
||||||
|
public class WmsInStkMinService : BaseWareHouseService
|
||||||
|
{
|
||||||
|
private readonly ISqlSugarClient _db;
|
||||||
|
private readonly IRunService _runService;
|
||||||
|
private readonly IVisualDevService _visualDevService;
|
||||||
|
private readonly IWareHouseService _wareHouseService;
|
||||||
|
private readonly IBillRullService _billRullService;
|
||||||
|
private readonly IUserManager _userManager;
|
||||||
|
private readonly IEventPublisher _eventPublisher;
|
||||||
|
public WmsInStkMinService(
|
||||||
|
ISqlSugarRepository<WmsCarryH> repository,
|
||||||
|
IRunService runService,
|
||||||
|
IVisualDevService visualDevService,
|
||||||
|
IWareHouseService wareHouseService,
|
||||||
|
IUserManager userManager,
|
||||||
|
IBillRullService billRullService,
|
||||||
|
IEventPublisher eventPublisher
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_db = repository.AsSugarClient();
|
||||||
|
_runService = runService;
|
||||||
|
_visualDevService = visualDevService;
|
||||||
|
_wareHouseService = wareHouseService;
|
||||||
|
_userManager = userManager;
|
||||||
|
_billRullService = billRullService;
|
||||||
|
_eventPublisher = eventPublisher;
|
||||||
|
OverideFuncs.CreateAsync = WmsInStkMin;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private async Task<dynamic> WmsInStkMin(VisualDevModelDataCrInput input)
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _db.Ado.BeginTranAsync();
|
||||||
|
//更新载具条码及状态
|
||||||
|
WmsCarryCode wmsCarryCode = new()
|
||||||
|
{
|
||||||
|
org_id = _userManager.User.OrganizeId,
|
||||||
|
barcode = input.data[nameof(WmsCarryCode.barcode)]?.ToString(),
|
||||||
|
carry_id = input.data[nameof(WmsCarryCode.carry_id)]?.ToString(),
|
||||||
|
material_id = input.data[nameof(WmsCarryCode.material_id)]?.ToString(),
|
||||||
|
material_code = input.data[nameof(WmsCarryCode.material_code)]?.ToString(),
|
||||||
|
code_batch = input.data[nameof(WmsCarryCode.code_batch)]?.ToString(),
|
||||||
|
codeqty =input.data[nameof(WmsCarryCode.codeqty)].ParseToDecimal(),
|
||||||
|
is_out = 0,
|
||||||
|
location_id = input.data[nameof(WmsCarryCode.location_id)]?.ToString(),
|
||||||
|
location_code = input.data[nameof(WmsCarryCode.location_code)]?.ToString(),
|
||||||
|
unit_id = input.data[nameof(WmsCarryCode.unit_id)]?.ToString(),
|
||||||
|
warehouse_id = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID,
|
||||||
|
create_id = _userManager.UserId,
|
||||||
|
create_time = DateTime.Now
|
||||||
|
};
|
||||||
|
if (wmsCarryCode.carry_id != null && wmsCarryCode.location_id != null)
|
||||||
|
{
|
||||||
|
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { carry_status = ((int)EnumCarryStatus.占用).ToString(), location_id = wmsCarryCode.location_id, location_code = wmsCarryCode.location_code }).Where(it => it.id == wmsCarryCode.carry_id).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { carry_status = ((int)EnumCarryStatus.占用).ToString()}).Where(it => it.id == wmsCarryCode.carry_id).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
await _db.Insertable(wmsCarryCode).ExecuteCommandAsync();
|
||||||
|
//更新库位数据
|
||||||
|
if (wmsCarryCode.location_id != null)
|
||||||
|
{
|
||||||
|
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_use = ((int)EnumCarryStatus.占用).ToString() }).Where(it => it.id == wmsCarryCode.location_id).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
await _db.Ado.CommitTranAsync();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
await _db.Ado.RollbackTranAsync();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
// 用JNPF的发布订阅模式发布消息
|
||||||
|
await InvokeGenPretaskExcute();
|
||||||
|
}
|
||||||
|
return Task.FromResult(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user