| | |
| | | { |
| | | #region Propertys & Variables |
| | | #region 固定写法,工序中的必要信息 |
| | | public DbClient MainDB { get; set; } |
| | | public bool IsFinished { get; set; } = false; |
| | | public IWorkStep CurStep { get; set; } |
| | | public IPosition CurPosition { get; set; } |
| | |
| | | public void Init(IWorkStep curStep, IPosition position, MES_WO_NODE_ACT nodeAct, MES_WO_ACTION setting) |
| | | { |
| | | #region 固定写法,给默认变量赋值 |
| | | MainDB = position.MainDB; |
| | | CurStep = curStep; |
| | | CurPosition = position; |
| | | NodeAct = nodeAct; |
| | | Setting = setting; |
| | | #endregion |
| | | |
| | | Label = Biz.Db.Queryable<BAS_LABEL_TEMP>().Where(q => q.LABEL_CODE == setting.LABEL_CODE).IncludesAllFirstLayer().First(); |
| | | LabelPV = Biz.Db.Queryable<BAS_LABEL_PV>().ToList(); |
| | | Label = MainDB.Queryable<BAS_LABEL_TEMP>().Where(q => q.LABEL_CODE == setting.LABEL_CODE).IncludesAllFirstLayer().First(); |
| | | LabelPV = MainDB.Queryable<BAS_LABEL_PV>().ToList(); |
| | | |
| | | CurStep.Message = Biz.L("等待标签打印"); |
| | | CurStep.Status = StepStatus.Normal; |
| | |
| | | /// <returns></returns> |
| | | public Locale GetBeginMsg() |
| | | { |
| | | var msg = new Locale("MES.WorkAction.PrintLabel.BeginMsg", CurPosition.CurSN, Label.LABEL_CODE, Label.LABEL_NAME); |
| | | var msg = new Locale("MES.WorkAction.PrintLabel.BeginMsg", CurPosition.CurSN, Label?.LABEL_CODE, Label?.LABEL_NAME); |
| | | //var msg = new Locale($"开始打印条码[{CurPosition.CurWipSN.SN}]的标签[{Label.LABEL_CODE}: {Label.LABEL_NAME}]"); |
| | | return msg; |
| | | } |
| | |
| | | { |
| | | var action = new ApiAction<SubmitOutput>(new SubmitOutput()); |
| | | |
| | | //设置打印变量值 |
| | | Label = CurPosition.SetLabelVariables(LabelPV, Label); |
| | | action.Data.Data = Label; |
| | | if (Label.IsNullOrEmpty()) |
| | | { |
| | | action = End(input); |
| | | } |
| | | else |
| | | { |
| | | //设置打印变量值 |
| | | Label = CurPosition.SetLabelVariables(LabelPV, Label, this); |
| | | action.Data.Data = Label; |
| | | |
| | | //如果返回成功则认为当前行为可以开始执行,否则返回失败 |
| | | CurStep.Message = Biz.L("打印开始"); |
| | | CurStep.Status = StepStatus.Normal; |
| | | action.IsSuccessed = true; |
| | | action.Data.ShortMsg = new("打印开始", ShortMessage.Types.Success); |
| | | //如果返回成功则认为当前行为可以开始执行,否则返回失败 |
| | | CurStep.Message = Biz.L("打印开始"); |
| | | CurStep.Status = StepStatus.Normal; |
| | | action.IsSuccessed = true; |
| | | action.Data.ShortMsg = new("打印开始", ShortMessage.Types.Success); |
| | | } |
| | | return action; |
| | | } |
| | | |
| | |
| | | action.Data.ShortMsg = new("打印失败", ShortMessage.Types.Failed); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"标签{Label.LABEL_NAME}[{Label.LABEL_CODE}]打印失败", Label.LABEL_NAME); |
| | | action.LocaleMsg = new("MES.WorkAction.PrintLabel.PrintFail", Label.LABEL_NAME, Label.LABEL_CODE); |
| | | action.LocaleMsg = new("MES.WorkAction.PrintLabel.PrintFail", Label?.LABEL_NAME, Label?.LABEL_CODE); |
| | | //如果行为设置为出错需要重置工序操作 |
| | | if (NodeAct.NEED_RESET == "Y") |
| | | { |
| | |
| | | PRD_CODE = wipSn.PRD_CODE, |
| | | ACT_TYPE = NodeAct.ACT_TYPE, |
| | | ACT_SN = wipSn.SN, |
| | | ACT_VALUE_1 = Label.LABEL_CODE, |
| | | ACT_VALUE_2 = Label.Variables.ToJson(), |
| | | ACT_VALUE_1 = Label?.LABEL_CODE, |
| | | ACT_VALUE_2 = Label?.ToJson(), |
| | | ACT_RESULT = "Y", |
| | | TRACE_INFO = $"标签{Label.LABEL_NAME}[{Label.LABEL_CODE}]打印成功", |
| | | ELAPSED_TIME = CurStep.GetElapsedTime().TotalMilliseconds.ToInt64(), |
| | | TRACE_INFO = $"标签{Label?.LABEL_NAME}[{Label?.LABEL_CODE}]打印成功", |
| | | }; |
| | | wipActs.Add(wipAct); |
| | | } |
| | |
| | | CurStep.Status = StepStatus.Finished; |
| | | action.Data.ShortMsg = new("打印完成", ShortMessage.Types.Success); |
| | | //action.LocaleMsg = new($"标签{Label.LABEL_NAME}[{Label.LABEL_CODE}]打印成功", Label.LABEL_NAME); |
| | | action.LocaleMsg = new("MES.WorkAction.PrintLabel.PrintSuccess", Label.LABEL_NAME, Label.LABEL_CODE); |
| | | action.LocaleMsg = new("MES.WorkAction.PrintLabel.PrintSuccess", Label?.LABEL_NAME, Label?.LABEL_CODE); |
| | | return action; |
| | | } |
| | | |