服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
2024-10-11 9f49831b4fc9d883acaec0601dc0d5b3bb25bf4f
包装数量(出货数量)包装工序验证
已修改2个文件
91 ■■■■■ 文件已修改
Tiger.Business.MES/Transaction/PackingNode.cs 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Model.Net/Entitys/MES/ParameterEntity/PositionParameter.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business.MES/Transaction/PackingNode.cs
@@ -48,6 +48,15 @@
            var action = new ApiAction<SubmitOutput>(new SubmitOutput());
            try
            {
                if (input.Qty.ToInt32() <= 0)
                {
                    action.Data.ShortMsg = new("请输入包装数量", ShortMessage.Types.Error);
                    action.Data.OperInfo = new();
                    action.IsSuccessed = false;
                    action.LocaleMsg = new($"包装数量[{input.Qty}]不正确,请重新输入数量后继续包装操作");
                    //action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.QtyError", input.Qty);
                    return action;
                }
                //PkgSubmit:手动结束包装,手动保存暂存的包装数据
                if (NodeCmd == "PkgSubmit")
                {
@@ -119,22 +128,22 @@
                                    action.IsSuccessed = false;
                                    //action.LocaleMsg = new($"条码[{0}]已在产线[{1}]投入生产,请在正确岗位扫描");
                                    action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.NotCorrectLine", input.SN, wosns.First().Batch.ACT_LINE);
                                }
                                }
                                else
                                {
                                    if (CurBatch?.Batch?.ORDER_NO != wosns.First().Batch.ORDER_NO)
                                    {
                                        //条码已绑定的工单不等于当前工单则重新选择工单
                                        var result = await SelectOrder(new() { AuthOption = input.AuthOption, OrderNo = wosns.First().Batch.ORDER_NO }, wosns.First().Batch.BATCH_NO);
                                    if (CurBatch?.Batch?.ORDER_NO != wosns.First().Batch.ORDER_NO)
                                    {
                                        //条码已绑定的工单不等于当前工单则重新选择工单
                                        var result = await SelectOrder(new() { AuthOption = input.AuthOption, OrderNo = wosns.First().Batch.ORDER_NO }, wosns.First().Batch.BATCH_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.LocaleMsg = result.LocaleMsg;
                                            return action;
                                        }
                                    }
                                    //更新CurBatch
                                    CurBatch?.Update();
                                    //条码过站
@@ -225,9 +234,9 @@
                        action.Data.ShortMsg = new("重置扫描", ShortMessage.Types.Error);
                        action.Data.OperInfo = CurOperInfo(input.Locale);
                        ResetNode();
                        action.IsSuccessed = false;
                        //action.LocaleMsg = new($"岗位[{CurPosition.POST_CODE}]工步执行异常,请重新扫描产品条码", CurPosition.POST_CODE);
                        action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.WorkStepException", CurPosition.POST_CODE);
                        action.IsSuccessed = false;
                        //action.LocaleMsg = new($"岗位[{CurPosition.POST_CODE}]工步执行异常,请重新扫描产品条码", CurPosition.POST_CODE);
                        action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.WorkStepException", CurPosition.POST_CODE);
                    }
                }
            }
@@ -365,21 +374,21 @@
                        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.ROT_CODE = CurBatch.WO.ROUTE_CODE;
                        wipSN.NODE_ID = curNode.ID;
                        wipSN.NODE_NAME = curNode.NODE_NAME;
                        wipSN.FTY_CODE = CurFactory.FTY_CODE;
                        wipSN.WS_CODE = CurWorkshop.WS_CODE;
                        wipSN.LINE_CODE = CurLine.LINE_CODE;
                        wipSN.POST_CODE = CurPosition.POST_CODE;
                        wipSN.OPER_CODE = curNode.OPER_CODE;
                        wipSN.SEGMENT = curNode.SEGMENT;
                        wipSN.OPERATION_TIME = DateTime.Now;
                        wipSN.NODE_ID = curNode.ID;
                        wipSN.NODE_NAME = curNode.NODE_NAME;
                        wipSN.FTY_CODE = CurFactory.FTY_CODE;
                        wipSN.WS_CODE = CurWorkshop.WS_CODE;
                        wipSN.LINE_CODE = CurLine.LINE_CODE;
                        wipSN.POST_CODE = CurPosition.POST_CODE;
                        wipSN.OPER_CODE = curNode.OPER_CODE;
                        wipSN.SEGMENT = curNode.SEGMENT;
                        wipSN.OPERATION_TIME = DateTime.Now;
                        var curShiftPeriod = GetShiftPeriodForNow();
                        if (!curShiftPeriod.IsNullOrEmpty())
                        {
                            wipSN.SFTS_CODE = curShiftPeriod.ShiftSys.SFTS_CODE;
                            wipSN.SFT_CODE = curShiftPeriod.Shift.SFT_CODE;
                            wipSN.PRD_CODE = curShiftPeriod.Period.PRD_CODE;
                            wipSN.SFTS_CODE = curShiftPeriod.ShiftSys.SFTS_CODE;
                            wipSN.SFT_CODE = curShiftPeriod.Shift.SFT_CODE;
                            wipSN.PRD_CODE = curShiftPeriod.Period.PRD_CODE;
                        }
                        //如果是投入站
                        if (curNodeSetting.IS_INPUT == "Y")
