| | |
| | | public class IPQC : IIPQC |
| | | { |
| | | #region Propertys & Variables |
| | | #region 固定写法,工序中的必要信息 |
| | | public bool IsFinished { get; set; } = false; |
| | | public IWorkStep CurStep { get; set; } |
| | | public IPosition CurPosition { get; set; } |
| | | public MES_WO_NODE_ACT NodeAct { get; set; } |
| | | public MES_WO_ACTION Setting { get; set; } |
| | | #endregion |
| | | #endregion Propertys & Variables |
| | | |
| | | #region Functions |
| | |
| | | /// <returns></returns> |
| | | public void Init(IWorkStep curStep, IPosition position, MES_WO_NODE_ACT nodeAct, MES_WO_ACTION setting) |
| | | { |
| | | #region 固定写法,给默认变量赋值 |
| | | CurStep = curStep; |
| | | CurPosition = position; |
| | | NodeAct = nodeAct; |
| | | Setting = setting; |
| | | #endregion |
| | | |
| | | CurStep.Message = Biz.L("等待测试结果"); |
| | | CurStep.Status = StepStatus.Normal; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | action.LocaleMsg = new("MES.WorkAction.IPQC.PleaseTest"); |
| | | |
| | | //如果根据输入可以开始执行当前行为则标记为成功,否则失败 |
| | | CurStep.Message = Biz.L("等待测试"); |
| | | CurStep.Status = StepStatus.Normal; |
| | | action.IsSuccessed = false; |
| | | action.Data.ShortMsg = new("等待测试", ShortMessage.Types.Success); |
| | | return action; |
| | | } |
| | | /// <summary> |
| | |
| | | //行为执行完成 |
| | | if (false) |
| | | { |
| | | action = End(); |
| | | action = End(input); |
| | | } |
| | | } |
| | | //提交数据执行失败 |
| | | else |
| | | { |
| | | CurStep.Message = Biz.L("测试失败"); |
| | | CurStep.Status = StepStatus.Error; |
| | | action.Data.ShortMsg = new("测试失败", ShortMessage.Types.Failed); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"执行失败"); |
| | | action.LocaleMsg = new("MES.WorkAction.IPQC.Fail"); |
| | |
| | | /// 结束执行工序行为 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ApiAction<SubmitOutput> End() |
| | | public ApiAction<SubmitOutput> End(SubmitInput input) |
| | | { |
| | | var action = new ApiAction<SubmitOutput>(new SubmitOutput()); |
| | | |
| | |
| | | { |
| | | AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, |
| | | AUTH_PROD = CurPosition.CurLine.LINE_CODE, |
| | | WIP_ID = wipSn.ID, |
| | | HIS_ID = CurPosition.CurWipSNHiss.First(q => q.SN == wipSn.SN).ID, |
| | | SN = wipSn.SN, |
| | | STATUS = wipSn.STATUS, |
| | |
| | | POST_CODE = wipSn.POST_CODE, |
| | | OPER_CODE = wipSn.OPER_CODE, |
| | | SEGMENT = wipSn.SEGMENT, |
| | | FLOW_SN = wipSn.FLOW_SN, |
| | | TRAY_SN = wipSn.TRAY_SN, |
| | | INNER_SN = wipSn.INNER_SN, |
| | | CARTON_SN = wipSn.CARTON_SN, |
| | | PALLET_SN = wipSn.PALLET_SN, |
| | | OPERATION_TIME = DateTime.Now, |
| | | SFTS_CODE = wipSn.SFTS_CODE, |
| | | SFT_CODE = wipSn.SFT_CODE, |
| | |
| | | ACT_VALUE_4 = "", |
| | | ACT_VALUE_5 = "", |
| | | ACT_RESULT = "Y", |
| | | ELAPSED_TIME = CurStep.GetElapsedTime().TotalMilliseconds.ToInt64(), |
| | | TRACE_INFO = $"执行成功", |
| | | }; |
| | | wipActs.Add(wipAct); |
| | | } |
| | | |
| | | //创建变量克隆对象用于传入DBSubmitAction中保存当前需要暂存的数据值 |
| | | var _wipActs = wipActs.Clone(); |
| | | //保存数据 |
| | | CurStep.DBSubmitAction = () => |
| | | { |
| | | var db = CurPosition.GetCommitDB(); |
| | | db.Storageable(wipActs, CurPosition.UserCode).ExecuteCommand(); |
| | | db.Storageable(_wipActs, CurPosition.UserCode).ExecuteCommand(); |
| | | }; |
| | | |
| | | IsFinished = true; |
| | | action.LocaleMsg = new($"行为结束"); |
| | | CurStep.Message = Biz.L("测试完成"); |
| | | CurStep.Status = StepStatus.Finished; |
| | | action.Data.ShortMsg = new("测试完成", ShortMessage.Types.Success); |
| | | action.LocaleMsg = new($"测试结束"); |
| | | //action.LocaleMsg = new("MES.WorkAction.IPQC.Finish"); |
| | | return action; |
| | | } |