| | |
| | | using AutoMapper; |
| | | using HslCommunication; |
| | | using Mapster; |
| | | using Microsoft.AspNetCore.DataProtection.XmlEncryption; |
| | | using Newtonsoft.Json; |
| | | using SqlSugar; |
| | | using System.Diagnostics.CodeAnalysis; |
| | |
| | | task.NextAddress = item.TargetAddress; |
| | | } |
| | | // 判断任务目标地址和路径是否满足特定条件 |
| | | else if ((task.TargetAddress == "002-071-001" || task.TargetAddress == "001-061-001") && (task.Roadway.Contains("JZ")|| task.Roadway.Contains("CH"))) |
| | | else if (((task.TargetAddress == "002-071-001" || task.TargetAddress == "001-061-001") && (task.Roadway.Contains("JZ")|| task.Roadway.Contains("CH")))|| task.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm) |
| | | { |
| | | // 设置任务状态为出库新建 |
| | | task.TaskState = (int)TaskOutStatusEnum.OutNew; |
| | |
| | | // 判断任务类型是否为入库任务 |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | |
| | | var value = _sys_ConfigService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStation, SysConfigKeyConst.JZNGInBoundStation).ConfigValue; |
| | | var valueList = value.Split(',').ToList(); |
| | | // 判断源地址是否不等于"1359-4" |
| | | //if (task.SourceAddress != "1359-4" && task.SourceAddress != "1357-4") |
| | | if (!valueList.Contains(task.SourceAddress)) |
| | | if (task.SourceAddress == "1435" && task.TaskType == (int)TaskInboundTypeEnum.InNG) |
| | | { |
| | | List<Dt_Router> routers = _routerService.QueryNextRoutes(item.SourceAddress, item.TargetAddress); |
| | | if (routers.Count > 0) |
| | | { |
| | | // 设置任务状态为入库新建 |
| | | task.TaskState = (int)TaskInStatusEnum.InNew; |
| | | // 设置当前地址为源地址 |
| | | task.CurrentAddress = item.SourceAddress; |
| | | // 设置下一个地址为第一个子位置 |
| | | task.NextAddress = routers.FirstOrDefault().ChildPosi; |
| | | } |
| | | task.Remark = "NG"; |
| | | } |
| | | else if (!valueList.Contains(task.SourceAddress)) |
| | | { |
| | | // 查询从源地址到目标地址的路由 |
| | | List<Dt_Router> routers = _routerService.QueryNextRoutes(item.SourceAddress, item.TargetAddress); |
| | |
| | | return task; |
| | | } |
| | | |
| | | public Dt_Task QueryConveyorLineTask(string deviceNo, string currentAddress,string Barcode) |
| | | { |
| | | Dt_Task task = null; |
| | | task = BaseDal.QueryFirst(x => ((TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.InNew) || (TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.SC_OutFinish)) && x.CurrentAddress == currentAddress && x.PalletCode == Barcode, TaskOrderBy); |
| | | if (task == null) |
| | | { |
| | | task = BaseDal.QueryFirst(x => x.Roadway == currentAddress && x.TaskType == (int)TaskOutboundTypeEnum.TrayInToOut && x.TaskState == (int)TaskOutStatusEnum.OutNew && x.PalletCode == Barcode, TaskOrderBy); |
| | | } |
| | | return task; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据设备编号、当前地址查询输送线未执行的任务 |
| | | /// </summary> |
| | |
| | | public Dt_Task QueryExecutingConveyorLineTask(int taskNum, string nextAddress) |
| | | { |
| | | return BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.NextAddress == nextAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting), TaskOrderBy); |
| | | } |
| | | |
| | | public Dt_Task QueryExecutingConveyorLineTask(int taskNum, string nextAddress,string Barcode) |
| | | { |
| | | return BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.NextAddress == nextAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting) && x.PalletCode == Barcode, TaskOrderBy); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error($"任务完成异常,任务号:【{taskNum}】"); |
| | | QuartzLogger.WriteLogToFile($"Info_任务完成", $"任务完成异常,任务号:【{taskNum}】异常信息【{ex.Message}】{Environment.NewLine}{Environment.NewLine}"); |
| | | QuartzLogger.WriteLogToFile($"Info_任务完成", $"任务完成异常,任务号:【{taskNum}】异常信息【{ex.StackTrace}】{Environment.NewLine}{Environment.NewLine}"); |
| | | } |
| | | QuartzLogger.WriteLogToFile($"Info_任务完成", $"任务完成,任务号:【{taskNum}】返回参数【{JsonConvert.SerializeObject(content)}】{Environment.NewLine}{Environment.NewLine}"); |
| | | return content; |
| | |
| | | return BaseDal.QueryFirst(x => x.Roadway == deviceNo && x.TaskType == (int)TaskRelocationTypeEnum.Relocation && x.TaskState == (int)TaskStatus.Created); |
| | | } |
| | | |
| | | public Dt_Task QueryOutFireAlarmTask(string deviceNo) |
| | | { |
| | | return BaseDal.QueryFirst(x => x.Roadway == deviceNo && x.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm && x.TaskState == (int)TaskOutStatusEnum.OutNew); |
| | | } |
| | | |
| | | public Dt_Task QueryExecutingTaskByBarcode(string barcode, string nextAddress) |
| | | { |
| | | return BaseDal.QueryFirst(x => x.PalletCode == barcode && x.NextAddress == nextAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting), TaskOrderBy); |