| | |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Core.Caches; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Model.Models.Basic; |
| | | using WIDESEA_DTO.Basic; |
| | | |
| | | namespace WIDESEA_BasicService |
| | | { |
| | | public partial class WarehouseService : ServiceBase<Dt_Warehouse, IRepository<Dt_Warehouse>>, IWarehouseService |
| | | { |
| | | private readonly ICacheService _cacheService; |
| | | |
| | | public WarehouseService(IRepository<Dt_Warehouse> BaseDal,ICacheService cacheService) : base(BaseDal) |
| | | private readonly IRepository<Dt_WarehouseArea> _warehouseArearepository; |
| | | public WarehouseService(IRepository<Dt_Warehouse> BaseDal, ICacheService cacheService, IRepository<Dt_WarehouseArea> warehouseArearepository) : base(BaseDal) |
| | | { |
| | | _cacheService = cacheService; |
| | | _warehouseArearepository = warehouseArearepository; |
| | | } |
| | | |
| | | public IRepository<Dt_Warehouse> Repository => BaseDal; |
| | |
| | | return WarehouseDisableStatus(new int[] { key }); |
| | | } |
| | | |
| | | public async Task<WebResponseContent> ReceiveWarehouseArea(List<WarehouseAreaDto> models) |
| | | { |
| | | |
| | | var lists = _warehouseArearepository.Db.Queryable<Dt_WarehouseArea>().ToList(); |
| | | foreach (var item in models) |
| | | { |
| | | var dbfirst = lists.FirstOrDefault(x => x.Code == item.Code); |
| | | if (dbfirst != null) |
| | | { |
| | | dbfirst.Code = item.Code; |
| | | dbfirst.Name = item.Name; |
| | | dbfirst.FactoryArea = item.FactoryArea; |
| | | _warehouseArearepository.UpdateData(dbfirst); |
| | | } |
| | | else |
| | | { |
| | | _warehouseArearepository.AddData(new Dt_WarehouseArea { Code=item.Code,Name=item.Name,FactoryArea=item.FactoryArea}); |
| | | } |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |