$PBExportHeader$f_checkpz.srf global type f_checkpz from function_object end type forward prototypes global subroutine f_checkpz (string arg_status, ref s_mtrlcfg_expr arg_mtrl_config_expr[]) end prototypes global subroutine f_checkpz (string arg_status, ref s_mtrlcfg_expr arg_mtrl_config_expr[]);s_mtrlcfg_expr s_mtrl_config_expr[],s_mtrl_config_union[] Long i,j,ll_i,ll_j Boolean flag String str[] i = 0 flag = TRUE DO WHILE flag //分离利用'+'号分割字符串 IF Pos(arg_status,'+') > 0 THEN i++ str[i] = Mid(arg_status,1,Pos(arg_status,'+') - 1 ) arg_status = Mid(arg_status,Pos(arg_status , '+') + 1) ELSE flag = FALSE str[i+1] = arg_status END IF LOOP FOR i = 1 TO UpperBound(str[]) //分离利用'*'号分割出配置名和数量 IF Pos(str[i] , '*') > 0 THEN s_mtrl_config_expr[i].cfgname = Trim(Mid(str[i],1,Pos(str[i],'*') - 1)) s_mtrl_config_expr[i].qty = Trim(Mid(str[i] , (Pos(str[i] , '*') + 1), Len(str[i]) - (Pos(str[i] , '*') + 1) + 1)) ELSE s_mtrl_config_expr[i].cfgname = Trim(str[i]) s_mtrl_config_expr[i].qty = '1' END IF NEXT j = 0 FOR ll_i = 1 TO UpperBound(s_mtrl_config_expr) FOR ll_j = 1 TO j IF s_mtrl_config_union[ll_j].cfgname = s_mtrl_config_expr[ll_i].cfgname THEN s_mtrl_config_union[ll_j].qty = String(Dec(s_mtrl_config_union[ll_j].qty) + Dec(s_mtrl_config_expr[ll_j].qty)) GOTO next_ END IF NEXT j++ s_mtrl_config_union[j].cfgname = s_mtrl_config_expr[ll_i].cfgname s_mtrl_config_union[j].qty = s_mtrl_config_expr[ll_i].qty next_: NEXT arg_mtrl_config_expr = s_mtrl_config_union end subroutine