?? dphsacti.pc
字號:
/********************************************************************
* 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 + -