📄 plmaindlg.cpp
字号:
}
if(hCode == 13)//结束调度
{
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);
}
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.FinishTime);
}
//显示
m_lst.ShowWindow (SW_SHOWNORMAL);
m_lst.SetFocus ();
this->RedrawWindow();
return TRUE;
}
void CPlMainDlg::FillProcSpot()
{
//更改列表头
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,80);
m_lst.InsertColumn (2,_T("时间"),LVCFMT_CENTER,150);
m_lst.MoveWindow (1 ,22 ,245,195);
//显示内容
m_lst.DeleteAllItems ();
int index,iStatus=0;
wchar_t strTmp[1024]=TEXT("\0");
//获取
CDiskDataHandle help;
int Max=0,I=0;
Max=help.GetProcSpotLst ();
for (I=0;I<Max;I++)
{
//判断是否
wsprintf(strTmp,_T("12%02d"),I+1);
index=m_lst.InsertItem (I+1,strTmp);
swscanf(theApp.strText[I],_T("%d@"),&iStatus);
switch(iStatus)
{
case 1://已读短信
m_lst.SetItemText(index,1,_T("阅读"));
break;
case 2://出发去现场
m_lst.SetItemText(index,1,_T("去现场"));
break;
case 3://到达现场
m_lst.SetItemText(index,1,_T("到达现场"));
break;
}
//解析日期
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();
}
void CPlMainDlg::FillFinishSpot()
{
//更改列表头
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,iCount=0;
Max=help.GetFinishSpotLst ();
for (I=0;I<Max;I++)
{
wsprintf(strTmp,_T("13%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);//时间
iCount++;
if (iCount == Max)
break;
}
m_lst.SetFocus ();
this->RedrawWindow();
}
BOOL CPlMainDlg::ExcuteSpot(int vKey)
{
//没有内容
if (m_lst.GetItemCount() < 1 )
{
m_Local=-1;
return FALSE;
}
//int nItem = m_lst.GetNextSelectedItem(pos);
wchar_t h2Bit[8] = _T(""),e2Bit[8] = _T(""),strData[256] = _T("");
wcscpy(strData,m_lst.GetItemText (0,0));
wcsncpy(h2Bit,strData,2);
h2Bit[2] = 0;
wcsncpy(e2Bit,strData + 2,2);
e2Bit[2] = 0;
//判断是否为执行调度
if( _wtoi(h2Bit) == 82 && (m_Local>=0 && m_Local<100))
{
wchar_t FilePathName[MAX_PATH] = _T("");
wchar_t FileNewPath[MAX_PATH] = _T("");
wchar_t ActionInfo[MAX_PATH] = _T("");
//获取源文件
#ifdef WINCE
wcscpy(FilePathName,TEXT("\\Storage Card\\Spot\\ProcSpot\\"));
#else
wcscpy(FilePathName,TEXT(".\\Spot\\ProcSpot\\"));
#endif
//原文件
wcscat(FilePathName,theApp.strText[m_Local]);
wcscat(FilePathName,_T(".gps"));
//显示报案内容
CFile fCode;
if(!fCode.Open (FilePathName,CFile::modeReadWrite))
{
MessageBox(_T("该调度已经无效 "),_T("\"神州通\"E@syGPS车辆监控管理系统"),MB_OK);
m_Local=-1;
return TRUE;
}
vcSpot spot;
memset(&spot,0,sizeof(spot));
fCode.Read(&spot,sizeof(spot));
switch(vKey)
{
case 0x31://出发去现场
//判断是否已经发送
if (wcslen(spot.StartTime) > 0 || wcslen(spot.ArriveTime) > 0)
{
MessageBox(_T("你已经执行了 出发去现场 答复"),_T("\"神州通\"E@syGPS车辆监控管理系统"),MB_OK|MB_ICONEXCLAMATION);
m_Local=-1;
return TRUE;
}
#ifdef WINCE
wcscpy(FileNewPath,TEXT("\\Storage Card\\Spot\\ProcSpot\\"));
#else
wcscpy(FileNewPath,TEXT(".\\Spot\\ProcSpot\\"));
#endif
//新文件
theApp.strText[m_Local][0]= vKey+1;
wcscat(FileNewPath,theApp.strText[m_Local]);
wcscat(FileNewPath,_T(".gps"));
//时间标记
wcscpy(spot.StartTime,_T("出发去现场"));
//发送
wcscpy(ActionInfo,_T("发送出发去现场"));
break;
case 0x32://到达现场
//判断是否已经发送
if (wcslen(spot.ArriveTime) > 0)
{
MessageBox(_T("你已经执行了 到达现场 答复"),_T("\"神州通\"E@syGPS车辆监控管理系统"),MB_OK|MB_ICONEXCLAMATION);
m_Local=-1;
return TRUE;
}
#ifdef WINCE
wcscpy(FileNewPath,TEXT("\\Storage Card\\Spot\\ProcSpot\\"));
#else
wcscpy(FileNewPath,TEXT(".\\Spot\\ProcSpot\\"));
#endif
//新文件
theApp.strText[m_Local][0]= vKey+1;
wcscat(FileNewPath,theApp.strText[m_Local]);
wcscat(FileNewPath,_T(".gps"));
//时间标记
wcscpy(spot.ArriveTime,_T("到达现场"));
//发送
wcscpy(ActionInfo,_T("到达现场"));
break;
case 0x33://查勘完毕
#ifdef WINCE
wcscpy(FileNewPath,TEXT("\\Storage Card\\Spot\\FinishSpot\\"));
#else
wcscpy(FileNewPath,TEXT(".\\Spot\\FinishSpot\\"));
#endif
//新文件
theApp.strText[m_Local][0]= vKey+1;
wcscat(FileNewPath,theApp.strText[m_Local]);
wcscat(FileNewPath,_T(".gps"));
//时间标记
wcscpy(spot.FinishTime,_T("查勘完毕"));
//发送
wcscpy(ActionInfo,_T("查勘完毕"));
break;
case 0x34://按下4,表示太忙,不去
#ifdef WINCE
wcscpy(FileNewPath,TEXT("\\Storage Card\\Spot\\CancelSpot\\"));
#else
wcscpy(FileNewPath,TEXT(".\\Spot\\CancelSpot\\"));
#endif
//新文件
theApp.strText[m_Local][0]= vKey+1;
wcscat(FileNewPath,theApp.strText[m_Local]);
wcscat(FileNewPath,_T(".gps"));
//时间标记
wcscpy(spot.CancelTime,_T("拒绝执行查勘"));
//发送
wcscpy(ActionInfo,_T("太忙,拒绝执行查勘"));
break;
case 0x35://按下5,表示太远,不去
#ifdef WINCE
wcscpy(FileNewPath,TEXT("\\Storage Card\\Spot\\CancelSpot\\"));
#else
wcscpy(FileNewPath,TEXT(".\\Spot\\CancelSpot\\"));
#endif
//新文件
theApp.strText[m_Local][0]= vKey+1;
wcscat(FileNewPath,theApp.strText[m_Local]);
wcscat(FileNewPath,_T(".gps"));
//时间标记
wcscpy(spot.CancelTime,_T("拒绝执行查勘"));
//发送
wcscpy(ActionInfo,_T("太远,拒绝执行查勘"));
break;
case 0x36://按下6,表示超权限,不去
#ifdef WINCE
wcscpy(FileNewPath,TEXT("\\Storage Card\\Spot\\CancelSpot\\"));
#else
wcscpy(FileNewPath,TEXT(".\\Spot\\CancelSpot\\"));
#endif
//新文件
theApp.strText[m_Local][0]= vKey+1;
wcscat(FileNewPath,theApp.strText[m_Local]);
wcscat(FileNewPath,_T(".gps"));
//时间标记
wcscpy(spot.CancelTime,_T("拒绝执行查勘"));
//发送
wcscpy(ActionInfo,_T("超权限,拒绝执行查勘"));
break;
case 0x37://按下7,表示车辆故障,不去
#ifdef WINCE
wcscpy(FileNewPath,TEXT("\\Storage Card\\Spot\\CancelSpot\\"));
#else
wcscpy(FileNewPath,TEXT(".\\Spot\\CancelSpot\\"));
#endif
//新文件
theApp.strText[m_Local][0]= vKey+1;
wcscat(FileNewPath,theApp.strText[m_Local]);
wcscat(FileNewPath,_T(".gps"));
//时间标记
wcscpy(spot.CancelTime,_T("拒绝执行查勘"));
//发送
wcscpy(ActionInfo,_T("车辆故障,拒绝执行查勘"));
break;
case 0x38://按下8,表示拒绝执行
#ifdef WINCE
wcscpy(FileNewPath,TEXT("\\Storage Card\\Spot\\CancelSpot\\"));
#else
wcscpy(FileNewPath,TEXT(".\\Spot\\CancelSpot\\"));
#endif
//新文件
theApp.strText[m_Local][0]= vKey+1;
wcscat(FileNewPath,theApp.strText[m_Local]);
wcscat(FileNewPath,_T(".gps"));
//时间标记
wcscpy(spot.CancelTime,_T("拒绝执行查勘"));
//发送
wcscpy(ActionInfo,_T("拒绝执行查勘"));
break;
default:
fCode.Close ();
m_Local=-1;
return TRUE;
}
//更改文件名或者移动位置
wchar_t tip[512]= _T("您确定要 ");
wcscat(tip,ActionInfo);
wcscat(tip,_T(" 吗?"));
if(IDYES == MessageBox(tip,_T("\"神州通\"E@syGPS车辆监控管理系统"),MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON1))
{
//记录时间
fCode.SeekToBegin ();
fCode.Write (&spot,sizeof(spot));
fCode.Flush ();
fCode.Close ();
//路径更换
MoveFile(FilePathName,FileNewPath);
//开始发送
wcscpy(tip,ActionInfo);
USES_CONVERSION;
if(pe.EncodeSMSBody(W2A(ActionInfo),"13671168764",2))
wcscat(tip,_T(" 执行成功!"));
else
wcscat(tip,_T(" 执行失败!"));
MessageBox(tip,_T("\"神州通\"E@syGPS车辆监控管理系统"),MB_OK);
}
}
else
{
m_Local=-1;
return FALSE;
}
//取消位置
m_Local=-1;
return TRUE;
}
void CPlMainDlg::FillNotifyData(int iLocal)
{
wchar_t FilePathName[MAX_PATH] = _T("");
wchar_t FileNewPath[MAX_PATH] = _T("");
#ifdef WINCE
wcscpy(FilePathName,TEXT("\\Storage Card\\Notify\\"));
#else
wcscpy(FilePathName,TEXT(".\\Notify\\"));
#endif
wcscpy(FileNewPath,FilePathName);
wcscat(FilePathName,theApp.strText[iLocal]);
wcscat(FilePathName,_T(".gps"));
//更新为已读
theApp.strText[iLocal][0]='1';
wcscat(FileNewPath,theApp.strText[iLocal]);
wcscat(FileNewPath,_T(".gps"));
MoveFile (FilePathName,FileNewPath);
//显示通知内容
CFile fCode;
if(!fCode.Open (FileNewPath,CFile::modeRead))
{
MessageBox(_T("该通知已经无效 "),_T("\"神州通\"E@syGPS车辆监控管理系统"),MB_OK);
return ;
}
wchar_t strTmp[1024]=TEXT("\0");
memset(strTmp,0,sizeof(strTmp));
fCode.Read(strTmp,fCode.GetLength ());
fCode.Close ();
//更新列表:读数据前不可更新,否则将更改错位;
// 显示内容后不可更改,否则将隐藏显示内容框
OnInfo ();
//显示
m_scrtime= strTmp;
UpdateData (FALSE);
m_Notify.SetWindowPos (NULL,5,22,325,195,SWP_SHOWWINDOW);
this->RedrawWindow();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -