| | |
| | | #region Propertys & Variables |
| | | public string ID { get; set; } = Guid.NewGuid().ToString("N"); |
| | | public string Name { get; set; } |
| | | private DateTime BeginAt; |
| | | private DateTime EndAt; |
| | | public TimeSpan ElapsedTime => EndAt - BeginAt; |
| | | public IWorkStep.NodeTypes NodeType { get; set; } |
| | | public MES_WO_NODE Node { get; set; } |
| | | public MES_WO_OPER OperSetting { get; set; } |
| | |
| | | public int Sequence { get; set; } |
| | | public List<string> PrepNodeIDs { get; set; } = new(); |
| | | public string NodeID => NodeType == IWorkStep.NodeTypes.Action ? NodeAct.ID : Node.ID; |
| | | private bool _IsActive = true; |
| | | public bool IsActive |
| | | { |
| | | get => NodeType == IWorkStep.NodeTypes.Action ? ActSetting.IS_ACTIVE == "Y" : _IsActive; |
| | | set { _IsActive = value; } |
| | | } |
| | | private bool _IsFinished = false; |
| | | public bool IsFinished |
| | | { |
| | |
| | | /// <returns></returns> |
| | | public ApiAction<SubmitOutput> TryBegin(SubmitInput input) |
| | | { |
| | | return CurAction.TryBegin(input); |
| | | BeginAt = DateTime.Now; |
| | | //工步行为启用则正常执行 |
| | | if (IsActive) |
| | | { |
| | | return CurAction.TryBegin(input); |
| | | } |
| | | //工步行为不启用,否则工步默认完成 |
| | | else |
| | | { |
| | | CurAction.IsFinished = true; |
| | | var action = new ApiAction<SubmitOutput>(new SubmitOutput()); |
| | | this.Message = Biz.L($"行为未启用"); |
| | | this.Status = StepStatus.InActive; |
| | | action.Data.ShortMsg = new($"行为未启用", ShortMessage.Types.Success); |
| | | //action.LocaleMsg = new($"{0}行为未启用"); |
| | | action.LocaleMsg = new("MES.WorkAction.NotActive", NodeAct.ACT_NAME); |
| | | return action; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | public ApiAction<SubmitOutput> End(SubmitInput input) |
| | | { |
| | | return CurAction.End(input); |
| | | var result = CurAction.End(input); |
| | | EndAt = DateTime.Now; |
| | | return result; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取工步当前耗时 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public TimeSpan GetElapsedTime() |
| | | { |
| | | return DateTime.Now - BeginAt; |
| | | } |
| | | |
| | | /// <summary> |