Example #1
0
        /// <summary>
        /// 获取分拣机正在出烟的任务
        /// </summary>
        private void GetPutTask()
        {
            int taskno = 0;

            try
            {
                OperateOpcAndSoft operateOpcAndSoft = new OperateOpcAndSoft();
                taskno = operateOpcAndSoft.GetSortingTaskNo();

                foreach (DataGridViewRow dataGridViewRow in dgvIssued.Rows)
                {
                    if (dataGridViewRow.DefaultCellStyle.BackColor == Color.GreenYellow)
                    {
                        dataGridViewRow.DefaultCellStyle.BackColor = Color.White;
                        dataGridViewRow.DefaultCellStyle.ForeColor = Color.Black;
                    }
                    if ((Convert.ToInt32(dataGridViewRow.Cells["dataGridViewTextBoxColumn47"].Value) == taskno))
                    {
                        dataGridViewRow.DefaultCellStyle.BackColor = Color.GreenYellow;
                        dataGridViewRow.DefaultCellStyle.ForeColor = Color.Red;
                    }
                }
            }
            catch
            {
            }

            //if (puttaskindexno != taskno  && taskno != 0)
            //{
            //    puttaskindexno = taskno;

            //    Thread thread = new Thread(SetOrderNixielight);
            //    thread.Start();
            //}
        }
