예제 #1
0
 //将检测区的状态赋给上述属性
 public static void Get_D_State(DTURequestInfo requestinfo)
 {
     //状态
     D_System_State    = requestinfo.SystemState;
     D_Detection_Area1 = (requestinfo.PartState & 1) == 1 ? 1 : 0;
     D_Detection_Area2 = (requestinfo.PartState & 2) == 2 ? 1 : 0;
     D_Marking_State   = (requestinfo.PartState & 4) == 4 ? 1 : 0;
     D_Robot_State     = (requestinfo.PartState & 8) == 8 ? 1 : 0;
     if (D_System_State != 2)   //如果不是系统正常,已启动这个状态的话,就退出
     {
         return;
     }
     //动作
     D_AGV_Detection1 = (requestinfo.AGVExecuteCmd & 1) == 1 ? 1 : 0;
     D_AGV_Detection2 = (requestinfo.AGVExecuteCmd & 2) == 2 ? 1 : 0;
     //RFID
     D_Detection1_RFID = requestinfo.Detection_Area1_RFID;
     if (D_Detection1_RFID == ConfigClass.Tray_A3 && D_OnlyOnce3 == false)
     {
         D_AGV_Detection1_Para1 = requestinfo.Detection_Area1_Parameter1;
         D_AGV_Detection1_Para2 = requestinfo.Detection_Area1_Parameter2;
         D_AGV_Detection1_Para3 = requestinfo.Detection_Area1_Parameter3;
         D_AGV_Detection1_Para4 = requestinfo.Detection_Area1_Parameter4;
         D_AGV_Detection1_Para5 = requestinfo.Detection_Area1_Parameter5;
         SqlConnection  con = new SqlConnection();
         DataBaseHandle db  = new DataBaseHandle();
         db.SaveData(con, "检测订单", ConfigClass.GetTrayString(D_Detection1_RFID),
                     ConfigClass.GetTrayString(D_Detection2_RFID), D_AGV_Detection1_Para1, D_AGV_Detection1_Para2,
                     D_AGV_Detection1_Para3, D_AGV_Detection1_Para4, D_AGV_Detection1_Para5);
         D_OnlyOnce3 = true;
     }
     if (D_Detection1_RFID != ConfigClass.Tray_A3)
     {
         D_OnlyOnce3 = false;
     }
     D_Detection2_RFID = requestinfo.Detection_Area2_RFID;
     if (D_Detection2_RFID == ConfigClass.Tray_A3 && D_OnlyOnce4 == false)
     {
         D_AGV_Detection2_Para1 = requestinfo.Detection_Area2_Parameter1;
         D_AGV_Detection2_Para2 = requestinfo.Detection_Area2_Parameter2;
         D_AGV_Detection2_Para3 = requestinfo.Detection_Area2_Parameter3;
         D_AGV_Detection2_Para4 = requestinfo.Detection_Area2_Parameter4;
         D_AGV_Detection2_Para5 = requestinfo.Detection_Area2_Parameter5;
         SqlConnection  con = new SqlConnection();
         DataBaseHandle db  = new DataBaseHandle();
         db.SaveData(con, "检测订单", ConfigClass.GetTrayString(D_Detection1_RFID),
                     ConfigClass.GetTrayString(D_Detection2_RFID), D_AGV_Detection1_Para1, D_AGV_Detection1_Para2,
                     D_AGV_Detection1_Para3, D_AGV_Detection1_Para4, D_AGV_Detection1_Para5);
         D_OnlyOnce4 = true;
     }
     if (D_Detection2_RFID != ConfigClass.Tray_A3)
     {
         D_OnlyOnce4 = false;
     }
     //如果动作值为1,则通知AGV(向AGV表中插入命令)且不能重复插入
     if (D_AGV_Detection1 == 1 && D_OnlyOnce1 == false)
     {
         InformAGV(ConfigClass.DetectionArea1);
         D_OnlyOnce1 = true;
     }
     if (D_AGV_Detection1 == 0)
     {
         D_OnlyOnce1 = false;
     }
     if (D_AGV_Detection2 == 1 && D_OnlyOnce2 == false)
     {
         InformAGV(ConfigClass.DetectionArea2);
         D_OnlyOnce2 = true;
     }
     if (D_AGV_Detection2 == 0)
     {
         D_OnlyOnce2 = false;
     }
 }
예제 #2
0
 //将装配区的状态赋给上述属性
 public static void Get_A_State(DTURequestInfo requestinfo)
 {
     //状态
     A_System_State     = requestinfo.SystemState;
     A_Assembly_Area1   = (requestinfo.PartState & 1) == 1 ? 1 : 0;
     A_Assembly_Area2   = (requestinfo.PartState & 2) == 2 ? 1 : 0;
     A_Robot_State      = (requestinfo.PartState & 4) == 4 ? 1 : 0;
     A_Cor_State        = (requestinfo.PartState & 8) == 8 ? 1 : 0;
     A_Assembly_InArea1 = (requestinfo.PartState & 16) == 16 ? 1 : 0;
     A_Assembly_InArea2 = (requestinfo.PartState & 32) == 32 ? 1 : 0;
     if (A_System_State != 2)   //如果不是系统正常,已启动这个状态的话,就退出
     {
         return;
     }
     //动作
     A_AGV_Assembly1 = (requestinfo.AGVExecuteCmd & 1) == 1 ? 1 : 0;
     A_AGV_Assembly2 = (requestinfo.AGVExecuteCmd & 2) == 2 ? 1 : 0;
     //RFID
     A_Assembly1_RFID = requestinfo.Assembly_Area1_RFID;
     if (A_Assembly1_RFID == ConfigClass.Tray_B2 && A_OnlyOnce3 == false)
     {
         SqlConnection  con = new SqlConnection();
         DataBaseHandle db  = new DataBaseHandle();
         db.SaveData(con, "拧螺丝订单", ConfigClass.GetTrayString(A_Assembly1_RFID));
         A_OnlyOnce3 = true;
     }
     if (A_Assembly1_RFID != ConfigClass.Tray_B2)
     {
         A_OnlyOnce3 = false;
     }
     A_Assembly2_RFID = requestinfo.Assembly_Area2_RFID;
     if (A_Assembly2_RFID == ConfigClass.Tray_B2 && A_OnlyOnce4 == false)
     {
         SqlConnection  con = new SqlConnection();
         DataBaseHandle db  = new DataBaseHandle();
         db.SaveData(con, "拧螺丝订单", "缺省", ConfigClass.GetTrayString(A_Assembly1_RFID));
         A_OnlyOnce4 = true;
     }
     if (A_Assembly2_RFID != ConfigClass.Tray_B2)
     {
         A_OnlyOnce4 = false;
     }
     //如果动作值为1,则通知AGV(向AGV表中插入命令)且不能重复插入
     if (A_AGV_Assembly1 == 1 && A_OnlyOnce1 == false)
     {
         InformAGV(ConfigClass.AssemblyArea1);
         A_OnlyOnce1 = true;
     }
     if (A_AGV_Assembly1 == 0)
     {
         A_OnlyOnce1 = false;
     }
     if (A_AGV_Assembly2 == 1 && A_OnlyOnce2 == false)
     {
         InformAGV(ConfigClass.AssemblyArea2);
         A_OnlyOnce2 = true;
     }
     if (A_AGV_Assembly2 == 0)
     {
         A_OnlyOnce2 = false;
     }
 }
