Example #1
0
        private void InlineEfficiencyMonitor()
        {
            ALINE      line       = scApp.getEQObjCacheManager().getLine();
            VehicleBLL vehicleBLL = scApp.VehicleBLL;
            CMDBLL     cmdBLL     = scApp.CMDBLL;

            line.CurrntVehicleModeAutoRemoteCount = vehicleBLL.cache.getVhCurrentModeInAutoRemoteCount();
            line.CurrntVehicleModeAutoLoaclCount  = vehicleBLL.cache.getVhCurrentModeInAutoLocalCount();
            line.CurrntVehicleStatusIdelCount     = vehicleBLL.cache.getVhCurrentStatusInIdleCount();
            line.CurrntVehicleStatusErrorCount    = vehicleBLL.cache.getVhCurrentStatusInErrorCount();
            var    host_cmds = cmdBLL.loadACMD_MCSIsUnfinished();
            UInt16 carrier_transferring_count = (UInt16)host_cmds.
                                                Where(cmd => cmd.TRANSFERSTATE == E_TRAN_STATUS.Transferring).
                                                Count();
            UInt16 carrier_watting_count = (UInt16)host_cmds.
                                           Where(cmd => cmd.TRANSFERSTATE < E_TRAN_STATUS.Transferring).
                                           Count();
            UInt16 host_cmd_assigned_count = (UInt16)host_cmds.
                                             Where(cmd => cmd.TRANSFERSTATE >= E_TRAN_STATUS.Initial).
                                             Count();
            UInt16 host_cmd_watting_count = (UInt16)host_cmds.
                                            Where(cmd => cmd.TRANSFERSTATE < E_TRAN_STATUS.Initial).
                                            Count();

            line.CurrntCSTStatueTransferCount = carrier_transferring_count;
            line.CurrntCSTStatueWaitingCount  = carrier_watting_count;
            line.CurrntHostCommandTransferStatueAssignedCount = host_cmd_assigned_count;
            line.CurrntHostCommandTransferStatueWaitingCounr  = host_cmd_watting_count;
        }
        public bool checkAndUpdateVhEntryCycleRunAdr(string vh_id, string adr_id)
        {
            bool             isCyclingAdr    = false;
            ACYCLEZONEMASTER cycleZoneMaster = null;
            ALINE            line            = scApp.getEQObjCacheManager().getLine();
            AVEHICLE         vh = scApp.VehicleBLL.getVehicleByID(vh_id);

            if (!SCUtility.isEmpty(vh.CYCLERUN_ID) &&
                !vh.IS_CYCLING)
            {
                //DBConnection_EF con = DBConnection_EF.GetContext();
                //using (DBConnection_EF con = new DBConnection_EF())
                using (DBConnection_EF con = DBConnection_EF.GetUContext())
                {
                    cycleZoneMaster = cycleZoneMasterDao.getByEntryAdr(con, adr_id);
                    if (cycleZoneMaster == null)
                    {
                        return(false);
                    }
                    if (SCUtility.isMatche(vh.CYCLERUN_ID, cycleZoneMaster.CYCLE_ZONE_ID))
                    {
                        scApp.VehicleBLL.setVhIsInCycleRun(vh_id); //TODO 討論移到144判斷
                        isCyclingAdr = true;
                    }
                }
            }

            return(isCyclingAdr);
        }
Example #3
0
        /// <summary>
        /// Timer Action的執行動作
        /// </summary>
        /// <param name="obj">The object.</param>
        public override void doProcess(object obj)
        {
            if (System.Threading.Interlocked.Exchange(ref synPoint, 1) == 0)
            {
                try
                {
                    doCheckIPLinkStatus();
                    //doCheckIPLinkStatusParallel();
                    doCheckEQAliveStatus();
                    scApp.CheckSystemEventHandler.CheckCheckSystemIsExist();

                    ALINE line = scApp.getEQObjCacheManager().getLine();
                    InlineEfficiencyMonitor(line);
                    Task.Run(() =>
                    {
                        CheckLinkStatus(line);
                    });
                    if (SCUtility.getCallContext <bool>(ALINE.CONTEXT_KEY_WORD_LINE_STATUS_HAS_CHANGE))
                    {
                        line.NotifyLineStatusChange();
                        SCUtility.setCallContext(ALINE.CONTEXT_KEY_WORD_LINE_STATUS_HAS_CHANGE, null);
                    }
                }
                catch (Exception ex)
                {
                    logger.Error(ex, "Exception");
                }
                finally
                {
                    System.Threading.Interlocked.Exchange(ref synPoint, 0);
                }
            }
        }
 private void SetSCState(ALINE line)
 {
     Adapter.Invoke((obj) =>
     {
         lbl_SCState.Text = line.SCStats.GetDisplayName();
     }, null);
 }
