| | |
| | | info.InputQty = CurOperInfo(input.Locale).InputQty; |
| | | action.Data.OperInfo = info; |
| | | } |
| | | else if (!IsFinishAllSteps) |
| | | else if (Steps.Any() && !IsFinishAllSteps) |
| | | { |
| | | action.Data.OperInfo = SetOperNodeInfo(CurOperInfo(input.Locale)); |
| | | } |
| | |
| | | public ApiAction<SubmitOutput> NodeSubmit(ApiAction<SubmitOutput> action, SubmitInput input) |
| | | { |
| | | var curNode = CurBatch.GetNode(PostCode); |
| | | |
| | | try |
| | | { |
| | | //工序节点逻辑增加如果根基当前岗位找不到对应工序的时候要报错 |
| | | if (curNode.IsNullOrEmpty()) |
| | | { |
| | | action.Data.ShortMsg = new("未知工序", ShortMessage.Types.Error); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"岗位[{0}]在工单[{1}]工艺路线中找不到对应的工序,请检查工单工艺路线中工序与岗位的绑定关系是否正确"); |
| | | action.LocaleMsg = new("MES.Transaction.CollectNode.NodeSubmit.OperateNodeError", PostCode, CurBatch.WO.ORDER_NO); |
| | | return action; |
| | | } |
| | | var curNodeSetting = CurBatch.GetNodeSetting(curNode); |
| | | |
| | | //当工步列表为空,则执行当前工序的必要逻辑当作第一个工序节点,完成后按需求创建后续的工步列表 |
| | | if (Steps.IsNullOrEmpty()) |
| | | { |
| | | BeginAt = DateTime.Now; |
| | | //判断工单实时状态判断是否可以生产 |
| | | var woStatus = CurBatch.CheckCanProduce(curNode); |
| | | var woStatus = CurBatch.CheckCanProduce(curNode, curNodeSetting); |
| | | if (!woStatus.IsSuccessed) |
| | | { |
| | | woStatus.Data.ShortMsg = new("工单异常", ShortMessage.Types.Error); |
| | |
| | | } |
| | | |
| | | //更新工单条码明细信息 |
| | | var woSNs = CurBatch.WoSNs.Where(q => wipSNs.Any(w => q.SN == w.SN)).ToList(); |
| | | var woSNs = CurBatch.WoSNs.Where(q => wipSNs.Any(w => q.WIP_ID == w.ID)).ToList(); |
| | | foreach (var woSN in woSNs) |
| | | { |
| | | woSN.AUTH_ORG = CurBatch.WO.AUTH_ORG; |
| | |
| | | wipSN.PRD_CODE = curShiftPeriod.Period.PRD_CODE; |
| | | } |
| | | //如果是投入站 |
| | | if (curNode.IS_INPUT == "Y") |
| | | if (curNodeSetting.IS_INPUT == "Y") |
| | | { |
| | | var woSN = woSNs.First(q => q.SN == wipSN.SN); |
| | | var woSN = woSNs.First(q => q.WIP_ID == wipSN.ID); |
| | | 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") |
| | | if (curNodeSetting.IS_OUTPUT == "Y") |
| | | { |
| | | var woSN = woSNs.First(q => q.SN == wipSN.SN); |
| | | var woSN = woSNs.First(q => q.WIP_ID == wipSN.ID); |
| | | woSN.STATUS = BIZ_MES_WO_SN.STATUSs.Finished.GetValue(); |
| | | wipSN.STATUS = MES_WIP_DATA.STATUSs.Finished.GetValue(); |
| | | wipSN.OUTLINE_DATE = DateTime.Now; |
| | |
| | | var _wipSns = wipSNs.Clone(); |
| | | var _wipHiss = CurWipSNHiss.Clone(); |
| | | var _defect = CurDefects.Clone(); |
| | | var _curNode = curNode.Clone(); |
| | | var _curNodeSetting = curNodeSetting.Clone(); |
| | | var _Batch = CurBatch.Batch.Clone(); |
| | | |
| | | //初始化工步列表 |
| | |
| | | db.Storageable(_defect, UserCode).ExecuteCommand(); |
| | | } |
| | | //如果是投入站 |
| | | if (_curNode.IS_INPUT == "Y") |
| | | if (_curNodeSetting.IS_INPUT == "Y") |
| | | { |
| | | db.Updateable<BIZ_MES_WO>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + _woSns.Count).Where(q => q.ORDER_NO == _Batch.ORDER_NO).ExecuteCommand(); |
| | | db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + _woSns.Count).Where(q => q.BATCH_NO == _Batch.BATCH_NO).ExecuteCommand(); |
| | | } |
| | | //如果是产出站 |
| | | if (_curNode.IS_OUTPUT == "Y") |
| | | if (_curNodeSetting.IS_OUTPUT == "Y") |
| | | { |
| | | db.Updateable<BIZ_MES_WO>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + _woSns.Count).Where(q => q.ORDER_NO == _Batch.ORDER_NO).ExecuteCommand(); |
| | | db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + _woSns.Count).Where(q => q.BATCH_NO == _Batch.BATCH_NO).ExecuteCommand(); |
| | |
| | | //保存成功,返回过站消息 |
| | | CurOperInfo(locale).InputQty += CurWipSNs.Count; |
| | | action.Data.OperInfo = SetOperNodeInfo(CurOperInfo(locale)); |
| | | action.Data.ShortMsg = new("过站成功", ShortMessage.Types.Success); |
| | | action.Data.ShortMsg = new(CurWipSNs.Any(q => q.DFT_FLAG == "Y") ? "不良过站" : "良品过站", 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>()); |
| | | |