示例#1
0
        private static ILog log = LogManager.GetLogger("Console"); //Start logger
        static void Main(string[] args)
        {
            Console.WriteLine("Console_LIMA");
            log.Info("start"); //Log
            InterfacesPostTapingCollectShuttleToMx01Client    collectClient    = new InterfacesPostTapingCollectShuttleToMx01Client();
            InterfacesPostTapingEvacuationShuttleToMx01Client evacuationClient = new InterfacesPostTapingEvacuationShuttleToMx01Client();

            //Collect
            PostTapingCollectShuttleMissionStatusRequest resquestMissionStatusCollect = new PostTapingCollectShuttleMissionStatusRequest
            {
                MissionNumber = 123,
                MissionStatus = PostTapingCollectShuttleMissionStatusType.Ok,
            };

            PostTapingCollectShuttleReportRunningModeRequest resquestReportRunningModeCollect = new PostTapingCollectShuttleReportRunningModeRequest
            {
                DefaultCode         = 0,
                DefaultLabel        = "?",
                EquipmentCode       = 0,
                RunningMode         = PostTapingCollectShuttleRunningModeType.Manual,
                RunningModeDateTime = DateTime.Now,
            };

            PostTapingCollectShuttleTapingOutputConveyorRequest requestConveyorNumberCollect = new PostTapingCollectShuttleTapingOutputConveyorRequest
            {
                TapingOutputConveyorNumber = 0,
            };

            //Evacuation
            PostTapingEvacuationShuttleMissionStatusRequest resquestMissionStatusEvacuation = new PostTapingEvacuationShuttleMissionStatusRequest
            {
                MissionNumber = 123,
                MissionStatus = PostTapingEvacuationShuttleMissionStatusType.Ok,
            };

            PostTapingEvacuationShuttleReportRunningModeRequest resquestReportRunningModeEvacuation = new PostTapingEvacuationShuttleReportRunningModeRequest
            {
                DefaultCode         = 0,
                DefaultLabel        = "?",
                EquipmentCode       = 0,
                RunningMode         = PostTapingEvacuationShuttleRunningModeType.Manual,
                RunningModeDateTime = DateTime.Now,
            };

            Console.WriteLine("Collect");
            collectClient.MissionStatus(resquestMissionStatusCollect);
            Console.WriteLine("MissionStatus OK");

            collectClient.ReportRunningMode(resquestReportRunningModeCollect);
            Console.WriteLine("ReportRunningMode OK");

            collectClient.TapingOutputConveyorNumber(requestConveyorNumberCollect);
            Console.WriteLine("ConveyorNumber OK");

            Console.WriteLine("Evacuation");
            evacuationClient.MissionStatus(resquestMissionStatusEvacuation);
            Console.WriteLine("MissionStatus OK");

            evacuationClient.ReportRunningMode(resquestReportRunningModeEvacuation);
            Console.WriteLine("ReportRunningMode OK");

            Console.ReadKey();
        }
示例#2
0
        private void SvMgrAPI_OnDataChange2(SvMgrObjects.VariableResult[] ArrayVarResult)
        {
            for (int i = 0; i < ArrayVarResult.Length; i++)
            {
                switch (ArrayVarResult[i].varValue.vt)
                {
                case SvMgrEnums.VarType.svmgr_vtLOG:
                    foreach (TypeBool typeBool in Variable.vVariableBool)
                    {
                        if ((typeBool.GetAdviseNumber() == ArrayVarResult[i].clientHandle))
                        {
                            SvMgrAPI.LogMessage(SvMgrEnums.LogMessageLevel.Info, typeBool.GetVarName() + " = " + ArrayVarResult[i].varValue.Log);
                            typeBool.SetVar(ArrayVarResult[i].varValue.Log);
                        }
                    }
                    break;

                case SvMgrEnums.VarType.svmgr_vtANA:
                    foreach (TypeAna typeAna in Variable.vVariableAna)
                    {
                        if ((typeAna.GetAdviseNumber() == ArrayVarResult[i].clientHandle))
                        {
                            SvMgrAPI.LogMessage(SvMgrEnums.LogMessageLevel.Info, typeAna.GetVarName() + " = " + ArrayVarResult[i].varValue.Ana);
                            typeAna.SetVar(ArrayVarResult[i].varValue.Ana);
                        }
                    }
                    break;

                case SvMgrEnums.VarType.svmgr_vtTXT:
                    foreach (TypeString typeString in Variable.vVariableString)
                    {
                        if ((typeString.GetAdviseNumber() == ArrayVarResult[i].clientHandle))
                        {
                            SvMgrAPI.LogMessage(SvMgrEnums.LogMessageLevel.Info, typeString.GetVarName() + " = " + ArrayVarResult[i].varValue.Txt);
                            typeString.SetVar(ArrayVarResult[i].varValue.Txt);
                        }
                    }
                    break;
                }

                /*--------------------------------------------------- Action sur changement de valeur ----------------------------------------------------*/
                int indice;
                /*------------------------- Navette Collecte --------------------------------------*/
                //Class

                // MissionStatus
                indice = Variable.vVariableBool.IndexOf(NavetteCollecte.MissionStatus.SendCom);
                if (Variable.vVariableBool[indice].GetVarValue())
                {
                    indice = Variable.vVariableAna.IndexOf(NavetteCollecte.MissionStatus.MissionNumber);
                    resquestMissionStatusCollect.MissionNumber = Convert.ToInt32(Variable.vVariableAna[indice].GetVarValue());

                    indice = Variable.vVariableBool.IndexOf(NavetteCollecte.MissionStatus.MissionStatus);
                    if (Variable.vVariableBool[indice].GetVarValue())
                    {
                        resquestMissionStatusCollect.MissionStatus = PostTapingCollectShuttleMissionStatusType.Nok;
                    }
                    else
                    {
                        resquestMissionStatusCollect.MissionStatus = PostTapingCollectShuttleMissionStatusType.Ok;
                    }

                    try
                    {
                        collectClient.MissionStatus(resquestMissionStatusCollect);
                        SvMgrAPI.LogMessage(SvMgrEnums.LogMessageLevel.Info, "Collecte -- MissionStatus : OK");
                    }catch (Exception e)
                    {
                        indice = Variable.vVariableBool.IndexOf(NavetteCollecte.ErreurCom);
                        Variable.vVariableBool[indice].WriteVar(true);
                        SvMgrAPI.LogMessage(SvMgrEnums.LogMessageLevel.Warning, "Collecte -- Mission Status : " + e.Message);
                    }
                    indice = Variable.vVariableBool.IndexOf(NavetteCollecte.MissionStatus.SendCom);
                    Variable.vVariableBool[indice].WriteVar(false);
                }

                // ReportRunningMode
                indice = Variable.vVariableBool.IndexOf(NavetteCollecte.ReportRunningMode.SendCom);
                if (Variable.vVariableBool[indice].GetVarValue())
                {
                    indice = Variable.vVariableAna.IndexOf(NavetteCollecte.ReportRunningMode.DefaultCode);
                    resquestReportRunningModeCollect.DefaultCode = Convert.ToInt32(Variable.vVariableAna[indice].GetVarValue());

                    indice = Variable.vVariableString.IndexOf(NavetteCollecte.ReportRunningMode.DefaultLabel);
                    resquestReportRunningModeCollect.DefaultLabel = Variable.vVariableString[indice].GetVarValue();

                    indice = Variable.vVariableAna.IndexOf(NavetteCollecte.ReportRunningMode.EquipmentCode);
                    resquestReportRunningModeCollect.EquipmentCode = Convert.ToInt32(Variable.vVariableAna[indice].GetVarValue());

                    indice = Variable.vVariableAna.IndexOf(NavetteCollecte.ReportRunningMode.RunningMode);
                    if (Variable.vVariableAna[indice].GetVarValue() == 0)
                    {
                        resquestReportRunningModeCollect.RunningMode = PostTapingCollectShuttleRunningModeType.Default;
                    }
                    else if (Variable.vVariableAna[indice].GetVarValue() == 1)
                    {
                        resquestReportRunningModeCollect.RunningMode = PostTapingCollectShuttleRunningModeType.Manual;
                    }
                    else if (Variable.vVariableAna[indice].GetVarValue() == 2)
                    {
                        resquestReportRunningModeCollect.RunningMode = PostTapingCollectShuttleRunningModeType.MissionInProgress;
                    }
                    else if (Variable.vVariableAna[indice].GetVarValue() == 3)
                    {
                        resquestReportRunningModeCollect.RunningMode = PostTapingCollectShuttleRunningModeType.Rest;
                    }

                    resquestReportRunningModeCollect.RunningModeDateTime = DateTime.Now;

                    try
                    {
                        collectClient.ReportRunningMode(resquestReportRunningModeCollect);
                        SvMgrAPI.LogMessage(SvMgrEnums.LogMessageLevel.Info, "Collecte -- Report Running Mode : OK");
                    }catch (Exception e)
                    {
                        indice = Variable.vVariableBool.IndexOf(NavetteCollecte.ErreurCom);
                        Variable.vVariableBool[indice].WriteVar(true);
                        SvMgrAPI.LogMessage(SvMgrEnums.LogMessageLevel.Warning, "Collecte -- Report Running Mode : " + e.Message);
                    }
                    indice = Variable.vVariableBool.IndexOf(NavetteCollecte.ReportRunningMode.SendCom);
                    Variable.vVariableBool[indice].WriteVar(false);
                }

                // TapingOutputConveyorNumber
                indice = Variable.vVariableBool.IndexOf(NavetteCollecte.TapingOutputConveyorNumber.SendCom);
                if (Variable.vVariableBool[indice].GetVarValue())
                {
                    indice = Variable.vVariableAna.IndexOf(NavetteCollecte.TapingOutputConveyorNumber.TapingOutputConveyorNumber);
                    requestConveyorNumberCollect.TapingOutputConveyorNumber = Convert.ToInt32(Variable.vVariableAna[indice].GetVarValue());

                    try
                    {
                        collectClient.TapingOutputConveyorNumber(requestConveyorNumberCollect);
                        SvMgrAPI.LogMessage(SvMgrEnums.LogMessageLevel.Info, "Collecte -- Taping Output Conveyor Number : OK");
                    }
                    catch (Exception e)
                    {
                        indice = Variable.vVariableBool.IndexOf(NavetteCollecte.ErreurCom);
                        Variable.vVariableBool[indice].WriteVar(true);
                        SvMgrAPI.LogMessage(SvMgrEnums.LogMessageLevel.Warning, "Collecte -- Taping Output Conveyor Number : " + e.Message);
                    }
                    indice = Variable.vVariableBool.IndexOf(NavetteCollecte.TapingOutputConveyorNumber.SendCom);
                    Variable.vVariableBool[indice].WriteVar(false);
                }

                /*------------------------- Navette Evacuation --------------------------------------*/

                // MissionStatus
                indice = Variable.vVariableBool.IndexOf(NavetteEvacuation.MissionStatus.SendCom);
                if (Variable.vVariableBool[indice].GetVarValue())
                {
                    indice = Variable.vVariableAna.IndexOf(NavetteEvacuation.MissionStatus.MissionNumber);
                    resquestMissionStatusEvacuation.MissionNumber = Convert.ToInt32(Variable.vVariableAna[indice].GetVarValue());

                    indice = Variable.vVariableBool.IndexOf(NavetteEvacuation.MissionStatus.MissionStatus);
                    if (Variable.vVariableBool[indice].GetVarValue())
                    {
                        resquestMissionStatusEvacuation.MissionStatus = PostTapingEvacuationShuttleMissionStatusType.Nok;
                    }
                    else
                    {
                        resquestMissionStatusEvacuation.MissionStatus = PostTapingEvacuationShuttleMissionStatusType.Ok;
                    }

                    try
                    {
                        evacuationClient.MissionStatus(resquestMissionStatusEvacuation);
                        SvMgrAPI.LogMessage(SvMgrEnums.LogMessageLevel.Info, "Evacuation -- Mission Status : OK");
                    }
                    catch (Exception e)
                    {
                        indice = Variable.vVariableBool.IndexOf(NavetteEvacuation.ErreurCom);
                        Variable.vVariableBool[indice].WriteVar(true);
                        SvMgrAPI.LogMessage(SvMgrEnums.LogMessageLevel.Warning, "Evacuation -- Mission Status : " + e.Message);
                    }
                    indice = Variable.vVariableBool.IndexOf(NavetteEvacuation.MissionStatus.SendCom);
                    Variable.vVariableBool[indice].WriteVar(false);
                }

                // ReportRunningMode
                indice = Variable.vVariableBool.IndexOf(NavetteEvacuation.ReportRunningMode.SendCom);
                if (Variable.vVariableBool[indice].GetVarValue())
                {
                    indice = Variable.vVariableAna.IndexOf(NavetteEvacuation.ReportRunningMode.DefaultCode);
                    resquestReportRunningModeEvacuation.DefaultCode = Convert.ToInt32(Variable.vVariableAna[indice].GetVarValue());

                    indice = Variable.vVariableString.IndexOf(NavetteEvacuation.ReportRunningMode.DefaultLabel);
                    resquestReportRunningModeEvacuation.DefaultLabel = Variable.vVariableString[indice].GetVarValue();

                    indice = Variable.vVariableAna.IndexOf(NavetteEvacuation.ReportRunningMode.EquipmentCode);
                    resquestReportRunningModeEvacuation.EquipmentCode = Convert.ToInt32(Variable.vVariableAna[indice].GetVarValue());

                    indice = Variable.vVariableAna.IndexOf(NavetteEvacuation.ReportRunningMode.RunningMode);
                    if (Variable.vVariableAna[indice].GetVarValue() == 0)
                    {
                        resquestReportRunningModeEvacuation.RunningMode = PostTapingEvacuationShuttleRunningModeType.Default;
                    }
                    else if (Variable.vVariableAna[indice].GetVarValue() == 1)
                    {
                        resquestReportRunningModeEvacuation.RunningMode = PostTapingEvacuationShuttleRunningModeType.Manual;
                    }
                    else if (Variable.vVariableAna[indice].GetVarValue() == 2)
                    {
                        resquestReportRunningModeEvacuation.RunningMode = PostTapingEvacuationShuttleRunningModeType.MissionInProgress;
                    }
                    else if (Variable.vVariableAna[indice].GetVarValue() == 3)
                    {
                        resquestReportRunningModeEvacuation.RunningMode = PostTapingEvacuationShuttleRunningModeType.Rest;
                    }

                    resquestReportRunningModeEvacuation.RunningModeDateTime = DateTime.Now;

                    try
                    {
                        evacuationClient.ReportRunningMode(resquestReportRunningModeEvacuation);
                        SvMgrAPI.LogMessage(SvMgrEnums.LogMessageLevel.Info, "Evacuation -- Report Running Mode : OK");
                    }
                    catch (Exception e)
                    {
                        indice = Variable.vVariableBool.IndexOf(NavetteEvacuation.ErreurCom);
                        Variable.vVariableBool[indice].WriteVar(true);
                        SvMgrAPI.LogMessage(SvMgrEnums.LogMessageLevel.Warning, "Evacuation -- Report Running Mode : " + e.Message);
                    }
                    indice = Variable.vVariableBool.IndexOf(NavetteEvacuation.ReportRunningMode.SendCom);
                    Variable.vVariableBool[indice].WriteVar(false);
                }

                /*--------------------------------------------------- Fin action sur changement de valeur ----------------------------------------------------*/
            }
        }