Example #5
0
 public SubChargerValueDefMapAction()
     : base()
 {
     scApp  = SCApplication.getInstance();
     bcfApp = scApp.getBCFApplication();
     line   = scApp.getEQObjCacheManager().getLine();
 }
Example #6
0
        private void InlineEfficiencyMonitor(ALINE line)
        {
            VehicleBLL vehicleBLL = scApp.VehicleBLL;
            CMDBLL     cmdBLL     = scApp.CMDBLL;

            line.CurrntVehicleModeAutoRemoteCount = vehicleBLL.cache.getVhCurrentModeInAutoRemoteCount();
            line.CurrntVehicleModeAutoLoaclCount  = vehicleBLL.cache.getVhCurrentModeInAutoLocalCount();
            line.CurrntVehicleStatusIdelCount     = vehicleBLL.cache.getVhCurrentStatusInIdleCount();
            line.CurrntVehicleStatusErrorCount    = vehicleBLL.cache.getVhCurrentStatusInErrorCount();
            var    host_cmds = cmdBLL.loadACMD_MCSIsUnfinished();
            var    cst       = scApp.CassetteDataBLL.loadCassetteData();
            UInt16 carrier_transferring_count = (UInt16)cst.
                                                Where(x => x.CSTState == E_CSTState.Alternate ||
                                                      x.CSTState == E_CSTState.WaitIn ||
                                                      x.CSTState == E_CSTState.WaitOut ||
                                                      x.CSTState == E_CSTState.Transferring).
                                                Count();
            UInt16 carrier_watting_count = (UInt16)cst.
                                           Where(x => x.CSTState == E_CSTState.Installed ||
                                                 x.CSTState == E_CSTState.Completed).
                                           Count();

            UInt16 host_cmd_assigned_count = (UInt16)host_cmds.
                                             Where(cmd => cmd.TRANSFERSTATE >= E_TRAN_STATUS.Transferring).
                                             Count();
            UInt16 host_cmd_watting_count = (UInt16)host_cmds.
                                            Where(cmd => cmd.TRANSFERSTATE < E_TRAN_STATUS.Transferring).
                                            Count();

            line.CurrntCSTStatueTransferCount = carrier_transferring_count;
            line.CurrntCSTStatueWaitingCount  = carrier_watting_count;
            line.CurrntHostCommandTransferStatueAssignedCount = host_cmd_assigned_count;
            line.CurrntHostCommandTransferStatueWaitingCounr  = host_cmd_watting_count;
        }
