增加MES-WMS接口
This commit is contained in:
@@ -5,12 +5,14 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aop.Api.Domain;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
@@ -18,6 +20,8 @@ using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
@@ -278,6 +282,53 @@ namespace Tnb.WarehouseMgr
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// MES齐套出库接口
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> MESKittingOutStk(List<MESKittingOutStkInput> input)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
List<WmsKittingoutD> kittingOutDs = new();
|
||||
var kittingOuts = input.Adapt<List<WmsKittingoutH>>();
|
||||
|
||||
for (int i = 0; i < kittingOuts.Count; i++)
|
||||
{
|
||||
var x= kittingOuts[i];
|
||||
x.id = SnowflakeIdHelper.NextId();
|
||||
x.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_KITTINGOUTSTK_ENCODE).GetAwaiter().GetResult();
|
||||
x.bill_date = DateTime.Now;
|
||||
x.bill_type = WmsWareHouseConst.BIZTYPE_WMSKITTINGOUTSTK_ID;
|
||||
x.status = WmsWareHouseConst.BILLSTATUS_ADD_ID;
|
||||
x.biz_type = WmsWareHouseConst.BIZTYPE_WMSKITTINGOUTSTK_ID;
|
||||
var d = input[i]?.wmsKittingoutDs?.Adapt<List<WmsKittingoutD>>();
|
||||
d?.ForEach(it =>
|
||||
{
|
||||
it.id = SnowflakeIdHelper.NextId();
|
||||
it.bill_id = x.id;
|
||||
it.qty = 0;
|
||||
it.real_box = 0;
|
||||
it.warehouse_id = x.warehouse_id;
|
||||
});
|
||||
kittingOutDs.AddRange(d!);
|
||||
}
|
||||
await _db.Insertable(kittingOuts).ExecuteCommandAsync();
|
||||
await _db.Insertable(kittingOutDs).ExecuteCommandAsync();
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
|
||||
}
|
||||
await KittingOutByAdd();
|
||||
return ToApiResult();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user