From 088781b66df11767588f232732dd525a13beb6c2 Mon Sep 17 00:00:00 2001 From: chenwenkai <1084072318@qq.com> Date: Wed, 23 Oct 2024 15:25:51 +0800 Subject: [PATCH] =?UTF-8?q?1.PDA=E9=9D=99=E8=84=89=E7=BA=BF=E9=85=8D?= =?UTF-8?q?=E9=80=81=E8=B5=B7=E7=82=B9=E5=92=8C=E7=BB=88=E7=82=B9=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E5=8F=AF=E9=80=89=E5=8F=AF=E6=89=AB=EF=BC=9B2.?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E9=85=8D=E9=80=81=E4=B8=8D=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E5=A1=AB=E5=86=99=E8=BD=BD=E5=85=B7=EF=BC=8C=E7=94=9F=E6=88=90?= =?UTF-8?q?=E9=A2=84=E4=BB=BB=E5=8A=A1=E7=94=B3=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Consts/WmsWareHouseConst.cs | 4 + .../Tnb.WarehouseMgr/WmsPDADeliveryService.cs | 77 +++++++++++++------ 2 files changed, 56 insertions(+), 25 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs index e31e3815..490bcfbb 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs @@ -364,6 +364,10 @@ namespace Tnb.WarehouseMgr.Entities.Consts /// public const string BIZTYPE_WMSDELIVERY_ID = "26585291847957"; /// + /// 预任务生成业务类型-人工移库 + /// + public const string BIZTYPE_PEOPLEDELIVERY_ID = "37760774435349"; + /// /// 预任务生成业务类型-销售出库 /// public const string BIZTYPE_WMSSALERELEASE_ID = "25104446664213"; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs index 56513564..c761a8d0 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs @@ -4,6 +4,8 @@ using JNPF.Common.Enums; using JNPF.Common.Extension; using JNPF.EventBus; using JNPF.FriendlyException; +using JNPF.Systems.Entitys.Model.DataInterFace; +using JNPF.Systems.Entitys.System; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; using JNPF.VisualDev.Entitys; @@ -19,6 +21,7 @@ using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; +using JNPF.Common.Security; namespace Tnb.WarehouseMgr { @@ -89,13 +92,15 @@ namespace Tnb.WarehouseMgr } if (input.data.ContainsKey(nameof(WmsDelivery.endlocation_id))) { - BasLocation endLocation = await _db.Queryable().Where(x=>x.location_code==input.data[nameof(WmsDelivery.endlocation_id)].ToString()).FirstAsync(); - if (endLocation == null) - { - throw Oops.Bah("未找到目标库位"); - } + //BasLocation endLocation = await _db.Queryable().Where(x=>x.location_code==input.data[nameof(WmsDelivery.endlocation_id)].ToString()).FirstAsync(); + //if (endLocation == null) + //{ + // throw Oops.Bah("未找到目标库位"); + //} - endLocationId = endLocation.id; + //endLocationId = endLocation.id; + + endLocationId = input.data[nameof(WmsDelivery.endlocation_id)]?.ToString()!; } string[] locIds = new[] { startLocationId, endLocationId }; List locs = await _basLocationService?.GetLocationInfobyIds(locIds)!; @@ -108,8 +113,8 @@ namespace Tnb.WarehouseMgr throw new AppFriendlyException("起始库位不能为存储库位", 500); }*/ } - VisualDevEntity? templateEntity = await _visualDevService?.GetInfoById(ModuleConsts.MODULE_WMSDELIVERYPDA_ID, true)!; - await _runService.Create(templateEntity, input); + //VisualDevEntity? templateEntity = await _visualDevService?.GetInfoById(ModuleConsts.MODULE_WMSDELIVERYPDA_ID, true)!; + //await _runService.Create(templateEntity, input); // 计算路径,插入预任务申请 WmsPointH sPoint = null!; @@ -120,7 +125,9 @@ namespace Tnb.WarehouseMgr } if (input.data.ContainsKey(nameof(WmsTransfer.endlocation_id))) { - ePoint = await _db!.Queryable().FirstAsync(it => it.location_code == input.data[nameof(WmsTransfer.endlocation_id)].ToString()); + //ePoint = await _db!.Queryable().FirstAsync(it => it.location_code == input.data[nameof(WmsTransfer.endlocation_id)].ToString()); + + ePoint = await _db?.Queryable().FirstAsync(it => it.location_id == input.data[nameof(WmsTransfer.endlocation_id)].ToString())!; } if (sPoint != null && ePoint != null) @@ -163,14 +170,14 @@ namespace Tnb.WarehouseMgr endpoint_code = ePoint?.point_code!, bill_code = _billRullService!.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(), status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID, - biz_type = WmsWareHouseConst.BIZTYPE_WMSDELIVERY_ID, + biz_type = WmsWareHouseConst.BIZTYPE_PEOPLEDELIVERY_ID, 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.carry_id = input.data.ContainsKey(nameof(preTask.carry_id)) ? input.data[nameof(preTask.carry_id)]?.ToString()! : ""; + preTask.carry_code = input.data.ContainsKey(nameof(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_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; @@ -181,18 +188,18 @@ namespace Tnb.WarehouseMgr { if (input.data.ContainsKey(nameof(WmsDelivery.startlocation_id)) && input.data.ContainsKey(nameof(WmsDelivery.endlocation_id)) && input.data[nameof(WmsDelivery.endlocation_id)] != null && input.data[nameof(WmsDelivery.endlocation_id)] != null) { - //查询库位表 - BasLocation location = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsDelivery.startlocation_id)].ToString()); - { - //载具加锁,增加库位信息 - _ = await _db.Updateable().SetColumns(it => new WmsCarryH - { - carry_status = ((int)EnumCarryStatus.占用).ToString(), - is_lock = 1, - location_id = input.data[nameof(WmsDelivery.startlocation_id)].ToString(), - location_code = location.location_code - }).Where(it => it.id == input.data[nameof(WmsDelivery.carry_id)].ToString()).ExecuteCommandAsync(); - } + ////查询库位表 + //BasLocation location = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsDelivery.startlocation_id)].ToString()); + //{ + // //载具加锁,增加库位信息 + // _ = await _db.Updateable().SetColumns(it => new WmsCarryH + // { + // carry_status = ((int)EnumCarryStatus.占用).ToString(), + // is_lock = 1, + // location_id = input.data[nameof(WmsDelivery.startlocation_id)].ToString(), + // location_code = location.location_code + // }).Where(it => it.id == input.data[nameof(WmsDelivery.carry_id)].ToString()).ExecuteCommandAsync(); + //} //所有库位加锁 string?[] ids = new[] { input.data[nameof(WmsDelivery.startlocation_id)].ToString(), input.data[nameof(WmsDelivery.endlocation_id)].ToString() }; @@ -238,5 +245,25 @@ namespace Tnb.WarehouseMgr throw Oops.Oh(ErrorCode.COM1001); } } + + /// + /// 根据区域以及扫描的库位编码获取库位信息 + /// + /// + /// + public async Task LocationbyCode(Dictionary dic) + { + var id = dic["id"]; + var code = dic["code"]; + + var dataInterE = await _db.Queryable().FirstAsync(x => x.Id == id && x.DeleteMark == null); + if (dataInterE == null) + throw Oops.Bah("未找到对应实体"); + + var reqParameters = dataInterE.RequestParameters.ToList(); + var basLocation = await _db.Queryable().Where(r => r.location_code.Contains(code) && r.region_id == reqParameters.First().defaultValue).FirstAsync(); + + return basLocation; + } } }