Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            int count = this.troughdata.SelectedRows.Count;

            if (count > 0)
            {
                //info.MachineSeq = (decimal)this.troughdata.SelectedRows[0].Cells["MachineSeq"].Value;
                //info.ThroughNum = this.troughdata.SelectedRows[0].Cells["ThroughNum"].Value.ToString();
                string state = troughdata.CurrentRow.Cells["State"].Value.ToString();
                if (state == "禁用")
                {
                    decimal      machineSeq   = (decimal)this.troughdata.SelectedRows[0].Cells["MachineSeq"].Value;
                    string       throughnum   = this.troughdata.SelectedRows[0].Cells["ThroughNum"].Value.ToString();
                    DialogResult MsgBoxResult = MessageBox.Show("确定清除【设备号:" + machineSeq + "/通道号:" + throughnum + "】通道里卷烟信息吗?", //对话框的显示内容
                                                                "提示",                                                           //对话框的标题
                                                                MessageBoxButtons.YesNo,                                        //定义对话框的按钮,这里定义了YSE和NO两个按钮
                                                                MessageBoxIcon.Question,                                        //定义对话框内的图表式样,这里是一个黄色三角型内加一个感叹号
                                                                MessageBoxDefaultButton.Button2);                               //定义对话框的按钮式样
                    if (MsgBoxResult == DialogResult.Yes)
                    {
                        try
                        {
                            if (ThroughClass.DeleteThroughCigarette(machineSeq, throughnum))
                            {
                                MessageBox.Show("【设备号:" + machineSeq + "/通道号:" + throughnum + "】的通道卷烟信息已清除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }

                            Bind();
                        }
                        catch (Exception se)
                        {
                            MessageBox.Show(se.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("如需清除通道卷烟信息,请先禁用该通道");
                }
            }
            else
            {
                MessageBox.Show("请点击选择您要禁用的分拣通道!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #2
0
        public void init(decimal type)
        {
            decimal machineseq = new decimal();

            if (type == 40)
            {
                List <string> list = ThroughClass.GetMachineseqByType(40);
                foreach (var item in list)
                {
                    string[] str = item.Split(',');
                    if (str[0] == "2")
                    {
                        this.cbthroughnum.Items.Add("立式烟仓混合道(" + str[1] + ")");
                    }
                    else
                    {
                        this.cbthroughnum.Items.Add("特异形烟道(" + str[1] + ")");
                    }
                }
                this.cbthroughnum.SelectedIndex = 0;
            }

            else
            {
                machineseq = decimal.Parse(machine);

                this.cbthroughnum.Items.Add(machineseq);
                this.cbthroughnum.SelectedIndex = 0;
            }

            lbltype.Text    = "异形烟";
            lbllineNum.Text = "异形烟分拣线";
            //cbthroughnum.Enabled = false;
            txt_troughdesc.Visible = false;

            box_actcount.Visible = false;
            //cbthroughnum.Visible = false;


            label8.Visible = false;
            // label2.Visible = false;
            label3.Visible = false;
        }
Example #3
0
        void Bind()
        {
            List <decimal> groupNo = new List <decimal>();

            list = new List <ThroughInfo>();
            if (CBGroup1.Checked)
            {
                groupNo.Add(1);
            }
            if (CBGroup2.Checked)
            {
                groupNo.Add(2);
            }
            if (CBGroup3.Checked)
            {
                groupNo.Add(3);
            }
            if (!CBGroup1.Checked && !CBGroup2.Checked && !CBGroup3.Checked)
            {
                groupNo.Add(2);
                CBGroup2.CheckState = CheckState.Checked;
            }
            list = ThroughClass.GetThroughInfo(box_condition.SelectedIndex, groupNo, txt_keywd.Text);

            this.troughdata.DataSource          = list;
            this.troughdata.AutoGenerateColumns = false;

            //string columnwidths = pub.IniReadValue(this.Name, this.troughdata.Name);
            //if (columnwidths != "")
            //{
            //    string[] columns = columnwidths.Split(',');
            //    int j = 0;
            //    for (int i = 0; i < columns.Length; i++)
            //    {
            //        if (troughdata.Columns[i].Visible == true)
            //        {
            //            troughdata.Columns[j].Width = Convert.ToInt32(columns[i]);
            //            j = j + 1;
            //        }
            //    }
            //}
            troughdata.ClearSelection();
        }
Example #4
0
        private void btn_jy_Click(object sender, EventArgs e)
        {
            int count = this.troughdata.SelectedRows.Count;

            if (count > 0)
            {
                ThroughInfo info = new ThroughInfo();
                info.ID            = (decimal)this.troughdata.SelectedRows[0].Cells["ID"].Value;
                info.CigaretteCode = this.troughdata.SelectedRows[0].Cells["CigaretteCode"].Value.ToString();
                info.CigaretteType = decimal.Parse(this.troughdata.CurrentRow.Cells["CigaretteType"].Value + "");
                info.MachineSeq    = (decimal)this.troughdata.SelectedRows[0].Cells["MachineSeq"].Value;
                info.ThroughNum    = this.troughdata.SelectedRows[0].Cells["ThroughNum"].Value.ToString();
                info.GroupNo       = (decimal)this.troughdata.CurrentRow.Cells["GroupNo"].Value;

                DialogResult MsgBoxResult = MessageBox.Show("确定禁用【设备号:" + info.MachineSeq + "/通道号:" + info.ThroughNum + "】通道吗?", //对话框的显示内容
                                                            "提示",                                                                //对话框的标题
                                                            MessageBoxButtons.YesNo,                                             //定义对话框的按钮,这里定义了YSE和NO两个按钮
                                                            MessageBoxIcon.Question,                                             //定义对话框内的图表式样,这里是一个黄色三角型内加一个感叹号
                                                            MessageBoxDefaultButton.Button2);                                    //定义对话框的按钮式样
                if (MsgBoxResult == DialogResult.Yes)
                {
                    try
                    {
                        info.State = "0";
                        ThroughClass.UpdateThroughState(info);
                        ThroughClass.SetThroughActcount(info.CigaretteCode, info.GroupNo);
                        MessageBox.Show("【设备号:" + info.MachineSeq + "/通道号:" + info.ThroughNum + "】的通道已禁用!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Bind();
                    }
                    catch (Exception se)
                    {
                        MessageBox.Show(se.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else
            {
                MessageBox.Show("请点击选择您要禁用的分拣通道!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #5
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            T_PRODUCE_SORTTROUGH tps = new T_PRODUCE_SORTTROUGH();

            //tps.MACHINESEQ = Convert.ToDecimal(this.cbthroughnum.Text.Trim());//设备物理号编号:获取选择下拉框内的通道编号
            if (cbthroughnum.SelectedIndex == 0)
            {
                groupNo        = 2;
                tps.SEQ        = 60;
                tps.LINENUM    = "1";
                tps.TROUGHDESC = "立式烟仓第90道(混合道)";
            }

            else
            {
                groupNo = 1;
                //tps.SEQ = 200;
                tps.LINENUM    = "2";
                tps.TROUGHDESC = "特异型烟道";
            }


            //tps.TROUGHDESC = this.txt_troughdesc.Text.Trim();
            tps.CIGARETTECODE = this.txt_itemno.Text;
            tps.CIGARETTENAME = this.txt_itemname.Text;
            //tps.SEQ = 2;
            tps.GROUPNO       = groupNo;
            tps.TROUGHTYPE    = 10;
            tps.CIGARETTETYPE = Convert.ToDecimal(40);
            tps.MANTISSA      = 0;
            tps.STATE         = "10";
            tps.ACTCOUNT      = 1;
            tps.TROUGHTYPE    = 10;
            tps.THRESHOLD     = 50;
            tps.LASTMANTISSA  = 0;
            //tps.LINENUM = "0";

            //if (tps.MACHINESEQ.ToString() == "")
            //{
            //    MessageBox.Show("请选择通道编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //    return;
            //}
            if (tps.CIGARETTECODE == "")
            {
                MessageBox.Show("请选择卷烟品牌!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (handle_sign == "0")
            {
                string str = this.cbthroughnum.Text.Trim();
                //string s = str.Substring(str.IndexOf('(')+1, str.IndexOf(')') - str.IndexOf('(')-1);
                tps.MACHINESEQ = Convert.ToDecimal(str.Substring(str.IndexOf('(') + 1, str.IndexOf(')') - str.IndexOf('(') - 1));
                string msg = ThroughClass.InsertThrough(tps);

                MessageBox.Show(msg);
                this.Close();
            }
            else
            {
                tps.MACHINESEQ = Convert.ToDecimal(this.cbthroughnum.Text.Trim());
                if (tps.MACHINESEQ.ToString() == "")
                {
                    MessageBox.Show("请选择通道编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                tps.MACHINESEQ = Convert.ToDecimal(this.cbthroughnum.Text.Trim());
                tps.ID         = Convert.ToDecimal(id);
                string msg = ThroughClass.UpdateThrough(tps, lastCigarettecode);
                MessageBox.Show(msg);
            }
        }