| | |
| | | /// </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) |
| | |
| | | return first; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åå¯åºåºè´§ä½ç¼å· |
| | | /// </summary> |
| | |
| | | /// <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($"è´§ä½åé
失败,æªæ¾å°å¯åé
è´§ä½"); |
| | |
| | | /// <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(); |
| | | // |
| | | 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> |
| | |
| | | /// </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); |
| | | } |
| | | |
| | | } |