Example #7
0
        public void start(SCApplication _app)
        {
            scApp     = _app;
            reportBLL = _app.ReportBLL;
            lineBLL   = _app.LineBLL;
            line      = scApp.getEQObjCacheManager().getLine();

            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.Host_Control_State), PublishLineInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.SCStats), PublishLineInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.Secs_Link_Stat), PublishLineInfo);

            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.CurrentPortStateChecked), PublishOnlineCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.CurrentStateChecked), PublishOnlineCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.EnhancedVehiclesChecked), PublishOnlineCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.TSCStateChecked), PublishOnlineCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.UnitAlarmStateListChecked), PublishOnlineCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.EnhancedTransfersChecked), PublishOnlineCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.EnhancedCarriersChecked), PublishOnlineCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.LaneCutListChecked), PublishOnlineCheckInfo);

            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.MCSConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.RouterConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.OHT1ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.OHT2ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.OHT3ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.OHT4ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.OHT5ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.OHT6ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.OHT7ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.OHT8ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.OHT9ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.OHT10ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.OHT11ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.OHT12ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.OHT13ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.OHT14ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.MTLConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.MTSConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.MTS2ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.HID1ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.HID2ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.HID3ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.HID4ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.Adam1ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.Adam2ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.Adam3ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.Adam4ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AP1ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AP2ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AP3ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AP4ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AP5ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AP6ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AP7ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AP8ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AP9ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AP10ConnectionSuccess), PublishPingCheckInfo);
            //initPublish(line);
        }
        private void initialMapInfo()
        {
            MapId = app.MapBLL.GetMapInfoFromHttp(sc.App.SCAppConstants.MapInfoDataType.MapID);
            EFConnectionString = app.MapBLL.GetMapInfoFromHttp(sc.App.SCAppConstants.MapInfoDataType.EFConnectionString);
            RAILs        = app.MapBLL.GetMapInfosFromHttp <ARAIL>(sc.App.SCAppConstants.MapInfoDataType.Rail);
            POINTs       = app.MapBLL.GetMapInfosFromHttp <APOINT>(sc.App.SCAppConstants.MapInfoDataType.Point);
            GROUPRAILs   = app.MapBLL.GetMapInfosFromHttp <AGROUPRAILS>(sc.App.SCAppConstants.MapInfoDataType.GroupRails);
            ADDRESSes    = app.MapBLL.GetMapInfosFromHttp <AADDRESS>(sc.App.SCAppConstants.MapInfoDataType.Address);
            SECTIONs     = app.MapBLL.GetMapInfosFromHttp <ASECTION>(sc.App.SCAppConstants.MapInfoDataType.Section);
            SEGMENTs     = app.MapBLL.GetMapInfosFromHttp <ASEGMENT>(sc.App.SCAppConstants.MapInfoDataType.Segment);
            PORTSTATIONs = app.MapBLL.GetMapInfosFromHttp <APORTSTATION>(sc.App.SCAppConstants.MapInfoDataType.Port);
            PORTICONs    = app.MapBLL.GetMapInfosFromHttp <APORTICON>(sc.App.SCAppConstants.MapInfoDataType.PortIcon);
            Vehicles     = app.MapBLL.GetMapInfosFromHttp <AVEHICLE>(sc.App.SCAppConstants.MapInfoDataType.Vehicle);
            Eqpts        = app.MapBLL.GetMapInfosFromHttp <AEQPT>(sc.App.SCAppConstants.MapInfoDataType.Eqpt);
            List <MaintainLift>  mtlList = app.MapBLL.GetMapInfosFromHttp <MaintainLift>(sc.App.SCAppConstants.MapInfoDataType.MTL);
            List <MaintainSpace> mtsList = app.MapBLL.GetMapInfosFromHttp <MaintainSpace>(sc.App.SCAppConstants.MapInfoDataType.MTS);

            for (int i = 0; i < Eqpts.Count; i++)
            {
                var mtl = mtlList.Where(m => sc.Common.SCUtility.isMatche(m.EQPT_ID, Eqpts[i].EQPT_ID)).FirstOrDefault();
                if (mtl != null)
                {
                    Eqpts[i] = mtl;
                }
            }

            for (int i = 0; i < Eqpts.Count; i++)
            {
                var mts = mtsList.Where(m => sc.Common.SCUtility.isMatche(m.EQPT_ID, Eqpts[i].EQPT_ID)).FirstOrDefault();
                if (mts != null)
                {
                    Eqpts[i] = mts;
                }
            }

            //Eqpts = new List<AEQPT>();
            //Eqpts.AddRange(mtlList);
            //Eqpts.AddRange(mtsList);
            Line = app.MapBLL.GetMapInfoFromHttp <ALINE>(sc.App.SCAppConstants.MapInfoDataType.Line);



            ALARMs    = app.AlarmBLL.loadSetAlarm();
            AlarmMaps = app.MapBLL.GetMapInfosFromHttp <AlarmMap>(sc.App.SCAppConstants.MapInfoDataType.AlarmMap);

            MPCTipMessages = new List <sc.Data.VO.MPCTipMessage>();

            PORTSTATIONs = app.PortStationBLL.OperateDB.loadPortStation();
            USERs        = app.UserBLL.OperateDBUser.loadUser();
            USERGROUPs   = app.UserBLL.OperateDBUserGroup.loadUserGroup();
            USERFUNCs    = app.UserBLL.OperateDBUserGroupFunc.loadAllUserGroupFunc();
            FUNCs        = app.UserBLL.OperateDBFunctionCode.loadAllFunctionCode();
            //app.CmdBLL.loadACMD_MCSIsUnfinishedObjToShow();
            //MCS_CMDs = app.CmdBLL.loadACMD_MCSIsUnfinishedObjToShow();
            //MCS_CMDs = new List<sc.ObjectRelay.CMD_MCSObjToShow>();
            //MCS_CMDs = app.CmdBLL.loadVACMD_MCS();
            MCS_CMDs = app.CmdBLL.loadVACMD_MCS();
            initialVehicleObjToShow();
        }
        private void ProcLineInfo(object sender, StanMsgHandlerArgs e)
        {
            var   bytes         = e.Message.Data;
            var   line_info_gpb = BLL.LineBLL.Convert2Object_LineInfo(bytes);
            ALINE line          = scApp.getEQObjCacheManager().getLine();

            line.Put(line_info_gpb);
        }
        private void ObjCacheManager_PingCheckInfo_update(object sender, EventArgs e)
        {
            ALINE aLINE = app.ObjCacheManager.GetLine();

            try
            {
                Adapter.BeginInvoke(new SendOrPostCallback((o1) =>
                {
                    /*MCS Status*/
                    uc_MCS_Status.SetConnStatus("MCS", aLINE.MCSConnectionSuccess);
                    uc_Router_Status.SetConnStatus("Router", aLINE.RouterConnectionSuccess);
                    /*Vehicle Link Status*/
                    uc_VhLk_Status_OHT1.SetConnStatus("OHT1", aLINE.OHT1ConnectionSuccess);
                    uc_VhLk_Status_OHT2.SetConnStatus("OHT2", aLINE.OHT2ConnectionSuccess);
                    uc_VhLk_Status_OHT3.SetConnStatus("OHT3", aLINE.OHT3ConnectionSuccess);
                    uc_VhLk_Status_OHT4.SetConnStatus("OHT4", aLINE.OHT4ConnectionSuccess);
                    uc_VhLk_Status_OHT5.SetConnStatus("OHT5", aLINE.OHT5ConnectionSuccess);
                    uc_VhLk_Status_OHT6.SetConnStatus("OHT6", aLINE.OHT6ConnectionSuccess);
                    uc_VhLk_Status_OHT7.SetConnStatus("OHT7", aLINE.OHT7ConnectionSuccess);
                    uc_VhLk_Status_OHT8.SetConnStatus("OHT8", aLINE.OHT8ConnectionSuccess);
                    uc_VhLk_Status_OHT9.SetConnStatus("OHT9", aLINE.OHT9ConnectionSuccess);
                    uc_VhLk_Status_OHT10.SetConnStatus("OHT10", aLINE.OHT10ConnectionSuccess);
                    uc_VhLk_Status_OHT11.SetConnStatus("OHT11", aLINE.OHT11ConnectionSuccess);
                    uc_VhLk_Status_OHT12.SetConnStatus("OHT12", aLINE.OHT12ConnectionSuccess);
                    uc_VhLk_Status_OHT13.SetConnStatus("OHT13", aLINE.OHT13ConnectionSuccess);
                    uc_VhLk_Status_OHT14.SetConnStatus("OHT14", aLINE.OHT14ConnectionSuccess);
                    /*PLC Status*/
                    uc_PLC_Status_MTL.SetConnStatus("MTL", aLINE.MTLConnectionSuccess);
                    uc_PLC_Status_MTS1.SetConnStatus("MTS", aLINE.MTSConnectionSuccess);
                    uc_PLC_Status_MTS2.SetConnStatus("MTS2", aLINE.MTS2ConnectionSuccess);
                    uc_PLC_Status_HID1.SetConnStatus("HID1", aLINE.HID1ConnectionSuccess);
                    uc_PLC_Status_HID2.SetConnStatus("HID2", aLINE.HID2ConnectionSuccess);
                    uc_PLC_Status_HID3.SetConnStatus("HID3", aLINE.HID3ConnectionSuccess);
                    uc_PLC_Status_HID4.SetConnStatus("HID4", aLINE.HID4ConnectionSuccess);
                    uc_PLC_Status_ADAM6050_1.SetConnStatus("ADAM6050-1", aLINE.Adam1ConnectionSuccess);
                    uc_PLC_Status_ADAM6050_2.SetConnStatus("ADAM6050-2", aLINE.Adam2ConnectionSuccess);
                    uc_PLC_Status_ADAM6050_3.SetConnStatus("ADAM6050-3", aLINE.Adam3ConnectionSuccess);
                    uc_PLC_Status_ADAM6050_4.SetConnStatus("ADAM6050-4", aLINE.Adam4ConnectionSuccess);
                    /*AP Status*/
                    uc_AP_Status_1.SetConnStatus("AP-1", aLINE.AP1ConnectionSuccess);
                    uc_AP_Status_2.SetConnStatus("AP-2", aLINE.AP2ConnectionSuccess);
                    uc_AP_Status_3.SetConnStatus("AP-3", aLINE.AP3ConnectionSuccess);
                    uc_AP_Status_4.SetConnStatus("AP-4", aLINE.AP4ConnectionSuccess);
                    uc_AP_Status_5.SetConnStatus("AP-5", aLINE.AP5ConnectionSuccess);
                    uc_AP_Status_6.SetConnStatus("AP-6", aLINE.AP6ConnectionSuccess);
                    uc_AP_Status_7.SetConnStatus("AP-7", aLINE.AP7ConnectionSuccess);
                    uc_AP_Status_8.SetConnStatus("AP-8", aLINE.AP8ConnectionSuccess);
                    uc_AP_Status_9.SetConnStatus("AP-9", aLINE.AP9ConnectionSuccess);
                    uc_AP_Status_10.SetConnStatus("AP-10", aLINE.AP10ConnectionSuccess);
                }), null);
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception");
            }
        }
