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

📄 dphssimc.pc

📁 小灵通机卡分离模块的设计.建立在数据库服务器
💻 PC
📖 第 1 页 / 共 5 页
字号:
  if ((gitimes == 2 ) || (gitimes == 4))
  {
/*删除旧记录*/
    EXEC SQL DELETE FROM sr_accept_log WHERE produce_id = :gcproduce_id AND produce_no = :gcproduce_no AND (accept_state = '10' OR accept_state = '00');
    if (sqlca.sqlcode < 0)
    {
      strcat(gcretstr,"删除sr_accept_log出错");
      return -1;
    }
  }

  EXEC SQL INSERT INTO sr_accept_log(produce_id,produce_no,accept_state,order_id,accept_id,product_id,srv_code,sub_srv,accept_lan,vest_lan,unit_type,unit_code,exch_code,depart_code,depart_type,oper_code,terminal_ip,term_code,atime,srv_type)
  VALUES(:gcproduce_id,:gcproduce_no,:gcaccept_state,:gcorder_id,:gcaccept_id,:gcproduct_id,:gcsrv_code,:gcsub_srv,:gcaccept_lan,:gcvest_lan,:gcunit_type,:gcunit_code,:gcexch_code,:gcdepart_code,:gcdepart_type,:gcoper_code,:gcterminal_ip,:gcterm_code,sysdate,:gcsrv_type);
  if (sqlca.sqlcode < 0)
  {
    strcat(gcretstr,"插入sr_accept_log出错");
    return -1;
  }

  return 0;
}

/*
* 函数说明:生成pdn_servcontrol信息
* 输入参数:
* 输出参数:
* 返 回 值:
*/

int intoPdn_servcontrolProc()

{
EXEC SQL BEGIN DECLARE SECTION;

EXEC SQL END DECLARE SECTION;


  if ((gitimes == 2) || (gitimes == 4))
  {
/*删除旧记录*/
	  EXEC SQL DELETE FROM pdn_servcontrol WHERE produce_id = :gcproduce_id AND produce_no = :gcproduce_no AND (accept_state = '10' OR accept_state = '00');
	  if (sqlca.sqlcode < 0)
	  {
	    strcat(gcretstr,"删除pdn_servcontrol出错");
	    return -1;
	  }
  }

  EXEC SQL INSERT INTO pdn_servcontrol(produce_id,produce_no,order_id,accept_id,product_id,srv_code,sub_srv,accept_state,disp_flag,srv_type,atime)
  VALUES(:gcproduce_id,:gcproduce_no,:gcorder_id,:gcaccept_id,:gcproduct_id,:gcsrv_code,:gcsub_srv,:gcaccept_state,:gcdisp_flag,:gcsrv_type,sysdate);
  if (sqlca.sqlcode != 0)
  {
    strcat(gcretstr,"插入pdn_servcontrol出错");
    return -1;
  }
  return 0;
}




/*
* 函数说明:生成pdn_pdinfo信息
* 输入参数:
* 输出参数:
* 返 回 值:
*/

int intoPdn_pdinfoProc()

