⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dphsacti.pc

📁 小灵通机卡分离模块的设计.建立在数据库服务器
💻 PC
📖 第 1 页 / 共 4 页
字号:
/********************************************************************
* Copyright (c) 2002-2008. 广州南方电信系统软件有限公司
All rights reserved.

文件名称:DPHSACTI.pc
摘    要:带号码SIM卡开通处理

创建日期:2005年04月28日


 摘    要:主要提供给营业前台调用,处理受理时对sim卡状态的修改
* 输入参数:
		1.产品号码     gcproduct_no
	  2.sim卡密码    gcsrv_pwd    varchar
		3.受理工号     char  gcoper_code[26] = {0};
		4.受理部门
		5.受理管理局

* 输出参数:
		1.生产编号
		2.生产流水
		3.受理编号
		4.订单编号
		5.产品编号
* 返回值:0 成功  非0  失败


当前版本:1.0
作    者:yqd
完成日期:

********************************************************************/
#define YYDEBUG
#include "cicslink.h"
#include "yypublic.h"
#include "genid.h"
EXEC SQL BEGIN DECLARE SECTION;
#define PDINFO_FIELD	48
#define PDINFO_LENGTH	301
#define PHONE_FIELD	28
#define PHONE_LENGTH	201
#define ACCOUNTINFO_FIELD	26
#define ACCOUNTINFO_LENGTH	201
#define FOREGIFT_FIELD	11
#define FOREGIFT_LENGTH	401
#define PREPAY_FIELD	22
#define PREPAY_LENGTH	256
EXEC SQL END DECLARE SECTION;

EXEC SQL INCLUDE sqlca;


EXEC SQL BEGIN DECLARE SECTION;
char  gcproduct_no[25] = {0};
char  gcsrv_pwd[31] = {0};
char  gcoper_code[26] = {0};
char  gcdepart_code[26] = {0};
char  gcexch_code[26] = {0};
int 	temp1=0;
char  gcmainproduce_id[26] = {0};
char  gcmainproduce_no[26] = {0};
char  gcmainorder_id[26] = {0};
char  gcmainaccept_id[26] = {0};
char  gcmainproduct_id[26] = {0};
char  gcoldproduct_id[26]={0};
char  gcproduce_type[2]={0};

char  gctable_bunch[201] = {0};

char  gcmainphone_id[26] = {0};
char  gcaddorder_id[26] = {0};
char  gctempphone_id[26] = {0};
char  gctempproduce_id[26] = {0};
char  gctempproduce_no[26] = {0};
char  gctempaccept_id[26] = {0};
char  gctempproduct_id[26] = {0};
char  gcsrv_code[26] = {0};
char  gcsub_srv[26] = {0};
char  gcaccept_state[26] = {0};
char  gcdisp_flag[26] = {0};
char  gcsrv_type[26] = {0};
char  gcaccept_lan[26] = {0};
char  gcvest_lan[26] = {0};
char  gcaccept_grade[26] = {0};
int   giaccept_grade_value=0;
char  gcaccept_mode[26] = {0};
char  gccharge_tache[26] = {0};
char  gcunit_type[26] = {0};
char  gcunit_code[26] = {0};
char gccust_name[129]={0};

char  gcdepart_type[26] = {0};

char  gcterminal_ip[26] = {0};
char  gcterm_code[26] = {0};
char  gcproduct_nostr[2000] = {0};
char  gcps_codestr[2000] = {0};

char  gcsim_codestr[2000] = {0};


char  gcmainproduct_no[35] = {0};
char  lcproduct_no[20] = {0};
char  lcps_code[40] = {0};

char  lcsim_code[40] = {0};

int 	gideal_grad=0;
char  gccust_type[5] = {0};
int   gicust_type_value=0;
char  gcowncust_id[26] = {0};
char  gcusercust_id[26] = {0};
char	gccust_id[26] = {0};
char  gcGenCustid[26]={0};
char	gcbtime[26] = {0};
char	gcbact[5] = {0};
char  gcrela_type[5] = {0};
char  gclocal_flag[5] = {0};
char  gcrela_info[50] = {0};
char  gcrela_prod_no[50] = {0};
char  gcprod_class[5] = {0};
char  gcprodexch_code[6] = {0};
char  gcprot_code[30] = {0};
char  gclines[5] = {0};
int		gilines=0;
int   giaddlines=0;
int   gisrvs=0;
int   giadds=0;

char gcrows[5] = {0};
char gcretstr[500] = {0};                /*返回信息串*/
char gcfilename[100] = {0};
char gcyyerrlog[100] = {0};
int  gcretval=0;                   /*返回值*/
char gccondition[20] = {0};
char gccontract_id[26] = {0};
char gcpay_id[26] = {0};
char gccust_code[42] = {0};
char gcowncust_code[42] = {0};
char gcusercust_code[42] = {0};
char gcoldcontract[100][20] = {0};
char gcnewcontract[100][20] = {0};
char gcnewproduce_id[100][26] = {0};
char gcnewproduce_no[100][26] = {0};
char gcnewaccept_id[100][26] = {0};
char gcnewproduct_id[100][26] = {0};
char gcnewproduct_no[100][26] = {0};
char gcaddproduce_id[100][26] = {0};
char gcaddproduce_no[100][26] = {0};
char gcaddaccept_id[100][26] = {0};
char gcaddproduct_id[100][26] = {0};
char gcaddproduct_no[100][26] = {0};
char gcpayid[100][20] = {0};
char gcswitch_id[20] = {0};
long giswitch_id=0;
long giprodno_grade=0;
char gcfld_id[3] = {0};
char gcvalue[300] = {0};
char gcapply_name[21] = {0};
char gcapply_cert[2] = {0};
char gcapply_certno[31] = {0};
char gcapply_tel[41] = {0};
char gcapply_addr[256] = {0};
char gcaccount_id[26] = {0};
char gcphone_id[20]={0};
int  gitimes=0;
int v_count1=0;
int v_count=0;
int lc_retrun =1;
char temp_1[3000] = {0};
char gciccid[31]={0};
char gcpsnm[31]={0};
char gccert_no[33]={0};
char gccust_kind[3]={0};
char gccert_type[3]={0};
EXEC SQL END DECLARE SECTION;

int intoPdn_pdinfoProc();       	 /*生成pdn_pdinfo详细资料*/
int intoPdn_phoneProc();   	         /*生成pdn_phone详细资料*/
int intoPdn_warrantorProc();	         /*生成pdn_warrantor详细资料*/
int intoPdn_incr_prodProc();	         /*生成pdn_incr_prod详细资料*/
int intoPdn_prod_propProc();	         /*生成pdn_prod_prop详细资料*/
int intoPdn_accountProc();               /*生成pdn_account详细资料*/
int intoPdn_deviceProc();       	 /*生成pdn_device详细资料*/
int intoCn_cust_infoProc();	         /*生成cn_cust_info详细资料*/
int intoPdn_acceptlogProc();	         /*生成PDN_ACCEPTLOG*/
int intoSr_accept_logProc();	         /*生成sr_accept_log*/
int intoPdn_servcontrolProc();	         /*生成pdn_servcontrol*/
int intoPdn_relayProc();	  	 /*生成pdn_relay*/
int intoPdn_phsProc();		         /*生成pdn_phs*/

int intoPdn_phssimProc();		 /*生成pdn_phs*/

int intoPdn_relateProc();	         /*生成pdn_relate*/
int intoPdn_prepayProc();											/*生成pdn_prepay*/
int intoPdn_foregiftProc();											/*生成pdn_foregift*/
int intop_orderdis();	
int intoPdn_prepay();



DLLEXPORT CDECL main()

