| | |
| | | if (!CurBatch.IsNullOrEmpty() && CurBatch.IsFirstNode(PostCode)) |
| | | { |
| | | action = NodeSubmit(action, input); |
| | | return action; |
| | | //更新工序信息 |
| | | var info = WoContext.GetSnOperInfo(input.SN).Data; |
| | | info.InputQty = OperInfoDic[CurBatch.Batch.BATCH_NO].InputQty; |
| | | action.Data.OperInfo = info; |
| | | } |
| | | //当前岗位在当前工单不是首站,则查找条码已绑定的工单当作当前工单 |
| | | else |
| | |
| | | { |
| | | if (wosns.First().Batch.ACT_LINE != CurLine.LINE_CODE) |
| | | { |
| | | action.Data.ShortMsg = new("产线错误", ShortMessage.Types.Error); |
| | | action.Data.OperInfo = new(); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"条码[{0}]已在产线[{1}]投入生产,请在正确岗位扫描"); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.NotCorrectLine", input.SN, wosns.First().Batch.ACT_LINE); |
| | | return action; |
| | | } |
| | | else |
| | | { |
| | |
| | | var result = await SelectOrder(new() { AuthOption = input.AuthOption, OrderNo = wosns.First().Batch.ORDER_NO }); |
| | | if (!result.IsSuccessed) |
| | | { |
| | | action.Data.ShortMsg = new("工单异常", ShortMessage.Types.Error); |
| | | action.Data.OperInfo = new(); |
| | | action.IsSuccessed = result.IsSuccessed; |
| | | action.LocaleMsg = result.LocaleMsg; |
| | | return action; |
| | | } |
| | | } |
| | | //条码过站 |
| | | action = NodeSubmit(action, input); |
| | | return action; |
| | | action = NodeSubmit(action, input); |
| | | action.Data.OperInfo = SetOperNodeInfo(OperInfoDic[CurBatch.Batch.BATCH_NO]); |
| | | } |
| | | } |
| | | //查找不到条码已绑定的工单 |
| | |
| | | //没有当前工单,则先选择工单后再扫描条码 |
| | | if (CurBatch.IsNullOrEmpty()) |
| | | { |
| | | action.Data.ShortMsg = new("未选择工单", ShortMessage.Types.Error); |
| | | action.Data.OperInfo = new(); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"未选择工单,请先选择要生产的工单"); |
| | | action.LocaleMsg = new("MES.Transaction.CollectNode.Submit.NotSelectOrderException"); |
| | | return action; |
| | | } |
| | | //有当前工单且不是投入,则提示条码未投入生产,请先去首站扫描 |
| | | else |
| | | { |
| | | action.Data.ShortMsg = new("未投入生产", ShortMessage.Types.Error); |
| | | action.Data.OperInfo = new(); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"条码[{input.SN}]尚未投入生产,请先去首站扫描", input.SN); |
| | | action.LocaleMsg = new("MES.Transaction.CollectNode.Submit.NotInputException", input.SN); |
| | | return action; |
| | | } |
| | | } |
| | | } |
| | |
| | | if (submitStep.IsNullOrEmpty()) |
| | | { |
| | | action = BeginNextActionStep(input); |
| | | return action; |
| | | action.Data.OperInfo = OperInfoDic[CurBatch.Batch.BATCH_NO]; |
| | | } |
| | | else |
| | | { |
| | |
| | | //如果所有工步都完成 |
| | | if (IsFinishAllSteps) |
| | | { |
| | | return DoIfFinishAllSteps(result); |
| | | result = DoIfFinishAllSteps(result); |
| | | } |
| | | result.Data.OperInfo = OperInfoDic[CurBatch.Batch.BATCH_NO]; |
| | | return result; |
| | | } |
| | | } |
| | | //没有可执行的工步 |
| | | ResetNode(); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"岗位[{CurPosition.POST_CODE}]工步执行异常,请重新扫描产品条码", CurPosition.POST_CODE); |
| | | action.LocaleMsg = new("MES.Transaction.CollectNode.Submit.WorkStepException", CurPosition.POST_CODE); |
| | | else |
| | | { |
| | | action.Data.ShortMsg = new("重置扫描", ShortMessage.Types.Error); |
| | | action.Data.OperInfo = OperInfoDic.ContainsKey(CurBatch?.Batch?.BATCH_NO ?? "") ? OperInfoDic[CurBatch.Batch.BATCH_NO] : new(); |
| | | ResetNode(); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"岗位[{CurPosition.POST_CODE}]工步执行异常,请重新扫描产品条码", CurPosition.POST_CODE); |
| | | action.LocaleMsg = new("MES.Transaction.CollectNode.Submit.WorkStepException", CurPosition.POST_CODE); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | action.Data.ShortMsg = new("工序异常", ShortMessage.Types.Error); |
| | | action.Data.OperInfo = OperInfoDic.ContainsKey(CurBatch?.Batch?.BATCH_NO ?? "") ? OperInfoDic[CurBatch.Batch.BATCH_NO] : new(); |
| | | ResetNode(); |
| | | //action.CatchExceptionWithLog(ex, $"采集工序:提交操作数据异常"); |
| | | action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.CollectNode.SubmitException")); |
| | | } |
| | |
| | | var woStatus = CurBatch.CheckCanProduce(curNode); |
| | | if (!woStatus.IsSuccessed) |
| | | { |
| | | woStatus.Data.ShortMsg = new("工单异常", ShortMessage.Types.Error); |
| | | return woStatus; |
| | | } |
| | | //非法过站防呆:进入工序时要增加判断条码是否按流程过站 |
| | | |
| | | var wipSNs = Biz.Db.Queryable<MES_WIP_DATA>().IncludesAllFirstLayer().Where(q => (q.SN == input.SN || q.TRAY_SN == input.SN) && q.WORK_ORDER == CurBatch.WO.ORDER_NO).ToList(); |
| | | if (wipSNs.IsNullOrEmpty()) |
| | | { |
| | |
| | | }; |
| | | wipSNs.Add(wipSN); |
| | | } |
| | | |
| | | //如果条码不是当前工单或者产线的则报错 |
| | | if (wipSNs.Any(q => q.WORK_ORDER != CurBatch.WO.ORDER_NO || q.LINE_CODE != CurLine.LINE_CODE)) |
| | | { |
| | | if (wipSNs.First().LINE_CODE == CurLine.LINE_CODE) |
| | | { |
| | | action.Data.ShortMsg = new("工单错误", ShortMessage.Types.Error); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"产品[{CurSN}]不属于当前工单,请切换到工单[{wipSNs.First().WORK_ORDER}]后再扫描"); |
| | | action.LocaleMsg = new("MES.Transaction.CollectNode.NodeSubmit.WoError", CurSN, wipSNs.First().WORK_ORDER); |
| | | return action; |
| | | } |
| | | else |
| | | { |
| | | action.Data.ShortMsg = new("产线错误", ShortMessage.Types.Error); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"产品[{CurSN}]已在产线[{wipSNs.First().LINE_CODE}]投产,请到产线[{wipSNs.First().LINE_CODE}]扫描"); |
| | | action.LocaleMsg = new("MES.Transaction.CollectNode.NodeSubmit.LineError", CurSN, wipSNs.First().LINE_CODE); |
| | | return action; |
| | | } |
| | | } |
| | | |
| | | //非法过站防呆:进入工序时要增加判断条码是否按流程过站 |
| | | var canGotoNext = CurBatch.CanGotoNext(input, wipSNs.First(), curNode); |
| | | if (!canGotoNext.IsSuccessed) |
| | | { |
| | | woStatus.Data.ShortMsg = new("进站错误", ShortMessage.Types.Error); |
| | | return canGotoNext; |
| | | } |
| | | |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | action.Data.ShortMsg = new("工步异常", ShortMessage.Types.Error); |
| | | ResetNode(); |
| | | action.CatchExceptionWithLog(ex, $"采集工序:工序节点工步提交数据异常"); |
| | | //action.CatchExceptionWithLog(ex, $"{curNode.NODE_NAME}:工序节点工步提交数据异常,请检查工序节点设置"); |
| | | action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.CollectNode.NodeSubmitException", curNode.NODE_NAME)); |
| | | } |
| | |
| | | SaveStepsCommitActionToDB(); |
| | | |
| | | //保存成功,返回过站消息 |
| | | OperInfoDic[CurBatch.Batch.BATCH_NO].InputQty += CurWipSNs.Count; |
| | | action.Data.ShortMsg = new("过站成功", ShortMessage.Types.Success); |
| | | //action.LocaleMsg = new($"工单[{CurWipSN.WORK_ORDER}]的条码[{CurWipSN.SN}]在岗位[{CurWipSN.POST_CODE}]工序[{CurWipSN.NODE_NAME}]过站成功,状态[{CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()}]"); |
| | | action.LocaleMsg = new("MES.Transaction.CollectNode.ScanSn.PassSuccess", CurWipSNs.First().WORK_ORDER, CurSN, CurWipSNs.First().POST_CODE, CurWipSNs.First().NODE_NAME,CurWipSNs.First().STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()); |
| | | //重置工序 |
| | |
| | | //如果行为被标记成已完成,则重置工序 |
| | | if (TempPkgAction.IsFinished) |
| | | { |
| | | action.Data.OperInfo = OperInfoDic.ContainsKey(CurBatch?.Batch?.BATCH_NO ?? "") ? OperInfoDic[CurBatch.Batch.BATCH_NO] : new(); |
| | | ResetNode(); |
| | | } |
| | | return action; |
| | | } |
| | | //NodeSubmit:产品过站,正常产品过站逻辑 |
| | | else |
| | |
| | | if (!CurBatch.IsNullOrEmpty() && CurBatch.IsFirstNode(PostCode)) |
| | | { |
| | | action = NodeSubmit(action, input); |
| | | return action; |
| | | //更新工序信息 |
| | | var info = WoContext.GetSnOperInfo(input.SN).Data; |
| | | info.InputQty = OperInfoDic[CurBatch.Batch.BATCH_NO].InputQty; |
| | | action.Data.OperInfo = info; |
| | | } |
| | | //当前岗位在当前工单不是首站,则查找条码已绑定的工单当作当前工单 |
| | | else |
| | |
| | | { |
| | | if (wosns.Count > 1 && wosns.Any(q => q.SN.TRAY_SN != q.SN.OUTER_SN)) |
| | | { |
| | | action.Data.ShortMsg = new("请扫描产品", ShortMessage.Types.Error); |
| | | action.Data.OperInfo = new(); |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = new($"条码[{0}]是载具条码,请扫描载具中的产品条码继续包装操作"); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.OnlyMinPackage", input.SN); |
| | |
| | | } |
| | | if (wosns.First().Batch.ACT_LINE != CurLine.LINE_CODE) |
| | | { |
| | | action.Data.ShortMsg = new("产线错误", ShortMessage.Types.Error); |
| | | action.Data.OperInfo = new(); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"条码[{0}]已在产线[{1}]投入生产,请在正确岗位扫描"); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.NotCorrectLine", input.SN, wosns.First().Batch.ACT_LINE); |
| | | return action; |
| | | } |
| | | else |
| | | { |
| | |
| | | var result = await SelectOrder(new() { AuthOption = input.AuthOption, OrderNo = wosns.First().Batch.ORDER_NO }); |
| | | if (!result.IsSuccessed) |
| | | { |
| | | action.IsSuccessed = result.IsSuccessed; |
| | | action.Data.ShortMsg = new("工单异常", ShortMessage.Types.Error); |
| | | action.Data.OperInfo = new(); |
| | | action.IsSuccessed = result.IsSuccessed; |
| | | action.LocaleMsg = result.LocaleMsg; |
| | | return action; |
| | | } |
| | | } |
| | | //条码过站 |
| | | action = NodeSubmit(action, input); |
| | | return action; |
| | | action.Data.OperInfo = SetOperNodeInfo(OperInfoDic[CurBatch.Batch.BATCH_NO]); |
| | | } |
| | | } |
| | | //查找不到条码已绑定的工单 |
| | |
| | | //没有当前工单,则先选择工单后再扫描条码 |
| | | if (CurBatch.IsNullOrEmpty()) |
| | | { |
| | | action.Data.ShortMsg = new("未选择工单", ShortMessage.Types.Error); |
| | | action.Data.OperInfo = new(); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"未选择工单,请先选择要生产的工单"); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.NotSelectOrderException"); |
| | | return action; |
| | | } |
| | | //有当前工单且不是投入,则提示条码未投入生产,请先去首站扫描 |
| | | else |
| | | { |
| | | action.Data.ShortMsg = new("未投入生产", ShortMessage.Types.Error); |
| | | action.Data.OperInfo = new(); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"条码[{input.SN}]尚未投入生产,请先去首站扫描", input.SN); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.NotInputException", input.SN); |
| | | return action; |
| | | } |
| | | } |
| | | } |
| | |
| | | if (submitStep.IsNullOrEmpty()) |
| | | { |
| | | action = BeginNextActionStep(input); |
| | | return action; |
| | | action.Data.OperInfo = OperInfoDic[CurBatch.Batch.BATCH_NO]; |
| | | } |
| | | else |
| | | { |
| | |
| | | //如果所有工步都完成 |
| | | if (IsFinishAllSteps) |
| | | { |
| | | return DoIfFinishAllSteps(result); |
| | | result = DoIfFinishAllSteps(result); |
| | | } |
| | | result.Data.OperInfo = OperInfoDic[CurBatch.Batch.BATCH_NO]; |
| | | return result; |
| | | } |
| | | } |
| | | //没有可执行的工步 |
| | | ResetNode(); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"岗位[{CurPosition.POST_CODE}]工步执行异常,请重新扫描产品条码", CurPosition.POST_CODE); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.WorkStepException", CurPosition.POST_CODE); |
| | | else |
| | | { |
| | | action.Data.ShortMsg = new("重置扫描", ShortMessage.Types.Error); |
| | | action.Data.OperInfo = OperInfoDic.ContainsKey(CurBatch?.Batch?.BATCH_NO ?? "") ? OperInfoDic[CurBatch.Batch.BATCH_NO] : new(); |
| | | ResetNode(); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"岗位[{CurPosition.POST_CODE}]工步执行异常,请重新扫描产品条码", CurPosition.POST_CODE); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.WorkStepException", CurPosition.POST_CODE); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | action.Data.ShortMsg = new("工序异常", ShortMessage.Types.Error); |
| | | action.Data.OperInfo = OperInfoDic.ContainsKey(CurBatch?.Batch?.BATCH_NO ?? "") ? OperInfoDic[CurBatch.Batch.BATCH_NO] : new(); |
| | | //action.CatchExceptionWithLog(ex, $"包装工序:提交操作数据异常"); |
| | | action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.PackingNode.SubmitException")); |
| | | } |
| | |
| | | var woStatus = CurBatch.CheckCanProduce(curNode); |
| | | if (!woStatus.IsSuccessed) |
| | | { |
| | | woStatus.Data.ShortMsg = new("工单异常", ShortMessage.Types.Error); |
| | | return woStatus; |
| | | } |
| | | //非法过站防呆:进入工序时要增加判断条码是否按流程过站 |
| | | |
| | | var wipSNs = Biz.Db.Queryable<MES_WIP_DATA>().IncludesAllFirstLayer().Where(q => (q.SN == input.SN || q.TRAY_SN == input.SN) && q.WORK_ORDER == CurBatch.WO.ORDER_NO).ToList(); |
| | | if (wipSNs.IsNullOrEmpty()) |
| | | { |
| | |
| | | }; |
| | | wipSNs.Add(wipSN); |
| | | } |
| | | |
| | | //如果条码不是当前工单或者产线的则报错 |
| | | if (wipSNs.Any(q => q.WORK_ORDER != CurBatch.WO.ORDER_NO || q.LINE_CODE != CurLine.LINE_CODE)) |
| | | { |
| | | if (wipSNs.First().LINE_CODE == CurLine.LINE_CODE) |
| | | { |
| | | action.Data.ShortMsg = new("工单错误", ShortMessage.Types.Error); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"产品[{CurSN}]不属于当前工单,请切换到工单[{wipSNs.First().WORK_ORDER}]后再扫描"); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.NodeSubmit.WoError", CurSN, wipSNs.First().WORK_ORDER); |
| | | return action; |
| | | } |
| | | else |
| | | { |
| | | action.Data.ShortMsg = new("产线错误", ShortMessage.Types.Error); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"产品[{CurSN}]已在产线[{wipSNs.First().LINE_CODE}]投产,请到产线[{wipSNs.First().LINE_CODE}]扫描"); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.NodeSubmit.LineError", CurSN, wipSNs.First().LINE_CODE); |
| | | return action; |
| | | } |
| | | } |
| | | |
| | | //非法过站防呆:进入工序时要增加判断条码是否按流程过站 |
| | | var canGotoNext = CurBatch.CanGotoNext(input, wipSNs.First(), curNode); |
| | | if (!canGotoNext.IsSuccessed) |
| | | { |
| | | woStatus.Data.ShortMsg = new("进站错误", ShortMessage.Types.Error); |
| | | return canGotoNext; |
| | | } |
| | | |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | action.Data.ShortMsg = new("工步异常", ShortMessage.Types.Error); |
| | | ResetNode(); |
| | | //action.CatchExceptionWithLog(ex, $"{curNode.NODE_NAME}:工序节点工步提交数据异常,请检查工序节点设置"); |
| | | action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.PackingNode.NodeSubmitException", curNode.NODE_NAME)); |
| | |
| | | SaveStepsCommitActionToDB(); |
| | | |
| | | //保存成功,返回过站消息 |
| | | OperInfoDic[CurBatch.Batch.BATCH_NO].InputQty += CurWipSNs.Count; |
| | | action.Data.ShortMsg = new("过站成功", ShortMessage.Types.Success); |
| | | //action.LocaleMsg = new($"工单[{CurWipSN.WORK_ORDER}]的条码[{CurWipSN.SN}]在岗位[{CurWipSN.POST_CODE}]工序[{CurWipSN.NODE_NAME}]过站成功,状态[{CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()}]"); |
| | | action.LocaleMsg = new("MES.Transaction.CollectNode.ScanSn.PassSuccess", CurWipSNs.First().WORK_ORDER, CurSN, CurWipSNs.First().POST_CODE, CurWipSNs.First().NODE_NAME,CurWipSNs.First().STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()); |
| | | //重置工序 |
| | | //if (!isClone) |
| | | { |
| | | ResetNode(); |
| | | } |
| | | ResetNode(); |
| | | |
| | | return action; |
| | | } |
| | |
| | | public WorkBatch CurBatch { get; set; } |
| | | public IWorkBatch WorkBatch => CurBatch; |
| | | public List<MES_WIP_DATA> CurWipSNs { get; set; } = new(); |
| | | public string CurSN => CurWipSNs.Any() ? (CurWipSNs.First().TRAY_SN.IsNullOrEmpty() ? CurWipSNs.First().SN : CurWipSNs.First().TRAY_SN) : ""; |
| | | public string CurSN => (CurWipSNs.Any() ? (CurWipSNs.First().TRAY_SN.IsNullOrEmpty() ? CurWipSNs.First().SN : CurWipSNs.First().TRAY_SN) : ""); |
| | | public List<MES_WIP_HIS> CurWipSNHiss { get; set; } = new(); |
| | | public List<MES_WIP_DFT> CurDefects { get; set; } = new(); |
| | | public Dictionary<string, object> Context { get; set; } = new(); |
| | |
| | | public bool NeedTemporaryStoreDBCommitAction { get; set; } = false; |
| | | protected 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; } |
| | | #endregion Propertys & Variables |
| | | |
| | | #region Functions |
| | |
| | | WoContext.WoBatchDic.Add(wb.Batch.BATCH_NO, wb); |
| | | } |
| | | CurBatch = WoContext.GetBatch(input.OrderNo, CurLine.LINE_CODE); |
| | | OperInfoDic.Add(CurBatch.Batch.BATCH_NO, new()); |
| | | action.Data = new { WorkOrder = CurBatch.WO, Bacth = CurBatch.Batch }; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置当前条码的工序信息 |
| | | /// </summary> |
| | | public OperInfo SetOperNodeInfo(OperInfo info) |
| | | { |
| | | if (CurWipSNs.Any()) |
| | | { |
| | | info.CurNode = CurWipSNs.First().NODE_NAME; |
| | | info.NextNode = string.Join(",", CurBatch.GetNextNodes(CurWipSNs.First()).Select(q => q.NODE_NAME)); |
| | | } |
| | | else |
| | | { |
| | | info.CurNode = " — "; |
| | | info.NextNode = " — "; |
| | | } |
| | | return info; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 生成传入工步后续的行为到工步列表 |
| | | /// </summary> |
| | | /// <param name="parent"></param> |
| | |
| | | public async Task<ApiAction<SubmitOutput>> Submit(SubmitInput input) |
| | | { |
| | | var action = new ApiAction<SubmitOutput>(new SubmitOutput()); |
| | | |
| | | try |
| | | { |
| | | //工步列表为空或者工序节点工步有未完成时,优先完成工序节点工步 |
| | |
| | | if (!CurBatch.IsNullOrEmpty() && CurBatch.IsFirstNode(PostCode)) |
| | | { |
| | | action = NodeSubmit(action, input); |
| | | return action; |
| | | //更新工序信息 |
| | | var info = WoContext.GetSnOperInfo(input.SN).Data; |
| | | info.InputQty = OperInfoDic[CurBatch.Batch.BATCH_NO].InputQty; |
| | | action.Data.OperInfo = info; |
| | | } |
| | | //当前岗位在当前工单不是首站,则查找条码已绑定的工单当作当前工单 |
| | | else |
| | |
| | | { |
| | | if (wosns.First().Batch.ACT_LINE != CurLine.LINE_CODE) |
| | | { |
| | | action.Data.ShortMsg = new("产线错误", ShortMessage.Types.Error); |
| | | action.Data.OperInfo = new(); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"条码[{0}]已在产线[{1}]投入生产,请在正确岗位扫描"); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.NotCorrectLine", input.SN, wosns.First().Batch.ACT_LINE); |
| | | return action; |
| | | } |
| | | else |
| | | { |
| | |
| | | var result = await SelectOrder(new() { AuthOption = input.AuthOption, OrderNo = wosns.First().Batch.ORDER_NO }); |
| | | if (!result.IsSuccessed) |
| | | { |
| | | action.Data.ShortMsg = new("工单异常", ShortMessage.Types.Error); |
| | | action.Data.OperInfo = new(); |
| | | action.IsSuccessed = result.IsSuccessed; |
| | | action.LocaleMsg = result.LocaleMsg; |
| | | return action; |
| | |
| | | } |
| | | //条码过站 |
| | | action = NodeSubmit(action, input); |
| | | return action; |
| | | action.Data.OperInfo = SetOperNodeInfo(OperInfoDic[CurBatch.Batch.BATCH_NO]); |
| | | } |
| | | } |
| | | //查找不到条码已绑定的工单 |
| | |
| | | //没有当前工单,则先选择工单后再扫描条码 |
| | | if (CurBatch.IsNullOrEmpty()) |
| | | { |
| | | action.Data.ShortMsg = new("未选择工单", ShortMessage.Types.Error); |
| | | action.Data.OperInfo = new(); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"未选择工单,请先选择要生产的工单"); |
| | | action.LocaleMsg = new("MES.Transaction.TestNode.Submit.NotSelectOrderException"); |
| | | return action; |
| | | } |
| | | //有当前工单且不是投入,则提示条码未投入生产,请先去首站扫描 |
| | | else |
| | | { |
| | | action.Data.ShortMsg = new("未投入生产", ShortMessage.Types.Error); |
| | | action.Data.OperInfo = new(); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"条码[{input.SN}]尚未投入生产,请先去首站扫描", input.SN); |
| | | action.LocaleMsg = new("MES.Transaction.TestNode.Submit.NotInputException", input.SN); |
| | | return action; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //完成第一步,后开始执行当前工序的行为列表 |
| | | //完成工序节点工步后,后开始执行当前工序的行为工步 |
| | | //完成工序节点工步后,开始执行当前工序的行为工步 |
| | | else if (IsFinishNodeSteps && !IsFinishAllSteps) |
| | | { |
| | | var submitStep = Steps.Where(q => q.ID == input.CurStepID && !q.IsFinished).FirstOrDefault(); |
| | | if (submitStep.IsNullOrEmpty()) |
| | | { |
| | | action = BeginNextActionStep(input); |
| | | return action; |
| | | action.Data.OperInfo = OperInfoDic[CurBatch.Batch.BATCH_NO]; |
| | | } |
| | | else |
| | | { |
| | |
| | | //如果所有工步都完成 |
| | | if (IsFinishAllSteps) |
| | | { |
| | | return DoIfFinishAllSteps(result); |
| | | result = DoIfFinishAllSteps(result); |
| | | } |
| | | result.Data.OperInfo = OperInfoDic[CurBatch.Batch.BATCH_NO]; |
| | | return result; |
| | | } |
| | | } |
| | | //没有可执行的工步 |
| | | ResetNode(); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"岗位[{CurPosition.POST_CODE}]工步执行异常,请重新扫描产品条码", CurPosition.POST_CODE); |
| | | action.LocaleMsg = new("MES.Transaction.TestNode.Submit.WorkStepException", CurPosition.POST_CODE); |
| | | else |
| | | { |
| | | action.Data.ShortMsg = new("重置扫描", ShortMessage.Types.Error); |
| | | action.Data.OperInfo = OperInfoDic.ContainsKey(CurBatch?.Batch?.BATCH_NO ?? "") ? OperInfoDic[CurBatch.Batch.BATCH_NO] : new(); |
| | | ResetNode(); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"岗位[{CurPosition.POST_CODE}]工步执行异常,请重新扫描产品条码", CurPosition.POST_CODE); |
| | | action.LocaleMsg = new("MES.Transaction.TestNode.Submit.WorkStepException", CurPosition.POST_CODE); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | action.Data.ShortMsg = new("工序异常", ShortMessage.Types.Error); |
| | | action.Data.OperInfo = OperInfoDic.ContainsKey(CurBatch?.Batch?.BATCH_NO ?? "") ? OperInfoDic[CurBatch.Batch.BATCH_NO] : new(); |
| | | //action.CatchExceptionWithLog(ex, $"测试工序:提交操作数据异常"); |
| | | action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.TestNode.SubmitException")); |
| | | } |
| | |
| | | var woStatus = CurBatch.CheckCanProduce(curNode); |
| | | if (!woStatus.IsSuccessed) |
| | | { |
| | | woStatus.Data.ShortMsg = new("工单异常", ShortMessage.Types.Error); |
| | | return woStatus; |
| | | } |
| | | //非法过站防呆:进入工序时要增加判断条码是否按流程过站 |
| | | |
| | | var wipSNs = Biz.Db.Queryable<MES_WIP_DATA>().IncludesAllFirstLayer().Where(q => (q.SN == input.SN || q.TRAY_SN == input.SN) && q.WORK_ORDER == CurBatch.WO.ORDER_NO).ToList(); |
| | | if (wipSNs.IsNullOrEmpty()) |
| | | { |
| | |
| | | }; |
| | | wipSNs.Add(wipSN); |
| | | } |
| | | |
| | | //如果条码不是当前工单或者产线的则报错 |
| | | if (wipSNs.Any(q => q.WORK_ORDER != CurBatch.WO.ORDER_NO || q.LINE_CODE != CurLine.LINE_CODE)) |
| | | { |
| | | if (wipSNs.First().LINE_CODE == CurLine.LINE_CODE) |
| | | { |
| | | action.Data.ShortMsg = new("工单错误", ShortMessage.Types.Error); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"产品[{CurSN}]不属于当前工单,请切换到工单[{wipSNs.First().WORK_ORDER}]后再扫描"); |
| | | action.LocaleMsg = new("MES.Transaction.TestNode.NodeSubmit.WoError", CurSN, wipSNs.First().WORK_ORDER); |
| | | return action; |
| | | } |
| | | else |
| | | { |
| | | action.Data.ShortMsg = new("产线错误", ShortMessage.Types.Error); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"产品[{CurSN}]已在产线[{wipSNs.First().LINE_CODE}]投产,请到产线[{wipSNs.First().LINE_CODE}]扫描"); |
| | | action.LocaleMsg = new("MES.Transaction.TestNode.NodeSubmit.LineError", CurSN, wipSNs.First().LINE_CODE); |
| | | return action; |
| | | } |
| | | } |
| | | |
| | | //非法过站防呆:进入工序时要增加判断条码是否按流程过站 |
| | | var canGotoNext = CurBatch.CanGotoNext(input, wipSNs.First(), curNode); |
| | | if (!canGotoNext.IsSuccessed) |
| | | { |
| | | woStatus.Data.ShortMsg = new("进站错误", ShortMessage.Types.Error); |
| | | return canGotoNext; |
| | | } |
| | | |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | action.Data.ShortMsg = new("工步异常", ShortMessage.Types.Error); |
| | | ResetNode(); |
| | | //action.CatchExceptionWithLog(ex, $"{curNode.NODE_NAME}:工序节点工步提交数据异常,请检查工序节点设置"); |
| | | action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.TestNode.NodeSubmitException", curNode.NODE_NAME)); |
| | |
| | | SaveStepsCommitActionToDB(); |
| | | |
| | | //保存成功,返回过站消息 |
| | | OperInfoDic[CurBatch.Batch.BATCH_NO].InputQty += CurWipSNs.Count; |
| | | action.Data.ShortMsg = new("过站成功", ShortMessage.Types.Success); |
| | | //action.LocaleMsg = new($"工单[{CurWipSN.WORK_ORDER}]的条码[{CurWipSN.SN}]在岗位[{CurWipSN.POST_CODE}]工序[{CurWipSN.NODE_NAME}]过站成功,状态[{CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()}]"); |
| | | action.LocaleMsg = new("MES.Transaction.CollectNode.ScanSn.PassSuccess", CurWipSNs.First().WORK_ORDER, CurSN, CurWipSNs.First().POST_CODE, CurWipSNs.First().NODE_NAME, CurWipSNs.First().STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()); |
| | | //重置工序 |
| | |
| | | |
| | | //如果返回成功则认为当前行为可以开始执行,否则返回失败 |
| | | action.IsSuccessed = false; |
| | | action.Data.ShortMsg = new("等待上料", ShortMessage.Types.Normal); |
| | | return action; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | action.IsSuccessed = true; |
| | | action.Data.Data = CurAssembly; |
| | | action.Data.ShortMsg = new("上料成功", ShortMessage.Types.Success); |
| | | action.Data.Data = CurAssembly; |
| | | //action.LocaleMsg = new Locale($"扫描物料[{item.ItemInfo.ITEM_NAME}({item.ItemInfo.ITEM_CODE})的条码[{input.SN}]成功,请继续上料"); |
| | | action.LocaleMsg = new Locale("MES.WorkAction.Assembly.LoadSuccess", item.ItemInfo.ITEM_NAME, item.ItemInfo.ITEM_CODE); |
| | | |
| | |
| | | } |
| | | //都没有物料验证通过,则返回错误信息 |
| | | action.IsSuccessed = false; |
| | | action.Data.ShortMsg = new("上料失败", ShortMessage.Types.Failed); |
| | | //action.LocaleMsg = new($"条码[{input.SN}]验证失败,不是以下物料的条码:{string.Join(",", CurAssembly.Items.Where(q => !q.IsFinished).Select(q => $"{q.ItemInfo.ITEM_NAME}({q.ItemInfo.ITEM_CODE})"))}"); |
| | | action.LocaleMsg = new("MES.WorkAction.Assembly.LoadFail", input.SN, string.Join(",", CurAssembly.Items.Where(q => !q.IsFinished).Select(q => $"{q.ItemInfo.ITEM_NAME}({q.ItemInfo.ITEM_CODE})"))); |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | action.Data.ShortMsg = new("上料异常", ShortMessage.Types.Exception); |
| | | action.CatchExceptionWithLog(ex, $"上料行为:验证条码[{input.SN}]并保存数据异常"); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"验证条码[{input.SN}]并保存数据异常,工序已重置,请重新扫描进站产品条码"); |
| | |
| | | }; |
| | | |
| | | IsFinished = true; |
| | | action.Data.ShortMsg = new("上料完成", ShortMessage.Types.Success); |
| | | //action.LocaleMsg = new($"以下物料上料完成:{string.Join(",", CurAssembly.Items.Select(q => $"{q.ItemInfo.ITEM_NAME}({q.ItemInfo.ITEM_CODE})"))}"); |
| | | action.LocaleMsg = new("MES.WorkAction.Assembly.LoadFinish", string.Join(",", CurAssembly.Items.Select(q => $"{q.ItemInfo.ITEM_NAME}({q.ItemInfo.ITEM_CODE})"))); |
| | | return action; |
| | |
| | | |
| | | //如果根据输入可以开始执行当前行为则标记为成功,否则失败 |
| | | action.IsSuccessed = false; |
| | | action.Data.ShortMsg = new("打印开始", ShortMessage.Types.Success); |
| | | return action; |
| | | } |
| | | /// <summary> |
| | |
| | | //提交数据执行失败 |
| | | else |
| | | { |
| | | action.Data.ShortMsg = new("测试失败", ShortMessage.Types.Failed); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"执行失败"); |
| | | action.LocaleMsg = new("MES.WorkAction.IPQC.Fail"); |
| | |
| | | }; |
| | | |
| | | IsFinished = true; |
| | | action.LocaleMsg = new($"行为结束"); |
| | | action.Data.ShortMsg = new("测试完成", ShortMessage.Types.Success); |
| | | action.LocaleMsg = new($"测试结束"); |
| | | //action.LocaleMsg = new("MES.WorkAction.IPQC.Finish"); |
| | | return action; |
| | | } |
| | |
| | | CurCmd = data; |
| | | PrintTimes++; |
| | | action.Data.Data = data; |
| | | action.Data.ShortMsg = new("打印标签", ShortMessage.Types.Normal); |
| | | //action.LocaleMsg = new Locale($"开始第{PrintTimes}次打印第{min.PKG_LEVEL}层包装[{min.PkgType.PKG_NAME}]的标签[{LabelDic[min.PKG_LEVEL]?.LABEL_CODE}: {LabelDic[min.PKG_LEVEL].LABEL_NAME}]"); |
| | | action.LocaleMsg = new Locale("MES.WorkAction.PackingAction.BeginPrint", PrintTimes, min.PKG_LEVEL, min.PkgType.PKG_NAME, LabelDic[min.PKG_LEVEL]?.LABEL_CODE, LabelDic[min.PKG_LEVEL].LABEL_NAME); |
| | | } |
| | |
| | | if (!pInput.IsFinish || pInput.PkgSN.IsNullOrEmpty()) |
| | | { |
| | | var dtl = PkgRule.Details.First(q => q.PKG_LEVEL == pInput.PkgLevel); |
| | | action.Data.ShortMsg = new("扫描错误", ShortMessage.Types.Error); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"条码扫描失败,请重新扫描第{dtl.PKG_LEVEL}层包装[{dtl.PkgType.PKG_NAME}]的标签条码"); |
| | | action.LocaleMsg = new("MES.WorkAction.PackingAction.ScanFail", dtl.PKG_LEVEL, dtl.PkgType.PKG_NAME); |
| | |
| | | if (GetPackageList(CurPkg.Item).Any(q => q.SN == pInput.PkgSN)) |
| | | { |
| | | var dtl = PkgRule.Details.First(q => q.PKG_LEVEL == pInput.PkgLevel); |
| | | action.Data.ShortMsg = new("扫描错误", ShortMessage.Types.Error); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"条码[{pInput.PkgSN}]无需重复扫描,请扫描第{dtl.PKG_LEVEL}层包装[{dtl.PkgType.PKG_NAME}]的标签条码"); |
| | | action.LocaleMsg = new("MES.WorkAction.PackingAction.ScanRepeat", pInput.PkgSN, dtl.PKG_LEVEL, dtl.PkgType.PKG_NAME); |
| | |
| | | CurCmd = null; |
| | | PrintTimes = 0; |
| | | action = SavePkgData(input, action); |
| | | if (action.IsSuccessed) |
| | | { |
| | | action.Data.ShortMsg = new("扫描成功", ShortMessage.Types.Success); |
| | | } |
| | | } |
| | | break; |
| | | //Print:打印,打印当前包装层级的标签 |
| | |
| | | data.PkgLevel = dtl.PKG_LEVEL; |
| | | CurCmd = data; |
| | | action.Data.Data = data; |
| | | action.Data.ShortMsg = new("扫描标签", ShortMessage.Types.Normal); |
| | | //action.LocaleMsg = new($"请扫描第{dtl.PKG_LEVEL}层包装[{dtl.PkgType.PKG_NAME}]的标签条码"); |
| | | action.LocaleMsg = new("MES.WorkAction.PackingAction.PleaseScanLabel", dtl.PKG_LEVEL, dtl.PkgType.PKG_NAME); |
| | | } |
| | |
| | | { |
| | | PrintTimes++; |
| | | action.Data.Data = CurCmd; |
| | | action.Data.ShortMsg = new("重新打印", ShortMessage.Types.Normal); |
| | | //action.LocaleMsg = new Locale($"开始{PrintTimes}次打印第{dtl.PKG_LEVEL}层包装[{dtl.PkgType.PKG_NAME}]的标签[{LabelDic[dtl.PKG_LEVEL]?.LABEL_CODE}: {LabelDic[dtl.PKG_LEVEL].LABEL_NAME}]"); |
| | | action.LocaleMsg = new Locale("MES.WorkAction.PackingAction.BeginPrint", PrintTimes, dtl.PKG_LEVEL, dtl.PkgType.PKG_NAME, LabelDic[dtl.PKG_LEVEL]?.LABEL_CODE, LabelDic[dtl.PKG_LEVEL].LABEL_NAME); |
| | | } |
| | |
| | | { |
| | | CurCmd = null; |
| | | PrintTimes = 0; |
| | | action.Data.ShortMsg = new("打印失败", ShortMessage.Types.Failed); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"尝试第{PrintTimes}次打印第{dtl.PKG_LEVEL}层包装[{dtl.PkgType.PKG_NAME}]的标签[{LabelDic[dtl.PKG_LEVEL]?.LABEL_CODE}: {LabelDic[dtl.PKG_LEVEL].LABEL_NAME}]失败,工序已重置,请重新扫描进站产品条码"); |
| | | action.LocaleMsg = new("MES.WorkAction.PackingAction.PrintFail3Times", PrintTimes, dtl.PKG_LEVEL, dtl.PkgType.PKG_NAME, LabelDic[dtl.PKG_LEVEL]?.LABEL_CODE, LabelDic[dtl.PKG_LEVEL].LABEL_NAME); |
| | |
| | | data.PkgLevel = CurPkgItem.PKG_LEVEL; |
| | | CurCmd = data; |
| | | action.Data.Data = data; |
| | | action.Data.ShortMsg = new("包装成功", ShortMessage.Types.Success); |
| | | //action.LocaleMsg = new($"请把包装[{CurPkgItem.Package.SN}]上称称重"); |
| | | action.LocaleMsg = new("MES.WorkAction.PackingAction.PleaseWeighing", CurPkgItem.Package.SN); |
| | | } |
| | |
| | | else |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.Data.ShortMsg = new("称重失败", ShortMessage.Types.Failed); |
| | | //action.LocaleMsg = new($"包装[{CurPkgItem.Package.SN}]称重数据异常,请重新上称称重"); |
| | | action.LocaleMsg = new("MES.WorkAction.PackingAction.PleaseWeighingAgain", CurPkgItem.Package.SN); |
| | | return action; |
| | |
| | | data.PkgLevel = dtl.PKG_LEVEL; |
| | | CurCmd = data; |
| | | action.Data.Data = data; |
| | | action.Data.ShortMsg = new("扫描标签", ShortMessage.Types.Normal); |
| | | //action.LocaleMsg = new($"请扫描第{dtl.PKG_LEVEL}层包装[{dtl.PkgType.PKG_NAME}]的标签条码"); |
| | | action.LocaleMsg = new("MES.WorkAction.PackingAction.PleaseScanLabel", dtl.PKG_LEVEL, dtl.PkgType.PKG_NAME); |
| | | } |
| | |
| | | CurCmd = data; |
| | | PrintTimes++; |
| | | action.Data.Data = data; |
| | | action.Data.ShortMsg = new("打印标签", ShortMessage.Types.Normal); |
| | | //action.LocaleMsg = new Locale($"开始第{PrintTimes}次打印第{min.PKG_LEVEL}层包装[{min.PkgType.PKG_NAME}]的标签[{LabelDic[min.PKG_LEVEL]?.LABEL_CODE}: {LabelDic[min.PKG_LEVEL].LABEL_NAME}]"); |
| | | action.LocaleMsg = new Locale("MES.WorkAction.PackingAction.BeginPrint", PrintTimes, dtl.PKG_LEVEL, dtl.PkgType.PKG_NAME, LabelDic[dtl.PKG_LEVEL]?.LABEL_CODE, LabelDic[dtl.PKG_LEVEL].LABEL_NAME); |
| | | } |
| | |
| | | //数据异常 |
| | | else |
| | | { |
| | | action.Data.ShortMsg = new("包装错误", ShortMessage.Types.Error); |
| | | var pdtl = PkgRule.Details.First(q => q.PKG_LEVEL == pInput.PkgLevel); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"客户端提交的包装层级[{pdtl.PKG_LEVEL}]({pdtl.PkgType.PKG_NAME})数据不是正在处理的包装层级[{dtl.PKG_LEVEL}]({dtl.PkgType.PKG_NAME}),工序已重置,请重新扫描进站产品条码"); |
| | |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | action.Data.ShortMsg = new("包装异常", ShortMessage.Types.Exception); |
| | | var dtl = PkgRule.Details.First(q => q.PKG_LEVEL == pInput.PkgLevel); |
| | | action.CatchExceptionWithLog(ex, $"包装行为:扫描第{dtl.PKG_LEVEL}层包装[{dtl.PkgType.PKG_NAME}]的标签条码[{input.SN}]后保存数据失败"); |
| | | action.IsSuccessed = false; |
| | |
| | | data.PkgLevel = CurPkg.Item.PKG_LEVEL; |
| | | CurCmd = data; |
| | | action.Data.Data = data; |
| | | action.Data.ShortMsg = new("保存包装数据", ShortMessage.Types.Normal); |
| | | //action.LocaleMsg = new($"第{CurPkg.Item.PKG_LEVEL}层包装[{CurPkg.Item.PKG_NAME}]已经全部完成,保存包装数据"); |
| | | action.LocaleMsg = new("MES.WorkAction.PackingAction.PackageComplete", CurPkg.Item.PKG_LEVEL, CurPkg.Item.PKG_NAME); |
| | | |
| | |
| | | } |
| | | |
| | | IsFinished = true; |
| | | action.LocaleMsg = new($"产品条码[{CurPosition.CurSN}]包装完成"); |
| | | action.LocaleMsg = new("MES.WorkAction.PackingAction.PackingSuccess", CurPosition.CurSN); |
| | | action.Data.ShortMsg = new("包装完成", ShortMessage.Types.Success); |
| | | action.LocaleMsg = new($"条码[{CurPkg.Item.Package.SN}]包装完成"); |
| | | action.LocaleMsg = new("MES.WorkAction.PackingAction.PackingSuccess", CurPkg.Item.Package.SN); |
| | | return action; |
| | | } |
| | | |
| | |
| | | |
| | | //如果返回成功则认为当前行为可以开始执行,否则返回失败 |
| | | action.IsSuccessed = true; |
| | | action.Data.ShortMsg = new("打印开始", ShortMessage.Types.Success); |
| | | return action; |
| | | } |
| | | |
| | |
| | | //提交数据执行失败 |
| | | else |
| | | { |
| | | 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); |
| | |
| | | }; |
| | | |
| | | IsFinished = true; |
| | | 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); |
| | | return action; |
| | |
| | | |
| | | //如果返回成功则认为当前行为可以开始执行,否则返回失败 |
| | | action.IsSuccessed = true; |
| | | action.Data.ShortMsg = new("称重开始", ShortMessage.Types.Success); |
| | | return action; |
| | | } |
| | | |
| | |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | action.Data.ShortMsg = new("称重异常", ShortMessage.Types.Error); |
| | | action.CatchExceptionWithLog(ex, $"称重行为:条码[{CurPosition.CurSN}]称重数据[{input?.Data.ToString()}]保存异常"); |
| | | action.LocaleMsg = new("MES.WorkAction.Weighing.SaveWeightInfoException", CurPosition.CurSN, input?.Data.ToString()); |
| | | } |
| | |
| | | }; |
| | | |
| | | IsFinished = true; |
| | | action.Data.ShortMsg = new("称重完成", ShortMessage.Types.Success); |
| | | //action.LocaleMsg = new($"条码[{CurPosition.CurSN}]称重数据[{CurPkg.WEIGHT} {CurPkg.WEIGHT_UNIT}]保存成功"); |
| | | action.LocaleMsg = new("MES.WorkAction.Weighing.SaveSuccess", CurPosition.CurSN, CurPkg.WEIGHT, CurPkg.WEIGHT_UNIT); |
| | | return action; |
| | |
| | | |
| | | //如果返回成功则认为当前行为可以开始执行,否则返回失败 |
| | | action.IsSuccessed = true; |
| | | action.Data.ShortMsg = new("绑定开始", ShortMessage.Types.Success); |
| | | return action; |
| | | } |
| | | |
| | |
| | | //验证扫描的条码是否SN的扩展信息的标签 |
| | | if (input.SN.IsNullOrEmpty()) |
| | | { |
| | | action.Data.ShortMsg = new("绑定失败", ShortMessage.Types.Failed); |
| | | action.IsSuccessed = isOK = false; |
| | | //action.LocaleMsg = new Locale($"错误:[{ExtInfo.FIELD_NAME}]标签条码不能为空,请重新扫描"); |
| | | action.LocaleMsg = new Locale("MES.WorkAction.WipExtInfo.SnEmptyError", ExtInfo.FIELD_NAME); |
| | | } |
| | | if (CurPosition.CurWipSNs.Any(w => w.SN == input.SN)) |
| | | { |
| | | action.Data.ShortMsg = new("绑定失败", ShortMessage.Types.Failed); |
| | | action.IsSuccessed = isOK = false; |
| | | //action.LocaleMsg = new Locale($"错误:扫描到产品条码[{input.SN}],请重新扫描[{ExtInfo.FIELD_NAME}]标签条码"); |
| | | action.LocaleMsg = new Locale("MES.WorkAction.WipExtInfo.ScanProdSnError", input.SN, ExtInfo.FIELD_NAME); |
| | |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | action.Data.ShortMsg = new("绑定异常", ShortMessage.Types.Exception); |
| | | action.CatchExceptionWithLog(ex, $"扩展信息绑定行为:产品[{CurPosition.CurSN}]绑定[{ExtInfo.FIELD_NAME}]标签条码[{input.SN}]保存异常"); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"产品[{CurPosition.CurWipSN.SN}]绑定[{ExtInfo.FIELD_NAME}]标签条码[{input.SN}]保存异常,工序已重置,请重新扫描进站产品条码"); |
| | |
| | | }; |
| | | |
| | | IsFinished = true; |
| | | action.Data.ShortMsg = new("绑定完成", ShortMessage.Types.Success); |
| | | //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.CurSN, ExtInfo.FIELD_NAME, CurWipExt.GetType().GetProperty($"FIELD_{ExtInfo.SEQ.ToString("00")}")?.GetValue(CurWipExt)?.ToString()); |
| | | return action; |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Net.WebSockets; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using Tiger.IBusiness; |
| | |
| | | catch (Exception ex) |
| | | { |
| | | //action.CatchExceptionWithLog(ex, $"获取条码[{sn}]的下一个工序节点列表异常"); |
| | | action.CatchExceptionWithLog(ex, Biz.L("MES.WoContext.GetSnNextNodesException")); |
| | | action.CatchExceptionWithLog(ex, Biz.L("MES.WoContext.GetSnNextNodesException", sn)); |
| | | } |
| | | return action; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置当前条码的工序信息 |
| | | /// </summary> |
| | | public static ApiAction<OperInfo> GetSnOperInfo(string sn) |
| | | { |
| | | var action = new ApiAction<OperInfo>(new OperInfo()); |
| | | try |
| | | { |
| | | var wipSNs = Biz.Db.Queryable<MES_WIP_DATA>().IncludesAllFirstLayer().Where(q => (q.SN == sn || q.FLOW_SN == sn || q.TRAY_SN == sn || q.INNER_SN == sn || q.CARTON_SN == sn || q.PALLET_SN == sn)).ToList(); |
| | | if (wipSNs.IsNullOrEmpty()) |
| | | { |
| | | var woSNs = Biz.Db.Queryable<BIZ_MES_WO_SN>().Where(q => (q.SN == sn || q.TRAY_SN == sn || q.OUTER_SN == sn)).ToList(); |
| | | //查找到条码已绑定的工单 |
| | | if (!woSNs.IsNullOrEmpty()) |
| | | { |
| | | foreach (var woSN in woSNs) |
| | | { |
| | | var wipSN = new MES_WIP_DATA() |
| | | { |
| | | SN = sn, |
| | | FLOW_SN = sn, |
| | | STATUS = MES_WIP_DATA.STATUSs.Init.GetValue(), |
| | | ITEM_CODE = woSN.ITEM_CODE, |
| | | WORK_ORDER = woSN.WORK_ORDER, |
| | | BATCH_NO = woSN.BATCH_NO, |
| | | HOLD_FLAG = "N", |
| | | FINISHED_FLAG = "N", |
| | | INV_FLAG = "N", |
| | | DFT_FLAG = "N", |
| | | DFT_COUNT = 0, |
| | | }; |
| | | wipSNs.Add(wipSN); |
| | | } |
| | | } |
| | | } |
| | | if (wipSNs.IsNullOrEmpty()) |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"找不到条码[{sn}]的生产信息", sn); |
| | | action.LocaleMsg = new("MES.WoContext.SnNotFound", sn); |
| | | } |
| | | else |
| | | { |
| | | if (!WoBatchDic.Any(q => q.Value.WO.ORDER_NO == wipSNs.First().WORK_ORDER)) |
| | | { |
| | | var wb = new WorkBatch(wipSNs.First().WORK_ORDER).Init(""); |
| | | WoBatchDic.Add(wb.Batch.BATCH_NO, wb); |
| | | } |
| | | var wo = WoBatchDic.FirstOrDefault(q => q.Value.WO.ORDER_NO == wipSNs.First().WORK_ORDER).Value; |
| | | action.Data = new() |
| | | { |
| | | CurNode = wipSNs.First().NODE_NAME, |
| | | NextNode = string.Join(",", wo.GetNextNodes(wipSNs.First()).Select(q => q.NODE_NAME)), |
| | | }; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //action.CatchExceptionWithLog(ex, $"获取条码[{sn}]的工序信息异常"); |
| | | action.CatchExceptionWithLog(ex, Biz.L("MES.WoContext.GetSnOperInfoException", sn)); |
| | | } |
| | | return action; |
| | | } |
| | |
| | | |
| | | public class ShortMessage |
| | | { |
| | | public ShortMessage(string msg, Types type) |
| | | { |
| | | Content = msg; |
| | | Type = type; |
| | | } |
| | | |
| | | public string Content { get; set; } |
| | | public Types Type { get; set; } |
| | | |
| | |
| | | /// </summary> |
| | | public class OperInfo |
| | | { |
| | | public string NextNode { get; set; } |
| | | public string CurNode { get; set; } |
| | | public int InputQty { get; set; } |
| | | public string NextNode { get; set; } = " — "; |
| | | public string CurNode { get; set; } = " — "; |
| | | public int InputQty { get; set; } = 0; |
| | | } |
| | | } |