Esempio n. 1
0
        private (bool isSuccess, string result) AutoCarOutTest(IMaintainDevice maintainDevice, string preCarOutVhID)
        {
            var r = default((bool isSuccess, string result));

            try
            {
                //var r = bcApp.SCApplication.MTLService.carOutRequset(maintainDevice, vh_id);
                AVEHICLE pre_car_out_vh = bcApp.SCApplication.VehicleBLL.cache.getVhByID(preCarOutVhID);
                if (maintainDevice is sc.Data.VO.MaintainLift)
                {
                    sc.Data.VO.Interface.IMaintainDevice dockingMTS = bcApp.SCApplication.EquipmentBLL.cache.GetMaintainSpace();
                    r = bcApp.SCApplication.MTLService.checkVhAndMTxCarOutStatus(maintainDevice, dockingMTS, pre_car_out_vh);
                    if (r.isSuccess)
                    {
                        r = bcApp.SCApplication.MTLService.CarOurRequest(maintainDevice, pre_car_out_vh);
                    }
                    if (r.isSuccess)
                    {
                        r = bcApp.SCApplication.MTLService.processCarOutScenario(maintainDevice as sc.Data.VO.MaintainLift, pre_car_out_vh);
                    }
                }
                else if (maintainDevice is sc.Data.VO.MaintainSpace)
                {
                    r = bcApp.SCApplication.MTLService.checkVhAndMTxCarOutStatus(maintainDevice, null, pre_car_out_vh);
                    if (r.isSuccess)
                    {
                        r = bcApp.SCApplication.MTLService.CarOurRequest(maintainDevice, pre_car_out_vh);
                    }
                    if (r.isSuccess)
                    {
                        r = bcApp.SCApplication.MTLService.processCarOutScenario(maintainDevice as sc.Data.VO.MaintainSpace, pre_car_out_vh);
                    }
                }
            }
            catch (Exception ex)
            {
                r = (false, ex.ToString());
            }
            finally
            {
            }
            return(r);
        }
Esempio n. 2
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);
            };
        }
Esempio n. 3
0
        private (bool isSuccess, string result) AutoCarOutTest(IMaintainDevice maintainDevice, string preCarOutVhID)
        {
            var r = default((bool isSuccess, string result));

            try
            {
                //var r = bcApp.SCApplication.MTLService.carOutRequset(maintainDevice, vh_id);
                AVEHICLE pre_car_out_vh = bcApp.SCApplication.VehicleBLL.cache.getVhByID(preCarOutVhID);
                if (maintainDevice is sc.Data.VO.MaintainLift)
                {
                    sc.Data.VO.Interface.IMaintainDevice dockingMTS = bcApp.SCApplication.EquipmentBLL.cache.GetDockingMTLOfMaintainSpace();
                    if ((maintainDevice as sc.Data.VO.MaintainLift).EQPT_ID == "MTL" && dockingMTS != null)
                    {
                        r = bcApp.SCApplication.MTLService.checkVhAndMTxCarOutStatus(maintainDevice, dockingMTS, pre_car_out_vh);
                    }
                    else
                    {
                        r = bcApp.SCApplication.MTLService.checkVhAndMTxCarOutStatus(maintainDevice, null, pre_car_out_vh);
                        //r.isSuccess = true;
                    }
                    if (r.isSuccess)
                    {
                        r = bcApp.SCApplication.MTLService.CarOurRequest(maintainDevice, pre_car_out_vh);
                    }
                    //if (!SpinWait.SpinUntil(() => maintainDevice.CarOutSafetyCheck == true &&
                    ////maintainDevice.CarOutActionTypeSystemOutToMTL == true &&
                    //( dockingMTS==null||dockingMTS.CarOutSafetyCheck == true), 60000))
                    //{
                    //    r.isSuccess = false;
                    //    string  result = $"Process car out scenario,but mtl:{maintainDevice.DeviceID} status not ready " +
                    //    $"{nameof(maintainDevice.CarOutSafetyCheck)}:{maintainDevice.CarOutSafetyCheck}";
                    //    MessageBox.Show(result);
                    //}
                    if (r.isSuccess)
                    {
                        r = bcApp.SCApplication.MTLService.processCarOutScenario(maintainDevice as sc.Data.VO.MaintainLift, pre_car_out_vh);
                    }
                }
                else if (maintainDevice is sc.Data.VO.MaintainSpace)
                {
                    r = bcApp.SCApplication.MTLService.checkVhAndMTxCarOutStatus(maintainDevice, null, pre_car_out_vh);
                    if (r.isSuccess)
                    {
                        r = bcApp.SCApplication.MTLService.CarOurRequest(maintainDevice, pre_car_out_vh);
                    }
                    //if (!SpinWait.SpinUntil(() => maintainDevice.CarOutSafetyCheck == true, 30000))
                    //{
                    //    r.isSuccess = false;
                    //    string result = $"Process car out scenario,but mtl:{maintainDevice.DeviceID} status not ready " +
                    //    $"{nameof(maintainDevice.CarOutSafetyCheck)}:{maintainDevice.CarOutSafetyCheck}";
                    //    MessageBox.Show(result);
                    //}

                    if (r.isSuccess)
                    {
                        r = bcApp.SCApplication.MTLService.processCarOutScenario(maintainDevice as sc.Data.VO.MaintainSpace, pre_car_out_vh);
                    }
                }
            }
            catch (Exception ex)
            {
                r = (false, ex.ToString());
            }
            finally
            {
            }
            return(r);
        }