bug
liuying
2024-04-25 ae4e29f352975c2197521cf3c0b7179868d8cb84
iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsContainer/WmsContainerService.cs
@@ -26,6 +26,7 @@
        private readonly IRepository<SysDictType, MasterDbContextLocator> _sysDictTypeRep;
        private readonly IRepository<SysDictData, MasterDbContextLocator> _sysDictDataRep;
        private readonly ISysExcelTemplateService _sysExcelTemplateService;
        private readonly IRepository<WmsContainerType, MasterDbContextLocator> _wmsContainerTypeRep;
        private readonly static object _lock = new();
        public WmsContainerService(
@@ -33,12 +34,15 @@
            ,IRepository<SysDictType, MasterDbContextLocator> sysDictTypeRep
            ,IRepository<SysDictData, MasterDbContextLocator> sysDictDataRep
            ,ISysExcelTemplateService sysExcelTemplateService
            , IRepository<WmsContainerType, MasterDbContextLocator> wmsContainerTypeRep
        )
        {
            _wmsContainerRep = wmsContainerRep;
         _sysDictTypeRep = sysDictTypeRep;
         _sysDictDataRep = sysDictDataRep;
         _sysExcelTemplateService = sysExcelTemplateService;
            _wmsContainerTypeRep = wmsContainerTypeRep;
        }
        /// <summary>
@@ -164,9 +168,18 @@
        public async Task Add(AddWmsContainerInput input)
        {
            var wmsContainer = input.Adapt<WmsContainer>();
                        //验证
            await CheckExisit(wmsContainer);
            //容器类型id
            var ContainerTypeInfo = _wmsContainerTypeRep.Where(x => x.Id == input.ContainerTypeId).FirstOrDefault();
            if (ContainerTypeInfo == null)
            {
                throw Oops.Oh(errorMessage: @$"类型不存在!");
            }
            wmsContainer.ContainerTypeName = ContainerTypeInfo.TypeName;
            wmsContainer.CreatedUserId = wmsContainer.UpdatedUserId = SysHelper.GetUserId();
            wmsContainer.CreatedUserName = wmsContainer.UpdatedUserName = SysHelper.GetUserName();
            wmsContainer.CreatedTime = wmsContainer.UpdatedTime = SysHelper.GetNowTime();