| | |
| | | using Newtonsoft.Json; |
| | | using Tiger.IBusiness; |
| | | using Tiger.Model.Entitys.MES.Position; |
| | | using Tiger.Business.MES.Transaction; |
| | | |
| | | namespace Tiger.Business |
| | | { |
| | |
| | | public MES_WO_ACTION ActSetting { get; set; } |
| | | public IPosition CurPosition { get; set; } |
| | | public IWorkAction CurAction { get; set; } |
| | | public Dictionary<string, string> ActionDic { get; set; } = new(); |
| | | public int Sequence { get; set; } |
| | | public List<string> PrepNodeIDs { get; set; } = new(); |
| | | public string NodeID => NodeType == IWorkStep.NodeTypes.Action ? NodeAct.ID : Node.ID; |
| | |
| | | { |
| | | CurAction = DI.Resolve(NodeAct.Definition.SERVICE_TYPE) as IWorkAction; |
| | | //CurAction = DI.Resolve("Tiger.IBusiness.IPrintLabel,Tiger.IBusiness") as IWorkAction; |
| | | |
| | | //设置行为字典 |
| | | ActionDic = NodeAct.Variables.ToDictionary(k => k.VAR_CODE, v => v.DEFAULT); |
| | | |
| | | CurAction.Init(this, CurPosition, NodeAct, ActSetting); |
| | | } |
| | | |
| | |
| | | //工步行为启用则正常执行 |
| | | if (IsActive) |
| | | { |
| | | return CurAction.TryBegin(input); |
| | | UpdateActionDic(input.ActionDic); |
| | | return ResetActionDic(CurAction.TryBegin(input)); |
| | | } |
| | | //工步行为不启用,否则工步默认完成 |
| | | else |
| | |
| | | /// <returns></returns> |
| | | public ApiAction<SubmitOutput> Submit(SubmitInput input) |
| | | { |
| | | return CurAction.Submit(input); |
| | | UpdateActionDic(input.ActionDic); |
| | | return ResetActionDic(CurAction.Submit(input)); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | public ApiAction<SubmitOutput> End(SubmitInput input) |
| | | { |
| | | UpdateActionDic(input.ActionDic); |
| | | var result = CurAction.End(input); |
| | | EndAt = DateTime.Now; |
| | | return result; |
| | | return ResetActionDic(result); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取工步当前耗时 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public void UpdateActionDic(Dictionary<string, string> newDic) |
| | | { |
| | | foreach (var item in newDic ?? new()) |
| | | { |
| | | if (ActionDic.ContainsKey(item.Key)) |
| | | { |
| | | ActionDic[item.Key] = item.Value; |
| | | } |
| | | else |
| | | { |
| | | ActionDic.Add(item.Key, item.Value); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取工步当前耗时 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ApiAction<SubmitOutput> ResetActionDic(ApiAction<SubmitOutput> output) |
| | | { |
| | | output.Data.ActionDic = ActionDic; |
| | | return output; |
| | | } |
| | | |
| | | /// <summary> |