Example #11
0
        public void start(SCApplication _app)
        {
            scApp     = _app;
            reportBLL = _app.ReportBLL;
            lineBLL   = _app.LineBLL;
            line      = scApp.getEQObjCacheManager().getLine();


            //initPublish(line);
        }
Example #12
0
        private void RedisCacheManager_ConnectionRestored(object sender, ConnectionFailedEventArgs e)
        {
            logger.Info("ConnectionRestored");
            ALINE line = scApp.getEQObjCacheManager().getLine();

            if (line != null)
            {
                line.Redis_Link_Stat = SCAppConstants.LinkStatus.LinkOK;
            }
        }
Example #13
0
 /// <summary>
 /// Initializes the start.
 /// </summary>
 public override void initStart()
 {
     //not implement
     scApp = SCApplication.getInstance();
     //smControl = scApp.getBCFApplication().getMPLCSMControl("EQ") as MPLCSMControl;
     //isAliveIndexVW = scApp.getBCFApplication().getWriteValueEvent(SCAppConstants.EQPT_OBJECT_CATE_LINE, "VH_LINE", "OHxC_Alive_W");
     //isAliveIndexVR = scApp.getBCFApplication().getReadValueEvent(SCAppConstants.EQPT_OBJECT_CATE_LINE, "VH_LINE", "OHxC_Alive_R");
     dicCommInfo = scApp.getEQObjCacheManager().CommonInfo.dicCommunactionInfo;
     line        = scApp.getEQObjCacheManager().getLine();
 }
Example #14
0
        public void start(SCApplication _app)
        {
            scApp     = _app;
            reportBLL = _app.ReportBLL;
            lineBLL   = _app.LineBLL;
            line      = scApp.getEQObjCacheManager().getLine();

            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.Host_Control_State), PublishLineInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.SCStats), PublishLineInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.Secs_Link_Stat), PublishLineInfo);

            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.CurrentPortStateChecked), PublishOnlineCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.CurrentStateChecked), PublishOnlineCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.EnhancedVehiclesChecked), PublishOnlineCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.TSCStateChecked), PublishOnlineCheckInfo);
            //line.addEventHandler(nameof(ConnectionInfoService), nameof(line.UnitAlarmStateListChecked), PublishOnlineCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.EnhancedTransfersChecked), PublishOnlineCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.EnhancedCarriersChecked), PublishOnlineCheckInfo);
            //line.addEventHandler(nameof(ConnectionInfoService), nameof(line.LaneCutListChecked), PublishOnlineCheckInfo);

            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.MCSConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.RouterConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AGV1ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AGV2ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AGV3ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AGV4ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AGV5ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AGV6ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AGV7ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AGV8ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AGV9ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AGV10ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AGV11ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AGV12ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AGV13ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AGV14ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.ChargePLCConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.ADAM1ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.ADAM2ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.ADAM3ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.ADAM4ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.ADAM5ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AP1ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AP2ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AP3ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AP4ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AP5ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AP6ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AP7ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AP8ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AP9ConnectionSuccess), PublishPingCheckInfo);
            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.AP10ConnectionSuccess), PublishPingCheckInfo);

            initPublish(line);
        }
        private void updateTransferCommand()
        {
            //var mcs_commands = mainform.BCApp.SCApplication.CMDBLL.loadUnfinishedTransfer();
            ALINE line      = mainform.BCApp.SCApplication.getEQObjCacheManager().getLine();
            var   transfers = line.CurrentExcuteTransferCommand;

            cmdMCSshowList = transfers.
                             Select(mcs_cmd => new TRANSFERObjToShow(mainform.BCApp.SCApplication.PortStationBLL, mcs_cmd)).
                             ToList();
            cmsMCS_bindingSource.DataSource = cmdMCSshowList;
            dgv_TransferCommand.Refresh();
        }
        public bool isActive()
        {
            bool   isMaster  = false;
            string timeStemp = DateTime.Now.ToString(SCAppConstants.TimestampFormat_19);
            ALINE  line      = scApp.getEQObjCacheManager().getLine();

            try
            {
#if DEBUG
                //return true;
#endif
                //1.確認Current host是不是自己
                //  a.是:將自己的直在Set一次並回傳true
                string current_ohxc_id = redisCacheManager.StringGet(REDIS_KEY_WORD_CURRENT_MASTER);
                if (!SCUtility.isEmpty(current_ohxc_id) && SCUtility.isMatche(SCApplication.ServerName, current_ohxc_id))
                {
                    SetMaserHeartbeat();
                    isMaster = true;
                }
                //  b.否:回傳false,並確認目前的Master是不是存在,如果不存在的話將自己設置為Mater
                else
                {
                    string current_master_name = string.Format(REDIS_KEY_WORD_MASTER_TITLE, current_ohxc_id);
                    if (scApp.getRedisCacheManager().KeyExists(current_master_name))
                    {
                        isMaster = false;
                    }
                    else
                    {
                        if (!tryGetRedisLockKey(REDIS_LOCK_KEY_FAILOVER, timeStemp, timeOut_3Sec))
                        {
                            return(line.ServiceMode == SCAppConstants.AppServiceMode.Active);
                        }
                        Set2OHxCMaster();
                        SetMaserHeartbeat();
                        isMaster = true;
                        releaseRedisLockKey(REDIS_LOCK_KEY_FAILOVER, timeStemp);
                    }
                }
            }
            catch (StackExchange.Redis.RedisConnectionException ex)
            {
                logger.Error(ex, "Exception:");
                //scApp.getRedisCacheManager().initialRedisConnection();
                return(line.ServiceMode == SCAppConstants.AppServiceMode.Active);
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception:");
                return(line.ServiceMode == SCAppConstants.AppServiceMode.Active);
            }
            return(isMaster);
        }
 /// <summary>
 /// Updates the line.
 /// </summary>
 /// <param name="conn">The connection.</param>
 /// <param name="line">The line.</param>
 public void updateLine(DBConnection_EF conn, ALINE line)
 {
     try
     {
         conn.SaveChanges();
     }
     catch (Exception ex)
     {
         logger.Warn(ex);
         throw;
     }
 }
        public void start(SCApplication _app)
        {
            scApp     = _app;
            reportBLL = _app.ReportBLL;
            lineBLL   = _app.LineBLL;
            line      = scApp.getEQObjCacheManager().getLine();

            line.addEventHandler(nameof(ConnectionInfoService), nameof(line.MCSCommandAutoAssign), PublishTransferInfo);


            initPublish(line);
        }
        private void CMD_CST_DATA_Load(object sender, EventArgs e)
        {
            line        = BCApp.SCApplication.getEQObjCacheManager().getLine();
            shelfDefs   = BCApp.SCApplication.ShelfDefBLL.LoadEnableShelf();
            avehicle    = BCApp.SCApplication.VehicleBLL.loadAllVehicle();
            portInIList = BCApp.SCApplication.TransferService.portINIData.Values.ToList();

            foreach (var v in portInIList)
            {
                if ((BCApp.SCApplication.TransferService.isCVPort(v.PortName) && v.nowStage == v.Stage) ||
                    BCApp.SCApplication.TransferService.isAGVZone(v.PortName)
                    )
                {
                    comboBox1.Items.Add(v.PortName);
                    comboBox2.Items.Add(v.PortName);
                    comboBox3.Items.Add(v.PortName);
                }
            }

            foreach (var v in avehicle)
            {
                comboBox1.Items.Add(v.VEHICLE_ID);
                //comboBox2.Items.Add(v.PLCPortID);
                comboBox3.Items.Add(v.VEHICLE_ID);
            }

            foreach (var v in shelfDefs)
            {
                comboBox1.Items.Add(v.ShelfID);
                comboBox2.Items.Add(v.ShelfID);
            }

            foreach (var v in BCApp.SCApplication.ShelfDefBLL.LoadShelf())
            {
                comboBox3.Items.Add(v.ShelfID);
            }

            foreach (var v in BCApp.SCApplication.ZoneDefBLL.loadZoneData())
            {
                comboBox4.Items.Add(v.ZoneID.Trim());
                comboBox4.SelectedIndex = 0;
            }

            dateTimePicker1.Value = DateTime.Now.AddHours(-1);
            dateTimePicker2.Value = DateTime.Now;

            UpDate_CmdData();
            UpDate_CstData();
            UpDate_AlarmData();

            openTime = DateTime.Now;
        }
