| | |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_DTO.ERP; |
| | | using WIDESEA_DTO.Location; |
| | | using WIDESEA_DTO.Stock; |
| | | using WIDESEA_DTO.WMS; |
| | | using WIDESEA_IOrderRepository; |
| | | using WIDESEA_IServices; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Model.Models.Basic; |
| | |
| | | private readonly IDt_AreaInfoRepository _areaInfoRepository; //åºå |
| | | private readonly IDt_StationManagerRepository _stationManagerRepository; |
| | | private readonly ISys_ConfigService _configService; |
| | | private readonly IDt_OutboundOrderRepository _outorderRepository; |
| | | private readonly IDt_OutboundOrderDetailRepository _outorderdetailRepository; |
| | | |
| | | public Dt_TaskService(IDt_TaskRepository BaseDal, |
| | | IUnitOfWorkManage unitOfWorkManage, |
| | |
| | | IDt_AreaInfoRepository areaInfoRepository, |
| | | IStockInfoDetailRepository stockInfoDetailRepository, |
| | | IDt_StationManagerRepository stationManagerRepository, |
| | | ISys_ConfigService configService) : base(BaseDal) |
| | | ISys_ConfigService configService, |
| | | IDt_OutboundOrderRepository outorderRepository, |
| | | IDt_OutboundOrderDetailRepository outorderdetailRepository) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _stockInfoRepository = stockInfoRepository; |
| | |
| | | _stockInfoDetailRepository = stockInfoDetailRepository; |
| | | _stationManagerRepository = stationManagerRepository; |
| | | _configService = configService; |
| | | _outorderRepository = outorderRepository; |
| | | _outorderdetailRepository = outorderdetailRepository; |
| | | } |
| | | |
| | | #region å¤é¨æ¥å£æ¹æ³ |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var boxing = await _boxingInfoRepository.QueryFirstNavAsync(x => x.PalletCode == task.PalletCode); |
| | | var stock = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == task.PalletCode && x.StockStatus == (int)StockStateEmun.ç»çæå); |
| | | var locationStart = await _locationRepository.QueryFirstAsync(x => x.LocationCode == task.SourceAddress); |
| | | var locationEnd = await _locationRepository.QueryFirstAsync(x => x.LocationCode == task.TargetAddress); |
| | | |
| | | if (boxing == null) |
| | | if (stock == null) |
| | | { |
| | | return content.Error("æªæ¾å°ç»çæ°æ®"); |
| | | } |
| | | |
| | | DtStockInfo stock = CreatePalletStock(task, boxing); |
| | | DtBoxingInfo_Hty boxingInfo_Hty = boxing.Adapt<DtBoxingInfo_Hty>(); |
| | | boxingInfo_Hty.ModifyDate = DateTime.Now; |
| | | stock.LocationCode = task.TargetAddress; |
| | | stock.StockStatus = (int)StockStateEmun.å·²å
¥åº; |
| | | |
| | | task.TaskState = (int)TaskInStatusEnum.InFinish; |
| | | var taskHty = task.Adapt<Dt_Task_Hty>(); |
| | |
| | | |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | await _stockInfoRepository.AddDataNavAsync(stock); |
| | | await _stockInfoRepository.UpdateDataAsync(stock); |
| | | await DeleteTaskAsync(task.TaskId); |
| | | await AddTaskHtyAsync(taskHty); |
| | | await _boxingInfoRepository.Db.DeleteNav<DtBoxingInfo>(x => x.Id == boxing.Id) |
| | | .Include(x => x.BoxingInfoDetails) |
| | | .ExecuteCommandAsync(); |
| | | UpdateLocationStatus(locationStart, LocationEnum.Free, task.TaskNum.Value, (int)StatusChangeTypeEnum.AutomaticInbound); |
| | | UpdateLocationStatus(locationEnd, LocationEnum.InStock, task.TaskNum.Value, (int)StatusChangeTypeEnum.AutomaticInbound); |
| | | await AddBoxingHtyAsync(boxingInfo_Hty); |
| | | }); |
| | | content.OK("å
¥åºå®æ"); |
| | | } |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var boxingInfo = await _boxingInfoRepository.QueryFirstNavAsync(x => x.PalletCode == taskDto.PalletCode); |
| | | if (boxingInfo == null) |
| | | var stock = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == taskDto.PalletCode && x.StockStatus == (int)StockStateEmun.ç»çæå); |
| | | if (stock == null) |
| | | { |
| | | return content.Error("æçä¿¡æ¯ä¸åå¨ï¼è¯·ç¡®è®¤æçå·²ç»çæå"); |
| | | } |
| | |
| | | switch (taskDto.AreaId) |
| | | { |
| | | case 1: |
| | | return await InboundStakerArea(taskDto, StartAddress, await GetEmptyLocation("SC1")); |
| | | return await InboundStakerArea(taskDto, StartAddress); |
| | | case 2: |
| | | case 3: |
| | | case 4: |
| | |
| | | switch (location.AreaId) |
| | | { |
| | | case 1: |
| | | return await InboundStakerArea(taskDto, StartAddress, location); |
| | | return await InboundStakerArea(taskDto, StartAddress); |
| | | case 2: |
| | | case 3: |
| | | case 4: |
| | |
| | | } |
| | | } |
| | | |
| | | public async Task<WebResponseContent> InboundStakerArea(RequestTaskDto taskDto,DtLocationInfo StartAddress, DtLocationInfo location) |
| | | public async Task<WebResponseContent> InboundStakerArea(RequestTaskDto taskDto,DtLocationInfo StartAddress) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.Roadway == "SC1"); |
| | | |
| | | if (location == null) |
| | | { |
| | | return content.Error("ç»ç¹åºåæªæ¾å°ç©ºé²åºä½"); |
| | | } |
| | | Dt_Task taskNew = new Dt_Task |
| | | { |
| | | Grade = 1, |
| | | Roadway = "SC1", |
| | | TargetAddress = location.LocationCode, |
| | | TargetAddress = "SC1", |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | | NextAddress = station.stationChildCode, |
| | |
| | | BaseDal.AddData(taskNew); |
| | | |
| | | UpdateLocationStatus(StartAddress, LocationEnum.InStockDisable, taskNew.TaskNum.Value, (int)StatusChangeTypeEnum.AutomaticInbound); |
| | | UpdateLocationStatus(location, LocationEnum.Lock, taskNew.TaskNum.Value, (int)StatusChangeTypeEnum.AutomaticInbound); |
| | | //UpdateLocationStatus(location, LocationEnum.Lock, taskNew.TaskNum.Value, (int)StatusChangeTypeEnum.AutomaticInbound); |
| | | |
| | | |
| | | |
| | | //return content.OK(); |
| | | return content = await SendWCSTask(taskDTO); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | private DtStockInfo CreatePalletStock(Dt_Task task, DtBoxingInfo boxing) |
| | | { |
| | | var loation = _locationRepository.QueryFirst(x => x.RoadwayNo == task.Roadway && x.LocationCode == task.TargetAddress); |
| | | if (loation == null) |
| | | throw new Exception("æªæ¾å°å¯¹åºä½ç½®ä¿¡æ¯"); |
| | | |
| | | |
| | | var boxDetail = boxing.BoxingInfoDetails.Adapt<List<DtStockInfoDetail>>(); |
| | | boxDetail.ForEach(x => { x.Status = (int)StockStateEmun.å·²å
¥åº; }); |
| | | var stock = new DtStockInfo() |
| | | { |
| | | PalletCode = task.PalletCode, |
| | | LocationCode = task.TargetAddress, |
| | | CreateDate = DateTime.Now, |
| | | Creater = "system", |
| | | IsFull = boxing.IsFull, |
| | | StockInfoDetails = boxDetail, |
| | | }; |
| | | |
| | | stock.StockStatus = 1; |
| | | |
| | | return stock; |
| | | } |
| | | |
| | | #endregion ä»»å¡è¯·æ±æ¹æ³ |
| | | |