public void Scan(string text, string cigaretteCode, string barcode) { using (PersistentManager pm = new PersistentManager()) { StockOutDao outDao = new StockOutDao(); SupplyDao supplyDao = new SupplyDao(); if (barcode != string.Empty && supplyDao.Exist(barcode)) { return; } DataTable table = supplyDao.FindCigaretteAll(cigaretteCode); if (table.Rows.Count > 0) { THOK.AS.Stocking.View.ScanDialog scanDialog = new THOK.AS.Stocking.View.ScanDialog(table); scanDialog.setInformation(text, barcode); if (scanDialog.ShowDialog() == DialogResult.OK) { if (scanDialog.IsPass && scanDialog.Barcode.Length == 6) { cigaretteCode = scanDialog.SelectedCigaretteCode; barcode = scanDialog.Barcode; using (PersistentManager pmServer = new PersistentManager("ServerConnection")) { ServerDao serverDao = new ServerDao(); serverDao.SetPersistentManager(pmServer); serverDao.UpdateCigaretteToServer(barcode, cigaretteCode); } outDao.UpdateCigarette(barcode, cigaretteCode); } else { MessageBox.Show("验证码错误!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } }