w_mtrl_storage.srw 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. $PBExportHeader$w_mtrl_storage.srw
  2. forward
  3. global type w_mtrl_storage from w_publ_base
  4. end type
  5. type dw_1 from u_dw_rbtnfilter within w_mtrl_storage
  6. end type
  7. end forward
  8. global type w_mtrl_storage from w_publ_base
  9. integer width = 1787
  10. integer height = 1516
  11. string title = "物料仓库设定"
  12. boolean minbox = false
  13. windowtype windowtype = response!
  14. dw_1 dw_1
  15. end type
  16. global w_mtrl_storage w_mtrl_storage
  17. type variables
  18. long cur_mtrlid
  19. end variables
  20. forward prototypes
  21. public subroutine readinfo ()
  22. public function integer whiteinfo (ref string arg_msg)
  23. public function integer wf_find_nullstorage (ref string arg_msg)
  24. end prototypes
  25. public subroutine readinfo ();long ll_storageid
  26. long ll_dft
  27. int ls_i=1,ls_rowcount
  28. ls_rowcount=dw_1.rowcount()
  29. DECLARE cur_mtrl CURSOR FOR
  30. select storageid,dft
  31. from u_mtrl_storage
  32. where mtrlid=:cur_mtrlid
  33. order by storageid;
  34. open cur_mtrl;
  35. FETCH cur_mtrl INTO :ll_storageid,:ll_dft;
  36. do while sqlca.sqlcode=0
  37. for ls_i=1 to ls_rowcount
  38. if (ll_storageid=dw_1.object.storageid[ls_i]) then
  39. dw_1.object.checkbox[ls_i]=1
  40. dw_1.object.dft[ls_i]=ll_dft
  41. exit
  42. end if
  43. next
  44. FETCH cur_mtrl INTO :ll_storageid,:ll_dft;
  45. loop
  46. close cur_mtrl;
  47. dw_1.accepttext()
  48. end subroutine
  49. public function integer whiteinfo (ref string arg_msg);long ll_storageid[],ll_dft[]
  50. int ls_i,ls_rowcount,count
  51. int rslt=1
  52. uo_mtrldef uo_mtrl
  53. uo_mtrl = create uo_mtrldef
  54. uo_mtrl.commit_transaction = sqlca
  55. dw_1.accepttext()
  56. ls_rowcount=dw_1.rowcount()
  57. count = 0
  58. for ls_i=1 to ls_rowcount
  59. if dw_1.object.checkbox[ls_i]=1 then
  60. count++
  61. ll_storageid[count]=dw_1.object.storageid[ls_i]
  62. ll_dft[count]=dw_1.object.dft[ls_i]
  63. end if
  64. next
  65. if uo_mtrl.p_insert_storage(cur_mtrlid, ll_storageid,ll_dft,true, arg_msg) = 0 then
  66. rslt = 0
  67. goto ext
  68. end if
  69. destroy uo_mtrl
  70. ext:
  71. return rslt
  72. end function
  73. public function integer wf_find_nullstorage (ref string arg_msg);int ls_i,ls_rowcount,cnt
  74. int rslt=1
  75. dw_1.accepttext()
  76. ls_rowcount=dw_1.rowcount()
  77. ls_i=1
  78. do while (ls_i<=ls_rowcount)
  79. if (dw_1.object.checkbox[ls_i]=1) then
  80. exit
  81. end if
  82. ls_i++
  83. loop
  84. if ls_i>ls_rowcount then
  85. rslt=0
  86. arg_msg="请选择仓库"
  87. goto ext
  88. end if
  89. for ls_i=1 to ls_rowcount
  90. if dw_1.object.dft[ls_i]= 1 then
  91. cnt ++
  92. end if
  93. next
  94. if cnt > 1 then
  95. rslt=0
  96. arg_msg="默认反扣仓库不能选择多个"
  97. goto ext
  98. end if
  99. ext:
  100. return rslt
  101. end function
  102. on w_mtrl_storage.create
  103. int iCurrent
  104. call super::create
  105. this.dw_1=create dw_1
  106. iCurrent=UpperBound(this.Control)
  107. this.Control[iCurrent+1]=this.dw_1
  108. end on
  109. on w_mtrl_storage.destroy
  110. call super::destroy
  111. destroy(this.dw_1)
  112. end on
  113. event open;call super::open;dw_1.settransobject (sqlca)
  114. dw_1.retrieve()
  115. cur_mtrlid=message.DoubleParm
  116. int ls_mtrlcount=0
  117. select count(*)
  118. into :ls_mtrlcount
  119. from u_mtrldef
  120. where mtrlid=:cur_mtrlid;
  121. if sqlca.sqlcode<>0 or ls_mtrlcount<=0 then
  122. messagebox('提示','错误的物料ID', Information!, OK! )
  123. close(this)
  124. end if
  125. readinfo()
  126. end event
  127. type cb_func from w_publ_base`cb_func within w_mtrl_storage
  128. integer x = 1106
  129. integer y = 1316
  130. integer width = 311
  131. integer height = 96
  132. string text = "确定"
  133. string normalpicname = "ok.bmp"
  134. toolbaralignment pic_align = alignatleft!
  135. boolean border = true
  136. end type
  137. event cb_func::clicked;call super::clicked;string ls_msg=''
  138. if wf_find_nullstorage(ls_msg)=0 then
  139. messagebox('提示',ls_msg , Information!, OK! )
  140. return
  141. end if
  142. if whiteinfo(ls_msg)=0 then
  143. messagebox('提示',ls_msg , Information!, OK! )
  144. rollback;
  145. return
  146. else
  147. commit;
  148. messagebox('提示','保存成功!', Information!, OK! )
  149. close(parent)
  150. end if
  151. end event
  152. type cb_exit from w_publ_base`cb_exit within w_mtrl_storage
  153. integer x = 1426
  154. integer y = 1316
  155. end type
  156. type dw_1 from u_dw_rbtnfilter within w_mtrl_storage
  157. integer width = 1765
  158. integer height = 1288
  159. integer taborder = 20
  160. boolean bringtotop = true
  161. string dataobject = "dw_choose_storage"
  162. boolean vscrollbar = true
  163. end type