public void carOutComplete(IMaintainDevice mtx) { mtx.CarOurSuccess = true; //carOutVhID = ""; mtx.SetCarOutInterlock(false); mtx.PreCarOutVhID = ""; }
public void carInComplete(IMaintainDevice mtx, string vhID) { VehicleService.doRecoverModeStatusToAutoRemote(vhID); mtx.SetCarInMoving(false); //List<AMCSREPORTQUEUE> reportqueues = new List<AMCSREPORTQUEUE>(); //reportBLL.newReportVehicleInstalled(vhID, reportqueues); }
private void RegularUpdateRealTimeCarInfo(IMaintainDevice mtx, AVEHICLE carOurVh) { do { UInt16 car_id = (ushort)carOurVh.Num; UInt16 action_mode = 0; if (carOurVh.ACT_STATUS == ProtocolFormat.OHTMessage.VHActionStatus.Commanding) { if (!SCUtility.isEmpty(carOurVh.MCS_CMD)) { action_mode = CAR_ACTION_MODE_ACTION_FOR_MCS_COMMAND; } else { action_mode = CAR_ACTION_MODE_ACTION; } } else { action_mode = CAR_ACTION_MODE_NO_ACTION; } UInt16 cst_exist = (ushort)carOurVh.HAS_CST; UInt16 current_section_id = 0; UInt16.TryParse(carOurVh.CUR_SEC_ID, out current_section_id); UInt16 current_address_id = 0; UInt16.TryParse(carOurVh.CUR_ADR_ID, out current_address_id); UInt32 buffer_distance = 0; UInt16 speed = (ushort)carOurVh.Speed; mtx.CurrentPreCarOurID = car_id; mtx.CurrentPreCarOurActionMode = action_mode; mtx.CurrentPreCarOurCSTExist = cst_exist; mtx.CurrentPreCarOurSectionID = current_section_id; mtx.CurrentPreCarOurAddressID = current_address_id; mtx.CurrentPreCarOurDistance = buffer_distance; mtx.CurrentPreCarOurSpeed = speed; mtx.setCarRealTimeInfo(car_id, action_mode, cst_exist, current_section_id, current_address_id, buffer_distance, speed); //如果在移動過程中,MTx突然變成手動模式的話,則要將原本在移動的車子取消命令 if (mtx.MTxMode == MTxMode.Manual || !mtx.CarOutSafetyCheck) { carOutRequestCancle(mtx); LogHelper.Log(logger: logger, LogLevel: LogLevel.Warn, Class: nameof(MTLService), Device: "OHTC", Data: $"Device:{mtx.DeviceID} mtx mode suddenly turned mode:{mtx.MTxMode} or car out safety check change:{mtx.CarOutSafetyCheck}, " + $"so urgent cancel vh:{mtx.PreCarOutVhID} of command.", XID: mtx.DeviceID); break; } SpinWait.SpinUntil(() => false, 200); } while (!mtx.CancelCarOutRequest && !mtx.CarOurSuccess); //mtx.setCarRealTimeInfo(0, 0, 0, 0, 0, 0, 0); }
public (bool isSuccess, string result) checkVhAndMTxCarInStatus(IMaintainDevice mtx, IMaintainDevice dockingMtx, AVEHICLE car_in_vh) { bool isSuccess = true; string result = ""; string vh_id = car_in_vh.VEHICLE_ID; //1.要判斷目前車子的狀態 if (isSuccess && !car_in_vh.isTcpIpConnect) { isSuccess = false; result = $"vh id:{vh_id}, not connection."; } //if (isSuccess && car_in_vh.MODE_STATUS == ProtocolFormat.OHTMessage.VHModeStatus.Manual) //{ // isSuccess = false; // result = $"Vehicle:{vh_id}, current mode is:{car_in_vh.MODE_STATUS}, can't excute auto car out"; //} if (isSuccess && SCUtility.isEmpty(car_in_vh.CUR_SEC_ID)) { isSuccess = false; result = $"vh id:{vh_id}, current section is empty."; } if (isSuccess && !SCUtility.isMatche(car_in_vh.CUR_ADR_ID, mtx.DeviceAddress)) { isSuccess = false; result = $"vh id:{vh_id}, current address:{car_in_vh.CUR_ADR_ID} not match mtx device address:{mtx.DeviceAddress}."; } //2.要判斷MTL的 Safety check是否有On且是否為Auto Mode if (isSuccess && mtx.MTxMode == ProtocolFormat.OHTMessage.MTxMode.Manual) { isSuccess = false; result = $"MTx:{mtx.DeviceID} Current Mode:{mtx.MTxMode}, can't excute cat out requset."; } //3.若有Docking的Device,則需要再判斷一次他的狀態 if (dockingMtx != null) { if (isSuccess && dockingMtx.MTxMode == ProtocolFormat.OHTMessage.MTxMode.Manual) { isSuccess = false; result = $"Docking MTx:{dockingMtx.DeviceID} Current Mode:{dockingMtx.MTxMode}, can't excute cat out requset."; } if (isSuccess && !dockingMtx.CarOutSafetyCheck) { isSuccess = false; result = $"Docking MTx:{dockingMtx.DeviceID} CarInSafetyCheck:{dockingMtx.CarOutSafetyCheck}, can't excute cat in requset."; } } return(isSuccess, result); }
public void carOutComplete(IMaintainDevice mtx) { mtx.CarOurSuccess = true; //carOutVhID = ""; mtx.PreCarOutVhID = ""; //mtx.SetCarOutInterlock(false); if (mtx is MaintainLift) { CarOutFinish(mtx as MaintainLift); } else if (mtx is MaintainSpace) { CarOutFinish(mtx as MaintainSpace); } }
public (bool isSuccess, string result) CarOurRequest(IMaintainDevice mtx, AVEHICLE car_out_vh) { bool is_success = false; string result = ""; var send_result = mtx.carOutRequest((UInt16)car_out_vh.Num); is_success = send_result.isSendSuccess && send_result.returnCode == 1; if (!is_success) { result = $"MTL:{mtx.DeviceID} reject car our request. return code:{send_result.returnCode}"; } else { result = "OK"; } return(is_success, result); }
public void start(SCApplication app) { scApp = app; List <AEQPT> eqpts = app.getEQObjCacheManager().getAllEquipment(); foreach (var eqpt in eqpts) { if (eqpt is IMaintainDevice) { IMaintainDevice maintainDevice = eqpt as IMaintainDevice; if (maintainDevice is MaintainSpace) { MaintainSpace maintainSpace = eqpt as MaintainSpace; maintainSpace.addEventHandler(nameof(MTLService), nameof(maintainSpace.Plc_Link_Stat), PublishMTSInfo); maintainSpace.addEventHandler(nameof(MTLService), nameof(maintainSpace.Is_Eq_Alive), PublishMTSInfo); maintainSpace.addEventHandler(nameof(MTLService), nameof(maintainSpace.MTxMode), PublishMTSInfo); maintainSpace.addEventHandler(nameof(MTLService), nameof(maintainSpace.Interlock), PublishMTSInfo); maintainSpace.addEventHandler(nameof(MTLService), nameof(maintainSpace.CurrentCarID), PublishMTSInfo); maintainSpace.addEventHandler(nameof(MTLService), nameof(maintainSpace.CurrentPreCarOurDistance), PublishMTSInfo); maintainSpace.addEventHandler(nameof(MTLService), nameof(maintainSpace.SynchronizeTime), PublishMTSInfo); maintainSpace.addEventHandler(nameof(MTLService), nameof(maintainSpace.CarOutInterlock), PublishMTSInfo); maintainSpace.addEventHandler(nameof(MTLService), nameof(maintainSpace.CarInMoving), PublishMTSInfo); } else if (maintainDevice is MaintainLift) { MaintainLift maintainLift = eqpt as MaintainLift; maintainLift.addEventHandler(nameof(MTLService), nameof(maintainLift.Plc_Link_Stat), PublishMTLInfo); maintainLift.addEventHandler(nameof(MTLService), nameof(maintainLift.Is_Eq_Alive), PublishMTLInfo); maintainLift.addEventHandler(nameof(MTLService), nameof(maintainLift.MTxMode), PublishMTLInfo); maintainLift.addEventHandler(nameof(MTLService), nameof(maintainLift.Interlock), PublishMTLInfo); maintainLift.addEventHandler(nameof(MTLService), nameof(maintainLift.CurrentCarID), PublishMTLInfo); maintainLift.addEventHandler(nameof(MTLService), nameof(maintainLift.MTLLocation), PublishMTLInfo); maintainLift.addEventHandler(nameof(MTLService), nameof(maintainLift.CurrentPreCarOurDistance), PublishMTLInfo); maintainLift.addEventHandler(nameof(MTLService), nameof(maintainLift.SynchronizeTime), PublishMTLInfo); maintainLift.addEventHandler(nameof(MTLService), nameof(maintainLift.CarOutInterlock), PublishMTLInfo); maintainLift.addEventHandler(nameof(MTLService), nameof(maintainLift.CarInMoving), PublishMTLInfo); } } } VehicleService = app.VehicleService; vehicleBLL = app.VehicleBLL; reportBLL = app.ReportBLL; // mtl = app.getEQObjCacheManager().getEquipmentByEQPTID("MTL") as MaintainLift; }
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); }
/// <summary> /// 處理人員由OHTC執行CAR OUT時的流程 /// </summary> /// <param name="vhID"></param> /// <returns></returns> public (bool isSuccess, string result) carOutRequset(IMaintainDevice mtx, string vhID) { AVEHICLE pre_car_out_vh = vehicleBLL.cache.getVhByID(vhID); bool isSuccess = true; string result = ""; var check_result = checkVhAndMTxCarOutStatus(mtx, null, pre_car_out_vh); isSuccess = check_result.isSuccess; result = check_result.result; //2.向MTL發出Car out request //成功後開始向MTL發送該台Vh的當前狀態,並在裡面判斷是否有收到Cancel的命令,有的話要將資料清空 //Trun on 給MTL的Interlock flag //將該台Vh變更為AutoToMtl if (isSuccess) { var send_result = mtx.carOutRequest((UInt16)pre_car_out_vh.Num); if (send_result.isSendSuccess && send_result.returnCode == 1) { (bool isSuccess, string result)process_result = default((bool isSuccess, string result)); if (mtx is MaintainLift) { process_result = processCarOutScenario(mtx as MaintainLift, pre_car_out_vh); } else if (mtx is MaintainSpace) { process_result = processCarOutScenario(mtx as MaintainSpace, pre_car_out_vh); } else { return(process_result); } isSuccess = process_result.isSuccess; result = process_result.result; } else { isSuccess = false; result = $"Request car fail,Send result:{send_result.isSendSuccess}, return code:{send_result.returnCode}"; } } return(isSuccess, result); }
public void carInComplete(IMaintainDevice mtx, string vhID) { LogHelper.Log(logger: logger, LogLevel: LogLevel.Info, Class: nameof(MTLService), Device: SCAppConstants.DeviceName.DEVICE_NAME_MTx, Data: $"Process carInComplete!", XID: mtx.DeviceID, VehicleID: vhID); VehicleService.doRecoverModeStatusToAutoRemote(vhID); //mtx.SetCarInMoving(false); if (mtx is MaintainLift) { CarInFinish(mtx as MaintainLift); } else if (mtx is MaintainSpace) { CarInFinish(mtx as MaintainSpace); } //如果是MTS機台,因為在準備通過MTL時,會將CAR OUT訊號 TURN ON,因此在結束的時候要將它復歸 //List<AMCSREPORTQUEUE> reportqueues = new List<AMCSREPORTQUEUE>(); //reportBLL.newReportVehicleInstalled(vhID, reportqueues); }
public void carOutRequestCancle(IMaintainDevice mtx) { //將原本的在等待Carout的Vh改回AutoRemote mtx.CancelCarOutRequest = true; //if (!SCUtility.isEmpty(carOutVhID)) //{ // VehicleService.doRecoverModeStatusToAutoRemote(carOutVhID); //} //carOutVhID = ""; if (!SCUtility.isEmpty(mtx.PreCarOutVhID)) { VehicleService.doRecoverModeStatusToAutoRemote(mtx.PreCarOutVhID); AVEHICLE pre_car_out_vh = vehicleBLL.cache.getVhByID(mtx.PreCarOutVhID); if (!SCUtility.isEmpty(pre_car_out_vh?.OHTC_CMD)) { VehicleService.doAbortCommand (pre_car_out_vh, pre_car_out_vh.OHTC_CMD, ProtocolFormat.OHTMessage.CMDCancelType.CmdCancel); } } mtx.SetCarOutInterlock(false); mtx.PreCarOutVhID = ""; }
//bool cancelCarOutRequest = false; //bool carOurSuccess = false; /// <summary> /// 處理人員由MTL執行CAR OUT時的流程 /// </summary> /// <param name="vhNum"></param> /// <returns></returns> public (bool isSuccess, string result) carOutRequset(IMaintainDevice mtx, int vhNum) { AVEHICLE pre_car_out_vh = vehicleBLL.cache.getVhByNum(vhNum); if (pre_car_out_vh == null) { return(false, $"vh num:{vhNum}, not exist."); } else { bool isSuccess = true; string result = ""; var check_result = checkVhAndMTxCarOutStatus(mtx, null, pre_car_out_vh); isSuccess = check_result.isSuccess; result = check_result.result; if (isSuccess) { (bool isSuccess, string result)process_result = default((bool isSuccess, string result)); if (mtx is MaintainLift) { process_result = processCarOutScenario(mtx as MaintainLift, pre_car_out_vh); } else if (mtx is MaintainSpace) { process_result = processCarOutScenario(mtx as MaintainSpace, pre_car_out_vh); } else { return(process_result); } isSuccess = process_result.isSuccess; result = process_result.result; } return(isSuccess, result); } }
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); }
public (bool isSuccess, string result) checkVhAndMTxCarInStatus(IMaintainDevice mtx, IMaintainDevice dockingMtx, AVEHICLE car_in_vh) { bool isSuccess = true; string result = ""; string vh_id = car_in_vh.VEHICLE_ID; //1.要判斷目前車子的狀態 //要判斷目前MTS是否有在處理CAR IN流程 if (isSuccess && mtx.CarInMoving) { isSuccess = false; result = $"MTx:{mtx.DeviceID} Current CarInMoving:{mtx.CarInMoving}, can't excute cat in requset."; } if (isSuccess && !car_in_vh.isTcpIpConnect) { isSuccess = false; result = $"vh id:{vh_id}, not connection."; } //if (isSuccess && car_in_vh.MODE_STATUS == ProtocolFormat.OHTMessage.VHModeStatus.Manual) //{ // isSuccess = false; // result = $"Vehicle:{vh_id}, current mode is:{car_in_vh.MODE_STATUS}, can't excute auto car out"; //} if (isSuccess && SCUtility.isEmpty(car_in_vh.CUR_SEC_ID)) { isSuccess = false; result = $"vh id:{vh_id}, current section is empty."; } if (isSuccess && !SCUtility.isMatche(car_in_vh.CUR_ADR_ID, mtx.DeviceAddress)) { isSuccess = false; result = $"vh id:{vh_id}, current address:{car_in_vh.CUR_ADR_ID} not match mtx device address:{mtx.DeviceAddress}."; } //2.要判斷MTL的 Safety check是否有On且是否為Auto Mode //if (isSuccess && mtx.MTxMode == ProtocolFormat.OHTMessage.MTxMode.Manual) if (isSuccess && mtx.MTxMode != ProtocolFormat.OHTMessage.MTxMode.Auto) { isSuccess = false; result = $"MTx:{mtx.DeviceID} Current Mode:{mtx.MTxMode}, can't excute cat in requset."; } //3.要判斷MTS的 Car In Safety Check是否是準備好的 //if (mtx is MaintainSpace) //{ // if (isSuccess && !mtx.CarInSafetyCheck) // { // isSuccess = false; // result = $"MTx:{mtx.DeviceID} {nameof(mtx.CarInSafetyCheck)}:{mtx.CarInSafetyCheck}, can't excute cat in requset."; // } //} //4.若有Docking的Device,則需要再判斷一次他的狀態 if (dockingMtx != null) { if (isSuccess && dockingMtx.MTxMode == ProtocolFormat.OHTMessage.MTxMode.Manual) { isSuccess = false; result = $"Docking MTx:{dockingMtx.DeviceID} Current Mode:{dockingMtx.MTxMode}, can't excute cat in requset."; } //if (isSuccess && !dockingMtx.CarOutSafetyCheck) //{ // isSuccess = false; // result = $"Docking MTx:{dockingMtx.DeviceID} CarInSafetyCheck:{dockingMtx.CarOutSafetyCheck}, can't excute cat in requset."; //} //要執行Car in的時候,如果是MTS而且有Docking MTL,則要確認MTL上面是否有車子 if (mtx is MaintainSpace && dockingMtx is MaintainLift) { if (dockingMtx.HasVehicle) { isSuccess = false; result = $"Docking MTx:{dockingMtx.DeviceID} {nameof(dockingMtx.HasVehicle)}:{dockingMtx.HasVehicle}, can't excute cat in requset."; } } } return(isSuccess, result); }
public void carOutRequestCancle(IMaintainDevice mtx, bool isForceFinish) { LogHelper.Log(logger: logger, LogLevel: LogLevel.Warn, Class: nameof(MTLService), Device: SCAppConstants.DeviceName.DEVICE_NAME_MTx, Data: $"Process car out cancel request. mtx:{mtx.DeviceID}, pre car out vh:{mtx.PreCarOutVhID}, is force finish:{isForceFinish}", XID: mtx.DeviceID); //將原本的在等待Carout的Vh改回AutoRemote mtx.CancelCarOutRequest = true; //if (!SCUtility.isEmpty(carOutVhID)) //{ // VehicleService.doRecoverModeStatusToAutoRemote(carOutVhID); //} //carOutVhID = ""; if (!SCUtility.isEmpty(mtx.PreCarOutVhID)) { VehicleService.doRecoverModeStatusToAutoRemote(mtx.PreCarOutVhID); AVEHICLE pre_car_out_vh = vehicleBLL.cache.getVhByID(mtx.PreCarOutVhID); if (!SCUtility.isEmpty(pre_car_out_vh?.OHTC_CMD)) { ACMD_OHTC cmd = scApp.CMDBLL.getCMD_OHTCByID(pre_car_out_vh.OHTC_CMD); if (cmd != null) { if (cmd.CMD_TPYE == E_CMD_TYPE.MoveToMTL || cmd.CMD_TPYE == E_CMD_TYPE.SystemOut || cmd.CMD_TPYE == E_CMD_TYPE.SystemIn || cmd.CMD_TPYE == E_CMD_TYPE.MTLHome) { //如果是強制被取消(Safety check突然關閉)的時候,要先下一次暫停給車子 if (isForceFinish) { VehicleService.PauseRequest (pre_car_out_vh.VEHICLE_ID, PauseEvent.Pause, SCAppConstants.OHxCPauseType.Normal); } VehicleService.doAbortCommand (pre_car_out_vh, pre_car_out_vh.OHTC_CMD, ProtocolFormat.OHTMessage.CMDCancelType.CmdCancel); } } else { if (cmd.CMD_TPYE == E_CMD_TYPE.MoveToMTL || cmd.CMD_TPYE == E_CMD_TYPE.SystemOut || cmd.CMD_TPYE == E_CMD_TYPE.SystemIn || cmd.CMD_TPYE == E_CMD_TYPE.MTLHome) { //如果是強制被取消(Safety check突然關閉)的時候,要先下一次暫停給車子 if (isForceFinish) { VehicleService.PauseRequest (pre_car_out_vh.VEHICLE_ID, PauseEvent.Pause, SCAppConstants.OHxCPauseType.Normal); } VehicleService.doAbortCommand (pre_car_out_vh, pre_car_out_vh.OHTC_CMD, ProtocolFormat.OHTMessage.CMDCancelType.CmdCancel); } } } //如果OHT已經在MTS/MTL的Segment上時, //就不能將他的對應訊號關閉 if (SCUtility.isMatche(mtx.DeviceSegment, pre_car_out_vh.CUR_SEG_ID)) { LogHelper.Log(logger: logger, LogLevel: LogLevel.Warn, Class: nameof(MTLService), Device: SCAppConstants.DeviceName.DEVICE_NAME_MTx, Data: $"Process car out cancel request. mtx:{mtx.DeviceID}, pre car out vh:{mtx.PreCarOutVhID}, is force finish:{isForceFinish}," + $"But vh current section is in MTL segment:{mtx.DeviceSegment} .can't trun off car out single ", XID: mtx.DeviceID); return; } } //mtx.SetCarOutInterlock(false); //mtx.PreCarOutVhID = ""; mtx.PreCarOutVhID = ""; if (mtx is MaintainLift) { CarOutFinish(mtx as MaintainLift); } else if (mtx is MaintainSpace) { CarOutFinish(mtx as MaintainSpace); } }
public void carOutRequestCancle(IMaintainDevice mtx) { carOutRequestCancle(mtx, false); }
private Task AutoCarOutCancel(IMaintainDevice maintainDevice) { return(Task.Run(() => bcApp.SCApplication.MTLService.carOutRequestCancle(maintainDevice))); }
private void CarRealtimeInfo(IMaintainDevice maintainDevice, UInt16 car_id, UInt16 action_mode, UInt16 cst_exist, UInt16 current_section_id, UInt32 current_address_id, UInt32 buffer_distance, UInt16 speed) { maintainDevice.setCarRealTimeInfo(car_id, action_mode, cst_exist, current_section_id, current_address_id, buffer_distance, speed); }
public (bool isSuccess, string result) checkVhAndMTxCarOutStatus(IMaintainDevice mtx, IMaintainDevice dockingMtx, AVEHICLE car_out_vh) { bool isSuccess = true; string result = ""; //1.要判斷目前車子的狀態 if (isSuccess && car_out_vh == null) { isSuccess = false; result = $"vh not exist."; } string vh_id = car_out_vh.VEHICLE_ID; if (isSuccess && !car_out_vh.isTcpIpConnect) { isSuccess = false; result = $"vh id:{vh_id}, not connection."; } if (isSuccess && car_out_vh.MODE_STATUS == ProtocolFormat.OHTMessage.VHModeStatus.Manual) { isSuccess = false; result = $"Vehicle:{vh_id}, current mode is:{car_out_vh.MODE_STATUS}, can't excute auto car out"; } if (isSuccess && SCUtility.isEmpty(car_out_vh.CUR_SEC_ID)) { isSuccess = false; result = $"vh id:{vh_id}, current section is empty."; } //2.要判斷MTL的 Safety check是否有On且是否為Auto Mode if (isSuccess && !SCUtility.isEmpty(mtx.PreCarOutVhID)) { isSuccess = false; result = $"MTL:{mtx.DeviceID} Current process car our vh:{mtx.PreCarOutVhID}, can't excute cat out again."; } if (isSuccess && !mtx.IsAlive) { isSuccess = false; result = $"MTL:{mtx.DeviceID} Current Alive:{mtx.IsAlive}, can't excute cat out requset."; } if (isSuccess && mtx.MTxMode == ProtocolFormat.OHTMessage.MTxMode.Manual) { isSuccess = false; result = $"MTL:{mtx.DeviceID} Current Mode:{mtx.MTxMode}, can't excute cat out requset."; } if (isSuccess && !mtx.CarOutSafetyCheck) { isSuccess = false; result = $"MTx:{mtx.DeviceID} CarOutSafetyCheck:{mtx.CarOutSafetyCheck}, can't excute cat out requset."; } if (dockingMtx != null) { if (isSuccess && dockingMtx.MTxMode == ProtocolFormat.OHTMessage.MTxMode.Manual) { isSuccess = false; result = $"Docking MTx:{dockingMtx.DeviceID} Current Mode:{dockingMtx.MTxMode}, can't excute cat out requset."; } if (!SCUtility.isMatche(car_out_vh.CUR_ADR_ID, dockingMtx.DeviceAddress)) { if (isSuccess && !dockingMtx.CarOutSafetyCheck) { isSuccess = false; result = $"Docking MTx:{dockingMtx.DeviceID} CarOutSafetyCheck:{dockingMtx.CarOutSafetyCheck}, can't excute cat out requset."; } } } return(isSuccess, result); }
//bool cancelCarOutRequest = false; //bool carOurSuccess = false; /// <summary> /// 處理人員由MTL執行CAR OUT時的流程 /// </summary> /// <param name="vhNum"></param> /// <returns></returns> //public (bool isSuccess, string result) carOutRequset(IMaintainDevice mtx, int vhNum) //{ // AVEHICLE pre_car_out_vh = vehicleBLL.cache.getVhByNum(vhNum); // if (pre_car_out_vh == null) // return (false, $"vh num:{vhNum}, not exist."); // else // { // bool isSuccess = true; // string result = ""; // var check_result = checkVhAndMTxCarOutStatus(mtx, null, pre_car_out_vh); // isSuccess = check_result.isSuccess; // result = check_result.result; // if (isSuccess) // { // (bool isSuccess, string result) process_result = default((bool isSuccess, string result)); // if (mtx is MaintainLift) // { // process_result = processCarOutScenario(mtx as MaintainLift, pre_car_out_vh); // } // else if (mtx is MaintainSpace) // { // process_result = processCarOutScenario(mtx as MaintainSpace, pre_car_out_vh); // } // else // { // return process_result; // } // isSuccess = process_result.isSuccess; // result = process_result.result; // } // return (isSuccess, result); // } //} /// <summary> /// 處理人員由OHTC執行CAR OUT時的流程 /// </summary> /// <param name="vhID"></param> /// <returns></returns> //public (bool isSuccess, string result) carOutRequset(IMaintainDevice mtx, string vhID) //{ // AVEHICLE pre_car_out_vh = vehicleBLL.cache.getVhByID(vhID); // bool isSuccess = true; // string result = ""; // var check_result = checkVhAndMTxCarOutStatus(mtx, null, pre_car_out_vh); // isSuccess = check_result.isSuccess; // result = check_result.result; // //2.向MTL發出Car out request // //成功後開始向MTL發送該台Vh的當前狀態,並在裡面判斷是否有收到Cancel的命令,有的話要將資料清空 // //Trun on 給MTL的Interlock flag // //將該台Vh變更為AutoToMtl // if (isSuccess) // { // var send_result = mtx.carOutRequest((UInt16)pre_car_out_vh.Num); // if (send_result.isSendSuccess && send_result.returnCode == 1) // { // (bool isSuccess, string result) process_result = default((bool isSuccess, string result)); // if (mtx is MaintainLift) // { // process_result = processCarOutScenario(mtx as MaintainLift, pre_car_out_vh); // } // else if (mtx is MaintainSpace) // { // process_result = processCarOutScenario(mtx as MaintainSpace, pre_car_out_vh); // } // else // { // return process_result; // } // isSuccess = process_result.isSuccess; // result = process_result.result; // } // else // { // isSuccess = false; // result = $"Request car fail,Send result:{send_result.isSendSuccess}, return code:{send_result.returnCode}"; // } // } // return (isSuccess, result); //} public (bool isSuccess, string result) checkVhAndMTxCarOutStatus(IMaintainDevice mtx, IMaintainDevice dockingMtx, AVEHICLE car_out_vh) { bool isSuccess = true; string result = ""; //1.要判斷目前車子的狀態 if (isSuccess && mtx.CarOutInterlock) { isSuccess = false; result = $"MTx:{mtx.DeviceID} Current CarOutInterlock:{mtx.CarOutInterlock}, can't excute cat out requset."; } if (isSuccess && car_out_vh == null) { isSuccess = false; result = $"vh not exist."; //如果car_out_vh是Null就直接return回去 return(isSuccess, result); } string vh_id = car_out_vh.VEHICLE_ID; if (isSuccess && !car_out_vh.isTcpIpConnect) { isSuccess = false; result = $"vh id:{vh_id}, not connection."; } if (isSuccess && car_out_vh.MODE_STATUS == ProtocolFormat.OHTMessage.VHModeStatus.Manual) { isSuccess = false; result = $"Vehicle:{vh_id}, current mode is:{car_out_vh.MODE_STATUS}, can't excute auto car out"; } if (isSuccess && SCUtility.isEmpty(car_out_vh.CUR_SEC_ID)) { isSuccess = false; result = $"vh id:{vh_id}, current section is empty."; } if (isSuccess && SCUtility.isEmpty(car_out_vh.CUR_ADR_ID)) { isSuccess = false; result = $"vh id:{vh_id}, current address is empty."; } //要判斷目前到車子所在位置到目的地(MTL/MTS)路徑是不是通的 KeyValuePair <string[], double> route_distance; if (isSuccess && !scApp.RouteGuide.checkRoadIsWalkable(car_out_vh.CUR_ADR_ID, mtx.DeviceAddress, true, out route_distance)) { isSuccess = false; result = $"vh id:{vh_id}, current address:{car_out_vh.CUR_ADR_ID} to device:{mtx.DeviceID} of address id:{mtx.DeviceAddress} not walkable."; } //2.要判斷MTL的 Safety check是否有On且是否為Auto Mode if (isSuccess && !SCUtility.isEmpty(mtx.PreCarOutVhID)) { isSuccess = false; result = $"MTL:{mtx.DeviceID} Current process car our vh:{mtx.PreCarOutVhID}, can't excute cat out again."; } if (isSuccess && !mtx.IsAlive) { isSuccess = false; result = $"MTL:{mtx.DeviceID} Current Alive:{mtx.IsAlive}, can't excute cat out requset."; } if (isSuccess && mtx.MTxMode == ProtocolFormat.OHTMessage.MTxMode.Manual) { isSuccess = false; result = $"MTL:{mtx.DeviceID} Current Mode:{mtx.MTxMode}, can't excute cat out requset."; } //if (isSuccess && !mtx.CarOutSafetyCheck) //{ // isSuccess = false; // result = $"MTx:{mtx.DeviceID} CarOutSafetyCheck:{mtx.CarOutSafetyCheck}, can't excute cat out requset."; //} if (dockingMtx != null) { if (isSuccess && dockingMtx.MTxMode == ProtocolFormat.OHTMessage.MTxMode.Manual) { isSuccess = false; result = $"Docking MTx:{dockingMtx.DeviceID} Current Mode:{dockingMtx.MTxMode}, can't excute cat out requset."; } //if (!SCUtility.isMatche(car_out_vh.CUR_ADR_ID, dockingMtx.DeviceAddress)) //{ // if (isSuccess && !dockingMtx.CarOutSafetyCheck) // { // isSuccess = false; // result = $"Docking MTx:{dockingMtx.DeviceID} CarOutSafetyCheck:{dockingMtx.CarOutSafetyCheck}, can't excute cat out requset."; // } //} if (isSuccess && !SCUtility.isEmpty(dockingMtx.PreCarOutVhID)) { isSuccess = false; result = $"Docking MTx:{dockingMtx.DeviceID} has prepare car out vh:{dockingMtx.PreCarOutVhID}, can't excute cat out requset."; } //如果是MTL來確認是否可以 CAR OUT,則要判斷她前方的MTS 是否有車子在上面, //但如果是在該VH是在MTS上面則可以讓他下來 if (mtx is MaintainLift && dockingMtx is MaintainSpace) { if (!SCUtility.isMatche(car_out_vh.CUR_ADR_ID, dockingMtx.DeviceAddress)) { if (isSuccess && dockingMtx.HasVehicle) { isSuccess = false; result = $"Docking MTx:{dockingMtx.DeviceID} {nameof(dockingMtx.HasVehicle)}:{dockingMtx.HasVehicle}, can't excute cat out requset."; } } } } return(isSuccess, result); }