Esempio n. 1
0
 private void toolStripButton5_Click(object sender, EventArgs e)
 {
     try
     {
         this.liZuoSensor.AlarmsNolight();
         this.IsRedLight = false;
         bool flag = !this.IsErrorTags();
         if (flag)
         {
             MessageBox.Show("尾捆有错误标签不能上传,或尾捆无数据");
         }
         else
         {
             bool flag2 = this.m_TagTable.Count != Convert.ToInt32(this.toolStripTextBox_buonds.Text);
             if (flag2)
             {
                 MessageBoxButtons buttons      = MessageBoxButtons.OKCancel;
                 DialogResult      dialogResult = MessageBox.Show(string.Concat(new object[]
                 {
                     "捆数量:",
                     this.m_TagTable.Count,
                     "\r\n标签数量:",
                     this.ErrorTags.Count,
                     "\r\n合计:",
                     this.m_TagTable.Count * Convert.ToInt32(this.toolStripTextBox_item.Text) + this.ErrorTags.Count
                 }), "警告", buttons);
                 bool flag3 = dialogResult == DialogResult.OK;
                 if (flag3)
                 {
                     this.AddBoxItem();
                     Bounds   bounds = new Bounds(this.ErrorTags.Count);
                     string[] array  = new string[this.ErrorTags.Count];
                     int      num    = 0;
                     foreach (string text in this.ErrorTags.Keys)
                     {
                         array[num++] = text;
                     }
                     bounds.AddTags(array);
                     bounds.CapTimer = DateTime.Now;
                     bool flag4 = !this.m_TagTable.Contains(this.BoundID.ToString());
                     if (flag4)
                     {
                         this.m_TagTable.Add(this.BoundID.ToString(), bounds);
                     }
                     this.Upload();
                     DataRowView dataRowView = (DataRowView)this.toolStripComboBox1.ComboBox.SelectedItem;
                     Printer.AddPrintTask(dataRowView["FCode"].ToString(), dataRowView["FName"].ToString(), this.BoxNO, ((this.m_TagTable.Count - 1) * Convert.ToInt32(this.toolStripTextBox_item.Text) + this.ErrorTags.Count).ToString());
                     this.ErrorTags.Clear();
                     this.UpdataBoxItem();
                     this.listView_Bunchs.Items.Clear();
                     this.m_TagTable.Clear();
                     this.BoundID = 1;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         this.liZuoSensor.RedAlarms();
         MessageBox.Show(ex.ToString());
     }
 }
Esempio n. 2
0
        private void AddBoundsItem()
        {
            ListViewItem listViewItem = new ListViewItem();

            listViewItem.SubItems[0].Text = this.GetBoundID().ToString();
            listViewItem.SubItems.Add(this.m_BoundTags.Count.ToString());
            this.UpdataBoundsTags(this.m_BoundTags);
            bool flag = this.IsTagsCorrect() && this.CheckRepeat(this.m_BoundTags) && this.CheckBoxTagsInHistory(this.m_BoundTags);

            if (flag)
            {
                listViewItem.SubItems.Add("正确");
                listViewItem.SubItems[1].BackColor = Color.Green;
                this.liZuoSensor.GreenAlarms();
                this.listView_Bunchs.Items.Add(listViewItem);
                string[] array = new string[Convert.ToInt32(this.toolStripTextBox_item.Text)];
                int      num   = 0;
                foreach (string current in this.m_BoundTags)
                {
                    array[num] = current;
                    num++;
                }
                Bounds bounds = new Bounds(Convert.ToInt32(this.toolStripTextBox_item.Text));
                bounds.AddTags(array);
                bounds.CapTimer = DateTime.Now;
                bool flag2 = !this.m_TagTable.Contains(this.BoundID.ToString());
                if (flag2)
                {
                    this.m_TagTable.Add(this.BoundID.ToString(), bounds);
                }
                bool flag3 = this.m_TagTable.Count == Convert.ToInt32(this.toolStripTextBox_buonds.Text);
                if (flag3)
                {
                    bool flag4 = this.CheckBoxTags();
                    if (flag4)
                    {
                        this.AddBoxItem();
                        this.Upload();
                        DataRowView dataRowView = (DataRowView)this.toolStripComboBox1.ComboBox.SelectedItem;
                        Printer.AddPrintTask(dataRowView["FCode"].ToString(), dataRowView["FName"].ToString(), this.BoxNO, (this.m_TagTable.Count * Convert.ToInt32(this.toolStripTextBox_item.Text)).ToString());
                        this.UpdataBoxItem();
                        this.listView_Bunchs.Items.Clear();
                        this.m_TagTable.Clear();
                        this.BoundID = 1;
                    }
                    else
                    {
                        this.toolStripLabel6.Text      = "错误信息:" + DateTime.Now.ToString() + "_一箱中标签重复";
                        this.toolStripLabel6.ForeColor = Color.Red;
                        this.liZuoSensor.RedAlarms();
                        this.listView_Bunchs.Items.Clear();
                        this.m_TagTable.Clear();
                        this.BoundID = 1;
                    }
                }
            }
            else
            {
                listViewItem.SubItems.Add("错误");
                listViewItem.SubItems[2].BackColor = Color.Red;
                this.liZuoSensor.RedAlarms();
                this.liZuoSensor.RejectTask();
                this.listView_Bunchs.Items.Add(listViewItem);
                this.HoldErrorTags();
            }
        }