| | |
| | | //当前岗位在当前工单不是首站,则查找条码已绑定的工单当作当前工单 |
| | | else |
| | | { |
| | | var wosn = Biz.Db.Queryable<BIZ_MES_WO_BATCH, BIZ_MES_WO_SN>((q, s) => new JoinQueryInfos(JoinType.Inner, q.ORDER_NO == s.WORK_ORDER)) |
| | | .ByAuth(input.AuthOption).Where((q, s) => s.SN == input.SN).Select((q, s) => new { Batch = q, SN = s }).First(); |
| | | var wosns = Biz.Db.Queryable<BIZ_MES_WO_BATCH, BIZ_MES_WO_SN>((q, s) => new JoinQueryInfos(JoinType.Inner, q.ORDER_NO == s.WORK_ORDER)) |
| | | .ByAuth(input.AuthOption).Where((q, s) => s.SN == input.SN || s.TRAY_SN == input.SN).Select((q, s) => new { Batch = q, SN = s }).ToList(); |
| | | |
| | | //查找到条码已绑定的工单 |
| | | if (!wosn.IsNullOrEmpty()) |
| | | if (!wosns.IsNullOrEmpty()) |
| | | { |
| | | if (wosn.Batch.ACT_LINE != CurLine.LINE_CODE) |
| | | if (wosns.First().Batch.ACT_LINE != CurLine.LINE_CODE) |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"条码[{0}]已在产线[{1}]投入生产,请在正确岗位扫描"); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.NotCorrectLine", input.SN, wosn.Batch.ACT_LINE); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.NotCorrectLine", input.SN, wosns.First().Batch.ACT_LINE); |
| | | return action; |
| | | } |
| | | else |
| | | { |
| | | if (CurBatch?.Batch?.ORDER_NO != wosn.Batch.ORDER_NO) |
| | | if (CurBatch?.Batch?.ORDER_NO != wosns.First().Batch.ORDER_NO) |
| | | { |
| | | //条码已绑定的工单不等于当前工单则重新选择工单 |
| | | var result = await SelectOrder(new() { AuthOption = input.AuthOption, OrderNo = wosn.Batch.ORDER_NO }); |
| | | var result = await SelectOrder(new() { AuthOption = input.AuthOption, OrderNo = wosns.First().Batch.ORDER_NO }); |
| | | if (!result.IsSuccessed) |
| | | { |
| | | action.IsSuccessed = result.IsSuccessed; |
| | |
| | | return woStatus; |
| | | } |
| | | //非法过站防呆:进入工序时要增加判断条码是否按流程过站 |
| | | var wipSN = Biz.Db.Queryable<MES_WIP_DATA>().IncludesAllFirstLayer().First(q => q.SN == input.SN && q.WORK_ORDER == CurBatch.WO.ORDER_NO) ?? new MES_WIP_DATA() |
| | | 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()) |
| | | { |
| | | var wipSN = new MES_WIP_DATA() |
| | | { |
| | | SN = input.SN, |
| | | STATUS = MES_WIP_DATA.STATUSs.Init.GetValue(), |
| | |
| | | DFT_FLAG = "N", |
| | | DFT_COUNT = 0, |
| | | }; |
| | | var canGotoNext = CurBatch.CanGotoNext(input, wipSN, curNode); |
| | | wipSNs.Add(wipSN); |
| | | } |
| | | var canGotoNext = CurBatch.CanGotoNext(input, wipSNs.First(), curNode); |
| | | if (!canGotoNext.IsSuccessed) |
| | | { |
| | | return canGotoNext; |
| | |
| | | if (Steps.IsNullOrEmpty()) |
| | | { |
| | | //绑定条码到工单 |
| | | if (!CurBatch.WoSNs.Any(q => q.SN == input.SN)) |
| | | foreach (var wipSN in wipSNs) |
| | | { |
| | | if (!CurBatch.WoSNs.Any(q => q.SN == wipSN.SN)) |
| | | { |
| | | CurBatch.WoSNs.Add(new() |
| | | { |
| | | WORK_ORDER = CurBatch.Batch.ORDER_NO, |
| | | SN = input.SN, |
| | | SN = wipSN.SN, |
| | | TRAY_SN = wipSN.TRAY_SN, |
| | | STATUS = BIZ_MES_WO_SN.STATUSs.NotInput.GetValue(), |
| | | }); |
| | | } |
| | | var woSN = CurBatch.WoSNs.First(q => q.SN == input.SN); |
| | | } |
| | | |
| | | //更新工单条码明细信息 |
| | | var woSNs = CurBatch.WoSNs.Where(q => wipSNs.Any(w => q.SN == w.SN)).ToList(); |
| | | foreach (var woSN in woSNs) |
| | | { |
| | | woSN.AUTH_ORG = CurBatch.WO.AUTH_ORG; |
| | | woSN.AUTH_PROD = CurLine.LINE_CODE; |
| | | woSN.BATCH_NO = CurBatch.Batch.BATCH_NO; |
| | | } |
| | | |
| | | //条码过站 |
| | | foreach (var wipSN in wipSNs) |
| | | { |
| | | wipSN.AUTH_ORG = CurBatch.WO.AUTH_ORG; |
| | | wipSN.AUTH_PROD = CurLine.LINE_CODE; |
| | | wipSN.STATUS = MES_WIP_DATA.STATUSs.OK.GetValue();//wipSN.STATUS > 0 ? MES_WIP_DATA.STATUSs.OK.GetValue() : wipSN.STATUS; |
| | |
| | | wipSN.SFT_CODE = curShiftPeriod.Shift.SFT_CODE; |
| | | wipSN.PRD_CODE = curShiftPeriod.Period.PRD_CODE; |
| | | } |
| | | CurBatch.StartWorking(UserCode); |
| | | |
| | | //如果是投入站 |
| | | if (curNode.IS_INPUT == "Y") |
| | | { |
| | | var woSN = woSNs.First(q => q.SN == wipSN.SN); |
| | | woSN.STATUS = BIZ_MES_WO_SN.STATUSs.Inputed.GetValue(); |
| | | wipSN.STATUS = MES_WIP_DATA.STATUSs.Input.GetValue(); |
| | | wipSN.INLINE_DATE = DateTime.Now; |
| | |
| | | //如果是产出站 |
| | | if (curNode.IS_OUTPUT == "Y") |
| | | { |
| | | var woSN = woSNs.First(q => q.SN == wipSN.SN); |
| | | woSN.STATUS = BIZ_MES_WO_SN.STATUSs.Finished.GetValue(); |
| | | wipSN.STATUS = MES_WIP_DATA.STATUSs.Finished.GetValue(); |
| | | wipSN.OUTLINE_DATE = DateTime.Now; |
| | |
| | | wipSN.DFT_COUNT++; |
| | | wipSN.DFT_CODE = input.DFT_CODE; |
| | | } |
| | | } |
| | | |
| | | CurWipSNHis = new MES_WIP_HIS(CurWipSN = wipSN, $"工单[{wipSN.WORK_ORDER}]条码[{wipSN.SN}]在岗位[{wipSN.POST_CODE}]过站工序[{wipSN.NODE_NAME}]成功"); |
| | | //工单开工 |
| | | CurBatch.StartWorking(UserCode); |
| | | |
| | | //把当前条码增加到当前条码列表 |
| | | CurWipSNs = wipSNs; |
| | | CurWipSNHiss.Clear(); |
| | | foreach (var wipSN in wipSNs) |
| | | { |
| | | CurWipSNHiss.Add(new MES_WIP_HIS(wipSN, $"工单[{wipSN.WORK_ORDER}]条码[{wipSN.SN}]在岗位[{wipSN.POST_CODE}]过站工序[{wipSN.NODE_NAME}]成功")); |
| | | } |
| | | |
| | | //初始化工步列表 |
| | | Steps.Clear(); |
| | |
| | | DBSubmitAction = () => |
| | | { |
| | | var db = GetCommitDB(); |
| | | db.Storageable(woSN, UserCode).ExecuteCommand(); |
| | | db.Storageable(wipSN, UserCode).ExecuteCommand(); |
| | | db.Storageable(CurWipSNHis, UserCode).ExecuteCommand(); |
| | | db.Storageable(woSNs, UserCode).ExecuteCommand(); |
| | | db.Storageable(wipSNs, UserCode).ExecuteCommand(); |
| | | db.Storageable(CurWipSNHiss, UserCode).ExecuteCommand(); |
| | | //如果是投入站 |
| | | if (curNode.IS_INPUT == "Y") |
| | | { |
| | | db.Updateable<BIZ_MES_WO>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + 1).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand(); |
| | | db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + 1).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand(); |
| | | db.Updateable<BIZ_MES_WO>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + wipSNs.Count).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand(); |
| | | db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + wipSNs.Count).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand(); |
| | | } |
| | | //如果是产出站 |
| | | if (curNode.IS_OUTPUT == "Y") |
| | | { |
| | | db.Updateable<BIZ_MES_WO>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + 1).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand(); |
| | | db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + 1).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand(); |
| | | db.Updateable<BIZ_MES_WO>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + wipSNs.Count).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand(); |
| | | db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + wipSNs.Count).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand(); |
| | | } |
| | | } |
| | | }; |
| | |
| | | SaveStepsCommitActionToDB(); |
| | | |
| | | //保存成功,返回过站消息 |
| | | //action.LocaleMsg = new($"工单[{CurWipSN.WORK_ORDER}]的条码[{CurWipSN.SN}]在岗位[{CurWipSN.POST_CODE}]工序[{CurWipSN.NODE_NAME}]过站成功,状态[{CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()}]", 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", CurWipSN.WORK_ORDER, CurWipSN.SN, CurWipSN.POST_CODE, CurWipSN.NODE_NAME,CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()); |
| | | //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>()); |
| | | //重置工序 |
| | | ResetNode(); |
| | | return action; |
| | |
| | | //当前岗位在当前工单不是首站,则查找条码已绑定的工单当作当前工单 |
| | | else |
| | | { |
| | | var wosn = Biz.Db.Queryable<BIZ_MES_WO_BATCH, BIZ_MES_WO_SN>((q, s) => new JoinQueryInfos(JoinType.Inner, q.ORDER_NO == s.WORK_ORDER)) |
| | | .ByAuth(input.AuthOption).Where((q, s) => s.SN == input.SN).Select((q, s) => new { Batch = q, SN = s }).First(); |
| | | var wosns = Biz.Db.Queryable<BIZ_MES_WO_BATCH, BIZ_MES_WO_SN>((q, s) => new JoinQueryInfos(JoinType.Inner, q.ORDER_NO == s.WORK_ORDER)) |
| | | .ByAuth(input.AuthOption).Where((q, s) => s.SN == input.SN || s.TRAY_SN == input.SN).Select((q, s) => new { Batch = q, SN = s }).ToList(); |
| | | |
| | | //查找到条码已绑定的工单 |
| | | if (!wosn.IsNullOrEmpty()) |
| | | if (!wosns.IsNullOrEmpty()) |
| | | { |
| | | if (wosn.Batch.ACT_LINE != CurLine.LINE_CODE) |
| | | if (wosns.Count > 1 && wosns.Any(q => q.SN.TRAY_SN != q.SN.OUTER_SN)) |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = new($"条码[{0}]是载具条码,请扫描载具中的产品条码继续包装操作"); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.OnlyMinPackage", input.SN); |
| | | return action; |
| | | } |
| | | if (wosns.First().Batch.ACT_LINE != CurLine.LINE_CODE) |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"条码[{0}]已在产线[{1}]投入生产,请在正确岗位扫描"); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.NotCorrectLine", input.SN, wosn.Batch.ACT_LINE); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.NotCorrectLine", input.SN, wosns.First().Batch.ACT_LINE); |
| | | return action; |
| | | } |
| | | else |
| | | { |
| | | if (CurBatch?.Batch?.ORDER_NO != wosn.Batch.ORDER_NO) |
| | | if (CurBatch?.Batch?.ORDER_NO != wosns.First().Batch.ORDER_NO) |
| | | { |
| | | //条码已绑定的工单不等于当前工单则重新选择工单 |
| | | var result = await SelectOrder(new() { AuthOption = input.AuthOption, OrderNo = wosn.Batch.ORDER_NO }); |
| | | var result = await SelectOrder(new() { AuthOption = input.AuthOption, OrderNo = wosns.First().Batch.ORDER_NO }); |
| | | if (!result.IsSuccessed) |
| | | { |
| | | action.IsSuccessed = result.IsSuccessed; |
| | |
| | | return woStatus; |
| | | } |
| | | //非法过站防呆:进入工序时要增加判断条码是否按流程过站 |
| | | var wipSN = Biz.Db.Queryable<MES_WIP_DATA>().IncludesAllFirstLayer().First(q => q.SN == input.SN && q.WORK_ORDER == CurBatch.WO.ORDER_NO) ?? new MES_WIP_DATA() |
| | | 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()) |
| | | { |
| | | var wipSN = new MES_WIP_DATA() |
| | | { |
| | | SN = input.SN, |
| | | STATUS = MES_WIP_DATA.STATUSs.Init.GetValue(), |
| | |
| | | DFT_FLAG = "N", |
| | | DFT_COUNT = 0, |
| | | }; |
| | | var canGotoNext = CurBatch.CanGotoNext(input, wipSN, curNode); |
| | | wipSNs.Add(wipSN); |
| | | } |
| | | var canGotoNext = CurBatch.CanGotoNext(input, wipSNs.First(), curNode); |
| | | if (!canGotoNext.IsSuccessed) |
| | | { |
| | | return canGotoNext; |
| | |
| | | if (Steps.IsNullOrEmpty()) |
| | | { |
| | | //绑定条码到工单 |
| | | if (!CurBatch.WoSNs.Any(q => q.SN == input.SN)) |
| | | foreach (var wipSN in wipSNs) |
| | | { |
| | | if (!CurBatch.WoSNs.Any(q => q.SN == wipSN.SN)) |
| | | { |
| | | CurBatch.WoSNs.Add(new() |
| | | { |
| | | WORK_ORDER = CurBatch.Batch.ORDER_NO, |
| | | SN = input.SN, |
| | | SN = wipSN.SN, |
| | | TRAY_SN = wipSN.TRAY_SN, |
| | | STATUS = BIZ_MES_WO_SN.STATUSs.NotInput.GetValue(), |
| | | }); |
| | | } |
| | | var woSN = CurBatch.WoSNs.First(q => q.SN == input.SN); |
| | | } |
| | | |
| | | //更新工单条码明细信息 |
| | | var woSNs = CurBatch.WoSNs.Where(q => wipSNs.Any(w => q.SN == w.SN)).ToList(); |
| | | foreach (var woSN in woSNs) |
| | | { |
| | | woSN.AUTH_ORG = CurBatch.WO.AUTH_ORG; |
| | | woSN.AUTH_PROD = CurLine.LINE_CODE; |
| | | woSN.BATCH_NO = CurBatch.Batch.BATCH_NO; |
| | | } |
| | | |
| | | //条码过站 |
| | | foreach (var wipSN in wipSNs) |
| | | { |
| | | wipSN.AUTH_ORG = CurBatch.WO.AUTH_ORG; |
| | | wipSN.AUTH_PROD = CurLine.LINE_CODE; |
| | | wipSN.STATUS = MES_WIP_DATA.STATUSs.OK.GetValue();//wipSN.STATUS > 0 ? MES_WIP_DATA.STATUSs.OK.GetValue() : wipSN.STATUS; |
| | |
| | | wipSN.SFT_CODE = curShiftPeriod.Shift.SFT_CODE; |
| | | wipSN.PRD_CODE = curShiftPeriod.Period.PRD_CODE; |
| | | } |
| | | CurBatch.StartWorking(UserCode); |
| | | |
| | | //如果是投入站 |
| | | if (curNode.IS_INPUT == "Y") |
| | | { |
| | | var woSN = woSNs.First(q => q.SN == wipSN.SN); |
| | | woSN.STATUS = BIZ_MES_WO_SN.STATUSs.Inputed.GetValue(); |
| | | wipSN.STATUS = MES_WIP_DATA.STATUSs.Input.GetValue(); |
| | | wipSN.INLINE_DATE = DateTime.Now; |
| | |
| | | //如果是产出站 |
| | | if (curNode.IS_OUTPUT == "Y") |
| | | { |
| | | var woSN = woSNs.First(q => q.SN == wipSN.SN); |
| | | woSN.STATUS = BIZ_MES_WO_SN.STATUSs.Finished.GetValue(); |
| | | wipSN.STATUS = MES_WIP_DATA.STATUSs.Finished.GetValue(); |
| | | wipSN.OUTLINE_DATE = DateTime.Now; |
| | |
| | | wipSN.DFT_COUNT++; |
| | | wipSN.DFT_CODE = input.DFT_CODE; |
| | | } |
| | | } |
| | | |
| | | CurWipSNHis = new MES_WIP_HIS(CurWipSN = wipSN, $"工单[{wipSN.WORK_ORDER}]的条码[{wipSN.SN}]在岗位[{wipSN.POST_CODE}]工序[{wipSN.NODE_NAME}]过站成功,状态[{wipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()}]"); |
| | | //工单开工 |
| | | CurBatch.StartWorking(UserCode); |
| | | |
| | | //把当前条码增加到当前条码列表 |
| | | CurWipSNs = wipSNs; |
| | | CurWipSNHiss.Clear(); |
| | | foreach (var wipSN in wipSNs) |
| | | { |
| | | CurWipSNHiss.Add(new MES_WIP_HIS(wipSN, $"工单[{wipSN.WORK_ORDER}]条码[{wipSN.SN}]在岗位[{wipSN.POST_CODE}]过站工序[{wipSN.NODE_NAME}]成功")); |
| | | } |
| | | |
| | | //初始化工步列表 |
| | | Steps.Clear(); |
| | |
| | | DBSubmitAction = () => |
| | | { |
| | | var db = GetCommitDB(); |
| | | db.Storageable(woSN, UserCode).ExecuteCommand(); |
| | | db.Storageable(wipSN, UserCode).ExecuteCommand(); |
| | | db.Storageable(CurWipSNHis, UserCode).ExecuteCommand(); |
| | | db.Storageable(woSNs, UserCode).ExecuteCommand(); |
| | | db.Storageable(wipSNs, UserCode).ExecuteCommand(); |
| | | db.Storageable(CurWipSNHiss, UserCode).ExecuteCommand(); |
| | | //如果是投入站 |
| | | if (curNode.IS_INPUT == "Y") |
| | | { |
| | | db.Updateable<BIZ_MES_WO>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + 1).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand(); |
| | | db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + 1).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand(); |
| | | db.Updateable<BIZ_MES_WO>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + wipSNs.Count).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand(); |
| | | db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + wipSNs.Count).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand(); |
| | | } |
| | | //如果是产出站 |
| | | if (curNode.IS_OUTPUT == "Y") |
| | | { |
| | | db.Updateable<BIZ_MES_WO>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + 1).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand(); |
| | | db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + 1).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand(); |
| | | db.Updateable<BIZ_MES_WO>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + wipSNs.Count).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand(); |
| | | db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + wipSNs.Count).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand(); |
| | | } |
| | | } |
| | | }; |
| | |
| | | SaveStepsCommitActionToDB(); |
| | | |
| | | //保存成功,返回过站消息 |
| | | //action.LocaleMsg = new($"工单[{CurWipSN.WORK_ORDER}]的条码[{CurWipSN.SN}]在岗位[{CurWipSN.POST_CODE}]工序[{CurWipSN.NODE_NAME}]过站成功,状态[{CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()}]", CurWipSN.WORK_ORDER, CurWipSN.SN, CurWipSN.POST_CODE, CurWipSN.NODE_NAME, CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.ScanSn.PassSuccess", CurWipSN.WORK_ORDER, CurWipSN.SN, CurWipSN.POST_CODE, CurWipSN.NODE_NAME, CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()); |
| | | //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>()); |
| | | //重置工序 |
| | | ResetNode(); |
| | | return action; |
| | |
| | | case "NodeSubmit": |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"正在进行条码[{CurWipSN.SN}]的过站业务,不允许手动结束包装"); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.WorkingOnNodeSubmit", CurWipSN.SN); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.WorkingOnNodeSubmit", CurSN); |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | public MES_SHIFT_SYS CurShiftSys { get; set; } |
| | | public WorkBatch CurBatch { get; set; } |
| | | public IWorkBatch WorkBatch => CurBatch; |
| | | public MES_WIP_DATA CurWipSN { get; set; } |
| | | public MES_WIP_HIS CurWipSNHis { get; set; } |
| | | public List<MES_WIP_DATA> CurWipSNs { get; set; } |
| | | public string CurSN => CurWipSNs.First().TRAY_SN.IsNullOrEmpty() ? CurWipSNs.First().SN : CurWipSNs.First().TRAY_SN; |
| | | public List<MES_WIP_HIS> CurWipSNHiss { get; set; } |
| | | public Dictionary<string, object> Context { get; set; } = new(); |
| | | public List<WorkStep> Steps { get; set; } = new(); |
| | | public WorkStep CurStep { get; set; } |
| | |
| | | public virtual void ResetNode() |
| | | { |
| | | Steps.Clear(); |
| | | CurWipSN = null; |
| | | CurWipSNHis = null; |
| | | CurWipSNs = null; |
| | | CurWipSNHiss = null; |
| | | CurStep = null; |
| | | } |
| | | |
| | |
| | | switch (pv.VAR_METHOD) |
| | | { |
| | | case "GetSN": |
| | | return CurWipSN.SN; |
| | | return string.Join(",", CurWipSNs.Select(q => q.SN)); |
| | | case "GetTraySN": |
| | | return CurSN; |
| | | case "GetBAS_ITEM": |
| | | return WorkBatch.Product.ToJson(); |
| | | case "GetCustomer": |
| | |
| | | //当前岗位在当前工单不是首站,则查找条码已绑定的工单当作当前工单 |
| | | else |
| | | { |
| | | var wosn = Biz.Db.Queryable<BIZ_MES_WO_BATCH, BIZ_MES_WO_SN>((q, s) => new JoinQueryInfos(JoinType.Inner, q.ORDER_NO == s.WORK_ORDER)) |
| | | .ByAuth(input.AuthOption).Where((q, s) => s.SN == input.SN).Select((q, s) => new { Batch = q, SN = s }).First(); |
| | | var wosns = Biz.Db.Queryable<BIZ_MES_WO_BATCH, BIZ_MES_WO_SN>((q, s) => new JoinQueryInfos(JoinType.Inner, q.ORDER_NO == s.WORK_ORDER)) |
| | | .ByAuth(input.AuthOption).Where((q, s) => s.SN == input.SN || s.TRAY_SN == input.SN).Select((q, s) => new { Batch = q, SN = s }).ToList(); |
| | | |
| | | //查找到条码已绑定的工单 |
| | | if (!wosn.IsNullOrEmpty()) |
| | | if (!wosns.IsNullOrEmpty()) |
| | | { |
| | | if (wosn.Batch.ACT_LINE != CurLine.LINE_CODE) |
| | | if (wosns.First().Batch.ACT_LINE != CurLine.LINE_CODE) |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"条码[{0}]已在产线[{1}]投入生产,请在正确岗位扫描"); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.NotCorrectLine", input.SN, wosn.Batch.ACT_LINE); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.NotCorrectLine", input.SN, wosns.First().Batch.ACT_LINE); |
| | | return action; |
| | | } |
| | | else |
| | | { |
| | | if (CurBatch?.Batch?.ORDER_NO != wosn.Batch.ORDER_NO) |
| | | if (CurBatch?.Batch?.ORDER_NO != wosns.First().Batch.ORDER_NO) |
| | | { |
| | | //条码已绑定的工单不等于当前工单则重新选择工单 |
| | | var result = await SelectOrder(new() { AuthOption = input.AuthOption, OrderNo = wosn.Batch.ORDER_NO }); |
| | | var result = await SelectOrder(new() { AuthOption = input.AuthOption, OrderNo = wosns.First().Batch.ORDER_NO }); |
| | | if (!result.IsSuccessed) |
| | | { |
| | | action.IsSuccessed = result.IsSuccessed; |
| | |
| | | return woStatus; |
| | | } |
| | | //非法过站防呆:进入工序时要增加判断条码是否按流程过站 |
| | | var wipSN = Biz.Db.Queryable<MES_WIP_DATA>().IncludesAllFirstLayer().First(q => q.SN == input.SN && q.WORK_ORDER == CurBatch.WO.ORDER_NO) ?? new MES_WIP_DATA() |
| | | 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()) |
| | | { |
| | | var wipSN = new MES_WIP_DATA() |
| | | { |
| | | SN = input.SN, |
| | | STATUS = MES_WIP_DATA.STATUSs.Init.GetValue(), |
| | |
| | | DFT_FLAG = "N", |
| | | DFT_COUNT = 0, |
| | | }; |
| | | var canGotoNext = CurBatch.CanGotoNext(input, wipSN, curNode); |
| | | wipSNs.Add(wipSN); |
| | | } |
| | | var canGotoNext = CurBatch.CanGotoNext(input, wipSNs.First(), curNode); |
| | | if (!canGotoNext.IsSuccessed) |
| | | { |
| | | return canGotoNext; |
| | |
| | | if (Steps.IsNullOrEmpty()) |
| | | { |
| | | //绑定条码到工单 |
| | | if (!CurBatch.WoSNs.Any(q => q.SN == input.SN)) |
| | | foreach (var wipSN in wipSNs) |
| | | { |
| | | if (!CurBatch.WoSNs.Any(q => q.SN == wipSN.SN)) |
| | | { |
| | | CurBatch.WoSNs.Add(new() |
| | | { |
| | | WORK_ORDER = CurBatch.Batch.ORDER_NO, |
| | | SN = input.SN, |
| | | SN = wipSN.SN, |
| | | TRAY_SN = wipSN.TRAY_SN, |
| | | STATUS = BIZ_MES_WO_SN.STATUSs.NotInput.GetValue(), |
| | | }); |
| | | } |
| | | var woSN = CurBatch.WoSNs.First(q => q.SN == input.SN); |
| | | } |
| | | |
| | | //更新工单条码明细信息 |
| | | var woSNs = CurBatch.WoSNs.Where(q => wipSNs.Any(w => q.SN == w.SN)).ToList(); |
| | | foreach (var woSN in woSNs) |
| | | { |
| | | woSN.AUTH_ORG = CurBatch.WO.AUTH_ORG; |
| | | woSN.AUTH_PROD = CurLine.LINE_CODE; |
| | | woSN.BATCH_NO = CurBatch.Batch.BATCH_NO; |
| | | } |
| | | |
| | | //条码过站 |
| | | foreach (var wipSN in wipSNs) |
| | | { |
| | | wipSN.AUTH_ORG = CurBatch.WO.AUTH_ORG; |
| | | wipSN.AUTH_PROD = CurLine.LINE_CODE; |
| | | wipSN.STATUS = MES_WIP_DATA.STATUSs.OK.GetValue();//wipSN.STATUS > 0 ? MES_WIP_DATA.STATUSs.OK.GetValue() : wipSN.STATUS; |
| | |
| | | wipSN.SFT_CODE = curShiftPeriod.Shift.SFT_CODE; |
| | | wipSN.PRD_CODE = curShiftPeriod.Period.PRD_CODE; |
| | | } |
| | | CurBatch.StartWorking(UserCode); |
| | | |
| | | //如果是投入站 |
| | | if (curNode.IS_INPUT == "Y") |
| | | { |
| | | var woSN = woSNs.First(q => q.SN == wipSN.SN); |
| | | woSN.STATUS = BIZ_MES_WO_SN.STATUSs.Inputed.GetValue(); |
| | | wipSN.STATUS = MES_WIP_DATA.STATUSs.Input.GetValue(); |
| | | wipSN.INLINE_DATE = DateTime.Now; |
| | |
| | | //如果是产出站 |
| | | if (curNode.IS_OUTPUT == "Y") |
| | | { |
| | | var woSN = woSNs.First(q => q.SN == wipSN.SN); |
| | | woSN.STATUS = BIZ_MES_WO_SN.STATUSs.Finished.GetValue(); |
| | | wipSN.STATUS = MES_WIP_DATA.STATUSs.Finished.GetValue(); |
| | | wipSN.OUTLINE_DATE = DateTime.Now; |
| | |
| | | wipSN.DFT_COUNT++; |
| | | wipSN.DFT_CODE = input.DFT_CODE; |
| | | } |
| | | } |
| | | |
| | | CurWipSNHis = new MES_WIP_HIS(CurWipSN = wipSN, $"工单[{wipSN.WORK_ORDER}]条码[{wipSN.SN}]在岗位[{wipSN.POST_CODE}]过站工序[{wipSN.NODE_NAME}]成功"); |
| | | //工单开工 |
| | | CurBatch.StartWorking(UserCode); |
| | | |
| | | //把当前条码增加到当前条码列表 |
| | | CurWipSNs = wipSNs; |
| | | CurWipSNHiss.Clear(); |
| | | foreach (var wipSN in wipSNs) |
| | | { |
| | | CurWipSNHiss.Add(new MES_WIP_HIS(wipSN, $"工单[{wipSN.WORK_ORDER}]条码[{wipSN.SN}]在岗位[{wipSN.POST_CODE}]过站工序[{wipSN.NODE_NAME}]成功")); |
| | | } |
| | | |
| | | //初始化工步列表 |
| | | Steps.Clear(); |
| | |
| | | DBSubmitAction = () => |
| | | { |
| | | var db = GetCommitDB(); |
| | | db.Storageable(woSN, UserCode).ExecuteCommand(); |
| | | db.Storageable(wipSN, UserCode).ExecuteCommand(); |
| | | db.Storageable(CurWipSNHis, UserCode).ExecuteCommand(); |
| | | db.Storageable(woSNs, UserCode).ExecuteCommand(); |
| | | db.Storageable(wipSNs, UserCode).ExecuteCommand(); |
| | | db.Storageable(CurWipSNHiss, UserCode).ExecuteCommand(); |
| | | //如果是投入站 |
| | | if (curNode.IS_INPUT == "Y") |
| | | { |
| | | db.Updateable<BIZ_MES_WO>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + 1).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand(); |
| | | db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + 1).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand(); |
| | | db.Updateable<BIZ_MES_WO>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + wipSNs.Count).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand(); |
| | | db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + wipSNs.Count).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand(); |
| | | } |
| | | //如果是产出站 |
| | | if (curNode.IS_OUTPUT == "Y") |
| | | { |
| | | db.Updateable<BIZ_MES_WO>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + 1).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand(); |
| | | db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + 1).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand(); |
| | | db.Updateable<BIZ_MES_WO>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + wipSNs.Count).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand(); |
| | | db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + wipSNs.Count).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand(); |
| | | } |
| | | } |
| | | }; |
| | |
| | | SaveStepsCommitActionToDB(); |
| | | |
| | | //保存成功,返回过站消息 |
| | | //action.LocaleMsg = new($"工单[{CurWipSN.WORK_ORDER}]的条码[{CurWipSN.SN}]在岗位[{CurWipSN.POST_CODE}]工序[{CurWipSN.NODE_NAME}]过站成功,状态[{CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()}]", CurWipSN.WORK_ORDER, CurWipSN.SN, CurWipSN.POST_CODE, CurWipSN.NODE_NAME, CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()); |
| | | action.LocaleMsg = new("MES.Transaction.TestNode.ScanSn.PassSuccess", CurWipSN.WORK_ORDER, CurWipSN.SN, CurWipSN.POST_CODE, CurWipSN.NODE_NAME, CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()); |
| | | //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>()); |
| | | //重置工序 |
| | | ResetNode(); |
| | | return action; |
| | |
| | | ItemInfo = info, |
| | | RuleCode = assy.RULE_CODE, |
| | | LoadQty = assy.QTY, |
| | | IsBatchItem = assy.IsBatchItem, |
| | | }; |
| | | var bom = Boms.FirstOrDefault(q => q.ITEM_CODE == assy.ITEM_CODE); |
| | | if (!bom.IsNullOrEmpty()) |
| | |
| | | { |
| | | var action = new ApiAction<SubmitOutput>(new SubmitOutput()); |
| | | |
| | | if (input.SN != CurPosition.CurWipSN.SN) |
| | | if (!CurPosition.CurWipSNs.Any(w => w.SN == input.SN)) |
| | | { |
| | | action = SaveAssembly(input, action); |
| | | return action; |
| | |
| | | //验证通过则保存上料信息 |
| | | if (isOK) |
| | | { |
| | | //批次物料则只记录一次,非批次物料则要按个数验证数量 |
| | | if (item.IsBatchItem) |
| | | { |
| | | foreach (var wipSn in CurPosition.CurWipSNs) |
| | | { |
| | | var record = new MES_WIP_ASSY() |
| | | { |
| | | AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, |
| | | AUTH_PROD = CurPosition.CurLine.LINE_CODE, |
| | | SN = input.SN, |
| | | PROD_SN = CurPosition.CurWipSN.SN, |
| | | PROD_SN = wipSn.SN, |
| | | ITEM_CODE = item.ItemInfo.ITEM_CODE, |
| | | QTY = 1, |
| | | UNIT = item.ItemInfo.UNIT, |
| | | 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, |
| | | 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, |
| | | 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, |
| | | 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, |
| | | }; |
| | | item.Records.Add(record); |
| | | if (item.Records.Sum(q => q.QTY) >= item.LoadQty) |
| | | } |
| | | item.IsFinished = true; |
| | | } |
| | | else |
| | | { |
| | | var record = new MES_WIP_ASSY() |
| | | { |
| | | AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, |
| | | AUTH_PROD = CurPosition.CurLine.LINE_CODE, |
| | | SN = input.SN, |
| | | PROD_SN = CurPosition.CurSN, |
| | | ITEM_CODE = item.ItemInfo.ITEM_CODE, |
| | | QTY = 1, |
| | | UNIT = item.ItemInfo.UNIT, |
| | | WORK_ORDER = CurPosition.CurWipSNs.First().WORK_ORDER, |
| | | BATCH_NO = CurPosition.CurWipSNs.First().BATCH_NO, |
| | | ROT_CODE = CurPosition.CurWipSNs.First().ROT_CODE, |
| | | NODE_ID = CurPosition.CurWipSNs.First().NODE_ID, |
| | | NODE_NAME = CurPosition.CurWipSNs.First().NODE_NAME, |
| | | FTY_CODE = CurPosition.CurWipSNs.First().FTY_CODE, |
| | | WS_CODE = CurPosition.CurWipSNs.First().WS_CODE, |
| | | LINE_CODE = CurPosition.CurWipSNs.First().LINE_CODE, |
| | | POST_CODE = CurPosition.CurWipSNs.First().POST_CODE, |
| | | OPER_CODE = CurPosition.CurWipSNs.First().OPER_CODE, |
| | | SEGMENT = CurPosition.CurWipSNs.First().SEGMENT, |
| | | }; |
| | | item.Records.Add(record); |
| | | |
| | | if (item.Records.Sum(q => q.QTY) >= item.LoadQty * CurPosition.CurWipSNs.Count) |
| | | { |
| | | item.IsFinished = true; |
| | | } |
| | | } |
| | | |
| | | action.IsSuccessed = true; |
| | |
| | | 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.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, |
| | | 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 = 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, |
| | | 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 = CurPosition.CurWipSN.SFTS_CODE, |
| | | SFT_CODE = CurPosition.CurWipSN.SFT_CODE, |
| | | PRD_CODE = CurPosition.CurWipSN.PRD_CODE, |
| | | SFTS_CODE = wipSn.SFTS_CODE, |
| | | SFT_CODE = wipSn.SFT_CODE, |
| | | PRD_CODE = wipSn.PRD_CODE, |
| | | ACT_TYPE = NodeAct.ACT_TYPE, |
| | | ACT_SN = CurPosition.CurWipSN.SN, |
| | | ACT_SN = wipSn.SN, |
| | | ACT_VALUE_1 = CurAssembly.ToJson(), |
| | | ACT_RESULT = "Y", |
| | | TRACE_INFO = $"以下物料上料完成:{string.Join(",", CurAssembly.Items.Select(q => $"{q.ItemInfo.ITEM_NAME}({q.ItemInfo.ITEM_CODE})"))}", |
| | | }; |
| | | wipActs.Add(wipAct); |
| | | } |
| | | //整理上料记录 |
| | | var records = new List<MES_WIP_ASSY>(); |
| | | foreach (var item in CurAssembly.Items) |
| | | { |
| | |
| | | CurStep.DBSubmitAction = () => |
| | | { |
| | | var db = CurPosition.GetCommitDB(); |
| | | db.Storageable(wipAct, CurPosition.UserCode).ExecuteCommand(); |
| | | db.Storageable(wipActs, CurPosition.UserCode).ExecuteCommand(); |
| | | db.Insertable(records, CurPosition.UserCode).ExecuteCommand(); |
| | | }; |
| | | |
| | |
| | | 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.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, |
| | | 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 = 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, |
| | | 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 = CurPosition.CurWipSN.SFTS_CODE, |
| | | SFT_CODE = CurPosition.CurWipSN.SFT_CODE, |
| | | PRD_CODE = CurPosition.CurWipSN.PRD_CODE, |
| | | SFTS_CODE = wipSn.SFTS_CODE, |
| | | SFT_CODE = wipSn.SFT_CODE, |
| | | PRD_CODE = wipSn.PRD_CODE, |
| | | ACT_TYPE = NodeAct.ACT_TYPE, |
| | | ACT_SN = CurPosition.CurWipSN.SN, |
| | | ACT_SN = wipSn.SN, |
| | | ACT_VALUE_1 = "", |
| | | ACT_VALUE_2 = "", |
| | | ACT_VALUE_3 = "", |
| | |
| | | ACT_RESULT = "Y", |
| | | TRACE_INFO = $"执行成功", |
| | | }; |
| | | wipActs.Add(wipAct); |
| | | } |
| | | |
| | | //保存数据 |
| | | CurStep.DBSubmitAction = () => |
| | | { |
| | | var db = CurPosition.GetCommitDB(); |
| | | db.Storageable(wipAct, CurPosition.UserCode).ExecuteCommand(); |
| | | db.Storageable(wipActs, CurPosition.UserCode).ExecuteCommand(); |
| | | }; |
| | | |
| | | IsFinished = true; |
| | |
| | | //行为设定的OPTION_1是第一层包装的标签模板代码,如果为空则不需要打印 |
| | | if (LabelDic[min.PKG_LEVEL].IsNullOrEmpty()) |
| | | { |
| | | var msg = new Locale("MES.WorkAction.PackingAction.BeginMsg", min.PKG_LEVEL, min.PkgType.PKG_NAME, CurPosition.CurWipSN.SN); |
| | | var msg = new Locale("MES.WorkAction.PackingAction.BeginMsg", min.PKG_LEVEL, min.PkgType.PKG_NAME, CurPosition.CurSN); |
| | | //var msg = new Locale($"已扫描第{dtl.PKG_LEVEL}层包装[{dtl.PkgType.PKG_NAME}]的标签条码[{CurPosition.CurWipSN.SN}]"); |
| | | return msg; |
| | | } |
| | |
| | | action.LocaleMsg = GetBeginMsg(); |
| | | |
| | | var min = PkgRule.Details.OrderBy(q => q.PKG_LEVEL).First(); |
| | | //行为设定的OPTION_1-9是包装不同层级的标签模板代码,如果为空则不需要打印 |
| | | //根据包装不同层级的标签模板代码,如果为空则不需要打印 |
| | | if (LabelDic[min.PKG_LEVEL].IsNullOrEmpty()) |
| | | { |
| | | input.Data = new PackingActionInput() |
| | |
| | | ExecCode = "Scan", |
| | | IsFinish = true, |
| | | PkgLevel = min.PKG_LEVEL, |
| | | PkgSN = CurPosition.CurWipSN.SN, |
| | | PkgSN = CurPosition.CurSN, |
| | | }.ToJson(); |
| | | action = Submit(input); |
| | | } |
| | |
| | | AUTH_PROD = CurPosition.CurLine.LINE_CODE, |
| | | SN = pInput.PkgSN, |
| | | PKG_TYPE = dtl.PkgType.PKG_NAME, |
| | | ITEM_CODE = CurPosition.CurWipSN.ITEM_CODE, |
| | | QTY = CurPosition.CurWipSN.QTY, |
| | | ITEM_CODE = CurPosition.CurWipSNs.First().ITEM_CODE, |
| | | QTY = CurPosition.CurWipSNs.First().QTY, |
| | | UNIT = dtl.PkgType.PKG_NAME, |
| | | 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, |
| | | 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, |
| | | WORK_ORDER = CurPosition.CurWipSNs.First().WORK_ORDER, |
| | | BATCH_NO = CurPosition.CurWipSNs.First().BATCH_NO, |
| | | ROT_CODE = CurPosition.CurWipSNs.First().ROT_CODE, |
| | | NODE_ID = CurPosition.CurWipSNs.First().NODE_ID, |
| | | NODE_NAME = CurPosition.CurWipSNs.First().NODE_NAME, |
| | | FTY_CODE = CurPosition.CurWipSNs.First().FTY_CODE, |
| | | WS_CODE = CurPosition.CurWipSNs.First().WS_CODE, |
| | | LINE_CODE = CurPosition.CurWipSNs.First().LINE_CODE, |
| | | POST_CODE = CurPosition.CurWipSNs.First().POST_CODE, |
| | | OPER_CODE = CurPosition.CurWipSNs.First().OPER_CODE, |
| | | SEGMENT = CurPosition.CurWipSNs.First().SEGMENT, |
| | | } |
| | | }; |
| | | FinishLevel++; |
| | |
| | | AUTH_PROD = CurPosition.CurLine.LINE_CODE, |
| | | SN = pInput.PkgSN, |
| | | PKG_TYPE = dtl.PkgType.PKG_NAME, |
| | | ITEM_CODE = CurPosition.CurWipSN.ITEM_CODE, |
| | | ITEM_CODE = CurPosition.CurWipSNs.First().ITEM_CODE, |
| | | QTY = CurPkgItem.Items.Sum(q => q.Package.QTY), |
| | | UNIT = dtl.PkgType.PKG_NAME, |
| | | 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, |
| | | 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, |
| | | WORK_ORDER = CurPosition.CurWipSNs.First().WORK_ORDER, |
| | | BATCH_NO = CurPosition.CurWipSNs.First().BATCH_NO, |
| | | ROT_CODE = CurPosition.CurWipSNs.First().ROT_CODE, |
| | | NODE_ID = CurPosition.CurWipSNs.First().NODE_ID, |
| | | NODE_NAME = CurPosition.CurWipSNs.First().NODE_NAME, |
| | | FTY_CODE = CurPosition.CurWipSNs.First().FTY_CODE, |
| | | WS_CODE = CurPosition.CurWipSNs.First().WS_CODE, |
| | | LINE_CODE = CurPosition.CurWipSNs.First().LINE_CODE, |
| | | POST_CODE = CurPosition.CurWipSNs.First().POST_CODE, |
| | | OPER_CODE = CurPosition.CurWipSNs.First().OPER_CODE, |
| | | SEGMENT = CurPosition.CurWipSNs.First().SEGMENT, |
| | | }; |
| | | FinishLevel++; |
| | | //完成包装的层级小于最外层包装层级 |
| | |
| | | throw dbTran.ErrorException; |
| | | } |
| | | |
| | | //删除工序上下文中的包装记录 |
| | | CurPosition.Context.Remove("CurPackage"); |
| | | |
| | | var data = new PackingActionOutput() { PkgInfo = CurPkg }; |
| | | data.ExecCode = "Complete"; |
| | | data.PkgLevel = CurPkg.Item.PKG_LEVEL; |
| | |
| | | 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.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, |
| | | 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 = 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, |
| | | 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 = CurPosition.CurWipSN.SFTS_CODE, |
| | | SFT_CODE = CurPosition.CurWipSN.SFT_CODE, |
| | | PRD_CODE = CurPosition.CurWipSN.PRD_CODE, |
| | | SFTS_CODE = wipSn.SFTS_CODE, |
| | | SFT_CODE = wipSn.SFT_CODE, |
| | | PRD_CODE = wipSn.PRD_CODE, |
| | | ACT_TYPE = NodeAct.ACT_TYPE, |
| | | ACT_SN = CurPosition.CurWipSN.SN, |
| | | ACT_SN = wipSn.SN, |
| | | ACT_RESULT = "Y", |
| | | TRACE_INFO = $"产品条码[{CurPosition.CurWipSN.SN}]包装完成", |
| | | TRACE_INFO = $"产品条码[{string.Join(",", CurPosition.CurSN)}]包装完成", |
| | | }; |
| | | wipActs.Add(wipAct); |
| | | } |
| | | |
| | | //保存数据 |
| | | CurStep.DBSubmitAction = () => |
| | | { |
| | | var db = CurPosition.GetCommitDB(); |
| | | db.Storageable(wipAct, CurPosition.UserCode).ExecuteCommand(); |
| | | db.Storageable(wipActs, CurPosition.UserCode).ExecuteCommand(); |
| | | }; |
| | | |
| | | if (CurPkg.IsFinished) |
| | | { |
| | | //最外层包装已经完成包装,则把工序中暂存标记设为false,统一提交包装内产品的过站记录 |
| | | CurPosition.NeedTemporaryStoreDBCommitAction = false; |
| | | //删除工序上下文中的包装记录 |
| | | CurPosition.Context.Remove("CurPackage"); |
| | | } |
| | | else |
| | | { |
| | | //最外层包装未完成包装,则把工序中暂存标记设为true,待全部包装完成再统一提交包装内产品的过站记录 |
| | | CurPosition.NeedTemporaryStoreDBCommitAction = true; |
| | | //如果工序上下文中没有包装记录则新建一个 |
| | | if (CurPosition.Context.ContainsKey("CurPackage")) |
| | | { |
| | |
| | | { |
| | | CurPosition.Context.Add("CurPackage", CurPkg); |
| | | } |
| | | } |
| | | |
| | | IsFinished = true; |
| | | action.LocaleMsg = new($"产品条码[{CurPosition.CurWipSN.SN}]包装完成"); |
| | | action.LocaleMsg = new("MES.WorkAction.PackingAction.PackingSuccess", CurPosition.CurWipSN.SN); |
| | | action.LocaleMsg = new($"产品条码[{CurPosition.CurSN}]包装完成"); |
| | | action.LocaleMsg = new("MES.WorkAction.PackingAction.PackingSuccess", CurPosition.CurSN); |
| | | return action; |
| | | } |
| | | |
| | |
| | | /// <returns></returns> |
| | | public Locale GetBeginMsg() |
| | | { |
| | | var msg = new Locale("MES.WorkAction.PrintLabel.BeginMsg", CurPosition.CurWipSN.SN, 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()); |
| | | |
| | | //记录行为操作记录 |
| | | 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.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, |
| | | 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 = 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, |
| | | 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 = CurPosition.CurWipSN.SFTS_CODE, |
| | | SFT_CODE = CurPosition.CurWipSN.SFT_CODE, |
| | | PRD_CODE = CurPosition.CurWipSN.PRD_CODE, |
| | | SFTS_CODE = wipSn.SFTS_CODE, |
| | | SFT_CODE = wipSn.SFT_CODE, |
| | | PRD_CODE = wipSn.PRD_CODE, |
| | | ACT_TYPE = NodeAct.ACT_TYPE, |
| | | ACT_SN = CurPosition.CurWipSN.SN, |
| | | ACT_SN = wipSn.SN, |
| | | ACT_VALUE_1 = Label.LABEL_CODE, |
| | | ACT_VALUE_2 = Label.Variables.ToJson(), |
| | | ACT_RESULT = "Y", |
| | | TRACE_INFO = $"标签{Label.LABEL_NAME}[{Label.LABEL_CODE}]打印成功", |
| | | }; |
| | | wipActs.Add(wipAct); |
| | | } |
| | | |
| | | |
| | | //保存数据 |
| | | CurStep.DBSubmitAction = () => |
| | | { |
| | | var db = CurPosition.GetCommitDB(); |
| | | db.Storageable(wipAct, CurPosition.UserCode).ExecuteCommand(); |
| | | db.Storageable(wipActs, CurPosition.UserCode).ExecuteCommand(); |
| | | }; |
| | | |
| | | IsFinished = true; |
| | |
| | | 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 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.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, |
| | | 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 = 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, |
| | | 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 = CurPosition.CurWipSN.SFTS_CODE, |
| | | SFT_CODE = CurPosition.CurWipSN.SFT_CODE, |
| | | PRD_CODE = CurPosition.CurWipSN.PRD_CODE, |
| | | SFTS_CODE = wipSn.SFTS_CODE, |
| | | SFT_CODE = wipSn.SFT_CODE, |
| | | PRD_CODE = wipSn.PRD_CODE, |
| | | ACT_TYPE = NodeAct.ACT_TYPE, |
| | | ACT_SN = CurPosition.CurWipSN.SN, |
| | | ACT_SN = wipSn.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()}]保存成功", |
| | | 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; |
| | | } |
| | | |
| | |
| | | action.IsSuccessed = false; |
| | | action.Data.SetValue(this, null); |
| | | var nextList = Nodes.Where(q => q.IS_FIRST_NODE == "Y"); |
| | | action.LocaleMsg = new("MES.WorkBatch.GotoNextNodeException", wipSN.SN, nextNode.NODE_NAME, string.Join(", ", nextList.Select(q => q.NODE_NAME + (q.CAN_SKIP == "Y" ? $"({T(L("MES.WorkBatch.Optional"), input.Locale)})" : "")))); |
| | | action.LocaleMsg = new("MES.WorkBatch.GotoNextNodeException", input.SN, nextNode.NODE_NAME, string.Join(", ", nextList.Select(q => q.NODE_NAME + (q.CAN_SKIP == "Y" ? $"({T(L("MES.WorkBatch.Optional"), input.Locale)})" : "")))); |
| | | return action; |
| | | } |
| | | } |
| | |
| | | action.IsSuccessed = false; |
| | | action.Data.SetValue(this, null); |
| | | var nextList = reflowNodes.Where(q => wipSN.REFLOW_NODE.IsNullOrEmpty() || wipSN.REFLOW_NODE == q.NODE_NAME); |
| | | action.LocaleMsg = new("MES.WorkBatch.ReflowToNodeException", nextNode.NODE_NAME, wipSN.SN, curNode.NODE_NAME, string.Join(", ", nextList.Select(q => q.NODE_NAME + (q.CAN_SKIP == "Y" ? $"({T(L("MES.WorkBatch.Optional"), input.Locale)})" : "")))); |
| | | action.LocaleMsg = new("MES.WorkBatch.ReflowToNodeException", nextNode.NODE_NAME, input.SN, curNode.NODE_NAME, string.Join(", ", nextList.Select(q => q.NODE_NAME + (q.CAN_SKIP == "Y" ? $"({T(L("MES.WorkBatch.Optional"), input.Locale)})" : "")))); |
| | | return action; |
| | | } |
| | | } |
| | |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.Data.SetValue(this, null); |
| | | action.LocaleMsg = new("MES.WorkBatch.PleaseGotoRepair", curNode.NODE_NAME, wipSN.SN); |
| | | action.LocaleMsg = new("MES.WorkBatch.PleaseGotoRepair", curNode.NODE_NAME, input.SN); |
| | | return action; |
| | | } |
| | | //正常工序过站 |
| | |
| | | action.IsSuccessed = false; |
| | | action.Data.SetValue(this, null); |
| | | var nextList = nextNodes.Where(q => NodeSets.Any(s => s.NODE_ID == q.ID && s.IS_ACTIVE == "Y" && s.CAN_SKIP != "Y")); |
| | | action.LocaleMsg = new("MES.WorkBatch.GotoNextNodeException", wipSN.SN, nextNode.NODE_NAME, string.Join(", ", nextList.Select(q => q.NODE_NAME + (q.CAN_SKIP == "Y" ? $"({T(L("MES.WorkBatch.Optional"), input.Locale)})" : "")))); |
| | | action.LocaleMsg = new("MES.WorkBatch.GotoNextNodeException", input.SN, nextNode.NODE_NAME, string.Join(", ", nextList.Select(q => q.NODE_NAME + (q.CAN_SKIP == "Y" ? $"({T(L("MES.WorkBatch.Optional"), input.Locale)})" : "")))); |
| | | return action; |
| | | } |
| | | //如果当前工序没有必须执行的后续工序,则在前置工序查找还有没有后续工序没完成的工序,有则尝试执行 |
| | |
| | | action.IsSuccessed = false; |
| | | action.Data.SetValue(this, null); |
| | | var nextList = nextNodes.Where(q => NodeSets.Any(s => s.NODE_ID == q.ID && s.IS_ACTIVE == "Y")); |
| | | action.LocaleMsg = new("MES.WorkBatch.GotoNextNodeException", wipSN.SN, nextNode.NODE_NAME, string.Join(", ", nextList.Select(q => q.NODE_NAME + (q.CAN_SKIP == "Y" ? $"({T(L("MES.WorkBatch.Optional"), input.Locale)})" : "")))); |
| | | action.LocaleMsg = new("MES.WorkBatch.GotoNextNodeException", input.SN, nextNode.NODE_NAME, string.Join(", ", nextList.Select(q => q.NODE_NAME + (q.CAN_SKIP == "Y" ? $"({T(L("MES.WorkBatch.Optional"), input.Locale)})" : "")))); |
| | | return action; |
| | | } |
| | | } |
| | |
| | | public MES_LINE CurLine { get; set; } |
| | | public MES_POSITION CurPosition { get; set; } |
| | | public IWorkBatch WorkBatch { get; } |
| | | public MES_WIP_DATA CurWipSN { get; set; } |
| | | public MES_WIP_HIS CurWipSNHis { get; set; } |
| | | public List<MES_WIP_DATA> CurWipSNs { get; set; } |
| | | public string CurSN { get; } |
| | | public List<MES_WIP_HIS> CurWipSNHiss { get; set; } |
| | | public Dictionary<string, object> Context { get; set; } |
| | | /// <summary> |
| | | /// 是否需要临时存储数据库提交操作,待需要的时候再提交 |
| | |
| | | [DisplayName("关联工单号")] |
| | | public string WORK_ORDER { get; set; } |
| | | /// <summary> |
| | | /// 工单批次号 |
| | | /// </summary> |
| | | [DisplayName("工单批次号")] |
| | | public string BATCH_NO { get; set; } |
| | | /// <summary> |
| | | /// 条码 |
| | | /// </summary> |
| | | [DisplayName("条码")] |
| | | public string SN { get; set; } |
| | | /// <summary> |
| | | /// 托盘/载具条码 |
| | | /// </summary> |
| | | [DisplayName("托盘/载具条码")] |
| | | public string TRAY_SN { get; set; } |
| | | /// <summary> |
| | | /// 最外层包装条码 |
| | | /// </summary> |
| | | [DisplayName("最外层包装条码")] |
| | | public string OUTER_SN { get; set; } |
| | | /// <summary> |
| | | /// 状态(0NotInput未投入|1Inputed已投入|2Finished已完工) |
| | | /// </summary> |
| | | [DisplayName("状态(0NotInput未投入|1Inputed已投入|2Finished已完工)")] |
| | | public int STATUS { get; set; } |
| | | /// <summary> |
| | | /// 工单批次号 |
| | | /// </summary> |
| | | [DisplayName("工单批次号")] |
| | | public string BATCH_NO { get; set; } |
| | | /// <summary> |
| | | /// 备注 |
| | | /// </summary> |
| | |
| | | { |
| | | public string ITEM_CODE { get; set; } |
| | | public string RULE_CODE { get; set; } |
| | | /// <summary> |
| | | /// 是否批次物料 |
| | | /// </summary> |
| | | public bool IsBatchItem { get; set; } |
| | | /// <summary> |
| | | /// 上料数量 |
| | | /// </summary> |
| | | public int QTY { get; set; } |
| | | } |
| | | |
| | |
| | | public BAS_ITEM ItemInfo { get; set; } |
| | | public string RuleCode { get; set; } |
| | | public int LoadQty { get; set; } |
| | | /// <summary> |
| | | /// 是否批次物料 |
| | | /// </summary> |
| | | public bool IsBatchItem { get; set; } |
| | | public List<MES_WIP_ASSY> Records { get; set; } = new List<MES_WIP_ASSY>(); |
| | | public bool IsFinished { get; set; } = false; |
| | | |
| | |
| | | |
| | | #region 公共属性 |
| | | /// <summary> |
| | | /// GUID |
| | | /// </summary> |
| | | public string ID { get; set; } |
| | | /// <summary> |
| | | /// 用户ID |
| | | /// </summary> |
| | | public string USER_ID { get; set; } |
| | |
| | | |
| | | #region 公共属性 |
| | | /// <summary> |
| | | /// GUID |
| | | /// </summary> |
| | | public string ID { get; set; } |
| | | /// <summary> |
| | | /// 用户ID |
| | | /// </summary> |
| | | public string USER_ID { get; set; } |
| | |
| | | |
| | | #region 公共属性 |
| | | /// <summary> |
| | | /// GUID |
| | | /// </summary> |
| | | public string ID { get; set; } |
| | | /// <summary> |
| | | /// 用户ID |
| | | /// </summary> |
| | | public string USER_ID { get; set; } |
| | |
| | | |
| | | #region 公共属性 |
| | | /// <summary> |
| | | /// GUID |
| | | /// </summary> |
| | | public string ID { get; set; } |
| | | /// <summary> |
| | | /// 用户ID |
| | | /// </summary> |
| | | public string USER_ID { get; set; } |
| | |
| | | using System; |
| | | using System; |
| | | using SqlSugar; |
| | | using System.Linq; |
| | | using System.ComponentModel; |