| | |
| | | public List<WorkStep> Steps { get; set; } = new(); |
| | | public WorkStep CurStep { get; set; } |
| | | public List<WorkStep> NextSteps { get; set; } = new(); |
| | | public bool IsFinishNodeSteps => !Steps.Any(q => q.Type == IWorkStep.Types.Node && !q.IsFinished); |
| | | public bool IsFinishNodeSteps => !Steps.Any(q => q.NodeType == IWorkStep.NodeTypes.Node && !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; |
| | |
| | | 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; } |
| | | //protected OperInfo CurOperInfo { get; set; } |
| | | #endregion Propertys & Variables |
| | | |
| | | #region Functions |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"工单[{input.OrderNo}]没有下发到产线状态[{CurLine.LINE_CODE}]"); |
| | | action.LocaleMsg = new("MES.Transaction.Position.SelectOrder.LineException", input.OrderNo, CurLine.LINE_CODE); |
| | | return action; |
| | | } |
| | | if (batch.STATUS != BIZ_MES_WO_BATCH.STATUSs.Release.GetValue() && batch.STATUS != BIZ_MES_WO_BATCH.STATUSs.Working.GetValue()) |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"工单[{input.OrderNo}]状态[{wo.STATUS.GetEnum<BIZ_MES_WO_BATCH.STATUSs>().GetName()}]不能生产"); |
| | | action.LocaleMsg = new("MES.Transaction.Position.SelectOrder.StatusException", input.OrderNo, batch.STATUS.GetEnum<BIZ_MES_WO_BATCH.STATUSs>().GetName()); |
| | | return action; |
| | | } |
| | | var wb = new WorkBatch(input.OrderNo).Init(CurLine.LINE_CODE); |
| | |
| | | /// <summary> |
| | | /// 设置当前条码的工序信息 |
| | | /// </summary> |
| | | public OperInfo SetOperNodeInfo(OperInfo info) |
| | | public OperInfo SetOperNodeInfo(OperInfo info, string locale) |
| | | { |
| | | 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; |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | var next = new WorkStep(IWorkStep.Types.Action, this) |
| | | var next = new WorkStep(IWorkStep.NodeTypes.Action, this) |
| | | { |
| | | Name = act.ACT_NAME, |
| | | Sequence = parent.Sequence + 1, |
| | | Node = parent.Node, |
| | | OperSetting = CurBatch.NodeSets.FirstOrDefault(q => q.NODE_ID == parent.Node.ID), |
| | | NodeAct = act, |
| | | Setting = CurBatch.ActionSets.FirstOrDefault(q => q.ACT_ID == act.ID), |
| | | ActSetting = CurBatch.ActionSets.FirstOrDefault(q => q.ACT_ID == act.ID), |
| | | }; |
| | | next.Init(); |
| | | next.PrepNodeIDs.Add(parent.NodeID); |
| | |
| | | /// <param name="labelPVs">过程变量列表</param> |
| | | /// <param name="label">标签模板</param> |
| | | /// <returns></returns> |
| | | public BAS_LABEL_TEMP SetLabelVariables(List<BAS_LABEL_PV> labelPVs, BAS_LABEL_TEMP label) |
| | | public BAS_LABEL_TEMP SetLabelVariables(List<BAS_LABEL_PV> labelPVs, BAS_LABEL_TEMP label, IWorkAction action) |
| | | { |
| | | foreach (var item in label.Variables) |
| | | { |
| | |
| | | item.Value = item.VAR_VALUE; |
| | | break; |
| | | case BAS_LABEL_VAR.VAR_TYPEs.ProcessVariable: |
| | | item.Value = GetPrintProcessValue(labelPVs, item); |
| | | item.Value = GetPrintProcessValue(labelPVs, item, action); |
| | | break; |
| | | case BAS_LABEL_VAR.VAR_TYPEs.DateVariable: |
| | | item.Value = DateTime.Now.ToString(item.VAR_VALUE); |
| | |
| | | /// <param name="labelPVs">过程变量列表</param> |
| | | /// <param name="lv">标签模板变量</param> |
| | | /// <returns></returns> |
| | | public string GetPrintProcessValue(List<BAS_LABEL_PV> labelPVs, BAS_LABEL_VAR lv) |
| | | public string GetPrintProcessValue(List<BAS_LABEL_PV> labelPVs, BAS_LABEL_VAR lv, IWorkAction action) |
| | | { |
| | | var pv = labelPVs.FirstOrDefault(q => q.VAR_CODE == lv.VAR_VALUE); |
| | | if (!pv.IsNullOrEmpty()) |