示例#1
0
 bool GetPalletPresentStatusFromOpc()
 {
     if (objOPCServerDirector == null)
     {
         objOPCServerDirector = new OPCServerDirector();
     }
     return(objOPCServerDirector.ReadTag <bool>(MachineChannel + "." + MachineCode + "." + OpcTags.PS_PalletPresent));
 }
示例#2
0
        bool GetPalletPresentStatusFromOpc()
        {
            if (objOPCServerDirector == null)
            {
                objOPCServerDirector = new OPCServerDirector();
            }
            bool status = false;

            status = objOPCServerDirector.ReadTag <bool>(MachineChannel + "." + MachineCode + "." + OpcTags.EES_Pallet_Present_Prox_SW);
            return(status || objOPCServerDirector.ReadTag <bool>(MachineChannel + "." + MachineCode + "." + OpcTags.EES_Pallet_Present_Prox_NE));
        }
        bool GetPalletPresentStatusFromOpc()
        {
            if (objOPCServerDirector == null)
            {
                objOPCServerDirector = new OPCServerDirector();
            }

            string deckCode = getDeckCode(this.MachineCode);

            return(objOPCServerDirector.ReadTag <bool>(MachineChannel + "." + MachineCode + "." + OpcTags.PVL_Deck_Pallet_Present));
        }
示例#4
0
        public bool IsEESReadyForCarEntry(EESData objEESData)
        {
            bool isReady   = false;
            int  ees_state = 0;

            if (objOPCServerDirector == null)
            {
                objOPCServerDirector = new OPCServerDirector();
            }
            ees_state = objOPCServerDirector.ReadTag <Int16>(objEESData.machineChannel + "." + objEESData.machineCode + ".State_EES_HMI");
            isReady   = (ees_state == 100);
            return(isReady);
        }
示例#5
0
        public bool IsEESEntryInOPC(EESData objEESData)
        {
            bool isEntry  = false;
            int  ees_mode = 0;

            if (objOPCServerDirector == null)
            {
                objOPCServerDirector = new OPCServerDirector();
            }
            ees_mode = objOPCServerDirector.ReadTag <UInt16>(objEESData.machineChannel + "." + objEESData.machineCode + ".EES_Mode");
            isEntry  = (ees_mode == 1);
            return(isEntry);
        }
示例#6
0
        public bool GetInnerDoorBlockedStatus(string eesChannel, string eesCode)
        {
            bool status = false;

            if (objOPCServerDirector == null)
            {
                objOPCServerDirector = new OPCServerDirector();
            }

            status = !objOPCServerDirector.ReadTag <bool>(eesChannel + "." + eesCode + "." + OpcTags.EES_North_Side_Area_Laser_Blocked);


            return(status);
        }
示例#7
0
        public bool GetVehicleDetectorStatus(Model.EESData objEESData)
        {
            bool status = false;

            if (objOPCServerDirector == null)
            {
                objOPCServerDirector = new OPCServerDirector();
            }

            status = objOPCServerDirector.ReadTag <bool>(objEESData.machineChannel + "." + objEESData.machineCode + ".Vehicle_Detector");


            return(status);
        }
