| | |
| | | private readonly IRepository<SysDictData, MasterDbContextLocator> _sysDictDataRep; |
| | | private readonly ISysExcelTemplateService _sysExcelTemplateService; |
| | | private readonly static object _lock = new(); |
| | | |
| | | private readonly IRepository<WmsArea, MasterDbContextLocator> _wmsAreaRep; |
| | | public WmsPlaceService( |
| | | IRepository<WmsPlace,MasterDbContextLocator> wmsPlaceRep |
| | | ,IRepository<SysDictType, MasterDbContextLocator> sysDictTypeRep |
| | | ,IRepository<SysDictData, MasterDbContextLocator> sysDictDataRep |
| | | ,ISysExcelTemplateService sysExcelTemplateService |
| | | , IRepository<WmsArea, MasterDbContextLocator> wmsAreaRep |
| | | ) |
| | | { |
| | | _wmsPlaceRep = wmsPlaceRep; |
| | | _sysDictTypeRep = sysDictTypeRep; |
| | | _sysDictDataRep = sysDictDataRep; |
| | | _sysExcelTemplateService = sysExcelTemplateService; |
| | | _wmsAreaRep = wmsAreaRep; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | public async Task Add(AddWmsPlaceInput input) |
| | | { |
| | | var wmsPlace = input.Adapt<WmsPlace>(); |
| | | //验证 |
| | | var area = (await _wmsAreaRep.DetachedEntities.FirstOrDefaultAsync(u => u.Id == input.AreaId&&u.IsDeleted==false)).Adapt<WmsAreaOutput>(); |
| | | if (area == null) |
| | | { |
| | | throw Oops.Oh($"库区不存在"); |
| | | } |
| | | if (area.IsDisabled==true) |
| | | { |
| | | throw Oops.Oh($"库区已禁用"); |
| | | } |
| | | wmsPlace.AreaName= area.AreaName; |
| | | wmsPlace.AreaCode= area.AreaCode; |
| | | wmsPlace.PlaceTypeName = wmsPlace.PlaceType.ToString(); |
| | | //验证 |
| | | await CheckExisit(wmsPlace); |
| | | |
| | | wmsPlace.CreatedUserId = wmsPlace.UpdatedUserId = SysHelper.GetUserId(); |
| | |
| | | if (!isExist) throw Oops.Oh(ErrorCode.D1002); |
| | | |
| | | var wmsPlace = input.Adapt<WmsPlace>(); |
| | | |
| | | var area = (await _wmsAreaRep.DetachedEntities.FirstOrDefaultAsync(u => u.Id == input.AreaId && u.IsDeleted == false)).Adapt<WmsAreaOutput>(); |
| | | if (area == null) |
| | | { |
| | | throw Oops.Oh($"库区不存在"); |
| | | } |
| | | if (area.IsDisabled == true) |
| | | { |
| | | throw Oops.Oh($"库区已禁用"); |
| | | } |
| | | wmsPlace.AreaName = area.AreaName; |
| | | wmsPlace.AreaCode = area.AreaCode; |
| | | wmsPlace.PlaceTypeName = wmsPlace.PlaceType.ToString(); |
| | | //验证 |
| | | await CheckExisit(wmsPlace,true); |
| | | |
| | |
| | | var _OutSequence = "";//出库顺序 |
| | | var _IsVirtually = "";//是否虚拟 |
| | | var _IsDisabled = "";//是否禁用 |
| | | var _Id = "";//Id主键 |
| | | #endregion |
| | | |
| | | |
| | |
| | | _PlaceName = row["库位名称"]?.ToString() ; |
| | | _PlaceAlias = row["库位别名"]?.ToString() ; |
| | | _PlaceType = row["库位类型"]?.ToString() ; |
| | | _PlaceTypeName = row["库位类型名称"]?.ToString() ; |
| | | _PlaceStatus = row["库位属性"]?.ToString() ; |
| | | _IsSrmPlace = row["是否堆垛机库位"]?.ToString() ; |
| | | _SrmPlaceNo = row["堆垛机库位号"]?.ToString() ; |
| | | _IsRgvPlace = row["是否RGV库位"]?.ToString() ; |
| | | _RgvPlaceNo = row["RGV库位号"]?.ToString() ; |
| | | _IsAgvPlace = row["是否AGV库位"]?.ToString() ; |
| | | _AgvPlaceNo = row["AGV库位号"]?.ToString() ; |
| | | _IsTransPlace = row["是否输送线库位"]?.ToString() ; |
| | | _TransPlaceNo = row["输送线库位号"]?.ToString() ; |
| | | |
| | | _IsActivateWCS = row["是否激活与任务调度"]?.ToString() ; |
| | | _Environment = row["库存环境"]?.ToString() ; |
| | | _AreaCode = row["库区编号"]?.ToString() ; |
| | | _AreaId = row["所在库区"]?.ToString() ; |
| | | //_AreaId = row["所在库区"]?.ToString() ; |
| | | _AreaName = row["库区名称"]?.ToString() ; |
| | | _VerificationCode = row["检验码"]?.ToString() ; |
| | | _RowNo = row["排"]?.ToString() ; |
| | |
| | | _OutSequence = row["出库顺序"]?.ToString() ; |
| | | _IsVirtually = row["是否虚拟"]?.ToString() ; |
| | | _IsDisabled = row["是否禁用"]?.ToString() ; |
| | | _Id = row["Id主键"]?.ToString() ; |
| | | #endregion |
| | | |
| | | |
| | |
| | | throw Oops.Oh($"第{index}行[所在库区]{_AreaId}不能为空!"); |
| | | } |
| | | |
| | | if(!string.IsNullOrEmpty(_AreaId)) |
| | | { |
| | | if (!long.TryParse(_AreaId, out long outAreaId)&&!string.IsNullOrEmpty(_AreaId)) |
| | | { |
| | | throw Oops.Oh($"第{index}行[所在库区]{_AreaId}值不正确!"); |
| | | } |
| | | if (outAreaId <= 0&&!string.IsNullOrEmpty(_AreaId)) |
| | | { |
| | | throw Oops.Oh($"第{index}行[所在库区]{_AreaId}值不能小于等于0!"); |
| | | } |
| | | else |
| | | { |
| | | addItem.AreaId = outAreaId; |
| | | } |
| | | |
| | | } |
| | | |
| | | if(!string.IsNullOrEmpty(_AreaName)) |
| | | { |
| | | addItem.AreaName = (string)_AreaName; |
| | |
| | | addItem.IsDisabled = outIsDisabled; |
| | | } |
| | | } |
| | | |
| | | if(!string.IsNullOrEmpty(_Id)) |
| | | { |
| | | if (!long.TryParse(_Id, out long outId)&&!string.IsNullOrEmpty(_Id)) |
| | | { |
| | | throw Oops.Oh($"第{index}行[Id主键]{_Id}值不正确!"); |
| | | } |
| | | if (outId <= 0&&!string.IsNullOrEmpty(_Id)) |
| | | { |
| | | throw Oops.Oh($"第{index}行[Id主键]{_Id}值不能小于等于0!"); |
| | | } |
| | | else |
| | | { |
| | | addItem.Id = outId; |
| | | } |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |