示例#1
0
        private void BCMainForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            AEQPT fourColorLight = bcApp.SCApplication.getEQObjCacheManager().getEquipmentByEQPTID("ColorLight");

            if (fourColorLight != null)
            {
                fourColorLight.setColorLight(false, false, false, false, false, true);
            }
            AEQPT trafficLight1 = bcApp.SCApplication.getEQObjCacheManager().getEquipmentByEQPTID("TrafficLight1");

            if (trafficLight1 != null)
            {
                trafficLight1.setTrafficLight(false, true, false, false, false, true);
            }
            AEQPT trafficLight2 = bcApp.SCApplication.getEQObjCacheManager().getEquipmentByEQPTID("TrafficLight2");

            if (trafficLight2 != null)
            {
                trafficLight2.setTrafficLight(false, true, false, false, false, true);
            }

            //bcApp.SCApplication.getEQObjCacheManager().getEquipmentByEQPTID("Fire");
            List <AUNIT> units = bcApp.SCApplication.getEQObjCacheManager().getAllUnit();

            foreach (AUNIT unit in units)
            {
                if (unit.UNIT_ID.StartsWith("FireDoor"))
                {
                    FireDoorDefaultValueDefMapAction mapAction = unit.getMapActionByIdentityKey(nameof(FireDoorDefaultValueDefMapAction)) as FireDoorDefaultValueDefMapAction;
                    mapAction.sendFireDoorCrossSignal(true);
                }
            }

            System.Environment.Exit(0);
        }
示例#2
0
        protected void secsDisconnected(object sender, SECSEventArgs e)
        {
            if (line.Secs_Link_Stat == SCAppConstants.LinkStatus.LinkFail)
            {
                return;
            }
            //not implement
            Dictionary <string, CommuncationInfo> dicCommunactionInfo =
                scApp.getEQObjCacheManager().CommonInfo.dicCommunactionInfo;

            if (dicCommunactionInfo.ContainsKey("MCS"))
            {
                dicCommunactionInfo["MCS"].IsConnectinoSuccess = false;
            }
            isOnlineWithMcs     = false;
            line.Secs_Link_Stat = SCAppConstants.LinkStatus.LinkFail;
            line.connInfoUpdate_Disconnection();
            AEQPT fourColorLight = scApp.getEQObjCacheManager().getEquipmentByEQPTID("FOUR_COLOR_LIGHT");

            if (fourColorLight != null)
            {
                //Task.Run(() => fourColorLight.setFourColorLightBlue(false));
            }
            SCUtility.RecodeConnectionInfo
                ("MCS",
                SCAppConstants.RecodeConnectionInfo_Type.Disconnection.ToString(),
                line.StopWatch_mcsConnectionTime.Elapsed.TotalSeconds);
        }
示例#3
0
        private void RegisterMTSMTLEvent()
        {
            Post["MTSMTLInfo/InterlockRequest"] = (p) =>
            {
                var    scApp      = SCApplication.getInstance();
                string result     = string.Empty;
                bool   isSuccess  = true;
                string station_id = Request.Query.station_id.Value ?? Request.Form.station_id.Value ?? string.Empty;
                string isSet      = Request.Query.priority.Value ?? Request.Form.isSet.Value ?? string.Empty;
                try
                {
                    AEQPT MTLMTS   = scApp.getEQObjCacheManager().getEquipmentByEQPTID(station_id);
                    bool  setValue = Convert.ToBoolean(isSet);
                    if (MTLMTS != null)
                    {
                        if (MTLMTS.EQPT_ID.StartsWith("MTL"))
                        {
                            MTLMTS = MTLMTS as MaintainLift;
                            MTxValueDefMapActionBase MTLValueDefMapActionBase = MTLMTS.getMapActionByIdentityKey(nameof(MTLValueDefMapActionNew)) as MTxValueDefMapActionBase;
                            isSuccess = MTLValueDefMapActionBase.setOHxC2MTL_CarOutInterlock(setValue);
                        }
                        else if (MTLMTS.EQPT_ID.StartsWith("MTS"))
                        {
                            MTLMTS = MTLMTS as MaintainSpace;
                            MTxValueDefMapActionBase MTSValueDefMapActionBase = MTLMTS.getMapActionByIdentityKey(nameof(MTSValueDefMapActionNew)) as MTxValueDefMapActionBase;
                            isSuccess = MTSValueDefMapActionBase.setOHxC2MTL_CarOutInterlock(setValue);
                        }
                        else
                        {
                            isSuccess = false;
                        }

                        if (isSuccess)
                        {
                            result = "OK";
                        }
                        else
                        {
                            result = "Set interlock failed.";
                        }
                    }
                    else
                    {
                        result = $"Can not find station[{station_id}].";
                    }
                }
                catch (Exception ex)
                {
                    result = "Set interlock failed with exception happened.";
                }

                var response = (Response)result;
                response.ContentType = restfulContentType;
                return(response);
            };
        }