Example #20
0
        /// <summary>
        /// Calls the back do initialize.
        /// </summary>
        /// <param name="status">The status.</param>
        private void callBackDoInitialize(Object status)
        {
            ProgressBarDialog progress = status as ProgressBarDialog;

            Adapter.Invoke(new SendOrPostCallback((o1) =>
            {
                progress.Begin();
                progress.SetText("Initialize...");
            }), null);
            bcApp = BCApplication.getInstance(ServerName);

            try
            {
                bcApp.addUserToolStripStatusLabel(tssl_LoginUser_Value);
                bcApp.addRefreshUIDisplayFun(delegate(object o) { UpdateUIDisplayByAuthority(); });
                bcApp.SCApplication.loadECDataToSystem();
                line = bcApp.SCApplication.getEQObjCacheManager().getLine();
                ci   = bcApp.SCApplication.getEQObjCacheManager().CommonInfo;

                Adapter.Invoke(new SendOrPostCallback((o1) =>
                {
                    registerEvent();
                    initUI();
                }), null);

                //必須等到UI Event註冊完成後,才可以開啟通訊界面
                //bcApp.startProcess();
                bcApp.SCApplication.ParkBLL.setCurrentParkType();
                bcApp.SCApplication.CycleBLL.setCurrentCycleType();
                //line.addEventHandler(this.Name
                //, BCFUtility.getPropertyName(() => line.ServiceMode)
                //, (s1, e1) => { bcApp.SCApplication.FailOverService.ListenOrShutdownServerPort(); });
            }
            catch (Exception ex)
            {
                Adapter.Invoke(new SendOrPostCallback((o1) =>
                {
                    MessageBox.Show(this, ex.ToString());
                }), null);
                logger.Error(ex, "Exception");
            }
            finally
            {
                Adapter.Invoke(new SendOrPostCallback((o1) =>
                {
                    if (progress != null)
                    {
                        progress.End();
                    }
                }), null);
            }
        }
        public void updateVhEntryParkingAdr(string vh_id, APARKZONEDETAIL parkZoneDetail)
        {
            ALINE line = scApp.getEQObjCacheManager().getLine();

            using (DBConnection_EF con = DBConnection_EF.GetUContext())
            {
                updateParkAdrEmpty(vh_id);
                con.APARKZONEDETAIL.Attach(parkZoneDetail);
                parkZoneDetail.CAR_ID = vh_id;
                con.Entry(parkZoneDetail).Property(p => p.CAR_ID).IsModified = true;
                parkZoneDetailDao.update(con, parkZoneDetail);
            }
        }