示例#8
0
        public bool IsPalletPresentOnEES(Model.EESData objEESData)
        {
            bool isPresent = false;

            if (objOPCServerDirector == null)
            {
                objOPCServerDirector = new OPCServerDirector();
            }

            isPresent = objOPCServerDirector.ReadTag <bool>(objEESData.machineChannel + "." + objEESData.machineCode + ".Pallet_Present_Prox_NE");
            isPresent = isPresent || objOPCServerDirector.ReadTag <bool>(objEESData.machineChannel + "." + objEESData.machineCode + ".Pallet_Present_Prox_SW");


            return(isPresent);
        }
        bool GetPalletPresentStatusFromOpc()
        {
            if (objOPCServerDirector == null)
            {
                objOPCServerDirector = new OPCServerDirector();
            }
            string remCode = getREMCode(this.MachineCode);

            bool isPresent = false;

            if (objOPCServerDirector.IsMachineQualityHealthy(MachineChannel + "." +
                                                             remCode + "." + OpcTags.CM_Pallet_Present_on_REM) == OPCDA.qualityBits.good)
            {
                isPresent = objOPCServerDirector.ReadTag <bool>(MachineChannel + "." + remCode + "." + OpcTags.CM_Pallet_Present_on_REM);
            }
            return(isPresent);
        }
        bool GetPalletPresentStatusFromOpc()
        {
            if (objOPCServerDirector == null)
            {
                objOPCServerDirector = new OPCServerDirector();
            }
            bool   status   = false;
            string deckCode = getDeckCode(MachineCode);

            if (objOPCServerDirector.IsMachineQualityHealthy(MachineChannel + "." +
                                                             deckCode + "." + OpcTags.VLC_North_Pallet_Present_Prox) == OPCDA.qualityBits.good)
            {
                status = objOPCServerDirector.ReadTag <bool>(MachineChannel + "." + deckCode + "." + OpcTags.VLC_North_Pallet_Present_Prox);
                status = status || objOPCServerDirector.ReadTag <bool>(MachineChannel + "." + deckCode + "." + OpcTags.VLC_South_Pallet_Present_Prox);
            }
            return(status);
        }
        int GetPalletCountFromOpc()
        {
            if (objOPCServerDirector == null)
            {
                objOPCServerDirector = new OPCServerDirector();
            }
            int cnt = 0;

            try
            {
                cnt = objOPCServerDirector.ReadTag <Int16>(MachineChannel + "." + MachineCode + "." + OpcTags.PST_Pallet_Count);
            }
            catch (Exception errMsg)
            {
                //Console.WriteLine(errMsg.Message);
            }
            return(cnt);
        }
        public bool IsHighCar(string eesChannel, string eesCode)
        {
            bool isHighCar = true;

            if (objOPCServerDirector == null)
            {
                objOPCServerDirector = new OPCServerDirector();
            }
            try
            {
                //for low car is true, for high car its false.
                isHighCar = !objOPCServerDirector.ReadTag <bool>(eesChannel + "." + eesCode + "." + "Lower_Height_Sensor_Blocked");
            }
            finally
            {
            }

            return(isHighCar);
        }
        bool ConfirmBeforeDelete()
        {
            bool remove = false;

            try
            {
                bool  autoMode  = false;
                Int16 errorCode = 0;
                bool  isInL2    = false;

                OPCServerDirector opcd = new OPCServerDirector();
                // if(machineName.Contains("LCM") || machineName.Contains("UCM"))
                autoMode = opcd.ReadTag <bool>(channel + "." + machineName + "." + "Auto_Mode");

                if (machineName.Contains("LCM") || machineName.Contains("UCM") || machineName.Contains("PS_"))
                {
                    errorCode = opcd.ReadTag <Int16>(channel + "." + machineName + "." + "L2_Error_Data_Register");
                }
                else if (machineName.Contains("VLC") || machineName.Contains("PVL") || machineName.Contains("EES") || machineName.Contains("PST_"))
                {
                    errorCode = opcd.ReadTag <Int16>(channel + "." + machineName + "." + "L2_ErrCode");
                }

                Connection dbpm = new Connection();
                if (machineName.Contains("LCM") || machineName.Contains("UCM"))
                {
                    isInL2 = dbpm.HasCMInL2Mode(machineName);
                }
                else if (machineName.Contains("VLC"))
                {
                    isInL2 = dbpm.HasVLCInL2Mode(machineName);
                }
                else if (machineName.Contains("PS_"))
                {
                    isInL2 = dbpm.HasPSInL2Mode(machineName);
                }
                else if (machineName.Contains("EES"))
                {
                    isInL2 = dbpm.HasEESTnL2Mode(machineName);
                }
                else if (machineName.Contains("PVL"))
                {
                    isInL2 = dbpm.HasPVLTnL2Mode(machineName);
                }
                else if (machineName.Contains("PST_"))
                {
                    isInL2 = dbpm.HASPSTnL2Mode(machineName);
                }

                string message = "";
                message = autoMode == false ? "Not in auto mode." : message;
                message = errorCode != 0 ? " Error code = " + errorCode + ".": message;
                message = isInL2 == false ? " Not in L2 mode." : message;



                //if (!string.IsNullOrEmpty(message))
                //    if (!string.IsNullOrEmpty(message) &&
                //        MessageBox.Show(message + "Do you want to remove this notification.", "Information", MessageBoxButton.YesNo, MessageBoxImage.Question)
                //          == MessageBoxResult.Yes)
                //        remove = true;

                if (MessageBox.Show(message + "Do you want to remove this notification.", "Information", MessageBoxButton.YesNo, MessageBoxImage.Question)
                    == MessageBoxResult.Yes)
                {
                    remove = true;
                }
            }
            finally { }
            return(remove);
        }
        void VLCMove(string channel, string machine, Int16 aisleTo, Int16 aisleFrom, Int32 cycle, Int32 delay)
        {
            Connection db          = new Connection();
            string     demoMachine = "";

            try
            {
                OPCServerDirector opcd            = new OPCServerDirector();
                Int16             row             = 0;
                Int16             currentPosition = 0;
                int steps = 0;

                db.UpdateVLCBlockedStatus(machine, 1);
                demoMachine = machine + ",T";
                if (this.OnDemoMode != null)
                {
                    this.OnDemoMode(demoMachine, new EventArgs());
                }

                while (cycle > 0)
                {
                    if (!isActive)
                    {
                        break;
                    }
                    currentPosition = opcd.ReadTag <Int16>(channel + "." + machine + "." + "DestFloor");
                    if (currentPosition != aisleTo)
                    {
                        opcd.Write <Int16>(channel + "." + machine + "." + "DestFloor", aisleTo);
                        opcd.Write <bool>(channel + "." + machine + "." + "CP_Start", true);
                        System.Threading.Thread.Sleep(500);
                        opcd.ReadCMCommandDoneStatus(channel, machine, "CP_Done");
                        steps += 1;
                    }
                    else if (currentPosition != aisleFrom)
                    {
                        opcd.Write <Int16>(channel + "." + machine + "." + "DestFloor", aisleFrom);
                        opcd.Write <bool>(channel + "." + machine + "." + "CP_Start", true);
                        System.Threading.Thread.Sleep(500);
                        opcd.ReadCMCommandDoneStatus(channel, machine, "CP_Done");
                        steps += 1;
                    }

                    if (steps == 2)
                    {
                        steps  = 0;
                        cycle -= 1;
                        txtCycles.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(
                                                        delegate()
                        {
                            txtCycles.Text = cycle.ToString();
                        }));
                    }

                    System.Threading.Thread.Sleep(delay * 1000);
                }
                ChangeCMBorderColor(false);
            }
            finally
            {
                db.UpdateVLCBlockedStatus(machine, 0);
                if (this.OnDemoMode != null && !string.IsNullOrEmpty(demoMachine))
                {
                    demoMachine = machine + ",F";
                    this.OnDemoMode(demoMachine, new EventArgs());
                }
            }
        }
        void CMMove(string channel, string machine, Int16 aisleTo, Int16 aisleFrom, Int32 cycle, Int32 delay)
        {
            Connection db          = new Connection();
            int        aisleToDb   = 0;
            string     demoMachine = "";

            try
            {
                OPCServerDirector opcd            = new OPCServerDirector();
                Int16             row             = 0;
                Int16             currentPosition = 0;
                int steps = 0;

                db.UpdateCMBlockedStatusForHomMove(machineName, 1, 1, 0);

                demoMachine = machine + ",T";
                if (this.OnDemoMode != null)
                {
                    this.OnDemoMode(demoMachine, new EventArgs());
                }

                while (cycle > 0)
                {
                    if (!isActive)
                    {
                        break;
                    }
                    currentPosition = opcd.ReadTag <Int16>(channel + "." + machine + "." + "L2_Destination_Aisle");

                    string remName = GetREMRelatedToMachine(machineName);
                    row = opcd.ReadTag <Int16>(channel + "." + remName + "." + "L2_Commanded_ROW");

                    if (currentPosition != aisleTo)
                    {
                        db.UpdateCMBlockedStatusForHomMove(machineName, 1, 1, 0);
                        row = GetValidRowForMoving(this.floor, aisleTo);
                        opcd.Write <Int16>(channel + "." + machine + "." + "L2_Destination_Row", row);
                        opcd.Write <Int16>(channel + "." + machine + "." + "L2_Destination_Aisle", aisleTo);
                        opcd.Write <bool>(channel + "." + machine + "." + "L2_Move_Cmd", true);
                        System.Threading.Thread.Sleep(500);
                        opcd.ReadCMCommandDoneStatus(channel, machine, "L2_CMD_DONE");
                        steps    += 1;
                        aisleToDb = aisleTo;
                        db.UpdateCMBlockedStatusForHomMove(machineName, 1, 1, aisleTo);
                    }
                    else if (currentPosition != aisleFrom)
                    {
                        db.UpdateCMBlockedStatusForHomMove(machineName, 1, 1, 0);
                        row = GetValidRowForMoving(this.floor, aisleFrom);
                        opcd.Write <Int16>(channel + "." + machine + "." + "L2_Destination_Row", row);
                        opcd.Write <Int16>(channel + "." + machine + "." + "L2_Destination_Aisle", aisleFrom);
                        opcd.Write <bool>(channel + "." + machine + "." + "L2_Move_Cmd", true);
                        System.Threading.Thread.Sleep(500);
                        opcd.ReadCMCommandDoneStatus(channel, machine, "L2_CMD_DONE");
                        steps    += 1;
                        aisleToDb = aisleFrom;
                        db.UpdateCMBlockedStatusForHomMove(machineName, 1, 1, aisleFrom);
                    }

                    if (steps == 2)
                    {
                        steps  = 0;
                        cycle -= 1;
                        txtCycles.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(
                                                        delegate()
                        {
                            txtCycles.Text = cycle.ToString();
                        }));
                    }
                    System.Threading.Thread.Sleep(delay * 1000);
                }
                ChangeCMBorderColor(false);
            }
            finally
            {
                db.UpdateCMBlockedStatusForHomMove(machineName, 0, 0, 0);
                if (this.OnDemoMode != null && !string.IsNullOrEmpty(demoMachine))
                {
                    demoMachine = machine + ",F";
                    this.OnDemoMode(demoMachine, new EventArgs());
                }
            }
        }