| | |
| | | using SqlSugar; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Helper; |
| | |
| | | public partial class StockInfoService : ServiceBase<Dt_StockInfo, IRepository<Dt_StockInfo>>, IStockInfoService |
| | | { |
| | | private readonly IMapper _mapper; |
| | | |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | private readonly IRecordService _recordService; |
| | | public IRepository<Dt_StockInfo> Repository => BaseDal; |
| | | private readonly IRepository<Dt_StockInfoDetail> _stockInfoDetailRepository; |
| | |
| | | |
| | | private readonly IRepository<Dt_AllocateOrder> _allocateRepository; |
| | | private readonly ILocationInfoService _locationInfoService; |
| | | public StockInfoService(IRepository<Dt_StockInfo> BaseDal, IMapper mapper, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRecordService recordService, ILocationInfoService locationInfoService, IOutboundOrderService outboundOrderService, IRepository<Dt_AllocateOrder> allocateRepository) : base(BaseDal) |
| | | public StockInfoService(IRepository<Dt_StockInfo> BaseDal, IUnitOfWorkManage unitOfWorkManage, IMapper mapper, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRecordService recordService, ILocationInfoService locationInfoService, IOutboundOrderService outboundOrderService, IRepository<Dt_AllocateOrder> allocateRepository) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | | _stockInfoDetailRepository = stockInfoDetailRepository; |
| | |
| | | _locationInfoService = locationInfoService; |
| | | _outboundOrderService = outboundOrderService; |
| | | _allocateRepository = allocateRepository; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | //_outboundOrderDetailService = outboundOrderDetailService; |
| | | } |
| | | |
| | |
| | | return stockInfo; |
| | | } |
| | | |
| | | public override WebResponseContent DeleteData(object[] keys) |
| | | { |
| | | try |
| | | { |
| | | List<int> stockIds = keys.Select(x => x.ObjToInt()).ToList(); |
| | | |
| | | List<Dt_StockInfo> stockInfos = BaseDal.QueryData(x => stockIds.Contains(x.Id) && x.StockStatus == StockStatusEmun.å
¥åºå®æ.ObjToInt()); |
| | | |
| | | List<string> locationCodes = stockInfos.Select(x => x.LocationCode).Distinct().ToList(); |
| | | |
| | | List<Dt_LocationInfo> locationInfos = _locationInfoService.Repository.QueryData(x => locationCodes.Contains(x.LocationCode) && x.LocationStatus == LocationStatusEnum.Pallet.ObjToInt()); |
| | | |
| | | stockInfos = stockInfos.Where(x => locationInfos.Select(l => l.LocationCode).Contains(x.LocationCode)).ToList(); |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | _locationInfoService.UpdateLocationStatus(locationInfos, LocationStatusEnum.Free); |
| | | |
| | | BaseDal.DeleteAndMoveIntoHty(stockInfos, WIDESEA_Core.Enums.OperateTypeEnum.人工å é¤); |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | return WebResponseContent.Instance.OK("å 餿å"); |
| | | } |
| | | catch(Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error("å é¤å¤±è´¥ï¼"+ex.Message); |
| | | } |
| | | } |
| | | public void AddMaterielGroup(Dt_StockInfo stockInfo) |
| | | { |
| | | decimal beforeQuantity = 0; |