Example #22
0
        private void RedisCacheManager_ConnectionFailed(object sender, ConnectionFailedEventArgs e)
        {
            logger.Info(e.Exception,
                        "Redis ConnectionFailed.ConnectionType[{0}],FailureType[{1}]",
                        e.ConnectionType,
                        e.FailureType);
            ALINE line = scApp.getEQObjCacheManager().getLine();

            if (line != null)
            {
                line.Redis_Link_Stat = SCAppConstants.LinkStatus.LinkFail;
            }
        }
        private void updateDGVVTransferCommand(ALINE line)
        {
            List <VTRANSFER> cmd_mcs_lst = line.CurrentExcuteTransferCommand;

            if (cmd_mcs_lst == null)
            {
                return;
            }
            transfer_obj_to_show = cmd_mcs_lst.
                                   Select(vTran => new TRANSFERObjToShow(scApp.PortStationBLL, vTran)).
                                   ToList();
            transfer_bindingSource.DataSource = transfer_obj_to_show;
            dgv_TransferCommand.Refresh();
        }
 /// <summary>
 /// Updates the line host mode.
 /// </summary>
 /// <param name="conn">The connection.</param>
 /// <param name="line_id">The line_id.</param>
 /// <param name="host_mode">The host_mode.</param>
 public void updateLineHostMode(DBConnection_EF conn, string line_id, int host_mode)
 {
     try
     {
         ALINE line = getLineByID(conn, true, line_id);
         line.HOST_MODE = host_mode;
         conn.SaveChanges();
     }
     catch (Exception ex)
     {
         logger.Warn(ex);
         throw;
     }
 }
 /// <summary>
 /// Updates the line status.
 /// </summary>
 /// <param name="conn">The connection.</param>
 /// <param name="line_id">The line_id.</param>
 /// <param name="line_stat">The line_stat.</param>
 public void updateLineStatus(DBConnection_EF conn, string line_id, int line_stat)
 {
     try
     {
         ALINE line = getLineByID(conn, true, line_id);
         line.LINE_STAT = line_stat;
         conn.SaveChanges();
     }
     catch (Exception ex)
     {
         logger.Warn(ex);
         throw;
     }
 }
 /// <summary>
 /// Deletes the line by line identifier.
 /// </summary>
 /// <param name="conn">The connection.</param>
 /// <param name="line_id">The line_id.</param>
 public void deleteLineByLineID(DBConnection_EF conn, string line_id)
 {
     try
     {
         ALINE line = getLineByID(conn, false, line_id);
         conn.ALINE.Remove(line);
         conn.SaveChanges();
     }
     catch (Exception ex)
     {
         logger.Warn(ex);
         throw;
     }
 }
 /// <summary>
 /// Inserts the line.
 /// </summary>
 /// <param name="conn">The connection.</param>
 /// <param name="line">The line.</param>
 public void insertLine(DBConnection_EF conn, ALINE line)
 {
     try
     {
         //session.SaveOrUpdate(line);
         conn.ALINE.Add(line);
         conn.SaveChanges();
     }
     catch (Exception ex)
     {
         logger.Warn(ex);
         throw;
     }
 }
        private void updateDGVCommand(ALINE line)
        {
            List <ACMD> cmd_lst = line.CurrentExcuteCommand;

            if (cmd_lst == null)
            {
                return;
            }
            cmd_obj_to_show = cmd_lst.
                              Select(cmd => new CMDObjToShow(cmd)).
                              ToList();
            cmd_bindingSource.DataSource = cmd_obj_to_show;
            dgv_TaskCommand.Refresh();
        }
        public virtual void start(SCApplication _app)
        {
            scApp     = _app;
            reportBLL = _app.ReportBLL;
            lineBLL   = _app.LineBLL;
            line      = scApp.getEQObjCacheManager().getLine();

            line.addEventHandler(nameof(LineService), nameof(line.Currnet_Park_Type), PublishLineInfo);
            line.addEventHandler(nameof(LineService), nameof(line.Currnet_Cycle_Type), PublishLineInfo);
            line.addEventHandler(nameof(LineService), nameof(line.Secs_Link_Stat), PublishLineInfo);
            line.addEventHandler(nameof(LineService), nameof(line.Redis_Link_Stat), PublishLineInfo);
            line.addEventHandler(nameof(LineService), nameof(line.DetectionSystemExist), PublishLineInfo);
            line.addEventHandler(nameof(LineService), nameof(line.IsEarthquakeHappend), PublishLineInfo);
            line.addEventHandler(nameof(LineService), nameof(line.IsAlarmHappened), PublishLineInfo);

            line.addEventHandler(nameof(LineService), nameof(line.HasSeriousAlarmHappend), CheckLightAndBuzzer);
            line.addEventHandler(nameof(LineService), nameof(line.HasWarningHappend), CheckLightAndBuzzer);
            //line.addEventHandler(nameof(LineService), nameof(line.CurrntVehicleModeAutoRemoteCount), PublishLineInfo);
            //line.addEventHandler(nameof(LineService), nameof(line.CurrntVehicleModeAutoLoaclCount), PublishLineInfo);
            //line.addEventHandler(nameof(LineService), nameof(line.CurrntVehicleStatusIdelCount), PublishLineInfo);
            //line.addEventHandler(nameof(LineService), nameof(line.CurrntVehicleStatusErrorCount), PublishLineInfo);
            //line.addEventHandler(nameof(LineService), nameof(line.CurrntCSTStatueTransferCount), PublishLineInfo);
            //line.addEventHandler(nameof(LineService), nameof(line.CurrntCSTStatueWaitingCount), PublishLineInfo);
            //line.addEventHandler(nameof(LineService), nameof(line.CurrntHostCommandTransferStatueAssignedCount), PublishLineInfo);
            //line.addEventHandler(nameof(LineService), nameof(line.CurrntHostCommandTransferStatueWaitingCounr), PublishLineInfo);
            line.LineStatusChange += Line_LineStatusChange;

            line.LongTimeNoCommuncation += Line_LongTimeNoCommuncation;
            line.TimerActionStart();
            //Section 的事務處理
            List <ASECTION> sections = scApp.SectionBLL.cache.GetSections();

            foreach (ASECTION section in sections)
            {
                section.VehicleLeave += SectionVehicleLeave;
            }
            List <AADDRESS> addresses = scApp.AddressesBLL.cache.GetAddresses();

            foreach (AADDRESS address in addresses)
            {
                address.VehicleRelease += AddressVehicleRelease;
            }
            var commonInfo = scApp.getEQObjCacheManager().CommonInfo;

            commonInfo.addEventHandler(nameof(LineService), BCFUtility.getPropertyName(() => commonInfo.MPCTipMsgList),
                                       PublishTipMessageInfo);
        }
