| | |
| | | CurBatch?.Update(); |
| | | |
| | | var submitStep = Steps.Where(q => q.ID == input.CurStepID && !q.IsFinished).FirstOrDefault(); |
| | | //如果客户端返回的当前工步ID找不到未完成的行为工步,则直接开始下一个行为工步 |
| | | if (submitStep.IsNullOrEmpty()) |
| | | { |
| | | action = BeginNextActionStep(input); |
| | | action.Data.OperInfo = CurOperInfo(input.Locale); |
| | | } |
| | | else |
| | | { |
| | | var result = submitStep.Submit(input); |
| | | action = submitStep.Submit(input); |
| | | //如果当前工步已完成,开始执行下一工步 |
| | | if (result.IsSuccessed && submitStep.IsFinished) |
| | | if (action.IsSuccessed && submitStep.IsFinished) |
| | | { |
| | | result = BeginNextActionStep(input); |
| | | action = BeginNextActionStep(input); |
| | | } |
| | | //如果当前工步未完成 |
| | | else |
| | |
| | | //行为执行出错,工步被重置 |
| | | if (Steps.IsNullOrEmpty()) |
| | | { |
| | | result.LocaleMsg = new(Biz.T(result.LocaleMsg, input.Locale) + Biz.T(Biz.L("MES.Transaction.Position.RescanSN"), input.Locale)); |
| | | action.LocaleMsg = new(Biz.T(action.LocaleMsg, input.Locale) + Biz.T(Biz.L("MES.Transaction.Position.RescanSN"), input.Locale)); |
| | | } |
| | | else |
| | | { |
| | | result.Data.SetValue(CurBatch, CurStep, CurStep?.ID, IsFinishAllSteps); |
| | | action.Data.SetValue(CurBatch, CurStep, CurStep?.ID, IsFinishAllSteps); |
| | | } |
| | | } |
| | | } |
| | | //如果所有工步都完成 |
| | | if (IsFinishAllSteps) |
| | | { |
| | | result = DoIfFinishAllSteps(result, input.Locale); |
| | | action = DoIfFinishAllSteps(action, input.Locale); |
| | | } |
| | | else |
| | | { |
| | | result.Data.OperInfo = CurOperInfo(input.Locale); |
| | | } |
| | | return result; |
| | | action.Data.OperInfo = CurOperInfo(input.Locale); |
| | | } |
| | | } |
| | | //没有可执行的工步 |