Example #2
0
        public void LoadLineBoxProcess()
        {
            LineBoxProcessList lineboxprocesslist =
                LineBoxProcessList.GetList(ConfigurationSettings.AppSettings["Mode"].ToLower());

            try
            {
                OperateOpcAndSoft     operateOpcAndSoft = new OperateOpcAndSoft();
                Dictionary <int, int> putoutnums        = operateOpcAndSoft.GetPutOutNum();

                for (int i = 0; i < lineboxprocesslist.Count; i++)
                {
                    if (putoutnums.ContainsKey(Convert.ToInt32(lineboxprocesslist[i].LINEBOXCODE)))
                    {
                        lineboxprocesslist[i].OUTQTY    = putoutnums[Convert.ToInt32(lineboxprocesslist[i].LINEBOXCODE)];
                        lineboxprocesslist[i].REMAINQTY = lineboxprocesslist[i].NONQTY - lineboxprocesslist[i].OUTQTY;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }



            dgvLineboxprocess.DataSource = lineboxprocesslist;
            footSumLabel1.Sumdata();
        }
Example #3
0
        private void buttonX1_Click(object sender, EventArgs e)
        {
            OperateOpcAndSoft operateOpcAndSoft = new OperateOpcAndSoft();

            operateOpcAndSoft.InDataToTaskAddress();
            operateOpcAndSoft.OutDataToTaskAddress();
        }
Example #4
0
        /// <summary>
        /// 保存混仓卷烟在皮带上的数量
        /// </summary>
        private static void SaveDynamicBoxPutNum()
        {
            try
            {
                OperateOpcAndSoft     operateOpcAndSoft = new OperateOpcAndSoft();
                Dictionary <int, int> putoutnums        = operateOpcAndSoft.GetDynamicBoxPutNum();

                SortingTaskArrive sortingtaskarrive = SortingTaskArrive.GetSortingTaskArrive("0");

                if (Convert.ToInt32(sortingtaskarrive.Value) != putoutnums[73])
                {
                    sortingtaskarrive.ADDRESSCODE = "73";
                    sortingtaskarrive.Value       = putoutnums[73].ToString();
                    sortingtaskarrive.Save();
                }
            }
            catch
            {
            }
        }
Example #5
0
        public bool SendPD()
        {
            try
            {
                Dictionary <int, int> senDictionary = new Dictionary <int, int>();

                LineBoxProcessList lineboxprocesslist = LineBoxProcessList.GetList("盘点");

                OperateOpcAndSoft     operateOpcAndSoft = new OperateOpcAndSoft();
                Dictionary <int, int> putoutnums        = operateOpcAndSoft.GetPutOutNum();

                for (int i = 0; i < lineboxprocesslist.Count; i++)
                {
                    if (putoutnums.ContainsKey(Convert.ToInt32(lineboxprocesslist[i].LINEBOXCODE)))
                    {
                        lineboxprocesslist[i].OUTQTY = putoutnums[Convert.ToInt32(lineboxprocesslist[i].LINEBOXCODE)];
                        lineboxprocesslist[i].NONQTY = (lineboxprocesslist[i].NONQTY - lineboxprocesslist[i].OUTQTY);
                    }

                    //if (i == 9 || i == 11 || i == 21 || i == 23 || i == 33 || i == 36 || i == 45 || i == 47 || i == 57 || i == 59 || i == 69 || i == 71 || i == 81 || i == 83)
                    //将双仓的数量与前一个单仓相加
                    if (AppUtil.Put2LineBox.Contains(lineboxprocesslist[i].LINEBOXCODE))
                    {
                        lineboxprocesslist[i - 1].NONQTY = lineboxprocesslist[i - 1].NONQTY + lineboxprocesslist[i].NONQTY;
                    }
                }

                for (int i = 0; i < lineboxprocesslist.Count; i++)
                {
                    senDictionary.Add(Convert.ToInt32(lineboxprocesslist[i].LINEBOXCODE), lineboxprocesslist[i].NONQTY);
                }

                NixielightSDK.SendByMODBUS(senDictionary);
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Example #6
0
        private static void SaveUPDownPutIndexno()
        {
            try
            {
                try
                {
                    OperateOpcAndSoft operateOpcAndSoft = new OperateOpcAndSoft();
                    int upindexno = operateOpcAndSoft.GetUpPutIndexno();

                    PutInfo.SaveUpPutIndex(upindexno);

                    int downindexno = operateOpcAndSoft.GetDownPutIndexno();
                    PutInfo.SaveDownPutIndex(downindexno);
                }
                catch
                {
                }
            }
            catch
            {
            }
        }
Example #7
0
        private void GetOutPortInfo()
        {
            opert = new OperateOpcAndSoft();

            GetFirstCode();
            _outport = new OutPort(indexno);
            _outport.GetCustInfo();
            int onesum   = 0;
            int twosum   = 0;
            int threesum = 0;
            Dictionary <string, Color> ciginfo = _outport.GetCigInfo(ref onesum, ref twosum, ref threesum);

            labonesum.Text    = onesum.ToString();
            labtwosum.Text    = twosum.ToString();
            labthreesum.Text  = threesum.ToString();
            labonetwosum.Text = (onesum + twosum).ToString();
            foreach (Control control in this.panelEx2.Controls)
            {
                if (control is LabelX && control.Tag != null)
                {
                    if (_outport.ContainsKey(control.Tag.ToString()))
                    {
                        ((LabelX)control).Text = _outport[control.Tag.ToString()];
                    }
                }
            }

            foreach (Control control in this.panel6.Controls)
            {
                if (control is LabelX && control.Tag != null)
                {
                    if (_outport.ContainsKey(control.Tag.ToString()))
                    {
                        ((LabelX)control).Text = _outport[control.Tag.ToString()];
                    }
                }
            }


            itemPanel1.BeginUpdate();
            itemPanel1.Items.Clear();
            foreach (var s in ciginfo)
            {
                LabelItem labelItem = new LabelItem();
                labelItem.Text       = s.Key.Replace("(", " ").Replace(")", "");
                labelItem.Font       = new System.Drawing.Font("黑体", 14);
                labelItem.BorderSide = eBorderSide.All;
                labelItem.BorderType = eBorderType.Bump;
                if (s.Key.Contains("*"))
                {
                    labelItem.ForeColor = Color.Red;
                }
                else
                {
                    labelItem.ForeColor = s.Value;
                }
                labelItem.TextLineAlignment = StringAlignment.Center;
                labelItem.Width             = 225;
                labelItem.Height            = 25;
                //labelItem.WordWrap = true;
                itemPanel1.Items.Add(labelItem);
            }
            itemPanel1.EndUpdate();
        }
Example #8
0
        private void OpcItemList_Load(object sender, EventArgs e)
        {
            listView1.Columns.Add("address");
            listView1.GridLines     = true;  //显示网格线
            listView1.FullRowSelect = true;  //是否全行选择
            listView1.HideSelection = false; //失去焦点时显示选择的项

            listView1.MultiSelect = false;   //设置只能单选
            listView1.View        = View.Details;

            ListViewGroup group1 = new ListViewGroup();

            group1.Header          = "DB1";
            group1.HeaderAlignment = HorizontalAlignment.Center;

            ListViewGroup group6 = new ListViewGroup();

            group6.Header          = "DB6";
            group6.HeaderAlignment = HorizontalAlignment.Center;

            ListViewGroup group10 = new ListViewGroup();

            group10.Header          = "DB10";
            group10.HeaderAlignment = HorizontalAlignment.Center;

            ListViewGroup group15 = new ListViewGroup();

            group15.Header          = "DB15";
            group15.HeaderAlignment = HorizontalAlignment.Center;

            ListViewGroup group51 = new ListViewGroup();

            group51.Header          = "DB51";
            group51.HeaderAlignment = HorizontalAlignment.Center;

            ListViewGroup group52 = new ListViewGroup();

            group52.Header          = "DB52";
            group52.HeaderAlignment = HorizontalAlignment.Center;

            ListViewGroup group54 = new ListViewGroup();

            group54.Header          = "DB54";
            group54.HeaderAlignment = HorizontalAlignment.Center;

            string items = OperateOpcAndSoft.ItemList();

            string[] arr = items.Split('|');

            foreach (string item in arr)
            {
                ListViewItem view = null;
                if (item.Contains(group1.Header + ","))
                {
                    view = new ListViewItem(item, 0, group1);
                }
                else if (item.Contains(group10.Header + ","))
                {
                    view = new ListViewItem(item, 0, group10);
                }
                else if (item.Contains(group15.Header + ","))
                {
                    view = new ListViewItem(item, 0, group15);
                }
                else if (item.Contains(group6.Header + ","))
                {
                    view = new ListViewItem(item, 0, group6);
                }
                else if (item.Contains(group51.Header + ","))
                {
                    view = new ListViewItem(item, 0, group51);
                }
                else if (item.Contains(group52.Header + ","))
                {
                    view = new ListViewItem(item, 0, group52);
                }
                else if (item.Contains(group54.Header + ","))
                {
                    view = new ListViewItem(item, 0, group54);
                }
                else
                {
                    view      = new ListViewItem(item);
                    view.Text = item;
                }
                listView1.Items.Add(view);
            }
            group1.Header  = "上位下达配送任务:DB1";
            group10.Header = "与上位联动,交互信号:DB10";
            group15.Header = "虚出口任务区:DB15";
            group6.Header  = "分拣单元应分拣条烟数量 DB6";
            group51.Header = "上位下达配送任务:DB51";
            group52.Header = "补货任务区:DB52";
            group54.Header = "卧式仓补货品规(条码):DB54";

            listView1.Groups.Add(group1);
            listView1.Groups.Add(group6);
            listView1.Groups.Add(group10);
            listView1.Groups.Add(group15);
            listView1.Groups.Add(group51);
            listView1.Groups.Add(group52);
            listView1.Groups.Add(group54);

            listView1.Columns[0].TextAlign = HorizontalAlignment.Center;
            listView1.Columns[0].Width     = -1;
        }