服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-09-12 f6c758a94829953aa75bbe888c6dfa99d077c8df
Tiger.Business.MES/WorkAction/ThreeInOne.cs
@@ -27,6 +27,7 @@
        public BAS_LABEL_TEMP Label { get; set; }
        public List<BAS_LABEL_PV> LabelPV { get; set; }
        public List<mes_MOPickList> MoPickList { get; set; }
        public BAS_ITEM_CUST CustInfo { get; set; }
        #endregion Propertys & Variables
        #region Functions
@@ -48,6 +49,8 @@
            LabelPV = Biz.Db.Queryable<BAS_LABEL_PV>().ToList();
            //获取工单备料信息
            MoPickList = Biz.DataSource["YadaU9C"].Client.Queryable<mes_MOPickList>().Where(q => q.MoDocNo == CurPosition.WorkBatch.WO.ORDER_NO).ToList();
            //获取当前产品在当前客户的关系
            CustInfo = Biz.Db.Queryable<BAS_ITEM_CUST>().Where(q => q.ITEM_ID == CurPosition.WorkBatch.WO.ItemInfo.ID && q.CUST_CODE == CurPosition.WorkBatch.WO.CUST_CODE).First();
            CurStep.Message = Biz.L("扫描厂内条码");
            CurStep.Status = StepStatus.Normal;
@@ -183,38 +186,41 @@
                CUST_SN = input.Data,
            };
            var isOK = true;
            //客户条码已绑定其他厂内条码
            if (!CurCSN.FLOW_SN.IsNullOrEmpty() && CurCSN.FLOW_SN != CurPosition.CurWipSNs.First().SN)
            {
                CurStep.Message = Biz.L("绑定失败");
                CurStep.Status = StepStatus.Error;
                action.Data.ShortMsg = new("绑定失败", ShortMessage.Types.Failed);
                action.IsSuccessed = false;
                CurStep.SetStatusMessage(StepStatus.Error, Biz.L("客户标签绑定失败"));
                action.Data.ShortMsg = new("客户标签绑定失败", ShortMessage.Types.Failed);
                action.IsSuccessed = isOK = false;
                //action.LocaleMsg = new($"厂内条码[{0}]绑定客户条码[{1}]失败,客户条码已绑定厂内条码[{2}]");
                action.LocaleMsg = new("MES.WorkAction.ThreeInOne.BindingOtherSN", CurPosition.CurWipSNs.First().SN, CurCSN.CUST_SN, CurCSN.FLOW_SN);
                //如果行为设置为出错需要重置工序操作
                if (NodeAct.NEED_RESET == "Y")
                {
                    CurPosition.ResetNode();
                }
            }
            //客户条码不属于当前工单的客户
            else if (CurCSN.CUST_CODE.IsNullOrEmpty(CurPosition.WorkBatch.WO.CUST_CODE) != CurPosition.WorkBatch.WO.CUST_CODE)
            if (CurCSN.CUST_CODE.IsNullOrEmpty(CurPosition.WorkBatch.WO.CUST_CODE) != CurPosition.WorkBatch.WO.CUST_CODE)
            {
                CurStep.Message = Biz.L("绑定失败");
                CurStep.Status = StepStatus.Error;
                action.Data.ShortMsg = new("绑定失败", ShortMessage.Types.Failed);
                action.IsSuccessed = false;
                CurStep.SetStatusMessage(StepStatus.Error, Biz.L("客户标签绑定失败"));
                action.Data.ShortMsg = new("客户标签绑定失败", ShortMessage.Types.Failed);
                action.IsSuccessed = isOK = false;
                //action.LocaleMsg = new($"客户条码[{0}]属于客户[{1}],与当前工单的客户[{2}]不一致");
                action.LocaleMsg = new("MES.WorkAction.ThreeInOne.NotSameCustomer", CurCSN.CUST_SN, CurCSN.CUST_CODE, CurPosition.WorkBatch.WO.CUST_CODE);
                //如果行为设置为出错需要重置工序操作
                if (NodeAct.NEED_RESET == "Y")
            }
            //验证产品客户标签条码规则
            if (!CustInfo.RULE_CODE.IsNullOrEmpty() && !Biz.CodeRule[CustInfo.RULE_CODE].IsNullOrEmpty())
            {
                var result = Biz.CodeRule[CustInfo.RULE_CODE].Verify(CurCSN.CUST_SN);
                if (!result.IsSuccessed)
                {
                    CurPosition.ResetNode();
                    CurStep.SetStatusMessage(StepStatus.Error, Biz.L("客户标签绑定失败"));
                    action.Data.ShortMsg = new("客户标签绑定失败", ShortMessage.Types.Failed);
                    action.IsSuccessed = isOK = false;
                    //action.LocaleMsg = new Locale($"标签条码[{0}]未通过客户标签规则[{1}]验证");
                    action.LocaleMsg = new Locale("MES.WorkAction.ThreeInOne.CustSnVerifyError", CurCSN.CUST_SN, CustInfo.RULE_CODE);
                }
            }
            //提交数据执行失败
            else
            //验证通过则保存
            if (isOK)
            {
                CurCSN.CUST_CODE = CurPosition.WorkBatch.WO.CUST_CODE;
                CurCSN.FLOW_SN = CurPosition.CurWipSNs.First().SN;
@@ -222,6 +228,14 @@
                CurCSN.ITEM_CODE = CurPosition.WorkBatch.WO.ITEM_CODE;
                action = End(input);
            }
            else
            {
                //如果行为设置为出错需要重置工序操作
                if (NodeAct.NEED_RESET == "Y")
                {
                    CurPosition.ResetNode();
                }
            }
            return action;
        }