uo_mtrl_configure_ch.sru 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. $PBExportHeader$uo_mtrl_configure_ch.sru
  2. forward
  3. global type uo_mtrl_configure_ch from userobject
  4. end type
  5. type cb_6 from uo_imflatbutton within uo_mtrl_configure_ch
  6. end type
  7. type cb_5 from uo_imflatbutton within uo_mtrl_configure_ch
  8. end type
  9. type cb_4 from uo_imflatbutton within uo_mtrl_configure_ch
  10. end type
  11. type sle_1 from singlelineedit within uo_mtrl_configure_ch
  12. end type
  13. type cb_3 from uo_imflatbutton within uo_mtrl_configure_ch
  14. end type
  15. type cb_2 from uo_imflatbutton within uo_mtrl_configure_ch
  16. end type
  17. type cb_1 from uo_imflatbutton within uo_mtrl_configure_ch
  18. end type
  19. type dw_1 from datawindow within uo_mtrl_configure_ch
  20. end type
  21. type tv_1 from treeview within uo_mtrl_configure_ch
  22. end type
  23. end forward
  24. global type uo_mtrl_configure_ch from userobject
  25. integer width = 1806
  26. integer height = 1164
  27. long backcolor = 134217739
  28. string text = "none"
  29. long tabtextcolor = 33554432
  30. long picturemaskcolor = 536870912
  31. cb_6 cb_6
  32. cb_5 cb_5
  33. cb_4 cb_4
  34. sle_1 sle_1
  35. cb_3 cb_3
  36. cb_2 cb_2
  37. cb_1 cb_1
  38. dw_1 dw_1
  39. tv_1 tv_1
  40. end type
  41. global uo_mtrl_configure_ch uo_mtrl_configure_ch
  42. type variables
  43. long ll_mtrlid , ll_cfgid
  44. int li_cfgtype , li_sauditflag
  45. string ls_cfgname , ls_ename , ls_dscrp
  46. string ls_mtrlcode , ls_mtrlname
  47. string cfgname[]
  48. string ls_cfg_str = ''
  49. TreeViewItem tvi_tmp
  50. long deep=0
  51. long oki=0 ,li=0
  52. long select_tree=0,ls_ha=0,ls_ha1=0
  53. end variables
  54. forward prototypes
  55. public function integer wf_maketree ()
  56. public function integer wf_automtrlcfg_str ()
  57. end prototypes
  58. public function integer wf_maketree ();//====================================================================
  59. // Function: wf_maketree()
  60. //--------------------------------------------------------------------
  61. // Description:生成配置树
  62. //--------------------------------------------------------------------
  63. // Arguments:(None)
  64. //--------------------------------------------------------------------
  65. // Returns: integer
  66. //--------------------------------------------------------------------
  67. // Author: wjc Date: 2006.08.31
  68. //--------------------------------------------------------------------
  69. // Modify History:
  70. //
  71. //====================================================================
  72. Long hand
  73. deep = 1
  74. Long tvi_hdl = 0
  75. Int i
  76. String ls_mtrlpz
  77. DO UNTIL tv_1.FindItem(RootTreeItem!, 0) = -1
  78. tv_1.DeleteItem(tvi_hdl)
  79. LOOP
  80. SELECT mtrlcode,mtrlname INTO :ls_mtrlcode,:ls_mtrlname
  81. FROM u_mtrldef
  82. Where u_mtrldef.mtrlid = :ll_mtrlid;
  83. hand = tv_1.InsertItemLast(0,'['+ls_mtrlcode+']'+ls_mtrlname,1)
  84. DECLARE cur_tree CURSOR FOR
  85. SELECT name FROM u_mtrl_configure
  86. WHERE mtrlid = :ll_mtrlid
  87. AND type = 1
  88. ANd ifzj = 1;
  89. OPEN cur_tree;
  90. FETCH cur_tree INTO :ls_mtrlpz;
  91. DO WHILE sqlca.SQLCode = 0
  92. tv_1.InsertItemLast(hand, ls_mtrlpz, 1)
  93. FETCH cur_tree INTO :ls_mtrlpz;
  94. LOOP
  95. CLOSE cur_tree;
  96. tv_1.ExpandItem(hand)
  97. RETURN 0
  98. end function
  99. public function integer wf_automtrlcfg_str ();//====================================================================
  100. // Function: wf_automtrlcfg_str()
  101. //--------------------------------------------------------------------
  102. // Description:合并配置串
  103. //--------------------------------------------------------------------
  104. // Arguments:(None)
  105. //--------------------------------------------------------------------
  106. // Returns: integer
  107. //--------------------------------------------------------------------
  108. // Author: wjc Date: 2006.08.31
  109. //--------------------------------------------------------------------
  110. // Modify History:
  111. //
  112. //====================================================================
  113. Int rslt = 1
  114. Long ll_row , i
  115. ll_row = dw_1.RowCount( )
  116. IF ll_row <= 0 THEN
  117. rslt = 0
  118. GOTO ext
  119. END IF
  120. dw_1.AcceptText( )
  121. ls_cfg_str = ''
  122. FOR i = 1 TO ll_row - 1
  123. IF dw_1.Object.qty[i] <> 0 THEN
  124. // IF dw_1.Object.qty[i] = 1 THEN
  125. ls_cfg_str = ls_cfg_str + dw_1.Object.Name[i]+"+"
  126. // ELSE
  127. // ls_cfg_str = ls_cfg_str + dw_1.Object.Name[i]+'*'+String(dw_1.Object.qty[i],"##")+"+"
  128. // END IF
  129. END IF
  130. NEXT
  131. IF dw_1.Object.qty[ll_row] <> 0 THEN
  132. // IF dw_1.Object.qty[ll_row] = 1 THEN
  133. ls_cfg_str = ls_cfg_str + dw_1.Object.Name[ll_row]
  134. // ELSE
  135. // ls_cfg_str = ls_cfg_str + dw_1.Object.Name[ll_row]+'*'+String(dw_1.Object.qty[ll_row],"##")
  136. // END IF
  137. END IF
  138. sle_1.Text = ls_cfg_str
  139. ext:
  140. RETURN rslt
  141. end function
  142. on uo_mtrl_configure_ch.create
  143. this.cb_6=create cb_6
  144. this.cb_5=create cb_5
  145. this.cb_4=create cb_4
  146. this.sle_1=create sle_1
  147. this.cb_3=create cb_3
  148. this.cb_2=create cb_2
  149. this.cb_1=create cb_1
  150. this.dw_1=create dw_1
  151. this.tv_1=create tv_1
  152. this.Control[]={this.cb_6,&
  153. this.cb_5,&
  154. this.cb_4,&
  155. this.sle_1,&
  156. this.cb_3,&
  157. this.cb_2,&
  158. this.cb_1,&
  159. this.dw_1,&
  160. this.tv_1}
  161. end on
  162. on uo_mtrl_configure_ch.destroy
  163. destroy(this.cb_6)
  164. destroy(this.cb_5)
  165. destroy(this.cb_4)
  166. destroy(this.sle_1)
  167. destroy(this.cb_3)
  168. destroy(this.cb_2)
  169. destroy(this.cb_1)
  170. destroy(this.dw_1)
  171. destroy(this.tv_1)
  172. end on
  173. event constructor;ll_mtrlid = Message.DoubleParm
  174. dw_1.SetTransObject( sqlca )
  175. wf_maketree()
  176. end event
  177. type cb_6 from uo_imflatbutton within uo_mtrl_configure_ch
  178. integer x = 928
  179. integer y = 1036
  180. integer taborder = 60
  181. string text = "取消"
  182. end type
  183. event clicked;call super::clicked;CloseWithReturn(w_mtrl_configure_ch,'')
  184. end event
  185. type cb_5 from uo_imflatbutton within uo_mtrl_configure_ch
  186. integer x = 425
  187. integer y = 1032
  188. integer taborder = 60
  189. end type
  190. event clicked;call super::clicked;String arg_msg = ''
  191. Int i
  192. uo_func_mtrlcfg uo_func_mtrl_config
  193. uo_func_mtrl_config = CREATE uo_func_mtrlcfg
  194. FOR i = 1 TO dw_1.RowCount()
  195. IF dw_1.Object.qty[i] <= 0 THEN
  196. MessageBox('系统提示','构成数量必须大于0')
  197. RETURN
  198. END IF
  199. NEXT
  200. wf_automtrlcfg_str()
  201. IF uo_func_mtrl_config.check_mtrlcfg_str(ll_mtrlid,ls_cfg_str,0,arg_msg) = 0 THEN
  202. MessageBox("系统提示","检查配置名称失败!>>"+arg_msg)
  203. RETURN
  204. END IF
  205. DESTROY uo_func_mtrl_config
  206. CloseWithReturn(w_mtrl_configure_ch,ls_cfg_str)
  207. end event
  208. type cb_4 from uo_imflatbutton within uo_mtrl_configure_ch
  209. integer x = 754
  210. integer y = 268
  211. integer width = 137
  212. integer taborder = 50
  213. string text = ">>"
  214. end type
  215. event clicked;call super::clicked;String ls_mtrlpz
  216. Long ll_row
  217. dw_1.Reset( )
  218. DECLARE cur_mtrlcfg CURSOR FOR
  219. SELECT name FROM u_mtrl_configure
  220. WHERE mtrlid = :ll_mtrlid
  221. AND type = 1
  222. AND ifzj = 1;
  223. OPEN cur_mtrlcfg;
  224. FETCH cur_mtrlcfg INTO :ls_mtrlpz;
  225. DO WHILE sqlca.SQLCode = 0
  226. ll_row = dw_1.InsertRow(0)
  227. dw_1.Object.Name[ll_row] = ls_mtrlpz
  228. dw_1.Object.qty[ll_row] = 1
  229. FETCH cur_mtrlcfg INTO :ls_mtrlpz;
  230. LOOP
  231. CLOSE cur_mtrlcfg;
  232. wf_automtrlcfg_str()
  233. end event
  234. type sle_1 from singlelineedit within uo_mtrl_configure_ch
  235. integer y = 916
  236. integer width = 1783
  237. integer height = 96
  238. integer taborder = 50
  239. integer textsize = -9
  240. integer weight = 400
  241. fontcharset fontcharset = gb2312charset!
  242. fontpitch fontpitch = variable!
  243. string facename = "宋体"
  244. long textcolor = 33554432
  245. borderstyle borderstyle = stylelowered!
  246. end type
  247. type cb_3 from uo_imflatbutton within uo_mtrl_configure_ch
  248. integer x = 754
  249. integer y = 684
  250. integer width = 137
  251. integer taborder = 40
  252. string text = "<<"
  253. end type
  254. event clicked;call super::clicked;dw_1.reset( )
  255. sle_1.text = ''
  256. end event
  257. type cb_2 from uo_imflatbutton within uo_mtrl_configure_ch
  258. integer x = 754
  259. integer y = 476
  260. integer width = 137
  261. integer taborder = 30
  262. string text = "<"
  263. end type
  264. event clicked;call super::clicked;String ls_name
  265. Long ll_row
  266. ll_row = dw_1.GetRow( )
  267. IF ll_row <= 0 THEN RETURN
  268. ls_name = dw_1.Object.Name[dw_1.GetRow()]
  269. dw_1.DeleteRow(dw_1.GetRow())
  270. dw_1.AcceptText( )
  271. wf_automtrlcfg_str()
  272. end event
  273. type cb_1 from uo_imflatbutton within uo_mtrl_configure_ch
  274. integer x = 754
  275. integer y = 60
  276. integer width = 137
  277. integer taborder = 30
  278. string text = ">"
  279. end type
  280. event clicked;call super::clicked;Long ll_handle , ll_row
  281. Treeviewitem ltvi_tmp
  282. Int rslt
  283. ll_handle = tv_1.FindItem(CurrentTreeItem! , 0)
  284. IF ll_handle = 1 THEN RETURN
  285. rslt = tv_1.GetItem(ll_handle, ltvi_tmp)
  286. IF rslt = 1 THEN
  287. ll_row = dw_1.InsertRow(0)
  288. dw_1.Object.Name[ll_row] = ltvi_tmp.Label
  289. dw_1.Object.qty[ll_row] = 1
  290. END IF
  291. dw_1.AcceptText( )
  292. wf_automtrlcfg_str()
  293. end event
  294. type dw_1 from datawindow within uo_mtrl_configure_ch
  295. integer x = 914
  296. integer width = 869
  297. integer height = 896
  298. integer taborder = 20
  299. string dataobject = "dw_mtrl_configure_ch"
  300. boolean vscrollbar = true
  301. boolean livescroll = true
  302. borderstyle borderstyle = stylelowered!
  303. end type
  304. event clicked;IF row >= 0 THEN
  305. THIS.SelectRow(0,FALSE)
  306. THIS.SelectRow(row,TRUE)
  307. THIS.SetRow(row)
  308. THIS.ScrollToRow(row)
  309. END IF
  310. end event
  311. event doubleclicked;cb_2.triggerevent(clicked!)
  312. end event
  313. event dragdrop;String ls_name
  314. Long ll_row
  315. IF Source.TypeOf() = TreeView! THEN
  316. ls_name = tvi_tmp.Label
  317. ll_row = dw_1.InsertRow(0)
  318. dw_1.Object.Name[ll_row] = ls_name
  319. dw_1.Object.qty[ll_row] = 1
  320. wf_automtrlcfg_str()
  321. END IF
  322. end event
  323. event rowfocuschanged;IF currentrow > 0 THEN
  324. THIS.SetRow(currentrow)
  325. THIS.ScrollToRow(currentrow)
  326. THIS.SelectRow(0,FALSE)
  327. THIS.SelectRow(currentrow,TRUE)
  328. wf_automtrlcfg_str()
  329. END IF
  330. end event
  331. event itemchanged;if row > 0 then
  332. if Dec(data) <= 0 THEN
  333. Messagebox('系统提示','构成数量必须大于0')
  334. return
  335. end if
  336. end if
  337. end event
  338. type tv_1 from treeview within uo_mtrl_configure_ch
  339. integer width = 727
  340. integer height = 904
  341. integer taborder = 10
  342. integer textsize = -9
  343. integer weight = 400
  344. fontcharset fontcharset = gb2312charset!
  345. fontpitch fontpitch = variable!
  346. string facename = "宋体"
  347. long textcolor = 33554432
  348. borderstyle borderstyle = stylelowered!
  349. boolean disabledragdrop = false
  350. boolean trackselect = true
  351. string picturename[] = {"Custom030!"}
  352. long picturemaskcolor = 536870912
  353. long statepicturemaskcolor = 536870912
  354. end type
  355. event begindrag;IF Handle = 1 THEN RETURN
  356. THIS.Drag(Begin!)
  357. THIS.GetItem(Handle,tvi_tmp)
  358. end event
  359. event doubleclicked;cb_1.TriggerEvent(Clicked!)
  360. end event