| | |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | private async Task<TResponse> PostAsync<TRequest, TResponse>(string url, TRequest request) |
| | |
| | | { |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | private readonly IRepository<Dt_StockInfo> _stockInfoRepository; |
| | | public IRepository<Dt_LocationInfo> Repository => BaseDal; |
| | | public IRepository<Dt_LocationInfo> Repository => BaseDal; |
| | | public readonly IRepository<Dt_LocationType> _locationTypeRepository; |
| | | |
| | | public LocationInfoService(IRepository<Dt_LocationInfo> BaseDal, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_LocationType> locationTypeRepository) : base(BaseDal) |
| | |
| | | /// </summary> |
| | | /// <param name="roadwayNo"></param> |
| | | /// <returns></returns> |
| | | public Dt_LocationInfo? AssignLocation(int locationType) |
| | | { |
| | | if (locationType <= 0) |
| | | { |
| | | throw new ArgumentOutOfRangeException("ä»åºåºåé误ï¼"); |
| | | } |
| | | lock (_locker) |
| | | { |
| | | |
| | | List<LocationCache> removeItems = locationCaches.Where(x => (DateTime.Now - x.DateTime).TotalMinutes > locationCacheTime).ToList(); |
| | | int count = removeItems.Count; |
| | | for (int i = 0; i < count; i++) |
| | | { |
| | | locationCaches.Remove(removeItems[i]); |
| | | } |
| | | |
| | | List<string> lockLocationCodes = locationCaches.Select(x => x.LocationCode).ToList(); |
| | | |
| | | Dictionary<string, OrderByType> orderBy = new Dictionary<string, OrderByType>() |
| | | { |
| | | { nameof(Dt_LocationInfo.RoadwayNo),OrderByType.Asc }, |
| | | { nameof(Dt_LocationInfo.Layer),OrderByType.Asc }, |
| | | { nameof(Dt_LocationInfo.Column),OrderByType.Asc }, |
| | | { nameof(Dt_LocationInfo.Depth),OrderByType.Desc }, |
| | | { nameof(Dt_LocationInfo.Row),OrderByType.Asc } |
| | | }; |
| | | |
| | | var first = BaseDal.QueryFirst(x => x.LocationType == locationType && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.Disable.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode), orderBy);//æ¥è¯¢ç©ºè´§ä½ä¿¡æ¯å¹¶æé¤5åéå
åé
çè´§ä½,æ ¹æ®å±ãåãæ·±åº¦ãè¡æåº |
| | | if (first != null) |
| | | { |
| | | locationCaches.Add(new LocationCache { LocationCode = first?.LocationCode, DateTime = DateTime.Now }); |
| | | } |
| | | |
| | | return first; |
| | | } |
| | | } |
| | | public Dt_LocationInfo? AssignLocation() |
| | | { |
| | | lock (_locker) |
| | |
| | | { nameof(Dt_LocationInfo.Row),OrderByType.Asc } |
| | | }; |
| | | |
| | | var first= BaseDal.QueryFirst(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.Disable.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode), orderBy);//æ¥è¯¢ç©ºè´§ä½ä¿¡æ¯å¹¶æé¤5åéå
åé
çè´§ä½,æ ¹æ®å±ãåãæ·±åº¦ãè¡æåº |
| | | var first = BaseDal.QueryFirst(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.Disable.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode), orderBy);//æ¥è¯¢ç©ºè´§ä½ä¿¡æ¯å¹¶æé¤5åéå
åé
çè´§ä½,æ ¹æ®å±ãåãæ·±åº¦ãè¡æåº |
| | | |
| | | locationCaches.Add(new LocationCache { LocationCode = first.LocationCode, DateTime = DateTime.Now }); |
| | | |
| | | return first; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åå¯åºåºè´§ä½ç¼å· |
| | | /// </summary> |
| | |
| | | /// <returns></returns> |
| | | public List<string> GetCanOutLocationCodes() |
| | | { |
| | | return Repository.QueryData(x => x.LocationCode, x => x.LocationStatus == LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())).Distinct().ToList(); |
| | | return Repository.QueryData(x => x.LocationCode, x => x.LocationStatus == LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())).Distinct().ToList(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | public List<LocationTypeDto> GetLocationTypes() |
| | | { |
| | | return _locationTypeRepository.Db.Queryable<Dt_LocationType>().Select(x=> |
| | | new LocationTypeDto { LocationType=x.LocationType,LocationTypeDesc=x.LocationTypeDesc}).ToList(); |
| | | return _locationTypeRepository.Db.Queryable<Dt_LocationType>().Select(x => |
| | | new LocationTypeDto { LocationType = x.LocationType, LocationTypeDesc = x.LocationTypeDesc }).ToList(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | LocationCode = $"HAI-{row.ToString().PadLeft(3, '0')}-{col.ToString().PadLeft(3, '0')}-{layer.ToString().PadLeft(2, '0')} ", |
| | | LocationName = $"{row.ToString()}è¡{col.ToString()}å{layer.ToString()}å± ", |
| | | |
| | | |
| | | |
| | | RoadwayNo = roadwayNo, |
| | | Row = row, |
| | | Column = col, |
| | |
| | | LocationCode = $"HAI-{r1.ToString().PadLeft(3, '0')}-{col.ToString().PadLeft(3, '0')}-{layer.ToString().PadLeft(2, '0')} ", |
| | | LocationName = $"{r1.ToString()}è¡{col.ToString()}å{layer.ToString()}å± ", |
| | | |
| | | |
| | | |
| | | RoadwayNo = roadwayNo, |
| | | Row = r1, |
| | | Column = col, |
| | |
| | | LocationName = $"{r2.ToString()}è¡{col.ToString()}å{layer.ToString()}å± ", |
| | | |
| | | |
| | | |
| | | |
| | | RoadwayNo = roadwayNo, |
| | | Row = r2, |
| | | Column = col, |
| | |
| | | Row = i + 1, |
| | | Depth = depth, |
| | | }; |
| | | |
| | | locationInfo.LocationCode = $"HAI-{locationInfo.Row.ToString().PadLeft(3, '0')}-{locationInfo.Column.ToString().PadLeft(3, '0')}-{locationInfo.Layer.ToString().PadLeft(2, '0')}"; |
| | | locationInfo.LocationName = $"HAI{locationInfo.RoadwayNo}å··é{locationInfo.Row.ToString().PadLeft(3, '0')}è¡{locationInfo.Column.ToString().PadLeft(3, '0')}å{locationInfo.Layer.ToString().PadLeft(3, '0')}å±"; |
| | | |
| | | locationInfo.LocationCode = $"HAI-{locationInfo.Row.ToString().PadLeft(3, '0')}-{locationInfo.Column.ToString().PadLeft(3, '0')}-{locationInfo.Layer.ToString().PadLeft(2, '0')}"; |
| | | locationInfo.LocationName = $"HAI{locationInfo.RoadwayNo}å··é{locationInfo.Row.ToString().PadLeft(3, '0')}è¡{locationInfo.Column.ToString().PadLeft(3, '0')}å{locationInfo.Layer.ToString().PadLeft(3, '0')}å±"; |
| | | |
| | | |
| | | //locationInfo.LocationCode = $"{locationInfo.RoadwayNo}-{locationInfo.Row.ToString().PadLeft(3, '0')}-{locationInfo.Column.ToString().PadLeft(3, '0')}-{locationInfo.Layer.ToString().PadLeft(3, '0')}-{locationInfo.Depth.ToString().PadLeft(2, '0')}"; |
| | |
| | | } |
| | | } |
| | | } |
| | | // BaseDal.AddData(locationInfos); |
| | | // BaseDal.AddData(locationInfos); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | /// <returns></returns> |
| | | WebResponseContent InitializationLocation(InitializationLocationDTO initializationLocationDTO); |
| | | |
| | | Dt_LocationInfo? AssignLocation(); |
| | | Dt_LocationInfo? AssignLocation(int locationType); |
| | | |
| | | List<string> GetCanOutLocationCodes(); |
| | | |
| | | List<Dt_LocationInfo> GetLocationInfos(List<string> locationCodes); |
| | | |
| | | Dt_LocationInfo? AssignLocation(); |
| | | |
| | | List<LocationTypeDto> GetLocationTypes(); |
| | | |
| | | |
| | |
| | | |
| | | Task<WebResponseContent> TaskCompleted(string taskNum); |
| | | |
| | | |
| | | WebResponseContent GenerateOutboundTasks(int[] keys); |
| | | Task<WebResponseContent> GenerateOutboundTasksAsync(int[] keys); |
| | | } |
| | | } |
| | |
| | | |
| | | if (stockInfo == null) |
| | | { |
| | | stockInfo = new Dt_StockInfo() { PalletType = (int)PalletTypeEnum.None }; |
| | | stockInfo = new Dt_StockInfo() { PalletType = (int)PalletTypeEnum.None,LocationType=materielGroupDTO.locationType.ObjToInt() }; |
| | | stockInfo.Details = new List<Dt_StockInfoDetail>(); |
| | | } |
| | | var warehouseareas = _warehouseAreaRepository.Db.Queryable<Dt_WarehouseArea>().ToList(); |
| | | var warehousearea = warehouseareas.First(x => x.Name == materielGroupDTO.locationTypeDesc.Trim() && x.FactoryArea == inboundOrder.FactoryArea); |
| | | var warehousearea = warehouseareas.FirstOrDefault(x => x.Name == materielGroupDTO.locationTypeDesc && x.FactoryArea == inboundOrder.FactoryArea); |
| | | |
| | | foreach (var item in dbinboundOrderDetails) |
| | | { |
| | |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ä»åºä¸»é®")] |
| | | public int WarehouseId { get; set; } |
| | | |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ä»åºåºå")] |
| | | public int LocationType { get; set; } |
| | | /// <summary> |
| | | /// åºåç¶æ |
| | | /// </summary> |
| | |
| | | return WebResponseContent.Instance.Error($"该æçå·²ç»å®è´§ä½"); |
| | | } |
| | | |
| | | Dt_LocationInfo? locationInfo = _locationInfoService.AssignLocation(); |
| | | Dt_LocationInfo? locationInfo = _locationInfoService.AssignLocation(stockInfo.LocationType); |
| | | if (locationInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"è´§ä½åé
失败,æªæ¾å°å¯åé
è´§ä½"); |
| | |
| | | { |
| | | try |
| | | { |
| | | Dt_StockInfo stockInfo ; |
| | | Dt_StockInfo stockInfo; |
| | | if (string.IsNullOrEmpty(palletCode)) |
| | | { |
| | | stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletType == PalletTypeEnum.Empty.ObjToInt() && !string.IsNullOrWhiteSpace(x.LocationCode)).First(); |
| | | } |
| | | else |
| | | { |
| | | stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode) .First(); |
| | | stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).First(); |
| | | } |
| | | |
| | | if (stockInfo == null) |
| | |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | }; |
| | | var result = await _eSSApiService.CreateTaskAsync(esstask); |
| | | |
| | | _logger.LogInformation("å建任å¡PalletOutboundTask è¿å: " + result); |
| | |
| | | /// <param name="outStockLockInfos"></param> |
| | | /// <param name="locationInfos"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent GenerateOutboundTaskDataUpdate(List<Dt_Task> tasks, List<Dt_StockInfo>? stockInfos = null, List<Dt_OutboundOrderDetail>? outboundOrderDetails = null, List<Dt_OutStockLockInfo>? outStockLockInfos = null, List<Dt_LocationInfo>? locationInfos = null) |
| | | public async Task<WebResponseContent> GenerateOutboundTaskDataUpdateAsync(List<Dt_Task> tasks, List<Dt_StockInfo>? stockInfos = null, List<Dt_OutboundOrderDetail>? outboundOrderDetails = null, List<Dt_OutStockLockInfo>? outStockLockInfos = null, List<Dt_LocationInfo>? locationInfos = null) |
| | | { |
| | | try |
| | | { |
| | |
| | | _outboundOrderDetailService.Repository.UpdateData(outboundOrderDetails); |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | // |
| | | return WebResponseContent.Instance.OK(); |
| | | TaskModel esstask = new TaskModel() |
| | | { |
| | | taskType = "carry", |
| | | taskGroupCode = "", |
| | | groupPriority = 0, |
| | | tasks = new List<TasksType>() |
| | | }; |
| | | |
| | | foreach (var task in tasks) |
| | | { |
| | | esstask. |
| | | tasks.Add(new TasksType |
| | | { |
| | | taskCode = task.TaskNum.ToString(), |
| | | taskPriority = 0, |
| | | taskDescribe = new TaskDescribeType |
| | | { |
| | | containerCode = task.PalletCode, |
| | | containerType = "CT_KUBOT_STANDARD", |
| | | fromLocationCode = task.SourceAddress ?? "", |
| | | toStationCode = "", |
| | | toLocationCode = task.TargetAddress, |
| | | deadline = 0, |
| | | storageTag = "" |
| | | } |
| | | } |
| | | ); |
| | | } |
| | | var result = await _eSSApiService.CreateTaskAsync(esstask); |
| | | |
| | | _logger.LogInformation("å建任å¡PalletOutboundTask è¿å: " + result); |
| | | if (result) |
| | | { |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | else |
| | | { |
| | | return WebResponseContent.Instance.Error("ä¸åæºå¨äººä»»å¡å¤±è´¥ï¼"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | TargetAddress = "", |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | TaskType = taskType.ObjToInt(), |
| | | // TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | // TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | PalletType = stockInfo.PalletType, |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | |
| | |
| | | // task.Quantity = (float)stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).Sum(x => x.StockQuantity); |
| | | // task.BatchNo = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.BatchNo; |
| | | //} |
| | | |
| | | |
| | | tasks.Add(task); |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="keys">åºåºåæç»ä¸»é®</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent GenerateOutboundTasks(int[] keys) |
| | | public async Task<WebResponseContent> GenerateOutboundTasksAsync(int[] keys) |
| | | { |
| | | try |
| | | { |
| | |
| | | tasks.AddRange(result.Item1); |
| | | } |
| | | |
| | | WebResponseContent content = GenerateOutboundTaskDataUpdate(tasks, stockInfos, outboundOrderDetails, outStockLockInfos, locationInfos); |
| | | WebResponseContent content = await GenerateOutboundTaskDataUpdateAsync(tasks, stockInfos, outboundOrderDetails, outStockLockInfos, locationInfos); |
| | | return content; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | } |
| | | |
| | | [HttpPost, Route("TTTTTAssignLocation"), AllowAnonymous, MethodParamsValidate] |
| | | public WebResponseContent TTTTTAssignLocation() |
| | | public WebResponseContent TTTTTAssignLocation(int locationType) |
| | | { |
| | | |
| | | |
| | | |
| | | var sddd = Service.AssignLocation(); |
| | | var sddd = Service.AssignLocation(locationType); |
| | | |
| | | return WebResponseContent.Instance.OK("resdasd", sddd); |
| | | } |
| | |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Attributes; |
| | |
| | | /// <param name="keys"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("GenerateOutboundTasks"), AllowAnonymous] |
| | | public WebResponseContent GenerateOutboundTasks([FromBody] int[] keys) |
| | | public async Task<WebResponseContent> GenerateOutboundTasks([FromBody] int[] keys) |
| | | { |
| | | return Service.GenerateOutboundTasks(keys); |
| | | return await Service.GenerateOutboundTasksAsync(keys); |
| | | } |
| | | |
| | | } |