| | |
| | | using AngleSharp.Dom; |
| | | using log4net.Core; |
| | | using Mapster; |
| | | using Masuit.Tools; |
| | | using SixLabors.Fonts.Tables.AdvancedTypographic; |
| | |
| | | using WIDESEA_DTO.WMS; |
| | | using WIDESEA_IServices; |
| | | using WIDESEA_IStoragIntegrationServices; |
| | | using WIDESEA_StorageBasicRepository; |
| | | using WIDESEA_StoragIntegrationServices; |
| | | using WIDESEAWCS_BasicInfoRepository; |
| | | |
| | |
| | | var agingOutputDto = MapToAgingOutputDto(stock); |
| | | content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto); |
| | | |
| | | var result = JsonConvert.DeserializeObject<BasicResult>(content.Data.ToString()); |
| | | task.Remark = result.Success ? null : "NG"; |
| | | |
| | | if (!result.Success && result.MessageCode == "E10001") |
| | | if (content.Status) |
| | | { |
| | | await HandleOutBoundError(stock, task); |
| | | var result = JsonConvert.DeserializeObject<BasicResult>(content.Data.ToString()); |
| | | task.Remark = result.Success ? null : "NG"; |
| | | |
| | | if (!result.Success && result.MessageCode == "E10001") |
| | | { |
| | | await HandleOutBoundError(stock, task); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | task.Remark = "NG"; |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | var location = _locationRepository.QueryFirst(x => x.LocationCode == task.SourceAddress && x.RoadwayNo == task.Roadway); |
| | | //var details = _stockInfoDetailRepository.QueryData(x => x.StockId == stock.Id); |
| | | |
| | | int lastStatus = location.LocationStatus; |
| | | location.LocationStatus = (int)LocationEnum.Free; |
| | | task.TaskState = (int)TaskOutStatusEnum.OutFinish; |
| | | //task.CurrentAddress = task.NextAddress; |
| | | //task.NextAddress = task.TargetAddress; |
| | | |
| | | _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(location, lastStatus, (int)StatusChangeTypeEnum.AutomaticDelivery, task.TaskNum); |
| | | |
| | | LogFactory.GetLog("任务完成").Info(true, "更新库存状态与任务状态"); |
| | | return (location, task); |
| | |
| | | var boxing = await _boxingInfoRepository.QueryFirstNavAsync(x => x.PalletCode == task.PalletCode); |
| | | var locationInf = await _locationRepository.QueryFirstAsync(x => x.LocationCode == task.TargetAddress && x.RoadwayNo == task.Roadway); |
| | | |
| | | int lastStatus = locationInf.LocationStatus; |
| | | // 更新目标位置状态为库存中 |
| | | locationInf.LocationStatus = (int)LocationEnum.InStock; |
| | | |
| | |
| | | await _locationRepository.UpdateDataAsync(locationInf); |
| | | await _task_HtyRepository.AddDataAsync(taskHty); |
| | | await BaseDal.DeleteDataAsync(task); |
| | | |
| | | //记录货位变动信息 |
| | | _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(locationInf, lastStatus, (int)StatusChangeTypeEnum.AutomaticStorage, task.TaskNum); |
| | | |
| | | return content.OK("入库任务完成成功"); |
| | | } |
| | | // 根据是否有组盘信息创建库存实例模型 |
| | |
| | | bool isResult = await ExecuteTransaction(stock, taskHty, locationInf, task.TaskId, boxing); |
| | | if (isResult) |
| | | { |
| | | _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(locationInf, lastStatus, (int)StatusChangeTypeEnum.AutomaticStorage, task.TaskNum); |
| | | content.OK("入库任务完成成功"); |
| | | } |
| | | else |
| | |
| | | // 创建并获取整盘电芯状态 |
| | | TrayCellsStatusDto trayCells = CreateTrayCellsStatusDto(area, input.PalletCode); |
| | | content = await GetTrayCellStatusAsync(trayCells); |
| | | if (!content.Status) return content; |
| | | if (!content.Status) |
| | | { |
| | | ConsoleHelper.WriteErrorLine($"获取电芯状态失败:{content.Message}"); |
| | | return content; |
| | | } |
| | | |
| | | var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString()); |
| | | |
| | | if (!result.Success) |
| | | { |
| | | ConsoleHelper.WriteErrorLine($"获取电芯状态失败:{result.MOMMessage}"); |
| | | if (result.SerialNos.Count <= 0) |
| | | { |
| | | // 空托盘入库逻辑 |
| | |
| | | return content.Error(result.MOMMessage); |
| | | } |
| | | |
| | | // 处理异常电芯情况 |
| | | var serialNosError = result.SerialNos.Where(x => x.SerialNoStatus != 1).ToList(); |
| | | if (serialNosError.Count > 0) |
| | | |
| | | if (result.SerialNos.Count <= 0) |
| | | { |
| | | return await HandleErrorCells(input, area, serialNosError); |
| | | return await RequestTrayInTaskAsync(input); |
| | | } |
| | | else |
| | | { |
| | | |
| | | var boxing = CreateBoxingInfo(result, input.PalletCode); |
| | | if (boxing == null) return content.Error("组盘失败"); |
| | | |
| | | return await ProcessBasedOnProcessCode(boxing, area, input, result); |
| | | // 处理异常电芯情况 |
| | | var serialNosError = result.SerialNos.Where(x => x.SerialNoStatus != 1 && x.SerialNoStatus != 4).ToList(); |
| | | if (serialNosError.Count > 0) |
| | | { |
| | | return await HandleErrorCells(input, area, serialNosError); |
| | | } |
| | | |
| | | var boxing = CreateBoxingInfo(result, input.PalletCode); |
| | | if (boxing == null) return content.Error("组盘失败"); |
| | | |
| | | return await ProcessBasedOnProcessCode(boxing, area, input, result); |
| | | } |
| | | } |
| | | catch (Exception err) |
| | | { |