rjremote.cpp

来自「DCOM 上位机和嵌入式系统通信」· C++ 代码 · 共 199 行

CPP
199
字号
// rjremote.cpp : Implementation of Crjremote
#include "stdafx.h"
#include "ComServer.h"
#include "rjremote.h"
#include "Server1.h"

/////////////////////////////////////////////////////////////////////////////
// Crjremote


//STDMETHODIMP Crjremote::getremote_trace(short *rjct, trace *trc,double *dt,personlist *pstmb,short *almct,trace *almtrc)
STDMETHODIMP Crjremote::getrmt_ct(short *rjct, short *alct)
{
	// TODO: Add your implementation code here
//  short  i;
    *rjct=rj_ct;
	*alct=almct;
   // for(i=0;i<255;i++)
	//   dt[i]=rstm[i];

	return S_OK;
}

STDMETHODIMP Crjremote::getrmtrace(short *rfid,short *wno, double *dt, short *rno, short *addr)
{
	// TODO: Add your implementation code here
	int i;
    for(i=0;i<rj_ct;i++)
	{
	   rfid[i]=trclst[i].personID;
	   dt[i]=trclst[i].dt;
	   rno[i]=trclst[i].reno; // 修改
	   addr[i]=trclst[i].addrno;
	   wno[i]=trclst[i].workno;
	}

	return S_OK;
}

STDMETHODIMP Crjremote::getrmtlocal(short *addrno, double *loctm, 
									double *entm, double *extm,short *dw_rno,short *up_rno,short *lastrno,short *tag)
{
	// TODO: Add your implementation code here
 int i;
    for(i=0;i<4096;i++)
	{
		addrno[i]=perstmb[i].addrno;
		loctm[i]=perstmb[i].localtm;
		entm[i]=perstmb[i].entrytm;
		extm[i]=perstmb[i].exittm;
		dw_rno[i]=perstmb[i].dw_rno;
		up_rno[i]=perstmb[i].up_rno;
		lastrno[i]=perstmb[i].lastreno;
		tag[i]=perstmb[i].tag;
	}
	return S_OK;
}

STDMETHODIMP Crjremote::getrtmalm(short *rfid,short *wno, double *dt, short *rno, short *addr)
{
	// TODO: Add your implementation code here
	int i;

	for(i=0;i<almct;i++)
	{
	   rfid[i]=almtjb[i].personID;
	   dt[i]=almtjb[i].dt;
	   rno[i]=almtjb[i].reno;  //修改
	   addr[i]=almtjb[i].addrno;
	   wno[i]=almtjb[i].workno;
	}

	return S_OK;
}

STDMETHODIMP Crjremote::freshconfg()
{
	// TODO: Add your implementation code here
	bool bl=1;
	int i;
	HANDLE hd;
	WIN32_FIND_DATA fd;
	char pathsrc[_MAX_PATH];
	char pathdes[_MAX_PATH];
	char src[_MAX_PATH];
	char des[_MAX_PATH];
	char path[_MAX_PATH]="";
	char path1[_MAX_PATH]="";
	char path2[_MAX_PATH]="";
	unsigned char tmp[_MAX_PATH]="";

//	char fn[_MAX_PATH];
	_mbscpy(tmp,Curpath);
	Server1::unsigned_To_signed(tmp,path);
    for(i=2;i<_MAX_PATH;i++)
		path1[i-2]=path[i];
    Server1::unsigned_To_signed(otherpcname,pathsrc);

	strcat(pathsrc,path1);
	strcat(pathsrc,"\\config\\");
	strcpy(pathdes,path);
	strcat(pathdes,"\\config\\");
    strcpy(path2,pathsrc);
	strcat(path2,"*.*");
    //strcpy(path2,"\\\\He\\TD_Auto监控系统\\config\\*.*");
	hd=FindFirstFile(path2,&fd);
    DWORD dwd=GetLastError();
	while(bl)
	{
      bl=FindNextFile(hd,&fd);
	  if((strcmp(fd.cFileName,".")!=0)&&(strcmp(fd.cFileName,"..")!=0)&&(strcmp(fd.cFileName,"KJ95SYS.SYS")!=0))
	  {
		  strcpy(src,pathsrc);
		  strcat(src,fd.cFileName);
		  strcpy(des,pathdes);
		  strcat(des,fd.cFileName);
          CopyFile(src,des,0);
	  }
	}
    Server1::unsigned_To_signed(otherpcname,pathsrc);

	strcat(pathsrc,path1);
	strcat(pathsrc,"\\RJGRAPH\\");
	strcpy(pathdes,path);
	strcat(pathdes,"\\RJGRAPH\\");
    strcpy(path2,pathsrc);
	strcat(path2,"*.*");
	hd=FindFirstFile(path2,&fd);
    bl=1;
	while(bl)
	{
      bl=FindNextFile(hd,&fd);
	  if((strcmp(fd.cFileName,".")!=0)&&(strcmp(fd.cFileName,"..")!=0))
	  {
		  strcpy(src,pathsrc);
		  strcat(src,fd.cFileName);
		  strcpy(des,pathdes);
		  strcat(des,fd.cFileName);
          CopyFile(src,des,0);
	  }
	}

    Server1::unsigned_To_signed(otherpcname,pathsrc);

	strcat(pathsrc,path1);
	strcat(pathsrc,"\\GRAPH\\");
	strcpy(pathdes,path);
	strcat(pathdes,"\\GRAPH\\");
    strcpy(path2,pathsrc);
	strcat(path2,"*.*");
	hd=FindFirstFile(path2,&fd);
    bl=1;
	while(bl)
	{
      bl=FindNextFile(hd,&fd);
	  if((strcmp(fd.cFileName,".")!=0)&&(strcmp(fd.cFileName,"..")!=0))
	  {
		  strcpy(src,pathsrc);
		  strcat(src,fd.cFileName);
		  strcpy(des,pathdes);
		  strcat(des,fd.cFileName);
          CopyFile(src,des,0);
	  }
	}
	Server1::Read_File();
    for(i=0;i<rtinfo.count;i++)
	   File4.flag[rtinfo.st[i].stno]=4;
	return S_OK;
}

STDMETHODIMP Crjremote::getuptj(short *count, short *wno, short *idno, DATE *downdt, DATE *updt,short *dw_rno, short *up_rno, short *tag)
{
	// TODO: Add your implementation code here
    int i;

	  *count=upct;
	  for(i=0;i<upct;i++)
	  {
		  wno[i]=uptjb[i].workno;
		  idno[i]=uptjb[i].personID;
		  downdt[i]=uptjb[i].downdtm;
		  updt[i]=uptjb[i].updtm;
		  dw_rno[i]=uptjb[i].dw_rno;
		  up_rno[i]=uptjb[i].up_rno;
		  tag[i]=uptjb[i].tag;
	  }
	return S_OK;
}

STDMETHODIMP Crjremote::setchkUpPl(short count, short *chkid)
{
	// TODO: Add your implementation code here
   int i,j=0;
     for(i=0;i<count;i++)
	   chkup[chkct+i]=chkid[i];
	 chkct+=count;
	return S_OK;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?