Beispiel #1
0
        private void UpdateOrderTable(object obj)
        {
            int SerialNumber = -1;

            if (obj != null)
            {
                SerialNumber = Convert.ToInt32(obj);
            }
            Thread.Sleep(TimeSpan.FromSeconds(4));
            DataBaseHandle db          = new DataBaseHandle();
            SqlConnection  con         = new SqlConnection();
            string         OrderStyle  = "";
            int            WHTrayStyle = db.SelectOTbySerialNumber(con, SerialNumber, ref OrderStyle);

            if (OrderStyle == "入库订单")
            {
                //更新订单表
                if (WHTrayStyle == ConfigClass.Tray_A2)   //入库加工成品托盘A2
                {
                    db.UpdateOrderNum(con, "加工订单");
                    Thread.Sleep(1);
                    CheckWHNumber("加工订单");
                    UpdateOrderThreadState = false;
                    return;
                }
                if (WHTrayStyle == ConfigClass.Tray_A3)  //入库加工检测托盘A3
                {
                    db.UpdateOrderNum(con, "检测订单");
                    Thread.Sleep(1);
                    CheckWHNumber("检测订单");
                    UpdateOrderThreadState = false;
                    return;
                }
                if (WHTrayStyle == ConfigClass.Tray_B2)   //入库螺钉完成托盘
                {
                    db.UpdateOrderNum(con, "拧螺丝订单");
                    Thread.Sleep(1);
                    CheckWHNumber("拧螺丝订单");
                    UpdateOrderThreadState = false;
                    return;
                }
                if (WHTrayStyle == ConfigClass.Tray_A5)  //入库轴承压装完成托盘
                {
                    db.UpdateOrderNum(con, "轴承压装订单");
                    Thread.Sleep(1);
                    CheckWHNumber("轴承压装订单");
                    UpdateOrderThreadState = false;
                    return;
                }
            }
        }
Beispiel #2
0
        private void CheckAndInformAGV1(object obj)
        {
            Thread.Sleep(2);  //防止由于连续接收到相同信息,从而导致连续插入相同的指令
            WHPackageInfo  package     = obj as WHPackageInfo;
            SqlConnection  con         = new SqlConnection();
            DataBaseHandle db          = new DataBaseHandle();
            string         OrderStyle  = "";
            int            WHTrayStyle = db.SelectOTbySerialNumber(con, package.SerialNumber, ref OrderStyle);

            if (OrderStyle == "人工订单")   //如果是人工订单,则需要将其运送到人口下料区
            {
                db.InsertAGVCmd(con, ConfigClass.WHOutlibArea1, ConfigClass.HandDownArea);
                InformAGVThread1State = false;
                return;
            }
        }
Beispiel #3
0
        //通知AGV的线程执行的函数
        //通知AGV来取货物,并送往指定位置
        //(根据当前出库的托盘类型和订单类型和各个工作区的PLC状态来判断应该将货物送往哪里,然后向AGV指令表中插入数据)
        private void CheckAndInformAGV(object obj)
        {
            Thread.Sleep(TimeSpan.FromSeconds(4));  //防止由于连续接收到相同信息,从而导致连续插入相同的指令
            WHPackageInfo  package     = obj as WHPackageInfo;
            SqlConnection  con         = new SqlConnection();
            DataBaseHandle db          = new DataBaseHandle();
            string         OrderStyle  = "";
            int            WHTrayStyle = db.SelectOTbySerialNumber(con, package.SerialNumber, ref OrderStyle);

            //更新订单表的出库数量
            db.UpdateOutlibNum(con, OrderStyle);
            if (OrderStyle == "加工订单" && WHTrayStyle == ConfigClass.Tray_A0)  //如果是加工订单,且是加工空托盘A0的话
            {
                //AGV应该有从立库出口处前往加工区
                if (StateMachine.P_Process_Area1 == 0 && MainWindow.WHMatchingProcess1 == true && MainWindow.AGVMatchingProcess1 == false)
                {
                    db.InsertAGVCmd(con, ConfigClass.WHOutlibArea1, ConfigClass.ProcessArea1);
                    MainWindow.AGVMatchingProcess1 = true;
                    InformAGVThread1State          = false;
                    return;
                }
                if (StateMachine.P_Process_Area2 == 0 && MainWindow.WHMatchingProcess2 == true && MainWindow.AGVMatchingProcess2 == false)
                {
                    db.InsertAGVCmd(con, ConfigClass.WHOutlibArea1, ConfigClass.ProcessArea2);
                    MainWindow.AGVMatchingProcess2 = true;
                    InformAGVThread1State          = false;
                    return;
                }
                return;
            }
            if (OrderStyle == "检测订单" && WHTrayStyle == ConfigClass.Tray_A2) //如果是检测订单,且是加工成品托盘A2
            {
                //AGV应该从立库出口处前往检测区
                if (StateMachine.D_Detection_Area1 == 0 && MainWindow.WHMatchingDetection1 == true && MainWindow.AGVMatchingDetection1 == false)
                {
                    db.InsertAGVCmd(con, ConfigClass.WHOutlibArea1, ConfigClass.DetectionArea1);
                    MainWindow.AGVMatchingDetection1 = true;
                    InformAGVThread1State            = false;
                    return;
                }
                if (StateMachine.D_Detection_Area2 == 0 && MainWindow.WHMatchingDetection2 == true && MainWindow.AGVMatchingDetection2 == false)
                {
                    db.InsertAGVCmd(con, ConfigClass.WHOutlibArea1, ConfigClass.DetectionArea2);
                    MainWindow.AGVMatchingDetection2 = true;
                    InformAGVThread1State            = false;
                    return;
                }
                return;
            }
            if (OrderStyle == "拧螺丝订单" && WHTrayStyle == ConfigClass.Tray_B1)  //如果是拧螺丝订单,且是拧螺丝打钉托盘B1
            {
                if (StateMachine.A_Assembly_Area1 == 0 && MainWindow.WHMatchingAssembly1 == true && MainWindow.AGVMatchingAssembly1 == false)
                {
                    //AGV应该从立库出口处前往拧螺丝区(装配区1)
                    db.InsertAGVCmd(con, ConfigClass.WHOutlibArea1, ConfigClass.AssemblyArea1);
                    MainWindow.AGVMatchingAssembly1 = true;
                    InformAGVThread1State           = false;
                    return;
                }
            }
            if (OrderStyle == "轴承压装订单" && WHTrayStyle == ConfigClass.Tray_A4)  //如果是轴承压装订单,且是轴承压装毛坯托盘A4
            {
                if (StateMachine.A_Assembly_Area2 == 0 && MainWindow.WHMatchingAssembly2 == true && MainWindow.AGVMatchingAssembly2 == false)
                {
                    //AGV应该从立库出口处前往轴承压装区(装配区2)
                    db.InsertAGVCmd(con, ConfigClass.WHOutlibArea1, ConfigClass.AssemblyArea2);
                    MainWindow.AGVMatchingAssembly2 = true;
                    InformAGVThread1State           = false;
                    return;
                }
            }
        }