{
EXEC SQL BEGIN DECLARE SECTION;
  char lcnewa0[PDINFO_FIELD][PDINFO_LENGTH] = {0};
  char lcolda0[PDINFO_FIELD][PDINFO_LENGTH] = {0};
  char lcfielda0[PDINFO_FIELD][20] = {0};
  char lcchna0[PDINFO_FIELD][40] = {0};
  char lctypea0[PDINFO_FIELD][10] = {0};
  char lcsub[3] = {0};
  char lcupdate[2000] = {0};
  int  lisub=0;
  int  j=0;
  int  k=0;
  int  lirows=0;


EXEC SQL END DECLARE SECTION;

  gcretval = DinitpdnProc(gcproduct_id,gcproduce_id,gcproduce_no,"pdn_pdinfo",gitimes,gcdelflag,"0",gcsrv_code);
	if (gcretval == -1)
	{
		strcat(gcretstr,"初始化pdn_pdinfo出错");
		return -1;
	}
	if (gia0e == -1)
	{
  	return 0;
	}

  for(k=0;k<PDINFO_FIELD;k++)
  {
    lcfielda0[k][0]=0;
    lcchna0[k][0]=0;
    lctypea0[k][0]=0;
    lcnewa0[k][0]=0;
    lcolda0[k][0]=0;
  }

/*预先从dc_sysfields中取出字段和类型,保存在lcfielda0和lctypea0中*/
  EXEC SQL SELECT field_code,field_type INTO :lcfielda0,:lctypea0 FROM dc_sysfields WHERE table_code = 'pdn_pdinfo' ORDER BY fld_id;
  if (sqlca.sqlcode < 0)
  {
  	strcat(gcretstr,"检索dc_sysfields出错");
  	return -1;
  }
  for(j=0;j<PDINFO_FIELD;j++)
  {
    trim(lcfielda0[j]);
    trim(lctypea0[j]);
  }

  for(j=gia0s;j<=gia0e;j++)
  {
    ncpyRec(j,1,lcsub,3);
    lisub=atoi(lcsub);
    ncpyRec(j,3,lcchna0[lisub],40);
    trim(lcchna0[lisub]);
    ncpyRec(j,7,lcnewa0[lisub],PDINFO_LENGTH);
    trim(lcnewa0[lisub]);
    ncpyRec(j,8,lcolda0[lisub],PDINFO_LENGTH);
    trim(lcolda0[lisub]);
  }

/*保存生产编号、生产类型到数组*/
		strcpy(lcolda0[0],gcproduce_id);
		strcpy(lcnewa0[0],gcproduce_id);
		strcpy(lcchna0[0],"生产编号");

	strcpy(lcolda0[1],"1");
	strcpy(lcnewa0[1],"1");
	strcpy(lcchna0[1],"生产类型");

/*拼装SQL语句开始*/
  strcpy(lcupdate,"UPDATE pdn_pdinfo SET ");
  for (k=0;k<PDINFO_FIELD;k++)
  {
	  if (strcmp(lctypea0[k],"date") != 0)
    {
    	if (lcchna0[k][0] != 0)
	    {
	      strcat(lcupdate,lcfielda0[k]);
	      strcat(lcupdate," = '");
	      strcat(lcupdate,lcnewa0[k]);
	      strcat(lcupdate,"',");
	    }
    }
    else
    {
    	if (lcchna0[k][0] != 0)
	    {
	      strcat(lcupdate,lcfielda0[k]);
	      strcat(lcupdate," = to_date('");
	      strcat(lcupdate,lcnewa0[k]);
	      strcat(lcupdate,"','YYYY-MM-DD HH24:MI:SS'),");
	    }
    }
  }
  lcupdate[strlen(lcupdate) - 1] = 0;
  strcat(lcupdate," WHERE produce_id = '");
  strcat(lcupdate,gcproduce_id);
  strcat(lcupdate,"' AND produce_type = 1");

/*拼装SQL语句结束*/
  EXEC SQL EXECUTE IMMEDIATE :lcupdate;
#ifdef	YYDEBUG
	  DebugLog("lcupdate=%s",lcupdate);
#endif
	if (sqlca.sqlcode < 0)
	{
#ifdef	YYDEBUG
	  DebugLog("lcupdate=%s",lcupdate);
#endif
	  strcat(gcretstr,"修改pdn_pdinfo新记录出错");
	  return -1;
	}

/*生成记录变动表,*/
  EXEC SQL INSERT INTO pdn_chantype(produce_id,produce_no,table_name,record_id,product_id,record_type)
  VALUES(:gcproduce_id,:gcproduce_no,'pdn_pdinfo',1,:gcproduct_id,'M');
  if (sqlca.sqlcode < 0)
  {
    strcat(gcretstr,"插入pdn_chantype出错");
    return -1;
  }
	for(k=0;k<PDINFO_FIELD;k++)
  {
    if (lcchna0[k][0] != 0)
    {
      EXEC SQL INSERT INTO pdn_fieldchang(produce_id,produce_no,table_name,field_name,field_memo,record_id,product_id,field_type,new_value,old_value,srv_code,fld_id)
      VALUES(:gcproduce_id,:gcproduce_no,'pdn_pdinfo',:lcfielda0[k],:lcchna0[k],1,:gcproduct_id,:lctypea0[k],:lcnewa0[k],:lcolda0[k],:gcsrv_code,:k);
      if (sqlca.sqlcode < 0)
      {
        strcat(gcretstr,"插入pdn_fieldchang出错");
        return -1;
      }
    }
  }
  return 0;
}


/*
* 函数说明:生成cn_cust_info信息
* 输入参数:
* 输出参数:
* 返 回 值:
*/

int intoCn_cust_infoProc()

