Example #1
0
        private void ShowOrderInfo()
        {
            dictionary.Clear();
            int x = 0;
            int y = 0;

            BLL.T_PickOrder t_PickOrder = new BLL.T_PickOrder();
            DataTable       dt          = t_PickOrder.GetOrder();

            this.orderInfo.Controls.Clear();
            foreach (DataRow item in dt.Rows)
            {
                PickOrderControl pickOrderControl = new PickOrderControl();
                pickOrderControl.serial     = item["ProductionNumber"].ToString();
                pickOrderControl.barCode    = item["MasterBarCode"].ToString();
                pickOrderControl.carModelNo = item["CarModelName"].ToString();
                pickOrderControl.carTypeNo  = item["CarType"].ToString();

                pickOrderControl.SetInfo(this.orderInfo.Width, this.orderInfo.Height / 10);
                pickOrderControl.Location = new Point(x, y);
                this.orderInfo.Controls.Add(pickOrderControl);
                y += pickOrderControl.Height;
                dictionary.Add(item["MasterBarCode"].ToString(), pickOrderControl);
                if (SaveCode.ContainsKey(item["MasterBarCode"].ToString()))
                {
                    pickOrderControl.SetChoice(Color.Blue);
                }
            }
        }
Example #2
0
        private void Scan(string ScanNO)
        {
            try
            {
                string Scan = ScanNO;
                barCode = "";

                BLL.T_PickOrder t_PickOrder = new BLL.T_PickOrder();
                string          masterBar   = t_PickOrder.GetScanOrder();

                if (Scan == masterBar)
                {
                    t_PickOrder.SaveScanedOrder(masterBar, 1);
                    ShowOrderInfo();
                    //扫描条码与主序列匹配时关闭蜂鸣器
                    if (WriteOpc(OpcIn, "KittingLine1.KittingLine1-1.Lamp", "0"))
                    {
                        // MessageBox.Show("蜂鸣器发送失败");
                    }

                    t_PickOrder.ExcuteScanBar(masterBar);
                }
                else
                {
                    //扫描条码与主序列不匹配时触发蜂鸣器
                    if (WriteOpc(OpcIn, "KittingLine1.KittingLine1-1.Lamp", "1"))
                    {
                    }
                    HZ hZ = new HZ("扫描错误!当前应扫描序列号为:" + masterBar);
                    hZ.ShowDialog();
                }

                this.orderInfo.Focus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Example #3
0
        private void OpcInTri_DataChange(int TransactionID, int NumItems, ref Array ClientHandles, ref Array ItemValues, ref Array Qualities, ref Array TimeStamps)
        {
            try
            {
                for (int i = 1; i <= NumItems; i++)
                {
                    string value         = ItemValues.GetValue(i).ToString().ToLower().Trim(); //value值
                    int    clientHandles = int.Parse(ClientHandles.GetValue(i).ToString());    //唯一建
                    string tag           = OpcIn.OPCItems.Item(clientHandles).ItemID;          //TAG点

                    BLL.T_PickOrder  t_PickOrder  = new BLL.T_PickOrder();
                    BLL.T_PickConfig t_PickConfig = new BLL.T_PickConfig();

                    #region 一区逻辑处理
                    //一区到位信号
                    if (tag == "KittingLine1.KittingLine1-1.2#到位")
                    {
                        if (value == "true")
                        {
                            if (Area1IsDW)
                            {
                                return;
                            }
                            //   MessageBox.Show("接收到一区到位信号");
                            DataTable dt = t_PickOrder.GetArea1Order();
                            if (dt.Rows.Count > 0)
                            {
                                string masterBarCode = dt.Rows[0]["MasterBarCode"].ToString();
                                string AlCCode       = dt.Rows[0]["ALCCode"].ToString();
                                //string AssyNo1 = t_PickOrder.GetAssyNo(AlCCode);
                                //MessageBox.Show(masterBarCode);
                                //MessageBox.Show(dictionary.Count.ToString());

                                if (dictionary.Count > 0)
                                {
                                    dictionary[masterBarCode].SetChoice(Color.Blue);
                                    if (!SaveCode.ContainsKey(masterBarCode))
                                    {
                                        SaveCode.Add(masterBarCode, "");
                                    }
                                }
                                list_1 = t_PickConfig.GetPickItem(masterBarCode, AlCCode, 1);
                                if (list_1.Count == 0)
                                {
                                    WriteOpc(OpcIn, "KittingLine1.KittingLine1-1.2#放行", "1");
                                    //一区没有配置灯
                                }
                                else
                                {
                                    foreach (var item in list_1)
                                    {
                                        Isone = true;
                                        WriteOpc(OpcIn, item, "3");
                                        //   MessageBox.Show("正在亮灯。。");
                                    }
                                    Area1IsDW = true;
                                }
                            }
                        }
                    }

                    if (Isone)
                    {
                        if (value == "0")
                        {
                            if (list_1.Contains(tag))
                            {
                                Index_1++;
                                if (Index_1 == list_1.Count)
                                {
                                    WriteOpc(OpcIn, "KittingLine1.KittingLine1-1.2#放行", "1");
                                    Index_1 = 0;
                                    list_1.Clear();
                                    Isone = false;
                                    //一区全部灭灯
                                }
                            }
                        }
                    }

                    if (tag == "KittingLine1.KittingLine1-1.2#阻挡")
                    {
                        if (value == "true")
                        {
                            DataTable dt = t_PickOrder.GetArea1Order();
                            if (dt.Rows.Count > 0)
                            {
                                string masterBarCode = dt.Rows[0]["MasterBarCode"].ToString();
                                t_PickOrder.SaveArea1Order(masterBarCode, 1);
                                Area1IsDW = false;
                            }
                        }
                    }
                    #endregion


                    #region 二区逻辑处理
                    if (tag == "KittingLine1.KittingLine1-1.4#到位")
                    {
                        if (value == "true")
                        {
                            if (Area2IsDW)
                            {
                                return;
                            }
                            //   MessageBox.Show("接收到一区到位信号");
                            DataTable dt = t_PickOrder.GetArea2Order();
                            if (dt.Rows.Count > 0)
                            {
                                string masterBarCode = dt.Rows[0]["MasterBarCode"].ToString();
                                string AlCCode       = dt.Rows[0]["ALCCode"].ToString();
                                //string AssyNo2 = t_PickOrder.GetAssyNo(AlCCode);
                                list_2 = t_PickConfig.GetPickItem(masterBarCode, AlCCode, 2);
                                //MessageBox.Show(masterBarCode);
                                //MessageBox.Show(dictionary.Count.ToString());
                                if (dictionary.Count > 0)
                                {
                                    dictionary[masterBarCode].SetChoice(Color.Green);
                                    if (!SaveCode.ContainsKey(masterBarCode))
                                    {
                                        SaveCode.Add(masterBarCode, "");
                                    }
                                }
                                if (list_2.Count == 0)
                                {
                                    WriteOpc(OpcIn, "KittingLine1.KittingLine1-1.4#放行", "1");
                                    //二区没有配置灯
                                }
                                else
                                {
                                    foreach (var item in list_2)
                                    {
                                        Istwo = true;
                                        WriteOpc(OpcIn, item, "3");
                                        //   MessageBox.Show("正在亮灯。。");
                                    }
                                    Area2IsDW = true;
                                }
                            }
                        }
                    }

                    if (Istwo)
                    {
                        if (value == "0")
                        {
                            if (list_2.Contains(tag))
                            {
                                Index_2++;
                                if (Index_2 == list_2.Count)
                                {
                                    WriteOpc(OpcIn, "KittingLine1.KittingLine1-1.4#放行", "1");
                                    Index_2 = 0;
                                    list_2.Clear();
                                    Istwo = false;
                                    //二区全部灭灯
                                }
                            }
                        }
                    }

                    if (tag == "KittingLine1.KittingLine1-1.4#阻挡")
                    {
                        if (value == "true")
                        {
                            DataTable dt = t_PickOrder.GetArea2Order();
                            if (dt.Rows.Count > 0)
                            {
                                string masterBarCode = dt.Rows[0]["MasterBarCode"].ToString();
                                t_PickOrder.SaveArea2Order(masterBarCode, 1);
                                t_PickOrder.SaveScanedOrder(masterBarCode, 2);
                                Area2IsDW = false;
                                ShowOrderInfo();
                            }
                        }
                    }
                    #endregion

                    if (tag == "KtingByLight.MKtingByLight.004.001")
                    {
                        if (value == "false")
                        {
                            WriteOpc(OpcIn, "KtingByLight.MKtingByLight.004.001", "1");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }