uo_orderrqmtrl.sru 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. $PBExportHeader$uo_orderrqmtrl.sru
  2. forward
  3. global type uo_orderrqmtrl from nonvisualobject
  4. end type
  5. end forward
  6. global type uo_orderrqmtrl from nonvisualobject
  7. end type
  8. global uo_orderrqmtrl uo_orderrqmtrl
  9. type variables
  10. transaction commit_transaction
  11. end variables
  12. forward prototypes
  13. public function integer uf_rqdate_changed (long arg_scid, long arg_orderid, long arg_mtrlid, long arg_wrkgrpid, string arg_status, string arg_woodcode, string arg_pcode, long arg_plantype, long arg_produce_wrkgrpid, datetime arg_rqdate, ref string arg_msg, boolean if_commit)
  14. end prototypes
  15. public function integer uf_rqdate_changed (long arg_scid, long arg_orderid, long arg_mtrlid, long arg_wrkgrpid, string arg_status, string arg_woodcode, string arg_pcode, long arg_plantype, long arg_produce_wrkgrpid, datetime arg_rqdate, ref string arg_msg, boolean if_commit);Int rslt = 1
  16. DateTime ld_org_date
  17. Decimal ld_rqqty
  18. SELECT rqdate, rqqty
  19. INTO :ld_org_date, :ld_rqqty
  20. FROM u_OrderRqMtrl
  21. WHERE scid = :arg_scid
  22. AND orderid = :arg_orderid
  23. AND mtrlid = :arg_mtrlid
  24. AND wrkgrpid = :arg_wrkgrpid
  25. AND status = :arg_status
  26. AND woodcode = :arg_woodcode
  27. AND pcode = :arg_pcode
  28. AND plantype = :arg_plantype
  29. AND produce_wrkGrpid = :arg_produce_wrkGrpid
  30. Using commit_transaction;
  31. IF commit_transaction.SQLCode <> 0 THEN
  32. rslt = 0
  33. arg_msg = '查询物料需求时间失败,' + commit_transaction.SQLErrText
  34. GOTO ext
  35. END IF
  36. IF ld_org_date = arg_rqdate THEN
  37. GOTO ext
  38. END IF
  39. //IF f_aps_mtrl_will_add(arg_scid,arg_mtrlid,arg_status,arg_woodcode,arg_pcode,ld_org_date,0 - ld_rqqty,2,arg_msg,mrp_sqlca,True) = 0 THEN
  40. // rslt = 0
  41. // GOTO ext
  42. //END IF
  43. //
  44. //IF f_aps_mtrl_will_add(arg_scid,arg_mtrlid,arg_status,arg_woodcode,arg_pcode,arg_rqdate,ld_rqqty,2,arg_msg,mrp_sqlca,True) = 0 THEN
  45. // rslt = 0
  46. // GOTO ext
  47. //END IF
  48. UPDATE u_OrderRqMtrl
  49. SET rqdate = :arg_rqdate
  50. WHERE scid = :arg_scid
  51. AND orderid = :arg_orderid
  52. AND mtrlid = :arg_mtrlid
  53. AND wrkgrpid = :arg_wrkgrpid
  54. AND status = :arg_status
  55. AND woodcode = :arg_woodcode
  56. AND pcode = :arg_pcode
  57. AND plantype = :arg_plantype
  58. AND produce_wrkGrpid = :arg_produce_wrkGrpid
  59. Using commit_transaction;
  60. IF commit_transaction.SQLCode <> 0 THEN
  61. rslt = 0
  62. arg_msg = '更新物料需求日期失败,' + commit_transaction.SQLErrText
  63. GOTO ext
  64. END IF
  65. GOTO ext
  66. ext:
  67. IF rslt = 1 And if_commit THEN
  68. COMMIT Using commit_transaction;
  69. ELSEIF rslt = 0 THEN
  70. ROLLBACK Using commit_transaction;
  71. END IF
  72. RETURN rslt
  73. end function
  74. on uo_orderrqmtrl.create
  75. call super::create
  76. TriggerEvent( this, "constructor" )
  77. end on
  78. on uo_orderrqmtrl.destroy
  79. TriggerEvent( this, "destructor" )
  80. call super::destroy
  81. end on