{
EXEC SQL BEGIN DECLARE SECTION;
  char lcnewe7[44][260] = {0};
  char lcolde7[44][260] = {0};
  char lcfielde7[44][20] = {0};
  char lcchne7[44][40] = {0};
  char lctypee7[44][10] = {0};
  char lcupdate[2000] = {0};
	char lcsrowid[5] = {0};
	char lccrowid[5] = {0};
	char lcstype[5] = {0};
	char lcctype[5] = {0};
  char lcsub[3] = {0};
  int  lisub=0;
  int  j=0;
  int  k=0;
  int  lirows=0;


EXEC SQL END DECLARE SECTION;

  gcretval = DinitpdnProc(gcproduct_id,gcproduce_id,gcproduce_no,"cn_cust_info",gitimes,gcdelflag,"0",gcsrv_code);
	if (gcretval == -1)
	{
		strcat(gcretstr,"初始化cn_cust_info出错");
		return -1;
	}
	if (gie7e == -1)
	{
  	return 0;
	}

  for(k=0;k<44;k++)
  {
    lcfielde7[k][0]=0;
    lcchne7[k][0]=0;
    lctypee7[k][0]=0;
    lcnewe7[k][0]=0;
    lcolde7[k][0]=0;

  }

/*预先从dc_sysfields中取出字段和类型,保存在lcfielde7和lctypee7中*/
  EXEC SQL SELECT field_code,field_type INTO :lcfielde7,:lctypee7 FROM dc_sysfields WHERE table_code = 'cn_cust_info' ORDER BY fld_id;
  if (sqlca.sqlcode < 0)
  {
  	strcat(gcretstr,"检索dc_sysfields出错");
  	return -1;
  }
  for(j=0;j<44;j++)
  {
    trim(lcfielde7[j]);
    trim(lctypee7[j]);
  }

  ncpyRec(gie7s,5,lcstype,5);
  trim(lcstype);
  ncpyRec(gie7s,6,lcsrowid,5);
  trim(lcsrowid);
  for(j=gie7s;j<=gie7e;j++)
  {
    ncpyRec(j,1,lcsub,3);
    lisub=atoi(lcsub);
    ncpyRec(j,5,lcctype,5);
    trim(lcctype);
    ncpyRec(j,6,lccrowid,5);
    trim(lccrowid);

    if ((strcmp(lcsrowid,lccrowid) == 0) && (j != gie7e))
    {
      ncpyRec(j,3,lcchne7[lisub],40);
      trim(lcchne7[lisub]);
      ncpyRec(j,7,lcnewe7[lisub],260);
      trim(lcnewe7[lisub]);
      ncpyRec(j,8,lcolde7[lisub],260);
      trim(lcolde7[lisub]);
    }
    else                          /*不同记录序号或者到最后一条记录处理开始*/
    {
      if (j == gie7e)
      {
	      ncpyRec(j,3,lcchne7[lisub],40);
	      trim(lcchne7[lisub]);
	      ncpyRec(j,7,lcnewe7[lisub],260);
	      trim(lcnewe7[lisub]);
	      ncpyRec(j,8,lcolde7[lisub],260);
	      trim(lcolde7[lisub]);
      }
/*保存生产编号、生产类型到数组*/
		strcpy(lcolde7[0],gcproduce_id);
		strcpy(lcnewe7[0],gcproduce_id);
		strcpy(lcchne7[0],"生产编号");

	strcpy(lcolde7[1],"1");
	strcpy(lcnewe7[1],"1");
	strcpy(lcchne7[1],"生产类型");

		/*拼装SQL语句开始*/
		  strcpy(lcupdate,"UPDATE cn_cust_info SET ");
		  for (k=0;k<44;k++)
		  {
			  if (strcmp(lctypee7[k],"date") != 0)
		    {
		    	if (lcchne7[k][0] != 0)
			    {
			      strcat(lcupdate,lcfielde7[k]);
			      strcat(lcupdate," = '");
			      strcat(lcupdate,lcnewe7[k]);
			      strcat(lcupdate,"',");
			    }
		    }
		    else
		    {
		    	if (lcchne7[k][0] != 0)
			    {
			      strcat(lcupdate,lcfielde7[k]);
			      strcat(lcupdate," = to_date('");
			      strcat(lcupdate,lcnewe7[k]);
			      strcat(lcupdate,"','YYYY-MM-DD HH24:MI:SS'),");
			    }
		    }
		  }
		  lcupdate[strlen(lcupdate) - 1] = 0;
		  strcat(lcupdate," WHERE produce_id = '");
		  strcat(lcupdate,gcproduce_id);
		  strcat(lcupdate,"' AND produce_type = 1");
		  strcat(lcupdate," AND cust_id = '");
		  strcat(lcupdate,lcnewe7[2]);
		  strcat(lcupdate,"'");

		/*拼装SQL语句结束*/
		  EXEC SQL EXECUTE IMMEDIATE :lcupdate;
			if (sqlca.sqlcode < 0)
			{
		#ifdef	YYDEBUG
			  DebugLog("gitimes=0,lcupdate=%s",lcupdate);
		#endif
			  strcat(gcretstr,"修改cn_cust_info新记录出错");
			  return -1;
			}

		/*生成记录变动表*/
		  EXEC SQL INSERT INTO pdn_chantype(produce_id,produce_no,table_name,record_id,product_id,record_type)
		  VALUES(:gcproduce_id,:gcproduce_no,'cn_cust_info',:lcsrowid,:gcproduct_id,'M');
		  if (sqlca.sqlcode < 0)
		  {
		    strcat(gcretstr,"插入pdn_chantype出错");
		    return -1;
		  }
			for(k=0;k<44;k++)
		  {
		    if (lcchne7[k][0] != 0)
		    {
		      EXEC SQL INSERT INTO pdn_fieldchang(produce_id,produce_no,table_name,field_name,field_memo,record_id,product_id,field_type,new_value,old_value,srv_code,fld_id)
		      VALUES(:gcproduce_id,:gcproduce_no,'cn_cust_info',:lcfielde7[k],:lcchne7[k],:lcsrowid,:gcproduct_id,:lctypee7[k],:lcnewe7[k],:lcolde7[k],:gcsrv_code,:k);
		      if (sqlca.sqlcode < 0)
		      {
		        strcat(gcretstr,"插入pdn_fieldchang出错");
		        return -1;
		      }
		    }
		  }
      strcpy(lcsrowid,lccrowid);
      strcpy(lcstype,lcctype);
		  for(k=0;k<44;k++)
		  {
		    lcchne7[k][0]=0;
		    lcnewe7[k][0]=0;
		    lcolde7[k][0]=0;
		  }

	    ncpyRec(j,3,lcchne7[lisub],40);
	    trim(lcchne7[lisub]);
	    ncpyRec(j,7,lcnewe7[lisub],260);
	    trim(lcnewe7[lisub]);
	    ncpyRec(j,8,lcolde7[lisub],260);
	    trim(lcolde7[lisub]);
		}				/*不同记录序号或者到最后一条记录处理结束*/
	}                          /*for循环结束*/
  return 0;
}