@@ -467,20 +476,20 @@
                    //初始化工步列表
                    Steps.Clear();
                    var curStep = new WorkStep(IWorkStep.NodeTypes.Node, this)
                    var curStep = new WorkStep(IWorkStep.NodeTypes.Node, this)
                    {
                        Name = "扫描产品",
                        Sequence = Steps.Count + 1,
                        Node = curNode,
                        Node = curNode,
                        OperSetting = CurBatch.NodeSets.FirstOrDefault(q => q.NODE_ID == curNode.ID),
                        DBSubmitAction = () =>
                        {
                        {
                            //使用统一的事务DB对象
                            var db = GetCommitDB();
                            //数据保存逻辑
                            db.Storageable(_woSns, UserCode).ExecuteCommand();
                            db.Storageable(_wipSns, UserCode).ExecuteCommand();
                            db.Storageable(_wipHiss, UserCode).ExecuteCommand();
                            db.Storageable(_woSns, UserCode).ExecuteCommand();
                            db.Storageable(_wipSns, UserCode).ExecuteCommand();
                            db.Storageable(_wipHiss, UserCode).ExecuteCommand();
                            //如果有不良则保存
                            if (_defect.Any())
                            {
@@ -499,8 +508,8 @@
                                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();
                            }
                        }
                    };
                    Steps.Add(curStep);
                    };
                    Steps.Add(curStep);
                    //有需要用户提交信息则添加工序节点的其他工步
@@ -520,7 +529,7 @@
                    curStep.IsFinished = true;
                    curStep.Status = StepStatus.Finished;
                    CurStep = curStep;
                }
                }
                else if (!IsFinishNodeSteps)
                {
                    var curStep = Steps.Where(q => q.NodeType == IWorkStep.NodeTypes.Node && !q.IsFinished).OrderBy(q => q.Sequence).First();
@@ -606,11 +615,11 @@
            action.Data.OperInfo = SetOperNodeInfo(CurOperInfo(locale));
            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>());
            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;
        }
@@ -636,11 +645,11 @@
                        int curQty = CurPkg.Item.TotalQty;
                        int ruleQty = TempPkgAction.PkgRule.GetTotalQty();
                        //有填出货数量则验证当前包装数量必须等于(出货数量/包装规则数量)的余数
                        if (shipQty > 0 &&  curQty != shipQty % ruleQty)
                        if (shipQty > 0 && curQty != shipQty % ruleQty)
                        {
                            action.IsSuccessed = false;
                            //action.LocaleMsg = new($"出货数量设定为[{0}],目前包装了[{1}],包装尾数的数量必需是[{2}],请装够数量后再结束包装");
                            action.LocaleMsg = new("MES.Transaction.PackingNode.NotMatchShipQty", shipQty, curQty, shipQty % ruleQty);
                            action.LocaleMsg = new("MES.Transaction.PackingNode.NotMatchShipQty", shipQty, curQty, shipQty % ruleQty);
                            return action;
                        }
Tiger.Model.Net/Entitys/MES/ParameterEntity/PositionParameter.cs
@@ -45,6 +45,10 @@
        /// 当前操作需要提交的数据
        /// </summary>
        public string Data { get; set; }
        /// <summary>
        /// 数量
        /// </summary>
        public string Qty { get; set; }
    }
    public class SubmitOutput