| | |
| | | #region Propertys & Variables |
| | | public string UserCode { get; set; } |
| | | public string PostCode { get; set; } |
| | | protected DateTime BeginAt; |
| | | protected DateTime EndAt; |
| | | public TimeSpan ElapsedTime => EndAt - BeginAt; |
| | | public MES_FACTORY CurFactory { get; set; } |
| | | public MES_WORKSHOP CurWorkshop { get; set; } |
| | | public MES_LINE CurLine { get; set; } |
| | |
| | | public WorkStep CurStep { get; set; } |
| | | public List<WorkStep> NextSteps { get; set; } = new(); |
| | | public bool IsFinishNodeSteps => !Steps.Any(q => q.NodeType == IWorkStep.NodeTypes.Node && !q.IsFinished); |
| | | public bool IsFinishAllSteps => !Steps.Any() || !Steps.Any(q => !q.IsFinished); |
| | | public bool IsFinishAllSteps => Steps.Any() && !Steps.Any(q => !q.IsFinished); |
| | | //public int CurStep => Steps.Where(q => !q.IsFinished).OrderBy(q => q.Sequence).FirstOrDefault()?.Sequence ?? 0; |
| | | private DbClient CommitDB; |
| | | /// <summary> |
| | |
| | | public bool NeedTemporaryStoreDBCommitAction { get; set; } = false; |
| | | protected Dictionary<string, List<Action>> DBCommitList { get; set; } = new(); |
| | | protected List<Position> NodeCommitList { get; set; } = new(); |
| | | protected Dictionary<string, OperInfo> OperInfoDic { get; set; } = new(); |
| | | //protected OperInfo CurOperInfo { get; set; } |
| | | private Dictionary<string, OperInfo> OperInfoDic = new(); |
| | | |
| | | #endregion Propertys & Variables |
| | | |
| | | #region Functions |
| | |
| | | CurDefects.Clear(); |
| | | } |
| | | |
| | | //获取当前的工序信息 |
| | | protected OperInfo CurOperInfo(string locale) |
| | | { |
| | | OperInfo info = new(); |
| | | if (CurBatch?.Batch?.BATCH_NO != null) |
| | | { |
| | | info = OperInfoDic[CurBatch.Batch.BATCH_NO ]; |
| | | info.StepsInfo = Steps.Select(q => q.GetInfo(locale)).ToList(); |
| | | } |
| | | return info; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置当前条码的工序信息 |
| | | /// </summary> |
| | | public OperInfo SetOperNodeInfo(OperInfo info, string locale) |
| | | public OperInfo SetOperNodeInfo(OperInfo info) |
| | | { |
| | | if (CurWipSNs.Any()) |
| | | { |
| | | info.CurNode = CurWipSNs.First().NODE_NAME; |
| | | info.NextNode = string.Join(",", CurBatch.GetNextNodes(CurWipSNs.First()).Select(q => q.NODE_NAME)); |
| | | info.StepsInfo = Steps.Select(q => q.GetInfo(locale)).ToList(); |
| | | } |
| | | else |
| | | { |
| | | info.CurNode = " — "; |
| | | info.NextNode = " — "; |
| | | info.StepsInfo = new(); |
| | | } |
| | | return info; |
| | | } |
| | |
| | | CurStep = step; |
| | | //更新后续可执行的工步列表 |
| | | NextSteps = GetNextSteps(CurStep); |
| | | //返回结果到客户端 |
| | | result = canBegin; |
| | | result.Data.SetValue(CurBatch, CurStep, CurStep?.ID, IsFinishAllSteps); |
| | | |
| | | //如果当前执行工步尝试执行后就已经完成,不需要后续交互,且,则继续开始下一工步 |
| | | if (CurStep.IsFinished && NextSteps.Any()) |
| | | { |
| | | result = BeginNextActionStep(input); |
| | | } |
| | | else |
| | | { |
| | | //返回结果到客户端 |
| | | result = canBegin; |
| | | result.Data.SetValue(CurBatch, CurStep, CurStep?.ID, IsFinishAllSteps); |
| | | } |
| | | return result; |
| | | } |
| | | //工序被重置 |
| | | else if(Steps.IsNullOrEmpty()) |
| | | { |
| | | return canBegin; |
| | | } |
| | | } |
| | | |
| | |
| | | action.Invoke(); |
| | | } |
| | | } |
| | | //记录工序耗时 |
| | | EndAt = DateTime.Now; |
| | | var ids = CurWipSNHiss.Select(q => q.ID).ToList(); |
| | | GetCommitDB().Updateable<MES_WIP_HIS>().SetColumns(q => q.ELAPSED_TIME == ElapsedTime.TotalMilliseconds.ToInt64()).Where(q => ids.Contains(q.ID)).ExecuteCommand(); |
| | | }); |
| | | if (dbTran.IsSuccess) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | #region 打印专用方法 |
| | | /// <summary> |
| | | /// 获取打印标签模板过程变量值 |
| | | /// </summary> |
| | |
| | | return result; |
| | | } |
| | | |
| | | #endregion |
| | | #endregion Functions |
| | | |
| | | public override bool Close(bool needSaveHistoryLog = false) |