| | |
| | | string returnOrderNo = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.OrderNo; |
| | | Dt_ReturnOrder returnOrder = _returnOrderRepository.QueryFirst(x => x.OrderNo == returnOrderNo && x.OrderStatus == InOrderStatusEnum.未开始.ObjToInt()); |
| | | Dt_RoadwayInfo returnRoadwayInfo = new Dt_RoadwayInfo(); |
| | | if(returnOrder != null && !string.IsNullOrEmpty(returnOrder.LocationCode)) |
| | | if (returnOrder != null && !string.IsNullOrEmpty(returnOrder.LocationCode)) |
| | | { |
| | | Dt_LocationInfo locationInfo1 = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == returnOrder.LocationCode); |
| | | if(locationInfo1 == null) |
| | | if (locationInfo1 == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"回库单中该库位{returnOrder.LocationCode}未找到"); |
| | | } |
| | | returnRoadwayInfo = _basicRepository.RoadwayInfoRepository.QueryFirst(x => x.RoadwayNo == locationInfo1.RoadwayNo); |
| | | } |
| | | |
| | | if (Repository.QueryFirst(x => x.SourceAddress == (returnRoadwayInfo.InStationCode != null ? returnRoadwayInfo.InStationCode:stationCode) && x.TaskStatus == TaskStatusEnum.New.ObjToInt()) != null) |
| | | if (Repository.QueryFirst(x => x.SourceAddress == (returnRoadwayInfo.InStationCode != null ? returnRoadwayInfo.InStationCode : stationCode) && x.TaskStatus == TaskStatusEnum.New.ObjToInt()) != null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该站点已有未执行的任务"); |
| | | } |
| | | |
| | | |
| | | var details = stockInfo.Details.FirstOrDefault(); |
| | | if (!string.IsNullOrEmpty(stockInfo.LocationCode)) |
| | | { |
| | |
| | | newTask.MaterielCode = MaterielCode; |
| | | newTask.Quantity = (float)Quantity; |
| | | } |
| | | if(stockInfo.StockStatus == StockStatusEmun.余料退库.ObjToInt()) |
| | | if (stockInfo.StockStatus == StockStatusEmun.余料退库.ObjToInt()) |
| | | { |
| | | newTask.TaskType = TaskTypeEnum.SurplusReturn.ObjToInt(); |
| | | } |
| | | if(stockInfo.StockStatus == StockStatusEmun.反拣入库.ObjToInt()) |
| | | if (stockInfo.StockStatus == StockStatusEmun.反拣入库.ObjToInt()) |
| | | { |
| | | newTask.TaskType = TaskTypeEnum.ReverseIn.ObjToInt(); |
| | | } |
| | | if(stockInfo.StockStatus == StockStatusEmun.盘点库存完成.ObjToInt()) |
| | | if (stockInfo.StockStatus == StockStatusEmun.盘点库存完成.ObjToInt()) |
| | | { |
| | | newTask.TaskType = TaskTypeEnum.InInventory.ObjToInt(); |
| | | } |
| | |
| | | } |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | | _locationInfoService.UpdateData(locationInfo); |
| | | |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | WMSTaskDTO wMSTaskDTO = _mapper.Map<WMSTaskDTO>(newTask); |
| | | |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 返回入库仓库 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent ApplyLocation(string palletCode) |
| | | { |
| | | try |
| | | { |
| | | Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).Includes(x => x.Details).First(); |
| | | |
| | | if (stockInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"未找到组盘信息"); |
| | | } |
| | | return WebResponseContent.Instance.OK(data:stockInfo.WarehouseId); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 入库任务申请分配货位 |
| | | /// </summary> |