| | |
| | | public MES_WO_ACTION Setting { get; set; } |
| | | #endregion |
| | | public BAS_WIP_EXT ExtInfo { get; set; } |
| | | public MES_WIP_EXT CurWipExt { get; set; } |
| | | public List<MES_WIP_EXT> CurWipExt { get; set; } |
| | | #endregion Propertys & Variables |
| | | |
| | | #region Functions |
| | |
| | | var seq = Setting.ITEM_CODE.ToInt32(); |
| | | ExtInfo = Biz.Db.Queryable<BAS_WIP_EXT>().Where(q => q.SEQ == seq).First(); |
| | | //获取当前SN的扩展信息 |
| | | CurWipExt = Biz.Db.Queryable<MES_WIP_EXT>().Where(q => q.SN == CurPosition.CurWipSN.SN).First() ?? new () |
| | | CurWipExt = Biz.Db.Queryable<MES_WIP_EXT>().Where(q => CurPosition.CurWipSNs.Any(w => w.SN == q.SN)).ToList(); |
| | | foreach (var wipSN in CurPosition.CurWipSNs) |
| | | { |
| | | AUTH_ORG = CurPosition.CurWipSN.AUTH_ORG, |
| | | AUTH_PROD = CurPosition.CurWipSN.AUTH_PROD, |
| | | SN = CurPosition.CurWipSN.SN, |
| | | }; |
| | | if (!CurWipExt.Any(q => q.SN == wipSN.SN)) |
| | | { |
| | | CurWipExt.Add(new() |
| | | { |
| | | AUTH_ORG = wipSN.AUTH_ORG, |
| | | AUTH_PROD = wipSN.AUTH_PROD, |
| | | SN = wipSN.SN, |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | //action.LocaleMsg = new Locale($"错误:[{ExtInfo.FIELD_NAME}]标签条码不能为空,请重新扫描"); |
| | | action.LocaleMsg = new Locale("MES.WorkAction.WipExtInfo.SnEmptyError", ExtInfo.FIELD_NAME); |
| | | } |
| | | if (input.SN == CurPosition.CurWipSN.SN) |
| | | if (CurPosition.CurWipSNs.Any(w => w.SN == input.SN)) |
| | | { |
| | | action.IsSuccessed = isOK = false; |
| | | //action.LocaleMsg = new Locale($"错误:扫描到产品条码[{input.SN}],请重新扫描[{ExtInfo.FIELD_NAME}]标签条码"); |
| | |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | action.CatchExceptionWithLog(ex, $"扩展信息绑定行为:产品[{CurPosition.CurWipSN.SN}]绑定[{ExtInfo.FIELD_NAME}]标签条码[{input.SN}]保存异常"); |
| | | action.CatchExceptionWithLog(ex, $"扩展信息绑定行为:产品[{CurPosition.CurSN}]绑定[{ExtInfo.FIELD_NAME}]标签条码[{input.SN}]保存异常"); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"产品[{CurPosition.CurWipSN.SN}]绑定[{ExtInfo.FIELD_NAME}]标签条码[{input.SN}]保存异常,工序已重置,请重新扫描进站产品条码"); |
| | | action.LocaleMsg = new("MES.WorkAction.WipExtInfo.SaveExtInfoException", CurPosition.CurWipSN.SN, ExtInfo.FIELD_NAME, input.SN); |
| | | action.LocaleMsg = new("MES.WorkAction.WipExtInfo.SaveExtInfoException", CurPosition.CurSN, ExtInfo.FIELD_NAME, input.SN); |
| | | CurPosition.ResetNode(); |
| | | } |
| | | return action; |
| | |
| | | var action = new ApiAction<SubmitOutput>(new SubmitOutput()); |
| | | |
| | | //记录行为操作记录 |
| | | var wipAct = new MES_WIP_ACT() |
| | | var wipActs = new List<MES_WIP_ACT>(); |
| | | foreach (var wipSn in CurPosition.CurWipSNs) |
| | | { |
| | | AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, |
| | | AUTH_PROD = CurPosition.CurLine.LINE_CODE, |
| | | HIS_ID = CurPosition.CurWipSNHis.ID, |
| | | SN = CurPosition.CurWipSN.SN, |
| | | STATUS = CurPosition.CurWipSN.STATUS, |
| | | ITEM_CODE = CurPosition.CurWipSN.ITEM_CODE, |
| | | WORK_ORDER = CurPosition.CurWipSN.WORK_ORDER, |
| | | BATCH_NO = CurPosition.CurWipSN.BATCH_NO, |
| | | ROT_CODE = CurPosition.CurWipSN.ROT_CODE, |
| | | NODE_ID = CurPosition.CurWipSN.NODE_ID, |
| | | NODE_NAME = CurPosition.CurWipSN.NODE_NAME, |
| | | ACT_ID = NodeAct.ID, |
| | | ACT_NAME = NodeAct.ACT_NAME, |
| | | FTY_CODE = CurPosition.CurWipSN.FTY_CODE, |
| | | WS_CODE = CurPosition.CurWipSN.WS_CODE, |
| | | LINE_CODE = CurPosition.CurWipSN.LINE_CODE, |
| | | POST_CODE = CurPosition.CurWipSN.POST_CODE, |
| | | OPER_CODE = CurPosition.CurWipSN.OPER_CODE, |
| | | SEGMENT = CurPosition.CurWipSN.SEGMENT, |
| | | TRAY_SN = CurPosition.CurWipSN.TRAY_SN, |
| | | OPERATION_TIME = DateTime.Now, |
| | | SFTS_CODE = CurPosition.CurWipSN.SFTS_CODE, |
| | | SFT_CODE = CurPosition.CurWipSN.SFT_CODE, |
| | | PRD_CODE = CurPosition.CurWipSN.PRD_CODE, |
| | | ACT_TYPE = NodeAct.ACT_TYPE, |
| | | ACT_SN = CurPosition.CurWipSN.SN, |
| | | ACT_VALUE_1 = CurWipExt.ToJson(), |
| | | ACT_RESULT = "Y", |
| | | TRACE_INFO = $"产品[{CurPosition.CurWipSN.SN}]绑定[{ExtInfo.FIELD_NAME}]标签条码[{CurWipExt.GetType().GetProperty($"FIELD_{ExtInfo.SEQ.ToString("00")}")?.GetValue(CurWipExt)?.ToString()}]保存成功", |
| | | }; |
| | | 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 = CurWipExt.ToJson(), |
| | | ACT_RESULT = "Y", |
| | | TRACE_INFO = $"产品[{CurPosition.CurSN}]绑定[{ExtInfo.FIELD_NAME}]标签条码[{CurWipExt.GetType().GetProperty($"FIELD_{ExtInfo.SEQ.ToString("00")}")?.GetValue(CurWipExt)?.ToString()}]保存成功", |
| | | }; |
| | | wipActs.Add(wipAct); |
| | | } |
| | | |
| | | //保存数据 |
| | | CurStep.DBSubmitAction = () => |
| | | { |
| | | var db = CurPosition.GetCommitDB(); |
| | | db.Storageable(wipAct, CurPosition.UserCode).ExecuteCommand(); |
| | | db.Storageable(wipActs, CurPosition.UserCode).ExecuteCommand(); |
| | | db.Storageable(CurWipExt, CurPosition.UserCode).ExecuteCommand(); |
| | | }; |
| | | |
| | | IsFinished = true; |
| | | //action.LocaleMsg = new($"产品[{CurPosition.CurWipSN.SN}]绑定[{ExtInfo.FIELD_NAME}]标签条码[{CurWipExt.GetType().GetProperty($"FIELD_{ExtInfo.SEQ.ToString("00")}")?.GetValue(CurWipExt)?.ToString()}]保存成功"); |
| | | action.LocaleMsg = new("MES.WorkAction.WipExtInfo.SaveSuccess", CurPosition.CurWipSN.SN, ExtInfo.FIELD_NAME, CurWipExt.GetType().GetProperty($"FIELD_{ExtInfo.SEQ.ToString("00")}")?.GetValue(CurWipExt)?.ToString()); |
| | | action.LocaleMsg = new("MES.WorkAction.WipExtInfo.SaveSuccess", CurPosition.CurSN, ExtInfo.FIELD_NAME, CurWipExt.GetType().GetProperty($"FIELD_{ExtInfo.SEQ.ToString("00")}")?.GetValue(CurWipExt)?.ToString()); |
| | | return action; |
| | | } |
| | | |