diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs index 96cbd3af..c6fa8973 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs @@ -48,33 +48,83 @@ namespace Tnb.WarehouseMgr.Entities.Consts /// public const string TASK_BILL_STATUS_COMPLE_ID = "26126860808229"; /// - /// 预任务生成业务类型-载具移入Id - /// - public const string BIZTYPE_MOVEIN_ID = "26121988909861"; - /// /// 单据状态-作业中 /// public const string BILLSTATUS_ON_ID = "25065143245845"; /// - /// 预任务类型-入库TypeId + /// 任务类型-入库TypeId /// public const string WMS_PRETASK_INSTOCK_TYPE_ID = "26126748597797"; /// - /// 预任务生成业务类型-载具移入Id + /// 任务类型-出库TypeId /// - public const string BIZTYPE_EMPTYIN_ID = "26120915344165"; + public const string WMS_PRETASK_OUTSTOCK_TYPE_ID = "26126751446821"; + /// + /// 任务类型-转移TypeId + /// + public const string WMS_PRETASK_TRANSFER_TYPE_ID = "26126753796389"; + /// /// 预任务生成业务类型-空载具出库ID /// public const string BIZTYPE_EMPTYOUT_ID = "26122798979365"; /// - /// 预任务生成业务类型-PDA空载具入库ID + /// 预任务生成业务类型-空载具出库 /// - public const string BIZTYPE_EMPTYINPDA_ID = "26475795363877"; + public const string BIZTYPE_WMSEPTYOUTSTK_ID = "26122265173285"; /// - /// 预任务生成业务类型-PDA空载具出库ID + /// 预任务生成业务类型-载具移出 /// - public const string BIZTYPE_EMPTYOUTPDA_ID = "26475845405733"; + public const string BIZTYPE_WMSMOOUTSTK_ID = "26122271183141"; + /// + /// 预任务生成业务类型-空载具入库 + /// + public const string BIZTYPE_WMSEMPTYINSTOCK_ID = "26121986416677"; + /// + /// 预任务生成业务类型-载具移入 + /// + public const string BIZTYPE_CARRYMOVEINSTOCK_ID = "26121988909861"; + /// + /// 预任务生成业务类型-库内转移 + /// + public const string BIZTYPE_WMSTRANSFER_ID = "26125644258853"; + /// + /// 预任务生成业务类型-齐套分拣 + /// + public const string BIZTYPE_WMSSETSORTING_ID = "26186830379045"; + /// + /// 预任务生成业务类型-寄存捆包 + /// + public const string BIZTYPE_WMSINBALE_ID = "26191517767205"; + /// + /// 预任务生成业务类型-一般入库 + /// + public const string BIZTYPE_WMSINSTOCK_ID = "26191496816421"; + /// + /// 预任务生成业务类型-一般出库 + /// + public const string BIZTYPE_WMSOUTSTOCK_ID = "26191522660645"; + /// + /// 预任务生成业务类型-齐套入库 + /// + public const string BIZTYPE_WMSKITTINGINSTK_ID = "26165655816741"; + /// + /// 预任务生成业务类型-齐套出库 + /// + public const string BIZTYPE_WMSKITTINGOUTSTK_ID = "26169472620837"; + /// + /// 预任务生成业务类型-寄存出库 + /// + public const string BIZTYPE_WMSOUTBALE_ID = "26191525396517"; + /// + /// 预任务生成业务类型-寄存入库 + /// + public const string BIZTYPE_WMSINBALEINSTK_ID = "26501508971285"; + /// + /// 预任务生成业务类型-配送申请 + /// + public const string BIZTYPE_WMSDELIVERY_ID = "26585291847957"; + } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs index 453c6ebd..62af80c3 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs @@ -104,7 +104,7 @@ namespace Tnb.WarehouseMgr preTask.end_floor = ePoint?.floor.ToString(); preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(); preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID; - preTask.biz_type = WmsWareHouseConst.BIZTYPE_MOVEIN_ID; + preTask.biz_type = WmsWareHouseConst.BIZTYPE_CARRYMOVEINSTOCK_ID; preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID; preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!; preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveOutStockService.cs index 02ca1614..eee01c09 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveOutStockService.cs @@ -18,6 +18,7 @@ using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; +using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Interfaces; @@ -28,9 +29,11 @@ namespace Tnb.WarehouseMgr /// 载具移入 /// [OverideVisualDev(ModuleId)] + [ServiceModule(BizTypeId)] public class WmsCarryMoveOutStockService : BaseWareHouseService { private const string ModuleId = "26123262586661"; + private const string BizTypeId = "26122271183141"; private readonly ISqlSugarClient _db; private readonly IRunService _runService; private readonly IVisualDevService _visualDevService; @@ -99,8 +102,8 @@ namespace Tnb.WarehouseMgr preTask.end_floor = ePoint?.floor.ToString(); preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(); preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID; - preTask.biz_type = WmsWareHouseConst.BIZTYPE_MOVEIN_ID; - preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID; + preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSMOOUTSTK_ID; + preTask.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID; preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!; preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!; preTask.area_id = sPoint?.area_id; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs index bf417847..a922e99a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs @@ -103,7 +103,7 @@ namespace Tnb.WarehouseMgr preTask.end_floor = ePoint?.floor.ToString(); preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(); preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID; - preTask.biz_type = WmsWareHouseConst.BIZTYPE_EMPTYIN_ID; + preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSEMPTYINSTOCK_ID; preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!; preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!; preTask.area_id = sPoint?.area_id; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutStockService.cs new file mode 100644 index 00000000..4885c0b2 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutStockService.cs @@ -0,0 +1,144 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +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 JNPF.VisualDev; +using JNPF.VisualDev.Entitys; +using JNPF.VisualDev.Interfaces; +using Mapster; +using Microsoft.AspNetCore.Mvc; +using SqlSugar; +using Tnb.BasicData.Entities; +using Tnb.WarehouseMgr.Entities; +using Tnb.WarehouseMgr.Entities.Attributes; +using Tnb.WarehouseMgr.Entities.Consts; +using Tnb.WarehouseMgr.Entities.Dto; +using Tnb.WarehouseMgr.Interfaces; + +namespace Tnb.WarehouseMgr +{ + /// + /// 载具移入 + /// + [OverideVisualDev(ModuleId)] + [ServiceModule(BizTypeId)] + public class WmsEmptyMoveOutStockService : BaseWareHouseService + { + private const string ModuleId = "26122798979365"; + private const string BizTypeId = "26122798979365"; + private readonly ISqlSugarClient _db; + private readonly IRunService _runService; + private readonly IVisualDevService _visualDevService; + private readonly IWareHouseService _wareHouseService; + private readonly IBillRullService _billRullService; + private readonly IUserManager _userManager; + public WmsEmptyMoveOutStockService( + ISqlSugarRepository repository, + IRunService runService, + IVisualDevService visualDevService, + IWareHouseService wareHouseService, + IUserManager userManager, + IBillRullService billRullService) + { + _db = repository.AsSugarClient(); + _runService = runService; + _visualDevService = visualDevService; + _wareHouseService = wareHouseService; + _userManager = userManager; + _billRullService = billRullService; + OverideFuncs.CreateAsync = CarryMoveIn; + } + + private async Task CarryMoveIn(VisualDevModelDataCrInput input) + { + + try + { + await _db.Ado.BeginTranAsync(); + + VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true); + await _runService.Create(templateEntity, input); + //入库取终点 + var OutStockStrategyInput = new OutStockStrategyQuery { carry_id = input.data[nameof(OutStockStrategyQuery.carry_id)].ToString(), Size = 1 }; + var carrys = await _wareHouseService.OutStockStrategy(OutStockStrategyInput); + WmsPointH sPoint = null; + WmsPointH ePoint = null; + if (input.data.ContainsKey(nameof(WmsPointH.location_id))) + { + ePoint = await _db.Queryable().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString()); + } + if (carrys?.Count > 0) + { + sPoint = await _db.Queryable().FirstAsync(it => it.location_id == carrys[0].location_id); + } + + if (sPoint != null && ePoint != null) + { + var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); + //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) + if (points?.Count > 0) + { + if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500); + var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + { + var sPoint = it.FirstOrDefault(); + var ePoint = it.LastOrDefault(); + + WmsPretaskH preTask = new(); + preTask.org_id = _userManager.User.OrganizeId; + preTask.startlocation_id = sPoint?.location_id; + preTask.startlocation_code = sPoint?.location_code; + preTask.endlocation_id = ePoint?.location_id; + preTask.endlocation_code = ePoint?.location_code; + preTask.start_floor = sPoint?.floor.ToString(); + preTask.end_floor = ePoint?.floor.ToString(); + preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(); + preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID; + preTask.biz_type = WmsWareHouseConst.BIZTYPE_EMPTYOUT_ID; + //preTask.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID; + preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!; + preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!; + preTask.area_id = sPoint?.area_id; + preTask.area_code = it.Key; + preTask.require_id = input.data["ReturnIdentity"].ToString(); + preTask.require_code = input.data[nameof(preTask.bill_code)]?.ToString()!; + preTask.create_id = _userManager.UserId; + preTask.create_time = DateTime.Now; + return preTask; + }).ToList(); + var isOk = await _wareHouseService.GenPreTask(preTasks); + if (isOk) + { + var preTaskUpInput = new GenPreTaskUpInput(); + preTaskUpInput.PreTaskId = input.data["ReturnIdentity"].ToString(); + preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!; + preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id; + preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code; + preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList(); + preTaskUpInput.PreTaskRecords = preTasks.Adapt>(); + preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId()); + await _wareHouseService.GenTaskHandleAfter(preTaskUpInput); + } + } + + } + + await _db.Ado.CommitTranAsync(); + } + catch (Exception ex) + { + await _db.Ado.RollbackTranAsync(); + throw; + } + return Task.FromResult(true); + } + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsTransfer.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsTransfer.cs index a839ece1..6629a4c7 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsTransfer.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsTransfer.cs @@ -31,17 +31,17 @@ namespace Tnb.WarehouseMgr /// [OverideVisualDev(ModuleId)] [ServiceModule(BizTypeId)] - public class WmsCarryMoveInStockService : BaseWareHouseService + public class WmsTransferService : BaseWareHouseService { - private const string BizTypeId = "26121988909861"; - private const string ModuleId = "26122102481957"; + private const string BizTypeId = "26125644258853"; + private const string ModuleId = "26125750270757"; private readonly ISqlSugarClient _db; private readonly IRunService _runService; private readonly IVisualDevService _visualDevService; private readonly IWareHouseService _wareHouseService; private readonly IBillRullService _billRullService; private readonly IUserManager _userManager; - public WmsCarryMoveInStockService( + public WmsTransferService( ISqlSugarRepository repository, IRunService runService, IVisualDevService visualDevService, @@ -55,10 +55,10 @@ namespace Tnb.WarehouseMgr _wareHouseService = wareHouseService; _userManager = userManager; _billRullService = billRullService; - OverideFuncs.CreateAsync = CarryMoveIn; + OverideFuncs.CreateAsync = CarryTransfer; } - private async Task CarryMoveIn(VisualDevModelDataCrInput input) + private async Task CarryTransfer(VisualDevModelDataCrInput input) { try @@ -103,8 +103,8 @@ namespace Tnb.WarehouseMgr preTask.end_floor = ePoint?.floor.ToString(); preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(); preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID; - preTask.biz_type = WmsWareHouseConst.BIZTYPE_MOVEIN_ID; - preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID; + preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSTRANSFER_ID; + preTask.task_type = WmsWareHouseConst.WMS_PRETASK_TRANSFER_TYPE_ID; preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!; preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!; preTask.area_id = sPoint?.area_id;