internal void UploadSize()
 {
     foreach (var cigaretteScanInfo in CigaretteScanInfoStack.Values)
     {
         ProductDal productDal = new ProductDal();
         CigaretteScanInfo info = productDal.FindProductForScan(cigaretteScanInfo.ProductCode);
         cigaretteScanInfo.ProductNo = info.ProductNo;
         cigaretteScanInfo.Length = info.Length;
         cigaretteScanInfo.Width = info.Width;
         cigaretteScanInfo.Height = info.Height;
         cigaretteScanInfo.Barcode = info.Barcode;
     }
     AutomationContext.Write(memoryServiceName, memoryItemName, CigaretteScanInfoStack);
 }
 internal void Read()
 {
     if (!ScanManagerView.InitCigaretteScanInfoStack()) return;
     TaskDal task = new TaskDal();
     var table = task.FindStockInProduct();
     if (table.Rows.Count > 0)
     {
         foreach (DataRow row in table.Rows)
         {
             ProductDal productDal = new ProductDal();
             CigaretteScanInfo info = productDal.FindProductForScan(Convert.ToString(row["product_code"]));
             if (info != null && !CigaretteScanInfoStack.Keys.Contains(Convert.ToString(row["product_code"])))
             {
                 info.ProductCode = Convert.ToString(row["product_code"]);
                 info.ProductName = Convert.ToString(row["product_name"]);
                 info.Quantity = Convert.ToInt32(row["task_quantity"]);
                 info.Index = 0;
                 info.State = "0";
                 lock (CigaretteScanInfoStack)
                 {
                     CigaretteScanInfoStack.Add(info.ProductCode, info);
                 }
             }
             else if (info == null)
             {
                 XtraMessageBox.Show(string.Format("当前卷烟 {0} : {1} 没有尺寸信息,请先行进行维护!",
                     Convert.ToString(row["product_code"]), Convert.ToString(row["product_name"]))
                     , "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 XtraMessageBox.Show(string.Format("当前卷烟 {0} : {1} 已有扫码任务!",
                     Convert.ToString(row["product_code"]), Convert.ToString(row["product_name"]))
                     , "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
         AutomationContext.Write(memoryServiceName, memoryItemName, CigaretteScanInfoStack);
     }
     else
     {
         XtraMessageBox.Show("当前没有卷烟入库任务!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
     }
     Refresh();
 }
 internal void New()
 {
     if (!ScanManagerView.InitCigaretteScanInfoStack()) return;
     TaskDal task = new TaskDal();
     var table = task.FindStockInProduct();
     if (table.Rows.Count > 0)
     {
         CreateScanTaskDialog createScanTaskDialog = new CreateScanTaskDialog(table);
         if (createScanTaskDialog.ShowDialog() == DialogResult.OK && createScanTaskDialog.Quantity > 0)
         {
             ProductDal productDal = new ProductDal();
             CigaretteScanInfo info = productDal.FindProductForScan(createScanTaskDialog.SelectedCigaretteCode);
             if (info != null && !CigaretteScanInfoStack.Keys.Contains(createScanTaskDialog.SelectedCigaretteCode))
             {
                 info.ProductCode = createScanTaskDialog.SelectedCigaretteCode;
                 info.ProductName = createScanTaskDialog.SelectedCigaretteName;
                 info.Quantity = createScanTaskDialog.Quantity;
                 info.Index = 0;
                 info.State = "0";
                 lock (CigaretteScanInfoStack)
                 {
                     CigaretteScanInfoStack.Add(info.ProductCode, info);
                 }
                 AutomationContext.Write(memoryServiceName, memoryItemName, CigaretteScanInfoStack);
             }
             else if (info == null)
             {
                 XtraMessageBox.Show("当前卷烟没有尺寸信息,请先行进行维护!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 XtraMessageBox.Show("当前卷烟已有扫码任务!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
     }
     else
     {
         XtraMessageBox.Show("当卷烟没有入库任务!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     Refresh();
 }