Ejemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                txtProductCode.Text = txtProductCode.Text.Trim().ToUpper();

                //if (m_blIsTCUFlag)
                //{
                //    List<string> lstTemp = txtProductCode.Text.Split(',').ToList();

                //    if (lstTemp.Count() > 1)
                //    {
                //        txtProductCode.Text = lstTemp[2] + "(" + lstTemp[3] + ")";
                //    }
                //}

                if (!m_serverProductCode.VerifyProductCodesInfo(m_barCodeInfo.GoodsID, txtProductCode.Text.Trim(),
                                                                GlobalObject.CE_BarCodeType.内部钢印码, out m_err))
                {
                    throw new Exception(m_err);
                }

                switch (m_enumBusinessType)
                {
                case CE_BusinessType.库房业务:
                    CheckBusiness(typeof(CE_MarketingType));
                    break;

                case CE_BusinessType.车间业务:
                    CheckBusiness(typeof(CE_SubsidiaryOperationType));
                    break;

                case CE_BusinessType.综合业务:
                    CheckBusiness(typeof(CE_MarketingType));
                    CheckBusiness(typeof(CE_SubsidiaryOperationType));
                    break;

                default:
                    break;
                }

                if (!CheckNumber(txtProductCode.Text))
                {
                    return;
                }

                string strBoxNo = "";

                if (_TempBoxNo.Trim().Length > 0)
                {
                    strBoxNo = _TempBoxNo;
                }
                else
                {
                    if (m_enumBusinessType == CE_BusinessType.库房业务 || m_enumBusinessType == CE_BusinessType.综合业务)
                    {
                        if (m_dicMarkInfo.First().Value == CE_MarketingType.入库)
                        {
                            SetBoxNo();
                        }
                        else
                        {
                            strBoxNo = m_findSellIn.GetHoldBoxNo(txtProductCode.Text);
                        }
                    }
                }

                m_dtProductCodes = (DataTable)dataGridView1.DataSource;

                DataRow dr = m_dtProductCodes.NewRow();

                dr["Number"]      = m_dtProductCodes.Rows.Count + 1;
                dr["ProductCode"] = txtProductCode.Text;
                dr["BoxNo"]       = strBoxNo == "" ? txtBoxNo.Text : strBoxNo;
                m_dtProductCodes.Rows.Add(dr);
                dataGridView1.DataSource = m_dtProductCodes;

                PositioningRecord(txtProductCode.Text);
                txtProductCode.Text = "";
                txtProductCode.Focus();
            }
            catch (Exception ex)
            {
                timer1.Enabled = false;
                MessageDialog.ShowPromptMessage("编号:【" + txtProductCode.Text + "】  " + ex.Message);
                txtProductCode.Text = "";
                txtProductCode.Focus();
                timer1.Enabled = true;
                return;
            }
        }