添加 MX-PD-盘古 项目文件
将 MX-PD-盘古 - new 目录下的所有文件添加到主仓库
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
using MainShell.Common;
|
||||
using MainShell.Recipe.Models;
|
||||
using MW.WorkFlow;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MainShell.Process
|
||||
{
|
||||
public class PreparationSignalActivity : ActivityAbstractBase
|
||||
{
|
||||
public PreparationSignalActivity(string name)
|
||||
: base(name)
|
||||
{
|
||||
}
|
||||
|
||||
protected override Task<ActivityResult> OnExecuteAsync(WorkflowContext context, ActivityControl activityControl)
|
||||
{
|
||||
activityControl.ThrowIfCancellationRequested();
|
||||
|
||||
bool pendingChipLoad;
|
||||
if (context.TryGetData<bool>(WorkflowContextKeys.PendingChipLoad, out pendingChipLoad) && !pendingChipLoad)
|
||||
{
|
||||
return Task.FromResult(ActivityResult.Success);
|
||||
}
|
||||
|
||||
PreparationAreaService preparationAreaService;
|
||||
if (!context.TryGetData<PreparationAreaService>(WorkflowContextKeys.PreparationAreaService, out preparationAreaService) || preparationAreaService == null)
|
||||
{
|
||||
throw new InvalidOperationException("δ<>ڹ<EFBFBD><DAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
}
|
||||
|
||||
ChipPreparationRequest request = new ChipPreparationRequest
|
||||
{
|
||||
RecipeName = ResolveRecipeName(context),
|
||||
Action = ChipPreparationAction.Prepare,
|
||||
SourceStepId = ResolveSourceStepId(context)
|
||||
};
|
||||
|
||||
string rejectReason;
|
||||
if (preparationAreaService.TryRequestPrepare(request, out rejectReason) || CanIgnoreReject(preparationAreaService))
|
||||
{
|
||||
context.SetData(WorkflowContextKeys.PreparationAreaStatus, preparationAreaService.CurrentStatus);
|
||||
return Task.FromResult(ActivityResult.Success);
|
||||
}
|
||||
|
||||
return Task.FromResult(Fail(
|
||||
context,
|
||||
MessageKey.ProcessStepFailedWithReason,
|
||||
new object[]
|
||||
{
|
||||
Name,
|
||||
string.IsNullOrWhiteSpace(rejectReason) ? "оƬ<C6AC><D7BC><EFBFBD>źŴ<C5BA><C5B4><EFBFBD>ʧ<EFBFBD>ܡ<EFBFBD>" : rejectReason
|
||||
}));
|
||||
}
|
||||
|
||||
private static bool CanIgnoreReject(PreparationAreaService preparationAreaService)
|
||||
{
|
||||
return preparationAreaService.CurrentStatus == ChipPreparationStatus.Preparing ||
|
||||
preparationAreaService.CurrentStatus == ChipPreparationStatus.Prepared ||
|
||||
preparationAreaService.CurrentStatus == ChipPreparationStatus.Loading ||
|
||||
preparationAreaService.CurrentStatus == ChipPreparationStatus.Loaded;
|
||||
}
|
||||
|
||||
private static string ResolveRecipeName(WorkflowContext context)
|
||||
{
|
||||
RecipeManager recipeManager;
|
||||
if (context.TryGetData<RecipeManager>(WorkflowContextKeys.RecipeManager, out recipeManager) &&
|
||||
recipeManager != null &&
|
||||
recipeManager.CurrentWaferRecipe != null)
|
||||
{
|
||||
return recipeManager.CurrentWaferRecipe.RecipeName;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
private static string ResolveSourceStepId(WorkflowContext context)
|
||||
{
|
||||
string stepId;
|
||||
if (context.TryGetData<string>(WorkflowContextKeys.CurrentStepId, out stepId))
|
||||
{
|
||||
return stepId;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user