| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using Tiger.IBusiness; |
| | | using Tiger.IBusiness.MES.WorkAction; |
| | | using Tiger.Model; |
| | | using Tiger.Model.Entitys.MES.Position; |
| | | |
| | |
| | | { |
| | | #region Propertys & Variables |
| | | public bool IsFinished { get; set; } = false; |
| | | public string StepID { get; set; } |
| | | 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; } |
| | |
| | | |
| | | #region Functions |
| | | /// <summary> |
| | | /// 开始执行工序行为 |
| | | /// 初始化工序行为 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ApiAction<SubmitOutput> Begin(string stepID, IPosition position, MES_WO_NODE_ACT nodeAct, MES_WO_ACTION setting) |
| | | public void Init(IWorkStep curStep, IPosition position, MES_WO_NODE_ACT nodeAct, MES_WO_ACTION setting) |
| | | { |
| | | StepID = stepID; |
| | | CurStep = curStep; |
| | | CurPosition = position; |
| | | NodeAct = nodeAct; |
| | | Setting = setting; |
| | | var action = new ApiAction<SubmitOutput>(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取行为开始的提示信息 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public Locale GetBeginMsg() |
| | | { |
| | | //var msg = new Locale("MES.WorkAction.IPQC.BeginMsg"); |
| | | var msg = new Locale($"请提交测试结果"); |
| | | return msg; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 尝试开始执行工序行为 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ApiAction<SubmitOutput> TryBegin(SubmitInput input) |
| | | { |
| | | var action = new ApiAction<SubmitOutput>(new SubmitOutput()); |
| | | |
| | | |
| | | //action.LocaleMsg = new($"请按测试项提交测试数据"); |
| | | action.LocaleMsg = new("MES.WorkAction.IPQC.PleaseTest"); |
| | | |
| | | //如果根据输入可以开始执行当前行为则标记为成功,否则失败 |
| | | action.IsSuccessed = false; |
| | | return action; |
| | | } |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | public ApiAction<SubmitOutput> Submit(SubmitInput input) |
| | | { |
| | | var action = new ApiAction<SubmitOutput>(); |
| | | var action = new ApiAction<SubmitOutput>(new SubmitOutput()); |
| | | |
| | | //提交数据执行成功 |
| | | if (true) |
| | | { |
| | | action.IsSuccessed = true; |
| | | action.LocaleMsg = new($"执行成功"); |
| | | //action.LocaleMsg = new("MES.WorkAction.IPQC.Success"); |
| | | //行为执行完成 |
| | | if (false) |
| | | { |
| | | action = End(); |
| | | } |
| | | } |
| | | //提交数据执行失败 |
| | | else |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"执行失败"); |
| | | action.LocaleMsg = new("MES.WorkAction.IPQC.Fail"); |
| | | //如果行为设置为出错需要重置工序操作 |
| | | if (NodeAct.NEED_RESET == "Y") |
| | | { |
| | | CurPosition.ResetNode(); |
| | | } |
| | | } |
| | | |
| | | return action; |
| | | } |
| | |
| | | /// <returns></returns> |
| | | public ApiAction<SubmitOutput> End() |
| | | { |
| | | var action = new ApiAction<SubmitOutput>(); |
| | | var action = new ApiAction<SubmitOutput>(new SubmitOutput()); |
| | | |
| | | //记录行为操作记录 |
| | | var wipActs = new List<MES_WIP_ACT>(); |
| | | foreach (var wipSn in CurPosition.CurWipSNs) |
| | | { |
| | | var wipAct = new MES_WIP_ACT() |
| | | { |
| | | AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, |
| | | AUTH_PROD = CurPosition.CurLine.LINE_CODE, |
| | | HIS_ID = CurPosition.CurWipSNHiss.First(q => q.SN == wipSn.SN).ID, |
| | | SN = wipSn.SN, |
| | | STATUS = wipSn.STATUS, |
| | | ITEM_CODE = wipSn.ITEM_CODE, |
| | | WORK_ORDER = wipSn.WORK_ORDER, |
| | | BATCH_NO = wipSn.BATCH_NO, |
| | | ROT_CODE = wipSn.ROT_CODE, |
| | | NODE_ID = wipSn.NODE_ID, |
| | | NODE_NAME = wipSn.NODE_NAME, |
| | | ACT_ID = NodeAct.ID, |
| | | ACT_NAME = NodeAct.ACT_NAME, |
| | | FTY_CODE = wipSn.FTY_CODE, |
| | | WS_CODE = wipSn.WS_CODE, |
| | | LINE_CODE = wipSn.LINE_CODE, |
| | | POST_CODE = wipSn.POST_CODE, |
| | | OPER_CODE = wipSn.OPER_CODE, |
| | | SEGMENT = wipSn.SEGMENT, |
| | | TRAY_SN = wipSn.TRAY_SN, |
| | | OPERATION_TIME = DateTime.Now, |
| | | SFTS_CODE = wipSn.SFTS_CODE, |
| | | SFT_CODE = wipSn.SFT_CODE, |
| | | PRD_CODE = wipSn.PRD_CODE, |
| | | ACT_TYPE = NodeAct.ACT_TYPE, |
| | | ACT_SN = wipSn.SN, |
| | | ACT_VALUE_1 = "", |
| | | ACT_VALUE_2 = "", |
| | | ACT_VALUE_3 = "", |
| | | ACT_VALUE_4 = "", |
| | | ACT_VALUE_5 = "", |
| | | ACT_RESULT = "Y", |
| | | TRACE_INFO = $"执行成功", |
| | | }; |
| | | wipActs.Add(wipAct); |
| | | } |
| | | |
| | | //保存数据 |
| | | CurStep.DBSubmitAction = () => |
| | | { |
| | | var db = CurPosition.GetCommitDB(); |
| | | db.Storageable(wipActs, CurPosition.UserCode).ExecuteCommand(); |
| | | }; |
| | | |
| | | IsFinished = true; |
| | | action.LocaleMsg = new($"行为结束"); |
| | | //action.LocaleMsg = new("MES.WorkAction.IPQC.Finish"); |
| | | return action; |
| | | } |
| | | /// <summary> |
| | | /// 获取行为提示信息 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ApiAction GetPrompt() |
| | | { |
| | | var action = new ApiAction(); |
| | | action.LocaleMsg = new($"开始打印条码"); |
| | | return action; |
| | | } |
| | | |
| | | |
| | | #endregion Functions |
| | | } |