123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416 |
- // DialogADCalibrationMain.cpp : 实现文件
- //
- #include "stdafx.h"
- #include "DIOS_3DDR_MechCal.h"
- #include "DialogADCalibrationMain.h"
- #include "afxdialogex.h"
- #include "DialogPhysicalInput.h"
- static std::vector<CString> SplitCString(CString strSource, CString ch)
- {
- vector<CString> vecString;
- int iPos = 0;
- CString strTmp;
- strTmp = strSource.Tokenize(ch, iPos);
- while (strTmp.Trim() != _T(""))
- {
- vecString.push_back(strTmp);
- strTmp = strSource.Tokenize(ch, iPos);
- }
- return vecString;
- }
- // CDialogADCalibrationMain 对话框
- IMPLEMENT_DYNAMIC(CDialogADCalibrationMain, CDialogEx)
- CDialogADCalibrationMain::CDialogADCalibrationMain(CWnd* pParent /*=NULL*/)
- : CDialogEx(CDialogADCalibrationMain::IDD, pParent)
- {
- }
- CDialogADCalibrationMain::~CDialogADCalibrationMain()
- {
- }
- void CDialogADCalibrationMain::DoDataExchange(CDataExchange* pDX)
- {
- CDialogEx::DoDataExchange(pDX);
- DDX_Control(pDX, IDC_COMBO_ROTATE_DIRECTION, m_rotateDirection);
- DDX_Control(pDX, IDC_EDIT_ROTATE_TUBE_ANGLE_STEP, m_rotateStep);
- DDX_Control(pDX, IDC_COMBO_MOVE_DIRECTION, m_tubeHeightDirection);
- DDX_Control(pDX, IDC_EDIT_MOVE_TUBE_HEIGHT_STEP, m_tubeHeightStep);
- DDX_Control(pDX, IDC_EDIT_AD_VALUE_TUBE_ANGLE, m_tubeAngleAD);
- DDX_Control(pDX, IDC_EDIT_TUBE_ANGLE_ADS, m_tubeAngleCalADs);
- DDX_Control(pDX, IDC_EDIT_TUBE_ANGLE_PHYSICALS, m_tubeAngleCalPhysicals);
- DDX_Control(pDX, IDC_EDIT_AD_VALUE_TUBE_HEIGHT, m_tubeHeightAD);
- DDX_Control(pDX, IDC_EDIT_TUBE_HEIGHT_ADS, m_tubHeightCalADs);
- DDX_Control(pDX, IDC_EDIT_TUBE_HEIGHT_PHYSICALS, m_tubeHeightCalPhysicals);
- DDX_Control(pDX, IDC_EDIT_AD_VALUE_DET_HEIGHT, m_detectorAD);
- DDX_Control(pDX, IDC_EDIT_DET_HEIGHT_ADS, m_detectorCalAds);
- DDX_Control(pDX, IDC_EDIT_DET_HEIGHT_PHYSICALS, m_detectorHeightCalPhysicals);
- DDX_Control(pDX, IDC_EDIT_ENCODER_VALUE_TUBE_ANGLE, m_tubeAngleEncoder);
- DDX_Control(pDX, IDC_EDIT_ENCODER_VALUE_TUBE_HEIGHT, m_tubeHeightEncoder);
- DDX_Control(pDX, IDC_EDIT_PCODE, m_pcode);
- DDX_Control(pDX, IDC_COMBO_EX_MODE, m_examMode);
- DDX_Control(pDX, IDC_EDIT_C_TUBE_ANGLE, m_autoadTubeAngleCurrent);
- DDX_Control(pDX, IDC_EDIT_H_TUBE_ANGLE, m_autoadTubeAngleHighlimit);
- DDX_Control(pDX, IDC_EDIT_L_TUBEANGLE, m_autoadTubeAngleLowlimit);
- DDX_Control(pDX, IDC_EDIT_C_TUBE_HEIGHT, m_autoadTubeHeightCurrent);
- DDX_Control(pDX, IDC_EDIT_H_TUBE_HEIGHT, m_autoadTubeHeightHighlimit);
- DDX_Control(pDX, IDC_EDIT_L_TUBEHEIGHT, m_autoadTubeHeightLowlimit);
- DDX_Control(pDX, IDC_COMBO_SELFT_DOF, m_selftestDOF);
- DDX_Control(pDX, IDC_EDIT_SELFT_HIGH_LIMIT, m_selftestHighlimit);
- DDX_Control(pDX, IDC_EDIT_SELFT_LOW_LIMIT, m_selftestlowlimit);
- DDX_Control(pDX, IDC_EDIT_SELFT_PERIOD, m_selftestperiod);
- DDX_Control(pDX, IDC_EDIT_SELFT_DUTYCYCLE, m_selftestdutycycle);
- DDX_Control(pDX, IDC_EDIT2, m_selftestRepeatTime);
- DDX_Control(pDX, IDC_COMBO_LINE_SELECTION, m_comboTubeLineSelection);
- DDX_Control(pDX, IDC_COMBO_DETECTOR_SELECTION, m_comboDetectorSelection);
- DDX_Control(pDX, IDC_RADIO_WALL, m_radioWSWall);
- DDX_Control(pDX, IDC_RADIO_TABLE, m_radioWSTable);
- }
- BEGIN_MESSAGE_MAP(CDialogADCalibrationMain, CDialogEx)
- ON_BN_CLICKED(IDC_BUTTON_ROTATE_TUBE_ANGLE, &CDialogADCalibrationMain::OnBnClickedButtonRotateTubeAngle)
- ON_BN_CLICKED(IDC_BUTTON_MOVE_TUBE_HEIGHT, &CDialogADCalibrationMain::OnBnClickedButtonMoveTubeHeight)
- ON_BN_CLICKED(IDC_BUTTON_READ_AD_TUBE_ANGLE, &CDialogADCalibrationMain::OnBnClickedButtonReadAdTubeAngle)
- ON_BN_CLICKED(IDC_BUTTON_READ_AD_TUBE_HEIGHT, &CDialogADCalibrationMain::OnBnClickedButtonReadAdTubeHeight)
- ON_BN_CLICKED(IDC_BUTTON_READ_AD_DET_HEIGHT, &CDialogADCalibrationMain::OnBnClickedButtonReadAdDetHeight)
- ON_BN_CLICKED(IDC_BUTTON_CAL_TUBE_ANGLE_AD, &CDialogADCalibrationMain::OnBnClickedButtonCalTubeAngleAd)
- ON_BN_CLICKED(IDC_BUTTON_CAL_TUBE_HEIGHT_AD, &CDialogADCalibrationMain::OnBnClickedButtonCalTubeHeightAd)
- ON_BN_CLICKED(IDC_BUTTON_CAL_DET_HEIGHT_AD, &CDialogADCalibrationMain::OnBnClickedButtonCalDetHeightAd)
- ON_WM_CLOSE()
- ON_BN_CLICKED(IDC_BUTTON_READ_ENCODER_TUBE_ANGLE, &CDialogADCalibrationMain::OnBnClickedButtonReadEncoderTubeAngle)
- ON_BN_CLICKED(IDC_BUTTON_READ_ENCODER_TUBE_HEIGHT, &CDialogADCalibrationMain::OnBnClickedButtonReadEncoderTubeHeight)
- ON_BN_CLICKED(IDC_BUTTON_ENTER_CALIBRATION, &CDialogADCalibrationMain::OnBnClickedButtonEnterCalibration)
- ON_BN_CLICKED(IDC_BUTTON_EXIT_CALIBRATION, &CDialogADCalibrationMain::OnBnClickedButtonExitCalibration)
- ON_BN_CLICKED(IDC_BUTTON_RESET_SYSTEM, &CDialogADCalibrationMain::OnBnClickedButtonResetSystem)
- ON_BN_CLICKED(ID_BUTTON_CENTERADJUST, &CDialogADCalibrationMain::OnBnClickedButtonCenteradjust)
- ON_BN_CLICKED(ID_BUTTON_PARKING, &CDialogADCalibrationMain::OnBnClickedButtonParking)
- ON_BN_CLICKED(ID_BUTTON_TUBE_ANGLE_LOW_LIMIT, &CDialogADCalibrationMain::OnBnClickedButtonTubeAngleLowLimit)
- ON_BN_CLICKED(ID_BUTTON_TUBE_HEIGHT_LOW_LIMIT, &CDialogADCalibrationMain::OnBnClickedButtonTubeHeightLowLimit)
- ON_BN_CLICKED(IDC_BUTTON_ENTER_SELFTEST, &CDialogADCalibrationMain::OnBnClickedButtonEnterSelftest)
- ON_BN_CLICKED(IDC_BUTTON_EXIT_SELFTEST, &CDialogADCalibrationMain::OnBnClickedButtonExitSelftest)
- ON_BN_CLICKED(IDC_BUTTON_START_SELFTEST, &CDialogADCalibrationMain::OnBnClickedButtonStartSelftest)
- ON_BN_CLICKED(IDC_BUTTON_ACTIVE_TUBE_ANGLE_Z_CLEAR, &CDialogADCalibrationMain::OnBnClickedButtonActiveTubeAngleZClear)
- ON_BN_CLICKED(IDC_BUTTON_CANCEL_TUBE_ANGLE_Z_CLEAR, &CDialogADCalibrationMain::OnBnClickedButtonCancelTubeAngleZClear)
- ON_BN_CLICKED(IDC_BUTTON_ACTIVE_TUBE_HEIGHT_Z_CLEAR, &CDialogADCalibrationMain::OnBnClickedButtonActiveTubeHeightZClear)
- ON_BN_CLICKED(IDC_BUTTON_CANCEL_TUBE_HEIGHT_Z_CLEAR, &CDialogADCalibrationMain::OnBnClickedButtonCancelTubeHeightZClear)
- ON_BN_CLICKED(IDC_BUTTON_ROTATE_TO_TUBE_ANGLE_Z_AXIS, &CDialogADCalibrationMain::OnBnClickedButtonRotateToTubeAngleZAxis)
- ON_BN_CLICKED(IDC_BUTTON_MOVE_TO_TUBE_HEIGHT_Z_AXIS, &CDialogADCalibrationMain::OnBnClickedButtonMoveToTubeHeightZAxis)
- ON_BN_CLICKED(IDC_BUTTON_EM_STOP, &CDialogADCalibrationMain::OnBnClickedButtonEmStop)
- ON_BN_CLICKED(IDC_BUTTON_SET_PCODE_PARAM, &CDialogADCalibrationMain::OnBnClickedButtonSetPcodeParam)
- ON_BN_CLICKED(IDC_BUTTON_ROTATE_TUBE_ANGLE_PHY, &CDialogADCalibrationMain::OnBnClickedButtonRotateTubeAnglePhy)
- ON_BN_CLICKED(IDC_BUTTON_MOVE_TUBE_HEIGHT_PHY, &CDialogADCalibrationMain::OnBnClickedButtonMoveTubeHeightPhy)
- ON_BN_CLICKED(IDC_BUTTON_INSERT_TUBE_ANGLE, &CDialogADCalibrationMain::OnBnClickedButtonInsertTubeAngle)
- ON_BN_CLICKED(IDC_BUTTON_INSERT_TUBE_HEIGHT, &CDialogADCalibrationMain::OnBnClickedButtonInsertTubeHeight)
- ON_BN_CLICKED(IDC_BUTTON_INSERT_Detector_HEIGHT, &CDialogADCalibrationMain::OnBnClickedButtonInsertDetectorHeight)
- ON_BN_CLICKED(IDC_BUTTON_AUTO_CALAD_TUBEANGLE, &CDialogADCalibrationMain::OnBnClickedButtonAutoCaladTubeangle)
- ON_BN_CLICKED(IDC_BUTTON_AUTO_CALAD_TUBEHEIGHT, &CDialogADCalibrationMain::OnBnClickedButtonAutoCaladTubeheight)
- ON_BN_CLICKED(IDC_TUBE_ANGLE_SVO, &CDialogADCalibrationMain::OnBnClickedTubeAngleSvo)
- ON_BN_CLICKED(IDC_BUTTON_TUBEHEIGHT_SVO, &CDialogADCalibrationMain::OnBnClickedButtonTubeheightSvo)
- ON_BN_CLICKED(IDC_RADIO_WALL, &CDialogADCalibrationMain::OnBnClickedRadioWall)
- ON_BN_CLICKED(IDC_RADIO_TABLE, &CDialogADCalibrationMain::OnBnClickedRadioTable)
- ON_BN_CLICKED(IDC_BUTTON_RESET_TUBE_ANGLE_SAVEVALUE, &CDialogADCalibrationMain::OnBnClickedButtonResetTubeAngleSavevalue)
- ON_BN_CLICKED(IDC_BUTTON_RESET_TUBE_ANGLE_ENCODERZERO_SAVEVALUE, &CDialogADCalibrationMain::OnBnClickedButtonResetTubeAngleEncoderzeroSavevalue)
- ON_BN_CLICKED(IDC_BUTTON_TUBE_LINE_SAVE_MINPOS, &CDialogADCalibrationMain::OnBnClickedButtonTubeLineSaveMinpos)
- ON_BN_CLICKED(IDC_BUTTON_TUBE_LINE_SAVE_ENCODERZERO, &CDialogADCalibrationMain::OnBnClickedButtonTubeLineSaveEncoderzero)
- ON_CBN_SELCHANGE(IDC_COMBO_LINE_SELECTION, &CDialogADCalibrationMain::OnCbnSelchangeComboLineSelection)
- ON_CBN_SELENDOK(IDC_COMBO_LINE_SELECTION, &CDialogADCalibrationMain::OnCbnSelendokComboLineSelection)
- END_MESSAGE_MAP()
- // CDialogADCalibrationMain 消息处理程序
- void CDialogADCalibrationMain::OnBnClickedButtonRotateTubeAngle()
- {
- auto direction = m_rotateDirection.GetCurSel();
- CString strSteps;
- m_rotateStep.GetWindowText(strSteps);
- auto steps = atoi(strSteps.GetString());
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- oTemp.add("Orientation", direction);
- oTemp.add("StepNumber", steps);
- Request.add("P0", oTemp);
- g_DiosAPIServer.ExecuteAction("MachineryCalMotionTubeAngleRotate", Request, Result, 3000);
- }
- void CDialogADCalibrationMain::OnBnClickedButtonMoveTubeHeight()
- {
- auto direction = m_tubeHeightDirection.GetCurSel();
- CString strSteps;
- m_tubeHeightStep.GetWindowText(strSteps);
- auto steps = atoi(strSteps.GetString());
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- oTemp.add("Orientation", direction);
- oTemp.add("StepNumber", steps);
- Request.add("P0", oTemp);
- int sel = m_comboTubeLineSelection.GetCurSel();
- if (sel == 0)
- {
- g_DiosAPIServer.ExecuteAction("MachineryCalMotionTubeLineV", Request, Result, 3000);
- }
- else if (sel == 1)
- {
- g_DiosAPIServer.ExecuteAction("MachineryCalMotionTubeLineH", Request, Result, 3000);
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonReadAdTubeAngle()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachineryCalGetADofTubeAngle", Request, Result, 3000) == RET_SUCCEED)
- {
- ResDataObject obj1;
- try
- {
- obj1 = Result["P0"];
- CString strText((const char*)obj1["ADTubeAngle"]);
- m_tubeAngleAD.SetWindowText(strText);
- }
- catch (ResDataObjectExption &exp)
- {
- printf("%s%s", exp.what(), "\\n");
- TPRINTA_ERROR(exp.what());
- }
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonReadAdTubeHeight()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- dios_result res = RET_SUCCEED;
- int sel = m_comboTubeLineSelection.GetCurSel();
- if (sel == 0)
- {
- res = g_DiosAPIServer.ExecuteAction("MachineryCalGetADofTubeLineV", Request, Result, 30000);
- }
- else if (sel == 1)
- {
- res = g_DiosAPIServer.ExecuteAction("MachineryCalGetADofTubeLineH", Request, Result, 30000);
- }
- if (res == RET_SUCCEED)
- {
- string str = Result.encode();
- ResDataObject obj1;
- try
- {
- obj1 = Result["P0"];
- CString strText((const char*)obj1["ADTubeHeight"]);
- m_tubeHeightAD.SetWindowText(strText);
- }
- catch (ResDataObjectExption &exp)
- {
- printf("%s%s", exp.what(), "\\n");
- TPRINTA_ERROR(exp.what());
- }
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonReadAdDetHeight()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- dios_result res = RET_SUCCEED;
- int sel = m_comboDetectorSelection.GetCurSel();
- if (sel == 0)
- {
- res = g_DiosAPIServer.ExecuteAction("MachineryCalGetADofDetector", Request, Result, 30000);
- }
- else if (sel == 1)
- {
- res = g_DiosAPIServer.ExecuteAction("MachineryCalGetADofHorizontalDetector", Request, Result, 30000);
- }
- if (res == RET_SUCCEED)
- {
- ResDataObject obj1;
- try
- {
- obj1 = Result["P0"];
- CString strText((const char*)obj1["ADDetectorHeight"]);
- m_detectorAD.SetWindowText(strText);
- }
- catch (ResDataObjectExption &exp)
- {
- printf("%s%s", exp.what(), "\\n");
- TPRINTA_ERROR(exp.what());
- }
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonReadEncoderTubeAngle()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachineryCalGetEncoderOfTubeAngle", Request, Result, 3000) == RET_SUCCEED)
- {
- ResDataObject obj1;
- try
- {
- obj1 = Result["P0"];
- CString strText((const char*)obj1["EncoderTubeAngle"]);
- m_tubeAngleEncoder.SetWindowText(strText);
- }
- catch (ResDataObjectExption &exp)
- {
- printf("%s%s", exp.what(), "\\n");
- TPRINTA_ERROR(exp.what());
- }
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonReadEncoderTubeHeight()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- dios_result res = RET_SUCCEED;
- int sel = m_comboTubeLineSelection.GetCurSel();
- if (sel == 0)
- {
- res = g_DiosAPIServer.ExecuteAction("MachineryCalGetEncoderofTubeLineV", Request, Result, 30000);
- }
- else if (sel == 1)
- {
- res = g_DiosAPIServer.ExecuteAction("MachineryCalGetEncoderofTubeLineH", Request, Result, 30000);
- }
- if (res == RET_SUCCEED)
- {
- string str = Result.encode();
- ResDataObject obj1;
- try
- {
- obj1 = Result["P0"];
- CString strText((const char*)obj1["EncoderTubeHeight"]);
- m_tubeHeightEncoder.SetWindowText(strText);
- }
- catch (ResDataObjectExption &exp)
- {
- printf("%s%s", exp.what(), "\\n");
- TPRINTA_ERROR(exp.what());
- }
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonCalTubeAngleAd()
- {
- ResDataObject Request;
- ResDataObject Result;
- CString physicals;
- CString ads;
- ResDataObject params;
- m_tubeAngleCalPhysicals.GetWindowText(physicals);
- m_tubeAngleCalADs.GetWindowText(ads);
- auto vphs = SplitCString(physicals, "#");
- for (int i = 0; i < vphs.size();++i)
- {
- char tmp[64] = { 0 };
- sprintf_s(tmp, "Physical%d", i);
- params.add(tmp, vphs[i].GetString());
- }
- auto vads = SplitCString(ads,"#");
- for (int i = 0; i < vads.size();++i)
- {
- char tmp[64] = { 0 };
- sprintf_s(tmp, "AD%d", i);
- params.add(tmp, vads[i].GetString());
- }
- params.add("PointCount", (int)vphs.size());
- Request.add("P0", params);
- if (g_DiosAPIServer.ExecuteAction("MachineryCalSaveParamsofTubeAngle", Request, Result, 30000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonCalTubeHeightAd()
- {
- ResDataObject Request;
- ResDataObject Result;
- CString physicals;
- CString ads;
- ResDataObject params;
- m_tubeHeightCalPhysicals.GetWindowText(physicals);
- m_tubHeightCalADs.GetWindowText(ads);
- auto vphs = SplitCString(physicals, "#");
- for (int i = 0; i < vphs.size(); ++i)
- {
- char tmp[64] = { 0 };
- sprintf_s(tmp, "Physical%d", i);
- params.add(tmp, vphs[i].GetString());
- }
- auto vads = SplitCString(ads, "#");
- for (int i = 0; i < vads.size(); ++i)
- {
- char tmp[64] = { 0 };
- sprintf_s(tmp, "AD%d", i);
- params.add(tmp, vads[i].GetString());
- }
- params.add("PointCount", (int)vphs.size());
- Request.add("P0", params);
- int sel = m_comboTubeLineSelection.GetCurSel();
- if (sel == 0)
- {
- g_DiosAPIServer.ExecuteAction("MachineryCalSaveParamsofTubeLiveV", Request, Result, 30000);
- }
- else if (sel == 1)
- {
- g_DiosAPIServer.ExecuteAction("MachineryCalSaveParamsofTubeLiveH", Request, Result, 30000);
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonCalDetHeightAd()
- {
- ResDataObject Request;
- ResDataObject Result;
- CString physicals;
- CString ads;
- ResDataObject params;
- m_detectorHeightCalPhysicals.GetWindowText(physicals);
- m_detectorCalAds.GetWindowText(ads);
- auto vphs = SplitCString(physicals, "#");
- for (int i = 0; i < vphs.size(); ++i)
- {
- char tmp[64] = { 0 };
- sprintf_s(tmp, "Physical%d", i);
- params.add(tmp, vphs[i].GetString());
- }
- auto vads = SplitCString(ads, "#");
- for (int i = 0; i < vads.size(); ++i)
- {
- char tmp[64] = { 0 };
- sprintf_s(tmp, "AD%d", i);
- params.add(tmp, vads[i].GetString());
- }
- params.add("PointCount", (int)vphs.size());
- Request.add("P0", params);
- int sel = m_comboDetectorSelection.GetCurSel();
- if (sel == 0)
- {
- g_DiosAPIServer.ExecuteAction("MachineryCalSaveParamsofDetector", Request, Result, 30000);
- }
- else if (sel == 1)
- {
- g_DiosAPIServer.ExecuteAction("MachineryCalSaveParamsofDetectorHorizontal", Request, Result, 30000);
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonEnterCalibration()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachineryEnterCalibration", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonExitCalibration()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachineryExitCalibration", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonResetSystem()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachineryRESET", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonCenteradjust()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachineryCenterAdjust", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonParking()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- oTemp.add("ParkingMode", 1);
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachineryParkingTo", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonTubeAngleLowLimit()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- oTemp.add("ParkingMode", 2);
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachineryParkingTo", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonTubeHeightLowLimit()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- oTemp.add("ParkingMode", 3);
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachineryParkingTo", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonEnterSelftest()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachineryEnterMechnicalSelfTest", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonExitSelftest()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachineryExitMechnicalSelfTest", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonStartSelftest()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- CString highlimit, lowlimit, period, dutyCycle,repeatTime;
- m_selftestHighlimit.GetWindowText(highlimit);
- m_selftestlowlimit.GetWindowText(lowlimit);
- m_selftestperiod.GetWindowText(period);
- m_selftestdutycycle.GetWindowText(dutyCycle);
- m_selftestRepeatTime.GetWindowText(repeatTime);
- oTemp.add("DOF", m_selftestDOF.GetCurSel());
- oTemp.add("HighLimit", highlimit.GetString());
- oTemp.add("LowLimit", lowlimit.GetString());
- oTemp.add("Period", atoi(period.GetString()));
- oTemp.add("DutyCycle", dutyCycle.GetString());
- oTemp.add("RepeatTime", atoi(repeatTime.GetString()));
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachineryStartMechnicalSelfTest", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonActiveTubeAngleZClear()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachineryActiveTubeAngleZAxisClear", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonCancelTubeAngleZClear()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachineryCancelTubeAngleZAxisClear", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonActiveTubeHeightZClear()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachineryActiveTubeHeightZAxisClear", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonCancelTubeHeightZClear()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachineryCancelTubeHeightZAxisClear", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonRotateToTubeAngleZAxis()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachineryTubeAngleRotateToZAxis", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonMoveToTubeHeightZAxis()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachineryTubeHeightMoveToZAxis", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonEmStop()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachineryForceStopAllMotion", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::SetExamMode(int mode)
- {
- ResDataObject Request;
- ResDataObject Result;
- if (mode == 0)
- {
- Request.add("P0", "Single");
- }
- else if (mode == 1)
- {
- Request.add("P0", "TOMO");
- }
- else if (mode == 2)
- {
- Request.add("P0", "CBCT");
- }
- if (g_DiosAPIServer.ExecuteAction("MachinerySetExpMode", Request, Result, 30000))
- {
- printf("MachinerySetExpMode Action Failed\n");
- }
- else
- {
- printf("MachinerySetExpMode Action Succeed\n");
- }
- //ResDataObject ExamDR;
- //ResDataObject ExamTomo;
- //ResDataObject ExamCBCT;
- //ResDataObject ExamInfo;
- //ExamDR.add("Single", "1");
- //ExamTomo.add("TOMO", "1");
- //ExamCBCT.add("CBCT", "1");
- //if (mode == 0)
- //{
- // ExamInfo.add("DX", ExamDR);
- //}
- //else if (mode == 1)
- //{
- // ExamInfo.add("DX", ExamTomo);
- //}
- //else if (mode == 2)
- //{
- // ExamInfo.add("DX", ExamCBCT);
- //}
- //Request.add("P0", ExamInfo);
- //if (g_DiosAPIServer.ExecuteAction("MachinerySetExamInfo", Request, Result, 30000))
- //{
- // printf("SetExamInfo Action Failed\n");
- //}
- //else
- //{
- // printf("SetExamInfo Action Succeed\n");
- //}
- //Request.clear(); Result.clear();
- //Request.add("P0", "DX");
- //if (g_DiosAPIServer.ExecuteAction("MachinerySelectExamMode", Request, Result, 30000) < RET_SUCCEED)
- //{
- // printf("SelectExamMode Action Failed\n");
- //}
- //else
- //{
- // printf("SelectExamMode Action Succeed\n");
- //}
- }
- void CDialogADCalibrationMain::OnBnClickedButtonSetPcodeParam()
- {
- int nCurSel = 1;
- SetWorkstation();
- nCurSel = m_examMode.GetCurSel();
- if (nCurSel < 0)
- {
- nCurSel = 1;
- }
- SetExamMode(nCurSel);
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- CString strPositionCode;
- m_pcode.GetWindowText(strPositionCode);
- Request.clear(); Result.clear();
- if (g_DiosAPIServer.ExecuteAction("MachineryFrameAcq", Request, Result, 30000) < RET_SUCCEED)
- {
- printf("FrameAcq Action Failed\n");
- }
- else
- {
- printf("FrameAcq Action Succeed\n");
- }
- oTemp.add("SID", "1.20");
- oTemp.add("PositionNumber", strPositionCode);
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachinerySetTechParamsInfo", Request, Result, 30000) < RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonRotateTubeAnglePhy()
- {
- auto direction = m_rotateDirection.GetCurSel();
- CString strSteps;
- m_rotateStep.GetWindowText(strSteps);
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- oTemp.add("AsPhysical",1);
- oTemp.add("Orientation", direction);
- oTemp.add("StepNumber", strSteps.GetString());
- Request.add("P0", oTemp);
- g_DiosAPIServer.ExecuteAction("MachineryCalMotionTubeAngleRotate", Request, Result, 3000);
- }
- void CDialogADCalibrationMain::OnBnClickedButtonMoveTubeHeightPhy()
- {
- auto direction = m_tubeHeightDirection.GetCurSel();
- CString strSteps;
- m_tubeHeightStep.GetWindowText(strSteps);
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- oTemp.add("AsPhysical", 1);
- oTemp.add("Orientation", direction);
- oTemp.add("StepNumber", strSteps.GetString());
- Request.add("P0", oTemp);
- int sel = m_comboTubeLineSelection.GetCurSel();
- if (sel == 0)
- {
- g_DiosAPIServer.ExecuteAction("MachineryCalMotionTubeLineV", Request, Result, 3000);
- }
- else if (sel == 1)
- {
- g_DiosAPIServer.ExecuteAction("MachineryCalMotionTubeLineH", Request, Result, 3000);
- }
- }
- BOOL CDialogADCalibrationMain::OnInitDialog()
- {
- CDialogEx::OnInitDialog();
- m_examMode.AddString("RAD");
- m_examMode.AddString("TOMO");
- m_examMode.AddString("CBCT");
- ResDataObject obj1;
- obj1.add("sdsd",2996);
- CString strText((const char*)obj1["sdsd"]);
- m_rotateDirection.AddString("AntiClockwise");
- m_rotateDirection.AddString("Clockwise");
- m_tubeHeightDirection.AddString("Up");
- m_tubeHeightDirection.AddString("Down");
- m_selftestDOF.AddString("TubeAngle");
- m_selftestDOF.AddString("TubeHeight");
- m_rotateDirection.SetCurSel(0);
- m_tubeHeightDirection.SetCurSel(0);
- m_selftestDOF.SetCurSel(0);
- m_tubeAngleSvoStatus = 0;
- m_tubeHeightSvoStatus = 0;
- m_comboTubeLineSelection.AddString("Vertical");
- m_comboTubeLineSelection.AddString("Horizontal");
- m_comboTubeLineSelection.SetCurSel(0);
- m_comboDetectorSelection.AddString("Wall");
- m_comboDetectorSelection.AddString("Table");
- m_comboDetectorSelection.SetCurSel(0);
- if (g_DiosAPIServer.OpenMachinery() == DR_OK)
- {
- Sleep(3000);
- OnBnClickedButtonEnterCalibration();
- GetResetPos(0);
- }
- return TRUE;
- }
- void CDialogADCalibrationMain::OnClose()
- {
- CDialogEx::OnClose();
- }
- void CDialogADCalibrationMain::OnBnClickedButtonInsertTubeAngle()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachineryCalGetADofTubeAngle", Request, Result, 3000) == RET_SUCCEED)
- {
- ResDataObject obj1;
- try
- {
- obj1 = Result["P0"];
- CString strText((const char*)obj1["ADTubeAngle"]);
- m_tubeAngleAD.SetWindowText(strText);
- CString physicals;
- CString ads;
- m_tubeAngleCalPhysicals.GetWindowText(physicals);
- m_tubeAngleCalADs.GetWindowText(ads);
- if (ads != "")
- {
- ads = ads + "#" + strText;
- }
- else
- {
- ads = ads + strText;
- }
- m_tubeAngleCalADs.SetWindowText(ads);
- CDialogPhysicalInput ph;
- ph.DoModal();
- CString phy = ph.GetInput();
- if (physicals != "")
- {
- physicals = physicals + "#" + phy.Trim();
- }
- else
- {
- physicals = physicals + phy.Trim();
- }
- m_tubeAngleCalPhysicals.SetWindowText(physicals);
-
- }
- catch (ResDataObjectExption &exp)
- {
- printf("%s%s", exp.what(), "\\n");
- TPRINTA_ERROR(exp.what());
- }
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonInsertTubeHeight()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachineryCalGetADofTubeLineV", Request, Result, 30000) == RET_SUCCEED)
- {
- string str = Result.encode();
- ResDataObject obj1;
- try
- {
- obj1 = Result["P0"];
- CString strText((const char*)obj1["ADTubeHeight"]);
- m_tubeHeightAD.SetWindowText(strText);
- CString physicals;
- CString ads;
- m_tubeHeightCalPhysicals.GetWindowText(physicals);
- m_tubHeightCalADs.GetWindowText(ads);
- if (ads != "")
- {
- ads = ads + "#" + strText;
- }
- else
- {
- ads = ads + strText;
- }
- m_tubHeightCalADs.SetWindowText(ads);
- CDialogPhysicalInput ph;
- ph.DoModal();
- CString phy = ph.GetInput();
- if (physicals != "")
- {
- physicals = physicals + "#" + phy.Trim();
- }
- else
- {
- physicals = physicals + phy.Trim();
- }
- m_tubeHeightCalPhysicals.SetWindowText(physicals);
- }
- catch (ResDataObjectExption &exp)
- {
- printf("%s%s", exp.what(), "\\n");
- TPRINTA_ERROR(exp.what());
- }
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonInsertDetectorHeight()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("MachineryCalGetADofDetector", Request, Result, 3000) == RET_SUCCEED)
- {
- ResDataObject obj1;
- try
- {
- obj1 = Result["P0"];
- CString strText((const char*)obj1["ADDetectorHeight"]);
- m_detectorAD.SetWindowText(strText);
- CString physicals;
- CString ads;
- m_detectorHeightCalPhysicals.GetWindowText(physicals);
- m_detectorCalAds.GetWindowText(ads);
- if (ads != "")
- {
- ads = ads + "#" + strText;
- }
- else
- {
- ads = ads + strText;
- }
- m_detectorCalAds.SetWindowText(ads);
- CDialogPhysicalInput ph;
- ph.DoModal();
- CString phy = ph.GetInput();
- if (physicals != "")
- {
- physicals = physicals + "#" + phy.Trim();
- }
- else
- {
- physicals = physicals + phy.Trim();
- }
- m_detectorHeightCalPhysicals.SetWindowText(physicals);
- }
- catch (ResDataObjectExption &exp)
- {
- printf("%s%s", exp.what(), "\\n");
- TPRINTA_ERROR(exp.what());
- }
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonAutoCaladTubeangle()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- CString current;
- m_autoadTubeAngleCurrent.GetWindowText(current);
- CString high;
- m_autoadTubeAngleHighlimit.GetWindowText(high);
- CString low;
- m_autoadTubeAngleLowlimit.GetWindowText(low);
- oTemp.add("DOF", 0);
- oTemp.add("CurrentHeight", current.GetString());
- oTemp.add("HighLimit", high.GetString());
- oTemp.add("LowLimit", low.GetString());
- Request.add("P0", oTemp);
- g_DiosAPIServer.ExecuteAction("MachineryAutoADCalibration", Request, Result, 3000);
- }
- void CDialogADCalibrationMain::OnBnClickedButtonAutoCaladTubeheight()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- CString current;
- m_autoadTubeHeightCurrent.GetWindowText(current);
- CString high;
- m_autoadTubeHeightHighlimit.GetWindowText(high);
- CString low;
- m_autoadTubeHeightLowlimit.GetWindowText(low);
- oTemp.add("DOF", 1);
- oTemp.add("CurrentHeight", current.GetString());
- oTemp.add("HighLimit", high.GetString());
- oTemp.add("LowLimit", low.GetString());
- Request.add("P0", oTemp);
- g_DiosAPIServer.ExecuteAction("MachineryAutoADCalibration", Request, Result, 3000);
- }
- void CDialogADCalibrationMain::OnBnClickedTubeAngleSvo()
- {
- if (m_tubeAngleSvoStatus == 0)
- {
- m_tubeAngleSvoStatus = 1;
- }
- else
- {
- m_tubeAngleSvoStatus = 0;
- }
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- oTemp.add("DOF", 0);
- oTemp.add("SvoStatus", m_tubeAngleSvoStatus);
- Request.add("P0", oTemp);
- g_DiosAPIServer.ExecuteAction("MachinerySetSvoStatus", Request, Result, 3000);
- }
- void CDialogADCalibrationMain::OnBnClickedButtonTubeheightSvo()
- {
- if (m_tubeHeightSvoStatus == 0)
- {
- m_tubeHeightSvoStatus = 1;
- }
- else
- {
- m_tubeHeightSvoStatus = 0;
- }
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- oTemp.add("DOF", 1);
- oTemp.add("SvoStatus", m_tubeHeightSvoStatus);
- Request.add("P0", oTemp);
- int sel = m_comboTubeLineSelection.GetCurSel();
- if (sel == 0)
- {
- g_DiosAPIServer.ExecuteAction("MachinerySetSvoStatus", Request, Result, 3000);
- }
- else if (sel == 1)
- {
- g_DiosAPIServer.ExecuteAction("MachinerySetSvoStatusTubeH", Request, Result, 3000);
- }
- }
- void CDialogADCalibrationMain::OnBnClickedRadioWall()
- {
- // TODO: 在此添加控件通知处理程序代码
- //ResDataObject Request;
- //ResDataObject Result;
- //Request.add("P0", "Wall");
- //g_DiosAPIServer.ExecuteAction("MachinerySetWorkstation", Request, Result, 3000);
- }
- void CDialogADCalibrationMain::OnBnClickedRadioTable()
- {
- // TODO: 在此添加控件通知处理程序代码
- //ResDataObject Request;
- //ResDataObject Result;
- //Request.add("P0", "Table");
- //g_DiosAPIServer.ExecuteAction("MachinerySetWorkstation", Request, Result, 3000);
- }
- void CDialogADCalibrationMain::SetWorkstation()
- {
- ResDataObject Request;
- ResDataObject Result;
- if (m_radioWSWall.GetCheck() == 1)
- {
- Request.add("P0", "Wall");
- }
- else if (m_radioWSTable.GetCheck() == 1)
- {
- Request.add("P0", "Table");
- }
- g_DiosAPIServer.ExecuteAction("MachinerySetWorkstation", Request, Result, 3000);
- }
- void CDialogADCalibrationMain::OnBnClickedButtonResetTubeAngleSavevalue()
- {
- // TODO: 在此添加控件通知处理程序代码
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- CString strLowpos;
- GetDlgItem(IDC_EDIT_RESET_TUBE_ANGLE_MIN)->GetWindowText(strLowpos);
- oTemp.add("MotionUnit", "TubeAngle");
- oTemp.add("LowPosition", strLowpos);
- Request.add("P0", oTemp);
- g_DiosAPIServer.ExecuteAction("MachineryCalSaveResetLowPosition", Request, Result, 3000);
- }
- void CDialogADCalibrationMain::OnBnClickedButtonResetTubeAngleEncoderzeroSavevalue()
- {
- // TODO: 在此添加控件通知处理程序代码
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- CString strEncoderZeroPos;
- GetDlgItem(IDC_EDIT_RESET_TUBE_ANGLE_ENCODERZERO)->GetWindowText(strEncoderZeroPos);
- oTemp.add("MotionUnit", "TubeAngle");
- oTemp.add("EncoderZeroPosition", strEncoderZeroPos);
- Request.add("P0", oTemp);
- g_DiosAPIServer.ExecuteAction("MachineryCalSaveResetEcoderZeroPosition", Request, Result, 3000);
- }
- void CDialogADCalibrationMain::OnBnClickedButtonTubeLineSaveMinpos()
- {
- // TODO: 在此添加控件通知处理程序代码
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- CString strLowpos;
- GetDlgItem(IDC_EDIT_TUBE_LINE_POS_MIN)->GetWindowText(strLowpos);
- int sel = m_comboTubeLineSelection.GetCurSel();
- if (sel == 0)
- {
- oTemp.add("MotionUnit", "TubeVertical");
- }
- else if (sel == 1)
- {
- oTemp.add("MotionUnit", "TubeHorizontal");
- }
-
- oTemp.add("LowPosition", strLowpos);
- Request.add("P0", oTemp);
- g_DiosAPIServer.ExecuteAction("MachineryCalSaveResetLowPosition", Request, Result, 3000);
- }
- void CDialogADCalibrationMain::OnBnClickedButtonTubeLineSaveEncoderzero()
- {
- // TODO: 在此添加控件通知处理程序代码
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- CString strEncoderZeroPos;
- GetDlgItem(IDC_EDIT_TUBE_LINE_POS_ENCODER_ZERO)->GetWindowText(strEncoderZeroPos);
- int sel = m_comboTubeLineSelection.GetCurSel();
- if (sel == 0)
- {
- oTemp.add("MotionUnit", "TubeVertical");
- }
- else if (sel == 1)
- {
- oTemp.add("MotionUnit", "TubeHorizontal");
- }
- oTemp.add("EncoderZeroPosition", strEncoderZeroPos);
- Request.add("P0", oTemp);
- g_DiosAPIServer.ExecuteAction("MachineryCalSaveResetEcoderZeroPosition", Request, Result, 3000);
- }
- void CDialogADCalibrationMain::GetResetPos(int nTubeOrientation)
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- CString strlog;
- if (g_DiosAPIServer.ExecuteAction("MachineryCalGetResetPosParam", Request, Result, 30000) == RET_SUCCEED)
- {
- CString strlog = Result.encode();
- OutputDebugString(strlog);
- ResDataObject obj1;
- try
- {
- obj1 = Result["P0"];
- CString strTextLow, strTextZero;
- strlog.Format("select sel = %d", nTubeOrientation);
- OutputDebugString(strlog);
-
- if (nTubeOrientation == 0)
- {
- OutputDebugString("enter 0");
- ResDataObject objTubeHeight = obj1["TubeHeight"];
- m_fTubeHeightLowPos = atof(objTubeHeight["LowPosition"]);
- m_fTubeHeightZeroPos = atof(objTubeHeight["EncoderZeroPosition"]);
- strTextLow.Format("%0.3f", m_fTubeHeightLowPos);
- strTextZero.Format("%0.3f", m_fTubeHeightZeroPos);
-
- strlog.Format("TubeHeight, low pos=%s, zero pos=%s", strTextLow, strTextZero);
- OutputDebugString(strlog);
- }
- else
- {
- ResDataObject objTubeHorizontal = obj1["TubeHorizontal"];
- m_fTubeHorizontalLowPos = atof(objTubeHorizontal["LowPosition"]);
- m_fTubeHorizontalZeroPos = atof(objTubeHorizontal["EncoderZeroPosition"]);
- strTextLow.Format("%0.3f", m_fTubeHorizontalLowPos);
- strTextZero.Format("%0.3f", m_fTubeHorizontalZeroPos);
- strlog.Format("TubeHorizontal, low pos=%s, zero pos=%s", strTextLow, strTextZero);
- OutputDebugString(strlog);
- }
-
- GetDlgItem(IDC_EDIT_TUBE_LINE_POS_MIN)->SetWindowText(strTextLow);
- GetDlgItem(IDC_EDIT_TUBE_LINE_POS_ENCODER_ZERO)->SetWindowText(strTextZero);
- }
- catch (ResDataObjectExption& exp)
- {
- strlog.Format("GetResetPos catch, %s", exp.what());
- OutputDebugString(strlog);
- TPRINTA_ERROR(exp.what());
- }
- }
- }
- void CDialogADCalibrationMain::OnCbnSelchangeComboLineSelection()
- {
- // TODO: 在此添加控件通知处理程序代码
- }
- void CDialogADCalibrationMain::OnCbnSelendokComboLineSelection()
- {
- // TODO: 在此添加控件通知处理程序代码
- int nsel = m_comboTubeLineSelection.GetCurSel();
- GetResetPos(nsel);
- }
|