From 660ca866abd9e07a663090bfab7e4cf223643e40 Mon Sep 17 00:00:00 2001 From: WenJY Date: Fri, 8 May 2026 15:09:24 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E7=AD=9B=E9=80=89=E5=BA=93?= =?UTF-8?q?=E4=BD=8D=E9=80=BB=E8=BE=91=E5=AE=9E=E7=8E=B0=E3=80=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E9=A1=B9=E7=9B=AE=E5=AE=9E=E4=BD=93=E5=8F=82=E6=95=B0?= =?UTF-8?q?=EF=BC=9A=E5=8E=BB=E9=99=A4=E5=88=9B=E5=BB=BA=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sln.Wcs.Business/Domain/Enum/StoreTypeEnum.cs | 19 +++++ .../FilterLocationResultModel.cs | 5 ++ Sln.Wcs.Business/InStore/MaterialInStore.cs | 72 ++++++++++++++++++- Sln.Wcs.Model/Domain/BaseDeviceHost.cs | 32 --------- Sln.Wcs.Model/Domain/BaseDeviceInfo.cs | 32 --------- Sln.Wcs.Model/Domain/BaseDeviceParam.cs | 33 --------- Sln.Wcs.Model/Domain/BaseLocationInfo.cs | 32 --------- Sln.Wcs.Model/Domain/BaseMaterialInfo.cs | 32 --------- Sln.Wcs.Model/Domain/BasePathDetails.cs | 32 --------- Sln.Wcs.Model/Domain/BasePathInfo.cs | 32 --------- Sln.Wcs.Model/Domain/BaseStoreInfo.cs | 47 ++++-------- Sln.Wcs.Model/Domain/LiveTaskDetail.cs | 32 --------- Sln.Wcs.Model/Domain/LiveTaskQueue.cs | 32 --------- .../service/IBaseStoreInfoService.cs | 8 +++ .../service/Impl/BaseStoreInfoServiceImpl.cs | 38 ++++++++++ Sln.Wcs/MaterialInStoreTest.cs | 68 ++++++++++++++++++ Sln.Wcs/Program.cs | 32 --------- 17 files changed, 223 insertions(+), 355 deletions(-) create mode 100644 Sln.Wcs.Business/Domain/Enum/StoreTypeEnum.cs create mode 100644 Sln.Wcs/MaterialInStoreTest.cs diff --git a/Sln.Wcs.Business/Domain/Enum/StoreTypeEnum.cs b/Sln.Wcs.Business/Domain/Enum/StoreTypeEnum.cs new file mode 100644 index 0000000..99de31c --- /dev/null +++ b/Sln.Wcs.Business/Domain/Enum/StoreTypeEnum.cs @@ -0,0 +1,19 @@ +namespace Sln.Wcs.Business.Domain.Enum; + +public enum StoreTypeEnum +{ + /// + /// 包材 + /// + Material = 1, + + /// + /// 成品 + /// + Product = 2, + + /// + /// 托盘 + /// + Pallet = 3, +} \ No newline at end of file diff --git a/Sln.Wcs.Business/Domain/Model/FilterLocation/FilterLocationResultModel.cs b/Sln.Wcs.Business/Domain/Model/FilterLocation/FilterLocationResultModel.cs index fe4be26..66c6715 100644 --- a/Sln.Wcs.Business/Domain/Model/FilterLocation/FilterLocationResultModel.cs +++ b/Sln.Wcs.Business/Domain/Model/FilterLocation/FilterLocationResultModel.cs @@ -29,6 +29,11 @@ namespace Sln.Wcs.Business.Domain.Model.FilterLocation; public class FilterLocationResultModel { + /// + /// 目标仓库 + /// + public BaseStoreInfo storeInfo { get; set; } + /// /// 目标库位 /// diff --git a/Sln.Wcs.Business/InStore/MaterialInStore.cs b/Sln.Wcs.Business/InStore/MaterialInStore.cs index 9dd15e9..8d0e12d 100644 --- a/Sln.Wcs.Business/InStore/MaterialInStore.cs +++ b/Sln.Wcs.Business/InStore/MaterialInStore.cs @@ -30,6 +30,7 @@ using Sln.Wcs.Business.Domain.Dto.SaveTask; using Sln.Wcs.Business.Domain.Dto.ValidateMaterial; using Sln.Wcs.Business.Domain.Enum; using Sln.Wcs.Business.Domain.Model.CreateTask; +using Sln.Wcs.Business.Domain.Model.FilterLocation; using Sln.Wcs.Business.Domain.Model.SaveTask; using Sln.Wcs.Model.Domain; using Sln.Wcs.Repository.service; @@ -43,11 +44,13 @@ public class MaterialInStore:BaseBusiness { private readonly IBasePathInfoService _basePathInfoService; private readonly ILiveTaskQueueService _liveTaskQueueService; + private readonly IBaseStoreInfoService _baseStoreInfoService; - public MaterialInStore(IBasePathInfoService basePathInfoService, ILiveTaskQueueService liveTaskQueueService) + public MaterialInStore(IBasePathInfoService basePathInfoService, ILiveTaskQueueService liveTaskQueueService, IBaseStoreInfoService baseStoreInfoService) { _basePathInfoService = basePathInfoService; _liveTaskQueueService = liveTaskQueueService; + _baseStoreInfoService = baseStoreInfoService; } public override ValidateMaterialResultDto ValidateMaterial(ValidateMaterialDto validateMaterialDto) @@ -66,6 +69,25 @@ public class MaterialInStore:BaseBusiness CreateTaskResultDto resultDto = new CreateTaskResultDto(); try { + #region CreateTaskDto 参数校验 + + if (string.IsNullOrEmpty(createTaskDto.materialCode)) + { + throw new InvalidOperationException($"物料编号不允许为 NULL"); + } + + if (string.IsNullOrEmpty(createTaskDto.palletBarcode)) + { + throw new InvalidOperationException($"托盘条码不允许为 NULL"); + } + + if (string.IsNullOrEmpty(createTaskDto.startPoint) || string.IsNullOrEmpty(createTaskDto.endPoint)) + { + throw new InvalidOperationException($"起始位置、终点位置不允许为 NULL"); + } + + #endregion + createTaskDto.taskType = TaskTypeEnum.InStore; createTaskDto.taskCategory = TaskCategoryEnum.Material; //获取包材入库路径 @@ -100,9 +122,55 @@ public class MaterialInStore:BaseBusiness return resultDto; } + /// + /// 筛选库位 + /// + /// + /// + /// public override FilterLocationResultDto FilterLocation(FilterLocationDto filterLocationDto) { - throw new NotImplementedException(); + FilterLocationResultDto resultDto = new FilterLocationResultDto(); + try + { + + #region 参数校验 + + if (string.IsNullOrEmpty(filterLocationDto.materialCode)) + { + throw new InvalidOperationException($"物料编号不允许为 NULL"); + } + + #endregion + + Expression> storeWhere = x => x.storeType == (int)StoreTypeEnum.Material; + Expression> locationWhere = x=>x.materialCode==filterLocationDto.materialCode && x.locationStatus == 0 && x.isFlag == 1; + + List storeInfos = _baseStoreInfoService.GetBasePathInfo(storeWhere,locationWhere); + + //先对仓库进行排序 + BaseStoreInfo? storeInfo = storeInfos.Where(s => s.locationInfos.Count > 0).OrderBy(x=>x.storeCode).FirstOrDefault() ?? throw new ArgumentNullException($"未获取到可用仓库"); + + BaseLocationInfo? locationInfo = storeInfo.locationInfos.OrderBy(x => x.locationRows).ThenBy(x=>x.locationColumns).ThenBy(x=>x.locationLayers).FirstOrDefault() ?? throw new ArgumentNullException($"目标仓库:{storeInfo.storeName}中未获取到可用库位"); + + resultDto.code = BusinessStatusEnum.成功; + resultDto.msg = "执行完成"; + resultDto.data = new FilterLocationResultModel() + { + storeInfo = storeInfo, + + locationInfos = storeInfo.locationInfos, + + locationInfo = locationInfo, + }; + } + catch (Exception e) + { + resultDto.code = BusinessStatusEnum.方法执行异常; + resultDto.msg = e.Message; + } + + return resultDto; } /// diff --git a/Sln.Wcs.Model/Domain/BaseDeviceHost.cs b/Sln.Wcs.Model/Domain/BaseDeviceHost.cs index 28d9061..cf7e280 100644 --- a/Sln.Wcs.Model/Domain/BaseDeviceHost.cs +++ b/Sln.Wcs.Model/Domain/BaseDeviceHost.cs @@ -103,36 +103,4 @@ public class BaseDeviceHost /// [SugarColumn(ColumnName = "remark")] public string remark { get; set; } - - /// - /// Desc:创建人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "created_by")] - public string createdBy { get; set; } - - /// - /// Desc:创建时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "created_time")] - public DateTime? createdTime { get; set; } - - /// - /// Desc:更新人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "updated_by")] - public string updatedBy { get; set; } - - /// - /// Desc:更新时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "updated_time")] - public DateTime? updatedTime { get; set; } } \ No newline at end of file diff --git a/Sln.Wcs.Model/Domain/BaseDeviceInfo.cs b/Sln.Wcs.Model/Domain/BaseDeviceInfo.cs index 8214a8c..bb7ca6f 100644 --- a/Sln.Wcs.Model/Domain/BaseDeviceInfo.cs +++ b/Sln.Wcs.Model/Domain/BaseDeviceInfo.cs @@ -99,38 +99,6 @@ namespace Sln.Wcs.Model.Domain [SugarColumn(ColumnName = "remark")] public string remark { get; set; } - /// - /// Desc:创建人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "created_by")] - public string createdBy { get; set; } - - /// - /// Desc:创建时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "created_time")] - public DateTime? createdTime { get; set; } - - /// - /// Desc:更新人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "updated_by")] - public string updatedBy { get; set; } - - /// - /// Desc:更新时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "updated_time")] - public DateTime? updatedTime { get; set; } - /// /// 序号(用于列表显示,不参与数据库操作) /// diff --git a/Sln.Wcs.Model/Domain/BaseDeviceParam.cs b/Sln.Wcs.Model/Domain/BaseDeviceParam.cs index 36cc4c6..56a6ad6 100644 --- a/Sln.Wcs.Model/Domain/BaseDeviceParam.cs +++ b/Sln.Wcs.Model/Domain/BaseDeviceParam.cs @@ -112,37 +112,4 @@ public class BaseDeviceParam [SugarColumn(ColumnName = "remark")] public string remark { get; set; } - /// - /// Desc:创建人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "created_by")] - public string createdBy { get; set; } - - /// - /// Desc:创建时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "created_time")] - public DateTime? createdTime { get; set; } - - /// - /// Desc:更新人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "updated_by")] - public string updatedBy { get; set; } - - /// - /// Desc:更新时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "updated_time")] - public DateTime? updatedTime { get; set; } - - } \ No newline at end of file diff --git a/Sln.Wcs.Model/Domain/BaseLocationInfo.cs b/Sln.Wcs.Model/Domain/BaseLocationInfo.cs index 6f0ea9a..650c312 100644 --- a/Sln.Wcs.Model/Domain/BaseLocationInfo.cs +++ b/Sln.Wcs.Model/Domain/BaseLocationInfo.cs @@ -155,38 +155,6 @@ namespace Sln.Wcs.Model.Domain [SugarColumn(ColumnName = "remark")] public string remark { get; set; } - /// - /// Desc:创建人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "created_by")] - public string createdBy { get; set; } - - /// - /// Desc:创建时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "created_time")] - public DateTime? createdTime { get; set; } - - /// - /// Desc:更新人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "updated_by")] - public string updatedBy { get; set; } - - /// - /// Desc:更新时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "updated_time")] - public DateTime? updatedTime { get; set; } - /// /// 序号(用于列表显示,不参与数据库操作) /// diff --git a/Sln.Wcs.Model/Domain/BaseMaterialInfo.cs b/Sln.Wcs.Model/Domain/BaseMaterialInfo.cs index 8ebb37a..20b6481 100644 --- a/Sln.Wcs.Model/Domain/BaseMaterialInfo.cs +++ b/Sln.Wcs.Model/Domain/BaseMaterialInfo.cs @@ -107,38 +107,6 @@ namespace Sln.Wcs.Model.Domain [SugarColumn(ColumnName = "remark")] public string remark { get; set; } - /// - /// Desc:创建人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "created_by")] - public string createdBy { get; set; } - - /// - /// Desc:创建时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "created_time")] - public DateTime? createdTime { get; set; } - - /// - /// Desc:更新人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "updated_by")] - public string updatedBy { get; set; } - - /// - /// Desc:更新时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "updated_time")] - public DateTime? updatedTime { get; set; } - /// /// 序号(用于列表显示,不参与数据库操作) /// diff --git a/Sln.Wcs.Model/Domain/BasePathDetails.cs b/Sln.Wcs.Model/Domain/BasePathDetails.cs index 04d04da..624f00b 100644 --- a/Sln.Wcs.Model/Domain/BasePathDetails.cs +++ b/Sln.Wcs.Model/Domain/BasePathDetails.cs @@ -98,37 +98,5 @@ namespace Sln.Wcs.Model.Domain /// [SugarColumn(ColumnName = "remark")] public string remark { get; set; } - - /// - /// Desc:创建人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "created_by")] - public string createdBy { get; set; } - - /// - /// Desc:创建时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "created_time")] - public DateTime? createdTime { get; set; } - - /// - /// Desc:更新人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "updated_by")] - public string updatedBy { get; set; } - - /// - /// Desc:更新时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "updated_time")] - public DateTime? updatedTime { get; set; } } } diff --git a/Sln.Wcs.Model/Domain/BasePathInfo.cs b/Sln.Wcs.Model/Domain/BasePathInfo.cs index 612c64a..a5eae50 100644 --- a/Sln.Wcs.Model/Domain/BasePathInfo.cs +++ b/Sln.Wcs.Model/Domain/BasePathInfo.cs @@ -106,38 +106,6 @@ namespace Sln.Wcs.Model.Domain /// [SugarColumn(ColumnName = "remark")] public string remark { get; set; } - - /// - /// Desc:创建人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "created_by")] - public string createdBy { get; set; } - - /// - /// Desc:创建时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "created_time")] - public DateTime? createdTime { get; set; } - - /// - /// Desc:更新人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "updated_by")] - public string updatedBy { get; set; } - - /// - /// Desc:更新时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "updated_time")] - public DateTime? updatedTime { get; set; } /// /// 明细集合 diff --git a/Sln.Wcs.Model/Domain/BaseStoreInfo.cs b/Sln.Wcs.Model/Domain/BaseStoreInfo.cs index c7e49e5..7729fec 100644 --- a/Sln.Wcs.Model/Domain/BaseStoreInfo.cs +++ b/Sln.Wcs.Model/Domain/BaseStoreInfo.cs @@ -58,6 +58,14 @@ namespace Sln.Wcs.Model.Domain /// [SugarColumn(ColumnName = "store_name")] public string storeName { get; set; } + + /// + /// Desc:仓库类型:1-包材;2-成品;3-托盘 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "store_type")] + public int? storeType { get; set; } /// /// Desc:是否表示:1-是;0-否 @@ -75,42 +83,17 @@ namespace Sln.Wcs.Model.Domain [SugarColumn(ColumnName = "remark")] public string remark { get; set; } - /// - /// Desc:创建人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "created_by")] - public string createdBy { get; set; } - - /// - /// Desc:创建时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "created_time")] - public DateTime? createdTime { get; set; } - - /// - /// Desc:更新人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "updated_by")] - public string updatedBy { get; set; } - - /// - /// Desc:更新时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "updated_time")] - public DateTime? updatedTime { get; set; } - /// /// 序号(用于列表显示,不参与数据库操作) /// [SugarColumn(IsIgnore = true)] public int RowIndex { get; set; } + + /// + /// 库位集合 + /// + [SugarColumn(IsIgnore = true)] + [Navigate(NavigateType.OneToMany, nameof(BaseLocationInfo.storeCode), nameof(storeCode))] + public List locationInfos { get; set; } } } diff --git a/Sln.Wcs.Model/Domain/LiveTaskDetail.cs b/Sln.Wcs.Model/Domain/LiveTaskDetail.cs index a91d7b3..b9f3731 100644 --- a/Sln.Wcs.Model/Domain/LiveTaskDetail.cs +++ b/Sln.Wcs.Model/Domain/LiveTaskDetail.cs @@ -160,36 +160,4 @@ public class LiveTaskDetail /// [SugarColumn(ColumnName = "remark")] public string remark { get; set; } - - /// - /// Desc:创建人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "created_by")] - public string createdBy { get; set; } - - /// - /// Desc:创建时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "created_time")] - public DateTime? createdTime { get; set; } - - /// - /// Desc:更新人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "updated_by")] - public string updatedBy { get; set; } - - /// - /// Desc:更新时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "updated_time")] - public DateTime? updatedTime { get; set; } } \ No newline at end of file diff --git a/Sln.Wcs.Model/Domain/LiveTaskQueue.cs b/Sln.Wcs.Model/Domain/LiveTaskQueue.cs index 5d5991c..4aaa20b 100644 --- a/Sln.Wcs.Model/Domain/LiveTaskQueue.cs +++ b/Sln.Wcs.Model/Domain/LiveTaskQueue.cs @@ -152,38 +152,6 @@ public class LiveTaskQueue /// [SugarColumn(ColumnName = "remark")] public string remark { get; set; } - - /// - /// Desc:创建人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "created_by")] - public string createdBy { get; set; } - - /// - /// Desc:创建时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "created_time")] - public DateTime? createdTime { get; set; } - - /// - /// Desc:更新人 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "updated_by")] - public string updatedBy { get; set; } - - /// - /// Desc:更新时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "updated_time")] - public DateTime? updatedTime { get; set; } /// /// 明细集合 diff --git a/Sln.Wcs.Repository/service/IBaseStoreInfoService.cs b/Sln.Wcs.Repository/service/IBaseStoreInfoService.cs index 0056b71..7d37548 100644 --- a/Sln.Wcs.Repository/service/IBaseStoreInfoService.cs +++ b/Sln.Wcs.Repository/service/IBaseStoreInfoService.cs @@ -3,6 +3,7 @@ using Sln.Wcs.Repository.service.@base; using System; using System.Collections.Generic; using System.Linq; +using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; @@ -10,5 +11,12 @@ namespace Sln.Wcs.Repository.service { public interface IBaseStoreInfoService:IBaseService { + /// + /// 获取仓库信息:关联下属库位 + /// + /// + /// + /// + List GetBasePathInfo(Expression> storeWhere,Expression> locationWhere); } } diff --git a/Sln.Wcs.Repository/service/Impl/BaseStoreInfoServiceImpl.cs b/Sln.Wcs.Repository/service/Impl/BaseStoreInfoServiceImpl.cs index 5cf75ca..d08c047 100644 --- a/Sln.Wcs.Repository/service/Impl/BaseStoreInfoServiceImpl.cs +++ b/Sln.Wcs.Repository/service/Impl/BaseStoreInfoServiceImpl.cs @@ -3,8 +3,10 @@ using Sln.Wcs.Repository.service.@base; using System; using System.Collections.Generic; using System.Linq; +using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; +using SqlSugar; #region << 版 本 注 释 >> /*-------------------------------------------------------------------- @@ -34,6 +36,42 @@ namespace Sln.Wcs.Repository.service.Impl { public BaseStoreInfoServiceImpl(Repository rep) : base(rep) { + + } + + public List GetBasePathInfo(Expression> storeWhere,Expression> locationWhere) + { + try + { + // var result = _rep.Context.Queryable() + // .Includes(x => x.locationInfos.Where(p => p.isFlag == 1).ToList()) + // .Where(storeWhere) + // .ToList(); + + var res = _rep.Context.Queryable() + .Includes(x => x.locationInfos) // 先加载所有 + .Where(storeWhere) + .ToList() + .Select(store => new BaseStoreInfo + { + objId = store.objId, + storeCode = store.storeCode, + storeName = store.storeName, + storeType = store.storeType, + isFlag = store.isFlag, + remark = store.remark, + locationInfos = store.locationInfos.AsQueryable() + .Where(locationWhere) // 应用 locationWhere + .Where(p => p.isFlag == 1) + .ToList() + }).ToList(); + + return res; + } + catch (Exception ex) + { + throw new InvalidOperationException($"通过导航查询方式获取设备信息及下属参数执行异常:{ex.Message}"); + } } } } diff --git a/Sln.Wcs/MaterialInStoreTest.cs b/Sln.Wcs/MaterialInStoreTest.cs new file mode 100644 index 0000000..585df70 --- /dev/null +++ b/Sln.Wcs/MaterialInStoreTest.cs @@ -0,0 +1,68 @@ +#region << 版 本 注 释 >> + +/*-------------------------------------------------------------------- +* 版权所有 (c) 2026 WenJY 保留所有权利。 +* CLR版本:4.0.30319.42000 +* 机器名称:Mr.Wen's MacBook Pro +* 命名空间:Sln.Wcs +* 唯一标识:45EEA80E-9828-4E99-B3CF-F88DF38F4C55 +* +* 创建者:WenJY +* 电子邮箱: +* 创建时间:2026-05-08 14:59:38 +* 版本:V1.0.0 +* 描述: +* +*-------------------------------------------------------------------- +* 修改人: +* 时间: +* 修改说明: +* +* 版本:V1.0.0 +*--------------------------------------------------------------------*/ + +#endregion << 版 本 注 释 >> + +using Sln.Wcs.Business.Domain.Dto.CreateTask; +using Sln.Wcs.Business.Domain.Dto.FilterLocation; +using Sln.Wcs.Business.Domain.Dto.SaveTask; +using Sln.Wcs.Business.InStore; + +namespace Sln.Wcs; + +public class MaterialInStoreTest +{ + private readonly MaterialInStore _service; + + public MaterialInStoreTest(MaterialInStore service) + { + _service = service; + } + + public void Run() + { + var locationInfo = _service.FilterLocation(new FilterLocationDto() + { + materialCode = "20260507000001", + palletBarcode = "20260507000001" + }); + + var info = _service.CreateTask(new CreateTaskDto() + { + materialCode = "20260507000001", + materialBarcode = "20260507000001", + palletBarcode = "20260507000001", + amount = 1, + startPoint = "13#_L1_01", + endPoint = "15#_L3_03", + }); + + var res = _service.SaveTask(new SaveTaskDto() + { + taskCode = info.data.taskCode, + taskQueue = info.data.taskQueue, + taskDetails = info.data.taskDetails, + }); + + } +} \ No newline at end of file diff --git a/Sln.Wcs/Program.cs b/Sln.Wcs/Program.cs index 3fa7c52..042944d 100644 --- a/Sln.Wcs/Program.cs +++ b/Sln.Wcs/Program.cs @@ -3,22 +3,9 @@ using Com.Ctrip.Framework.Apollo; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using NeoSmart.Caching.Sqlite; -using Newtonsoft.Json; -using Sln.Wcs.Business; -using Sln.Wcs.Business.Domain.Dto.CreateTask; -using Sln.Wcs.Business.Domain.Dto.SaveTask; -using Sln.Wcs.Business.InStore; -using Sln.Wcs.HikRoBotSdk; -using Sln.Wcs.HoistApi.Domain.Dto.HoistControl; -using Sln.Wcs.HoistApi.Domain.Enum; -using Sln.Wcs.HoistApi.Service; -using Sln.Wcs.Model.Configs; -using Sln.Wcs.Model.Domain; using Sln.Wcs.Repository; -using Sln.Wcs.Repository.service; using Sln.Wcs.Serilog; using Sln.Wcs.Plc; -using Sln.Wcs.Plc.Service; using ZiggyCreatures.Caching.Fusion; using ZiggyCreatures.Caching.Fusion.Serialization.NewtonsoftJson; @@ -41,25 +28,6 @@ namespace Sln.Wcs log.Info($"系统启动成功,日志存放位置:{config["logPath"]}"); - var bus = serviceProvider.GetService(); - - var info = bus.CreateTask(new CreateTaskDto() - { - materialCode = "Material2", - materialBarcode = "Material2", - palletBarcode = "Material2", - amount = 1, - startPoint = "13#_L1_01", - endPoint = "15#_L3_03", - }); - - var res = bus.SaveTask(new SaveTaskDto() - { - taskCode = info.data.taskCode, - taskQueue = info.data.taskQueue, - taskDetails = info.data.taskDetails, - }); - } private static void ConfigureServices(IServiceCollection services)