mes->wms入库接口代码调整
This commit is contained in:
@@ -242,5 +242,6 @@ namespace Tnb.WarehouseMgr.Entities.Consts
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 条码编号
|
/// 条码编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int barcode_qty { get; set; }
|
public int codeqty { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 批次
|
/// 批次
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\BasicData\Tnb.BasicData.Interfaces\Tnb.BasicData.Interfaces.csproj" />
|
<ProjectReference Include="..\..\BasicData\Tnb.BasicData.Interfaces\Tnb.BasicData.Interfaces.csproj" />
|
||||||
|
<ProjectReference Include="..\..\ProductionMgr\Tnb.ProductionMgr.Interfaces\Tnb.ProductionMgr.Interfaces.csproj" />
|
||||||
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev.Engine\Tnb.VisualDev.Engine.csproj" />
|
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev.Engine\Tnb.VisualDev.Engine.csproj" />
|
||||||
<ProjectReference Include="..\Tnb.WarehouseMgr.Interfaces\Tnb.WarehouseMgr.Interfaces.csproj" />
|
<ProjectReference Include="..\Tnb.WarehouseMgr.Interfaces\Tnb.WarehouseMgr.Interfaces.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -576,6 +576,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
await _db.Ado.RollbackTranAsync();
|
await _db.Ado.RollbackTranAsync();
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ using Senparc.Weixin.Work.AdvancedAPIs.OaDataOpen;
|
|||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
using Tnb.Common.Utils;
|
using Tnb.Common.Utils;
|
||||||
|
using Tnb.ProductionMgr.Interfaces;
|
||||||
using Tnb.WarehouseMgr.Entities;
|
using Tnb.WarehouseMgr.Entities;
|
||||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||||
using Tnb.WarehouseMgr.Entities.Consts;
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
@@ -42,13 +43,15 @@ namespace Tnb.WarehouseMgr
|
|||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
private readonly IWareHouseService _wareHouseService;
|
private readonly IWareHouseService _wareHouseService;
|
||||||
private readonly IBillRullService _billRullService;
|
private readonly IBillRullService _billRullService;
|
||||||
|
private readonly IPrdInstockService _prdInstockService;
|
||||||
private static Dictionary<string, object> _dicBillCodes = new();
|
private static Dictionary<string, object> _dicBillCodes = new();
|
||||||
public WmsInStockService(
|
public WmsInStockService(
|
||||||
ISqlSugarRepository<WmsInstockH> repository,
|
ISqlSugarRepository<WmsInstockH> repository,
|
||||||
IDictionaryDataService dictionaryDataService,
|
IDictionaryDataService dictionaryDataService,
|
||||||
IUserManager userManager,
|
IUserManager userManager,
|
||||||
IBillRullService billRullService,
|
IBillRullService billRullService,
|
||||||
IWareHouseService wareHouseService
|
IWareHouseService wareHouseService,
|
||||||
|
IPrdInstockService prdInstockService
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_db = repository.AsSugarClient();
|
_db = repository.AsSugarClient();
|
||||||
@@ -56,6 +59,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
_billRullService = billRullService;
|
_billRullService = billRullService;
|
||||||
_wareHouseService = wareHouseService;
|
_wareHouseService = wareHouseService;
|
||||||
|
_prdInstockService = prdInstockService;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据入库申请单ID获取申请单明细信息
|
/// 根据入库申请单ID获取申请单明细信息
|
||||||
@@ -215,17 +219,27 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
await _db.Updateable(instockDetails).ExecuteCommandAsync();
|
await _db.Updateable(instockDetails).ExecuteCommandAsync();
|
||||||
|
var instock = await _db.Queryable<WmsInstockH>().SingleAsync(it => it.id == input.requireId);
|
||||||
|
if (instock.IsNull()) ArgumentNullException.ThrowIfNull(nameof(instock));
|
||||||
|
if (instock?.sync_status != WmsWareHouseConst.SYNC_STATUS_NONEEDSYNC)
|
||||||
|
{
|
||||||
|
//如果是自动单据,需要回更上层系统
|
||||||
|
Dictionary<string, string> pars = new() { { nameof(WmsInstockH.source_id), instock!.source_id } };
|
||||||
|
var callBackRes = await _prdInstockService.SyncInstock(pars);
|
||||||
|
instock.sync_status = callBackRes == true ? WmsWareHouseConst.SYNC_STATUS__SYNCCOMPLETE : WmsWareHouseConst.SYNC_STATUS__SYNCFAILED;
|
||||||
|
await _db.Updateable(instock).UpdateColumns(it => it.sync_status).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
var allInstockDetails = await _db.Queryable<WmsInstockD>().Where(it => it.bill_id == input.requireId).ToListAsync();
|
var allInstockDetails = await _db.Queryable<WmsInstockD>().Where(it => it.bill_id == input.requireId).ToListAsync();
|
||||||
if (allInstockDetails.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
|
if (allInstockDetails.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
|
||||||
{
|
{
|
||||||
await _db.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
|
instock.status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID;
|
||||||
//如果是自动单据,需要回更上层系统
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//任务没有结束,更新状态为工作中
|
//任务没有结束,更新状态为工作中
|
||||||
await _db.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
|
instock.status = WmsWareHouseConst.BILLSTATUS_ON_ID;
|
||||||
}
|
}
|
||||||
|
await _db.Updateable(instock).UpdateColumns(it => it.status).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
await _db.Ado.CommitTranAsync();
|
await _db.Ado.CommitTranAsync();
|
||||||
@@ -293,7 +307,6 @@ namespace Tnb.WarehouseMgr
|
|||||||
foreach (var instockcode in instockcodes!)
|
foreach (var instockcode in instockcodes!)
|
||||||
{
|
{
|
||||||
instockcode.id = SnowflakeIdHelper.NextId();
|
instockcode.id = SnowflakeIdHelper.NextId();
|
||||||
var materialId = instockcode.material_id;
|
|
||||||
var materialCode = instockcode.material_code;
|
var materialCode = instockcode.material_code;
|
||||||
var codeBatch = instockcode.code_batch;
|
var codeBatch = instockcode.code_batch;
|
||||||
var b = items.Find(x => x.material_code == materialCode && x.code_batch == codeBatch);
|
var b = items.Find(x => x.material_code == materialCode && x.code_batch == codeBatch);
|
||||||
@@ -301,7 +314,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
var c = DeepCopyHelper<WmsInstockCode>.DeepCopy(b);
|
var c = DeepCopyHelper<WmsInstockCode>.DeepCopy(b);
|
||||||
c.id = SnowflakeIdHelper.NextId();
|
c.id = SnowflakeIdHelper.NextId();
|
||||||
c.bill_d_id = instockcodes.Find(x => x.material_code == materialCode && x.code_batch == codeBatch)?.id!;
|
c.bill_d_id = instockds?.Find(x => x.material_code == materialCode && x.code_batch == codeBatch)?.id ?? "";
|
||||||
c.barcode = instockcode.barcode;
|
c.barcode = instockcode.barcode;
|
||||||
c.codeqty = instockcode.codeqty;
|
c.codeqty = instockcode.codeqty;
|
||||||
c.is_end = 0;// 未结束
|
c.is_end = 0;// 未结束
|
||||||
@@ -432,7 +445,6 @@ namespace Tnb.WarehouseMgr
|
|||||||
await _db.Updateable<WmsInstockD>().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCOdes.Select(x => x.bill_d_id).Contains(it.id)).ExecuteCommandAsync();
|
await _db.Updateable<WmsInstockD>().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCOdes.Select(x => x.bill_d_id).Contains(it.id)).ExecuteCommandAsync();
|
||||||
await _db.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == instock!.id).ExecuteCommandAsync();
|
await _db.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == instock!.id).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user