服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-09-12 f6c758a94829953aa75bbe888c6dfa99d077c8df
优化三码合一行为,验证客户条码行为
已修改3个文件
已重命名1个文件
121 ■■■■ 文件已修改
Tiger.Api/Language.db 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business.MES/WorkAction/ThreeInOne.cs 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business.MES/WorkAction/VerifyCustomSN.cs 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.IBusiness/MES/WorkAction/IVerifyCustomSN.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Api/Language.db
Binary files differ
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;
        }
Tiger.Business.MES/WorkAction/VerifyCustomSN.cs
@@ -1,4 +1,5 @@
using Rhea.Common;
using Org.BouncyCastle.Ocsp;
using Rhea.Common;
using SqlSugar;
using System;
using System.Collections.Generic;
@@ -12,7 +13,7 @@
namespace Tiger.Business.MES.WorkAction
{
    public class VerifyCustomSN : IVerifyItem
    public class VerifyCustomSN : IVerifyCustomSN
    {
        #region Propertys & Variables
        #region å›ºå®šå†™æ³•,工序中的必要信息
@@ -22,7 +23,7 @@
        public MES_WO_NODE_ACT NodeAct { get; set; }
        public MES_WO_ACTION Setting { get; set; }
        #endregion
        public BAS_ITEM_CUST CustInfo { get; set; }
        #endregion Propertys & Variables
        #region Functions
@@ -39,8 +40,10 @@
            Setting = setting;
            #endregion
            CurStep.Message = Biz.L("验证产品数据");
            CurStep.Status = StepStatus.Normal;
            //获取当前产品在当前客户的关系
            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.SetStatusMessage(StepStatus.Normal, Biz.L("验证是否客户标签"));
        }
        /// <summary>
@@ -49,8 +52,8 @@
        /// <returns></returns>
        public Locale GetBeginMsg()
        {
            var msg = new Locale("MES.WorkAction.VerifyItem.BeginMsg");
            //var msg = new Locale($"开始验证产品[{CurPosition.CurWipSN.SN}]");
            var msg = new Locale("MES.WorkAction.VerifyCustomSN.BeginMsg", CurPosition.CurSN);
            //var msg = new Locale($"开始验证条码[{0}]是否客户标签");
            return msg;
        }
@@ -85,7 +88,7 @@
            if (!action.IsSuccessed)
            {
                //如果行为设置为出错需要重置工序操作
                if (NodeAct.NEED_RESET == "Y")
                //if (NodeAct.NEED_RESET == "Y")
                {
                    CurPosition.ResetNode();
                }
@@ -99,23 +102,17 @@
            {
                var isOK = true;
                //验证逻辑
                //if (input.SN.IsNullOrEmpty())
                if (!CustInfo.RULE_CODE.IsNullOrEmpty() && !Biz.CodeRule[CustInfo.RULE_CODE].IsNullOrEmpty())
                {
                    CurStep.Message = Biz.L("验证失败");
                    CurStep.Status = StepStatus.Error;
                    action.Data.ShortMsg = new("验证失败", ShortMessage.Types.Failed);
                    action.IsSuccessed = isOK = false;
                    //action.LocaleMsg = new Locale($"错误:[{ExtInfo.FIELD_NAME}]标签条码不能为空,请重新扫描");
                    //action.LocaleMsg = new Locale("MES.WorkAction.VerifyItem.SnEmptyError", ExtInfo.FIELD_NAME);
                }
                //if (CurPosition.CurWipSNs.Any(w => w.SN == input.SN))
                {
                    CurStep.Message = Biz.L("验证失败");
                    CurStep.Status = StepStatus.Error;
                    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.VerifyItem.ScanProdSnError", input.SN, ExtInfo.FIELD_NAME);
                    var result = Biz.CodeRule[CustInfo.RULE_CODE].Verify(CurPosition.CurSN);
                    if (!result.IsSuccessed)
                    {
                        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.VerifyCustomSN.CustSnVerifyError", CurPosition.CurSN, CustInfo.RULE_CODE);
                    }
                }
                //验证通过则保存
@@ -123,18 +120,15 @@
                {
                    action = End(input);
                }
                //都没有物料验证通过,则返回错误信息
            }
            catch (System.Exception ex)
            {
                CurStep.Message = Biz.L("验证异常");
                CurStep.Status = StepStatus.Error;
                action.Data.ShortMsg = new("验证异常", ShortMessage.Types.Exception);
                action.CatchExceptionWithLog(ex, $"验证异常");
                CurStep.SetStatusMessage(StepStatus.Error, Biz.L("客户标签验证异常"));
                action.Data.ShortMsg = new("客户标签验证异常", ShortMessage.Types.Exception);
                action.CatchExceptionWithLog(ex, $"客户标签验证异常");
                action.IsSuccessed = false;
                //action.LocaleMsg = new($"产品[{CurPosition.CurSN}]验证异常,工序已重置,请重新扫描进站产品条码");
                //action.LocaleMsg = new("MES.WorkAction.VerifyItem.SaveExtInfoException", CurPosition.CurSN);
                //action.LocaleMsg = new($"标签条码[{0}]验证异常,工序已重置,请重新扫描进站产品条码");
                action.LocaleMsg = new("MES.WorkAction.VerifyCustomSN.CustSnVerifyException", CurPosition.CurSN);
                CurPosition.ResetNode();
            }
            return action;
@@ -201,11 +195,10 @@
            };
            IsFinished = true;
            CurStep.Message = Biz.L("验证通过");
            CurStep.Status = StepStatus.Finished;
            action.Data.ShortMsg = new("验证通过", ShortMessage.Types.Success);
            //action.LocaleMsg = new($"产品[{CurPosition.CurSN}]验证通过");
            action.LocaleMsg = new("MES.WorkAction.VerifyItem.VerifySuccess", CurPosition.CurSN);
            CurStep.SetStatusMessage(StepStatus.Finished, Biz.L("客户标签验证通过"));
            action.Data.ShortMsg = new("客户标签验证通过", ShortMessage.Types.Success);
            //action.LocaleMsg = new($"客户标签条码[{0}]验证通过");
            action.LocaleMsg = new("MES.WorkAction.VerifyCustomSN.VerifySuccess", CurPosition.CurSN);
            return action;
        }
Tiger.IBusiness/MES/WorkAction/IVerifyCustomSN.cs
ÎļþÃû´Ó Tiger.IBusiness/MES/WorkAction/IVerifyItem.cs ÐÞ¸Ä
@@ -5,7 +5,7 @@
namespace Tiger.IBusiness.MES.WorkAction
{
    public interface IVerifyItem : IWorkAction
    public interface IVerifyCustomSN : IWorkAction
    {
    }