/// <summary>
        /// 产品总成编码校验
        /// </summary>
        /// <param name="productType">总成编码</param>
        /// <param name="productCode">产品编码</param>
        /// <param name="barCodeType">编码类型</param>
        /// <param name="error">出错时返回的错误信息</param>
        /// <returns>检验通过返回true, 失败返回false</returns>
        public bool VerifyProductCodesInfo(string productType, string productCode, GlobalObject.CE_BarCodeType barCodeType, out string error)
        {
            DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

            error = null;

            try
            {
                var varData = from a in ctx.F_GoodsPlanCost
                              where a.GoodsCode == productType
                              select a;

                foreach (var item in varData)
                {
                    if (VerifyProductCodesInfo(item.ID, productCode, barCodeType, out error))
                    {
                        return(true);
                    }
                }

                error = "未找到匹配编码";
                return(false);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        /// <summary>
        /// 产品总成编码校验
        /// </summary>
        /// <param name="goodsID">总成ID</param>
        /// <param name="productCode">产品编码</param>
        /// <param name="barCodeType">编码类型</param>
        /// <param name="error">出错时返回的错误信息</param>
        /// <returns>检验通过返回true, 失败返回false</returns>
        public bool VerifyProductCodesInfo(int goodsID, string productCode, GlobalObject.CE_BarCodeType barCodeType, out string error)
        {
            error       = "";
            productCode = productCode.ToUpper();

            View_F_GoodsPlanCost goodsInfo = UniversalFunction.GetGoodsInfo(goodsID);

            if (!Convert.ToBoolean(BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.检测钢印码及条形码]))
            {
                return(true);
            }

            if (StapleFunction.IsChineseCharacters(productCode))
            {
                error = "请不要在产品编号中包含中文字符";
                return(false);
            }

            Dictionary <CE_GoodsAttributeName, object> dic = UniversalFunction.GetGoodsInfList_Attribute_AttchedInfoList(goodsID);

            if (!dic.Keys.ToList().Contains(CE_GoodsAttributeName.流水码))
            {
                throw new Exception(UniversalFunction.GetGoodsMessage(goodsID) + "基础属性未设置【流水码】");
            }

            List <F_ProductWaterCode> lstWaterCode = dic[CE_GoodsAttributeName.流水码] as List <F_ProductWaterCode>;

            if (lstWaterCode.Count == 0)
            {
                error = "产品类型不正确,无法找到对应的编码规则";
                return(false);
            }
            else
            {
                foreach (var item in lstWaterCode)
                {
                    //条形码检测
                    if (barCodeType == CE_BarCodeType.出厂条形码)
                    {
                        if (productCode.Length == item.BarcodeExample.Length &&
                            Regex.IsMatch(productCode, @item.BarcodeRole))
                        {
                            return(true);
                        }
                    }//钢印码检测
                    else if (barCodeType == CE_BarCodeType.内部钢印码)
                    {
                        if (productCode.Length == item.SteelSealExample.Length &&
                            Regex.IsMatch(productCode, @item.SteelSealRole))
                        {
                            return(true);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }

                if (barCodeType == CE_BarCodeType.出厂条形码)
                {
                    error = "编码规则不符,条形码正确格式为";
                    foreach (var item in lstWaterCode)
                    {
                        error += "【" + item.BarcodeExample.Trim() + "】";
                    }
                }
                else if (barCodeType == CE_BarCodeType.内部钢印码)
                {
                    error = "编码规则不符,钢印码正确格式为";
                    foreach (var item in lstWaterCode)
                    {
                        error += "【" + item.SteelSealExample.Trim() + "】";
                    }
                }

                return(false);
            }
        }