📄 dlgdataview.cpp
字号:
void CDlgDataView::OnButtonPrintPre()
{
//暂停抓拍视频
CVideoCaptureView* pView=CVideoCaptureView::GetView();
if(!pView) return;
pView->IsCapturing=FALSE;
SaveToDB();
PreparePrint();
WriteLog("PreparePrint ok");
Sleep(0);
try{
//调用打印模版 打印报表
HINSTANCE hLibrary;
// pPrintRecord PrintRecord;
pPrintFile PrintFile;
hLibrary=LoadLibrary("PrintDll.dll");
if(!hLibrary)
{
ShowMessage2("打印模块PrintDll.dll丢失");
return;
}
PrintFile=(pPrintFile)GetProcAddress(hLibrary,"PrintFile");
TCHAR pc[]=".\\wftzs.frf";
int b=(*PrintFile)(m_sPrintParam.GetBuffer(0),pc);
FreeLibrary(hLibrary);
}catch (...) {
AfxMessageBox("打印模块调用失败!");
}
//重新开始抓拍视频
// pView->IsCapturing=TRUE;
}
void CDlgDataView::OnButtonPrint()
{
//暂停抓拍视频
CVideoCaptureView* pView=CVideoCaptureView::GetView();
if(!pView) return;
// pView->IsCapturing=FALSE;
SaveToDB();
PreparePrint();
Sleep(500);
WriteLog("ok");
//调用打印模版 打印报表
HINSTANCE hLibrary;
// pPrintRecord PrintRecord;
pPrintFile PrintFile;
hLibrary=LoadLibrary("PrintDll.dll");
if(!hLibrary)
{
ShowMessage2("打印模块PrintDll.dll丢失");
return;
}
// PrintRecord=(pPrintRecord)GetProcAddress(hLibrary,"PrintRecord");
PrintFile=(pPrintFile)GetProcAddress(hLibrary,"PrintFile");
CString str;
GetDlgItem(IDC_RECORD_ID)->GetWindowText(str);
// int a= (*PrintRecord)(atoi(str),bigBMP+1);
TCHAR pc[]=".\\wftzs.frf";
int b=(*PrintFile)(m_sPrintParam.GetBuffer(0),pc,0,1);
FreeLibrary(hLibrary);
//重新开始抓拍视频
// pView->IsCapturing=TRUE;
}
BEGIN_EVENTSINK_MAP(CDlgDataView, CDialog)
//{{AFX_EVENTSINK_MAP(CDlgDataView)
ON_EVENT(CDlgDataView, IDC_MMCONTROL, 4 /* PlayClick */, OnPlayClickMmcontrol, VTS_PI2)
//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()
void CDlgDataView::OnPlayClickMmcontrol(short FAR* Cancel)
{
//m_avi.SetCommand("next");
m_avi.SetCommand("Prev");
m_avi.SetCommand("Play");
}
//选择汉字 在号牌编辑框 显示
void CDlgDataView::OnCloseupComboFirstLicense2()
{
UpdateData();
CString s,s1;
GetDlgItem(IDC_COMBO_FIRST_LICENSE2)->GetWindowText(s);
GetDlgItem(IDC_LICENSE2)->GetWindowText(s1);
if (s1.GetLength()>2 && s.GetLength()>0) {
s1=s1.Mid(2);
}
s1=s+s1;
GetDlgItem(IDC_LICENSE2)->SetWindowText(s1);
}
//设置车号,头位汉字在 提供选择框选择
void CDlgDataView::OnChangeLicense2()
{
/*
m_FirstLicense2.ShowDropDown(FALSE);
CString str;
GetDlgItem(IDC_LICENSE2)->GetWindowText(str);
if(str.Left(2)=="WJ")
return;
if(str.GetLength()>0)
{
if(IsDBCSLeadByte(*str.GetBuffer(0)))
return;
else
{
CString nn=str.Right(1);
int num=atoi(nn.GetBuffer(0));
if (num >0)
{
CString hz="";
if (m_FirstLicense2.GetCount()>=num)
m_FirstLicense2.GetLBText(num-1,hz);
GetDlgItem(IDC_LICENSE2)->SetWindowText("");
if(hz.GetLength() > 1)
{
char aa[3];
aa[2]='\0';
memcpy(aa,hz.GetBuffer(0),2);
// GetDlgItem(IDC_LICENSE2)->SendMessage(WM_CHAR,(WPARAM)((aa[1]<<8)+aa[0]),0);
GetDlgItem(IDC_LICENSE2)->SetWindowText(aa);
((CEdit*) (GetDlgItem(IDC_LICENSE2)))->SetSel(2,3);
}
m_FirstLicense2.ShowDropDown(FALSE);
}
else
{
m_FirstLicense2.ResetContent();
CVideoCaptureView* pView=CVideoCaptureView::GetView();
CADODataset* pRst=new CADODataset();
pRst->SetConnection(pView->pConn);
CString sql;
sql.Format("select * from HPHZ where PY like '%s%%' order by PY desc",str);
pRst->Open(sql,CADODataset::openQuery);
int i=1;
if (pRst->IsEof())
{
GetDlgItem(IDC_LICENSE2)->SetWindowText("");
}
CString text;
while (!pRst->IsEof())
{
pRst->GetFieldValue("HZ",str);
text.Format("%s-%d",str,i);
// m_firstLicense.SetWindowText(str);
m_FirstLicense2.AddString(text);
pRst->MoveNext();
i++;
}
if(i==2)
{
if(text.GetLength() > 1)
{
GetDlgItem(IDC_LICENSE2)->SetWindowText("");
BYTE aa[2];
memcpy(aa,text.GetBuffer(0),2);
GetDlgItem(IDC_LICENSE2)->SendMessage(WM_CHAR,(WPARAM)((aa[1]<<8)+aa[0]),0);
m_FirstLicense2.ShowDropDown();
}
}
pRst->Close();
delete pRst;//->~CADODataset();
pRst=NULL;
m_FirstLicense2.ShowDropDown();
}
}
}*/
}
//选择框在末尾添加汉字
void CDlgDataView::OnCloseupComboLastLicense2()
{
CString str,str2;
// UpdateData(TRUE);
int a=m_LastLicense2.GetCurSel();
if (a>-1)
{
m_LastLicense2.GetLBText(a,str);
// m_LastLicense.GetWindowText(str);
GetDlgItem(IDC_LICENSE2)->GetWindowText(str2);
GetDlgItem(IDC_LICENSE2)->SetWindowText(str2+str);
}
}
void CDlgDataView::OnButtonSend()
{
SaveToDB();
CVideoCaptureView* pView=CVideoCaptureView::GetView();
while(!pView)
pView=CVideoCaptureView::GetView();
// if(pView->m_dwManualTransRecordID<1)
{
CString str;
GetDlgItem(IDC_RECORD_ID)->GetWindowText(str);
pView->m_dwManualTransRecordID=atol(str);
long aaaa=pView->m_dwManualTransRecordID;
pView->m_iSendPicNum=bigBMP;
//12.25 add
for(int i=0;i<8;i++)
{
if(i==bigBMP)
{
CString strSqll,thisBmpFile="";
thisBmpFile=bmpFile[i];
int iipos=thisBmpFile.Find("\\");
while(iipos>0)
{
thisBmpFile=thisBmpFile.Right(thisBmpFile.GetLength()-iipos-1);
iipos=thisBmpFile.Find("\\");
}
strSqll.Format("Update Record Set SDCS='1' , bmp='%s' where XH=%ld",thisBmpFile,pView->m_dwManualTransRecordID);
pView->pConn->Execute(strSqll);
}
else
{
if (bmpFile[i].Find(".")>0)
{
try{
DeleteFile(bmpFile[i]);
}
catch (...) {
}
}
}
}
//删除主界面 列表框的选中 项
CListCtrl* pLC=(CListCtrl*)pView->GetDlgItem(IDC_LIST_DATA);
if(pLC->GetItemCount()>1)
{
if (!RecordChange(1,FALSE))
if(!RecordChange(2,FALSE))
EndDialog(0);
}
else if(pLC->GetItemCount()==1)
{
CString str=pLC->GetItemText(0,0);
thisNum=atol(str.GetBuffer(0));
}
for(i=0;i<pLC->GetItemCount();i++)
{
if(pView->ZDJC)
{
if(atol(pLC->GetItemText(i,7))==aaaa)//m_lRecordID)
{
pLC->DeleteItem(i);
break;
}
}
else
{
if(atol(pLC->GetItemText(i,0))==aaaa)//m_lRecordID)
{
pLC->DeleteItem(i);
break;
}
}
}
//当没有数据时关闭该窗口
if(pLC->GetItemCount()<=1)
EndDialog(0);
}
/*12.25 else
{
CString st;
st.Format("上个记录[%ld]还没有发送完毕",pView->m_dwManualTransRecordID);
ShowMessage(st);
}*/
}
void CDlgDataView::OnCloseupComboCarType()
{
//保存参数
CComboBox* pCb=(CComboBox*)GetDlgItem(IDC_COMBO_CAR_TYPE);
int i=pCb->GetCurSel();
if(i<0)
return;
CString str,cartype;
pCb->GetLBText(i,str);
pRstGlobal->Close();
pRstGlobal->Open("select CLLX from CLLX where LXMS='"+str+"'",CADODataset::openQuery);
if(pRstGlobal->IsEof())
cartype="";
else
{
pRstGlobal->GetFieldValue(0,cartype);
}
pRstGlobal->Close();
GetDlgItem(IDC_CAR_TYPE)->SetWindowText(cartype);
}
void CDlgDataView::OnCloseupComboAlarm()
{
CComboBox* pCb=(CComboBox*)GetDlgItem(IDC_COMBO_ALARM);
int i=pCb->GetCurSel();
if(i<0)
return;
CString str,cartype;
long dm=pCb->GetItemData(i);
cartype.Format("%0.4d",dm);
GetDlgItem(IDC_EDIT_ALARM)->SetWindowText(cartype);
}
void CDlgDataView::OnButtonBk()
{
CVideoCaptureView* pView=CVideoCaptureView::GetView();
while(!pView)
pView=CVideoCaptureView::GetView();
CString str;
GetDlgItem(IDC_LICENSE2)->GetWindowText(str);
if(str.GetLength()>4)
{
CString sql;
sql.Format("Update WZBK set DEAL='1', CLRQ=Date() where HPHM='%s'",str);
CADODataset* pRst=new CADODataset();
pRst->SetConnection(pView->pConn);
pRst->ExecSql(sql);
delete pRst;
}
}
void CDlgDataView::PreparePrint()
{
CVideoCaptureView* pView=CVideoCaptureView::GetView();
while(!pView)
pView=CVideoCaptureView::GetView();
try{
CString sValue;
GetDlgItem(IDC_CAP_DATE)->GetWindowText(sValue);
COleDateTime tt,tt1;
tt.ParseDateTime(sValue);
tt1=COleDateTime::GetCurrentTime();
CString sTZSJ;
sTZSJ.Format("%d 年 %d 月 %d 日",tt1.GetYear(),tt1.GetMonth(),tt1.GetDay());
CString WFDD;
GetDlgItem(IDC_CAP_ADDRESS)->GetWindowText(WFDD);
CString WFXW;
GetDlgItem(IDC_COMBO_ALARM)->GetWindowText(WFXW);
CString WFDM;
GetDlgItem(IDC_EDIT_ALARM)->GetWindowText(WFDM);
CString nr1="",nr2="",nr3="";
TCHAR sVal[MAX_PATH];
GetPrivateProfileString("printer","nr1","XXXXXXX",sVal,MAX_PATH,".\\config.ini");
nr1=sVal;
GetPrivateProfileString("printer","nr2","XXXXXXX",sVal,MAX_PATH,".\\config.ini");
nr2=sVal;
GetPrivateProfileString("printer","nr3","XXXXXXX",sVal,MAX_PATH,".\\config.ini");
nr3=sVal;
CString sWFSJ;
GetDlgItem(IDC_CAP_DATE)->GetWindowText(sWFSJ);
tt.ParseDateTime(sWFSJ);
sValue=tt.Format("%Y%m%d%H%M");
CString sXH;//sWFSJ
sXH.Format("%s%s%s%0.8ld",pView->m_szAddress,pView->m_szMachineID,sValue,m_lRecordID);
m_sPrintParam="";
m_sPrintParam.Format("-GAJG-:%s^-BH-:%s^-Y-:%d^-M-:%d^-D-:%d^-H-:%d^-MI-:%d^-WFDD-:%s^-WFXW-:%s^-WFDM-:%s^-NR1-:%s^-NR2-:%s^-NR3-:%s^-DATE-:%s",
pView->m_szPoliceUint,sXH,tt.GetYear(),tt.GetMonth(),tt.GetDay(),tt.GetHour(),tt.GetMinute(),WFDD,WFXW,WFDM,nr1,nr2,nr3,sTZSJ);
CString sHPHM;
GetDlgItem(IDC_LICENSE2)->GetWindowText(sHPHM);
CString sCLLX;
GetDlgItem(IDC_COMBO1)->GetWindowText(sCLLX);
CString sBFB="",BFB1="",BFB2="";
long targetSpeed,MaxSpeed;
GetDlgItem(IDC_TARGETSPEED)->GetWindowText(sValue);
if (sValue.GetLength()>0) {
targetSpeed=atoi(sValue.GetBuffer(0));
}else
targetSpeed=0;
GetDlgItem(IDC_LIMITED_SPEED)->GetWindowText(sValue);
if (sValue.GetLength()>0) {
MaxSpeed=atoi(sValue.GetBuffer(0));
}else
MaxSpeed=0;
if(targetSpeed>MaxSpeed&&targetSpeed&&MaxSpeed){
int bfb=(targetSpeed-MaxSpeed)*100/MaxSpeed;
sBFB.Format("%d%%",bfb);
if (bfb<51) {
BFB1="√";
BFB2="";
}else
{
BFB2="√";
BFB1="";
}
}
if (bigBMP<1) {
bigBMP=1;
}
CString sWFTP=bmpFile[bigBMP];
int days=::GetPrivateProfileInt("printer","day",15,".\\config.ini");
CString LXDH;
GetPrivateProfileString("system","name","110",sVal,MAX_PATH,".\\config.ini");
sValue=sVal;
int i=sValue.Find("---");
if (i>1) {
LXDH=sValue.Mid(i+3);
}else{
LXDH="";
}
//NAME=无锡交警大队---0510-110
sValue.Format("-HPHM-:%s^-CLLX-:%s^-WFSJ-:%s^-BFB-:%s^-BFB1-:%s^-BFB2-:%s^-WFTP-:%s^-DAY-:%d^-LXDH-:%s^-XSSD-:%dkm/h^-CLXS-:%dkm/h",
sHPHM,sCLLX,sWFSJ,sBFB,BFB1,BFB2,sWFTP,days,LXDH,targetSpeed,MaxSpeed);
m_sPrintParam=m_sPrintParam+"^"+sValue;
sValue.Format("-WFTP1-:%s",YJTP);
m_sPrintParam=m_sPrintParam+"^"+sValue;
WriteLog(m_sPrintParam);
}catch (...) {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -