private void setSpecifyAdr() { try { if (!BCFUtility.isEmpty(InObservationVh.startAdr)) { uctl_Map.changeSpecifyAddressColor (InObservationVh.startAdr, CLR_MAP_ADDRESS_START); reqSelectionStartAdr = InObservationVh.startAdr; } if (!BCFUtility.isEmpty(InObservationVh.FromAdr)) { uctl_Map.changeSpecifyAddressColor (InObservationVh.FromAdr, CLR_MAP_ADDRESS_FROM); reqSelectionFromAdr = InObservationVh.FromAdr; } if (!BCFUtility.isEmpty(InObservationVh.ToAdr)) { uctl_Map.changeSpecifyAddressColor (InObservationVh.ToAdr, CLR_MAP_ADDRESS_TO); reqSelectionToAdr = InObservationVh.ToAdr; } } catch (Exception ex) { logger.Error(ex, "Exception"); } }
public virtual void TextValueChange(object sender, ValueChangedEventArgs args) { try { ValueRead vr = sender as ValueRead; BCFUtility.writeEquipmentLog(eqpt.EQPT_ID, new List <ValueRead> { vr }); string TestValue = (string)vr.getText(); eqpt.test = TestValue; TestWriteFun(); //node.DoorClosed = eqpt.DoorClosed && pair_eqpt.DoorClosed; //if (pair_eqpt != null) //{ // node.DoorClosed = eqpt.DoorClosed && pair_eqpt.DoorClosed; //} //else //{ // node.DoorClosed = eqpt.DoorClosed; //} } catch (Exception ex) { logger.Error(ex, "Exception"); } }
private void resetSpecifyAdr() { try { if (!BCFUtility.isEmpty(reqSelectionStartAdr)) { uctl_Map.changeSpecifyAddressColor (reqSelectionStartAdr, CLR_MAP_ADDRESS_DUFAULT); reqSelectionStartAdr = string.Empty; } if (!BCFUtility.isEmpty(reqSelectionFromAdr)) { uctl_Map.changeSpecifyAddressColor (reqSelectionFromAdr, CLR_MAP_ADDRESS_DUFAULT); reqSelectionFromAdr = string.Empty; } if (!BCFUtility.isEmpty(reqSelectionToAdr)) { uctl_Map.changeSpecifyAddressColor (reqSelectionToAdr, CLR_MAP_ADDRESS_DUFAULT); reqSelectionToAdr = string.Empty; } } catch (Exception ex) { logger.Error(ex, "Exception"); } }
private async void btn_Avoid_Click(object sender, EventArgs e) { string vehicle_id = cmb_Vehicle.Text; string avoid_adr = cmb_toAddress.Text; AVEHICLE vh = scApp.getEQObjCacheManager().getVehicletByVHID(vehicle_id); if (vh == null) { MessageBox.Show("No find vehile."); return; } if (BCFUtility.isEmpty(avoid_adr)) { MessageBox.Show("No find avoid address."); return; } (bool is_success, string result)resule = default((bool is_success, string result)); await Task.Run(() => { resule = scApp.VehicleService.Send.Avoid(vehicle_id, avoid_adr); }); if (resule.is_success) { MessageBox.Show("Avoid success", "Avoid success.", MessageBoxButtons.OK, MessageBoxIcon.None); } else { MessageBox.Show(resule.result, "Avoid fail.", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void Write(BCFApplication bcfApp, string eqObjIDCate, string eq_id, out ValueWrite vw_handshake) { vw_handshake = null; EQ_ID = eq_id; List <ValueWrite> listVW = new List <ValueWrite>(); foreach (FieldInfo info in fieldInfos) { PLCElement element = getPLCElementAttr(info); string value = string.Empty; UInt16[] ivalueArray = null; object valueObj = info.GetValue(this); if (valueObj is Enum) { value = ((int)valueObj).ToString(); } else if (valueObj is bool) { value = ((bool)valueObj) ? "1" : "0"; } else if (valueObj is UInt16[]) { ivalueArray = valueObj as UInt16[]; } else { object obj = info.GetValue(this); if (obj != null) { value = info.GetValue(this).ToString(); } } ValueWrite vw = null; vw = bcfApp.getWriteValueEvent(eqObjIDCate, eq_id, element.ValueName); if (valueObj is UInt16[]) { vw.setWriteValue(ivalueArray); } else { vw.setWriteValue(value); } if (element.IsHandshakeProp || element.IsIndexProp) { vw_handshake = vw; } else { ISMControl.writeDeviceBlock(bcfApp, vw); } listVW.Add(vw); } if (listVW.Count > 0) { BCFUtility.writeEquipmentLog(eq_id, listVW); } }
private void cmb_vh_id_SelectedIndexChanged(object sender, EventArgs e) { ComboBox combo = sender as ComboBox; if (combo == null) { return; } List <ListBoxItem> filterlistBoxItems; string select_vh_id = combo.Text; if (BCFUtility.isMatche(KEY_WORD_ALL, select_vh_id)) { filterlistBoxItems = AllListBoxItems; } else { filterlistBoxItems = new List <ListBoxItem>(); foreach (var item in AllListBoxItems) { if (item.VhIDs.Contains(select_vh_id)) { filterlistBoxItems.Add(item); } } } HistoricalReply.setPlayInfo(select_vh_id, filterlistBoxItems.Select(item => item.Index).ToArray()); SetListBox(filterlistBoxItems); FocusVehicle?.Invoke(this, select_vh_id); }
private void tmrRefresh_Tick(object sender, EventArgs e) { change_flag = !change_flag; if (!BCFUtility.isEmpty(current_SelectSegment)) { List <GroupRails> lstGroupRails = m_DicSegmentGroupRails[current_SelectSegment]; foreach (GroupRails groupRails in lstGroupRails) { groupRails.GroupColorChange(change_flag ? RailOriginalColor : Color.Yellow); } } if (current_FlashingSectionGroup != null && current_FlashingSectionGroup.Count() > 0) { foreach (string[] section_ids in current_FlashingSectionGroup) { foreach (string section_id in section_ids) { m_DicSectionGroupRails[section_id] .GroupColorChange(change_flag ? RailOriginalColor : Color.Yellow); } } } }
public virtual void Read(BCFApplication bcfApp, string eqObjIDCate, string eq_id) { List <ValueRead> listVR = new List <ValueRead>(); foreach (FieldInfo info in fieldInfos) { ValueRead vr = null; PLCElement element = getPLCElementAttr(info); if (bcfApp.tryGetReadValueEventstring(eqObjIDCate, EQ_ID, element.ValueName, out vr)) { if (info.FieldType == typeof(Int32)) { info.SetValue(this, Convert.ToInt32(vr.getText())); } else { info.SetValue(this, vr.getText()); } listVR.Add(vr); } else { } } if (listVR.Count > 0) { BCFUtility.writeEquipmentLog(eq_id, listVR); } }
public virtual void AliveChange(object sender, ValueChangedEventArgs args) { try { ValueRead vr = sender as ValueRead; BCFUtility.writeEquipmentLog(eqpt.EQPT_ID, new List <ValueRead> { vr }); Boolean alive = (Boolean)vr.getText(); eqpt.Is_Eq_Alive = alive; eqpt.Eq_Alive_Last_Change_time = DateTime.Now; //node.Is_Alive = eqpt.Is_Eq_Alive && pair_eqpt.Is_Eq_Alive; if (pair_eqpt != null) { node.Is_Alive = eqpt.Is_Eq_Alive && pair_eqpt.Is_Eq_Alive; } else { node.Is_Alive = eqpt.Is_Eq_Alive; } } catch (Exception ex) { logger.Error(ex, "Exception"); } }
public virtual void DoorCloseChange(object sender, ValueChangedEventArgs args) { try { ValueRead vr = sender as ValueRead; BCFUtility.writeEquipmentLog(eqpt.EQPT_ID, new List <ValueRead> { vr }); Boolean doorClosed = (Boolean)vr.getText(); eqpt.DoorClosed = doorClosed; //node.DoorClosed = eqpt.DoorClosed && pair_eqpt.DoorClosed; if (pair_eqpt != null) { node.DoorClosed = eqpt.DoorClosed && pair_eqpt.DoorClosed; } else { node.DoorClosed = eqpt.DoorClosed; } } catch (Exception ex) { logger.Error(ex, "Exception"); } }
public ALARM setAlarmReport(string nodeID, string eq_id, string error_code, string errorDesc) { lock (lock_obj_alarm) { if (IsAlarmExist(eq_id, error_code)) { return(null); } //AlarmMap alarmMap = alarmMapDao.getAlarmMap(eq_id, error_code); AlarmMap alarmMap = alarmMapDao.getAlarmMap(nodeID, error_code); string strNow = BCFUtility.formatDateTime(DateTime.Now, SCAppConstants.TimestampFormat_19); ALARM alarm = new ALARM() { EQPT_ID = eq_id, RPT_DATE_TIME = DateTime.Now, ALAM_CODE = error_code, ALAM_LVL = alarmMap == null ? E_ALARM_LVL.None : alarmMap.ALARM_LVL, ALAM_STAT = ProtocolFormat.OHTMessage.ErrorStatus.ErrSet, ALAM_DESC = alarmMap == null ? errorDesc : alarmMap.ALARM_DESC, }; if (SCUtility.isEmpty(alarm.ALAM_DESC)) { alarm.ALAM_DESC = $"Unknow error:{error_code}"; } using (DBConnection_EF con = DBConnection_EF.GetUContext()) { alarmDao.insertAlarm(con, alarm); CheckSetAlarm(); } return(alarm); } }
public string getLoginPassword() //A0.02 { if (BCFUtility.isMatche(uc_Exit.password_box.Password, "")) { TipMessage_Type_Light.Show("Failure", "Please input password.", BCAppConstants.WARN_MSG); } return(uc_Exit.password_box.Password); }
public virtual Boolean isAdmin() { if (BCFUtility.isMatche(ADMIN_FLG, SCAppConstants.YES_FLAG)) { return(true); } return(false); }
public virtual Boolean isDisable() { if (BCFUtility.isMatche(DISABLE_FLG, SCAppConstants.YES_FLAG)) { return(true); } return(false); }
/// <summary> /// Adds the alarm his. /// </summary> /// <param name="alarm">The alarm.</param> public virtual void addAlarmHis(ALARM alarm) { lock (alarmLock) { alarmList.Add(alarm); OnPropertyChanged(BCFUtility.getPropertyName(() => this.AlarmList)); } }
/// <summary> /// Gets the login password. /// </summary> /// <returns>System.String.</returns> public string getLoginPassword() { if (BCFUtility.isMatche(UserIDTBx.Text, "ADMIN")) { return("hello@123"); } return(PwdTBx.Text); }
public virtual Boolean isPowerUser() { if (BCFUtility.isMatche(POWER_USER_FLG, SCAppConstants.YES_FLAG)) { return(true); } return(isAdmin()); }
/// <summary> /// Resets the alarm his. /// </summary> /// <param name="dbAlarmList">The database alarm list.</param> public virtual void resetAlarmHis(List <ALARM> dbAlarmList) { lock (alarmLock) { alarmList.Clear(); alarmList.AddRange(dbAlarmList); OnPropertyChanged(BCFUtility.getPropertyName(() => this.AlarmList)); } }
/// <summary> /// Resets the lot list. /// </summary> /// <param name="dbLotList">The database lot list.</param> public virtual void resetLotList(List <ALOT> dbLotList) { lock (lotLock) { lotList.Clear(); lotList.AddRange(dbLotList); OnPropertyChanged(BCFUtility.getPropertyName(() => this.LotList)); } }
//EC Data /// <summary> /// Updates the system parameter. /// </summary> /// <param name="ecid">The ecid.</param> /// <param name="val">The value.</param> /// <param name="refreshSecsAgent">The refresh secs agent.</param> public void updateSystemParameter(string ecid, string val, Boolean refreshSecsAgent) { try { if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_CONVERSATION_TIMEOUT)) { SystemParameter.setSECSConversactionTimeout(Convert.ToInt16(val)); } else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_GEM_INITIAL_CONTROL_STATE)) { SystemParameter.setInitialHostMode(val); } else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_CONTROL_STATE_KEEPING_TIME)) { SystemParameter.setControlStateKeepTime(Convert.ToInt16(val)); } else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_HEARTBEAT)) { SystemParameter.setHeartBeatSec(Convert.ToInt32(val)); //Restart Timer ITimerAction timer = scApp.getBCFApplication().getTimerAction("SECSHeartBeat"); if (timer != null) { timer.start(); } } else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_DEVICE_ID)) { scApp.setSECSAgentDeviceID(Convert.ToInt32(val), refreshSecsAgent); } else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_T3)) { scApp.setSECSAgentT3Timeout(Convert.ToInt32(val), refreshSecsAgent); } else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_T5)) { scApp.setSECSAgentT5Timeout(Convert.ToInt32(val), refreshSecsAgent); } else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_T6)) { scApp.setSECSAgentT6Timeout(Convert.ToInt32(val), refreshSecsAgent); } else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_T7)) { scApp.setSECSAgentT7Timeout(Convert.ToInt32(val), refreshSecsAgent); } else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_T8)) { scApp.setSECSAgentT8Timeout(Convert.ToInt32(val), refreshSecsAgent); } } catch (Exception ex) { logger.Error(ex, "Exception:"); } }
public void start(SCApplication _app) { scApp = _app; Segments = scApp.MapBLL.loadAllSegments(); Sections = scApp.MapBLL.loadAllSection(); Addresses = scApp.MapBLL.loadAllAddress(); ReserveEnhanceInfosSections = scApp.ReserveEnhanceInfoDao.getReserveEnhanceInfoSections(scApp); TrafficControlInfos = scApp.TrafficControlInfoDao.getTrafficControlInfos(scApp); for (int i = 0; i < Addresses.Count; i++) { AADDRESS address = Addresses[i]; address.initialAddressType(); //address.initialSegmentID(scApp.SectionBLL); bool isReserveEnhanceAddress = GetReserveEnhanceInfo(address.ADR_ID) != null; if (isReserveEnhanceAddress && address.IsCoupler) { AADDRESS couplerAndReserveEnhanceAddress = new CouplerAndReserveEnhanceAddress(); BCFUtility.setValueToPropety(ref address, ref couplerAndReserveEnhanceAddress); setReserveEnhanceAddressInfo(couplerAndReserveEnhanceAddress); setCouplerTypeAddressInfo(couplerAndReserveEnhanceAddress); Addresses[i] = couplerAndReserveEnhanceAddress; } else if (address.IsCoupler) { AADDRESS couplerAddress = new CouplerAddress(); BCFUtility.setValueToPropety(ref address, ref couplerAddress); setCouplerTypeAddressInfo(couplerAddress); Addresses[i] = couplerAddress; } else if (isReserveEnhanceAddress) { AADDRESS couplerAndReserveEnhanceAddress = new ReserveEnhanceAddress(); BCFUtility.setValueToPropety(ref address, ref couplerAndReserveEnhanceAddress); setReserveEnhanceAddressInfo(couplerAndReserveEnhanceAddress); Addresses[i] = couplerAndReserveEnhanceAddress; } } foreach (ASECTION section in Sections) { section.setOnSectionAddress(scApp.AddressesBLL); } foreach (ASEGMENT segment in Segments) { segment.SetSectionList(scApp.SectionBLL); } CommonInfo = new CommonInfo(); initialCommunationInfo(); }
public ALARM setAlarmReport(string node_id, string eq_id, string error_code) { lock (lock_obj_alarm) { if (IsAlarmExist(eq_id, error_code)) { return(null); } string alarmUnitType = "OHCV"; if (scApp.TransferService.isUnitType(eq_id, Service.UnitType.AGV)) { alarmUnitType = "AGV STATION"; } if (scApp.TransferService.isUnitType(eq_id, Service.UnitType.CRANE)) { alarmUnitType = "CRANE"; } AlarmMap alarmMap = alarmMapDao.getAlarmMap(alarmUnitType, error_code); if (alarmMap == null) { scApp.TransferService.TransferServiceLogger.Info ( DateTime.Now.ToString("HH:mm:ss.fff ") + "OHT >> OHB|AlarmMap 不存在:" + " EQ_Name:" + eq_id + " Error_code:" + error_code ); } string strNow = BCFUtility.formatDateTime(DateTime.Now, SCAppConstants.TimestampFormat_19); ALARM alarm = new ALARM() { EQPT_ID = eq_id, RPT_DATE_TIME = strNow, ALAM_CODE = error_code, ALAM_LVL = alarmMap == null ? E_ALARM_LVL.Warn : alarmMap.ALARM_LVL, ALAM_STAT = ProtocolFormat.OHTMessage.ErrorStatus.ErrSet, ALAM_DESC = alarmMap == null ? $"unknow alarm code:{error_code}" : $"{alarmMap.ALARM_DESC}(error code:{error_code})", ERROR_ID = error_code, //alarmMap?.ALARM_ID ?? "0", UnitID = eq_id, UnitState = "1", }; using (DBConnection_EF con = DBConnection_EF.GetUContext()) { alarmDao.insertAlarm(con, alarm); CheckSetAlarm(); } return(alarm); } }
public string getLoginPassword() { if (BCFUtility.isMatche(password_box.Password, "")) { //TipMessage.Show("Please input password."); TipMessage_Type.Show("Please input password.", BCAppConstants.WARN_MSG); } return(password_box.Password); }
public void resetRailColor(string SelectSegment) { if (!BCFUtility.isEmpty(SelectSegment)) { foreach (GroupRails groupRails in m_DicSegmentGroupRails[SelectSegment.Trim()]) { groupRails.GroupColorChange(RailOriginalColor); } } }
public bool resetHandshake(BCFApplication bcfApp, string eqObjIDCate, string eq_id) { ValueWrite handshake_vw = getValueWriteHandshake(bcfApp, eqObjIDCate, eq_id); List <ValueWrite> vws = new List <ValueWrite>(); //A0.01 handshake_vw.initWriteValue(); vws.Add(handshake_vw); //A0.01 BCFUtility.writeEquipmentLog(eq_id, vws); //A0.01 return(ISMControl.writeDeviceBlock(bcfApp, handshake_vw)); }
private async void excuteScanCommand() { //string fromAdr = string.Empty; string vehicleId = string.Empty; string hostsource_portid = cmb_fromAddress.Text; string hostdest_portid = cmb_toAddress.Text; string from_adr = string.Empty; string to_adr = string.Empty; string cmd_id = string.Empty; string cst_id = txt_cstID.Text; string box_id = "box_id"; string lot_id = "lot_id"; E_VH_TYPE vh_type = E_VH_TYPE.None; vehicleId = SCUtility.Trim(cmb_Vehicle.Text, true); scApp.PortDefBLL.getAddressID(hostsource_portid, out from_adr, out vh_type); cmd_id = scApp.SequenceBLL.getCommandID(SCAppConstants.GenOHxCCommandType.Manual); if (BCFUtility.isEmpty(vehicleId)) { MessageBox.Show("No find vehile."); return; } if (BCFUtility.isEmpty(cst_id)) { MessageBox.Show("cst id can't empty."); return; } AVEHICLE vh = scApp.getEQObjCacheManager().getVehicletByVHID(vehicleId); sc.BLL.CMDBLL.OHTCCommandCheckResult check_result_info = null; await Task.Run(() => { //if (SCUtility.isMatche(vh.CUR_ADR_ID, fromAdr)) //{ // scApp.VehicleService.TransferRequset(vehicleId, cmd_id, ActiveType.Scan, "CST02", new string[0], new string[0], fromAdr, ""); //} //else { //scApp.CMDBLL.doCreatTransferCommand(vehicleId, string.Empty, "CST06", scApp.CMDBLL.doCreatTransferCommand(vehicleId, string.Empty, cst_id, E_CMD_TYPE.Scan, hostsource_portid, "", 0, 0, box_id, lot_id, from_adr); check_result_info = sc.BLL.CMDBLL.getCallContext <sc.BLL.CMDBLL.OHTCCommandCheckResult> (sc.BLL.CMDBLL.CALL_CONTEXT_KEY_WORD_OHTC_CMD_CHECK_RESULT); } }); if (check_result_info != null && !check_result_info.IsSuccess) { MessageBox.Show(check_result_info.ToString(), "Command create fail.", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void init() { //註冊監聽事件 commonInfo.addEventHandler(HandlerID, BCFUtility.getPropertyName(() => commonInfo.MPCTipMsgList), (s1, e1) => refreshTable()); //取得MPC Tip Messages,並載入到Tip Message DGV //this.m_TipMsgDGV.DataSource dataBS.DataSource = commonInfo.MPCTipMsgList; m_TipMsgDGV.DataSource = dataBS; dataBS.ResetBindings(false); }
private void initialMapSpace() { if (BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_ASE)) { space_Height_m = 14000; space_Width_m = 40000; zoon_Factor = 100; defaultMaxScale = 10; trackBar_scale.SmallChange = 2; } else if (BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_ASE_LOOP)) { space_Height_m = 14000; space_Width_m = 53000; zoon_Factor = 100; defaultMaxScale = 10; trackBar_scale.SmallChange = 2; } else if (BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_ASE_LINE3)) { space_Height_m = 14000; space_Width_m = 50000; zoon_Factor = 100; defaultMaxScale = 10; trackBar_scale.SmallChange = 2; } else if (BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_ASE_TEST)) { space_Height_m = 14000; space_Width_m = 40000; zoon_Factor = 100; defaultMaxScale = 10; trackBar_scale.SmallChange = 2; } else { space_Height_m = 14000; space_Width_m = 40000; zoon_Factor = 100; defaultMaxScale = 10; } trackBar_scale.Maximum = defaultMaxScale; trackBar_scale.Value = defaultMaxScale; lbl_maxScale.Text = defaultMaxScale.ToString(); //BCUtility.setScale(trackBar_scale.Value); BCUtility.setScale(10, zoon_Factor); double space_Height_PixelsHeight = BCUtility.RealLengthToPixelsWidthByScale(space_Height_m); double space_Height_PixelsWidth = BCUtility.RealLengthToPixelsWidthByScale(space_Width_m); pnl_Map.Height = (int)space_Height_PixelsHeight; pnl_Map.Width = (int)space_Height_PixelsWidth; this.pnl_Map.Resize += new System.EventHandler(this.pnl_Map_Resize); pnl_Map.Tag = pnl_Map.Height + "|" + pnl_Map.Width; }
/// <summary> /// Removes the lot by identifier. /// </summary> /// <param name="lot_id">The lot_id.</param> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> public virtual bool removeLotByID(string lot_id) { ALOT lot = lotList.Where(l => l.LOT_ID.Trim() == lot_id.Trim()).SingleOrDefault(); if (lot == null) { return(false); } lotList.Remove(lot); OnPropertyChanged(BCFUtility.getPropertyName(() => this.lotList)); return(true); }
public void addMPCTipMsg(MPCTipMessage mpcTipMsg) { lock (mpcTipMsgList) { if (mpcTipMsgList.Count > MAX_MPC_TIP_MSG_COUNT) { mpcTipMsgList.RemoveAt(mpcTipMsgList.Count - 1); } mpcTipMsgList.Insert(0, mpcTipMsg); OnPropertyChanged(BCFUtility.getPropertyName(() => this.MPCTipMsgList)); } }