|
|
@@ -4,6 +4,7 @@
|
|
|
#include "../wnd/CChufangSettingWnd.h"
|
|
|
|
|
|
#include "../print/CPosPrinter.h"
|
|
|
+#include "../helper/CComHelper.h"
|
|
|
|
|
|
CSettingPageUI::CSettingPageUI()
|
|
|
{
|
|
|
@@ -161,6 +162,7 @@ void CSettingPageUI::InitShow()
|
|
|
std::string setting_printer_leixing = CSetting::GetParam("setting_printer_leixing");
|
|
|
|
|
|
CHorizontalLayoutUI* usb_layout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("setting_printer_usb_layout")));
|
|
|
+ CHorizontalLayoutUI* chuankou_layout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("setting_printer_chuankou_layout")));
|
|
|
CHorizontalLayoutUI* wangkou_layout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("setting_printer_wangkou_layout")));
|
|
|
|
|
|
if (setting_printer_leixing == "auto")
|
|
|
@@ -169,8 +171,9 @@ void CSettingPageUI::InitShow()
|
|
|
com->SelectItem(0, false, false);
|
|
|
com->SetText(L"智能识别模式");
|
|
|
|
|
|
- //智能识别模式隐藏这2个
|
|
|
+ //智能识别模式隐藏这3个
|
|
|
usb_layout->SetVisible(false);
|
|
|
+ chuankou_layout->SetVisible(false);
|
|
|
wangkou_layout->SetVisible(false);
|
|
|
}
|
|
|
else if (setting_printer_leixing == "usb")
|
|
|
@@ -181,6 +184,7 @@ void CSettingPageUI::InitShow()
|
|
|
|
|
|
//显示usb布局
|
|
|
usb_layout->SetVisible(true);
|
|
|
+ chuankou_layout->SetVisible(false);
|
|
|
wangkou_layout->SetVisible(false);
|
|
|
|
|
|
//usb下拉框默认选中
|
|
|
@@ -221,6 +225,7 @@ void CSettingPageUI::InitShow()
|
|
|
com->SetText(L"并口");
|
|
|
|
|
|
usb_layout->SetVisible(false);
|
|
|
+ chuankou_layout->SetVisible(false);
|
|
|
wangkou_layout->SetVisible(false);
|
|
|
}
|
|
|
else if (setting_printer_leixing == "chuankou")
|
|
|
@@ -230,7 +235,40 @@ void CSettingPageUI::InitShow()
|
|
|
com->SetText(L"串口");
|
|
|
|
|
|
usb_layout->SetVisible(false);
|
|
|
+ chuankou_layout->SetVisible(true);
|
|
|
wangkou_layout->SetVisible(false);
|
|
|
+
|
|
|
+ //串口下拉框默认选中
|
|
|
+ CComboUI* com_chuankou = static_cast<CComboUI*>(this->FindSubControl(_T("setting_printer_com")));
|
|
|
+ com_chuankou->RemoveAll();
|
|
|
+
|
|
|
+ //数据库中保存的之前的设置
|
|
|
+ std::string setting_printer_com = CSetting::GetParam("setting_printer_com");
|
|
|
+ std::wstring ws_setting_printer_com = CLewaimaiString::UTF8ToUnicode(setting_printer_com);
|
|
|
+
|
|
|
+ CComHelper helper;
|
|
|
+ std::vector<std::wstring> com_devices = helper.getComPort();
|
|
|
+
|
|
|
+ int i = 0;
|
|
|
+ int nSelect = -1;
|
|
|
+
|
|
|
+ for (std::vector<std::wstring>::iterator it = com_devices.begin(); it != com_devices.end(); it++)
|
|
|
+ {
|
|
|
+ CListLabelElementUI* elem = new CListLabelElementUI();
|
|
|
+ elem->SetText((*it).c_str());
|
|
|
+ com_chuankou->Add(elem);
|
|
|
+
|
|
|
+ if (*it == ws_setting_printer_com)
|
|
|
+ {
|
|
|
+ nSelect = i;
|
|
|
+ }
|
|
|
+
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+
|
|
|
+ com_chuankou->SetInternVisible(true);
|
|
|
+ com_chuankou->SelectItem(nSelect, false, false);
|
|
|
+ com_chuankou->SetText(CLewaimaiString::UTF8ToUnicode(setting_printer_com).c_str());
|
|
|
}
|
|
|
else if (setting_printer_leixing == "wangkou")
|
|
|
{
|
|
|
@@ -239,6 +277,7 @@ void CSettingPageUI::InitShow()
|
|
|
com->SetText(L"网口");
|
|
|
|
|
|
usb_layout->SetVisible(false);
|
|
|
+ chuankou_layout->SetVisible(false);
|
|
|
wangkou_layout->SetVisible(true);
|
|
|
|
|
|
std::string setting_printer_wangkou_ip = CSetting::GetParam("setting_printer_wangkou_ip");
|
|
|
@@ -357,6 +396,95 @@ void CSettingPageUI::InitShow()
|
|
|
box->Selected(false, false);
|
|
|
}
|
|
|
|
|
|
+ //电子秤设置
|
|
|
+ com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_dianzicheng_xinghao")));
|
|
|
+ std::string setting_dianzicheng_xinghao = CSetting::GetParam("setting_dianzicheng_xinghao");
|
|
|
+
|
|
|
+ if (setting_dianzicheng_xinghao == "dahua_acs")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(0, false, false);
|
|
|
+ com->SetText(L"大华ACS-30Ab");
|
|
|
+ }
|
|
|
+
|
|
|
+ //串口下拉框默认选中
|
|
|
+ CComboUI* com_dianzicheng = static_cast<CComboUI*>(this->FindSubControl(_T("setting_dianzicheng_chuankou")));
|
|
|
+ com_dianzicheng->RemoveAll();
|
|
|
+
|
|
|
+ //数据库中保存的之前的设置
|
|
|
+ std::string setting_dianzicheng_com = CSetting::GetParam("setting_dianzicheng_com");
|
|
|
+ std::wstring ws_setting_dianzicheng_com = CLewaimaiString::UTF8ToUnicode(setting_dianzicheng_com);
|
|
|
+
|
|
|
+ CComHelper helper;
|
|
|
+ std::vector<std::wstring> com_devices = helper.getComPort();
|
|
|
+
|
|
|
+ int i = 0;
|
|
|
+ int nSelect = -1;
|
|
|
+
|
|
|
+ for (std::vector<std::wstring>::iterator it = com_devices.begin(); it != com_devices.end(); it++)
|
|
|
+ {
|
|
|
+ CListLabelElementUI* elem = new CListLabelElementUI();
|
|
|
+ elem->SetText((*it).c_str());
|
|
|
+ com_dianzicheng->Add(elem);
|
|
|
+
|
|
|
+ if (*it == ws_setting_dianzicheng_com)
|
|
|
+ {
|
|
|
+ nSelect = i;
|
|
|
+ }
|
|
|
+
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+
|
|
|
+ com_dianzicheng->SetInternVisible(true);
|
|
|
+ com_dianzicheng->SelectItem(nSelect, false, false);
|
|
|
+ com_dianzicheng->SetText(CLewaimaiString::UTF8ToUnicode(setting_dianzicheng_com).c_str());
|
|
|
+
|
|
|
+ com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_dianzicheng_botelv")));
|
|
|
+ std::string setting_dianzicheng_botelv = CSetting::GetParam("setting_dianzicheng_botelv");
|
|
|
+
|
|
|
+ if (setting_dianzicheng_botelv == "600")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(0, false, false);
|
|
|
+ com->SetText(L"600");
|
|
|
+ }
|
|
|
+ else if (setting_dianzicheng_botelv == "1200")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(1, false, false);
|
|
|
+ com->SetText(L"1200");
|
|
|
+ }
|
|
|
+ else if (setting_dianzicheng_botelv == "2400")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(2, false, false);
|
|
|
+ com->SetText(L"2400");
|
|
|
+ }
|
|
|
+ else if (setting_dianzicheng_botelv == "4800")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(3, false, false);
|
|
|
+ com->SetText(L"4800");
|
|
|
+ }
|
|
|
+ else if (setting_dianzicheng_botelv == "9600")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(4, false, false);
|
|
|
+ com->SetText(L"9600");
|
|
|
+ }
|
|
|
+ else if (setting_dianzicheng_botelv == "19200")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(5, false, false);
|
|
|
+ com->SetText(L"19200");
|
|
|
+ }
|
|
|
+ else if (setting_dianzicheng_botelv == "38400")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(6, false, false);
|
|
|
+ com->SetText(L"38400");
|
|
|
+ }
|
|
|
+
|
|
|
//系统设置
|
|
|
box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_is_auto_start")));
|
|
|
if (CSetting::GetParam("setting_is_auto_start") == "1")
|
|
|
@@ -402,8 +530,8 @@ void CSettingPageUI::InitShow()
|
|
|
|
|
|
std::vector<std::wstring> usb_devices = CPosPrinterQueue::GetInstance()->getUsbDevices();
|
|
|
|
|
|
- int i = 0;
|
|
|
- int nSelect = -1;
|
|
|
+ i = 0;
|
|
|
+ nSelect = -1;
|
|
|
|
|
|
for (std::vector<std::wstring>::iterator it = usb_devices.begin(); it != usb_devices.end(); it++)
|
|
|
{
|
|
|
@@ -1119,21 +1247,26 @@ void CSettingPageUI::HandleSelectChangeMsg(TNotifyUI& msg)
|
|
|
CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(this->FindSubControl(_T("setting_switch")));
|
|
|
pControl->SelectItem(4);
|
|
|
}
|
|
|
- else if (name == _T("setting_xianshi_switch"))
|
|
|
+ else if (name == _T("setting_dianzicheng_switch"))
|
|
|
{
|
|
|
CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(this->FindSubControl(_T("setting_switch")));
|
|
|
pControl->SelectItem(5);
|
|
|
}
|
|
|
- else if (name == _T("setting_system_switch"))
|
|
|
+ else if (name == _T("setting_xianshi_switch"))
|
|
|
{
|
|
|
CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(this->FindSubControl(_T("setting_switch")));
|
|
|
pControl->SelectItem(6);
|
|
|
}
|
|
|
- else if (name == _T("setting_system_about"))
|
|
|
+ else if (name == _T("setting_system_switch"))
|
|
|
{
|
|
|
CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(this->FindSubControl(_T("setting_switch")));
|
|
|
pControl->SelectItem(7);
|
|
|
}
|
|
|
+ else if (name == _T("setting_system_about"))
|
|
|
+ {
|
|
|
+ CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(this->FindSubControl(_T("setting_switch")));
|
|
|
+ pControl->SelectItem(8);
|
|
|
+ }
|
|
|
else if (name == _T("xianshi_setting_youtu"))
|
|
|
{
|
|
|
CSetting::SetParam("setting_xianshi_is_youtu", "1");
|
|
|
@@ -1188,6 +1321,7 @@ void CSettingPageUI::HandleItemSelectMsg(TNotifyUI& msg)
|
|
|
CComboUI* com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_printer_leixing")));
|
|
|
|
|
|
CHorizontalLayoutUI* usb_layout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("setting_printer_usb_layout")));
|
|
|
+ CHorizontalLayoutUI* chuankou_layout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("setting_printer_chuankou_layout")));
|
|
|
CHorizontalLayoutUI* wangkou_layout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("setting_printer_wangkou_layout")));
|
|
|
|
|
|
if (com->GetCurSel() == 0)
|
|
|
@@ -1195,6 +1329,7 @@ void CSettingPageUI::HandleItemSelectMsg(TNotifyUI& msg)
|
|
|
CSetting::SetParam("setting_printer_leixing", "auto");
|
|
|
|
|
|
usb_layout->SetVisible(false);
|
|
|
+ chuankou_layout->SetVisible(false);
|
|
|
wangkou_layout->SetVisible(false);
|
|
|
}
|
|
|
else if (com->GetCurSel() == 1)
|
|
|
@@ -1203,6 +1338,7 @@ void CSettingPageUI::HandleItemSelectMsg(TNotifyUI& msg)
|
|
|
|
|
|
//显示usb布局
|
|
|
usb_layout->SetVisible(true);
|
|
|
+ chuankou_layout->SetVisible(false);
|
|
|
wangkou_layout->SetVisible(false);
|
|
|
|
|
|
//usb下拉框默认选中
|
|
|
@@ -1241,6 +1377,7 @@ void CSettingPageUI::HandleItemSelectMsg(TNotifyUI& msg)
|
|
|
CSetting::SetParam("setting_printer_leixing", "bingkou");
|
|
|
|
|
|
usb_layout->SetVisible(false);
|
|
|
+ chuankou_layout->SetVisible(false);
|
|
|
wangkou_layout->SetVisible(false);
|
|
|
}
|
|
|
else if (com->GetCurSel() == 3)
|
|
|
@@ -1248,13 +1385,47 @@ void CSettingPageUI::HandleItemSelectMsg(TNotifyUI& msg)
|
|
|
CSetting::SetParam("setting_printer_leixing", "chuankou");
|
|
|
|
|
|
usb_layout->SetVisible(false);
|
|
|
+ chuankou_layout->SetVisible(true);
|
|
|
wangkou_layout->SetVisible(false);
|
|
|
+
|
|
|
+ //串口下拉框默认选中
|
|
|
+ CComboUI* com_chuankou = static_cast<CComboUI*>(this->FindSubControl(_T("setting_printer_com")));
|
|
|
+ com_chuankou->RemoveAll();
|
|
|
+
|
|
|
+ //数据库中保存的之前的设置
|
|
|
+ std::string setting_printer_com = CSetting::GetParam("setting_printer_com");
|
|
|
+ std::wstring ws_setting_printer_com = CLewaimaiString::UTF8ToUnicode(setting_printer_com);
|
|
|
+
|
|
|
+ CComHelper helper;
|
|
|
+ std::vector<std::wstring> com_devices = helper.getComPort();
|
|
|
+
|
|
|
+ int i = 0;
|
|
|
+ int nSelect = -1;
|
|
|
+
|
|
|
+ for (std::vector<std::wstring>::iterator it = com_devices.begin(); it != com_devices.end(); it++)
|
|
|
+ {
|
|
|
+ CListLabelElementUI* elem = new CListLabelElementUI();
|
|
|
+ elem->SetText((*it).c_str());
|
|
|
+ com_chuankou->Add(elem);
|
|
|
+
|
|
|
+ if (*it == ws_setting_printer_com)
|
|
|
+ {
|
|
|
+ nSelect = i;
|
|
|
+ }
|
|
|
+
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+
|
|
|
+ com_chuankou->SetInternVisible(true);
|
|
|
+ com_chuankou->SelectItem(nSelect, false, false);
|
|
|
+ com_chuankou->SetText(CLewaimaiString::UTF8ToUnicode(setting_printer_com).c_str());
|
|
|
}
|
|
|
else if (com->GetCurSel() == 4)
|
|
|
{
|
|
|
CSetting::SetParam("setting_printer_leixing", "wangkou");
|
|
|
|
|
|
usb_layout->SetVisible(false);
|
|
|
+ chuankou_layout->SetVisible(false);
|
|
|
wangkou_layout->SetVisible(true);
|
|
|
|
|
|
std::string setting_printer_wangkou_ip = CSetting::GetParam("setting_printer_wangkou_ip");
|
|
|
@@ -1270,6 +1441,36 @@ void CSettingPageUI::HandleItemSelectMsg(TNotifyUI& msg)
|
|
|
|
|
|
CSetting::SetParam("setting_printer_usb", CLewaimaiString::UnicodeToUTF8(usb_device));
|
|
|
}
|
|
|
+ else if (name == _T("setting_printer_com"))
|
|
|
+ {
|
|
|
+ CComboUI* com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_printer_com")));
|
|
|
+ wstring com_device = com->GetText();
|
|
|
+
|
|
|
+ CSetting::SetParam("setting_printer_com", CLewaimaiString::UnicodeToUTF8(com_device));
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_dianzicheng_xinghao"))
|
|
|
+ {
|
|
|
+ CComboUI* com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_dianzicheng_xinghao")));
|
|
|
+
|
|
|
+ if (com->GetCurSel() == 0)
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_dianzicheng_xinghao", "dahua_acs");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_dianzicheng_chuankou"))
|
|
|
+ {
|
|
|
+ CComboUI* com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_dianzicheng_chuankou")));
|
|
|
+ wstring com_device = com->GetText();
|
|
|
+
|
|
|
+ CSetting::SetParam("setting_dianzicheng_com", CLewaimaiString::UnicodeToUTF8(com_device));
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_dianzicheng_botelv"))
|
|
|
+ {
|
|
|
+ CComboUI* com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_dianzicheng_botelv")));
|
|
|
+ wstring com_device = com->GetText();
|
|
|
+
|
|
|
+ CSetting::SetParam("setting_dianzicheng_botelv", CLewaimaiString::UnicodeToUTF8(com_device));
|
|
|
+ }
|
|
|
else if (name == _T("setting_biaoqian_printer_usb"))
|
|
|
{
|
|
|
CComboUI* com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_biaoqian_printer_usb")));
|