f_pack_dscrp.srf 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. $PBExportHeader$f_pack_dscrp.srf
  2. global type f_pack_dscrp from function_object
  3. end type
  4. forward prototypes
  5. global function string f_pack_dscrp (long arg_mtrlid, decimal arg_qty, string arg_prdpackcode, decimal arg_packqty, string arg_unit)
  6. end prototypes
  7. global function string f_pack_dscrp (long arg_mtrlid, decimal arg_qty, string arg_prdpackcode, decimal arg_packqty, string arg_unit);//返回包装
  8. //f_pack_dscrp(arg_mtrlid,arg_qty,arg_prdpackcode,arg_packqty,arg_unit)
  9. String rst_dscrp = ''
  10. Decimal lde_packqty_Tol, lde_qty
  11. String ls_format
  12. arg_qty = abs(arg_qty)
  13. arg_prdpackcode = Trim(arg_prdpackcode)
  14. IF arg_prdpackcode = '' Or arg_packqty = 0 THEN
  15. ls_format = f_GetStringFormat(0, arg_qty)
  16. rst_dscrp = String(arg_qty,ls_format) + arg_unit
  17. GOTO ext
  18. END IF
  19. Int li_ifpacktype
  20. SELECT ifpacktype INTO :li_ifpacktype
  21. FROM u_mtrldef
  22. Where mtrlid = :arg_mtrlid;
  23. IF sqlca.SQLCode <> 0 THEN
  24. li_ifpacktype = 1
  25. END IF
  26. IF li_ifpacktype = 0 THEN //乘法
  27. lde_packqty_Tol = arg_qty * arg_packqty
  28. ls_format = f_GetStringFormat(0, lde_packqty_Tol)
  29. rst_dscrp = String(lde_packqty_Tol,ls_format) + arg_prdpackcode
  30. ELSE //除法
  31. lde_packqty_Tol = truncate(arg_qty / arg_packqty, 0)
  32. lde_qty = Mod(arg_qty, arg_packqty)
  33. rst_dscrp = ""
  34. IF lde_packqty_Tol > 0 THEN
  35. rst_dscrp = String(lde_packqty_Tol) + arg_prdpackcode
  36. END IF
  37. IF lde_qty > 0 THEN
  38. ls_format = f_GetStringFormat(0, lde_qty)
  39. rst_dscrp += String(lde_qty,ls_format) + arg_unit
  40. END IF
  41. // IF Long(arg_qty/arg_packqty) <= 0 THEN //不够一包
  42. // ls_format = f_GetStringFormat(0, arg_qty)
  43. // rst_dscrp = String(arg_qty,ls_format) + arg_unit
  44. // ELSE
  45. // IF Mod ( arg_qty, arg_packqty ) = 0 THEN
  46. // rst_dscrp = String(Truncate(arg_qty/arg_packqty,0)) + Trim(arg_prdpackcode)
  47. // ELSE
  48. // IF Mod(Mod ( arg_qty, arg_packqty ),1) = 0 THEN
  49. // IF Truncate(arg_qty/arg_packqty,0) = 0 THEN
  50. // rst_dscrp = String(Mod ( arg_qty, arg_packqty ),'#####0') + arg_unit
  51. // ELSE
  52. // rst_dscrp = String(Truncate(arg_qty/arg_packqty,0)) + Trim(arg_prdpackcode) + String(Mod ( arg_qty, arg_packqty ),'#####0') + arg_unit
  53. // END IF
  54. // ELSE
  55. // IF Truncate(arg_qty/arg_packqty,0) = 0 THEN
  56. // rst_dscrp = String(Mod ( arg_qty, arg_packqty ),'#####0.00##') + arg_unit
  57. // ELSE
  58. // rst_dscrp = String(Truncate(arg_qty/arg_packqty,0)) + Trim(arg_prdpackcode) + String(Mod ( arg_qty, arg_packqty ),'#####0.00##') + arg_unit
  59. // END IF
  60. // END IF
  61. // END IF
  62. // END IF
  63. END IF
  64. ext:
  65. RETURN rst_dscrp
  66. end function