📄 plmaindlg.cpp
字号:
}
//显示
m_lst.ShowWindow (SW_SHOWNORMAL);
m_lst.SetFocus ();
this->RedrawWindow();
}
void CPlMainDlg::OnAlarm()
{
//时间
CEdit* pBoxOne;
pBoxOne = (CEdit*) GetDlgItem (IDC_SCRTIME);
pBoxOne->ShowWindow (SW_HIDE);
KillTimer (TMR_HOROLOGE);
//调整显示
m_lst.DeleteColumn (2);
m_lst.DeleteColumn (1);
m_lst.DeleteColumn (0);
m_lst.InsertColumn (0,_T(""),LVCFMT_LEFT,0);
m_lst.InsertColumn (1,_T("序号"),LVCFMT_CENTER,70);
m_lst.InsertColumn (2,_T("报警内容"),LVCFMT_CENTER,280);
m_lst.MoveWindow (1 ,22 ,368,195);
//显示内容
m_lst.DeleteAllItems ();
int index;
wchar_t strTmp[1024]=TEXT("\0");
//获取
CDiskDataHandle help;
int Max=0,I=0;
Max=help.GetAlarm();
if(0 != Max)
{
for (I=0;I<Max;I++)
{
wsprintf(strTmp,_T("30%02d"),I+1);
index=m_lst.InsertItem (I+1,strTmp);
wsprintf(strTmp,_T("%d"),I+1);
m_lst.SetItemText(index,1,strTmp);//序号
m_lst.SetItemText(index,2,theApp.strText[I]);//求助内容
}
}
//显示
m_lst.ShowWindow (SW_SHOWNORMAL);
m_lst.SetFocus ();
this->RedrawWindow();
}
void CPlMainDlg::OnInfo()
{
//时间
CEdit* pBoxOne;
pBoxOne = (CEdit*) GetDlgItem (IDC_SCRTIME);
pBoxOne->ShowWindow (SW_HIDE);
KillTimer (TMR_HOROLOGE);
//更改列表头
m_lst.DeleteColumn (2);
m_lst.DeleteColumn (1);
m_lst.DeleteColumn (0);
m_lst.InsertColumn (0,_T(""),LVCFMT_LEFT,0);
m_lst.InsertColumn (1,_T("读否"),LVCFMT_CENTER,40);
m_lst.InsertColumn (2,_T("时间"),LVCFMT_CENTER,135);
m_lst.MoveWindow (1 ,22 ,190,195);
//显示内容
m_lst.DeleteAllItems ();
int index;
wchar_t strTmp[1024]=TEXT("\0");
//获取
CDiskDataHandle help;
int Max=0,I=0,iLocal=0,bRead=0;
Max=help.GetNotify ();
if(0 != Max)
{
for (I=0;I<Max;I++)
{
wsprintf(strTmp,_T("40%02d"),I+1);
index=m_lst.InsertItem (I+1,strTmp);
swscanf(theApp.strText[I],_T("%d@"),&bRead);
if(bRead == 0)
m_lst.SetItemText(index,1,_T("Х"));//是否已读
else
m_lst.SetItemText(index,1,_T("√"));//是否已读
//解析日期
wcsncpy(strTmp,theApp.strText[I]+2,wcslen(theApp.strText[I])-2);
strTmp[wcslen(theApp.strText[I])-2]=0;
strTmp[13]=':';
strTmp[16]=':';
m_lst.SetItemText(index,2,strTmp);//时间
}
}
//显示
m_lst.ShowWindow (SW_SHOWNORMAL);
m_lst.SetFocus ();
this->RedrawWindow();
}
void CPlMainDlg::OnSetup()
{
//时间
CEdit* pBoxOne;
pBoxOne = (CEdit*) GetDlgItem (IDC_SCRTIME);
pBoxOne->ShowWindow (SW_HIDE);
KillTimer (TMR_HOROLOGE);
TCHAR path[256]=TEXT("\0"),sms[512]=TEXT("\0");
CFile fCode;
#ifdef WINCE
wcscpy(path,TEXT("\\Storage Card\\sms.gps"));
#else
wcscpy(path,TEXT(".\\4.gps"));
#endif
fCode.Open (path,CFile::modeCreate | CFile::modeReadWrite);
//生成测试文件
/*vcSpot spot;
memset (&spot,0,sizeof(spot));
wcscpy(spot.Desc ,_T("一般报案"));
wcscpy(spot.Insurance ,_T("王英"));
wcscpy(spot.License ,_T("京A"));
wcscpy(spot.LinkTel ,_T("010-83548990"));
spot.Main =0;
wcscpy(spot.OperName ,_T("李京"));
wcscpy(spot.OperTel ,_T("89900"));
wcscpy(spot.ReportName ,_T("赵忠祥"));
wcscpy(spot.ReportTime ,_T("2005-09-08 12:10:06"));
wcscpy(spot.SpotID ,_T("第4个测试报案"));
wcscpy(spot.RecvTime ,_T("2005-09-08 12:14:06"));
fCode.Write(&spot,sizeof(spot));
Setup set;
memset(&set,0,sizeof(Setup));
strcpy(set.ip ,"192.168.0.1");
strcpy(set.port ,"9100");
strcpy(set.sms ,"8613800377500");
fCode.Write(&set,sizeof(set));
//wcscpy(sms,_T(" 第3个小组通知 请各成员务必注意,未了加快我们的工作进度,请各位成员尽快熟悉我们的车载设备。GPS领导工作小组2000505050散开来发送看到发连锁店开发绿色;的放大到\0"));
//fCode.Write(sms,wcslen(sms)*2);
fCode.Close ();*/
//CDialog::OnCancel();
//启动通信
//更改列表头
m_lst.DeleteColumn (2);
m_lst.DeleteColumn (1);
m_lst.DeleteColumn (0);
m_lst.InsertColumn (0,_T(""),LVCFMT_LEFT,0);
m_lst.InsertColumn (1,_T("序号"),LVCFMT_LEFT,50);
m_lst.InsertColumn (2,_T("内容"),LVCFMT_CENTER,200);
m_lst.MoveWindow (1 ,22 ,250,195);
pe.InitPePort(_T("COM2:"));
}
void CPlMainDlg::OnClickLst(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
POSITION pos = m_lst.GetFirstSelectedItemPosition();
if (pos == NULL)
return ;
int nItem = m_lst.GetNextSelectedItem(pos);
//MessageBox(m_lst.GetItemText (nItem,0));
LstReadDataHandle();
*pResult = 0;
}
void CPlMainDlg::OnCancel()
{
// TODO: Add extra cleanup here
//CDialog::OnCancel();
}
void CPlMainDlg::OnOK()
{
// TODO: Add extra validation here
//CDialog::OnOK();
}
BOOL CPlMainDlg::LstReadDataHandle()
{
m_Local=-1;
POSITION pos = m_lst.GetFirstSelectedItemPosition();
if (pos == NULL)
return FALSE;
int nItem = m_lst.GetNextSelectedItem(pos);
wchar_t h2Bit[8] = _T(""),e2Bit[8] = _T(""),strData[256] = _T("");
wcscpy(strData,m_lst.GetItemText (nItem,0));
wcsncpy(h2Bit,strData,2);
h2Bit[2] = 0;
wcsncpy(e2Bit,strData + 2,2);
e2Bit[2] = 0;
switch(_wtoi(h2Bit))
{
case 11://新调度
if (_wtoi(e2Bit) == 0)//新调度汇总
FillNewSpot();
else//详细列表
FillSpotData(_wtoi(h2Bit),_wtoi(e2Bit)-1);
break;
case 12://过程调度
if (_wtoi(e2Bit) == 0)//过程调度汇总
FillProcSpot();
else//详细列表
FillSpotData(_wtoi(h2Bit),_wtoi(e2Bit)-1);
break;
case 13://完成调度
if (_wtoi(e2Bit) == 0)//完成调度汇总
FillFinishSpot();
else//详细列表
FillSpotData(_wtoi(h2Bit),_wtoi(e2Bit)-1);
break;
case 40://通知
FillNotifyData (_wtoi(e2Bit)-1);
break;
default:
break;
}
//判断条件
return TRUE;
}
void CPlMainDlg::FillNewSpot()
{
//更改列表头
m_lst.DeleteColumn (2);
m_lst.DeleteColumn (1);
m_lst.DeleteColumn (0);
m_lst.InsertColumn (0,_T(""),LVCFMT_LEFT,0);
m_lst.InsertColumn (1,_T("序号"),LVCFMT_CENTER,40);
m_lst.InsertColumn (2,_T("时间"),LVCFMT_CENTER,135);
m_lst.MoveWindow (1 ,22 ,190,195);
//显示内容
m_lst.DeleteAllItems ();
int index;
wchar_t strTmp[1024]=TEXT("\0");
//获取
CDiskDataHandle help;
int Max=0,I=0;
Max=help.GetNewSpotLst ();
for (I=0;I<Max;I++)
{
wsprintf(strTmp,_T("11%02d"),I+1);
index=m_lst.InsertItem (I+1,strTmp);
wsprintf(strTmp,_T("%d"),I+1);
m_lst.SetItemText(index,1,strTmp);//顺序号
//解析日期
wcsncpy(strTmp,theApp.strText[I]+2,wcslen(theApp.strText[I])-2);
strTmp[wcslen(theApp.strText[I])-2]=0;
strTmp[13]=':';
strTmp[16]=':';
m_lst.SetItemText(index,2,strTmp);//时间
}
m_lst.SetFocus ();
this->RedrawWindow();
}
BOOL CPlMainDlg::FillSpotData(int hCode,int iLocal)
{
wchar_t FilePathName[MAX_PATH] = _T("");
#ifdef WINCE
wcscpy(FilePathName,TEXT("\\Storage Card\\Spot\\"));
#else
wcscpy(FilePathName,TEXT(".\\Spot\\"));
#endif
switch(hCode)
{
case 11://新调度
wcscat(FilePathName,_T("NewSpot\\"));
break;
case 12://过程调度
wcscat(FilePathName,_T("ProcSpot\\"));
break;
case 13://结束调度
wcscat(FilePathName,_T("FinishSpot\\"));
break;
}
wcscat(FilePathName,theApp.strText[iLocal]);
wcscat(FilePathName,_T(".gps"));
//调整显示
m_lst.DeleteColumn (2);
m_lst.DeleteColumn (1);
m_lst.DeleteColumn (0);
m_lst.InsertColumn (0,_T(""),LVCFMT_LEFT,0);
m_lst.InsertColumn (1,_T("类别"),LVCFMT_RIGHT,80);
m_lst.InsertColumn (2,_T("内容"),LVCFMT_LEFT,270);
m_lst.MoveWindow (1 ,22 ,368,195);
//显示标题
m_lst.DeleteAllItems ();
int index;
wchar_t strTmp[1024]=TEXT("\0");
//获取
CDiskDataHandle help;
//显示报案内容
CFile fCode;
if(!fCode.Open (FilePathName,CFile::modeReadWrite))
{
MessageBox(_T("该调度已经无效 "),_T("\"神州通\"E@syGPS车辆监控管理系统"),MB_OK);
return FALSE;
}
vcSpot spot;
memset(&spot,0,sizeof(spot));
fCode.Read(&spot,sizeof(spot));
//产生调度内容
wchar_t strData[50][128];
memset(strData,0,sizeof(strData));
wcscpy(strData[0],spot.SpotID); //1报案号
wcscpy(strData[1],spot.License); //2车牌号码
wcscpy(strData[2],spot.Insurance); //3被保险人
wcscpy(strData[3],spot.ReportName);//4报案人
wcscpy(strData[4],spot.LinkTel); //5联系电话
wcscpy(strData[5],spot.ReportTime);//6报案时间
wcscpy(strData[6],spot.Desc); //7说明
if (spot.Main)
wcscpy(strData[7],_T("是")); //8大客户
else
wcscpy(strData[7],_T("否")); //8大客户
wcscpy(strData[8],spot.OperName); //9调度员
wcscpy(strData[9],spot.OperTel); //10调度电话
int Max=0,I=0;
Max=help.GetTitle();
if(0 != Max)
{
for (I=0;I<Max;I++)
{
wsprintf(strTmp,_T("%d%02d"),hCode%10 + 80,I+1);
index=m_lst.InsertItem (I+1,strTmp);
m_lst.SetItemText(index,1,theApp.strTitle[I]);//类别
m_lst.SetItemText(index,2,strData[I]);//类别
}
}
if (hCode == 11)//新调度:添加收到时间
{
wsprintf(strTmp,_T("%d%02d"),hCode%10 + 80,++I);
index=m_lst.InsertItem (I+1,strTmp);
m_lst.SetItemText(index,1,_T("收到时间"));//类别
m_lst.SetItemText(index,2,spot.RecvTime);//类别
//更新阅读时间
wcscpy(spot.ReadTime,_T("2005-09-09 12:10:10"));
fCode.SeekToBegin();
fCode.Write(&spot,sizeof(spot));
fCode.Flush();
fCode.Close ();
//转移位置
CDiskDataHandle disk;
//未完场案件太多
if (disk.GetProcSpot()>=100)
{
MessageBox(_T("未查勘完成报案太多,请尽快查勘完毕!"),_T("\"神州通\"E@syGPS车辆监控管理系统"),MB_OK);
return FALSE;
}
//转移位置
wchar_t FileNewPath[MAX_PATH] = _T("");
#ifdef WINCE
wcscpy(FileNewPath,TEXT("\\Storage Card\\Spot\\ProcSpot\\"));
#else
wcscpy(FileNewPath,TEXT(".\\Spot\\ProcSpot\\"));
#endif
theApp.strText[iLocal][0]='1';
wcscat(FileNewPath,theApp.strText[iLocal]);
wcscat(FileNewPath,_T(".gps"));
MoveFile(FilePathName,FileNewPath);
}
if (hCode == 12)//过程调度:添加过程时间
{
m_Local= iLocal;//记录选定的报案位置
wsprintf(strTmp,_T("%d%02d"),hCode%10 + 80,++I);
index=m_lst.InsertItem (I+1,strTmp);
m_lst.SetItemText(index,1,_T("收到时间"));
m_lst.SetItemText(index,2,spot.RecvTime);
wsprintf(strTmp,_T("%d%02d"),hCode%10 + 80,++I);
index=m_lst.InsertItem (I+1,strTmp);
m_lst.SetItemText(index,1,_T("阅读时间"));
m_lst.SetItemText(index,2,spot.ReadTime);
//出发去现场
if (wcslen(spot.StartTime)>0)
{
wsprintf(strTmp,_T("%d%02d"),hCode%10 + 80,++I);
index=m_lst.InsertItem (I+1,strTmp);
m_lst.SetItemText(index,1,_T("出发去现场"));
m_lst.SetItemText(index,2,spot.StartTime);
}
//到达现场
if (wcslen(spot.ArriveTime)>0)
{
wsprintf(strTmp,_T("%d%02d"),hCode%10 + 80,++I);
index=m_lst.InsertItem (I+1,strTmp);
m_lst.SetItemText(index,1,_T("到达现场"));
m_lst.SetItemText(index,2,spot.ArriveTime);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -