/// <summary>
        /// 更新指定短信的数据
        /// </summary>
        /// <param name="shortMsgID">短信ID</param>
        /// <param name="shortMsg">更新后的短信内容</param>
        public void Update(string shortMsgID, View_Task_ShortMessage shortMsg)
        {
            TaskManagementDataContext ctx = CommentParameter.TaskManagementDataContext;

            var result = from r in ctx.Task_ShortMessage
                         where r.ID == shortMsgID
                         select r;

            Task_ShortMessage msg = result.Single();

            msg.Status  = shortMsg.状态;
            msg.Content = shortMsg.短信内容;

            if (GlobalObject.GeneralFunction.IsNullOrEmpty(shortMsg.接收人手机号) || !StapleFunction.IsHandset(shortMsg.接收人手机号))
            {
                throw new Exception(string.Format("不正确的手机号码:{0}", shortMsg.接收人手机号));
            }

            msg.MobileNo       = shortMsg.接收人手机号;
            msg.Receiver       = shortMsg.接收人姓名;
            msg.SendTime       = shortMsg.发送时间;
            msg.Remark         = shortMsg.备注;
            msg.CreateTime     = ServerTime.Time;
            msg.ShortMsgTypeID = GetShortMsgType(shortMsg.短信类别).TypeID;

            ctx.SubmitChanges();
        }
        /// <summary>
        /// 发送传递流消息
        /// </summary>
        /// <param name="billNo">单据号</param>
        /// <param name="message">单据消息</param>
        /// <param name="receivedUserType">接收用户类别,角色或用户</param>
        /// <param name="receiver">接收消息的角色或用户组</param>
        /// <param name="lstAdditionalInfo">
        /// 附加信息,用于重定向及数据定位等功能(列表第1个位置始终为重定向单据的单据类型,列表第2个位置始终为重定向单据的单据号)
        /// </param>
        public void SendMessage(string billNo, string message, BillFlowMessage_ReceivedUserType receivedUserType,
                                List <string> receiver, List <string> lstAdditionalInfo)
        {
            if (m_billType == null || m_billType == "")
            {
                m_billType = GetBillType(billNo);
            }

            Debug.Assert(!GlobalObject.GeneralFunction.IsNullOrEmpty(m_billType), "单据类别不能为空");
            Debug.Assert(!GlobalObject.GeneralFunction.IsNullOrEmpty(billNo), "单据号不能为空");
            Debug.Assert(!GlobalObject.GeneralFunction.IsNullOrEmpty(message), "消息不能为空");

            try
            {
                Flow_BillFlowMessage msg = GetMessage(billNo);

                if (msg != null)
                {
                    msg.发起方用户编码 = BasicInfo.LoginID;
                    msg.发起方消息   = message;
                    msg.接收方类型   = receivedUserType.ToString();
                    msg.接收方     = StapleFunction.CreateSplitString(",", receiver);

                    msg.期望的处理完成时间 = null;

                    InitAdditionalInfo(ref msg, lstAdditionalInfo);

                    m_billFlowMsg.ContinueMessage(BasicInfo.LoginID, msg);

                    SendFinishedFlagToMessagePromptForm(billNo);
                }
                else
                {
                    msg = new Flow_BillFlowMessage();

                    msg.初始发起方用户编码 = BasicInfo.LoginID;
                    msg.单据号       = billNo;
                    msg.单据类型      = m_billType;
                    msg.单据流水号     = billNo;
                    msg.接收方类型     = receivedUserType.ToString();
                    msg.单据状态      = BillStatus.等待处理.ToString();
                    msg.发起方消息     = message;
                    msg.接收方       = StapleFunction.CreateSplitString(",", receiver);

                    msg.期望的处理完成时间 = null;

                    InitAdditionalInfo(ref msg, lstAdditionalInfo);

                    m_billFlowMsg.SendRequestMessage(BasicInfo.LoginID, msg);
                }
            }
            catch (Exception exce)
            {
                m_logManagement.WriteException(exce.Message + "\t\r" + exce.StackTrace, out m_error);
            }
        }
        /// <summary>
        /// 从旧数据中拷贝检测数据、实现装配数据到新区域
        /// </summary>
        private void CopyMeasureData()
        {
            if (txtOldCheckData.Text == "")
            {
                return;
            }

            txtCheckData.Text  = StapleFunction.GetNonNumericString(txtOldCheckData.Text);
            txtResultData.Text = StapleFunction.GetNonNumericString(txtOldResultData.Text);
        }
        /// <summary>
        /// 添加短信
        /// </summary>
        /// <param name="lstShortMsg">短信列表</param>
        /// <param name="status">短信状态</param>
        public void Add(List <View_Task_ShortMessage> lstShortMsg, ShortMessageStatus status)
        {
            //signing messages
            TaskManagementDataContext ctx = CommentParameter.TaskManagementDataContext;

            Task_ShortMessage shortMsg = new Task_ShortMessage();

            DateTime date = ServerTime.Time;

            var result = from r in ctx.Task_ShortMessage
                         where r.ID.Substring(3, 4) == date.Year.ToString()
                         select r;

            int maxValue = 1;

            if (result.Count() > 0)
            {
                maxValue += (from r in ctx.Task_ShortMessage
                             where r.ID.Substring(3, 4) == date.Year.ToString()
                             select Convert.ToInt32(r.ID.Substring(9))).Max();
            }

            foreach (var item in lstShortMsg)
            {
                Task_ShortMessage addItem = new Task_ShortMessage();

                // HYX : 短信项
                addItem.ID = string.Format("SMX{0:D4}{1:D2}{2:D5}", date.Year, date.Month, maxValue);

                maxValue++;

                addItem.CreaterID  = BasicInfo.LoginID;
                addItem.CreateTime = date;
                addItem.Receiver   = item.接收人姓名;

                if (GlobalObject.GeneralFunction.IsNullOrEmpty(item.接收人手机号) || !StapleFunction.IsHandset(item.接收人手机号))
                {
                    throw new Exception(string.Format("不正确的手机号码:{0}", item.接收人手机号));
                }

                addItem.MobileNo       = item.接收人手机号;
                addItem.Content        = item.短信内容;
                addItem.SendTime       = item.发送时间;
                addItem.Status         = status.ToString();
                addItem.Remark         = item.备注;
                addItem.ShortMsgTypeID = GetShortMsgType(item.短信类别).TypeID;

                ctx.Task_ShortMessage.InsertOnSubmit(addItem);
            }

            ctx.SubmitChanges();
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            BindingCollection <View_S_GoodsEnteringBill> tempList = dataGridView1.DataSource as BindingCollection <View_S_GoodsEnteringBill>;
            View_S_GoodsEnteringBill tempLnq = new View_S_GoodsEnteringBill();

            if (txtName.Text.Trim().Length == 0)
            {
                MessageDialog.ShowPromptMessage("物品名称不能为空");
                return;
            }

            tempLnq.单据号 = txtSDBNo.Text;

            tempLnq.图号型号   = txtCode.Text.ToUpper().Trim();
            tempLnq.图号型号   = StapleFunction.DeleteSpace(tempLnq.图号型号);
            tempLnq.物品名称   = txtName.Text.Trim();
            tempLnq.物品名称   = tempLnq.物品名称.Replace('(', '(');
            tempLnq.物品名称   = tempLnq.物品名称.Replace(')', ')');
            tempLnq.规格     = txtSpec.Text.Trim();
            tempLnq.单位     = cmbUnit.Text;
            tempLnq.材料类别   = txtDepot.Text;
            tempLnq.材料类别编码 = txtDepot.Tag.ToString();
            tempLnq.备注     = txtRemark.Text.Trim();

            try
            {
                foreach (View_S_GoodsEnteringBill item in tempList)
                {
                    if (item.图号型号 == tempLnq.图号型号 && item.物品名称 == tempLnq.物品名称 && item.规格 == tempLnq.规格)
                    {
                        throw new Exception("已存在于当前列表中,无法重复添加");
                    }
                }

                CheckString(tempLnq.物品名称);
                m_serverGoodsEntering.CheckGoodsInfo(tempLnq);
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
                return;
            }

            tempList.Add(tempLnq);
            RefreshDataGridView(m_listGoodsEntering);
            ClearInfo();
        }
        /// <summary>
        /// 传递流消息到多个角色或用户(走流程)
        /// </summary>
        /// <param name="billNo">单据号</param>
        /// <param name="message">消息内容</param>
        /// <param name="receivedUserType">接收方类别,角色或用户</param>
        /// <param name="receiver">接收方代码数组,角色编码或用户编码</param>
        /// <param name="lstAdditionalInfo">
        /// 附加信息,用于重定向及数据定位等功能(列表第1个位置始终为重定向单据的单据类型,列表第2个位置始终为重定向单据的单据号)
        /// </param>
        /// <returns>操作是否成功的标志</returns>
        public bool PassFlowMessage(string billNo, string message, BillFlowMessage_ReceivedUserType receivedUserType,
                                    List <string> receiver, List <string> lstAdditionalInfo)
        {
            if (m_billType == null || m_billType == "")
            {
                m_billType = GetBillType(billNo);
            }

            Debug.Assert(!GlobalObject.GeneralFunction.IsNullOrEmpty(m_billType), "单据类别不能为空");
            Debug.Assert(!GlobalObject.GeneralFunction.IsNullOrEmpty(billNo), "单据号不能为空");
            Debug.Assert(!GlobalObject.GeneralFunction.IsNullOrEmpty(message), "消息不能为空");

            try
            {
                Flow_BillFlowMessage msg = GetMessage(billNo);

                if (msg != null)
                {
                    msg.发起方用户编码 = BasicInfo.LoginID;
                    msg.发起方消息   = message;
                    msg.接收方类型   = receivedUserType.ToString();
                    msg.接收方     = StapleFunction.CreateSplitString(",", receiver);

                    msg.期望的处理完成时间 = null;

                    InitAdditionalInfo(ref msg, lstAdditionalInfo);

                    m_billFlowMsg.ContinueMessage(BasicInfo.LoginID, msg);

                    SendFinishedFlagToMessagePromptForm(billNo);
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// 发送新的流消息
        /// </summary>
        /// <param name="billNo">单据号</param>
        /// <param name="message">单据消息</param>
        /// <param name="receivedUserType">接收用户类别,角色或用户</param>
        /// <param name="receiver">接收消息的角色或用户组</param>
        /// <param name="lstAdditionalInfo">
        /// 附加信息,用于重定向及数据定位等功能(列表第1个位置始终为重定向单据的单据类型,列表第2个位置始终为重定向单据的单据号)
        /// </param>
        public void SendNewFlowMessage(string billNo, string message, BillFlowMessage_ReceivedUserType receivedUserType,
                                       List <string> receiver, List <string> lstAdditionalInfo)
        {
            if (m_billType == null || m_billType == "")
            {
                m_billType = GetBillType(billNo);
            }

            Debug.Assert(!GlobalObject.GeneralFunction.IsNullOrEmpty(m_billType), "单据类别不能为空");
            Debug.Assert(!GlobalObject.GeneralFunction.IsNullOrEmpty(billNo), "单据号不能为空");
            Debug.Assert(!GlobalObject.GeneralFunction.IsNullOrEmpty(message), "消息不能为空");

            try
            {
                Flow_BillFlowMessage msg = new Flow_BillFlowMessage();

                msg.初始发起方用户编码 = BasicInfo.LoginID;
                msg.单据号       = billNo;
                msg.单据类型      = m_billType;
                msg.单据流水号     = billNo;
                msg.接收方类型     = receivedUserType.ToString();
                msg.单据状态      = BillStatus.等待处理.ToString();
                msg.发起方消息     = message;
                msg.接收方       = StapleFunction.CreateSplitString(",", receiver);

                msg.期望的处理完成时间 = null;

                InitAdditionalInfo(ref msg, lstAdditionalInfo);

                m_billFlowMsg.SendRequestMessage(BasicInfo.LoginID, msg);
            }
            catch (Exception)
            {
                throw;
            }
        }
        private void btnModify_Click(object sender, EventArgs e)
        {
            if (dataGridView1.CurrentRow == null)
            {
                return;
            }

            View_S_GoodsEnteringBill tempLnq = new View_S_GoodsEnteringBill();

            if (txtName.Text.Trim().Length == 0)
            {
                MessageDialog.ShowPromptMessage("物品名称不能为空");
                return;
            }

            tempLnq.单据号 = txtSDBNo.Text;

            tempLnq.图号型号   = txtCode.Text.ToUpper().Trim();
            tempLnq.图号型号   = StapleFunction.DeleteSpace(tempLnq.图号型号);
            tempLnq.物品名称   = txtName.Text.Trim();
            tempLnq.物品名称   = tempLnq.物品名称.Replace('(', '(');
            tempLnq.物品名称   = tempLnq.物品名称.Replace(')', ')');
            tempLnq.规格     = txtSpec.Text.Trim();
            tempLnq.单位     = cmbUnit.Text;
            tempLnq.材料类别   = txtDepot.Text;
            tempLnq.材料类别编码 = txtDepot.Tag.ToString();
            tempLnq.备注     = txtRemark.Text.Trim();

            dataGridView1.CurrentRow.Cells["图号型号"].Value = txtCode.Text.Trim();

            #region 2016-11-22, 夏石友, 增加了去除全角、半角空格的功能
            dataGridView1.CurrentRow.Cells["物品名称"].Value = StapleFunction.DeleteSpace(txtName.Text.Trim());
            dataGridView1.CurrentRow.Cells["规格"].Value   = StapleFunction.DeleteSpace(txtSpec.Text.Trim());
            #endregion

            dataGridView1.CurrentRow.Cells["材料类别"].Value   = txtDepot.Text;
            dataGridView1.CurrentRow.Cells["材料类别编码"].Value = txtDepot.Tag;
            dataGridView1.CurrentRow.Cells["单位"].Value     = cmbUnit.Text;
            dataGridView1.CurrentRow.Cells["备注"].Value     = txtRemark.Text.Trim();


            try
            {
                CheckString(tempLnq.物品名称);
                m_serverGoodsEntering.CheckGoodsInfo(tempLnq);

                dataGridView1.CurrentRow.Cells["图号型号"].Value   = tempLnq.图号型号;
                dataGridView1.CurrentRow.Cells["物品名称"].Value   = tempLnq.物品名称;
                dataGridView1.CurrentRow.Cells["规格"].Value     = tempLnq.规格;
                dataGridView1.CurrentRow.Cells["材料类别"].Value   = tempLnq.材料类别;
                dataGridView1.CurrentRow.Cells["材料类别编码"].Value = tempLnq.材料类别编码;
                dataGridView1.CurrentRow.Cells["单位"].Value     = tempLnq.单位;
                dataGridView1.CurrentRow.Cells["备注"].Value     = tempLnq.备注;
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
                return;
            }

            ClearInfo();
        }
        /// <summary>
        /// 结束流消息(流程已经走完)
        /// </summary>
        /// <param name="billNo">单据号</param>
        /// <param name="message">消息内容</param>
        /// <param name="noticeRoles">要知会的角色列表</param>
        /// <param name="noticeUsers">要知会的用户列表</param>
        /// <returns>操作是否成功的标志</returns>
        public bool EndFlowMessage(string billNo, string message, List <string> noticeRoles, List <string> noticeUsers)
        {
            if (m_billType == null || m_billType == "")
            {
                m_billType = GetBillType(billNo);
            }

            Debug.Assert(!GlobalObject.GeneralFunction.IsNullOrEmpty(m_billType), "单据类别不能为空");
            Debug.Assert(!GlobalObject.GeneralFunction.IsNullOrEmpty(billNo), "单据号不能为空");
            Debug.Assert(!GlobalObject.GeneralFunction.IsNullOrEmpty(message), "消息不能为空");
            //Debug.Assert(noticeRoles != null, "要知会的角色列表不能为空");

            try
            {
                m_logManagement.WriteException(string.Format("进入EndFlowMessage, BillNo:{0},Msg:{1}", billNo, message), out m_error);

                Flow_BillFlowMessage msg = GetMessage(billNo);

                if (msg != null)
                {
                    m_billFlowMsg.EndMessage(BasicInfo.LoginID, msg.序号, message);

                    // 2014-11-17 14:55 增加判断,如果没有角色和知会用户时不发送知会消息
                    if ((noticeRoles != null && noticeRoles.Count > 0) || (noticeUsers != null && noticeUsers.Count > 0))
                    {
                        // 获取要知会的用户编码
                        List <string> lstNoticeUser = GetUserCodes(noticeRoles, noticeUsers);

                        if (!lstNoticeUser.Contains(msg.初始发起方用户编码))
                        {
                            lstNoticeUser.Add(msg.初始发起方用户编码);
                        }

                        // 发送知会消息
                        NotifyMessage(msg.单据类型, msg.单据号, message, BasicInfo.LoginID, noticeRoles, lstNoticeUser);
                    }

                    SendFinishedFlagToMessagePromptForm(billNo);
                }
                else
                {
                    m_logManagement.WriteException(string.Format("没有找到单据消息,主动添加消息。EndFlowMessage, BillNo:{0},Msg:{1}", billNo, message), out m_error);

                    BillFlowMessage_ReceivedUserType receivedUserType = BillFlowMessage_ReceivedUserType.用户;

                    if (noticeRoles != null && noticeRoles.Count > 0)
                    {
                        receivedUserType = BillFlowMessage_ReceivedUserType.角色;
                    }

                    msg = new Flow_BillFlowMessage();

                    msg.初始发起方用户编码 = BasicInfo.LoginID;
                    msg.单据号       = billNo;
                    msg.单据类型      = m_billType;
                    msg.单据流水号     = billNo;
                    msg.接收方类型     = receivedUserType.ToString();
                    msg.单据状态      = BillStatus.已完成.ToString();
                    msg.发起方消息     = message;
                    msg.接收方       = StapleFunction.CreateSplitString(",",
                                                                     receivedUserType == BillFlowMessage_ReceivedUserType.角色 ? noticeRoles : noticeUsers);

                    msg.期望的处理完成时间 = null;

                    m_billFlowMsg.SendRequestMessage(BasicInfo.LoginID, msg);
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// 检查录入的信息是否正确
        /// </summary>
        /// <returns>正确返回true</returns>
        private bool CheckData()
        {
            if (m_dataRow["父总成编码"] == "")
            {
                MessageDialog.ShowPromptMessage("一级总成不允许进行此操作");
                return(false);
            }

            if (m_updateMode != UpdateModeEnum.调整 && txtBatchNo.Text.Length == 0)
            {
                numBarcode.Focus();
                MessageDialog.ShowPromptMessage("请获取返修件的条形码后再进行此操作");
                return(false);
            }

            if (numAssemblyAmount.Value == 0m)
            {
                numAssemblyAmount.Focus();
                MessageDialog.ShowPromptMessage("请录入装配数量后再进行此操作");
                return(false);
            }

            if (txtRemark.Text.Trim().Length == 0)
            {
                txtRemark.Focus();
                MessageDialog.ShowPromptMessage("请录入备注信息后再进行此操作");
                return(false);
            }

            if (m_electronFileServer.IsAssemblyPart(m_dataRow["零部件编码"]))
            {
                return(true);
            }

            string error;

            if (txtOldCheckData.Text.Length > 0)
            {
                if (StapleFunction.GetNonNumericString(txtOldCheckData.Text) != StapleFunction.GetNonNumericString(txtCheckData.Text) ||
                    !CheckNumericInfo(txtCheckData.Text))
                {
                    txtCheckData.Focus();
                    MessageDialog.ShowPromptMessage("请录入正确的检测数据后再进行此操作(效仿数据区的检测数据录入格式)");
                    return(false);
                }

                if (!CheckSpec(out error))
                {
                    txtCheckData.Focus();
                    MessageDialog.ShowPromptMessage(error);
                    return(false);
                }

                int    index = txtResultData.Text.LastIndexOf(':');
                double value = 0;

                if (index + 1 == txtResultData.Text.Length ||
                    StapleFunction.GetNonNumericString(txtResultData.Text) != StapleFunction.GetNonNumericString(txtResultData.Text) ||
                    !CheckNumericInfo(txtResultData.Text) ||
                    !Double.TryParse(txtResultData.Text.Substring(index + 1), out value))
                {
                    txtResultData.Focus();
                    MessageDialog.ShowPromptMessage("请录入正确的测量数据后再进行此操作(效仿数据区的测量数据录入格式)");
                    return(false);
                }
            }
            else
            {
                if (txtSpec.Text != m_dataRow["规格"])
                {
                    numBarcode.Focus();
                    MessageDialog.ShowPromptMessage("扫描零件的规格必须与原规格一致");
                    return(false);
                }
            }

            if (m_dataRow["零件标识码"].Length > 0 && txtPartID.Text.Trim().Length == 0)
            {
                txtPartID.Focus();
                MessageDialog.ShowPromptMessage("请录入零件标识码后再进行此操作");
                return(false);
            }

            return(true);
        }
        /// <summary>
        /// 检查数字录入是否正确
        /// </summary>
        /// <param name="strData">要检查的字符串</param>
        /// <returns>正确返回true</returns>
        private bool CheckNumericInfo(string strData)
        {
            int    index     = strData.IndexOf('=');
            int    nextIndex = -1;
            string strValue;
            Regex  r = new Regex(@"(^[+-]?(\d+)(\.\d+)?$)|(^[+-]?\d+(\.\d+)?[+]\d+(\.\d+)?$)"); // 同时匹配 +0.18 or +0.18+0.20

            while (index != -1)
            {
                nextIndex = strData.IndexOf(',', index);

                if (nextIndex == -1)
                {
                    nextIndex = strData.Length - 1;
                }

                if (nextIndex == index + 1)
                {
                    return(false);
                }
                else
                {
                    if (StapleFunction.IsChineseCharacters(strData.Substring(nextIndex - 1, 1)))
                    {
                        strValue = strData.Substring(index + 1, nextIndex - index - 2);
                    }
                    else
                    {
                        strValue = strData.Substring(index + 1, nextIndex - index - 1);
                    }

                    //Regex r = new Regex(@"^[+-]?(\d+)(\.\d+)?$"); // 匹配浮点数
                    //Regex r = new Regex(@"^[+-]?\d+(\.\d+)?[+]\d+(\.\d+)?$"); // 匹配 +0.18+0.20

                    if (!r.IsMatch(strValue))
                    {
                        return(false);
                    }
                }

                index = strData.IndexOf('=', nextIndex + 1);
            }

            index = strData.IndexOf(':');

            while (index != -1)
            {
                nextIndex = strData.IndexOf(',', index);

                if (nextIndex == -1)
                {
                    nextIndex = strData.Length;
                }

                if (nextIndex == index + 1)
                {
                    return(false);
                }
                else
                {
                    if (StapleFunction.IsChineseCharacters(strData.Substring(nextIndex - 1, 1)))
                    {
                        strValue = strData.Substring(index + 1, nextIndex - index - 2);
                    }
                    else
                    {
                        strValue = strData.Substring(index + 1, nextIndex - index - 1);
                    }

                    if (!r.IsMatch(strValue))
                    {
                        return(false);
                    }
                }

                index = nextIndex == strData.Length ? -1 : strData.IndexOf(':', nextIndex + 1);
            }

            return(true);
        }
        /// <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);
            }
        }