📄 svrf305.ec
字号:
#include "../incl/serverpub.h"
$include sqlca;
#define MAXLEN 24
//Date:2003/02/10
/**修改记录
*/
int GetNameCount(char *pcId,char *pcName)
{
$char e_cName[61],e_cId[17];
memset(e_cName,0,sizeof(e_cName));
memset(e_cId,0,sizeof(e_cId));
memcpy(e_cId,pcId,16);
if(pcId[10]=='1')
$select name into :e_cName from enterprise where id=:e_cId;
else
$select name into :e_cName from person where id=:e_cId;
//if(SQLCODE=
memcpy(pcName,e_cName,40);
return 0;
}
SvrF305(int argc,char *argv[])
{
char cTemp[80],cRetCode[4],cFileName[80];
$char e_cSqlDest[800];
FILE *fp=NULL;
int i,iRet=0,iOne=1,iType=0;
$char e_cCol[MAXLEN][41];
char cBody[256],cName[41];
#ifdef QDCS
for(i=0;i<argc;i++)
WriteTest("argv[%d]:%s\n",i,argv[i]);
#endif
/**argv[0]
1 保证人
2 有价证券质押报告
3 房产抵押报告
4 地产抵押报告
5 设备抵押报告
*/
iType=atoi(argv[0]);
memset(e_cSqlDest,0,sizeof(e_cSqlDest));
switch(iType)
{
case 1:
sprintf(e_cSqlDest,"assurer where apply_no='%s'",argv[1]);
break;
case 2:
sprintf(e_cSqlDest,"portfolio where apply_no='%s'",argv[1]);
break;
case 3:
sprintf(e_cSqlDest,"realty where apply_no='%s'",argv[1]);
break;
case 4:
sprintf(e_cSqlDest,"ground_use where apply_no='%s'",argv[1]);
break;
case 5:
sprintf(e_cSqlDest,"equipment where apply_no='%s'",argv[1]);
break;
}
memset(cRetCode,0,sizeof(cRetCode));
if((iRet=GetCount(e_cSqlDest,cRetCode))==0){//NO record
CreateStruct("返回码",NORECORD);return 0;
} else {
iOne=1;
//地区号(5)+前置机号(4)+所号(4)+操作员号(4)
memset(cTemp,0,sizeof(cTemp));
FindKey("地区号");strcat(cTemp,sCurrent->cValue);
FindKey("前置机号");strcat(cTemp,sCurrent->cValue);
FindKey("储蓄所号");strcat(cTemp,sCurrent->cValue);
FindKey("操作员号");strcat(cTemp,sCurrent->cValue);
memset(cFileName,0,sizeof(cFileName));
sprintf(cFileName,"%s/download/%s",getenv("HOME"),cTemp);
if (( fp=fopen(cFileName,"w"))==NULL)
{
WriteTest("[%s]: open file %s error \n",__FILE__,cFileName);
CreateStruct("返回码","020");
return 0;
}
switch(iType)
{
case 1:
//保证人客户号,保证人客户名,状态,保证协议号,我社客户,保证金额,保证能力
fprintf(fp, "vcid,vcname,vcstate,vcagree_no,vcflag,vcsum,vcability\n");
break;
case 2:
fprintf(fp, "viserno,vcname,vcid,vccustname,vinumber,vfsum,vcissue_unit,vdstop_date,vccard_no,vfevaluate,vfimpawn,vdim_init_date,vdim_stop_date,vcstate\n");
break;
case 3:
fprintf(fp, "viserno,vcname,vclocation,vcflag,vcid,vccustname,vccustodian,vcusufructer,vfbuild,vcpurpose,vfoccupy,vfground_use,vdg_init_date,vdg_stop_date,vchouse_no,vcground_no,vfori_value,vfpure_value,vfeva_value,vfmor_value,vceva_unit,vdp_init_date,vdp_stop_date,vcstate\n");
break;
case 4:
fprintf(fp, "vcserno,vcname,vclocation,viflag,vcid,vccustname,vcpurpose,vckind,vfarea,vdg_init_date,vdg_stop_date,vccard_no,vcinsu_no,vfface_value,vfeva_value,vcmatter_name,vfmatter_value,vfmor_value,vdmor_init_date,vdmor_stop_date,vcstate\n");
break;
case 5:
fprintf(fp, "vcmor_no,vcmor_name,vcmor_location,vcflag,vccustno,vccustname,vcspec,vctype,vccard_no,vcinsu_no,vcnum,vcformer_value,vcnet_value,vcest_value,vcmor_value,vcmor_init_date,vcmor_stop_date,vcstate\n");
break;
}
}
memset(e_cSqlDest,0,sizeof(e_cSqlDest));
if(iType==1){
sprintf(e_cSqlDest,"select id,state,agree_no,flag,sum,ability from assurer where apply_no='%s'",argv[1]);
}else if(iType==2){
sprintf(e_cSqlDest,"select serno,title,id,name,number,sum,issue_unit,stop_date,card_no,evaluate,impawn,im_init_date,im_stop_date,state from portfolio where apply_no='%s'",argv[1]);
}else if(iType==3){
sprintf(e_cSqlDest,"select serno,title,location,flag,id,name,custodian,usufructer,build,purpose,occupy,ground_use,g_init_date,g_stop_date,house_no,ground_no,ori_value,pure_value,eva_value,mor_value,eva_unit,p_init_date,p_stop_date,state from realty where apply_no='%s'",argv[1]);
}else if(iType==4){
sprintf(e_cSqlDest,"select serno,title,location,flag,id,name,purpose,kind,area,g_init_date,g_stop_date,card_no,insu_no,face_value,eva_value,matter_name,matter_value,mor_value,mor_init_date,mor_stop_date,state from ground_use where apply_no='%s'",argv[1]);
}else if(iType==5){
sprintf(e_cSqlDest,"select serno,title,location,flag,id,name,spec,model,card_no,insu_no,number,old_value,pure_value,eva_value,mor_value,init_date,stop_date,state from equipment where apply_no='%s'",argv[1]);
}
#ifdef QDCS
WriteTest("[%s]SQL=%s\n",__FILE__,e_cSqlDest);
#endif
$prepare Many from :e_cSqlDest;
$declare File1 cursor for Many;
if(SQLCODE!=0){
if(iOne) fclose(fp);
CreateStruct("返回码",DBOPERERR);return 0;
}
$open File1;
if(SQLCODE!=0){
if(iOne) fclose(fp);
CreateStruct("返回码",DBOPERERR);return 0;
}
while(1){
for(i=0;i<MAXLEN;i++)
memset(e_cCol[i],0,sizeof(e_cCol[i]));
if(iType==1)
$fetch File1 into :e_cCol[0],:e_cCol[1],:e_cCol[2],:e_cCol[3],:e_cCol[4],:e_cCol[5];
else if(iType==2)
$fetch File1 into :e_cCol[0],:e_cCol[1],:e_cCol[2],:e_cCol[3],:e_cCol[4],:e_cCol[5],:e_cCol[6],:e_cCol[7],:e_cCol[8],:e_cCol[9],:e_cCol[10],:e_cCol[11],:e_cCol[12],:e_cCol[13];
else if(iType==3)
$fetch File1 into :e_cCol[0],:e_cCol[1],:e_cCol[2],:e_cCol[3],:e_cCol[4],:e_cCol[5],:e_cCol[6],:e_cCol[7],:e_cCol[8],:e_cCol[9],:e_cCol[10],:e_cCol[11],:e_cCol[12],:e_cCol[13],:e_cCol[14],:e_cCol[15],:e_cCol[16],:e_cCol[17],:e_cCol[18],:e_cCol[19],:e_cCol[20],:e_cCol[21],:e_cCol[22],:e_cCol[23];
else if(iType==4)
$fetch File1 into :e_cCol[0],:e_cCol[1],:e_cCol[2],:e_cCol[3],:e_cCol[4],:e_cCol[5],:e_cCol[6],:e_cCol[7],:e_cCol[8],:e_cCol[9],:e_cCol[10],:e_cCol[11],:e_cCol[12],:e_cCol[13],:e_cCol[14],:e_cCol[15],:e_cCol[16],:e_cCol[17],:e_cCol[18],:e_cCol[19],:e_cCol[20];
else if(iType==5)
$fetch File1 into :e_cCol[0],:e_cCol[1],:e_cCol[2],:e_cCol[3],:e_cCol[4],:e_cCol[5],:e_cCol[6],:e_cCol[7],:e_cCol[8],:e_cCol[9],:e_cCol[10],:e_cCol[11],:e_cCol[12],:e_cCol[13],:e_cCol[14],:e_cCol[15],:e_cCol[16],:e_cCol[17];
if(SQLCODE!=0)break;
memset(cBody,0,sizeof(cBody));
if(iType==1)
{
/*取保证人名称*/
memset(cName,0,sizeof(cName));
GetNameCount(e_cCol[0],cName);
sprintf(cBody,"%s,%s,%s,%s,%s,%s,%s",e_cCol[0],cName,e_cCol[1],e_cCol[2],e_cCol[3],e_cCol[4],e_cCol[5]);
} else if(iType==2){
ConvertDate(e_cCol[7]);
ConvertDate(e_cCol[11]);
ConvertDate(e_cCol[12]);
sprintf(cBody,"%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s",e_cCol[0],e_cCol[1],e_cCol[2],e_cCol[3],e_cCol[4],e_cCol[5],e_cCol[6],e_cCol[7],e_cCol[8],e_cCol[9],e_cCol[10],e_cCol[11],e_cCol[12],e_cCol[13]);
} else if(iType==3){
ConvertDate(e_cCol[12]);
ConvertDate(e_cCol[13]);
ConvertDate(e_cCol[21]);
ConvertDate(e_cCol[22]);
sprintf(cBody,"%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s",e_cCol[0],e_cCol[1],e_cCol[2],e_cCol[3],e_cCol[4],e_cCol[5],e_cCol[6],e_cCol[7],e_cCol[8],e_cCol[9],e_cCol[10],e_cCol[11],e_cCol[12],e_cCol[13],e_cCol[14],e_cCol[15],e_cCol[16],e_cCol[17],e_cCol[18],e_cCol[19],e_cCol[20],e_cCol[21],e_cCol[22],e_cCol[23]);
} else if(iType==4){
ConvertDate(e_cCol[9]);
ConvertDate(e_cCol[10]);
ConvertDate(e_cCol[19]);
ConvertDate(e_cCol[18]);
sprintf(cBody,"%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s",e_cCol[0],e_cCol[1],e_cCol[2],e_cCol[3],e_cCol[4],e_cCol[5],e_cCol[6],e_cCol[7],e_cCol[8],e_cCol[9],e_cCol[10],e_cCol[11],e_cCol[12],e_cCol[13],e_cCol[14],e_cCol[15],e_cCol[16],e_cCol[17],e_cCol[18],e_cCol[19],e_cCol[20]);
} else if(iType==5){
ConvertDate(e_cCol[16]);
ConvertDate(e_cCol[15]);
sprintf(cBody,"%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s",e_cCol[0],e_cCol[1],e_cCol[2],e_cCol[3],e_cCol[4],e_cCol[5],e_cCol[6],e_cCol[7],e_cCol[8],e_cCol[9],e_cCol[10],e_cCol[11],e_cCol[12],e_cCol[13],e_cCol[14],e_cCol[15],e_cCol[16],e_cCol[17]);
}
fprintf(fp,"%s\n",cBody);
}
$close File1;
$free File1;
CreateStruct("返回码","000");
if(iOne){
fclose(fp);
}
memset(cBody,0,sizeof(cBody));
strcpy(cBody,"10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
CreateStruct("发报报体",cBody);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -