/// <summary> /// 判断车辆是否跑位位 /// </summary> /// <returns></returns> public bool CheckCarInMoveOut(int hid) { if (dicErrorCode != null) { if (dicErrorCode.ContainsKey(hid)) { short startbit = 0; switch (hid) { case 11: startbit = 579; break; case 13: startbit = 1059; break; } List <CErrorCode> errs = dicErrorCode[hid]; CErrorCode code = errs.Find(ce => ce.StartBit == startbit); if (code != null) { if (code.CurrentValue == 1) { return(true); } } } } return(false); }
} // ShowLongParticipialForms (...) /* * protected void Preprocess (string sSearchString) * { * int i_Stress = Convert.ToInt32(true); // It should've been bool * if (Regex.IsMatch (sSearchString, (string)">")) * { * i_Stress = Convert.ToInt32(true); * } * else * { * i_Stress = Convert.ToInt32(true); // Test * } * sSearchString = sSearchString.Replace(">", ""); * if (Regex.IsMatch (sSearchString, (string)"\\-")) * { * string[] arr_Range = Regex.Split (sSearchString, (string)"([0-9]*)\\-([0-9]*)"); * long l_start_id = long.Parse(arr_Range[1]); * long l_end_id = long.Parse(arr_Range[2]); * m_LexPreprocessor.PrepareLexemes (l_start_id, l_end_id, i_Stress); * } * else * { * long l_lexeme_id = long.Parse (sSearchString); * m_LexPreprocessor.PrepareLexeme(l_lexeme_id, i_Stress); * } * * } // Preprocess (...) */ protected void ShowParseOutput() { int iWordform = 0, iPreviousID = -1; tabControl.TabPages.Clear(); if (null == m_Parser) { MessageBox.Show("Internal error: Parser object is null.", "Zal error", MessageBoxButtons.OK); return; } int iWordForm = 0; CWordFormManaged wordform = null; EM_ReturnCode eRet = (EM_ReturnCode)m_Parser.eGetFirstWordForm(ref wordform); if (CErrorCode.bError(eRet)) { MessageBox.Show("Error"); return; } if (EM_ReturnCode.H_NO_ERROR != eRet) { MessageBox.Show("Form not found"); return; } do { m_listWordForms.Add(wordform); AnalysisPanel ap = new AnalysisPanel(iWordform); // ap.Location = new System.Drawing.Point(0, iWordform * ap.Size.Height + 4); string sWordForm = wordform.sWordForm(); MarkStress(ref sWordForm, wordform); ap.sWordform = sWordForm; ap.sID = wordform.llLexemeId().ToString(); ap.eoPOS = wordform.ePos(); ap.eoAspect = wordform.eAspect(); ap.eoGender = wordform.eGender(); ap.eoCase = wordform.eCase(); ap.eoNumber = wordform.eNumber(); ap.eoAnimacy = wordform.eAnimacy(); ap.eoPerson = wordform.ePerson(); ap.eoReflexiveness = wordform.eReflexive(); ap.eoSubparadigm = wordform.eSubparadigm(); iWordform = 0; iPreviousID = (int)wordform.llLexemeId(); TabPage tab_Lexeme = new TabPage(wordform.sWordForm()); // tab_Lexeme.Text = wordform.sWordForm(); tab_Lexeme.AutoScroll = true; tab_Lexeme.Controls.Add(ap); tabControl.TabPages.Add(tab_Lexeme); tab_Lexeme.Show(); tab_Lexeme.Focus(); ++iWordform; ap.Show(); eRet = (EM_ReturnCode)m_Parser.eGetNextWordForm(ref wordform); } while (EM_ReturnCode.H_NO_ERROR == eRet); } // ShowParseOutput()
/// <summary> /// 判断是否可接收新指令 /// </summary> /// <param name="hallID">设备ID</param> /// <returns></returns> public bool CheckAcceptNewCommand(int scNo) { #region if (dicErrorCode != null) { if (dicErrorCode.ContainsKey(scNo)) { short startbit = 0; switch (scNo) { case 1: startbit = 240; break; case 2: startbit = 480; break; case 11: startbit = 720; break; case 12: startbit = 960; break; case 13: startbit = 1200; break; case 14: startbit = 1440; break; } List <CErrorCode> errs = dicErrorCode[scNo]; CErrorCode code = errs.Find(ce => ce.StartBit == startbit); if (code != null) { if (code.CurrentValue == 1) { return(true); } } } } return(false); #endregion }
} // ShowShortParticipialForms (...) protected void ShowLongParticipialForms(AdjPanel adjPanel, CLexemeManaged lexeme, EM_Subparadigm eoSpLong) { CWordFormManaged wf = null; EM_ReturnCode eRet = (EM_ReturnCode)lexeme.eGetFirstWordForm(ref wf); do { if (!CErrorCode.bError(eRet) && (eoSpLong == wf.eSubparadigm())) { string sKey = string.Empty; if (eoSpLong == wf.eSubparadigm() && EM_Number.NUM_SG == wf.eNumber()) { sKey = m_hashGender[wf.eGender()]; } sKey += m_hashCase[wf.eCase()]; sKey += (EM_Number.NUM_SG == wf.eNumber()) ? "Sg" : "Pl"; if (EM_Case.CASE_ACC == wf.eCase()) { if ((EM_Gender.GENDER_M == wf.eGender() && EM_Number.NUM_SG == wf.eNumber()) || (EM_Number.NUM_PL == wf.eNumber())) { sKey += (EM_Animacy.ANIM_YES == wf.eAnimacy()) ? "Anim" : "Inanim"; } } string sWordForm = wf.sWordForm(); MarkStress(ref sWordForm, wf); adjPanel.SetForm(sKey, sWordForm, wf.eStatus()); } eRet = (EM_ReturnCode)lexeme.eGetNextWordForm(ref wf); } while (EM_ReturnCode.H_NO_ERROR == eRet); } // ShowLongParticipialForms (...)
} // ShowLexemes() protected void ShowLexemeDetails(LexemeDataPanel ldpSource) { CLexemeManaged lexeme = m_hashLexemes[ldpSource]; try { lexeme.eGenerateParadigm(); } catch (Exception ex) { string sMsg = "ShowLexemeDetails: "; // MainLib.ZalError err = new MainLib.ZalError(); // sMsg += err.LastError; sMsg += ex.Message; MessageBox.Show(sMsg, "Error", MessageBoxButtons.OK); return; } TabPage tabPageDetails = new TabPage(lexeme.sSourceForm()); ArrayList al = m_lexemeToTabs[lexeme]; al.Add(tabPageDetails); string grSt = lexeme.sGraphicStem(); if ((EM_PartOfSpeech.POS_NOUN == lexeme.ePartOfSpeech()) || (EM_PartOfSpeech.POS_PRONOUN == lexeme.ePartOfSpeech()) || (EM_PartOfSpeech.POS_NUM == lexeme.ePartOfSpeech())) { NounPanel np = new NounPanel(); tabPageDetails.Controls.Add(np); np.sLexName = grSt; CWordFormManaged wf = null; EM_ReturnCode eRet = (EM_ReturnCode)lexeme.eGetFirstWordForm(ref wf); do { if (EM_ReturnCode.H_NO_ERROR != eRet) { continue; } string sKey = m_hashCase[wf.eCase()]; sKey += (wf.eNumber() == EM_Number.NUM_SG) ? "Sg" : "Pl"; string sWordForm = wf.sWordForm(); MarkStress(ref sWordForm, wf); np.SetForm(sKey, sWordForm, wf.eStatus()); eRet = (EM_ReturnCode)lexeme.eGetNextWordForm(ref wf); } while (EM_ReturnCode.H_NO_ERROR == eRet); } if (EM_PartOfSpeech.POS_ADJ == lexeme.ePartOfSpeech() || EM_PartOfSpeech.POS_PRONOUN_ADJ == lexeme.ePartOfSpeech() || EM_PartOfSpeech.POS_NUM_ADJ == lexeme.ePartOfSpeech()) { AdjPanel ap = new AdjPanel(); tabPageDetails.Controls.Add(ap); CWordFormManaged wf = null; EM_ReturnCode eRet = (EM_ReturnCode)lexeme.eGetFirstWordForm(ref wf); do { if (CErrorCode.bError(eRet)) { continue; } string sKey = ""; if (EM_Subparadigm.SUBPARADIGM_LONG_ADJ == wf.eSubparadigm()) { if (EM_Number.NUM_SG == wf.eNumber()) { sKey = m_hashGender[wf.eGender()]; } sKey += m_hashCase[wf.eCase()]; sKey += (EM_Number.NUM_SG == wf.eNumber()) ? "Sg" : "Pl"; if (EM_Case.CASE_ACC == wf.eCase()) { if ((EM_Gender.GENDER_M == wf.eGender() && EM_Number.NUM_SG == wf.eNumber()) || (EM_Number.NUM_PL == wf.eNumber())) { sKey += (EM_Animacy.ANIM_YES == wf.eAnimacy()) ? "Anim" : "Inanim"; } } string sWordForm = wf.sWordForm(); MarkStress(ref sWordForm, wf); ap.SetForm(sKey, sWordForm, wf.eStatus()); } if (EM_Subparadigm.SUBPARADIGM_SHORT_ADJ == wf.eSubparadigm()) { sKey = "Short"; if (EM_Number.NUM_SG == wf.eNumber()) { sKey += m_hashGender[wf.eGender()]; } sKey += m_hashNumber[wf.eNumber()]; string sWordForm = wf.sWordForm(); MarkStress(ref sWordForm, wf); ap.SetForm(sKey, sWordForm, wf.eStatus()); } if (EM_Subparadigm.SUBPARADIGM_COMPARATIVE == wf.eSubparadigm()) { sKey = "Comparative"; string sWordForm = wf.sWordForm(); MarkStress(ref sWordForm, wf); ap.SetForm(sKey, sWordForm, wf.eStatus()); } eRet = (EM_ReturnCode)lexeme.eGetNextWordForm(ref wf); } while (EM_ReturnCode.H_NO_ERROR == eRet); } // if (MainLib.EM_PartOfSpeech.POS_ADJ == lexeme.ePartOfSpeech()) if (EM_PartOfSpeech.POS_VERB == lexeme.ePartOfSpeech()) { VerbPanel vp = new VerbPanel(lexeme); SubscribeToVerbEvents(vp); tabPageDetails.Controls.Add(vp); vp.sLexName = grSt; CWordFormManaged wf = null; EM_ReturnCode eRet = (EM_ReturnCode)lexeme.eGetFirstWordForm(ref wf); string sWordForm = wf.sWordForm(); do { if (CErrorCode.bError(eRet)) { continue; } EM_Subparadigm eSubparadigm = wf.eSubparadigm(); switch (eSubparadigm) { case EM_Subparadigm.SUBPARADIGM_PRESENT_TENSE: { string sKey = "Pres" + m_hashPerson[wf.ePerson()]; sKey += (wf.eNumber() == EM_Number.NUM_SG) ? "Sg" : "Pl"; MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); break; } case EM_Subparadigm.SUBPARADIGM_PAST_TENSE: { string sKey = "Past"; if (EM_Number.NUM_SG == wf.eNumber()) { sKey += m_hashGender[wf.eGender()]; } sKey += (wf.eNumber() == EM_Number.NUM_SG) ? "Sg" : "Pl"; MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); break; } case EM_Subparadigm.SUBPARADIGM_INFINITIVE: { string sKey = "Infinitive"; MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); break; } case EM_Subparadigm.SUBPARADIGM_IMPERATIVE: { string sKey = "Imperative"; sKey += (wf.eNumber() == EM_Number.NUM_SG) ? "Sg" : "Pl"; MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); break; } case EM_Subparadigm.SUBPARADIGM_PART_PRES_ACT: { string sKey = "PartPresActive"; if (wf.eNumber() == EM_Number.NUM_SG && wf.eGender() == EM_Gender.GENDER_M && wf.eCase() == EM_Case.CASE_NOM) { MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); } break; } case EM_Subparadigm.SUBPARADIGM_PART_PAST_ACT: { string sKey = "PartPastActive"; if (wf.eNumber() == EM_Number.NUM_SG && wf.eGender() == EM_Gender.GENDER_M && wf.eCase() == EM_Case.CASE_NOM) { MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); } break; } case EM_Subparadigm.SUBPARADIGM_ADVERBIAL_PRESENT: { MarkStress(ref sWordForm, wf); vp.SetForm("PresAdverbial", sWordForm, wf.eStatus()); break; } case EM_Subparadigm.SUBPARADIGM_ADVERBIAL_PAST: { MarkStress(ref sWordForm, wf); vp.SetForm("PastAdverbial", sWordForm, wf.eStatus()); break; } case EM_Subparadigm.SUBPARADIGM_PART_PRES_PASS_LONG: { string sKey = "PartPresPassive"; if (wf.eNumber() == EM_Number.NUM_SG && wf.eGender() == EM_Gender.GENDER_M && wf.eCase() == EM_Case.CASE_NOM) { MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); } break; } case EM_Subparadigm.SUBPARADIGM_PART_PAST_PASS_LONG: { string sKey = "PartPastPassive"; if (wf.eNumber() == EM_Number.NUM_SG && wf.eGender() == EM_Gender.GENDER_M && wf.eCase() == EM_Case.CASE_NOM) { MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); } break; } } // switch... eRet = (EM_ReturnCode)lexeme.eGetNextWordForm(ref wf); sWordForm = wf.sWordForm(); } while (EM_ReturnCode.H_NO_ERROR == eRet); } // if (EM_PartOfSpeech.POS_VERB == lexeme.ePartOfSpeech()) tabControl.Controls.Add(tabPageDetails); tabControl.SelectedTab = tabPageDetails; } // ShowLexemeDetails (...)
} // GetDbPath() private void ShowLexemes() { int iNumLexemes = 0; if (m_Dictionary.eCountLexemes(ref iNumLexemes) != EM_ReturnCode.H_NO_ERROR) { MessageBox.Show(this, "Not in the dictionary.", "Zal Synthesizer"); return; } TabPage tabPageLexemes = new TabPage(m_sSearchString); tabPageLexemes.AutoScroll = true; LexemeDataPanel ldpFocused = null; int iLexeme = 0; CLexemeManaged lex = null; EM_ReturnCode eRet = (EM_ReturnCode)m_Dictionary.eGetFirstLexeme(ref lex); do { if (CErrorCode.bError(eRet)) { continue; } if (eRet != EM_ReturnCode.H_NO_ERROR) { MessageBox.Show(this, "Unable to retrieve lexeme data.", "Zal Synthesizer"); return; } if (lex.sSourceForm() == m_sSearchString) { LexemeDataPanel ldp = new LexemeDataPanel(); m_hashLexemes.Add(ldp, lex); SubscribeToLexemeEvents(ldp); ldp.Location = new System.Drawing.Point(0, iLexeme * ldp.Size.Height + 4); ldp.sInitialForm = lex.sSourceForm(); ldp.sGraphicStem = lex.sGraphicStem(); ldp.iInflectionId = lex.iInflectionId(); ldp.sMainSymbol = lex.sMainSymbol(); ldp.sType = lex.iType().ToString(); ldp.sStressType = (m_hashAccent[lex.eAccentType1()].ToString()); if (lex.eAccentType2() != EM_AccentType.AT_UNDEFINED) { ldp.sStressType += "/" + m_hashAccent[lex.eAccentType2()]; } tabPageLexemes.Controls.Add(ldp); ldp.Left += 20; ldp.Top += 20; if (0 == iLexeme) { ldpFocused = ldp; } ArrayList alTabs = new ArrayList(); m_lexemeToTabs.Add(lex, alTabs); ++iLexeme; } eRet = (EM_ReturnCode)m_Dictionary.eGetNextLexeme(ref lex); } while (EM_ReturnCode.H_NO_ERROR == eRet); tabControl.Controls.Add(tabPageLexemes); tabControl.SelectTab(tabPageLexemes); ldpFocused.FocusShowButton(); } // ShowLexemes()
private void InitAllStatValue() { try { CErrorCode[] errCode = Program.mng.GetErrorCodesOfEqpID(11); if (errCode != null) { foreach (Control cc in hall1CC) { CErrorCode err = Array.Find(errCode, (a => a.StartBit == Convert.ToInt16(cc.Name.Substring(1)))); if (err != null) { switch (err.Color) { case 4: cc.BackColor = Color.Cyan; break; case 1: cc.BackColor = Color.Red; break; case 2: cc.BackColor = Color.Yellow; break; case 3: cc.BackColor = Color.Lime; break; } } else { cc.BackColor = Color.SteelBlue; } } } CErrorCode[] errors = Program.mng.GetErrorCodesOfEqpID(12); if (errors != null) { foreach (Control cc in hall2CC) { CErrorCode err = Array.Find(errors, (e => e.StartBit == Convert.ToInt16(cc.Name.Substring(1)))); if (err != null) { switch (err.Color) { case 4: cc.BackColor = Color.Cyan; break; case 3: cc.BackColor = Color.Lime; break; case 2: cc.BackColor = Color.Yellow; break; case 1: cc.BackColor = Color.Red; break; } } else { cc.BackColor = Color.SteelBlue; } } } CErrorCode[] errors3 = Program.mng.GetErrorCodesOfEqpID(13); if (errors3 != null) { foreach (Control cc in hall3CC) { CErrorCode err = Array.Find(errors3, (e => e.StartBit == Convert.ToInt16(cc.Name.Substring(1)))); if (err != null) { switch (err.Color) { case 4: cc.BackColor = Color.Cyan; break; case 3: cc.BackColor = Color.Lime; break; case 2: cc.BackColor = Color.Yellow; break; case 1: cc.BackColor = Color.Red; break; } } else { cc.BackColor = Color.SteelBlue; } } } CErrorCode[] errors4 = Program.mng.GetErrorCodesOfEqpID(14); if (errors4 != null) { foreach (Control cc in hall4CC) { CErrorCode err = Array.Find(errors4, (e => e.StartBit == Convert.ToInt16(cc.Name.Substring(1)))); if (err != null) { switch (err.Color) { case 4: cc.BackColor = Color.Cyan; break; case 3: cc.BackColor = Color.Lime; break; case 2: cc.BackColor = Color.Yellow; break; case 1: cc.BackColor = Color.Red; break; } } else { cc.BackColor = Color.SteelBlue; } } } CErrorCode[] codes = Program.mng.GetErrorCodesOfEqpID(1); if (codes != null) { foreach (Control cc in Etv1CC) { CErrorCode er = Array.Find(codes, (e => e.StartBit == Convert.ToInt16(cc.Name.Substring(1)))); if (er != null) { switch (er.Color) { case 4: cc.BackColor = Color.Cyan; break; case 3: cc.BackColor = Color.Lime; break; case 2: cc.BackColor = Color.Yellow; break; case 1: cc.BackColor = Color.Red; break; } } else { cc.BackColor = Color.SteelBlue; } } } CErrorCode[] codes2 = Program.mng.GetErrorCodesOfEqpID(2); if (codes2 != null) { foreach (Control cc in Etv2CC) { CErrorCode er = Array.Find(codes2, (e => e.StartBit == Convert.ToInt16(cc.Name.Substring(1)))); if (er != null) { switch (er.Color) { case 4: cc.BackColor = Color.Cyan; break; case 3: cc.BackColor = Color.Lime; break; case 2: cc.BackColor = Color.Yellow; break; case 1: cc.BackColor = Color.Red; break; } } else { cc.BackColor = Color.SteelBlue; } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void updateStatusInfo() { try { if (tabControl1.SelectedTab == tabPageH1) //HALL1 { CErrorCode[] errCode = Program.mng.GetErrorCodesOfEqpID(11); if (errCode != null) { foreach (Control cc in hall1CC) { CErrorCode err = Array.Find(errCode, (a => a.StartBit == Convert.ToInt16(cc.Name.Substring(1)))); if (err != null) { switch (err.Color) { case 4: cc.BackColor = Color.Cyan; break; case 1: cc.BackColor = Color.Red; break; case 2: cc.BackColor = Color.Yellow; break; case 3: cc.BackColor = Color.Lime; break; } } else { cc.BackColor = Color.SteelBlue; } } } CErrorCode[] errors = Program.mng.GetErrorCodesOfEqpID(12); if (errors != null) { foreach (Control cc in hall2CC) { CErrorCode err = Array.Find(errors, (e => e.StartBit == Convert.ToInt16(cc.Name.Substring(1)))); if (err != null) { switch (err.Color) { case 4: cc.BackColor = Color.Cyan; break; case 3: cc.BackColor = Color.Lime; break; case 2: cc.BackColor = Color.Yellow; break; case 1: cc.BackColor = Color.Red; break; } } else { cc.BackColor = Color.SteelBlue; } } } } else if (tabControl1.SelectedTab == tabPageH3) { CErrorCode[] errors3 = Program.mng.GetErrorCodesOfEqpID(13); if (errors3 != null) { foreach (Control cc in hall3CC) { CErrorCode err = Array.Find(errors3, (e => e.StartBit == Convert.ToInt16(cc.Name.Substring(1)))); if (err != null) { switch (err.Color) { case 4: cc.BackColor = Color.Cyan; break; case 3: cc.BackColor = Color.Lime; break; case 2: cc.BackColor = Color.Yellow; break; case 1: cc.BackColor = Color.Red; break; } } else { cc.BackColor = Color.SteelBlue; } } } CErrorCode[] errors4 = Program.mng.GetErrorCodesOfEqpID(14); if (errors4 != null) { foreach (Control cc in hall4CC) { CErrorCode err = Array.Find(errors4, (e => e.StartBit == Convert.ToInt16(cc.Name.Substring(1)))); if (err != null) { switch (err.Color) { case 4: cc.BackColor = Color.Cyan; break; case 3: cc.BackColor = Color.Lime; break; case 2: cc.BackColor = Color.Yellow; break; case 1: cc.BackColor = Color.Red; break; } } else { cc.BackColor = Color.SteelBlue; } } } } else if (tabControl1.SelectedTab == tabPageEtv1) { CErrorCode[] codes = Program.mng.GetErrorCodesOfEqpID(1); if (codes != null) { foreach (Control cc in Etv1CC) { CErrorCode er = Array.Find(codes, (e => e.StartBit == Convert.ToInt16(cc.Name.Substring(1)))); if (er != null) { switch (er.Color) { case 4: cc.BackColor = Color.Cyan; break; case 3: cc.BackColor = Color.Lime; break; case 2: cc.BackColor = Color.Yellow; break; case 1: cc.BackColor = Color.Red; break; } } else { cc.BackColor = Color.SteelBlue; } } } } else if (tabControl1.SelectedTab == tabPageEtv2) { CErrorCode[] codes = Program.mng.GetErrorCodesOfEqpID(2); if (codes != null) { foreach (Control cc in Etv2CC) { CErrorCode er = Array.Find(codes, (e => e.StartBit == Convert.ToInt16(cc.Name.Substring(1)))); if (er != null) { switch (er.Color) { case 4: cc.BackColor = Color.Cyan; break; case 3: cc.BackColor = Color.Lime; break; case 2: cc.BackColor = Color.Yellow; break; case 1: cc.BackColor = Color.Red; break; } } else { cc.BackColor = Color.SteelBlue; } } } } } catch (Exception ex) { MessageBox.Show("更新报警信息异常:" + ex.ToString()); } }