| | |
| | | using Mapster; |
| | | using Masuit.Tools; |
| | | using SixLabors.Fonts.Tables.AdvancedTypographic; |
| | | using SqlSugar; |
| | | using System.Text.RegularExpressions; |
| | | using System.Threading.Tasks; |
| | |
| | | { |
| | | if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound) |
| | | { |
| | | if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound) |
| | | //if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound) |
| | | //{ |
| | | if (!task.Roadway.Contains("FR") && stock.ProcessCode != "OCVB") |
| | | { |
| | | if (!task.Roadway.Contains("FR") && stock.ProcessCode != "OCVB") |
| | | var agingOutputDto = MapToAgingOutputDto(stock); |
| | | content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto); |
| | | |
| | | if (content.Status) |
| | | { |
| | | var agingOutputDto = MapToAgingOutputDto(stock); |
| | | content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto); |
| | | var result = JsonConvert.DeserializeObject<BasicResult>(content.Data.ToString()); |
| | | |
| | | if (content.Status) |
| | | if (!result.Success && result.MessageCode == "E10001") |
| | | { |
| | | var result = JsonConvert.DeserializeObject<BasicResult>(content.Data.ToString()); |
| | | |
| | | if (!result.Success && result.MessageCode == "E10001") |
| | | { |
| | | await HandleOutBoundError(stock, task); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | task.Remark = "NG"; |
| | | ConsoleHelper.WriteErrorLine("MOM通报点芯NG"); |
| | | return content.Error("MOM通报点芯NG"); |
| | | await HandleOutBoundError(stock, task); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | task.Remark = "NG"; |
| | | ConsoleHelper.WriteErrorLine("MOM通报点芯NG"); |
| | | return content.Error("MOM通报点芯NG"); |
| | | } |
| | | } |
| | | //} |
| | | } |
| | | |
| | | if (task.Remark == "NG") |
| | |
| | | Console.WriteLine(err.Message.ToString()); |
| | | LogFactory.GetLog("任务完成").Error(true, err); |
| | | content.Error(err.Message); |
| | | task.ErrorMessage= err.Message; |
| | | task.TaskState=(int)TaskInStatusEnum.SC_InExecuting; |
| | | task.ErrorMessage = err.Message; |
| | | task.TaskState = (int)TaskInStatusEnum.SC_InExecuting; |
| | | await BaseDal.Update(task); |
| | | } |
| | | return 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 (task.TaskType == (int)TaskOutboundTypeEnum.InToOut) |
| | | { |
| | | return await CompleteInToOutTaskAsync(task, stock); |
| | | } |
| | | // 根据任务类型调用相应的完成任务方法 |
| | | switch (task.TaskType) |
| | | { |
| | |
| | | case (int)TaskOutboundTypeEnum.OutTray: |
| | | case (int)TaskOutboundTypeEnum.Outbound: |
| | | case (int)TaskOutboundTypeEnum.OutNG: |
| | | |
| | | |
| | | LogFactory.GetLog("任务完成").InfoFormat(true, "出库任务", ""); |
| | | return await CompleteStackTaskAsync(task, stock); |
| | | |
| | |
| | | |
| | | case (int)TaskRelocationTypeEnum.Relocation: |
| | | return await CompleteTransferTaskAsync(task, stock); |
| | | |
| | | default: |
| | | return content.Error("任务类型不存在"); |
| | | } |
| | |
| | | var stock = await QueryStockInfo(input.PalletCode); |
| | | if (stock != null) |
| | | { |
| | | List<string> strings = new List<string>() { "GW", "CW", "FR" }; |
| | | if (stock.AreaCode.Contains(strings)) |
| | | { |
| | | return content.Error($"托盘【{stock.PalletCode}】存在库存不允许入库"); |
| | | } |
| | | Dt_Task taskNew = new Dt_Task |
| | | { |
| | | Grade = 1, |
| | |
| | | // 更详细的异常处理,可以根据异常类型记录不同的错误日志等 |
| | | content.Error(err.Message); |
| | | Console.WriteLine(err.Message); |
| | | LogFactory.GetLog($"请求入库异常").Info(true, $"异常信息【{err.Message}】异常行【{err.StackTrace}】"); |
| | | } |
| | | |
| | | return content; |
| | |
| | | var configOne = _configService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStacker, SysConfigConst.CHInboundEmptyProductLineOne); |
| | | var configTwo = _configService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStacker, SysConfigConst.CHInboundEmptyProductLineTwo); |
| | | |
| | | List<string> productLineconfigOne = configOne.ConfigValue.Split(',').ToList(); |
| | | List<string> productLineconfigTwo = configTwo.ConfigValue.Split(',').ToList(); |
| | | List<string> productLineconfigOne = configOne.ConfigValue.Split(',').ToList(); |
| | | List<string> productLineconfigTwo = configTwo.ConfigValue.Split(',').ToList(); |
| | | |
| | | if (productLineconfigOne.Count == 0 && productLineconfigTwo.Count() == 0) |
| | | { |
| | |
| | | { |
| | | ConsoleHelper.WriteErrorLine($"未找到{result.ProductionLine}对应配置巷道"); |
| | | return content.Error($"未找到{result.ProductionLine}对应配置巷道"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | strings = stationManagers.Roadway.Split(',').ToList(); |
| | | } |
| | | |
| | | |
| | | |
| | | return await CreateNewTask(input, result.ProductionLine, result.ProcessCode, strings, 1); |
| | | } |
| | |
| | | |
| | | // 获取组盘信息 |
| | | private DtBoxingInfo CreateBoxingInfo(ResultTrayCellsStatus result, string palletCode) |
| | | { |
| | | var boxing=_boxingInfoRepository.QueryFirst(x=>x.PalletCode == palletCode); |
| | | { |
| | | var boxing = _boxingInfoRepository.QueryFirst(x => x.PalletCode == palletCode); |
| | | if (boxing == null) |
| | | { |
| | | return new DtBoxingInfo |
| | |
| | | }).ToList() |
| | | }; |
| | | } |
| | | else { |
| | | else |
| | | { |
| | | _boxingInfoRepository.DeleteData(boxing); |
| | | return new DtBoxingInfo |
| | | { |
| | |
| | | }).ToList() |
| | | }; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | // 获取工艺申请 |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | // 记录异常信息并抛出 |
| | | LogFactory.GetLog($"{position}请求{productionLine}任务").Info(true, $"{position}-{tag}-{areaCode}-{JsonConvert.SerializeObject(areaCodes)}-{productionLine}"); |
| | | // 根据托盘类型查询库存信息 |
| | | DtStockInfo stockInfo = tag == (int)TaskOutboundTypeEnum.Outbound |
| | | ? areaCode != "CWSC1" ? await QueryStockInfoForRealTrayAsync(areaCode, areaCodes, productionLine) : await QueryStockInfoForRealTrayCWAsync(areaCodes, productionLine) |
| | |
| | | if (stockInfo.AreaCode.Contains("CH")) |
| | | { |
| | | // 创建并添加任务到数据库 |
| | | if(stockInfo.LocationInfo.RoadwayNo=="CHSC1"|| stockInfo.LocationInfo.RoadwayNo == "CHSC2"|| stockInfo.LocationInfo.RoadwayNo == "CHSC3") |
| | | if (stockInfo.LocationInfo.RoadwayNo == "CHSC1" || stockInfo.LocationInfo.RoadwayNo == "CHSC2" || stockInfo.LocationInfo.RoadwayNo == "CHSC3") |
| | | { |
| | | task = CreateTask(stockInfo, "1020-1", taskType); |
| | | } |
| | |
| | | { |
| | | task = CreateTask(stockInfo, "1049-8", taskType); |
| | | } |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | // 创建历史任务实例模型 |
| | | try |
| | | { |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskId == Convert.ToInt32(key[0])); |
| | | if (task == null) |
| | | foreach (var item in key) |
| | | { |
| | | return content.Error("未找到任务信息!"); |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskId == Convert.ToInt32(key)); |
| | | if (task == null) |
| | | { |
| | | return content.Error("未找到任务信息!"); |
| | | } |
| | | var taskHtyNG = CreateHistoricalTask(task, true); |
| | | // 添加历史任务 |
| | | var isTaskHtyAdd = _task_HtyRepository.AddData(taskHtyNG) > 0; |
| | | |
| | | // 删除任务数据 |
| | | var isTaskDelete = BaseDal.Delete(task.TaskId); |
| | | } |
| | | var taskHtyNG = CreateHistoricalTask(task, true); |
| | | |
| | | // 执行数据库事务 |
| | | |
| | | // 添加历史任务 |
| | | var isTaskHtyAdd = _task_HtyRepository.AddData(taskHtyNG) > 0; |
| | | |
| | | // 删除任务数据 |
| | | var isTaskDelete = BaseDal.Delete(task.TaskId); |
| | | |
| | | return content.OK("删除成功!"); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | { |
| | | taskHty.Creater = App.User.UserName != null ? App.User.UserName : "System"; |
| | | } |
| | | taskHty.TaskState = task.TaskType > 199 ? (int)TaskInStatusEnum.InFinish : (int)TaskOutStatusEnum.OutFinish; |
| | | return taskHty; |
| | | } |
| | | |
| | |
| | | ToAddress = await GetRoadWayAsync(process); |
| | | else |
| | | ToAddress = process[0]; |
| | | |
| | | if (string.IsNullOrEmpty(ToAddress)) |
| | | { |
| | | return content.Error("无法获取目标地址"); |
| | | } |
| | | // 创建新任务实例 |
| | | var task = new Dt_Task |
| | | { |