f_checkpz.srf 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. $PBExportHeader$f_checkpz.srf
  2. global type f_checkpz from function_object
  3. end type
  4. forward prototypes
  5. global subroutine f_checkpz (string arg_status, ref s_mtrlcfg_expr arg_mtrl_config_expr[])
  6. end prototypes
  7. 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[]
  8. Long i,j,ll_i,ll_j
  9. Boolean flag
  10. String str[]
  11. i = 0
  12. flag = TRUE
  13. DO WHILE flag //分离利用'+'号分割字符串
  14. IF Pos(arg_status,'+') > 0 THEN
  15. i++
  16. str[i] = Mid(arg_status,1,Pos(arg_status,'+') - 1 )
  17. arg_status = Mid(arg_status,Pos(arg_status , '+') + 1)
  18. ELSE
  19. flag = FALSE
  20. str[i+1] = arg_status
  21. END IF
  22. LOOP
  23. FOR i = 1 TO UpperBound(str[]) //分离利用'*'号分割出配置名和数量
  24. IF Pos(str[i] , '*') > 0 THEN
  25. s_mtrl_config_expr[i].cfgname = Trim(Mid(str[i],1,Pos(str[i],'*') - 1))
  26. s_mtrl_config_expr[i].qty = Trim(Mid(str[i] , (Pos(str[i] , '*') + 1), Len(str[i]) - (Pos(str[i] , '*') + 1) + 1))
  27. ELSE
  28. s_mtrl_config_expr[i].cfgname = Trim(str[i])
  29. s_mtrl_config_expr[i].qty = '1'
  30. END IF
  31. NEXT
  32. j = 0
  33. FOR ll_i = 1 TO UpperBound(s_mtrl_config_expr)
  34. FOR ll_j = 1 TO j
  35. IF s_mtrl_config_union[ll_j].cfgname = s_mtrl_config_expr[ll_i].cfgname THEN
  36. s_mtrl_config_union[ll_j].qty = String(Dec(s_mtrl_config_union[ll_j].qty) + Dec(s_mtrl_config_expr[ll_j].qty))
  37. GOTO next_
  38. END IF
  39. NEXT
  40. j++
  41. s_mtrl_config_union[j].cfgname = s_mtrl_config_expr[ll_i].cfgname
  42. s_mtrl_config_union[j].qty = s_mtrl_config_expr[ll_i].qty
  43. next_:
  44. NEXT
  45. arg_mtrl_config_expr = s_mtrl_config_union
  46. end subroutine