private void AfterConstruct(MainF xMF) { xMainF = xMF; xNSI = xMF.xNSI; nDocType = (int)(xMF.xDLLAPars[0]); //DataRow drP = (DataRow)(xMF.xDLLAPars[1]); //drParent = drP; // BD_DOUTD drParent = (DataRow)(xMF.xDLLAPars[1]); // dvB = xNSI.dsM.Relations[NSI.REL2BRK].ChildTable.DefaultView; dvB.RowFilter = String.Format("SYSN={0} AND ID={1}", drParent["SYSN"], drParent["ID"]); lHeadB.Text = "Брак (" + drParent["KRKMC"].ToString() + ")"; tNameProdB.Text = (string)drParent["SNM"]; // Мест и единиц по накладной nMaxMest = (int)drParent["KOLM"]; fMaxEd = (FRACT)drParent["KOLE"]; fEmk = (FRACT)drParent["EMK"]; EvalTotal(); lMaxM.Text = nMaxMest.ToString(); lMaxE.Text = fMaxEd.ToString(); SetBindBrak(drParent); // Настройки грида dgBrak.SuspendLayout(); dgBrak.DataSource = bsB; BrakStyle(dgBrak); dgBrak.ResumeLayout(); // Включить TouchScreen xMainF.xBCScanner.TouchScr(true); if (bsB.Count == 0) { CreateNew(); if (nDocType == AppC.TYPD_BRK) { // Мест tKolMB.Text = lMaxM.Text; tKolMB.DataBindings[0].WriteValue(); // Единиц tKolEB.Text = lMaxE.Text; tKolEB.DataBindings[0].WriteValue(); } BeginEditB(); } else { dgBrak.Enabled = true; dgBrak.Focus(); bsB.ResetBindings(false); } }
static void Main(string[] args) { // XimiaEGE.MainF.DownloadBD(messenge:Console.WriteLine); // /* Console.WriteLine(); if (MainF.LoadData()) { Console.WriteLine("Yes"); } Console.WriteLine(XimiaEGE.MainF.Bd.Patch); // /* List <string> vs = new List <string>(0); foreach (var Elem in MainF.Bd.months[0].vars) { vs.Add(Elem.varOtvet.Id); } Console.WriteLine(MainF.GetHtmlReshenie(new List <uint> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 }, vs.ToArray(), null, true)); // */ while (true) { Console.ReadKey(); } }
//public Kompl(MainF x, FuncDic xF, int nFCh) private void AfterConstruct(MainF x) { xMF = x; xNSI = xMF.xNSI; xFuncs = x.xFuncs; nFuncCh = (int)x.xDLLPars; this.lHeadKompl.Text = (nFuncCh == AppC.F_LOADKPL) ? "Комплектация поддонов" : "Отгрузка поддонов"; dgZkz.SuspendLayout(); KomplStyle(dgZkz); dgZkz.DataSource = xNSI.DT[NSI.BD_KMPL].dt; dgZkz.ResumeLayout(); Binding bi = new Binding("Text", xNSI.DT[NSI.BD_KMPL].dt, "PP_NAME"); //bi.ControlUpdateMode = ControlUpdateMode.OnPropertyChanged; //bi.DataSourceUpdateMode = DataSourceUpdateMode.Never; //bi.FormattingEnabled = true; //bi.Format += new ConvertEventHandler(bi_Format); bi.DataSourceUpdateMode = DataSourceUpdateMode.Never; tPolName.DataBindings.Add(bi); tLstUch.Text = xMF.xSm.LstUchKompl; dgZkz.Focus(); }
/// <summary> /// byte 数据类型 /// </summary> public static void CleardtcByByte() { Byte[] byte4 = new Byte[8]; byte4[0] = 0x31; byte4[1] = 0x34; byte4[2] = 0x66; byte4[3] = 0x66; byte4[4] = 0x30; byte4[5] = 0x30; byte4[6] = 0x0D; byte4[7] = 0x0A; GobalSerialPort.WriteByMessage(CommonCmd.ATST00, 0, CommonCmd.ATST00.Length); Thread.Sleep(400); GobalSerialPort.WriteByMessage(byte4, 0, byte4.Length); Thread.Sleep(400); string backresult = GobalSerialPort.ResultBackString; if (backresult.Contains("54") && backresult.Contains("FF") && backresult.Contains("00")) { MainF.ShowBoxTex("清除故障成功!"); // return; } MainF.ShowBoxTex("清除故障成功!"); GobalSerialPort.WriteByMessage(CommonCmd.ATST0F, 0, CommonCmd.ATST0F.Length); }
private void AfterConstruct(MainF xF) { xNSI = xF.xNSI; xSm = xF.xSm; nCurReg = (int)xF.xDLLPars; // центровка формы Rectangle screen = Screen.PrimaryScreen.Bounds; this.Location = new Point((screen.Width - this.Width) / 2, (screen.Height - this.Height) / 2); SetBindSmenaPars(); SetAvtFields(); if (xMF.evReadNSI != null) {// загрузку НСИ выполнять параллельно авторизации xTh = new Thread(new ThreadStart(ReadLocNSI)); xTh.Priority = ThreadPriority.Lowest; xTh.Start(); } if (nCurReg != AppC.AVT_PARS) {// парметры изменяются только с клавиатуры ehScan = new BarcodeScanner.BarcodeScanEventHandler(OnScanBage); xMF.xBCScanner.BarcodeScan += ehScan; } else { xOldSm.nSklad = xSm.nSklad; xOldSm.nUch = xSm.nUch; xOldSm.sDatDoc = xSm.DocData; xOldSm.nReg = xSm.RegApp; } BeginEditAvt(nCurReg); }
/// <summary> /// 读取行程记录仪 /// </summary> public void ReadFtrip() { try { CommonCmd.SendATE1(); // EcuVersionF.EcuVsion = "P1287770"; if (EcuVersionF.EcuVsion == null) { MainF.ShowBoxTex("未能读取ECU版本号"); return; } GetCmdFormDb(EcuVersionF.EcuVsion); SendData(); Work_OutoneStep(); WorkOut_TimerAndCounter(); _1Dimensional_Maps(); _2Dimensional_Maps(); ShowTripRecord();//先清除数据,然后重新填充 SaveFileFunction.Tp_SaveExcel(); MainF.ShowBoxTex("读完数据"); } catch (Exception e) { log.Info("tp read this is exception" + e.Message); } }
// разбор параметров от главной формы private void AfterConstruct(object xx) { object[] x = (object[])xx; try { xMF = (MainF)(x[0]); bAutoMark = (bool)(x[1]); } catch { } xNSI = xMF.xNSI; //ehOldScan = new BarcodeScanner.BarcodeScanEventHandler(OnScanPL); ehOldScan = new BarcodeScanner.BarcodeScanEventHandler(OnScan); xMF.xBCScanner.BarcodeScan += ehOldScan; xHelpS = new Srv.HelpShow(this); lstHelp = new List <string>(new string[] { xMF.xFuncs.TryGetFuncKeys(AppC.F_UPLD_DOC).PadRight(CMD_SIGHN) + " - выгрузка сведений", xMF.xFuncs.TryGetFuncKeys(AppC.F_CHG_REC).PadRight(CMD_SIGHN) + " - новая паллетта", "->,<-".PadRight(CMD_SIGHN) + " - смена емкости", xMF.xFuncs.TryGetFuncKeys(AppC.F_EASYEDIT).PadRight(CMD_SIGHN) + " - новый документ", xMF.xFuncs.TryGetFuncKeys(AppC.F_LOAD_DOC).PadRight(CMD_SIGHN) + " - стрейчевание", xMF.xFuncs.TryGetFuncKeys(AppC.F_A4MOVE).PadRight(CMD_SIGHN) + " - режим стрейч", xMF.xFuncs.TryGetFuncKeys(AppC.F_KMCINF).PadRight(CMD_SIGHN) + " - без WMS", xMF.xFuncs.TryGetFuncKeys(AppC.F_QUIT).PadRight(CMD_SIGHN) + " - выход", xMF.xFuncs.TryGetFuncKeys(AppC.F_MARKWMS).PadRight(CMD_SIGHN) + " - возврат в главную" }); //System.Reflection.AssemblyName xAN = System.Reflection.Assembly.GetExecutingAssembly().GetName(); //string sV = xAN.Version.ToString(); //int nPoint = sV.LastIndexOf("."); //lHelp.Text = String.Format("<F1> - помощь v{0}", sV.Substring(nPoint)); xMF.CheckNSIState(false); this.Tag = null; // номер ID-точки tDevID.Text = sDevID = Smena.EnterPointID; chNewDoc.Checked = (sDevID.Length > 0)?false:true; enWrapMode = xMF.xPars.WrapMode; SetWrapp(); if (xMF.xPars.CanEditIDNum) { tDevID.Focus(); } else { tDevID.Enabled = false; if (sDevID.Length > 0) { MainCycleStart(sDevID, false); } } }
//private void Avtor_GotFocus(object sender, EventArgs e) //{ // int i = 99; // if (this.Tag != null) // { // xMF = ((MainF)this.Tag); // AfterConstruct(xMF); // this.Tag = null; // } //} private void Avtor_Load(object sender, EventArgs e) { if (this.Tag != null) { xMF = ((MainF)this.Tag); AfterConstruct(xMF); this.Tag = null; } }
public void AfterConstruct(MainF xM) { xMainF = xM; xNSI = xM.xNSI; // каждый раз все по-новой xMainF.aAvtoPark = null; nRegFixing = (int)xMainF.xDLLPars; xPark = new ParkA(nRegFixing); dvAvto = xNSI.DT[NSI.BD_SOTG].dt.DefaultView; SetBindShlyuz(); // Настройки грида dgShlyuz.SuspendLayout(); dgShlyuz.DataSource = bsSh; ShlzStyle(dgShlyuz); dgShlyuz.ResumeLayout(); ehOldScan = new BarcodeScanner.BarcodeScanEventHandler(OnScanPL); xMainF.xBCScanner.BarcodeScan += ehOldScan; if (xMainF.xSm.urCur >= Smena.USERRIGHTS.USER_BOSS_SKLAD) { tPropusk.Enabled = true; tShlAddr.Enabled = true; } if (xMainF.aAvtoPark == null) {// по умолчанию - прибытие //lHeadP.SuspendLayout(); lHeadP.BackColor = colCome; //lHeadP.ResumeLayout(); if (nRegFixing == AppC.FX_PTLST) { BeginEditP(null); } } else {// последней была операция прибытия xPark.DRCome = dvAvto.Table.NewRow(); xPark.DRCome.ItemArray = xMainF.aAvtoPark; bsSh.Filter = string.Format("ID={0}", xPark.DRCome["ID"]); bsSh.ResetBindings(false); dgShlyuz.Focus(); // сейчас предлагается убытие xPark.NShl = (int)xPark.DRCome["NSH"]; xPark.NPtvList = (int)xPark.DRCome["ND"]; xPark.NSm = int.Parse((string)xPark.DRCome["KSMEN"]); tNDoc.DataBindings[0].ReadValue(); tSm.DataBindings[0].ReadValue(); tShlAddr.DataBindings[0].ReadValue(); tIn.Text = "Прибыл " + (string)xPark.DRCome["DTP"]; tAvto.Text = (string)xPark.DRCome["KAVT"]; IOChange(IO_GOUT); IsParkAvail(); } }
public DGTBox4Ch(DataGrid dg) : base() { if (dg != null) { base.Owner = dg; } base.ReadOnly = true; xF = NSI.xFF; }
/// <summary> /// 清除故障 /// </summary> public static void Cleardtc() { GobalSerialPort.WriteByMessage(CommonCmd.ClearDtcCmd, 0, CommonCmd.ClearDtcCmd.Length); string backresult = GobalSerialPort.ResultBackString; if (backresult.Contains("54") && backresult.Contains("FF") && backresult.Contains("00")) { MainF.ShowBoxTex("清除故障成功!"); } }
public DGTBox4Ch(DataGrid dg, string sTable) : base() { if (dg != null) { base.Owner = dg; } base.TableInd = sTable; base.ReadOnly = true; xF = NSI.xFF; }
private void Avtor_Activated(object sender, EventArgs e) { if (this.Tag != null) { xMF = ((MainF)this.Tag); this.Tag = null; if (!AfterConstruct(xMF)) { this.DialogResult = DialogResult.Cancel; } } }
/// <summary> // 运行开始方法 /// </summary> public static void workRun() { CommonCmd.SendATE1(); //GobalSerialPort.GobalSerialPortEnventChange(); ToSendEcu13IdF(); CmdWrite(); WorkOutToDb(); MainF.ShowBoxTex("读取ID完毕"); DbDataToExcel(); }
/// <summary> /// 获取ECUVersion 数据问题 /// </summary> public static void GetEcuVersion() { log.Info("ecu version read .."); GobalSerialPort.WriteByMessage(CommonCmd.ecuVersionCmd, 0, CommonCmd.ecuVersionCmd.Length); String VersionString = GobalSerialPort.ResultBackString; _13IdFDataWork.InsertAcessF_7(VersionString); EcuVsion = _13IdFDataWork.WorkOutData; MainF.EcuVersionLabelShow(EcuVsion); log.Info("ecu version is :" + EcuVsion); // CommonAutoRest.MainFTextThreadMessage1.Set(); }
public void AfterConstruct(MainF xM, string e, int nKrKMC, bool bSelectEAN) { xMainF = xM; xNSI = xM.xNSI; sEAN = e; dvAvto = xNSI.DT[NSI.NS_MC].dt.DefaultView; bsSh = new BindingSource(); bsSh.DataSource = dvAvto; if (bSelectEAN) { lEAN.Text = String.Format("EAN13 = <{0}>", sEAN); } else { lEAN.Text = String.Format("Краткий код = <{0}>", nKrKMC); } // Настройки грида dgShlyuz.SuspendLayout(); dgShlyuz.DataSource = bsSh; ShlzStyle(dgShlyuz); dgShlyuz.ResumeLayout(); if (bSelectEAN) { bsSh.Filter = string.Format("EAN13='{0}'", sEAN); } else { bsSh.Filter = string.Format("KRKMC={0}", nKrKMC); } bsSh.Sort = "KSK"; bsSh.ResetBindings(false); dgShlyuz.Focus(); ehOldScan = new BarcodeScanner.BarcodeScanEventHandler(OnScanPL); xMainF.xBCScanner.BarcodeScan += ehOldScan; }
/// <summary> /// 连接ECU 通过获取锁模式 /// </summary> public void ConnectEucByWait() { if (GobalSerialPort.SerialPort.IsOpen == false) { return; } ClearSendAndRecive(); String backEndString = null; CommonCmd.SendATE1(); // GobalSerialPort.GobalSerialPortEnventChange(); //718 code GobalSerialPort.WriteByMessage(_AT2S, 0, _AT2S.Length); backEndString = GetSerialPortBackData(); CommonConstant.TL718CODE = backEndString; //foreach (string num in TL718NUM) //{ // if (backEndString.Contains(num)) // { // GobalSerialPort.WriteByMessage(ATSP5, 0, ATSP5.Length); ////////读取718芯片 // } //} GobalSerialPort.WriteByMessage(ATSP5, 0, ATSP5.Length); ////////读取718芯片 backEndString = GetSerialPortBackData(); if (backEndString.Contains("OK")) { GobalSerialPort.WriteByMessage(CommonCmd.ATST0F, 0, CommonCmd.ATST0F.Length); //2 } backEndString = GetSerialPortBackData(); if (backEndString.Contains("OK")) { GobalSerialPort.WriteByMessage(ATSW19, 0, ATSW19.Length); //22222/ ////333333 } backEndString = GetSerialPortBackData(); if (backEndString.Contains("OK")) { GobalSerialPort.WriteByMessage(ATSH81_10_F1, 0, ATSH81_10_F1.Length); } backEndString = GetSerialPortBackData(); if (backEndString.Contains("OK")) { GobalSerialPort.WriteByMessage(_1081, 0, _1081.Length); ////////////5 //连接处可能需要特殊处理 } backEndString = GetSerialPortBackData(); EcuVersionF.GetEcuVersion(); if (backEndString.Contains("50") && backEndString.Contains("81")) { ECULINKStatus = true; MainF.ShowBoxTex("串口连接成功!"); } else { ECULINKStatus = false; MainF.ShowBoxTex("串口未成功!"); } MainF.EcuIsLinked = EcuConnectionF.ECULINKStatus1; //MethodInvoker MethInvk = new MethodInvoker(ShowForm5); //BeginInvoke(MethInvk); // }
/// <summary> /// read dtc code /// </summary> public static void ReadECU13DTC() { CommonCmd.SendATE1(); GobalSerialPort.ClearSendAndRecive(); try { byte[] stringToalldtccodeA = StringToSendBytes.bytesToSend("1800FF00\n"); //发送命令的一个转化 GobalSerialPort.WriteByMessage(stringToalldtccodeA, 0, stringToalldtccodeA.Length); StringOfGets = GobalSerialPort.ResultBackString; string[] splitstring = StringOfGets.Split('\r'); if (splitstring[1] != null && (!splitstring[1].Contains("NO"))) { string result = splitstring[1]; string ss = result; ss = result.Replace(" ", ""); //这里是将空格改为空的字符串,但是还有其他的方法 string sub = ss.Substring(2, 2); string subtostr = sub.ToString(); int subtoint = Convert.ToInt32(subtostr, 16); //subint 是表示有多少个故障代码 string[] strsubtring = new string[subtoint]; //strsubtring 表示要开辟多少个字符串数组 ECU13DTC = new string[subtoint]; int[] strsubtint = new int[subtoint]; Console.WriteLine(subtoint); byte[][] C13DTwrite = new byte[subtoint][]; Save13BackDTC = new string[subtoint]; C13BackTDNumCode = new string[subtoint]; for (int i = 0; i < subtoint; i++) { C13DTwrite[i] = new byte[8]; } //初始化数据 SingleDtcFunction singleDtcFunction = new SingleDtcFunction(); MyMeans.DropDTC(); //清除原先数据 MyMeans.AccessLink(); int x = 4; for (int i = 0; i < subtoint; i++) { strsubtring[i] = ss.Substring(x, 6); x = x + 6; strsubtring[i] = strsubtring[i].Substring(0, 4); C13BackTDNumCode[i] = strsubtring[i]; int TheoneString = Convert.ToInt32(strsubtring[i].Substring(0, 1), 16); int _16TheoneString = int.Parse(TheoneString.ToString("X"), System.Globalization.NumberStyles.HexNumber); string ThethreeString = strsubtring[i].Substring(1, 3); //将前面的一个数据去掉前面的两位 string SUBba = Convert.ToString(_16TheoneString, 2).PadLeft(4, '0'); string C = SUBba.Substring(2, 2); string D = "00" + C; string Fianba = (Convert.ToInt32("00" + C)).ToString("X"); string Fianba1 = Convert.ToInt32(D, 2).ToString(); strsubtring[i] = Fianba1 + ThethreeString; ECU13DTC[i] = strsubtring[i]; ECU13DTCSingle = strsubtring[i]; strsubtring[i] = "17" + strsubtring[i]; C13DTwrite[i] = StringToSendBytes.bytesToSend(strsubtring[i] + "\n"); try { GobalSerialPort.WriteByMessage(C13DTwrite[i], 0, C13DTwrite[0].Length); StringOfGets = GobalSerialPort.ResultBackString; Save13BackDTC[i] = StringOfGets; Save13BackDTCSingle = StringOfGets; //Date int count = i + 1; singleDtcFunction.ShowDtcCodeF(count); } catch (Exception e) { log.Info("the error fo message is :" + e.Message); continue; } } MainF.ShowBoxTex("读取故障完毕"); MyMeans.AccessBreak(); SaveFileFunction.Dtc_SaveExcel(); } } catch (Exception e) { SaveFileFunction.Dtc_SaveExcel(); log.Info("Dtc final error :" + e.Message); } }
private bool AfterConstruct(MainF x) { int nTotM_ZVK = 0, nTotM_TTN = 0; string sRf; DataView dvM; xMF = x; xNSI = xMF.xNSI; bDocIsKMPL = ((int)x.xCDoc.drCurRow["TYPOP"] == AppC.TYPOP_KMPL) ? true : false; //if (bDocIsKMPL) //{ // bWillMark = xMF.IsZkzReady(true); // if (!bWillMark) // return (false); //} ehOldScan = new BarcodeScanner.BarcodeScanEventHandler(OnScanPL); xMF.xBCScanner.BarcodeScan += ehOldScan; //xFuncs = x.xFuncs; nNomPodd = x.xCDoc.xNPs.Current; //tNomPoddon.Text = (xMF.xCDoc.nCurNomPodd + 1).ToString(); tSSCC.Text = ""; if (bDocIsKMPL) { this.Text = String.Format("Текущий поддон {0}", x.xCDoc.xNPs.Current); tNomPoddon.Text = xMF.xCDoc.xNPs.TryNext(false, true).ToString(); lNomsAvail.Text = "(" + xMF.xCDoc.xNPs.RangeN() + ")"; sRf = xMF.xCDoc.DefDetFilter() + String.Format(" AND (NPODDZ={0})", x.xCDoc.xNPs.Current); } else { this.Text = String.Format("Текущий поддон {0}", x.xCDoc.xNPs.Current + 1); lNomPodd.Text = ""; tNomPoddon.Text = ""; lNomsAvail.Text = ""; sRf = xMF.xCDoc.DefDetFilter(); if ((int)xMF.xCDoc.drCurRow["CHKSSCC"] <= 0) { sRf += " AND (LEN(SSCC)<>20)"; } } dvM = new DataView(xNSI.DT[NSI.BD_DOUTD].dt, sRf, "", DataViewRowState.CurrentRows); foreach (DataRowView drv in dvM) { nTotM_TTN += (int)drv.Row["KOLM"]; } if (x.bZVKPresent) { if (!bDocIsKMPL) { sRf = xMF.xCDoc.DefDetFilter(); } dvM = new DataView(xNSI.DT[NSI.BD_DIND].dt, sRf, "", DataViewRowState.CurrentRows); foreach (DataRowView drv in dvM) { nTotM_ZVK += (int)drv.Row["KOLM"]; } } lMestOnPodd.Text = String.Format("Мест = {0} (заказ = {1})", nTotM_TTN, nTotM_ZVK); return(true); }
private bool AfterConstruct(MainF xF) { bool cbAvail = true, ret = false; int i; xNSI = xF.xNSI; xSm = xF.xSm; nCurReg = (int)xF.xDLLPars; // центровка формы Rectangle screen = Screen.PrimaryScreen.Bounds; this.Location = new Point((screen.Width - this.Width) / 2, (screen.Height - this.Height) / 2); SetBindSmenaPars(); i = WhatNextMode(ref cbAvail, 1); if (i < 0) { Srv.ErrorMsg("Запуск программы запрещен!"); } else { cbReg.SelectedValue = xSm.RegApp = i; SetAvtFields(); if (xMF.evReadNSI != null) {// загрузку НСИ выполнять параллельно авторизации xTh = new Thread(new ThreadStart(ReadLocNSI)); xTh.Priority = ThreadPriority.Lowest; xTh.Start(); } if (nCurReg != AppC.AVT_PARS) {// парметры изменяются только с клавиатуры ehScan = new BarcodeScanner.BarcodeScanEventHandler(OnScanBage); xMF.xBCScanner.BarcodeScan += ehScan; } else { xOldSm.nSklad = xSm.nSklad; xOldSm.nUch = xSm.nUch; xOldSm.sDatDoc = xSm.DocData; xOldSm.nReg = xSm.RegApp; } //if ( i < 0 ) //{ // Srv.ErrorMsg("Нет разрешенных режимов!"); // this.DialogResult = DialogResult.Cancel; //} //else // BeginEditAvt(nCurReg, i); BeginEditAvt(nCurReg, cbAvail); ret = true; } return(ret); }