| | |
| | | // - 手臂上有物料(RobotArmObject == 1) |
| | | // - 任务状态为 RobotPickFinish(已记录取货完成) |
| | | if ((latestState.CurrentAction == "PickFinished" || latestState.CurrentAction == "AllPickFinished") |
| | | && (latestState.RobotArmObject.IsNullOrEmpty() || latestState.RobotArmObject == 1) |
| | | //&& (latestState.RobotArmObject.IsNullOrEmpty() || latestState.RobotArmObject == 1) |
| | | && task.RobotTaskState == TaskRobotStatusEnum.RobotPickFinish.GetHashCode()) |
| | | { |
| | | QuartzLogHelper.LogInfo(_logger, $"ExecuteAsync:满足放货条件,开始下发放货任务,任务号: {task.RobotTaskNum}", latestState.RobotCrane?.DeviceName ?? ipAddress); |
| | |
| | | // - 手臂上无物料(RobotArmObject == 0) |
| | | // - 任务状态为 RobotPutFinish 或不是 RobotExecuting |
| | | else if ((latestState.CurrentAction == "PutFinished" || latestState.CurrentAction == "AllPutFinished" || latestState.CurrentAction.IsNullOrEmpty()) |
| | | && (latestState.RobotArmObject.IsNullOrEmpty() || latestState.RobotArmObject == 0) |
| | | //&& (latestState.RobotArmObject.IsNullOrEmpty() || latestState.RobotArmObject == 0) |
| | | && (task.RobotTaskState == TaskRobotStatusEnum.RobotPutFinish.GetHashCode() || task.RobotTaskState != TaskRobotStatusEnum.RobotExecuting.GetHashCode())) |
| | | { |
| | | QuartzLogHelper.LogInfo(_logger, $"ExecuteAsync:满足取货条件,开始下发取货任务,任务号: {task.RobotTaskNum}", latestState.RobotCrane?.DeviceName ?? ipAddress); |
| | |
| | | // 检查电池是否已到位 |
| | | if (!stateForUpdate.BatteryArrived) |
| | | { |
| | | QuartzLogHelper.LogError(_logger, $"HandlePutFinishedStateAsync:电芯未到位,任务号: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress); |
| | | return; |
| | | } |
| | | // 读取线体电芯条码 |
| | | string trayBarcode1 = RobotBarcodeGenerator.GenerateTrayBarcode("DB40.990"); |
| | | string trayBarcode2 = RobotBarcodeGenerator.GenerateTrayBarcode("DB40.1020"); |
| | | string trayBarcode2 = RobotBarcodeGenerator.GenerateTrayBarcode("DB40.990"); |
| | | string trayBarcode1 = RobotBarcodeGenerator.GenerateTrayBarcode("DB40.1020"); |
| | | |
| | | // 如果条码生成成功 |
| | | if (!string.IsNullOrEmpty(trayBarcode1) && !string.IsNullOrEmpty(trayBarcode2)) |
| | | { |
| | | if (stateForUpdate.CellBarcode.Contains(trayBarcode1) || stateForUpdate.CellBarcode.Contains(trayBarcode2)) |
| | | { |
| | | QuartzLogHelper.LogInfo(_logger, $"HandlePutFinishedStateAsync:读取的托盘条码已存在,可能存在重复,任务号: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress); |
| | | QuartzLogHelper.LogInfo(_logger, $"HandlePutFinishedStateAsync:读取的电芯条码已存在,可能存在重复,任务号: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress); |
| | | |
| | | // 发送取货指令 标记扫码NG,放货时不使用这些条码,并放入NG口 |
| | | //await _taskProcessor.SendSocketRobotPickAsync(task, stateForUpdate, true); |
| | |
| | | } |
| | | else |
| | | { |
| | | QuartzLogHelper.LogInfo(_logger, $"HandlePutFinishedStateAsync:读取的托盘条码唯一,继续执行,任务号: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress); |
| | | if (trayBarcode1.Length < 13 || trayBarcode2.Length < 13) |
| | | { |
| | | QuartzLogHelper.LogError(_logger, $"HandlePutFinishedStateAsync:电芯条码长度不达标,任务号: {task.RobotTaskNum},读取电芯条码成功: 【{trayBarcode1}】-----【{trayBarcode2}】", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress); |
| | | return; |
| | | } |
| | | |
| | | QuartzLogHelper.LogInfo(_logger, $"HandlePutFinishedStateAsync:读取的电芯条码唯一,继续执行,任务号: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress); |
| | | |
| | | // 将条码添加到状态中,供后续放货时使用 |
| | | stateForUpdate.CellBarcode = new List<string>() |
| | |
| | | } |
| | | |
| | | // 记录日志:读取托盘条码成功 |
| | | QuartzLogHelper.LogInfo(_logger, $"HandlePutFinishedStateAsync:读取托盘条码成功: 【{trayBarcode1}】-----【{trayBarcode2}】,任务号: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress); |
| | | QuartzLogHelper.LogInfo(_logger, $"HandlePutFinishedStateAsync:读取电芯条码成功: 【{trayBarcode1}】-----【{trayBarcode2}】,任务号: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress); |
| | | |
| | | // 发送取货指令 |
| | | await _taskProcessor.SendSocketRobotPickAsync(task, stateForUpdate); |