// ■ 리스트 뷰 추가 #region ○ 리스트 뷰 추가 public void Add_ListView(string strMsg, string strLine) { try { string strDate = CoFAS_ConvertManager.Date2String(DateTime.Now, CoFAS_ConvertManager.enDateType.DateTimeShort); string[] stritem = new string[] { strDate, strMsg };//, strLine }; CoFAS_ControlManager.InvokeIfNeeded(_lvLog, () => { ListViewItem li = new ListViewItem(stritem); _lvLog.Items.Insert(0, li); while (_lvLog.Items.Count > 100) { int intIndex = 0; intIndex = _lvLog.Items.Count - 1; CoFAS_ControlManager.InvokeIfNeeded(_lvLog, () => _lvLog.Items.RemoveAt(intIndex)); } ; } ); } catch (Exception ex) { } }
//품목코드 찾기(저울스캔시) // private void FindPartCode(string pPart_code) // { // IWorkbook workbook = _sdMAIN.Document; // Worksheet sheet_0 = workbook.Worksheets[0]; // Range rg; // // rg = sheet_0.Range["D11:D42"]; //판정유무 // // IEnumerable<Cell> searchResult = rg.Search(pPart_code); // foreach (Cell cell in searchResult) // { // sheet_0.Cells[cell.RowIndex, 8].SetValue("450.1"); // //cell.RowIndex // } // } #endregion //품목코드 찾기(저울스캔시) private void FindPartCode(string pPart_code, string pVend_Part_code, string make_no, string inspect_code, string pReference_id) { bool find_cnt = false; //int rowHandle = _gdMAIN_VIEW.LocateByValue("PART_CODE", pPart_code); int rowHandle = _gdMAIN_VIEW.LocateByValue("SHIPMENT_ID", pReference_id); if (rowHandle != DevExpress.XtraGrid.GridControl.InvalidRowHandle) { CoFAS_ControlManager.InvokeIfNeeded(_gdMAIN, () => _gdMAIN_VIEW.FocusedRowHandle = rowHandle); //_gdMAIN_VIEW.FocusedRowHandle = rowHandle; // SubFind_DisplayData("R", _gdMAIN_VIEW.GetFocusedRowCellValue("PART_CODE").ToString()); find_cnt = true; } else { find_cnt = false; } //cell.RowIndex if (!find_cnt) { CoFAS_DevExpressManager.ShowInformationMessage("일치하지 않는번호입니다."); } }
void _Barcode_Received_Data(byte[] yReceiveData) { try { if (yReceiveData.Length > 0) { string pFindData = string.Empty; string vPart_code = string.Empty; string vMake_no = string.Empty; string vInspect_no = string.Empty; string vVend_Part_Code = string.Empty; string vReference_id = string.Empty; pFindData = CoFAS_ConvertManager.Bytes2String(yReceiveData, 0, 0); //pFindData = pFindData.Substring(0, pFindData.Length -5);//뒤에 개행문자 지울경우(2자리) pFindData = pFindData.Substring(0, 11); CoFAS_ControlManager.InvokeIfNeeded(_luBAR_CODE, () => _luBAR_CODE.Text = pFindData); MainFind_DisplayData(); //종료시 close시키기 //엑셀로 커서가게 //바코드세팅 com번호 가져오게하기 //기존 USP_BarcodeLabelPrint_R30를 수정하여 같이쓰게 하든가 아니면 별도로 가져오게하기 //dispose 예외처리하기 } Application.DoEvents(); //화면초기화 } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// 메시지를 표시한다 /// </summary> /// <param name="pMessage"></param> protected void DisplayMessage(string pMessage) { DateTime dt = DateTime.Now; _pMessage = string.Format("[{0}:{1}:{2}] {3}\r\n", dt.ToString("HH"), dt.ToString("mm"), dt.ToString("ss"), pMessage); CoFAS_ControlManager.InvokeIfNeeded(_lbMessage, () => _lbMessage.Text = _pMessage); }
public void UpdateDtNow(object obj) { pCount++; if (pCount == 2) { CoFAS_ControlManager.InvokeIfNeeded(this, () => Close()); } }
void OnTick(object sender, EventArgs e) { if (IsDisposed) { DisableTimer(); return; } System.DateTime currentDate = System.DateTime.Now; CoFAS_ControlManager.InvokeIfNeeded(labelControl1, () => labelControl1.Text = string.Format("{0:T}\r\n{1}", currentDate, currentDate.ToString("D"))); }
/// <summary> /// 다운로드 파일 상태 표시 /// </summary> /// <param name="strFileName"></param> /// <param name="intTotalSize"></param> /// <param name="intRecevedFileSize"></param> private void FileDownloading(string strFileName, int intTotalSize, int intRecevedFileSize) { CoFAS_ControlManager.InvokeIfNeeded(_lbAutodownload, () => _lbAutodownload.Text = string.Format("{0} {1}/{2}kb", strFileName, intRecevedFileSize, intTotalSize)); CoFAS_ControlManager.InvokeIfNeeded(_pgrAutodownloadFile, () => { _pgrAutodownloadFile.Properties.Maximum = intTotalSize; _pgrAutodownloadFile.Properties.Minimum = 0; _pgrAutodownloadFile.PerformStep(); _pgrAutodownloadFile.Update(); }); //CoFAS_ControlManager.InvokeIfNeeded(_lbFileCount, () => _lbFileCount.Text = string.Format("{0:D0}%", 100 * intRecevedFileSize / intTotalSize)); }
/// <summary> /// 파일 다운로드 처리 메세지 표시 /// </summary> /// <param name="isTotalCount"></param> /// <param name="strMsg"></param> private void DoEvent(bool isTotalCount, string strMsg) { if (isTotalCount) { CoFAS_ControlManager.InvokeIfNeeded(_lbFileCount, () => _lbFileCount.Text = strMsg); } else { CoFAS_ControlManager.InvokeIfNeeded(_lbAutodownload, () => _lbAutodownload.Text = strMsg); } Application.DoEvents(); Thread.Sleep(150); }
public frmBasePOP() { InitializeComponent(); if (System.IO.File.Exists(Application.StartupPath + "\\" + "logo.png")) { _peCI.Image = Image.FromFile(Application.StartupPath + "\\" + "logo.png"); } else { _peCI.Image = Properties.Resources.None; } CoFAS_ControlManager.InvokeIfNeeded(_lbStartTime, () => _lbStartTime.Text = CoFAS_ConvertManager.Date2String(DateTime.Now, CoFAS_ConvertManager.enDateType.DateTime)); tmrTime = new System.Threading.Timer(new TimerCallback(Up_Date_Time), null, 0, 1000); }
// ■ 메세지 처리 #region ○ 메세지 처리 /// <summary> /// /// </summary> /// <param name="strMessage">메세지 표시</param> /// <param name="isLog">로그 저장 유무</param> /// <param name="isView">화면 표시 유무</param> private void Message_Log(string strMessage, bool isLog, bool isView) { DateTime dt = DateTime.Now; _pMessage = string.Format("[{0}:{1}:{2}] {3}\r\n", dt.ToString("HH"), dt.ToString("mm"), dt.ToString("ss"), strMessage); if (isView) { CoFAS_ControlManager.InvokeIfNeeded(_lbMessage, () => _lbMessage.Text = _pMessage); } if (isLog) { _pCoFASLog.WLog(_pMessage); } }
public void ucEng_Create() { try { ucG = new ucGatheringCtl[iucEngCnt]; double dRow = 0; int icnt = 0; int iQty = 3; //열 표시 수량 int iWidth = 333; int iHeight = 222; dRow = iucEngCnt; dRow = Math.Ceiling(dRow / iQty); for (int i = 0; i < iucEngCnt; i++) { ucG[i] = new ucGatheringCtl(dsSetting.Tables["P_SET"].Rows[i]); } for (int a = 0; a < dRow; a++) { for (int b = 0; b < iQty; b++) { if (icnt == iucEngCnt) { break; } CoFAS_ControlManager.InvokeIfNeeded(ucG[icnt], () => ucG[icnt].Width = iWidth); CoFAS_ControlManager.InvokeIfNeeded(ucG[icnt], () => ucG[icnt].Height = iHeight); CoFAS_ControlManager.InvokeIfNeeded(ucG[icnt], () => ucG[icnt].Top = (a * (iHeight + 10)) + 10); CoFAS_ControlManager.InvokeIfNeeded(ucG[icnt], () => ucG[icnt].Left = b * (iWidth + 10)); CoFAS_ControlManager.InvokeIfNeeded(_pnGMain, () => _pnGMain.Controls.Add(ucG[icnt])); icnt++; } } } catch (Exception ex) { } }
private void AutoDownload_Start() { try { DoEvent(true, string.Format("{0:D0}%", "0")); DoEvent(false, "File Download Start . . ."); for (int i = 1; i < 11; i++) { double dbl = i * 0.1; CoFAS_ControlManager.InvokeIfNeeded(this, () => this.Opacity = dbl); Thread.Sleep(150); Application.DoEvents(); } //FileTemporary 파일 삭제. CoFAS_FileManager.FolderFileDelete(strPathUpdate); //File 다운로드 FileDownload(); } catch (Exception ex) { } finally { DoEvent(false, "File Download Complete . . ."); //clsLog.WLog("업데이트 프로그램을 종료합니다."); try { //파일 무브 FileMove(); } catch (Exception ex) { } CoFAS_ControlManager.InvokeIfNeeded(this, () => this.Close()); } }
public frmPOPProductMonitoring(UserEntity pUserEntity) { InitializeComponent(); _pUserEntity = pUserEntity; // 접속 시간 업데이트 CoFAS_ControlManager.InvokeIfNeeded(_lbStartTime, () => _lbStartTime.Text = CoFAS_ConvertManager.Date2String(DateTime.Now, CoFAS_ConvertManager.enDateType.DateTime)); tmrTime = new System.Threading.Timer(new TimerCallback(Up_Date_Time), null, 0, 1000); // timer : 1분 timer.Enabled = true; timer.Interval = 60000; timer.Tick += new EventHandler(time_tick); timer.Start(); Activated += new EventHandler(Form_Activated); FormClosing += new FormClosingEventHandler(Form_Closing); FormClosed += new FormClosedEventHandler(Form_FormClosed); Load += new EventHandler(Form_Load); }
private void Up_Date_Time(object obj) { CoFAS_ControlManager.InvokeIfNeeded(_lbCurrentTime, () => _lbCurrentTime.Text = CoFAS_ConvertManager.Date2String(DateTime.Now, CoFAS_ConvertManager.enDateType.DateTime)); }
private void Start_tmr(object obj) { if (isStop) { return; } string strMessage = ""; try { tmrInterface.Change(Timeout.Infinite, Timeout.Infinite); isRunning = true; Initialize("1"); _dtList = new DBInterfaceBusiness().Interface_Data_Order(); if (_dtList != null || _dtList.Rows.Count > 0) { CoFAS_ControlManager.InvokeIfNeeded(_luJSNO, () => _luJSNO.Text = _dtList.Rows[0]["JSNO"].ToString()); } _dtList = new DBInterfaceBusiness().Interface_Data_Sensor(); if (_dtList != null || _dtList.Rows.Count > 0) { CoFAS_ControlManager.InvokeIfNeeded(_luWORK_DATE, () => _luWORK_DATE.Text = _dtList.Rows[0]["WORK_DATE"].ToString()); CoFAS_ControlManager.InvokeIfNeeded(_luPROC_DATE, () => _luPROC_DATE.Text = _dtList.Rows[0]["PROC_DATE"].ToString()); CoFAS_ControlManager.InvokeIfNeeded(_luPROC_TIME, () => _luPROC_TIME.Text = _dtList.Rows[0]["PROC_TIME"].ToString()); } strMessage = "01"; DisplayMessage("1. Interface Data Search"); Initialize("2"); _dtListOrder = new DBInterfaceBusiness().Interface_Data_Order_MST(_luJSNO.Text.ToString()); if (_dtListOrder != null || _dtListOrder.Rows.Count > 0) { Initialize("1"); //저장 bool isOrder = false; isOrder = new DBInterfaceBusiness().Interface_Data_Order_Save(_pDBInterfaceEntity, _dtListOrder); } strMessage = "02"; DisplayMessage("2. Interface Order MST Data Search & Save"); Initialize("3"); _dtListSensor = new DBInterfaceBusiness().Interface_Data_Sensor_MST(_luWORK_DATE.Text.ToString(), _luPROC_DATE.Text.ToString(), _luPROC_TIME.Text.ToString()); string str = _dtListSensor.Rows.Count.ToString() + " / " + _luWORK_DATE.Text.ToString() + " / " + _luPROC_DATE.Text.ToString() + " / " + _luPROC_TIME.Text.ToString(); Add_ListView(str, ""); if (_dtListSensor != null || _dtListSensor.Rows.Count > 0) { Initialize("1"); //저장 bool isSensor = false; isSensor = new DBInterfaceBusiness().Interface_Data_Sensor_Save(_pDBInterfaceEntity, _dtListSensor); } strMessage = "03"; DisplayMessage("3. Interface Sensor MST Data Search & Save"); // 보강 작업지시 추가 로직 Initialize("7"); //Cofas_dyt DB _dtListbokang = new DBInterfaceBusiness().Interface_Data_Order_Bokang(); Thread.Sleep(1000); if (_dtListbokang.Rows.Count > 0) { Initialize("6"); //우일 DB DBManager.PrimaryConnectionString = string.Format ( //"location = {0}; user id = {1}; password = {2}; data source = {3}", "Server={0};Database={1};UID={2};PWD={3}", "210.123.142.224,1514", //Properties.Settings.Default.SERVER_IP.ToString(), "DYETEC_DB", //Properties.Settings.Default.DB_NAME.ToString(), "coever", //Properties.Settings.Default.DB_ID.ToString(), "coever2018`" ); _dtListminwon = new DBInterfaceBusiness().Interface_Data_minwon(_dtListbokang.Rows[0][0].ToString()); //민원 _dtListworkorder = new DBInterfaceBusiness().Interface_Data_workorder(_dtListbokang.Rows[0][1].ToString()); // 작업지시 _dtListcolor = new DBInterfaceBusiness().Interface_Data_color(_dtListbokang.Rows[0][2].ToString()); // 색상정보 _dtListplan = new DBInterfaceBusiness().Interface_Data_workplan(_dtListbokang.Rows[0][3].ToString()); // 작업계획 } if (_dtListminwon.Rows.Count > 0) { Initialize("7"); //Cofas_dyt DB new DBInterfaceBusiness().Interface_Data_Sensor_Save_Bokang_minwon(_pDBInterfaceEntity, _dtListminwon); } if (_dtListworkorder.Rows.Count > 0) { Initialize("7"); //Cofas_dyt DB new DBInterfaceBusiness().Interface_Data_Sensor_Save_Bokang_workorder(_pDBInterfaceEntity, _dtListworkorder); } if (_dtListcolor.Rows.Count > 0) { Initialize("7"); //Cofas_dyt DB new DBInterfaceBusiness().Interface_Data_Sensor_Save_Bokang_color(_pDBInterfaceEntity, _dtListcolor); } if (_dtListplan.Rows.Count > 0) { Initialize("7"); //Cofas_dyt DB new DBInterfaceBusiness().Interface_Data_Sensor_Save_Bokang_workplan(_pDBInterfaceEntity, _dtListplan); } strMessage = "07"; DisplayMessage("7. Interface Bokang Data Search & Save"); Initialize("4"); _dtListSensor = new DBInterfaceBusiness().Interface_Data_Sensor_MST_sarim(_luWORK_DATE.Text.ToString(), _luPROC_DATE.Text.ToString(), _luPROC_TIME.Text.ToString()); string str4 = _dtListSensor.Rows.Count.ToString() + " / " + _luWORK_DATE.Text.ToString() + " / " + _luPROC_DATE.Text.ToString() + " / " + _luPROC_TIME.Text.ToString(); Add_ListView(str4, ""); ///// if (_dtListSensor != null || _dtListSensor.Rows.Count > 0) { Initialize("5"); //저장 bool isSensor = false; isSensor = new DBInterfaceBusiness().Interface_Data_Sensor_Save_sarim(_pDBInterfaceEntity, _dtListSensor); } strMessage = "04"; DisplayMessage("4. Interface Sensor MST Data Search & Save"); tmrInterface.Change(60000, 0); isRunning = false; } catch (Exception ex) { tmrInterface.Change(60000, 0); isRunning = false; DisplayMessage(strMessage + " Interface : " + ex.ToString()); } }
private void LocalFind_DisplayData() { try { CoFAS_DevExpressManager.SetCursor(this, Cursors.WaitCursor); if (_pCoFASXml.GetSingleNodeValue("SERVERSOCKET/IP").Length > 0) //값이 있으면, 설정 { try { ucG = new ucGatheringCtl[1]; int icnt = 0; int iQty = 3; //열 표시 수량 double dRow = 1; // 카드 수량 dRow = Math.Ceiling(dRow / iQty); int iWidth = 333; int iHeight = 222; for (int i = 0; i < _dtList.Rows.Count; i++) { _dtSubList = new GatheringMainBusiness().Gathering_Search_Sub(_dtList.Rows[i]); // 게더링 프로그램 Row 세팅 ucG[i] = new ucGatheringCtl(_dtList.Rows[i], _dtSubList, _DtMinMax); } for (int a = 0; a < dRow; a++) { for (int b = 0; b < iQty; b++) { if (icnt == _dtList.Rows.Count) { break; } CoFAS_ControlManager.InvokeIfNeeded(ucG[icnt], () => ucG[icnt].Width = iWidth); CoFAS_ControlManager.InvokeIfNeeded(ucG[icnt], () => ucG[icnt].Height = iHeight); CoFAS_ControlManager.InvokeIfNeeded(ucG[icnt], () => ucG[icnt].Top = (a * (iHeight + 10)) + 10); CoFAS_ControlManager.InvokeIfNeeded(ucG[icnt], () => ucG[icnt].Left = b * (iWidth + 10)); CoFAS_ControlManager.InvokeIfNeeded(_pnGMain, () => _pnGMain.Controls.Add(ucG[icnt])); icnt++; } } } catch (Exception ex) { } } else { DisplayMessage("조회 내역이 없습니다."); } } catch (ExceptionManager pExceptionManager) { CoFAS_DevExpressManager.ShowErrorMessage(string.Format("{0}\n{1}", pExceptionManager.Exception.Message.ToString(), pExceptionManager.TargetSite.ToString())); } finally { //_gdMAIN_VIEW.BestFitColumns(); CoFAS_DevExpressManager.SetCursor(this, Cursors.Default); } }
/// <summary> /// 파일 다운로드 /// </summary> private void FileDownload() { try { DoEvent(false, "Chack Download File..."); pAutoDownloadEntity.FILE_TYPE = strFileType; using (DataTable dt = new AutoDownloadBusiness().FileInfo_GetList(pAutoDownloadEntity)) { int intUpdateTotalCount = dt.Rows.Count; int intUpdateCount = 0; DoEvent(false, string.Format("Update File List {0} Files - Start File Download...", intUpdateTotalCount.ToString())); foreach (DataRow dr in dt.Rows) { intUpdateCount++; CoFAS_ControlManager.InvokeIfNeeded(_lbFileCount, () => _lbFileCount.Text = string.Format("{0:D0}% {1:D2}/{2:D2}", 100 * intUpdateCount / intUpdateTotalCount, intUpdateCount, intUpdateTotalCount)); CoFAS_ControlManager.InvokeIfNeeded(_pgrAutodownloadAll, () => { _pgrAutodownloadAll.Properties.Maximum = intUpdateTotalCount; _pgrAutodownloadAll.Properties.Minimum = 0; _pgrAutodownloadAll.PerformStep(); _pgrAutodownloadAll.Update(); }); string strFileName = strTargetPath + @"\" + CoFAS_ConvertManager.obj2String(dr["FILENAME"]); string strTempFileName = strPathUpdate + CoFAS_ConvertManager.obj2String(dr["FILENAME"]); string strVersion = CoFAS_ConvertManager.obj2String(dr["VERSION"]); DateTime dtFileDate = (DateTime)dr["FILE_DATE"]; string strCrc = CoFAS_ConvertManager.obj2String(dr["CRC"]); int intFileSize = Convert.ToInt32(dr["FILE_SIZE"]); bool isUpdate = false; string strFileVersion = string.Empty; DateTime dtFileFileDate = DateTime.Now; isUpdate = false; DoEvent(false, string.Format("Check the file '{0}'", dr["FILENAME"])); if (CoFAS_FileManager.FileExists(strFileName)) { System.IO.FileInfo fi = new System.IO.FileInfo(strFileName); strFileVersion = CoFAS_ConvertManager.obj2String(CoFAS_FileManager.FileGetVersion(fi.FullName)); dtFileFileDate = fi.LastWriteTime; if (strFileVersion != strVersion || CoFAS_ConvertManager.obj2String(dtFileFileDate) != CoFAS_ConvertManager.obj2String(dtFileDate)) { isUpdate = true; } } else { isUpdate = true; } int intErrCnt = 0; while (isUpdate) { pAutoDownloadEntity.FILE_TYPE = "MES"; pAutoDownloadEntity.FILENAME = CoFAS_ConvertManager.obj2String(dr["FILENAME"]); pAutoDownloadEntity.FILE_PATH = strPathUpdate; string strFileCrc = new AutoDownloadBusiness().FileInfo_GetFileData(pAutoDownloadEntity); GC.Collect(); Application.DoEvents(); GC.WaitForPendingFinalizers(); //crc검사 if (strCrc != strFileCrc) { intErrCnt++; CoFAS_FileManager.FileDelete(strPathUpdate + CoFAS_ConvertManager.obj2String(dr["FILENAME"])); //3회까지 시도한다. if (intErrCnt > 2) { isUpdate = false; } else { isUpdate = true; } } else { isUpdate = false; System.IO.FileInfo fi = new System.IO.FileInfo(strTempFileName); fi.LastWriteTime = dtFileDate; } } } } DoEvent(false, string.Format("Completed downloading files from server")); } catch { throw; } finally { } }
private void Serial_Data(byte[] data) { if (data.Length < 2) { return; } if (isWorkData) { isWorkData = false; string strData = ""; double d1 = 32768; //고정 double d2 = 65535; //고정 double d3 = 16485; //설정 값 나누기 20181016 사용 안함. double d4 = 0.048; //설정 값 빼기 20181016 사용 안함. //string decimalNumber = "32768"; //int number = int.Parse(decimalNumber); //string hex = number.ToString("x"); string strHex = ""; string strDec = ""; string strXHex = ""; string strXDec = ""; string strYHex = ""; string strYDec = ""; double dm1 = 0; double dm1X = 0; double dm1Y = 0; double dm2 = 0; double dm2X = 0; double dm2Y = 0; double dm3 = 0; //각도 값 double dm3X = 0; //각도 값 double dm3Y = 0; //각도 값 double dm4 = 0; //백분율 double dm4X = 0; //백분율 double dm4Y = 0; //백분율 string strSign = ""; //변위 부호 double dbDisplacement = 0; //변위 값 string strMesage = ""; switch (data[3].ToString()) { case "48": strXHex = int.Parse(data[5].ToString()).ToString("x").PadLeft(2, '0') + int.Parse(data[6].ToString()).ToString("x").PadLeft(2, '0'); strXDec = Convert.ToInt32(strXHex, 16).ToString(); dm1X = double.Parse(strXDec); strYHex = int.Parse(data[8].ToString()).ToString("x").PadLeft(2, '0') + int.Parse(data[9].ToString()).ToString("x").PadLeft(2, '0'); strYDec = Convert.ToInt32(strYHex, 16).ToString(); dm1Y = double.Parse(strYDec); break; case "49": strHex = int.Parse(data[5].ToString()).ToString("x").PadLeft(2, '0') + int.Parse(data[6].ToString()).ToString("x").PadLeft(2, '0'); strDec = Convert.ToInt32(strHex, 16).ToString(); dm1 = double.Parse(strDec); break; } //strHex = int.Parse(data[5].ToString()).ToString("x") + int.Parse(data[6].ToString()).ToString("x"); //strDec = Convert.ToInt32(strHex, 16).ToString(); //double dm1 = double.Parse(strDec); //double dm2 = 0; //double dm3 = 0; //각도 값 //double dm4 = 0; //백분율 //string strSign = ""; //변위 부호 //double dbDisplacement = 0; //변위 값 //string strMesage = ""; string strTime = CoFAS_ConvertManager.Date2String(DateTime.Now, CoFAS_ConvertManager.enDateType.DateTime).Replace("-", "").Replace(" ", "").Replace(":", ""); switch (data[3].ToString()) { case "48": //행거 X , Y strMesage = ""; /* * if (dm1 > d1) * { * double _dm2 = 0; * _dm2 = (dm1 - d2); * * //((4.147 * (Math.Pow(10, -13)) * (Math.Pow(_dm2, 3))) + (-1.764 * (Math.Pow(10, -10)) * (Math.Pow(_dm2, 2))) + (5.577 * (Math.Pow(10, -4)) * (_dm2)) + 1.845); * * if (_dm2 < 0) * { * dm2 = ((2.516 * (Math.Pow(10, -13)) * (Math.Pow(_dm2, 3))) + (4.248 * (Math.Pow(10, -9)) * (Math.Pow(_dm2, 2))) + (0.0005628 * _dm2) + 2.796); * } * else * { * dm2 = ((2.516 * (Math.Pow(10, -13)) * Math.Pow(_dm2, 3)) + (4.248 * (Math.Pow(10, -9)) * Math.Pow(_dm2, 2)) + (0.0005628 * _dm2) + 2.796); * } * * * } * else * { * * * dm2 = ((2.516 * (Math.Pow(10, -13)) * Math.Pow(dm1, 3)) + (4.248 * (Math.Pow(10, -9)) * Math.Pow(dm1, 2)) + (0.0005628 * dm1) + 2.796); * } * * dm3 = Math.Round(dm2 * 10) + 2; */ dm3X = (1.126 * (((dm1X * 4.9996) / 65536 - 2.341) / 0.075)) - 0.06351; dm4X = 1550 * Math.Sin(dm3X * (3.14159 / 180)); // + 1550 * Math.Sin(dm3X * (3.14159 / 180)) * Math.Tan(dm3X / 2) * (3.14159 / 180) * Math.Tan(dm3X * (3.14159 / 180)); dm3Y = (1.126 * (((dm1Y * 4.9996) / 65536 - 2.5811) / 0.075)) - 0.06351; dm4Y = 1100 * Math.Sin(dm3Y * (3.14159 / 180)); // + 1100 * Math.Sin(dm3Y * (3.14159 / 180 )) * Math.Tan(dm3Y / 2) * (3.14159 / 180) * Math.Tan(dm3Y * (3.14159 / 180)); //dm4Y = 1100 * Math.Sin(dm1Y) * (3.14 / 180) + 1100 * Math.Sin(dm1Y) * (3.14 / 180) * Math.Tan(dm1Y / 2) * (3.14 / 180) * Math.Tan(dm1) * (3.14 / 180); strMesage = data[2].ToString().PadLeft(2, '0') + ":" + strTime + ":0000:1006:" + dm3X.ToString() + ":," + dm3Y.ToString() + ":,"; // txt2XV.Text = dm3X.ToString(); // txt2XP.Text = "0"; CoFAS_ControlManager.InvokeIfNeeded(txt2XV, () => { txt2XV.Text = Math.Round(dm3X, 2).ToString(); }); CoFAS_ControlManager.InvokeIfNeeded(txt2XP, () => { txt2XP.Text = Math.Round(dm4X, 2).ToString(); }); //txt2YV.Text = dm3Y.ToString(); //txt2YP.Text = "0"; CoFAS_ControlManager.InvokeIfNeeded(txt2YV, () => { txt2YV.Text = Math.Round(dm3Y, 2).ToString(); }); CoFAS_ControlManager.InvokeIfNeeded(txt2YP, () => { txt2YP.Text = Math.Round(dm4Y, 2).ToString(); }); break; case "49": //각도 변위 strMesage = ""; if (dm1 > d1) { //dm2 = ((dm1 - d2) / d3) - d4; dm2 = (dm1 - d2); } else { //dm2 = (dm1 / d3) - d4; dm2 = dm1; } dm4 = ((0.00061 * dm2) + 4.994) * 10; //dm3 = Math.Asin(dm2) * (180 / 3.14); //각도 dm3 = 30.5 - Math.Asin(dm2 / 16000) * (180 / 3.14); //각도 strMesage = data[2].ToString().PadLeft(2, '0') + ":" + strTime + ":0000:1007:" + dm3.ToString() + ":," + dm4.ToString() + ":,"; // txt1V.Text = dm3.ToString(); // txt1P.Text = dm4.ToString(); CoFAS_ControlManager.InvokeIfNeeded(txt1V, () => { txt1V.Text = Math.Round(dm3).ToString(); }); CoFAS_ControlManager.InvokeIfNeeded(txt1P, () => { txt1P.Text = Math.Round(dm4) > 100 ? "100" : Math.Round(dm4).ToString(); }); //================================================================================== /* * if (int.Parse(data[8].ToString()) != 0) * { * //음수 * strSign = "-"; * } * * // 변경 * * string strBinary1 = (Convert.ToString(int.Parse(data[9].ToString()), 2)).PadLeft(8,'0'); * string strTemp1 = ""; * * for(int a = 8; a > 0; a--) * { * strTemp1 += strBinary1[a-1]; * } * * //strTemp1 = new String(strBinary1.ToCharArray().Reverse().ToArray()); * * //strTemp1 = Convert.ToInt32(strTemp1, 2).ToString(); * * string strBinary2 = (Convert.ToString(int.Parse(data[10].ToString()), 2)).PadLeft(8,'0'); * string strTemp2 = ""; * * for (int a = 8; a > 0; a--) * { * strTemp2 += strBinary2[a-1]; * } * * //strTemp2 = new String(strBinary2.ToCharArray().Reverse().ToArray()); * * //strTemp2 = Convert.ToInt32(strTemp2, 2).ToString(); * * string strTemp3 = ""; * strTemp3 = strTemp1 + strTemp2; * * double dbTemp = 0.0; * * dbTemp = double.Parse(Convert.ToInt32(strTemp3, 2).ToString()); * * * * dbDisplacement = dbTemp / 100; * * strMesage = strMesage + "03:" + strTime + ":0000:1007:" + strSign + dbDisplacement.ToString() + ":,"; */ break; case "3": //행거 각도 strMesage = ""; if (dm1 > d1) { double _dm2 = 0; _dm2 = (dm1 - d2); //((4.147 * (Math.Pow(10, -13)) * (Math.Pow(_dm2, 3))) + (-1.764 * (Math.Pow(10, -10)) * (Math.Pow(_dm2, 2))) + (5.577 * (Math.Pow(10, -4)) * (_dm2)) + 1.845); if (_dm2 < 0) { dm2 = ((2.516 * (Math.Pow(10, -13)) * (Math.Pow(_dm2, 3))) + (4.248 * (Math.Pow(10, -9)) * (Math.Pow(_dm2, 2))) + (0.0005628 * _dm2) + 2.796); } else { dm2 = ((2.516 * (Math.Pow(10, -13)) * Math.Pow(_dm2, 3)) + (4.248 * (Math.Pow(10, -9)) * Math.Pow(_dm2, 2)) + (0.0005628 * _dm2) + 2.796); } } else { dm2 = ((2.516 * (Math.Pow(10, -13)) * Math.Pow(dm1, 3)) + (4.248 * (Math.Pow(10, -9)) * Math.Pow(dm1, 2)) + (0.0005628 * dm1) + 2.796); } dm3 = Math.Round(dm2 * 10) + 2; strMesage = "10:" + strTime + ":0000:1006:" + dm3.ToString() + ":,"; break; } Add_ListView(strMesage, ""); //로그 데이터 // string binary = Convert.ToString(128, 2); //strData = CoFAS_ConvertManager.Bytes2String(data,0,0); for (int a = 0; a < 11; a++) { strData += data[a].ToString() + " "; } strData = "[ " + strData + " ] ["; for (int b = 0; b < 11; b++) { strData += int.Parse(data[b].ToString()).ToString("x") + " "; } strData = strData + " ] "; //foreach(byte bt in data) //{ //} strData += " [ " + dm3.ToString() + " " + strSign + dbDisplacement.ToString() + " ] "; //strData = Encoding.UTF8.GetString(data, 0, data.Length - 1); Add_ListView(strData.ToUpper(), ""); //로그 데이터 string[] strRData = new string[ProcGetStringcount(strMesage, ",")]; if (strRData.Length <= 0) { return; } strRData = strMesage.Split(','); for (int a = 0; a < strRData.Length; a++) { if (strRData[a].Length > 0) { // InsertQueueData(strRData[a]); } } //string[] strHex = BitConverter.ToString(data, 3, 10).Split('-'); //string strHex1 = CoFAS_ConvertManager.Hex2Double(strHex[0] + strHex[1] + strHex[2] + strHex[3] + strHex[4] + strHex[5] + strHex[6] + strHex[7]).ToString(); //string strMsg = ""; //strMsg += string.Format("환산 측정 부피 : {0} m3", strHex1); //Add_ListView("수신 : " + strMsg, ""); //string str = Encoding.UTF8.GetString(data, 0, data.Length - 1); //str = CoFAS_ConvertManager.ByteArray2HexString(data, ""); //Add_ListView("수신 : " + str, ""); isWorkData = true; } }
private void MainFind_DisplayData() { try { CoFAS_DevExpressManager.SetCursor(this, Cursors.WaitCursor); _dtList = new GatheringMainBusiness().Gathering_Search_Mst(_pGatheringMainEntity); // 게더링 프로그램 Header 세팅 //for(int a = 0; a < _dtList.Rows.Count; a++) //{ // if( int.Parse(_dtList.Rows[a]["GROUPCNT"].ToString()) >1) // { // } //} // 받은 데이터 변환 시켜야함. 추가.. if (_dtList != null && _dtList.Rows.Count > 0) //값이 있으면, 설정 { try { ucG = new ucGatheringCtl[_dtList.Rows.Count]; int icnt = 0; int iQty = 3; //열 표시 수량 double dRow = _dtList.Rows.Count; // 카드 수량 dRow = Math.Ceiling(dRow / iQty); int iWidth = 333; int iHeight = 222; for (int i = 0; i < _dtList.Rows.Count; i++) { _dtSubList = new GatheringMainBusiness().Gathering_Search_Sub(_dtList.Rows[i]); // 게더링 프로그램 Row 세팅 ucG[i] = new ucGatheringCtl(_dtList.Rows[i], _dtSubList, _DtMinMax); } for (int a = 0; a < dRow; a++) { for (int b = 0; b < iQty; b++) { if (icnt == _dtList.Rows.Count) { break; } CoFAS_ControlManager.InvokeIfNeeded(ucG[icnt], () => ucG[icnt].Width = iWidth); CoFAS_ControlManager.InvokeIfNeeded(ucG[icnt], () => ucG[icnt].Height = iHeight); CoFAS_ControlManager.InvokeIfNeeded(ucG[icnt], () => ucG[icnt].Top = (a * (iHeight + 10)) + 10); CoFAS_ControlManager.InvokeIfNeeded(ucG[icnt], () => ucG[icnt].Left = b * (iWidth + 10)); CoFAS_ControlManager.InvokeIfNeeded(_pnGMain, () => _pnGMain.Controls.Add(ucG[icnt])); icnt++; } } } catch (Exception ex) { } } else { DisplayMessage("조회 내역이 없습니다."); } } catch (ExceptionManager pExceptionManager) { CoFAS_DevExpressManager.ShowErrorMessage(string.Format("{0}\n{1}", pExceptionManager.Exception.Message.ToString(), pExceptionManager.TargetSite.ToString())); } finally { //_gdMAIN_VIEW.BestFitColumns(); CoFAS_DevExpressManager.SetCursor(this, Cursors.Default); } }