dbauo_mtrlware.sru 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. $PBExportHeader$dbauo_mtrlware.sru
  2. forward
  3. global type dbauo_mtrlware from nonvisualobject
  4. end type
  5. end forward
  6. global type dbauo_mtrlware from nonvisualobject
  7. end type
  8. global dbauo_mtrlware dbauo_mtrlware
  9. type variables
  10. //====================================================================
  11. // 事件: .Declare Instance Variables()
  12. //--------------------------------------------------------------------
  13. // 描述:
  14. //--------------------------------------------------------------------
  15. // 参数:
  16. //--------------------------------------------------------------------
  17. // 返回: (none)
  18. //--------------------------------------------------------------------
  19. // 作者: lwl 日期: 2011年05月20日
  20. //--------------------------------------------------------------------
  21. // LONGJOE
  22. //--------------------------------------------------------------------
  23. // 修改历史:
  24. //
  25. //====================================================================
  26. long ins_mtrlid
  27. string ins_mtrlcuscode
  28. string ins_status
  29. string ins_pcode
  30. string ins_woodcode
  31. decimal ins_noallocqty
  32. decimal ins_tempqty
  33. dbauo_mtrlwaremx mx[]
  34. end variables
  35. forward prototypes
  36. public subroutine f_init (long arg_mtrlid, string arg_mtrlcuscode, string arg_status, string arg_pcode, string arg_woodcode)
  37. public subroutine f_clear ()
  38. public function dbauo_mtrlwaremx f_find (long arg_mtrlwareid)
  39. end prototypes
  40. public subroutine f_init (long arg_mtrlid, string arg_mtrlcuscode, string arg_status, string arg_pcode, string arg_woodcode);ins_mtrlid = arg_mtrlid
  41. ins_mtrlcuscode = arg_mtrlcuscode
  42. ins_status = arg_status
  43. ins_pcode = arg_pcode
  44. ins_woodcode = arg_woodcode
  45. ins_noallocqty = 0
  46. Long ll_scid, arr_scid[], ll_mtrlwareid, arr_mtrlwareid[]
  47. Decimal ld_noallocqty, arr_noallocqty[]
  48. Long ll_cnt = 0
  49. DECLARE cur1 CURSOR FOR
  50. SELECT u_mtrlware.scid,
  51. u_mtrlware.mtrlwareid,
  52. u_mtrlware.noallocqty
  53. FROM u_mtrlware INNER JOIN
  54. u_storage ON u_mtrlware.storageid = u_storage.storageid
  55. WHERE u_storage.storagetype = 1
  56. AND u_mtrlware.noallocqty > 0
  57. AND u_mtrlware.mtrlid = :ins_mtrlid
  58. AND u_mtrlware.mtrlcuscode = :ins_mtrlcuscode
  59. AND u_mtrlware.status = :ins_status
  60. AND u_mtrlware.pcode = :ins_pcode
  61. AND u_mtrlware.woodcode = :ins_woodcode
  62. Order By u_mtrlware.scid, u_mtrlware.mtrlwareid;
  63. OPEN cur1;
  64. FETCH cur1 Into :ll_scid, :ll_mtrlwareid, :ld_noallocqty;
  65. DO WHILE sqlca.SQLCode = 0
  66. ll_cnt++
  67. arr_scid[ll_cnt] = ll_scid
  68. arr_mtrlwareid[ll_cnt] = ll_mtrlwareid
  69. arr_noallocqty[ll_cnt] = ld_noallocqty
  70. ins_noallocqty += ld_noallocqty
  71. FETCH cur1 Into :ll_scid, :ll_mtrlwareid, :ld_noallocqty;
  72. LOOP
  73. CLOSE cur1;
  74. Long ll_i
  75. f_clear()
  76. FOR ll_i = 1 To ll_cnt
  77. mx[ll_i] = Create dbauo_mtrlwaremx
  78. mx[ll_i].f_init(This, arr_scid[ll_i], arr_mtrlwareid[ll_i], arr_noallocqty[ll_i])
  79. NEXT
  80. end subroutine
  81. public subroutine f_clear ();long ll_i
  82. for ll_i = 1 to upperbound(mx)
  83. destroy mx[ll_i]
  84. next
  85. dbauo_mtrlwaremx mx_empty[]
  86. mx = mx_empty
  87. end subroutine
  88. public function dbauo_mtrlwaremx f_find (long arg_mtrlwareid);dbauo_mtrlwaremx rslt
  89. Long ll_i
  90. SetNull(rslt)
  91. FOR ll_i = 1 To UpperBound(mx)
  92. IF mx[ll_i].ins_mtrlwareid = arg_mtrlwareid THEN
  93. rslt = mx[ll_i]
  94. EXIT
  95. END IF
  96. NEXT
  97. RETURN rslt
  98. end function
  99. on dbauo_mtrlware.create
  100. call super::create
  101. TriggerEvent( this, "constructor" )
  102. end on
  103. on dbauo_mtrlware.destroy
  104. TriggerEvent( this, "destructor" )
  105. call super::destroy
  106. end on
  107. event destructor;f_clear()
  108. end event