{
	EXEC SQL BEGIN DECLARE SECTION;
	int RECORDCOUNT;

	EXEC SQL END DECLARE SECTION;

		PrintStatus("yqd int main");



	#ifdef	YYDEBUG
	sprintf(gcfilename,"%s%s",DEBUGDIR,"DPHSACTI.tr");
	trim(gcfilename);
	sprintf(gcyyerrlog,"%s%s",DEBUGDIR,"yyerrlog.tr");
	trim(gcyyerrlog);
	if((tracefp=fopen(gcfilename,"w"))==NULL)
	{
		fprintf(stderr,"open trace file error\n");
		exceptExit(10002,INI_COMM_ERR );
	}
	#endif
			PrintStatus("line 220");
	if (getInputData("DPHSACTI") != 0)   	      /*初始化通讯区*/
	{
		#ifdef	YYDEBUG
		fclose(tracefp);
		CopyTr(gcfilename,gcyyerrlog);
		#endif
		exceptExit(10002,INI_COMM_ERR );          /*初始化错误,退出服务*/
	}
	PrintStatus("line 229");
	if (getInParamNum() < 5)
	{
		#ifdef	YYDEBUG
		DebugLog("参数个数不够");
		fclose(tracefp);
		CopyTr(gcfilename,gcyyerrlog);
		#endif
		exceptExit(10001,PARAM_ERR );	      /*参数输入错误,退出服务*/
	}

	ncpyParm(1,gcproduct_no,26);;
	ncpyParm(2,gcsrv_pwd,31);
	ncpyParm(3,gcoper_code,26);
	ncpyParm(4,gcdepart_code,26);
	ncpyParm(5,gcexch_code,26);

	trim(gcproduct_no);
	trim(gcsrv_pwd);
	trim(gcoper_code);
	trim(gcdepart_code);
	trim(gcexch_code);

	gilines=atoi(gclines);
	giswitch_id=atoi(gcswitch_id);

	#ifdef	YYDEBUG
	DebugLog("gcproduct_no=%s",gcproduct_no);
	DebugLog("gcsrv_pwd=%s",gcsrv_pwd);
	DebugLog("gcoper_code=%s",gcoper_code);
	DebugLog("gcdepart_code=%s",gcdepart_code);
	DebugLog("gcexch_code=%s",gcexch_code);
	#endif

		PrintStatus("yqd ====261");

	EXEC SQL SELECT COUNT(*) INTO :RECORDCOUNT 
	FROM RN_NUMBER WHERE use_state ='D' AND product_no = :gcproduct_no;
	
	if( RECORDCOUNT<=0 )
	{
			exceptExit(1," 该产品号码不存在,或已经在使用,输入其他号码。" );

	}
	RECORDCOUNT=0;
  EXEC SQL SELECT COUNT(*) INTO :v_count FROM rc_sim WHERE prod_no = :gcproduct_no AND use_state= 'F';
	if ( v_count !=1 )
	{
	 				 exceptExit(1," 该产品号码不存在,或者已经激活,输入其他号码。" );
  }
  else
  {
  			EXEC SQL SELECT COUNT(*) INTO RECORDCOUNT 
  			FROM  rc_sim 
  			WHERE prod_no = :gcproduct_no AND use_state= 'F' 
  			AND SRV_PWD = :gcsrv_pwd;
       	if (RECORDCOUNT == 0)
       	{
       			  exceptExit(1," 密码错误" );

       	}
       	else if (sqlca.sqlcode<0)
       	{
       			  exceptExit(-1,"查询rc_sim表出错!" );

       	}
       	else if (RECORDCOUNT ==1)
       	{
       		  	EXEC SQL SELECT iccid,psnm INTO :gciccid,:gcpsnm FROM rc_sim WHERE prod_no = :gcproduct_no ;
       		  	trim(gciccid);
       		  	trim(gcpsnm);

       	/*改sim卡号的使用状态为预站*/
         EXEC SQL UPDATE RC_SIM SET use_state= 'E'
	          WHERE prod_no=:gcproduct_no AND use_state='F';
       			if (sqlca.sqlcode < 0)
       			{
       			  exceptExit(3," 更新sim卡使用状态字段出错。" );

       			}

	       }
	       
	       
	 }


    EXEC SQL UPDATE RN_NUMBER SET use_state= 'E'
	  WHERE product_no=:gcproduct_no ;
   if (sqlca.sqlcode < 0)
       			{
       			  exceptExit(3," 更新RC_NO使用状态字段出错。" );

       			}


	   	sprintf(gcmainproduct_id,"%d",GenProductidProc());
  	trim(gcmainproduct_id);
  	if (strcmp(gcmainproduct_id,"-1") == 0)
  	{
    	strcpy(gcretstr,"生成产品编号出错");
    	return -1;
  	}

		sprintf(gcGenCustid,"%d",GenCustidProc());
		trim(gcGenCustid);
		if (strcmp(gcGenCustid,"-1") == 0)
		{
			strcpy(gcretstr,"生成客户编号出错");
			return -1;
		}
      trim(gcGenCustid);
  		sprintf(gccust_code,"%s%010s","898",gcGenCustid);
  		trim(gccust_code);
PrintStatus("gccust_code");
PrintStatus(gccust_code);
	/*取简表串dc_srv_table*/
	EXEC SQL SELECT table_bunch INTO :gctable_bunch FROM dc_srv_table WHERE prod_class = '20' AND srv_code='I7' ;
	if (sqlca.sqlcode != 0)
	{
		strcat(gcretstr,"检索dc_srv_table出错");
		#ifdef	YYDEBUG
		DebugLog("%s",gcretstr);
		fclose(tracefp);
		CopyTr(gcfilename,gcyyerrlog);
		#endif
		exceptExit(-1,gcretstr);
	}

	/*获取预付费资料表:dc_sim_preinfo信息*/
	sprintf(gcretstr,"295yqd	gcproduct_no:%s",	gcproduct_no);
	PrintStatus(gcretstr);

	EXEC SQL SELECT cust_id , contract_id ,product_id
	          INTO  :gccust_id,:gccontract_id,:gcoldproduct_id
	FROM dc_sim_preinfo
	WHERE (start_no < :gcproduct_no AND end_no >:gcproduct_no)
			OR start_no = :gcproduct_no OR end_no =:gcproduct_no  ;
			
		sprintf(gcretstr,"366yqd======	oldproduct_id:%s",	gcoldproduct_id);
	PrintStatus(gcretstr);
	sprintf(gcretstr,"368yqd=======	gccontract_id:%s",	gccontract_id);
	PrintStatus(gcretstr);
	sprintf(gcretstr,"295yqd	gccust_id:%s",	gccust_id);
	PrintStatus(gcretstr);
		
			

	if (sqlca.sqlcode < 0)
	{
		strcat(gcretstr,"检索dc_sim_preinfo出错");
		#ifdef	YYDEBUG
		DebugLog("%s",gcretstr);
		fclose(tracefp);
		CopyTr(gcfilename,gcyyerrlog);
		#endif
		exceptExit(-1,gcretstr);
	}



/**-----------------------生成Pdn_acceptlog详细资料----------------------------------------------------*/
	    gcretval=intoPdn_acceptlogProc();
      if (gcretval != 0)
      {
#ifdef	YYDEBUG
        DebugLog("Pdn_acceptlog error");
        fclose(tracefp);
		CopyTr(gcfilename,gcyyerrlog);
#endif
        exceptExit(gcretval,gcretstr);
      }
/**-----------------------生成Pdn_servcontrol详细资料----------------------------------------------------*/

		gcretval=intoPdn_servcontrolProc();
      if (gcretval != 0)
      {
#ifdef	YYDEBUG
        DebugLog("Pdn_servcontrol error");
        fclose(tracefp);
		CopyTr(gcfilename,gcyyerrlog);
#endif
        exceptExit(gcretval,gcretstr);
      }

/**-----------------------生成Sr_accept_log详细资料----------------------------------------------------*/

		gcretval=intoSr_accept_logProc();
      if (gcretval != 0)
      {
#ifdef	YYDEBUG
        DebugLog("Pdn_servcontrol error");
        fclose(tracefp);
		CopyTr(gcfilename,gcyyerrlog);
#endif
        exceptExit(gcretval,gcretstr);
      }

/**-----------------------生成Pdn_pdinfo详细资料----------------------------------------------------*/
	/*if(strspn(gctable_bunch,"A0")>0) */

	if( strstr(gctable_bunch,"A0") !=0)
	{
	PrintStatus("yqd384进入PDN_PDINFO!!!!");

		gcretval=intoPdn_pdinfoProc();
      if (gcretval != 0)
      {
#ifdef	YYDEBUG
        DebugLog("Pdn_servcontrol error");
        fclose(tracefp);
		CopyTr(gcfilename,gcyyerrlog);
#endif
        exceptExit(gcretval,gcretstr);
      }
}

/**-----------------------生成Cn_cust_info详细资料----------------------------------------------------*/
	if(strstr(gctable_bunch,"E7")!=0)
	{
	PrintStatus("yqd399进入cn_cust_info!!!!");

		gcretval=intoCn_cust_infoProc();
      if (gcretval != 0)

⌨️ 快捷键说明

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