| | |
| | | [ExporterHeader(DisplayName = "站台状态")] |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "站台状态")] |
| | | public string Status { get; set; } = "Active"; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 生产产线 |
| | | /// </summary> |
| | | [ImporterHeader(Name = "生产产线")] |
| | | [ExporterHeader(DisplayName = "生产产线")] |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "生产产线")] |
| | | public string ProductionLine { get; set; } |
| | | |
| | | } |
| | | } |
| | |
| | | taskOutboundTypeEnum = TaskOutboundTypeEnum.OutTray; |
| | | else |
| | | taskOutboundTypeEnum = TaskOutboundTypeEnum.Outbound; |
| | | await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform.Stacker); |
| | | await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform.Stacker, platform); |
| | | } |
| | | catch (Exception) |
| | | { |
| | |
| | | /// <summary> |
| | | /// 检查任务并创建新任务 |
| | | /// </summary> |
| | | private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, string roadWay, List<string> roadways = null) |
| | | private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, string roadWay, Platform platform) |
| | | { |
| | | var tasks = _taskRepository.QueryData(x => x.TaskType == (int)taskType && x.TargetAddress == childDeviceCode); |
| | | if (tasks.Count < index) |
| | |
| | | var wmsIpAddress = wmsBase + requestTrayOutTask; |
| | | |
| | | |
| | | var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = roadWay, roadways = roadways }.ToJsonString()); |
| | | var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = roadWay, platform.ProductionLine }.ToJsonString()); |
| | | //var result = await HttpHelper.PostAsync("http://localhost:5000/api/Task/RequestTrayOutTaskAsync", dynamic.ToJsonString()); |
| | | |
| | | WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result); |
| | |
| | | public string Position { get; set; } |
| | | public int Tag { get; set; } |
| | | public string AreaCdoe { get; set; } |
| | | public List<string> Roadways { get; set; } |
| | | public string ProductionLine { get; set; } |
| | | } |
| | |
| | | /// <param name="areaCode">区域编码</param> |
| | | /// <param name="roadways">巷道列表</param> |
| | | /// <returns>返回结果集</returns> |
| | | Task<WebResponseContent> RequestTrayOutTaskAsync(string position, int tag, string areaCode, List<string> roadways); |
| | | Task<WebResponseContent> RequestTrayOutTaskAsync(string position, int tag, string areaCode, string productionLine); |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="areaCode">区域编码</param> |
| | | /// <param name="roadways">巷道编码集合</param> |
| | | /// <returns>返回结果集</returns> |
| | | public async Task<WebResponseContent> RequestTrayOutTaskAsync(string position, int tag, string areaCode, List<string> roadways) |
| | | public async Task<WebResponseContent> RequestTrayOutTaskAsync(string position, int tag, string areaCode, string productionLine) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | // 根据托盘类型查询库存信息 |
| | | DtStockInfo stockInfo = tag == (int)TaskOutboundTypeEnum.Outbound |
| | | ? QueryStockInfoForRealTrayAsync(areaCode, roadways).Result |
| | | : QueryStockInfoForEmptyTrayAsync(areaCode, roadways).Result; |
| | | ? QueryStockInfoForRealTrayAsync(areaCode, productionLine).Result |
| | | : QueryStockInfoForEmptyTrayAsync(areaCode).Result; |
| | | |
| | | if (stockInfo == null) |
| | | { |
| | |
| | | /// <summary> |
| | | /// 查询实盘库存信息 |
| | | /// </summary> |
| | | private async Task<DtStockInfo> QueryStockInfoForRealTrayAsync(string areaCode, List<string> roadways) |
| | | private async Task<DtStockInfo> QueryStockInfoForRealTrayAsync(string areaCode, string productionLine) |
| | | { |
| | | var area = await _areaInfoRepository.QueryFirstAsync(x => x.AreaCode == areaCode); |
| | | |
| | |
| | | .Includes(x => x.LocationInfo) // 预加载LocationInfo |
| | | .Includes(x => x.StockInfoDetails) // 预加载StockInfoDetails |
| | | .Where(x => x.AreaCode == areaCode && x.OutboundTime < DateTime.Now && x.IsFull == true) // 过滤条件 |
| | | .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine) |
| | | .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID) // 过滤条件 |
| | | .OrderBy(x => x.OutboundTime) // 排序 |
| | | .FirstAsync(); // 获取第一个元素 |
| | |
| | | /// <summary> |
| | | /// 查询空盘库存信息 |
| | | /// </summary> |
| | | private async Task<DtStockInfo> QueryStockInfoForEmptyTrayAsync(string areaCode, List<string> roadways) |
| | | private async Task<DtStockInfo> QueryStockInfoForEmptyTrayAsync(string areaCode) |
| | | { |
| | | var area = await _areaInfoRepository.QueryFirstAsync(x => x.AreaCode == areaCode); |
| | | |
| | |
| | | |
| | | var location = locations.OrderBy(x => x.Layer).ThenBy(x => x.Column).ThenBy(x => x.Row).FirstOrDefault(); |
| | | |
| | | var stockInfo = await QueryStockInfoForEmptyTrayAsync("CWSC1", new List<string>()); |
| | | var stockInfo = await QueryStockInfoForEmptyTrayAsync("CWSC1"); |
| | | |
| | | if (stockInfo != null) |
| | | { |
| | |
| | | [HttpPost, AllowAnonymous, Route("RequestTrayOutTaskAsync")] |
| | | public async Task<WebResponseContent> RequestTrayOutTaskAsync([FromBody] RequestOutTaskDto request) |
| | | { |
| | | return await Service.RequestTrayOutTaskAsync(request.Position, request.Tag, request.AreaCdoe, request.Roadways); |
| | | return await Service.RequestTrayOutTaskAsync(request.Position, request.Tag, request.AreaCdoe, request.ProductionLine); |
| | | } |
| | | |
| | | /// <summary> |