diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsKittingInStkService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsKittingInStkService.cs new file mode 100644 index 00000000..849a24b8 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsKittingInStkService.cs @@ -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 +{ + /// + /// 齐套入库服务接口s + /// + public interface IWmsKittingInStkService + { + Task KittingInStk(VisualDevModelDataCrInput input); + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs index fd56fd77..204c1d43 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs @@ -125,6 +125,7 @@ namespace Tnb.WarehouseMgr carryCodes = input.data["tablefield130"].ToObject>(); } } + List pretaskCodes = new(); foreach (var pt in preTasks) { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs index 6f9dc631..8dcc7be3 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs @@ -35,13 +35,21 @@ namespace Tnb.WarehouseMgr private readonly IUserManager _userManager; private readonly IWareHouseService _warehouseService; private readonly IBillRullService _billRullService; - public WmsRobotCallbackService(IWmsCarryBindService wmsCarryBindService, ISqlSugarRepository repository, IUserManager userManager, IWareHouseService warehouseService, IBillRullService billRullService) + private readonly IWmsKittingInStkService _wmsKittingInStkService; + public WmsRobotCallbackService( + IWmsCarryBindService wmsCarryBindService, + ISqlSugarRepository 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().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(); + 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().SingleAsync(it => it.id == kittingout.location_id); if (kittingout.location_id.IsNullOrWhiteSpace() || (location != null && location.is_type.ToEnum() == EnumLocationType.存储库位)) { //入库 - InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = location.wh_id }; - var endLocations = await _warehouseService.InStockStrategy(inStockStrategyInput); - sPoint = await _db.Queryable().FirstAsync(it => it.location_id == carry.location_id); - if (endLocations?.Count > 0) - { - ePoint = await _db.Queryable().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().FirstAsync(it => it.location_id == carry.location_id); - ePoint = await _db.Queryable().FirstAsync(it => it.location_id == kittingout.location_id); + var sPoint = await _db.Queryable().FirstAsync(it => it.location_id == carry.location_id); + var ePoint = await _db.Queryable().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); } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs index 1806caf7..e0c78d87 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs @@ -74,17 +74,22 @@ namespace Tnb.WarehouseMgr loc.is_use = (int)EnumCarryStatus.空闲; await _db.Updateable(loc).UpdateColumns(it => it.is_use).ExecuteCommandAsync(); } + carry.location_id = null; + carry.location_code = null; + await _db.Updateable(carry).UpdateColumns(it => new { it.location_id, it.location_code }).ExecuteCommandAsync(); var disTask = await _db.Queryable().SingleAsync(it => it.id == input.disTaskId); if (disTask != null) { if (_dicBizType.ContainsKey(disTask.biz_type)) { - WareHouseUpInput upInput = new() { + WareHouseUpInput upInput = new() + { loginType = "web", - bizTypeId = disTask.biz_type, - requireId = disTask.require_id, + bizTypeId = disTask.biz_type, + requireId = disTask.require_id, carryIds = new List { input.carryId }, - distaskCodes = input.distaskCodes }; + distaskCodes = input.distaskCodes + }; await DoUpdate(upInput); //回更业务 //switch (_dicBizType[disTask.biz_type]) //{