| | |
| | | using Mapster; |
| | | using Masuit.Tools; |
| | | using Masuit.Tools.Models; |
| | | using Microsoft.EntityFrameworkCore; |
| | | using System.Linq; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_DTO.MOM; |
| | |
| | | using WIDESEA_StorageBasicRepository; |
| | | using WIDESEA_StorageTaskRepository; |
| | | using WIDESEA_StoragIntegrationServices; |
| | | using WIDESEAWCS_BasicInfoRepository; |
| | | |
| | | namespace WIDESEA_StorageOutTaskServices; |
| | | |
| | |
| | | private readonly IDt_AreaInfoRepository _areaInfoRepository; //区域 |
| | | private readonly IAgingInOrOutInputService _agingInOrOutInputService; //静置\陈化 |
| | | private readonly IProductionRepository _productionRepository; //生产 |
| | | private readonly IDt_StationManagerRepository _stationManagerRepository; |
| | | |
| | | public Dt_TaskService(IDt_TaskRepository BaseDal, |
| | | IUnitOfWorkManage unitOfWorkManage, |
| | |
| | | IDt_AreaInfoRepository areaInfoRepository, |
| | | IAgingInOrOutInputService agingInOrOutInputService, |
| | | IStockInfoDetailRepository stockInfoDetailRepository, |
| | | IProductionRepository productionRepository) : base(BaseDal) |
| | | IProductionRepository productionRepository, |
| | | IDt_StationManagerRepository stationManagerRepository) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _outOrderRepository = outOrderRepository; |
| | |
| | | _agingInOrOutInputService = agingInOrOutInputService; |
| | | _stockInfoDetailRepository = stockInfoDetailRepository; |
| | | _productionRepository = productionRepository; |
| | | _stationManagerRepository = stationManagerRepository; |
| | | } |
| | | |
| | | #region 外部接口方法 |
| | |
| | | //var process = await SqlSugarHelper.Db.Queryable<Dt_EquipmentProcess>() |
| | | // .FirstAsync(x => x.EquipmentName == task.Roadway); |
| | | //var info = JsonConvert.DeserializeObject<ResponseEqptRunDto>(process.ProcessValue); |
| | | |
| | | var agingOutputDto = MapToAgingOutputDto(stock); |
| | | content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto); |
| | | ValidateResponse(content); |
| | | if (!task.Roadway.Contains("FR")) //非分容库区均上报MOM出入站 |
| | | { |
| | | var agingOutputDto = MapToAgingOutputDto(stock); |
| | | content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto); |
| | | ValidateResponse(content); |
| | | } |
| | | } |
| | | |
| | | // 更新库存状态和任务状态 |
| | |
| | | } |
| | | LogFactory.GetLog("任务完成").InfoFormat(true, "验证任务是否存在", JsonConvert.SerializeObject(task)); |
| | | |
| | | if(task.TaskType == (int)TaskOutboundTypeEnum.InToOut) |
| | | { |
| | | return await CompleteInToOutTaskAsync(task); |
| | | } |
| | | |
| | | // 验证库存是否存在 |
| | | var stock = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == task.PalletCode); |
| | | |
| | |
| | | if (serialNosError.Count > 0) |
| | | { |
| | | // TODO 创建任务送至NG排出口 |
| | | List<string> NGStation = input.Position == "1088" ? new List<string>() { "1020" } : new List<string>() { "JZSC01" }; |
| | | var efg = _stationManagerRepository.QueryData(x => x.stationType == 1 && x.stationChildCode == input.Position && x.stationArea == area.AreaCode).ToList(); |
| | | //List<string> NGStation = input.Position == "1088" ? new List<string>() { "1020" } : new List<string>() { "JZSC01" }; |
| | | if(efg.Count <= 0) |
| | | { |
| | | throw new Exception("未找到NG入库站台配置"); |
| | | } |
| | | List<string> NGStation = efg.Select(x => x.stationNGLocation).ToList(); |
| | | if (NGStation.Count <= 0) |
| | | { |
| | | NGStation = efg.Select(x => x.stationNGChildCode).ToList(); |
| | | } |
| | | content = await CreateNewTask(input, NGStation, 2); |
| | | return content.Error("存在异常电芯"); |
| | | } |
| | |
| | | //// 调用GetProcessResponseAsync方法,获取工艺响应 |
| | | //var processResponse = await GetProcessResponseAsync(process, input.Position); |
| | | |
| | | List<string> strings = input.Position == "1088" ? new List<string>() { "CHSC01" } : new List<string>() { "JZSC01" }; |
| | | //List<string> strings = input.Position == "1088" ? new List<string>() { "CHSC01" } : new List<string>() { "JZSC01" }; |
| | | var stationManagers = _stationManagerRepository.QueryData(x => x.stationType == 1 && x.stationChildCode == input.Position && x.stationArea == area.AreaCode).ToList(); |
| | | if (stationManagers.Count <= 0) |
| | | { |
| | | throw new Exception("未找到NG入库站台配置"); |
| | | } |
| | | List<string> strings = stationManagers.Select(x=>x.Roadway).ToList(); |
| | | // 调用CreateNewTask方法,创建新任务 |
| | | content = await CreateNewTask(input, strings); |
| | | if (content.Status) |
| | |
| | | return content.OK(data: task); |
| | | } |
| | | |
| | | var stationManagers = _stationManagerRepository.QueryData(x => x.stationType == 1 && x.stationChildCode == input.Position).ToList(); |
| | | if (stationManagers.Count <= 0) |
| | | { |
| | | throw new Exception("未找到空托盘入库站台配置"); |
| | | } |
| | | |
| | | |
| | | // 获取目标地址 |
| | | List<string> strings = input.Position == "1016" ? new List<string>() { "CHSC01" } : new List<string>() { "JZSC01" }; |
| | | List<string> strings = stationManagers.Select(x => x.Roadway).ToList(); |
| | | |
| | | return await CreateNewTask(input, strings, 1); |
| | | } |