示例#4
0
        //private void FireReportChange(object sender, ValueChangedEventArgs e)
        //{
        //    var function = scApp.getFunBaseObj<FireReport>(unit.EQPT_ID) as FireReport;
        //    try
        //    {
        //        //1.建立各個Function物件
        //        function.Read(bcfApp, unit.EqptObjectCate, unit.EQPT_ID);
        //        //2.read log
        //        function.Timestamp = DateTime.Now;
        //        LogManager.GetLogger("com.mirle.ibg3k0.sc.Common.LogHelper").Info(function.ToString());

        //        //3.logical (include db save)
        //        unit.fireReport = function.FIRE_REPORT;

        //        if (unit.fireReport)//火災發生
        //        {
        //            //Ban該防火門所在segment
        //            sendFireDoorCrossSignal(true);
        //        }
        //        else//火災終止
        //        {
        //            //解Ban該防火門所在segment
        //            sendFireDoorCrossSignal(false);
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        logger.Error(ex, "Exception");
        //    }
        //    finally
        //    {
        //        scApp.putFunBaseObj<FireReport>(function);
        //    }
        //}


        public void sendFireDoorCrossSignal(bool signal)
        {
            var function =
                scApp.getFunBaseObj <FireDoorCross>(unit.UNIT_ID) as FireDoorCross;

            try
            {
                //1.建立各個Function物件
                function.FIRE_DOOR_CROSS = !signal;//寫入ADAM時訊號要相反,才能符合客戶規範
                function.Write(bcfApp, unit.EqptObjectCate, unit.UNIT_ID);
                //2.write log
                function.Timestamp = DateTime.Now;
                LogManager.GetLogger("com.mirle.ibg3k0.sc.Common.LogHelper").Info(function.ToString());

                //3.logical (include db save)
                unit.fireDoorCrossingSignal = signal;
                if (!unit.fireDoorCrossingSignal)//因為火災報警當下可能因為Cross訊號所以無法Ban路徑,所以這邊要再做檢查。
                {
                    AEQPT firedoorinfo = scApp.getEQObjCacheManager().getEquipmentByEQPTID(unit.EQPT_ID);
                    if (firedoorinfo.fireReport)
                    {
                        banFireDoorRoute();
                        //檢查是不是所有Cross訊號都關了
                        bool result = true;
                        foreach (AUNIT unit in firedoorinfo.UnitList)
                        {
                            foreach (ASEGMENT seg in scApp.getCommObjCacheManager().getFireDoorSegment(unit.UNIT_ID))
                            {
                                if (seg.STATUS == E_SEG_STATUS.Active)
                                {
                                    result = false;
                                }
                            }
                        }
                        if (result)//所有門的路段都被Ban了
                        {
                            firedoorinfo.fireDoorCancelAbortCommand(scApp);
                        }
                        else
                        {
                            //do nothing
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception");
            }
            finally
            {
                scApp.putFunBaseObj <FireDoorCross>(function);
            }
        }
 public virtual void setContext(BaseEQObject baseEQ)
 {
     try
     {
         this.eqpt = baseEQ as AEQPT;
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Exection:");
     }
 }
 /// <summary>
 /// Updates the eqpt.
 /// </summary>
 /// <param name="conn">The connection.</param>
 /// <param name="eqpt">The eqpt.</param>
 public void updateEqpt(DBConnection_EF conn, AEQPT eqpt)
 {
     try
     {
         conn.SaveChanges();
     }
     catch (Exception ex)
     {
         logger.Warn(ex);
         throw;
     }
 }
        public void stopHostCommunication()
        {
            scApp.getBCFApplication().getSECSAgent(scApp.EAPSecsAgentName).stop();
            line.Secs_Link_Stat = SCAppConstants.LinkStatus.LinkFail;
            line.connInfoUpdate_Disconnection();
            AEQPT fourColorLight = scApp.getEQObjCacheManager().getEquipmentByEQPTID("FOUR_COLOR_LIGHT");

            if (fourColorLight != null)
            {
                //Task.Run(() => fourColorLight.setFourColorLightBlue(false));
            }
        }
示例#8
0
        private void AliveToDevice(int syncIndex, string eqID, string writeName)
        {
            if (System.Threading.Interlocked.Exchange(ref syncPoint[syncIndex], 1) == 0)
            {
                bool isWriteSucess = false;
                try
                {
                    ValueWrite isAliveIndexVW = scApp.getBCFApplication().getWriteValueEvent(SCAppConstants.EQPT_OBJECT_CATE_EQPT, eqID, writeName);
                    if (isAliveIndexVW == null)
                    {
                        return;
                    }
                    UInt16 isAliveIndex = (UInt16)isAliveIndexVW.getText();

                    int x = isAliveIndex + 1;
                    if (x > 9999)
                    {
                        x = 1;
                    }
                    isAliveIndexVW.setWriteValue((UInt16)x);
                    ISMControl.writeDeviceBlock(scApp.getBCFApplication(), isAliveIndexVW);

                    if (isWriteSucess || switchFlag)
                    {
                        isWriteSucess = false;
                        switchFlag    = false;
                        isWriteSucess = ISMControl.writeDeviceBlock(scApp.getBCFApplication(), isAliveIndexVW);
                        switchFlag    = true;
                    }
                    else
                    {
                        switchFlag    = false;
                        isWriteSucess = false;
                    }
                }
                catch (Exception e)
                {
                    switchFlag    = true;
                    isWriteSucess = false;
                }
                finally
                {
                    AEQPT eqpt = scApp.getEQObjCacheManager().getEquipmentByEQPTID(eqID);
                    if (eqpt != null)
                    {
                        eqpt.Plc_Link_Stat = isWriteSucess ? SCAppConstants.LinkStatus.LinkOK : SCAppConstants.LinkStatus.LinkFail;
                    }

                    System.Threading.Interlocked.Exchange(ref syncPoint[syncIndex], 0);
                }
            }
        }
 /// <summary>
 /// Inserts the eqpt.
 /// </summary>
 /// <param name="conn">The connection.</param>
 /// <param name="eqpt">The eqpt.</param>
 public void insertEqpt(DBConnection_EF conn, AEQPT eqpt)
 {
     try
     {
         conn.AEQPT.Add(eqpt);
         conn.SaveChanges();
     }
     catch (Exception ex)
     {
         logger.Warn(ex);
         throw;
     }
 }
示例#10
0
        private void BCMainForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            AEQPT fourColorLight = bcApp.SCApplication.getEQObjCacheManager().getEquipmentByEQPTID("FOUR_COLOR_LIGHT");

            if (fourColorLight != null)
            {
                fourColorLight.setFourColorLightBlue(false);
                fourColorLight.setFourColorLightGreen(false);
                fourColorLight.setFourColorLightOrange(false);
                fourColorLight.setFourColorLightRedWithBuzzer(false, true);
            }
            System.Environment.Exit(0);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ProcessDataValueHandler"/> class.
        /// </summary>
        /// <param name="vr">The vr.</param>
        /// <param name="eq">The eq.</param>
        /// <param name="operator_id">The operator_id.</param>
        /// <param name="lot_id">The lot_id.</param>
        /// <param name="prod_id">The prod_id.</param>
        /// <param name="ppid">The ppid.</param>
        /// <param name="glass_id">The glass_id.</param>
        public ProcessDataValueHandler(ValueRead vr, AEQPT eq,
                                       string operator_id, string lot_id, string prod_id, string ppid, string glass_id)
            : base(vr)
        {
            this.eqpt        = eq;
            procDataLog      = LogManager.GetLogger(eqpt.EQPT_ID.Trim() + "_ProcData");
            DataItemList     = new List <KeyValuePair <string, string> >();
            this.Operator_ID = operator_id;
            this.Lot_ID      = lot_id;
            this.Prod_ID     = prod_id;
            this.PPID        = ppid;
            this.Glass_ID    = glass_id;

            init();
        }
 public virtual void setContext(BaseEQObject baseEQ)
 {
     try
     {
         this.eqpt = baseEQ as AEQPT;
         //node = scApp.getEQObjCacheManager().getParentNodeByEQPTID(eqpt.EQPT_ID);
         //string[] str_arr = eqpt.EQPT_ID.Split('_');
         //string code = str_arr[1] == "A" ? "B" : "A";
         ////pair_eqpt = scApp.getEQObjCacheManager().getEquipmentByEQPTID(eqpt.EQPT_ID.Split('_')[0] + "_B") as OHCV;
         //pair_eqpt = scApp.getEQObjCacheManager().getEquipmentByEQPTID(eqpt.EQPT_ID.Split('_')[0] + "_" + code) as OHCV;
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Exection:");
     }
 }
示例#13
0
        public override void doProcess(object obj)
        {
            bool isWriteSucess = false;

            try
            {
                if (mCharger == null)
                {
                    mCharger = scApp.getEQObjCacheManager().getEquipmentByEQPTID("MCharger");
                }
                ValueWrite isAliveIndexVW = scApp.getBCFApplication().getWriteValueEvent(SCAppConstants.EQPT_OBJECT_CATE_EQPT, "MCharger", "AGVC_TO_CHARGER_ALIVE_INDEX");
                if (isAliveIndexVW == null)
                {
                    return;
                }
                UInt16 isAliveIndex = (UInt16)isAliveIndexVW.getText();

                int x = isAliveIndex + 1;
                if (x > 9999)
                {
                    x = 1;
                }
                isAliveIndexVW.setWriteValue((UInt16)x);

                if (isWriteSucess || switchFlag)
                {
                    isWriteSucess = false;
                    switchFlag    = false;

                    //isWriteSucess = smControl.writeDeviceBlock(isAliveIndexVW);
                    isWriteSucess           = ISMControl.writeDeviceBlock(scApp.getBCFApplication(), isAliveIndexVW);
                    switchFlag              = true;
                    mCharger.AGVCAliveIndex = x;
                }
                else
                {
                    switchFlag    = false;
                    isWriteSucess = false;
                }
            }
            catch (Exception e)
            {
                switchFlag    = true;
                isWriteSucess = false;
            }
        }
        /// <summary>
        /// Gets the eqpt by eqpt identifier.
        /// </summary>
        /// <param name="conn">The connection.</param>
        /// <param name="readLock">The read lock.</param>
        /// <param name="eqpt_id">The eqpt_id.</param>
        /// <returns>Equipment.</returns>
        public AEQPT getEqptByEqptID(DBConnection_EF conn, Boolean readLock, string eqpt_id)
        {
            AEQPT rtnEqpt = null;

            try
            {
                var query = from rptid in conn.AEQPT
                            where rptid.EQPT_ID == eqpt_id.Trim()
                            select rptid;
                rtnEqpt = query.SingleOrDefault();
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                throw;
            }
            return(rtnEqpt);
        }
示例#15
0
 public void PublishMTLMTSInfo(object sender, PropertyChangedEventArgs e)
 {
     try
     {
         AEQPT eqpt = sender as AEQPT;
         if (sender == null)
         {
             return;
         }
         byte[] line_serialize = BLL.LineBLL.Convert2GPB_MTLMTSInfo(eqpt);
         scApp.getNatsManager().PublishAsync
             (SCAppConstants.NATS_SUBJECT_MTLMTS, line_serialize);
         //TODO 要改用GPP傳送
         //var line_Serialize = ZeroFormatter.ZeroFormatterSerializer.Serialize(line);
         //scApp.getNatsManager().PublishAsync
         //    (string.Format(SCAppConstants.NATS_SUBJECT_LINE_INFO), line_Serialize);
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Exception:");
     }
 }
        public void putMTL_MTSCheckInfo(sc.ProtocolFormat.OHTMessage.MTL_MTS_INFO newMTLMTSInfo)
        {
            if (newMTLMTSInfo == null)
            {
                return;
            }
            AEQPT eqpt = Eqpts.Where(e => e.EQPT_ID == newMTLMTSInfo.StationID.Trim()).SingleOrDefault();

            if (eqpt is MaintainSpace)
            {
                MaintainSpace MTS = eqpt as MaintainSpace;
                MTS.Plc_Link_Stat            = newMTLMTSInfo.NetworkLink ? sc.App.SCAppConstants.LinkStatus.LinkOK : sc.App.SCAppConstants.LinkStatus.LinkFail;
                MTS.Is_Eq_Alive              = newMTLMTSInfo.Alive;
                MTS.MTxMode                  = newMTLMTSInfo.Mode ? sc.ProtocolFormat.OHTMessage.MTxMode.Auto : sc.ProtocolFormat.OHTMessage.MTxMode.Manual;
                MTS.Interlock                = newMTLMTSInfo.Interlock;
                MTS.CurrentCarID             = newMTLMTSInfo.CarID;
                MTS.CurrentPreCarOurDistance = Convert.ToUInt32(newMTLMTSInfo.Distance);
                MTS.SynchronizeTime          = Convert.ToDateTime(newMTLMTSInfo.SynchronizeTime);
                MTS.CarOutInterlock          = newMTLMTSInfo.CarOutInterlock;
                MTS.CarInMoving              = newMTLMTSInfo.CarInMoving;
            }
            else if (eqpt is MaintainLift)
            {
                MaintainLift MTL = eqpt as MaintainLift;
                MTL.Plc_Link_Stat            = newMTLMTSInfo.NetworkLink ? sc.App.SCAppConstants.LinkStatus.LinkOK : sc.App.SCAppConstants.LinkStatus.LinkFail;
                MTL.Is_Eq_Alive              = newMTLMTSInfo.Alive;
                MTL.MTxMode                  = newMTLMTSInfo.Mode ? sc.ProtocolFormat.OHTMessage.MTxMode.Auto : sc.ProtocolFormat.OHTMessage.MTxMode.Manual;
                MTL.Interlock                = newMTLMTSInfo.Interlock;
                MTL.CurrentCarID             = newMTLMTSInfo.CarID;
                MTL.MTLLocation              = newMTLMTSInfo.MTLLocation == MTLLocation.Bottorn.ToString() ? MTLLocation.Bottorn : newMTLMTSInfo.MTLLocation == MTLLocation.Upper.ToString() ? MTLLocation.Upper : MTLLocation.None;
                MTL.CurrentPreCarOurDistance = Convert.ToUInt32(newMTLMTSInfo.Distance);
                MTL.SynchronizeTime          = Convert.ToDateTime(newMTLMTSInfo.SynchronizeTime);
                MTL.CarOutInterlock          = newMTLMTSInfo.CarOutInterlock;
                MTL.CarInMoving              = newMTLMTSInfo.CarInMoving;
            }

            MTLMTSInfoUpdate?.Invoke(this, EventArgs.Empty);
        }
示例#17
0
        protected void secsConnected(object sender, SECSEventArgs e)
        {
            if (line.Secs_Link_Stat == SCAppConstants.LinkStatus.LinkOK)
            {
                return;
            }
            Dictionary <string, CommuncationInfo> dicCommunactionInfo =
                scApp.getEQObjCacheManager().CommonInfo.dicCommunactionInfo;

            if (dicCommunactionInfo.ContainsKey("MCS"))
            {
                dicCommunactionInfo["MCS"].IsConnectinoSuccess = true;
            }
            line.Secs_Link_Stat = SCAppConstants.LinkStatus.LinkOK;
            AEQPT fourColorLight = scApp.getEQObjCacheManager().getEquipmentByEQPTID("FOUR_COLOR_LIGHT");

            if (fourColorLight != null)
            {
                //Task.Run(() => fourColorLight.setFourColorLightBlue(true));
            }
            isOnlineWithMcs = true;
            line.connInfoUpdate_Connection();
            SCUtility.RecodeConnectionInfo
                ("MCS",
                SCAppConstants.RecodeConnectionInfo_Type.Connection.ToString(),
                line.StopWatch_mcsDisconnectionTime.Elapsed.TotalSeconds);

            ITimerAction timer = scApp.getBCFApplication().getTimerAction("SECSHeartBeat");

            if (timer != null && !timer.IsStarted)
            {
                timer.start();
            }

            initialWithMCS();
        }
示例#18
0
        private void RegisterMTSMTLEvent()
        {
            Post["MTSMTLInfo/InterlockRequest"] = (p) =>
            {
                var    scApp      = SCApplication.getInstance();
                string result     = DEFAULT_RESULT;
                bool   isSuccess  = true;
                string station_id = Request.Query.station_id.Value ?? Request.Form.station_id.Value ?? string.Empty;
                string isSet      = Request.Query.priority.Value ?? Request.Form.isSet.Value ?? string.Empty;
                try
                {
                    AEQPT MTLMTS   = scApp.getEQObjCacheManager().getEquipmentByEQPTID(station_id);
                    bool  setValue = Convert.ToBoolean(isSet);
                    if (MTLMTS != null)
                    {
                        if (MTLMTS.EQPT_ID.StartsWith("MTL"))
                        {
                            MTLMTS = MTLMTS as MaintainLift;
                            MTxValueDefMapActionBase MTLValueDefMapActionBase = MTLMTS.getMapActionByIdentityKey(nameof(MTLValueDefMapActionNew)) as MTxValueDefMapActionBase;
                            isSuccess = MTLValueDefMapActionBase.setOHxC2MTL_CarOutInterlock(setValue);
                        }
                        else if (MTLMTS.EQPT_ID.StartsWith("MTS"))
                        {
                            MTLMTS = MTLMTS as MaintainSpace;
                            MTxValueDefMapActionBase MTSValueDefMapActionBase = MTLMTS.getMapActionByIdentityKey(nameof(MTSValueDefMapActionNew)) as MTxValueDefMapActionBase;
                            isSuccess = MTSValueDefMapActionBase.setOHxC2MTL_CarOutInterlock(setValue);
                        }
                        else
                        {
                            isSuccess = false;
                        }

                        if (isSuccess)
                        {
                            result = "OK";
                        }
                        else
                        {
                            result = "Set interlock failed.";
                        }
                    }
                    else
                    {
                        result = $"Can not find station[{station_id}].";
                    }
                }
                catch (Exception ex)
                {
                    result = "Set interlock failed with exception happened.";
                }

                var response = (Response)result;
                response.ContentType = restfulContentType;
                return(response);
            };
            Post["MTSMTLInfo/CarInInterlockRequest"] = (p) =>
            {
                var    scApp      = SCApplication.getInstance();
                string result     = DEFAULT_RESULT;
                bool   isSuccess  = true;
                string station_id = Request.Query.station_id.Value ?? Request.Form.station_id.Value ?? string.Empty;
                string isSet      = Request.Query.priority.Value ?? Request.Form.isSet.Value ?? string.Empty;
                try
                {
                    AEQPT MTLMTS   = scApp.getEQObjCacheManager().getEquipmentByEQPTID(station_id);
                    bool  setValue = Convert.ToBoolean(isSet);
                    if (MTLMTS != null)
                    {
                        if (MTLMTS.EQPT_ID.StartsWith("MTL"))
                        {
                            MTLMTS = MTLMTS as MaintainLift;
                            MTxValueDefMapActionBase MTLValueDefMapActionBase = MTLMTS.getMapActionByIdentityKey(nameof(MTLValueDefMapActionNew)) as MTxValueDefMapActionBase;
                            isSuccess = MTLValueDefMapActionBase.setOHxC2MTL_CarInMoving(setValue);
                        }
                        else if (MTLMTS.EQPT_ID.StartsWith("MTS"))
                        {
                            MTLMTS = MTLMTS as MaintainSpace;
                            MTxValueDefMapActionBase MTSValueDefMapActionBase = MTLMTS.getMapActionByIdentityKey(nameof(MTSValueDefMapActionNew)) as MTxValueDefMapActionBase;
                            isSuccess = MTSValueDefMapActionBase.setOHxC2MTL_CarInMoving(setValue);
                        }
                        else
                        {
                            isSuccess = false;
                        }

                        if (isSuccess)
                        {
                            result = "OK";
                        }
                        else
                        {
                            result = "Set interlock failed.";
                        }
                    }
                    else
                    {
                        result = $"Can not find station[{station_id}].";
                    }
                }
                catch (Exception ex)
                {
                    result = "Set interlock failed with exception happened.";
                }

                var response = (Response)result;
                response.ContentType = restfulContentType;
                return(response);
            };

            Post["MTSMTLInfo/CarOutRequest"] = (p) =>
            {
                var    scApp      = SCApplication.getInstance();
                var    r          = default((bool isSuccess, string result));
                string result     = DEFAULT_RESULT;
                bool   isSuccess  = true;
                string vh_id      = Request.Query.vh_id.Value ?? Request.Form.vh_id.Value ?? string.Empty;
                string station_id = Request.Query.station_id.Value ?? Request.Form.station_id.Value ?? string.Empty;
                string isSet      = Request.Query.priority.Value ?? Request.Form.isSet.Value ?? string.Empty;
                try
                {
                    AVEHICLE pre_car_out_vh = scApp.VehicleBLL.cache.getVhByID(vh_id);
                    Data.VO.Interface.IMaintainDevice maintainDevice = scApp.EquipmentBLL.cache.getMaintainDevice(station_id);
                    if (maintainDevice is sc.Data.VO.MaintainLift)
                    {
                        sc.Data.VO.Interface.IMaintainDevice dockingMTS = scApp.EquipmentBLL.cache.GetDockingMTLOfMaintainSpace();
                        r = scApp.MTLService.checkVhAndMTxCarOutStatus(maintainDevice, dockingMTS, pre_car_out_vh);
                        if (r.isSuccess)
                        {
                            r = scApp.MTLService.CarOurRequest(maintainDevice, pre_car_out_vh);
                        }
                        if (r.isSuccess)
                        {
                            r = scApp.MTLService.processCarOutScenario(maintainDevice as sc.Data.VO.MaintainLift, pre_car_out_vh);
                        }
                    }
                    else if (maintainDevice is sc.Data.VO.MaintainSpace)
                    {
                        r = scApp.MTLService.checkVhAndMTxCarOutStatus(maintainDevice, null, pre_car_out_vh);
                        if (r.isSuccess)
                        {
                            r = scApp.MTLService.CarOurRequest(maintainDevice, pre_car_out_vh);
                        }
                        if (r.isSuccess)
                        {
                            r = scApp.MTLService.processCarOutScenario(maintainDevice as sc.Data.VO.MaintainSpace, pre_car_out_vh);
                        }
                    }
                    if (!r.isSuccess)
                    {
                        result = r.result;
                    }
                    isSuccess = r.isSuccess;
                }
                catch (Exception ex)
                {
                    result    = "excute car out request failed with exception happened.";
                    isSuccess = false;
                }

                var response = (Response)result;
                response.ContentType = restfulContentType;
                return(response);
            };
            Post["MTSMTLInfo/CarOutCancel"] = (p) =>
            {
                var    scApp      = SCApplication.getInstance();
                string result     = DEFAULT_RESULT;
                bool   isSuccess  = true;
                string station_id = Request.Query.station_id.Value ?? Request.Form.station_id.Value ?? string.Empty;
                string isSet      = Request.Query.priority.Value ?? Request.Form.isSet.Value ?? string.Empty;
                try
                {
                    Data.VO.Interface.IMaintainDevice maintainDevice = scApp.EquipmentBLL.cache.getMaintainDevice(station_id);
                    scApp.MTLService.carOutRequestCancle(maintainDevice);

                    isSuccess = true;
                }
                catch (Exception ex)
                {
                    result    = "excute car out cancel failed with exception happened.";
                    isSuccess = false;
                }

                var response = (Response)result;
                response.ContentType = restfulContentType;
                return(response);
            };
        }
示例#19
0
 public virtual void setContext(BaseEQObject baseEQ)
 {
     this.eqpt = baseEQ as AEQPT;
 }
 public MTLMTSDatailViewObj(AEQPT myDatabaseObject)
 {
     this.eqpt = myDatabaseObject;
 }
示例#21
0
        private void PortStationDataChange(object sender, ValueChangedEventArgs e)
        {
            var function =
                scApp.getFunBaseObj <PortStationReport>(PortStation.PORT_ID) as PortStationReport;

            try
            {
                //1.建立各個Function物件
                function.Read(bcfApp, SCAppConstants.EQPT_OBJECT_CATE_PORT, PortStation.PORT_ID);
                function.portServiceState = PortStation.PORT_SERVICE_STATUS;
                //2.read log
                function.Timestamp = DateTime.Now;
                LogManager.GetLogger("com.mirle.ibg3k0.sc.Common.LogHelper").Info(function.ToString());
                //LogHelper.Log(logger: logger, LogLevel: LogLevel.Info, Class: nameof(PortStationReport), Device: DEVICE_NAME,
                //    XID: PortStation.PORT_ID, Data: function.ToString());

                //3.logical (include db save)
                ProtocolFormat.OHTMessage.PortStationStatus status = default(ProtocolFormat.OHTMessage.PortStationStatus);
                if (function.portStationReady)
                {
                    switch (function.portStationLoadRequest)
                    {
                    case true:
                        //PortStation.PORT_STATUS = ProtocolFormat.OHTMessage.PortStationStatus.LoadRequest;//LoadRequest
                        status = ProtocolFormat.OHTMessage.PortStationStatus.LoadRequest;    //LoadRequest
                        break;

                    case false:
                        //PortStation.PORT_STATUS = ProtocolFormat.OHTMessage.PortStationStatus.UnloadRequest;//UnloadRequest
                        status = ProtocolFormat.OHTMessage.PortStationStatus.UnloadRequest;    //UnloadRequest
                        break;
                    }
                }
                else
                {
                    switch (function.portStationLoadRequest)
                    {
                    case true:
                        PortStation.PORT_STATUS = ProtocolFormat.OHTMessage.PortStationStatus.Down; //Down
                        status = ProtocolFormat.OHTMessage.PortStationStatus.Down;                  //Down
                        break;

                    case false:
                        PortStation.PORT_STATUS = ProtocolFormat.OHTMessage.PortStationStatus.Wait; //Wait
                        status = ProtocolFormat.OHTMessage.PortStationStatus.Wait;                  //Wait
                        break;
                    }
                }
                scApp.PortStationService.doUpdatePortStatus(PortStation.PORT_ID, status);

                AEQPT eqpt = scApp.getEQObjCacheManager().getEquipmentByEQPTID(PortStation.EQPT_ID);
                if (PortStation.PORT_SERVICE_STATUS != ProtocolFormat.OHTMessage.PortStationServiceStatus.OutOfService && !eqpt.EQ_Down)//如果Port沒有disable且所屬EQ並非Down,才需要上報MCS PortEventState
                {
                    mcsMapAction.sendS6F11_PortEventState(PortStation.PORT_ID, ((int)PortStation.PORT_STATUS).ToString());
                }
                else
                {
                    //do nothing
                }
                //如果port Down

                //scApp.getEQObjCacheManager().getPortStation

                //foreach(AUNIT portstation in eqpt.UnitList )
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception");
            }
            finally
            {
                scApp.putFunBaseObj <PortStationReport>(function);
            }
        }