예제 #3
0
        }                                                           //人工下料AGV对接台RFID识别托盘工件相关参数5

        //将加工区的状态赋给上述属性
        public static void Get_P_State(DTURequestInfo requestinfo)
        {
            //状态
            P_System_State     = requestinfo.SystemState;
            P_Manual_Up_Area   = (requestinfo.PartState & 1) == 1 ? 1 : 0;
            P_Manual_Down_Area = (requestinfo.PartState & 2) == 2 ? 1 : 0;
            P_Process_Area1    = (requestinfo.PartState & 4) == 4 ? 1 : 0;
            P_Process_Area2    = (requestinfo.PartState & 8) == 8 ? 1 : 0;
            P_Mazak1_State     = (requestinfo.PartState & 16) == 16 ? 1 : 0;
            P_Mazak2_State     = (requestinfo.PartState & 32) == 32 ? 1 : 0;
            P_Big_State        = (requestinfo.PartState & 64) == 64 ? 1 : 0;
            P_Robot_State      = (requestinfo.PartState & 128) == 128 ? 1 : 0;
            //系统控制
            P_System_Control = requestinfo.SystemControl;
            if (P_System_State != 2)   //如果不是系统正常,已启动这个状态的话,就退出
            {
                return;
            }

            //动作
            P_Raw_Tray_Empty = (requestinfo.Raw_Tray_Empty & 1) == 1 ? 1 : 0;

            P_AGV_Manual_Up   = (requestinfo.AGVExecuteCmd & 1) == 1 ? 1 : 0;
            P_AGV_Manual_Down = (requestinfo.AGVExecuteCmd & 2) == 2 ? 1 : 0;
            P_AGV_Process1    = (requestinfo.AGVExecuteCmd & 4) == 4 ? 1 : 0;
            P_AGV_Process2    = (requestinfo.AGVExecuteCmd & 8) == 8 ? 1 : 0;
            //RFID
            P_Manual_Up_RFID   = requestinfo.Manual_Up_RFID;
            P_Manual_Down_RFID = requestinfo.Manual_Down_RFID;
            P_Process1_RFID    = requestinfo.Process_Area1_RFID;
            if (P_Process1_RFID == ConfigClass.Tray_A2 && P_OnlyOnce5 == false)
            {
                SqlConnection  con = new SqlConnection();
                DataBaseHandle db  = new DataBaseHandle();
                db.SaveData(con, "加工订单", ConfigClass.GetTrayString(P_Process1_RFID));
                P_OnlyOnce5 = true;
            }
            if (P_Process1_RFID != ConfigClass.Tray_A2)
            {
                P_OnlyOnce5 = false;
            }
            P_Process2_RFID = requestinfo.Process_Area2_RFID;
            if (P_Process2_RFID == ConfigClass.Tray_A2 && P_OnlyOnce6 == false)
            {
                SqlConnection  con = new SqlConnection();
                DataBaseHandle db  = new DataBaseHandle();
                db.SaveData(con, "加工订单", "缺省", ConfigClass.GetTrayString(P_Process2_RFID));
                P_OnlyOnce6 = true;
            }
            if (P_Process2_RFID != ConfigClass.Tray_A2)
            {
                P_OnlyOnce6 = false;
            }

            //数据
            UP_C_D_Number   = (int)requestinfo.Manual_Up_CD_Number;
            Down_C_D_Number = (int)requestinfo.Manual_Down_CD_Number;
            Down_RFID_Para1 = requestinfo.Manual_Down_Para1;
            Down_RFID_Para2 = requestinfo.Manual_Down_Para2;
            Down_RFID_Para3 = requestinfo.Manual_Down_Para3;
            Down_RFID_Para4 = requestinfo.Manual_Down_Para4;
            Down_RFID_Para5 = requestinfo.Manual_Down_Para5;

            //如果动作值为1,则通知AGV(向AGV表中插入命令),且不能重复插入
            if (P_Raw_Tray_Empty == 1 && P_OnlyOnce1 == false)
            {
                WHSendPackage package = new WHSendPackage();
                package.Head         = 29000;
                package.TrayID       = 0;
                package.WHPostion    = 0;
                package.SerialNumber = 0;
                if (MainWindow.WHDISCONNECTED == false)
                {
                    sendWHMsgDel(package);
                    P_OnlyOnce1 = true;
                }
            }
            if (P_Raw_Tray_Empty == 0)
            {
                P_OnlyOnce1 = false;
            }
            if (P_AGV_Process1 == 1 && P_OnlyOnce2 == false)
            {
                InformAGV(ConfigClass.ProcessArea1);
                P_OnlyOnce2 = true;
            }
            if (P_AGV_Process1 == 0)
            {
                P_OnlyOnce2 = false;
            }
            if (P_AGV_Process2 == 1 && P_OnlyOnce3 == false)
            {
                InformAGV(ConfigClass.ProcessArea2);
                P_OnlyOnce3 = true;
            }
            if (P_AGV_Process2 == 0)
            {
                P_OnlyOnce3 = false;
            }
            if (P_AGV_Manual_Up == 1 && P_OnlyOnce4 == false)
            {
                InformAGV(ConfigClass.HandUpArea, P_Manual_Up_RFID);
                P_OnlyOnce4 = true;
            }
            if (P_AGV_Manual_Up == 0)
            {
                P_OnlyOnce4 = false;
            }
        }