private void button8_Click(object sender, EventArgs e) { ACMD_MCS datainfo = BCApp.SCApplication.CMDBLL.LoadCmdData().First(); #region 新增OHT命令 ACMD_OHTC cmdohtc = new ACMD_OHTC { CMD_ID = datainfo.CMD_ID, CARRIER_ID = datainfo.CARRIER_ID, BOX_ID = datainfo.BOX_ID, VH_ID = comboBox12.Text, CMD_ID_MCS = datainfo.CMD_ID, CMD_TPYE = 0, PRIORITY = 50, SOURCE = datainfo.HOSTSOURCE, DESTINATION = datainfo.HOSTDESTINATION, CMD_STAUS = 0, CMD_PROGRESS = 0, ESTIMATED_EXCESS_TIME = 0, REAL_CMP_TIME = 0, ESTIMATED_TIME = 50 }; BCApp.SCApplication.CMDBLL.creatCommand_OHTC(cmdohtc); #endregion }
public bool newReportTransferCancelInitial(ACMD_MCS cmd, List <AMCSREPORTQUEUE> reportqueues) { bool isSuccsess = true; isSuccsess = isSuccsess && iBSEMDriver.S6F11SendTransferCancelInitial(cmd, reportqueues); return(isSuccsess); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { try { SetIsInputMethodEnabled(); if (app.ObjCacheManager.GetMCS_CMD().Count > 0) { txt_CurMaxPriSum.Text = app.CmdBLL.getCMD_MCSMaxProritySum().ToString(); txt_CurMinPriSum.Text = app.CmdBLL.getCMD_MCSMinProritySum().ToString(); ACMD_MCS mcs_cmd = app.CmdBLL.GetCmd_MCSByID(mcs_cmd_id); txt_McsCmdID.Text = mcs_cmd_id; txt_McsPri.Text = mcs_cmd.PRIORITY.ToString(); txt_PortPri.Text = mcs_cmd.PORT_PRIORITY.ToString(); txt_TimePri.Text = mcs_cmd.TIME_PRIORITY.ToString(); num_PriSum.Value = mcs_cmd.PRIORITY_SUM; } else { } } catch (Exception ex) { logger.Error(ex, "Exception"); } }
private void button1_Click(object sender, EventArgs e) { ACMD_MCS datainfo = BCApp.SCApplication.CMDBLL.LoadCmdData().First(); if (datainfo != null) { BCApp.SCApplication.CMDBLL.updateCMD_MCS_BCROnCrane(datainfo.CMD_ID, textBox3.Text); } }
private void button1_Click(object sender, EventArgs e) { ACMD_MCS datainfo = BCApp.SCApplication.CMDBLL.LoadCmdData().First(); if (datainfo != null) { BCApp.SCApplication.CMDBLL.updateCMD_MCS_BCROnCrane(datainfo.CMD_ID, textBox3.Text); BCApp.SCApplication.TransferService.OHT_IDRead(datainfo.CMD_ID, datainfo.CRANE, textBox3.Text, BCRReadResult.BcrMisMatch); } }
public ACMD_MCS GetCmd_MCSByID(string cmdID) { ACMD_MCS cmd = null; using (DBConnection_EF con = DBConnection_EF.GetUContext()) { cmd = cmd_mcsDao.getByID(con, cmdID); } return(cmd); }
public bool newReportTransferCommandFinish(ACMD_MCS CMD_MCS, AVEHICLE vh, string resultCode, List <AMCSREPORTQUEUE> reportqueues) { bool isSuccsess = true; if (vh != null) { isSuccsess = isSuccsess && iBSEMDriver.S6F11SendVehicleUnassinged(vh.VEHICLE_ID, reportqueues); } isSuccsess = isSuccsess && iBSEMDriver.S6F11SendTransferCompleted(CMD_MCS, vh, resultCode, reportqueues); return(isSuccsess); }
public void DeleteCmdData(DBConnection_EF conn, ACMD_MCS cmddata) { try { conn.ACMD_MCS.Remove(cmddata); conn.SaveChanges(); } catch (Exception ex) { //logger.Warn(ex); throw; } }
public bool upDateVIDCommandInfo(string eq_id, string mcs_cmd_id) { bool isSuccess = true; if (SCUtility.isEmpty(mcs_cmd_id)) { return(false); } ACMD_MCS mcs_msc = scApp.CMDBLL.getCMD_MCSByID(mcs_cmd_id); if (mcs_msc != null) { isSuccess = upDateVIDCommandInfo(eq_id, mcs_msc.CARRIER_ID, mcs_msc.CMD_ID, mcs_msc.HOSTSOURCE, mcs_msc.HOSTDESTINATION, mcs_msc.PRIORITY, mcs_msc.REPLACE); } return(isSuccess); }
public bool creatSysExcuteQuality(ACMD_MCS cmd_mcs) { bool isSuccess = true; string cmd_id = cmd_mcs.CMD_ID; string cst_id = cmd_mcs.CARRIER_ID; string source = cmd_mcs.HOSTSOURCE; string destn = cmd_mcs.HOSTDESTINATION; int total_act_vh = scApp.VehicleBLL.getActVhCount(); int total_idle_vh = scApp.VehicleBLL.getIdleVhCount(); int total_parking_vh = scApp.VehicleBLL.getParkingVhCount(); int total_cycling_vh = scApp.VehicleBLL.getCyclingVhCount(); ASYSEXCUTEQUALITY sysExcuteQuality = buildSysExcuteQualityObj(cmd_id, cst_id, source, destn, total_act_vh, total_idle_vh, total_parking_vh, total_cycling_vh); addSysExcuteQuality(sysExcuteQuality); return(isSuccess); }
public override bool S6F11SendAlarmSet(ACMD_MCS CMD_MCS, ALARM ALARM, string unitid, string unitstate, string RecoveryOption) { return(true); }
public override bool S6F11SendCarrierTransferring(ACMD_MCS cmd, CassetteData cassette, string ohtName, List <AMCSREPORTQUEUE> reportQueues = null) { return(true); }
public override bool S6F11SendAlarmCleared(ACMD_MCS CMD_MCS, ALARM ALARM, string unitid, string unitstate) { return(true); }
public abstract bool S6F11SendAlarmCleared(ACMD_MCS CMD_MCS, ALARM ALARM, string unitid, string unitstate);
public abstract bool S6F11SendAlarmSet(ACMD_MCS CMD_MCS, ALARM ALARM, string unitid, string unitstate, string RecoveryOption);
private void RegisterTransferManagementEvent() { Post["TransferManagement/MCSQueueSwitch"] = (p) => { var scApp = SCApplication.getInstance(); string result = string.Empty; try { string AutoAssign = Request.Query.AutoAssign.Value ?? Request.Form.AutoAssign.Value ?? string.Empty; bool isAutoAssign = Convert.ToBoolean(AutoAssign); scApp.getEQObjCacheManager().getLine().MCSCommandAutoAssign = isAutoAssign; result = "OK"; } catch (Exception ex) { result = "MCS Queue Switch update failed with exception happened"; } var response = (Response)result; response.ContentType = restfulContentType; return(response); }; Post["TransferManagement/CancelAbort"] = (p) => { var scApp = SCApplication.getInstance(); bool isSuccess = true; string result = string.Empty; CMDCancelType cnacel_type = default(CMDCancelType); string mcs_cmd_id = Request.Query.mcs_cmd.Value ?? Request.Form.mcs_cmd.Value ?? string.Empty; try { ACMD_MCS mcs_cmd = scApp.CMDBLL.getCMD_MCSByID(mcs_cmd_id); if (mcs_cmd == null) { result = $"Can not find transfer command:[{mcs_cmd_id}]."; } else { if (mcs_cmd.TRANSFERSTATE < sc.E_TRAN_STATUS.Transferring) { cnacel_type = CMDCancelType.CmdCancel; bool btemp = scApp.VehicleService.doCancelOrAbortCommandByMCSCmdID(mcs_cmd_id, cnacel_type); if (btemp) { result = "OK"; } else { result = $"Transfer command:[{mcs_cmd_id}] cancel failed."; } } else if (mcs_cmd.TRANSFERSTATE < sc.E_TRAN_STATUS.Canceling) { cnacel_type = CMDCancelType.CmdAbort; bool btemp = scApp.VehicleService.doCancelOrAbortCommandByMCSCmdID(mcs_cmd_id, cnacel_type); if (btemp) { result = "OK"; } else { result = $"Transfer command:[{mcs_cmd_id}] adort failed."; } } else { result = $"Command ID:{mcs_cmd.CMD_ID.Trim()} can't excute cancel / abort,\r\ncurrent state:{mcs_cmd.TRANSFERSTATE}"; } } } catch (Exception ex) { isSuccess = false; result = "Execption happend!"; logger.Error(ex, "Execption:"); } var response = (Response)result; response.ContentType = restfulContentType; return(response); }; Post["TransferManagement/ForceFinish"] = (p) => { var scApp = SCApplication.getInstance(); bool isSuccess = true; string result = string.Empty; string mcs_cmd_id = Request.Query.mcs_cmd.Value ?? Request.Form.mcs_cmd.Value ?? string.Empty; AVEHICLE excute_cmd_of_vh = scApp.VehicleBLL.cache.getVehicleByMCSCmdID(mcs_cmd_id); ACMD_MCS mcs_cmd = scApp.CMDBLL.getCMD_MCSByID(mcs_cmd_id); try { if (excute_cmd_of_vh != null) { scApp.VehicleBLL.doTransferCommandFinish(excute_cmd_of_vh.VEHICLE_ID, excute_cmd_of_vh.OHTC_CMD, CompleteStatus.CmpStatusForceFinishByOp, 0); scApp.VIDBLL.initialVIDCommandInfo(excute_cmd_of_vh.VEHICLE_ID); } scApp.CMDBLL.updateCMD_MCS_TranStatus2Complete(mcs_cmd_id, E_TRAN_STATUS.Aborted); scApp.ReportBLL.newReportTransferCommandFinish(mcs_cmd, excute_cmd_of_vh, sc.Data.SECS.AGVC.SECSConst.CMD_Result_Unsuccessful, null); result = "OK"; } catch { result = "ForceFinish failed."; } var response = (Response)result; response.ContentType = restfulContentType; return(response); }; Post["TransferManagement/AssignVehicle"] = (p) => { var scApp = SCApplication.getInstance(); string result = string.Empty; string mcs_cmd_id = Request.Query.mcs_cmd.Value ?? Request.Form.mcs_cmd.Value ?? string.Empty; string vh_id = Request.Query.vh_id.Value ?? Request.Form.vh_id.Value ?? string.Empty; try { ACMD_MCS mcs_cmd = scApp.CMDBLL.getCMD_MCSByID(mcs_cmd_id); scApp.CMDBLL.assignCommnadToVehicle(mcs_cmd_id, vh_id, out result); } catch (Exception ex) { result = "Assign command to vehicle failed with exception happened."; } var response = (Response)result; response.ContentType = restfulContentType; return(response); }; Post["TransferManagement/ShiftCommand"] = (p) => { var scApp = SCApplication.getInstance(); string result = string.Empty; string mcs_cmd_id = Request.Query.mcs_cmd.Value ?? Request.Form.mcs_cmd.Value ?? string.Empty; string vh_id = Request.Query.vh_id.Value ?? Request.Form.vh_id.Value ?? string.Empty; try { ACMD_MCS mcs_cmd = scApp.CMDBLL.getCMD_MCSByID(mcs_cmd_id); scApp.CMDBLL.commandShift(mcs_cmd_id, vh_id, out result); } catch (Exception ex) { result = "Shift command failed with exception happened."; } var response = (Response)result; response.ContentType = restfulContentType; return(response); }; Post["TransferManagement/ChangeStatus"] = (p) => { var scApp = SCApplication.getInstance(); string result = string.Empty; bool isSuccess = true; string mcs_cmd_id = Request.Query.mcs_cmd.Value ?? Request.Form.mcs_cmd.Value ?? string.Empty; string sstatus = Request.Query.status.Value ?? Request.Form.status.Value ?? string.Empty; try { ACMD_MCS mcs_cmd = scApp.CMDBLL.getCMD_MCSByID(mcs_cmd_id); E_TRAN_STATUS status = (E_TRAN_STATUS)Enum.Parse(typeof(E_TRAN_STATUS), sstatus, false); if (mcs_cmd != null) { isSuccess = scApp.CMDBLL.updateCMD_MCS_TranStatus(mcs_cmd_id, status); if (isSuccess) { result = "OK"; } else { result = "Update status failed."; } } else { result = $"Can not find MCS Command[{mcs_cmd_id}]."; } } catch (Exception ex) { result = "Update status failed with exception happened."; } //Todo by Mark var response = (Response)result; response.ContentType = restfulContentType; return(response); }; Post["TransferManagement/Priority"] = (p) => { var scApp = SCApplication.getInstance(); string result = string.Empty; bool isSuccess = true; string mcs_cmd_id = Request.Query.mcs_cmd.Value ?? Request.Form.mcs_cmd.Value ?? string.Empty; string priority = Request.Query.priority.Value ?? Request.Form.priority.Value ?? string.Empty; try { ACMD_MCS mcs_cmd = scApp.CMDBLL.getCMD_MCSByID(mcs_cmd_id); int iPriority = Convert.ToInt32(priority); if (mcs_cmd != null) { isSuccess = scApp.CMDBLL.updateCMD_MCS_PrioritySUM(mcs_cmd, iPriority); if (isSuccess) { result = "OK"; } else { result = "Update priority failed."; } } else { result = $"Can not find MCS Command[{mcs_cmd_id}]."; } } catch (Exception ex) { result = "Update priority failed with exception happened."; } var response = (Response)result; response.ContentType = restfulContentType; return(response); }; }
public abstract bool S6F11SendTransferCompleted(ACMD_MCS CMD_MCS, AVEHICLE vh, string resultCode, List <AMCSREPORTQUEUE> reportQueues = null);
public CMD_MCSObjToShow(BLL.PortStationBLL portStationBLL, ACMD_MCS _cmd_mcs) { cmd_mcs = _cmd_mcs; PortStationBLL = portStationBLL; }
public void update(DBConnection_EF con, ACMD_MCS cmd) { con.SaveChanges(); }
public abstract bool S6F11SendCarrierStoredAlt(ACMD_MCS cmd, CassetteData cassette, List <AMCSREPORTQUEUE> reportQueues = null);
public abstract bool S6F11SendCarrierTransferring(ACMD_MCS cmd, CassetteData cassette, string ohtName, List <AMCSREPORTQUEUE> reportQueues = null);
public override bool S6F11SendTransferCompleted(ACMD_MCS cmd, CassetteData cassette, string result_code, List <AMCSREPORTQUEUE> reportQueues = null) { return(true); }
public void Remove(DBConnection_EF con, ACMD_MCS cmd_mcs) { con.Entry(cmd_mcs).State = EntityState.Deleted; con.ACMD_MCS.Remove(cmd_mcs); con.SaveChanges(); }
public CMD_MCSObjToShow(BLL.VehicleBLL vehicleBLL, BLL.PortStationBLL portStationBLL, ACMD_MCS _cmd_mcs) { cmd_mcs = _cmd_mcs; VehicleBLL = vehicleBLL; PortStationBLL = portStationBLL; }
public abstract bool S6F11SendTransferCompleted(ACMD_MCS cmd, CassetteData cassette, string result_code, List <AMCSREPORTQUEUE> reportQueues = null);
private void RegisterVehilceEvent() { Get["AVEHICLES/{ID}"] = (p) => { string vh_id = p.ID; AVEHICLE vh = SCApplication.getInstance().VehicleBLL.getVehicleByID(vh_id); var response = (Response)vh.ToString(); response.ContentType = restfulContentType; return(response); }; Get["AVEHICLES"] = (p) => { string vh_id = p.ID; List <AVEHICLE> vhs = SCApplication.getInstance().getEQObjCacheManager().getAllVehicle(); var response = (Response)JsonConvert.SerializeObject(vhs); response.ContentType = restfulContentType; return(response); }; //Get["AVEHICLES/(?<all>)"] = (p) => Get["AVEHICLES/_search"] = (p) => { List <AVEHICLE> vhs = null; foreach (string name in Request.Query) { switch (name) { case "SectionID": string sec_id = Request.Query[name] ?? string.Empty; vhs = SCApplication.getInstance().VehicleBLL.loadVehicleBySEC_ID(sec_id); break; } } var response = (Response)JsonConvert.SerializeObject(vhs); response.ContentType = restfulContentType; return(response); }; Get["metrics"] = (p) => { int total_idle_vh_clean = SCApplication.getInstance().VehicleBLL.getNoExcuteMcsCmdVhCount(E_VH_TYPE.Clean); int total_idle_vh_Dirty = SCApplication.getInstance().VehicleBLL.getNoExcuteMcsCmdVhCount(E_VH_TYPE.Dirty); int total_cmd_is_queue_count = SCApplication.getInstance().CMDBLL.getCMD_MCSIsQueueCount(); int total_cmd_is_running_count = SCApplication.getInstance().CMDBLL.getCMD_MCSIsRunningCount(); string ohxc_excute_info = string.Empty; StringBuilder sb = new StringBuilder(); setOhxCContent(sb, nameof(total_idle_vh_clean), total_idle_vh_clean, "current idle clean car"); setOhxCContent(sb, nameof(total_idle_vh_Dirty), total_idle_vh_Dirty, "current idle dirty car"); setOhxCContent(sb, nameof(total_cmd_is_queue_count), total_cmd_is_queue_count, "cmd number being queued"); setOhxCContent(sb, nameof(total_cmd_is_running_count), total_cmd_is_running_count, "cmd number being executed"); var response = (Response)sb.ToString(); response.ContentType = restfulContentType; return(response); }; Post["AVEHICLES/ViewerUpdate"] = (p) => { SCApplication scApp = SCApplication.getInstance(); List <AVEHICLE> vhs = scApp.getEQObjCacheManager().getAllVehicle(); //foreach (AVEHICLE vh in vhs) //{ // scApp.VehicleService.PublishVhInfo(vh, null); // SpinWait.SpinUntil(() => false, 10); //} var response = (Response)"OK"; response.ContentType = restfulContentType; return(response); }; //Post["api/io/T2STK100T01/waitin/CST01"] = (p) => //{ // var response = (Response)"OK"; // response.ContentType = restfulContentType; // return response; //}; Post["AVEHICLES/SendCommand"] = (p) => { var scApp = SCApplication.getInstance(); bool isSuccess = true; string vh_id = Request.Query.vh_id.Value ?? Request.Form.vh_id.Value ?? string.Empty; string carrier_id = Request.Query.carrier_id.Value ?? Request.Form.carrier_id.Value ?? string.Empty; string from_port_id = Request.Query.from_port_id.Value ?? Request.Form.from_port_id.Value ?? string.Empty; string to_port_id = Request.Query.to_port_id.Value ?? Request.Form.to_port_id.Value ?? string.Empty; E_CMD_TYPE e_cmd_type = default(E_CMD_TYPE); string cmd_type = Request.Query.cmd_type.Value ?? Request.Form.cmd_type.Value ?? string.Empty; string result = string.Empty; try { ACMD_OHTC cmd_obj = null; AVEHICLE assignVH = null; assignVH = scApp.VehicleBLL.getVehicleByID(vh_id); isSuccess = assignVH != null; if (isSuccess) { isSuccess = Enum.TryParse(cmd_type, out e_cmd_type); if (isSuccess) { switch (e_cmd_type) { case E_CMD_TYPE.Move: case E_CMD_TYPE.Load: case E_CMD_TYPE.Unload: case E_CMD_TYPE.LoadUnload: case E_CMD_TYPE.MoveToMTL: case E_CMD_TYPE.SystemOut: string from_adr = from_port_id; string to_adr = to_port_id; //scApp.MapBLL.getAddressID(from_port_id, out from_adr); //scApp.MapBLL.getAddressID(to_port_id, out to_adr); scApp.CMDBLL.doCreatTransferCommand(vh_id, out cmd_obj, cmd_type: e_cmd_type, source: from_adr, destination: to_adr, carrier_id: carrier_id, gen_cmd_type: SCAppConstants.GenOHxCCommandType.Manual); sc.BLL.CMDBLL.OHTCCommandCheckResult check_result_info = sc.BLL.CMDBLL.getCallContext <sc.BLL.CMDBLL.OHTCCommandCheckResult> (sc.BLL.CMDBLL.CALL_CONTEXT_KEY_WORD_OHTC_CMD_CHECK_RESULT); isSuccess = check_result_info.IsSuccess; result = check_result_info.ToString(); if (isSuccess) { isSuccess = scApp.VehicleService.doSendOHxCCmdToVh(assignVH, cmd_obj); if (isSuccess) { result = "OK"; } else { result = "Send command to vehicle failed!"; } } else { result = "Command create failed!"; //bcf.App.BCFApplication.onWarningMsg(this, new bcf.Common.LogEventArgs("Command create fail.", check_result_info.Num)); } break; case E_CMD_TYPE.Home: string cmd_id = scApp.SequenceBLL.getCommandID(SCAppConstants.GenOHxCCommandType.Manual); isSuccess = scApp.VehicleService.TransferRequset(vh_id, cmd_id, ActiveType.Home, "", new string[0], new string[0], "", ""); break; case E_CMD_TYPE.Teaching: isSuccess = scApp.VehicleService.TeachingRequest(vh_id, from_port_id, to_port_id); break; } } else { result = $"Try parse Command Type:[{cmd_type}] failed!"; } } else { result = $"Vehicle :[{vh_id}] not found!"; } } catch (Exception ex) { isSuccess = false; result = "Execption happend!"; logger.Error(ex, "Execption:"); } var response = (Response)result; response.ContentType = restfulContentType; return(response); }; Post["AVEHICLES/SendReset"] = (p) => { var scApp = SCApplication.getInstance(); bool isSuccess = true; string vh_id = Request.Query.vh_id.Value ?? Request.Form.vh_id.Value ?? string.Empty; string result = string.Empty; try { LogHelper.Log(logger: logger, LogLevel: LogLevel.Debug, Class: nameof(VehicleInfo), Device: "OHTC", Data: $"Process vh:{vh_id} position reset request from viewer...", VehicleID: vh_id); AVEHICLE assignVH = null; assignVH = scApp.VehicleBLL.getVehicleByID(vh_id); isSuccess = assignVH != null; //確認要求的VH,是否存在 if (isSuccess) { if (assignVH == null) { isSuccess = false; result = $"vh:{vh_id} is not exist."; } } //確認是否還是連線著,如果是,則不能夠進行位置的重置 if (isSuccess) { if (assignVH.isTcpIpConnect) { isSuccess = false; result = $"vh:{vh_id} current is connect. can't excute reset."; } } //確認該Vh是否還有Block,如果有也不能重置 if (isSuccess) { var non_release_block = scApp.MapBLL.loadNonReleaseBlockQueueByCarID(vh_id); if (non_release_block != null && non_release_block.Count > 0) { isSuccess = false; result = $"vh:{vh_id} current has blocking zone, can't excute. please check block management."; } } if (isSuccess) { //isSuccess = scApp.VehicleService.VehicleStatusRequest(vh_id, true); isSuccess = scApp.VehicleService.VhPositionReset(vh_id); if (isSuccess) { result = "OK"; } else { result = "excute reset failed."; } } LogHelper.Log(logger: logger, LogLevel: LogLevel.Debug, Class: nameof(VehicleInfo), Device: "OHTC", Data: $"End process vh:{vh_id} position reset request from viewer. is success:{isSuccess} result:{result}", VehicleID: vh_id); } catch (Exception ex) { isSuccess = false; result = "Execption happend!"; logger.Error(ex, "Execption:"); } var response = (Response)result; response.ContentType = restfulContentType; return(response); }; Post["AVEHICLES/SendCancelAbort"] = (p) => { var scApp = SCApplication.getInstance(); bool isSuccess = true; string vh_id = Request.Query.vh_id.Value ?? Request.Form.vh_id.Value ?? string.Empty; string result = string.Empty; try { AVEHICLE assignVH = null; assignVH = scApp.VehicleBLL.getVehicleByID(vh_id); isSuccess = assignVH != null; if (isSuccess) { string mcs_cmd_id = assignVH.MCS_CMD; if (!string.IsNullOrWhiteSpace(mcs_cmd_id)) { ACMD_MCS mcs_cmd = scApp.CMDBLL.getCMD_MCSByID(mcs_cmd_id); if (mcs_cmd == null) { result = $"Can't find MCS command:[{mcs_cmd_id}] in database."; } else { CMDCancelType actType = default(CMDCancelType); if (mcs_cmd.TRANSFERSTATE < sc.E_TRAN_STATUS.Transferring) { actType = CMDCancelType.CmdCancel; isSuccess = scApp.VehicleService.doCancelOrAbortCommandByMCSCmdID(mcs_cmd_id, actType); if (isSuccess) { result = "OK"; } else { result = "Send command cancel/abort failed."; } } else if (mcs_cmd.TRANSFERSTATE < sc.E_TRAN_STATUS.Canceling) { actType = CMDCancelType.CmdAbort; isSuccess = scApp.VehicleService.doCancelOrAbortCommandByMCSCmdID(mcs_cmd_id, actType); if (isSuccess) { result = "OK"; } else { result = "Send command cancel/abort failed."; } } else { result = $"MCS command:[{mcs_cmd_id}] can't excute cancel / abort,\r\ncurrent state:{mcs_cmd.TRANSFERSTATE}"; } } } else { string ohtc_cmd_id = assignVH.OHTC_CMD; if (string.IsNullOrWhiteSpace(ohtc_cmd_id)) { result = $"Vehicle:[{vh_id}] do not have command."; } else { ACMD_OHTC ohtc_cmd = scApp.CMDBLL.getCMD_OHTCByID(ohtc_cmd_id); if (ohtc_cmd == null) { result = $"Can't find vehicle command:[{ohtc_cmd_id}] in database."; } else { CMDCancelType actType = ohtc_cmd.CMD_STAUS >= E_CMD_STATUS.Execution ? CMDCancelType.CmdAbort : CMDCancelType.CmdCancel; isSuccess = scApp.VehicleService.doAbortCommand(assignVH, ohtc_cmd_id, actType); if (isSuccess) { result = "OK"; } else { result = "Send vehicle status request failed."; } } } } } else { result = $"Vehicle :[{vh_id}] not found!"; } } catch (Exception ex) { isSuccess = false; result = "Execption happend!"; logger.Error(ex, "Execption:"); } var response = (Response)result; response.ContentType = restfulContentType; return(response); }; Post["AVEHICLES/PauseEvent"] = (p) => { bool isSuccess = false; SCApplication scApp = SCApplication.getInstance(); string vh_id = Request.Query.vh_id.Value ?? Request.Form.vh_id.Value ?? string.Empty; string event_type = Request.Query.event_type.Value ?? Request.Form.event_type.Value ?? string.Empty; PauseEvent pauseEvent = default(PauseEvent); isSuccess = Enum.TryParse(event_type, out pauseEvent); if (isSuccess) { isSuccess = scApp.VehicleService.PauseRequest (vh_id, pauseEvent, SCAppConstants.OHxCPauseType.Normal); } var response = (Response)(isSuccess ? "OK" : "NG"); response.ContentType = restfulContentType; return(response); }; Post["AVEHICLES/PauseStatusChange"] = (p) => { bool isSuccess = false; string result = string.Empty; SCApplication scApp = SCApplication.getInstance(); string vh_id = Request.Query.vh_id.Value ?? Request.Form.vh_id.Value ?? string.Empty; string pauseType = Request.Query.pauseType.Value ?? Request.Form.pauseType.Value ?? string.Empty; string event_type = Request.Query.event_type.Value ?? Request.Form.event_type.Value ?? string.Empty; SCAppConstants.OHxCPauseType pause_type = default(SCAppConstants.OHxCPauseType); PauseEvent pauseEvent = default(PauseEvent); isSuccess = Enum.TryParse(pauseType, out pause_type); if (isSuccess) { isSuccess = Enum.TryParse(event_type, out pauseEvent); if (isSuccess) { isSuccess = scApp.VehicleService.PauseRequest (vh_id, pauseEvent, pause_type); if (isSuccess) { //AVEHICLE vh = scApp.VehicleBLL.getVehicleByID(vh_id); //vh.NotifyVhStatusChange(); result = "OK"; } else { result = $"Send pause request to vehicle:{vh_id} failed."; } } else { result = $"Can't recognize Pause Event:{event_type}."; } } else { result = $"Can't recognize Pause Type:{pauseType}."; } var response = (Response)result; response.ContentType = restfulContentType; return(response); }; Post["AVEHICLES/ModeStatusChange"] = (p) => { bool isSuccess = false; string result = string.Empty; SCApplication scApp = SCApplication.getInstance(); string vh_id = Request.Query.vh_id.Value ?? Request.Form.vh_id.Value ?? string.Empty; string modeStatus = Request.Query.modeStatus.Value ?? Request.Form.modeStatus.Value ?? string.Empty; VHModeStatus mode_status = default(VHModeStatus); isSuccess = Enum.TryParse(modeStatus, out mode_status); if (isSuccess) { if (isSuccess) { isSuccess = scApp.VehicleBLL.updataVehicleMode(vh_id, mode_status); if (isSuccess) { AVEHICLE vh = scApp.VehicleBLL.getVehicleByID(vh_id); vh.NotifyVhStatusChange(); result = "OK"; } else { result = $"Update vehicle:{vh_id} mode status failed."; } } } else { result = $"Can't recognize mode status:{modeStatus}."; } var response = (Response)result; response.ContentType = restfulContentType; return(response); }; Post["AVEHICLES/ResetAlarm"] = (p) => { var scApp = SCApplication.getInstance(); string result = string.Empty; bool isSuccess = true; string vh_id = Request.Query.vh_id.Value ?? Request.Form.vh_id.Value ?? string.Empty; try { isSuccess = scApp.VehicleService.AlarmResetRequest(vh_id); if (isSuccess) { result = "OK"; } else { result = "Reset alarm failed."; } } catch (Exception ex) { result = "Reset alarm failedwith exception happened."; } var response = (Response)result; response.ContentType = restfulContentType; return(response); }; Post["Engineer/ForceCmdFinish"] = (p) => { var scApp = SCApplication.getInstance(); string vh_id = Request.Query.vh_id.Value ?? Request.Form.vh_id.Value ?? string.Empty; bool isSuccess = scApp.CMDBLL.forceUpdataCmdStatus2FnishByVhID(vh_id); if (isSuccess) { var vh = scApp.VehicleBLL.getVehicleByID(vh_id); vh.NotifyVhExcuteCMDStatusChange(); } var response = (Response)(isSuccess ? "OK" : "NG"); response.ContentType = restfulContentType; return(response); }; }
public override bool S6F11SendCarrierStoredAlt(ACMD_MCS cmd, CassetteData cassette, List <AMCSREPORTQUEUE> reportQueues = null) { return(true); }
public CMD_MCSObjToShow(BLL.VehicleBLL vehicleBLL, ACMD_MCS cmdMcs) { cmd_mcs = cmdMcs; VehicleBLL = vehicleBLL; }
protected virtual void S1F3ReceiveSelectedEquipmentStatusRequest(object sender, SECSEventArgs e) { try { S1F3 s1f3 = ((S1F3)e.secsHandler.Parse <S1F3>(e)); SCUtility.secsActionRecordMsg(scApp, true, s1f3); int count = s1f3.SVID.Count(); S1F4 s1f4 = new S1F4(); s1f4.SECSAgentName = scApp.EAPSecsAgentName; s1f4.SystemByte = s1f3.SystemByte; s1f4.SV = new SXFY[count]; for (int i = 0; i < count; i++) { if (s1f3.SVID[i] == SECSConst.VID_AlarmsSet) { //TODO Set Alarm List s1f4.SV[i] = new S6F11.RPTINFO.RPTITEM.VIDITEM_04(); } else if (s1f3.SVID[i] == SECSConst.VID_ControlState) { string control_state = SCAppConstants.LineHostControlState.convert2MES(line.Host_Control_State); s1f4.SV[i] = new S6F11.RPTINFO.RPTITEM.VIDITEM_06() { CONTROLSTATE = control_state }; } else if (s1f3.SVID[i] == SECSConst.VID_ActiveVehicles) { List <AVEHICLE> vhs = scApp.getEQObjCacheManager().getAllVehicle(); int vhs_count = vhs.Count; S6F11.RPTINFO.RPTITEM.VIDITEM_71[] VEHICLEINFOs = new S6F11.RPTINFO.RPTITEM.VIDITEM_71[vhs_count]; for (int j = 0; j < vhs_count; j++) { VEHICLEINFOs[j] = new S6F11.RPTINFO.RPTITEM.VIDITEM_71() { VHINFO = new S6F11.RPTINFO.RPTITEM.VIDITEM_71.VEHICLEINFO() { VEHICLE_ID = vhs[j].VEHICLE_ID, VEHICLE_STATE = "2" } }; } s1f4.SV[i] = new S6F11.RPTINFO.RPTITEM.VIDITEM_53() { VEHICLEINFO = VEHICLEINFOs }; } else if (s1f3.SVID[i] == SECSConst.VID_SCState) { //string sc_state = SCAppConstants.LineSCState.convert2MES(line.SCStats); //s1f4.SV[i] = new S6F11.RPTINFO.RPTITEM.VIDITEM_73() //{ // SCSTATE = sc_state //}; } else if (s1f3.SVID[i] == SECSConst.VID_EnhancedTransfers) { List <ACMD_MCS> mcs_cmds = scApp.CMDBLL.loadACMD_MCSIsUnfinished(); int cmd_count = mcs_cmds.Count; S6F11.RPTINFO.RPTITEM.VIDITEM_13[] EnhancedTransferCmds = new S6F11.RPTINFO.RPTITEM.VIDITEM_13[cmd_count]; for (int k = 0; k < cmd_count; k++) { ACMD_MCS mcs_cmd = mcs_cmds[k]; string transfer_state = SCAppConstants.TransferState.convert2MES(mcs_cmd.TRANSFERSTATE); EnhancedTransferCmds[k] = new S6F11.RPTINFO.RPTITEM.VIDITEM_13(); EnhancedTransferCmds[k].TRANSFER_STATE.TRANSFER_STATE = transfer_state; EnhancedTransferCmds[k].COMMAND_INFO.COMMAND_ID.COMMAND_ID = mcs_cmd.CMD_ID; EnhancedTransferCmds[k].COMMAND_INFO.PRIORITY.PRIORITY = mcs_cmd.PRIORITY.ToString(); EnhancedTransferCmds[k].TRANSFER_INFO.CARRIER_ID = mcs_cmd.CARRIER_ID; EnhancedTransferCmds[k].TRANSFER_INFO.SOURCE_PORT = mcs_cmd.HOSTSOURCE; EnhancedTransferCmds[k].TRANSFER_INFO.DESTINATION_PORT = mcs_cmd.HOSTDESTINATION; } s1f4.SV[i] = new S6F11.RPTINFO.RPTITEM.VIDITEM_76() { EnhancedTransferCmd = EnhancedTransferCmds }; } else if (s1f3.SVID[i] == SECSConst.VID_Spec_Version) { s1f4.SV[i] = new S6F11.RPTINFO.RPTITEM.VIDITEM_114() { SPEC_VERSION = string.Empty // TODO fill in }; } else if (s1f3.SVID[i] == SECSConst.VID_Enhanced_Carriers) { List <AVEHICLE> has_carry_vhs = scApp.getEQObjCacheManager().getAllVehicle().Where(vh => vh.HAS_CST == 1).ToList(); int carry_vhs_count = has_carry_vhs.Count; S6F11.RPTINFO.RPTITEM.VIDITEM_10[] carrier_info = new S6F11.RPTINFO.RPTITEM.VIDITEM_10[carry_vhs_count]; for (int j = 0; j < carry_vhs_count; j++) { carrier_info[j] = new S6F11.RPTINFO.RPTITEM.VIDITEM_10(); carrier_info[j].CARRIER_ID_OBJ.CARRIER_ID = has_carry_vhs[j].CST_ID.Trim(); carrier_info[j].CARRIER_LOC_OBJ.CARRIER_LOC = has_carry_vhs[j].VEHICLE_ID; carrier_info[j].INSTALL_TIME_OBJ.INSTALLTIME = string.Empty; //TODO 要填入進入的時間 carrier_info[j].CARRIER_ZONE_NAME = string.Empty; carrier_info[j].CARRIER_STATE = string.Empty; } s1f4.SV[i] = new S6F11.RPTINFO.RPTITEM.VIDITEM_51() { ENHANCED_CARRIER_INFO = carrier_info }; } else if (s1f3.SVID[i] == SECSConst.VID_Current_Port_States) { List <APORTSTATION> port_station = scApp.MapBLL.loadAllPort(); int port_count = port_station.Count; var vid_118 = new S6F11.RPTINFO.RPTITEM.VIDITEM_118(); vid_118.PORT_INFO = new S6F11.RPTINFO.RPTITEM.VIDITEM_354[port_count]; for (int j = 0; j < port_count; j++) { vid_118.PORT_INFO[j] = new S6F11.RPTINFO.RPTITEM.VIDITEM_354(); vid_118.PORT_INFO[j].PORT_ID.PORT_ID = port_station[j].PORT_ID; vid_118.PORT_INFO[j].PORT_TRANSFTER_STATE.PORT_TRANSFER_STATE = ((int)port_station[j].PORT_STATUS).ToString(); } s1f4.SV[i] = vid_118; } else { s1f4.SV[i] = new S6F11.RPTINFO.RPTITEM.VIDITEM_04(); } } TrxSECS.ReturnCode rtnCode = ISECSControl.replySECS(bcfApp, s1f4); SCUtility.secsActionRecordMsg(scApp, false, s1f4); } catch (Exception ex) { logger.Error("MESDefaultMapAction has Error[Line Name:{0}],[Error method:{1}],[Error Message:{2}", line.LINE_ID, "S1F3_Receive_Eqpt_Stat_Req", ex.ToString()); } }
public void add(DBConnection_EF con, ACMD_MCS rail) { con.ACMD_MCS.Add(rail); con.SaveChanges(); }