/*
* 函数说明:生成pdn_phone信息
* 输入参数:
* 输出参数:
* 返 回 值:
*/

int intoPdn_phoneProc()

{
EXEC SQL BEGIN DECLARE SECTION;
  char lcnewa1[PHONE_FIELD][PHONE_LENGTH] = {0};
  char lcolda1[PHONE_FIELD][PHONE_LENGTH] = {0};
  char lcfielda1[PHONE_FIELD][20] = {0};
  char lcchna1[PHONE_FIELD][40] = {0};
  char lctypea1[PHONE_FIELD][10] = {0};
  char lcinsert[2000] = {0};
  char lcvalues[2000] = {0};
  char lcupdate[2000] = {0};
	char lcwhere[2000] = {0};
	char lcdelete[2000] = {0};
	char lcsql[2000] = {0};
	char lcsrowid[5] = {0};
	char lccrowid[5] = {0};
	char lcstype[5] = {0};
	char lcctype[5] = {0};
  char lcsub[3] = {0};
  int  lisub=0;
  int  j=0;
  int  k=0;
  int  lirows=0;


EXEC SQL END DECLARE SECTION;

  gcretval = DinitpdnProc(gcproduct_id,gcproduce_id,gcproduce_no,"pdn_phone",gitimes,gcdelflag,"0",gcsrv_code);
	if (gcretval == -1)
	{
		strcat(gcretstr,"初始化pdn_phone出错");
		return -1;
	}
	if (gia1e == -1)
	{
  	return 0;
	}

/*因为需要生成ISDN的子号码,所以检索pdn_pdinfo的相关信息*/
	EXEC SQL SELECT prod_class,exch_code,prot_code INTO :gcprod_class,:gcprodexch_code,:gcprot_code FROM pdn_pdinfo WHERE produce_id = :gcproduce_id AND produce_type = 1;
	if (sqlca.sqlcode != 0)
	{
		strcpy(gcretstr,"查询pdn_pdinfo局向出错");
		return -1;
	}
	trim(gcprod_class);
	trim(gcprodexch_code);
	trim(gcprot_code);

  for(k=0;k<PHONE_FIELD;k++)
  {
    lcfielda1[k][0]=0;
    lcchna1[k][0]=0;
    lctypea1[k][0]=0;
    lcnewa1[k][0]=0;
    lcolda1[k][0]=0;
  }

/*预先从dc_sysfields中取出字段和类型,保存在lcfielda1和lctypea1中*/
  EXEC SQL SELECT field_code,field_type INTO :lcfielda1,:lctypea1 FROM dc_sysfields WHERE table_code = 'pdn_phone' ORDER BY fld_id;
  if (sqlca.sqlcode < 0)
  {
  	strcat(gcretstr,"检索dc_sysfields出错");
  	return -1;

⌨️ 快捷键说明

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