增加MES-WMS接口
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
@@ -22,6 +23,7 @@ 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.Interfaces;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
@@ -33,7 +35,7 @@ namespace Tnb.WarehouseMgr
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSEMPTYINSTOCK_ID)]
|
||||
[ServiceModule(BizTypeId)]
|
||||
|
||||
public class WmsEmptyInstockService : BaseWareHouseService
|
||||
public class WmsEmptyInstockService : BaseWareHouseService, IWmsEmptyInstockService
|
||||
{
|
||||
private const string BizTypeId = "26121986416677";
|
||||
private readonly ISqlSugarClient _db;
|
||||
@@ -116,7 +118,7 @@ namespace Tnb.WarehouseMgr
|
||||
preTask.create_time = DateTime.Now;
|
||||
return preTask;
|
||||
}).ToList();
|
||||
var isOk = await _wareHouseService.GenPreTask(preTasks,null!);
|
||||
var isOk = await _wareHouseService.GenPreTask(preTasks, null!);
|
||||
if (isOk)
|
||||
{
|
||||
var preTaskUpInput = new GenPreTaskUpInput();
|
||||
@@ -161,7 +163,55 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
/// <summary>
|
||||
/// MES空载具入库
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> MesEmptyCarryInStock(MESEmptyCarryInStockInput input)
|
||||
{
|
||||
try
|
||||
{
|
||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.carry_code == input.carry_code);
|
||||
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.location_code == input.location_code);
|
||||
var emptyInstock = await _db.Queryable<WmsEmptyInstock>().FirstAsync(it => it.carry_code == input.carry_code && it.status == WmsWareHouseConst.BILLSTATUS_ADD_ID);
|
||||
if (emptyInstock != null)
|
||||
{
|
||||
return ToApiResult(HttpStatusCode.InternalServerError, $"空载具{emptyInstock.carry_code},预任务已生成");
|
||||
}
|
||||
if (carry != null && location != null)
|
||||
{
|
||||
var cols = new List<string>();
|
||||
var dic = new Dictionary<string, object>();
|
||||
dic[nameof(WmsEmptyInstock.id)] = SnowflakeIdHelper.NextId();
|
||||
dic[nameof(WmsEmptyInstock.org_id)] = input.org_id;
|
||||
dic[nameof(WmsEmptyInstock.location_id)] = location.id;
|
||||
dic[nameof(WmsEmptyInstock.bill_code)] = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_EMPTYINSTK_ENCODE);
|
||||
dic[nameof(WmsEmptyInstock.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID;
|
||||
dic[nameof(WmsEmptyInstock.carry_id)] = carry.id;
|
||||
dic[nameof(WmsEmptyInstock.carry_code)] = input.carry_code;
|
||||
dic[nameof(WmsEmptyInstock.biz_type)] = WmsWareHouseConst.BIZTYPE_WMSEMPTYINSTOCK_ID;
|
||||
dic[nameof(WmsEmptyInstock.create_id)] = input.create_id;
|
||||
dic[nameof(WmsEmptyInstock.create_time)] = DateTime.Now;
|
||||
dic[nameof(WmsEmptyInstock.warehouse_id)] = input.warehouse_id;
|
||||
|
||||
VisualDevModelDataCrInput visualDevModelDataCrInput = new ()
|
||||
{
|
||||
data = dic
|
||||
};
|
||||
await WmsEmptyIn(visualDevModelDataCrInput);
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
|
||||
}
|
||||
return ToApiResult();
|
||||
|
||||
}
|
||||
public async override Task ModifyAsync(WareHouseUpInput input)
|
||||
{
|
||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||
|
||||
Reference in New Issue
Block a user