机器人回调代码调整

This commit is contained in:
alex
2023-06-30 15:53:27 +08:00
parent b56b53a234
commit 8d1e343c5a
3 changed files with 43 additions and 12 deletions

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JNPF.Common.Dtos.VisualDev;
namespace Tnb.WarehouseMgr.Interfaces
{
/// <summary>
/// 齐套入库服务接口s
/// </summary>
public interface IWmsKittingInStkService
{
Task<dynamic> KittingInStk(VisualDevModelDataCrInput input);
}
}

View File

@@ -125,6 +125,7 @@ namespace Tnb.WarehouseMgr
carryCodes = input.data["tablefield130"].ToObject<List<WmsCarryCode>>();
}
}
List<WmsPretaskCode> pretaskCodes = new();
foreach (var pt in preTasks)
{

View File

@@ -35,13 +35,21 @@ namespace Tnb.WarehouseMgr
private readonly IUserManager _userManager;
private readonly IWareHouseService _warehouseService;
private readonly IBillRullService _billRullService;
public WmsRobotCallbackService(IWmsCarryBindService wmsCarryBindService, ISqlSugarRepository<WmsCarrybindH> repository, IUserManager userManager, IWareHouseService warehouseService, IBillRullService billRullService)
private readonly IWmsKittingInStkService _wmsKittingInStkService;
public WmsRobotCallbackService(
IWmsCarryBindService wmsCarryBindService,
ISqlSugarRepository<WmsCarrybindH> repository,
IUserManager userManager,
IWareHouseService warehouseService,
IBillRullService billRullService,
IWmsKittingInStkService wmsKittingInStkService)
{
_wmsCarryBindService = wmsCarryBindService;
_db = repository.AsSugarClient();
_userManager = userManager;
_warehouseService = warehouseService;
_billRullService = billRullService;
_wmsKittingInStkService = wmsKittingInStkService;
}
[HttpPost]
@@ -73,28 +81,32 @@ namespace Tnb.WarehouseMgr
var kittingout = await _db.Queryable<WmsKittingoutH>().FirstAsync(it => it.collocation_scheme_id == carry.collocation_scheme_id && it.status == WmsWareHouseConst.BILLSTATUS_CALLED_ID);
if (kittingout != null)
{
WmsPointH sPoint = null!;
WmsPointH ePoint = null!;
visualDevModelCrInput.data = new Dictionary<string, object>();
visualDevModelCrInput.data[nameof(InStockStrategyQuery.warehouse_id)] = kittingout.warehouse_id;
visualDevModelCrInput.data[nameof(WmsKittingInstock.carry_id)] = input.carry_id;
visualDevModelCrInput.data[nameof(WmsKittingInstock.carry_code)] = input.carry_code;
visualDevModelCrInput.data[nameof(WmsKittingInstock.collocation_scheme_id)] = carry.collocation_scheme_id;
visualDevModelCrInput.data[nameof(WmsKittingInstock.collocation_scheme_code)] = carry.collocation_scheme_code;
visualDevModelCrInput.data[nameof(WmsKittingInstock.seq)] = kittingout.seq;
visualDevModelCrInput.data[nameof(WmsKittingInstock.biz_type)] = WmsWareHouseConst.BIZTYPE_WMSKITTINGINSTK_ID;
visualDevModelCrInput.data[nameof(WmsKittingInstock.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID;
visualDevModelCrInput.data[nameof(WmsKittingInstock.create_id)] = _userManager.UserId;
visualDevModelCrInput.data[nameof(WmsKittingInstock.create_time)] = DateTime.Now;
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == kittingout.location_id);
if (kittingout.location_id.IsNullOrWhiteSpace() || (location != null && location.is_type.ToEnum<EnumLocationType>() == EnumLocationType.))
{
//入库
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = location.wh_id };
var endLocations = await _warehouseService.InStockStrategy(inStockStrategyInput);
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
if (endLocations?.Count > 0)
{
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == endLocations[0].id);
}
await _wmsKittingInStkService.KittingInStk(visualDevModelCrInput);
}
else
{
if (location != null && location.is_use == (int)EnumCarryStatus. && location.is_lock == 0)
{
//出库
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == kittingout.location_id);
var sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
var ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == kittingout.location_id);
if (sPoint != null && ePoint != null)
{
var kittingOutObj = new { requireId = kittingout.id, requireCode = kittingout.bill_code };
@@ -124,6 +136,7 @@ namespace Tnb.WarehouseMgr
else
{
//入库
await _wmsKittingInStkService.KittingInStk(visualDevModelCrInput);
}
}
}