Example #30
0
        private void CheckLinkStatus(ALINE line)
        {
            if (System.Threading.Interlocked.Exchange(ref syncCheckLink_Point, 1) == 0)
            {
                try
                {
                    bool is_connection_success = false;
                    foreach (var device in line.DeviceConnectionInfos)
                    {
                        switch (device.Type)
                        {
                        case ProtocolFormat.OHTMessage.DeviceConnectionType.Ap:
                            var ap_setting_info = scApp.LineBLL.getAPSetting(device.Name);
                            is_connection_success = PingIt(ap_setting_info.REMOTE_IP);
                            break;

                        case ProtocolFormat.OHTMessage.DeviceConnectionType.Mcs:
                            var secs_agent = scApp.getBCFApplication().getSECSAgent(device.Name);
                            is_connection_success = secs_agent.IsSelected;
                            break;

                        case ProtocolFormat.OHTMessage.DeviceConnectionType.Plc:
                            var plc_agent = scApp.getBCFApplication().getMPLCSMControl(device.Name);
                            is_connection_success = plc_agent.isAlive();
                            break;
                        }
                        ProtocolFormat.OHTMessage.ConnectionStatus new_status =
                            is_connection_success ? ProtocolFormat.OHTMessage.ConnectionStatus.Success
                                                              : ProtocolFormat.OHTMessage.ConnectionStatus.Unsuccess;
                        if (device.Status != new_status)
                        {
                            device.Status = new_status;
                            SCUtility.setCallContext(ALINE.CONTEXT_KEY_WORD_LINE_STATUS_HAS_CHANGE, true);
                        }
                    }
                }
                catch (Exception ex)
                {
                    logger.Error(ex, "Exception");
                }
                finally
                {
                    System.Threading.Interlocked.Exchange(ref syncCheckLink_Point, 0);
                }
            }
        }