📄 dmobimod.pc
字号:
}
}
}
if (gia1e == -1)
{
return 0;
}
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)
{
strcpy(gcretstr,"检索dc_sysfields出错");
return -1;
}
for(j=0;j<PHONE_FIELD;j++)
{
trim(lcfielda1[j]);
trim(lctypea1[j]);
}
ncpyRec(gia1s,5,lcstype,5);
trim(lcstype);
ncpyRec(gia1s,6,lcsrowid,5);
trim(lcsrowid);
for(j=gia1s;j<=gia1e;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 != gia1e))
{
ncpyRec(j,3,lcchna1[lisub],40);
trim(lcchna1[lisub]);
ncpyRec(j,7,lcnewa1[lisub],PHONE_LENGTH);
trim(lcnewa1[lisub]);
ncpyRec(j,8,lcolda1[lisub],PHONE_LENGTH);
trim(lcolda1[lisub]);
}
else /*不同记录序号或者到最后一条记录处理开始*/
{
if (j == gia1e)
{
ncpyRec(j,3,lcchna1[lisub],40);
trim(lcchna1[lisub]);
ncpyRec(j,7,lcnewa1[lisub],PHONE_LENGTH);
trim(lcnewa1[lisub]);
ncpyRec(j,8,lcolda1[lisub],PHONE_LENGTH);
trim(lcolda1[lisub]);
}
/*保存生产编号、生产类型到数组*/
strcpy(lcolda1[0],gcmainproduce_id);
strcpy(lcnewa1[0],gcmainproduce_id);
strcpy(lcchna1[0],"生产编号");
strcpy(lcolda1[1],"1");
strcpy(lcnewa1[1],"1");
strcpy(lcchna1[1],"生产类型");
/*拼装SQL语句开始*/
if (lcstype[0] == 'D') /*删除*/
{
strcpy(lcdelete,"DELETE FROM pdn_phone");
}
else if (lcstype[0] == 'A') /*增加*/
{
strcpy(lcinsert,"INSERT INTO pdn_phone(");
strcpy(lcvalues," VALUES(");
}
else if (lcstype[0] == 'M') /*修改*/
{
strcpy(lcupdate,"UPDATE pdn_phone SET ");
}
for(i=0;i<PHONE_FIELD;i++)
{
/*拼装SQL语句处理*/
if (lcchna1[i][0] != 0)
{
if (lcstype[0] == 'D')
{
}
else if (lcstype[0] == 'A')
{
if ((strcmp(lctypea1[i],"date") != 0)&&(lcchna1[i][0] != 0))
{
strcat(lcinsert,lcfielda1[i]);
strcat(lcinsert,",");
strcat(lcvalues,"'");
strcat(lcvalues,lcnewa1[i]);
strcat(lcvalues,"',");
}
else if ((strcmp(lctypea1[i],"date") == 0)&&(lcchna1[i][0] != 0))
{
strcat(lcinsert,lcfielda1[i]);
strcat(lcinsert,",");
strcat(lcvalues,"to_date('");
strcat(lcvalues,lcnewa1[i]);
strcat(lcvalues,"','YYYY-MM-DD HH24:MI:SS'),");
}
}
else if (lcstype[0] == 'M')
{
if ((strcmp(lctypea1[i],"date") != 0)&&(lcchna1[i][0] != 0))
{
strcat(lcupdate,lcfielda1[i]);
strcat(lcupdate," = '");
strcat(lcupdate,lcnewa1[i]);
strcat(lcupdate,"',");
}
else if ((strcmp(lctypea1[i],"date") == 0)&&(lcchna1[i][0] != 0))
{
strcat(lcupdate,lcfielda1[i]);
strcat(lcupdate," = to_date('");
strcat(lcupdate,lcnewa1[i]);
strcat(lcupdate,"','YYYY-MM-DD HH24:MI:SS'),");
}
}
if (i < 10)
{
sprintf(gcfieldstr,"%s%c%d%c","A1",'0',i,'/');
}
else
{
sprintf(gcfieldstr,"%s%d%c","A1",i,'/');
}
if ((i != 0) && (i != 1) &&(i != 2)) /*非主键字段*/
{
#ifdef YYDEBUG
DebugLog("pdn_phone 开始judge,i=%d",i);
#endif
gcretval=judge_srvcodeProc("pdn_phone","A1",lcfielda1[i],lcchna1[i],lcnewa1[i],lcolda1[i],lctypea1[i],i,gcfieldstr,atoi(lcsrowid),lcstype);
#ifdef YYDEBUG
DebugLog("pdn_phone 完成judge,i=%d",i);
#endif
if (gcretval != 0)
{
return -1;
}
}
}
} /*fielchang的for循环结束*/
if (lcstype[0] == 'D')
{
strcpy(lcwhere," WHERE produce_id = '");
strcat(lcwhere,gcmainproduce_id);
strcat(lcwhere,"' AND produce_type = 1");
strcat(lcwhere," AND phone_id = '");
strcat(lcwhere,lcolda1[2]);
strcat(lcwhere,"'");
strcat(lcdelete,lcwhere);
strcpy(lcsql,lcdelete);
}
else if (lcstype[0] == 'A')
{
lcinsert[strlen(lcinsert) - 1] = 0;
strcat(lcinsert,")");
lcvalues[strlen(lcvalues) - 1] = 0;
strcat(lcvalues,")");
strcat(lcinsert,lcvalues);
strcpy(lcsql,lcinsert);
}
else if (lcstype[0] == 'M')
{
strcpy(lcwhere," WHERE produce_id = '");
strcat(lcwhere,gcmainproduce_id);
strcat(lcwhere,"' AND produce_type = 1");
strcat(lcwhere," AND phone_id = '");
strcat(lcwhere,lcolda1[2]);
strcat(lcwhere,"'");
lcupdate[strlen(lcupdate) - 1] = 0;
strcat(lcupdate,lcwhere);
strcpy(lcsql,lcupdate);
}
/*拼装SQL语句结束*/
EXEC SQL EXECUTE IMMEDIATE :lcsql;
#ifdef YYDEBUG
DebugLog("pdn_phone,lcsql=%s",lcsql);
#endif
if (sqlca.sqlcode < 0)
{
#ifdef YYDEBUG
DebugLog("lcsql=%s",lcsql);
#endif
strcpy(gcretstr,"修改pdn_phone出错");
return -1;
}
/*对每一张工单的信息变动表,写主键记录*/
sprintf(lctempstr,"%s%s","A1",lcsrowid);
for(i=0;i<gisrvc;i++)
{
#ifdef YYDEBUG
DebugLog("start insert primarykey, lctempstr=%s",lctempstr);
DebugLog("gcnewchantypestr=%s",gcnewchantypestr[i]);
#endif
if (strstr(gcnewchantypestr[i],lctempstr) != NULL)
{
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(:gcnewproduce_id[i],:gcnewproduce_no[i],'pdn_phone',:lcfielda1[0],:lcchna1[0],:lcsrowid,:gcmainproduct_id,:lctypea1[0],:lcnewa1[0],:lcolda1[0],:gcnewsrv_code[i],0);
if (sqlca.sqlcode < 0)
{
strcpy(gcretstr,"插入pdn_fieldchang出错");
return -1;
}
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(:gcnewproduce_id[i],:gcnewproduce_no[i],'pdn_phone',:lcfielda1[1],:lcchna1[1],:lcsrowid,:gcmainproduct_id,:lctypea1[1],:lcnewa1[1],:lcolda1[1],:gcnewsrv_code[i],1);
if (sqlca.sqlcode < 0)
{
strcpy(gcretstr,"插入pdn_fieldchang出错");
return -1;
}
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(:gcnewproduce_id[i],:gcnewproduce_no[i],'pdn_phone',:lcfielda1[2],:lcchna1[2],:lcsrowid,:gcmainproduct_id,:lctypea1[2],:lcnewa1[2],:lcolda1[2],:gcnewsrv_code[i],2);
if (sqlca.sqlcode < 0)
{
strcpy(gcretstr,"插入pdn_fieldchang出错");
return -1;
}
}
}
strcpy(lcsrowid,lccrowid);
strcpy(lcstype,lcctype);
for(k=0;k<PHONE_FIELD;k++)
{
lcchna1[k][0]=0;
lcnewa1[k][0]=0;
lcolda1[k][0]=0;
}
ncpyRec(j,3,lcchna1[lisub],40);
trim(lcchna1[lisub]);
ncpyRec(j,7,lcnewa1[lisub],PHONE_LENGTH);
trim(lcnewa1[lisub]);
ncpyRec(j,8,lcolda1[lisub],PHONE_LENGTH);
trim(lcolda1[lisub]);
} /*不同记录序号或者到最后一条记录处理结束*/
} /*for循环结束*/
return 0;
}
/*
* 函数说明:生成pdn_incr_prod信息
* 输入参数:
* 输出参数:
* 返 回 值:
*/
int intoPdn_incr_prodProc()
{
EXEC SQL BEGIN DECLARE SECTION;
char lcnewg0[6][12] = {0};
char lcoldg0[6][12] = {0};
char lcfieldg0[6][20] = {0};
char lcchng0[6][40] = {0};
char lctypeg0[6][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};
char lcphone_id[26] = {0};
int lisub=0;
int i=0;
int j=0;
int k=0;
char lctempstr[10] = {0};
EXEC SQL END DECLARE SECTION;
/*初始化pdn_incr_prod*/
if ((gitimes == 0) || (gitimes == 1) || (gitimes == 4))
{
if (girolls == 0)
{
gcretval = DinitpdnProc(gcmainproduct_id,gcmainproduce_id,gcrollproduce_no[0],"pdn_incr_prod",gitimes,gcdelflag,gcnewflag,gcrollsrv_code[0]);
if (gcretval == -1)
{
strcpy(gcretstr,"初始化pdn_incr_prod出错");
return -1;
}
}
else
{
for(i=0;i<girolls;i++)
{
if (gcrollproduce_no[i][0] != 0)
{
gcretval = DinitpdnProc(gcmainproduct_id,gcmainproduce_id,gcrollproduce_no[i],"pdn_incr_prod",gitimes,gcdelflag,gcnewflag,gcrollsrv_code[i]);
if (gcretval == -1)
{
strcpy(gcretstr,"初始化pdn_incr_prod出错");
return -1;
}
}
}
}
}
else if (gitimes == 2)
{
for(i=0;i<giaddc;i++)
{
gcretval = DinitpdnProc(gcmainproduct_id,gcoldproduce_id[i],gcoldproduce_no[i],"pdn_incr_prod",gitimes,gcdelflag,gcnewflag,gcoldsrv_code[i]);
if (gcretval == -1)
{
strcpy(gcretstr,"初始化pdn_incr_prod出错");
return -1;
}
}
}
if (gig0e == -1)
{
return 0;
}
for(k=0;k<6;k++)
{
lcfieldg0[k][0]=0;
lcchng0[k][0]=0;
lctypeg0[k][0]=0;
lcnewg0[k][0]=0;
lcoldg0[k][0]=0;
}
/*预先从dc_sysfields中取出字段和类型,保存在lcfieldg0和lctypeg0中*/
EXEC SQL SELECT field_code,field_type INTO :lcfieldg0,:lctypeg0 FROM dc_sysfields WHERE table_code = 'pdn_incr_prod' ORDER BY fld_id;
if (sqlca.sqlcode < 0)
{
strcpy(gcretstr,"检索dc_sysfields出错");
return -1;
}
for(j=0;j<6;j++)
{
trim(lcfieldg0[j]);
trim(lctypeg0[j]);
}
ncpyRec(gig0s,5,lcstype,5);
trim(lcstype);
ncpyRec(gig0s,6,lcsrowid,5);
trim(lcsrowid);
for(j=gig0s;j<=gig0e;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 != gig0e))
{
ncpyRec(j,3,lcchng0[lisub],40);
trim(lcchng0[lisub]);
ncpyRec(j,7,lcnewg0[lisub],12);
trim(lcnewg0[lisub]);
ncpyRec(j,8,lcoldg0[lisub],12);
trim(lcoldg0[lisub]);
}
else /*不同记录序号或者到最后一条记录处理开始*/
{
if (j == gig0e)
{
ncpyRec(j,3,lcchng0[lisub],40);
trim(lcchng0[lisub]);
ncpyRec(j,7,lcnewg0[lisub],12);
trim(lcnewg0[lisub]);
ncpyRec(j,8,lcoldg0[lisub],12);
trim(lcoldg0[lisub]);
}
/*保存生产编号、生产类型到数组*/
strcpy(lcoldg0[0],gcmainproduce_id);
strcpy(lcnewg0[0],gcmainproduce_id);
strcpy(lcchng0[0],"生产编号");
strcpy(lcoldg0[1],"1");
strcpy(lcnewg0[1],"1");
strcpy(lcchng0[1],"生产类型");
/*拼装SQL语句开始*/
if (lcstype[0] == 'D') /*删除*/
{
strcpy(lcdelete,"DELETE FROM pdn_incr_prod");
}
else if (lcstype[0] == 'A') /*增加*/
{
strcpy(lcinsert,"INSERT INTO pdn_incr_prod(");
strcpy(lcvalues," VALUES(");
}
else if (lcstype[0] == 'M') /*修改*/
{
strcpy(lcupdate,"UPDATE pdn_incr_prod SET ");
}
for(i=0;i<6;i++)
{
/*拼装SQL语句处理*/
if (lcchng0[i][0] != 0)
{
if (lcstype[0] == 'D')
{
}
else if (lcstype[0] == 'A')
{
if ((strcmp(lctypeg0[i],"date") != 0)&&(lcchng0[i][0] != 0))
{
strcat(lcinsert,lcfieldg0[i]);
strcat(lcinsert,",");
strcat(lcvalues,"'");
strcat(lcvalues,lcnewg0[i]);
strcat(lcvalues,"',");
}
else if (strcmp(lctypeg0[i],"date") == 0)
{
strcat(lcinsert,lcfieldg0[i]);
strcat(lcinsert,",");
strcat(lcvalues,"to_date('");
strcat(lcvalues,lcnewg0[i]);
strcat(lcvalues,"','YYYY-MM-DD HH24:MI:SS'),");
}
}
else if (lcstype[0] == 'M')
{
if ((strcmp(lctypeg0[i],"date") != 0)&&(lcchng0[i][0] != 0))
{
strcat(lcupdate,lcfieldg0[i]);
strcat(lcupdate," = '");
strcat(lcupdate,lcnewg0[i]);
strcat(lcupdate,"',");
}
else if (strcmp(lctypeg0[i],"date") == 0)
{
strcat(lcupdate,lcfieldg0[i]);
strcat(lcupdate," = to_date('");
strcat(lcupdate,lcnewg0[i]);
strcat(lcupdate,"','YYYY-MM-DD HH24:MI:SS'),");
}
}
if (i < 10)
{
sprintf(gcfieldstr,"%s%c%d%c","G0",'0',i,'/');
}
else
{
sprintf(gcfieldstr,"%s%d%c","G0",i,'/');
}
if ((i != 0) && (i != 1) && (i != 3)) /*非主键字段*/
{
#ifdef YYDEBUG
DebugLog("pdn_incr_prod 开始judge,i=%d",i);
#endif
gcretval=judge_srvcodeProc("pdn_incr_prod","G0",lcfieldg0[i],lcchng0[i],lcnewg0[i],lcoldg0[i],lctypeg0[i],i,gcfieldstr,atoi(lcsrowid),lcstype);
#ifdef YYDEBUG
DebugLog("pdn_incr_prod 完成judge,i=%d",i);
#endif
if (gcretval != 0)
{
return -1;
}
}
}
} /*fielchang的for循环结束*/
if (lcstype[0] == 'D')
{
strcpy(lcwhere," WHERE produce_id = '");
strcat(lcwhere,gcmainproduce_id);
strcat(lcwhere,"' AND produce_type = 1");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -