w_mtrldef_ch_hq.srw 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. $PBExportHeader$w_mtrldef_ch_hq.srw
  2. forward
  3. global type w_mtrldef_ch_hq from w_pageretr_ch
  4. end type
  5. type cbx_mlselect from checkbox within w_mtrldef_ch_hq
  6. end type
  7. type tv_1 from uo_tv_mtrltype within w_mtrldef_ch_hq
  8. end type
  9. type ddlb_mtrlprp from uo_ddlb_mtrlorigin within w_mtrldef_ch_hq
  10. end type
  11. type cbx_all from checkbox within w_mtrldef_ch_hq
  12. end type
  13. end forward
  14. global type w_mtrldef_ch_hq from w_pageretr_ch
  15. integer width = 3616
  16. integer height = 2304
  17. string title = "主行情材料选择"
  18. event retrieve_mx ( )
  19. cbx_mlselect cbx_mlselect
  20. tv_1 tv_1
  21. ddlb_mtrlprp ddlb_mtrlprp
  22. cbx_all cbx_all
  23. end type
  24. global w_mtrldef_ch_hq w_mtrldef_ch_hq
  25. type variables
  26. s_mtrldef_array INS_RT_STRU
  27. Boolean if_changeselect = TRUE
  28. Int if_mlselect = 0
  29. String ls_handtype = ''
  30. Int cur_mtrlorigin = 0 //当前显示物料来源
  31. Long cur_scid
  32. boolean if_select_all=false
  33. //datawindow dw_1,dw_2,dw_3
  34. end variables
  35. forward prototypes
  36. public subroutine wf_resize ()
  37. public subroutine wf_resize_2 ()
  38. end prototypes
  39. public subroutine wf_resize ();Long w_width,w_height
  40. w_width = 3600
  41. w_height = 2300
  42. dw_pageretr.Width = THIS.Width - tv_1.Width - 50
  43. end subroutine
  44. public subroutine wf_resize_2 ();Long w_width,w_height
  45. w_width = 3600
  46. w_height = 2300
  47. dw_pageretr.height = tv_1.height
  48. end subroutine
  49. on w_mtrldef_ch_hq.create
  50. int iCurrent
  51. call super::create
  52. this.cbx_mlselect=create cbx_mlselect
  53. this.tv_1=create tv_1
  54. this.ddlb_mtrlprp=create ddlb_mtrlprp
  55. this.cbx_all=create cbx_all
  56. iCurrent=UpperBound(this.Control)
  57. this.Control[iCurrent+1]=this.cbx_mlselect
  58. this.Control[iCurrent+2]=this.tv_1
  59. this.Control[iCurrent+3]=this.ddlb_mtrlprp
  60. this.Control[iCurrent+4]=this.cbx_all
  61. end on
  62. on w_mtrldef_ch_hq.destroy
  63. call super::destroy
  64. destroy(this.cbx_mlselect)
  65. destroy(this.tv_1)
  66. destroy(this.ddlb_mtrlprp)
  67. destroy(this.cbx_all)
  68. end on
  69. event ue_before_open;call super::ue_before_open;
  70. if_ue_retr=true
  71. if_ue_sort=true
  72. end event
  73. event close;call super::close;cLOSEWITHRETURN(THIS,INS_RT_STRU)
  74. //<INS_RT_STRU> 窗体级子定义结构变量,用于返回
  75. end event
  76. event open;THIS.TriggerEvent('ue_before_open')
  77. wf_movetocenter()
  78. OLD_TITLE = THIS.Title
  79. s_tran = Message.PowerObjectParm
  80. IF NOT IsNull(s_tran) THEN
  81. retrieve_all = s_tran.if_retrieve_all
  82. mode = s_tran.work_mode
  83. arg_pkid = s_tran.arg_pkid
  84. arg_string_code = s_tran.arg_string_code
  85. cur_scid = s_tran.c_long
  86. if_select_all = s_tran.if_select_all
  87. END IF
  88. dw_pageretr.RBUTTON_FILTER_USE = TRUE //右键查询功能开关
  89. dw_pageretr.titleclick_sort_use = TRUE //单击标题排序功能开关
  90. dw_pageretr.SetTransObject (sqlca)
  91. pkcolumndbtname = wf_get_pkcolumndbtname(dw_pageretr) //取第一列为关键字
  92. ori_oldselect = dw_pageretr.Describe("DataWindow.Table.Select")
  93. ls_newselect = ori_oldselect
  94. ds_curquery = CREATE DATASTORE
  95. ds_curquery.DataObject = 'd_extr_find'
  96. ds_curquery.SetTransObject (sqlca)
  97. wf_editindex_lockf()
  98. IF s_tran.b_long = 0 THEN
  99. ddlb_mtrlprp.Text = "自制产品[0]"
  100. cur_mtrlorigin = 0
  101. ELSEIF s_tran.b_long = 2 THEN
  102. ddlb_mtrlprp.Text = "采购[2]"
  103. cur_mtrlorigin = 2
  104. ELSEIF s_tran.b_long = 3 THEN
  105. ddlb_mtrlprp.Text = "外协部件[3]"
  106. cur_mtrlorigin = 3
  107. ELSEIF s_tran.b_long = -1 THEN
  108. ddlb_mtrlprp.Text = "全部[-1]"
  109. cur_mtrlorigin = -1
  110. END IF
  111. IF NOT retrieve_all AND Trim(arg_string_code) <> '' THEN
  112. sle_usual_query.Text = Trim(arg_string_code)
  113. THIS.TriggerEvent("ue_usual_query_RETR") //修改ls_newselect,retrieve
  114. ELSE
  115. wf_retrieveuc(dw_pageretr,ls_newselect,1)
  116. THIS.TriggerEvent('RETRIEVE_pageretr')
  117. END IF
  118. IF retrieve_all AND Trim(arg_string_code) <> '' THEN
  119. THIS.TriggerEvent("ue_usual_query_filt")
  120. END IF
  121. IF if_select_all THEN
  122. cbx_mlselect.Enabled = TRUE
  123. ELSE
  124. cbx_mlselect.Enabled = FALSE
  125. cbx_all.Enabled = FALSE
  126. cbx_mlselect.Checked = FALSE
  127. if_mlselect = 0
  128. END IF
  129. INS_RT_STRU.mtrlid[1] = 0
  130. end event
  131. event retrieve_pageretr;Boolean cb_nextpage_enabled,cb_retrieveall_enabled
  132. Boolean cb_func_enabled,cb_retrieve_enabled
  133. cb_nextpage_enabled = cb_nextpage.Enabled
  134. cb_retrieveall_enabled = cb_retrieveall.Enabled
  135. cb_func_enabled = cb_func.Enabled
  136. cb_nextpage.Enabled = FALSE
  137. cb_retrieveall.Enabled = FALSE
  138. cb_func.Enabled = FALSE
  139. SetPointer(HourGlass!)
  140. dw_pageretr.Retrieve(ls_handtype,cur_mtrlorigin)
  141. IF dw_pageretr.RowCount() > 0 AND dw_pageretr.GetRow() = 0 THEN dw_pageretr.SetRow(1)
  142. SetPointer(Arrow!)
  143. cb_nextpage.Enabled = cb_nextpage_enabled
  144. cb_retrieveall.Enabled = cb_retrieveall_enabled
  145. cb_func.Enabled = cb_func_enabled
  146. end event
  147. event ue_usual_query_filt;call super::ue_usual_query_filt;string obj_expr=''
  148. if trim(sle_usual_query.text)<>'' then
  149. IF POS(trim(sle_usual_query.text),'%')=0 THEN
  150. obj_expr=obj_expr+'( u_mtrldef_mtrlcode LIKE "%'+trim(sle_usual_query.text)+'%" )'
  151. obj_expr=obj_expr+' or (u_mtrldef_mtrlname LIKE "%'+trim(sle_usual_query.text)+'%" )'
  152. ELSE
  153. obj_expr=obj_expr+'( u_mtrldef_mtrlcode LIKE "'+trim(sle_usual_query.text)+'" )'
  154. obj_expr=obj_expr+' or (u_mtrldef_mtrlname LIKE "'+trim(sle_usual_query.text)+'" )'
  155. END IF
  156. end if
  157. dw_pageretr.setfilter(obj_expr)
  158. dw_pageretr.SetRedraw(False)
  159. dw_pageretr.filter()
  160. if dw_pageretr.rowcount()>=1 then
  161. dw_pageretr.selectrow(0,false)
  162. dw_pageretr.selectrow(1,true )
  163. end if
  164. dw_pageretr.SetRedraw(TRUE )
  165. end event
  166. event ue_usual_query_retr;call super::ue_usual_query_retr;string ls_querystrpart=''
  167. ls_newselect=lower(ori_oldselect)
  168. if trim(sle_usual_query.text)<>'' then
  169. if pos(trim(sle_usual_query.text),'%')=0 then
  170. ls_querystrpart=ls_querystrpart + "( u_mtrldef.mtrlcode like '%"+trim(sle_usual_query.text)+"%'"
  171. ls_querystrpart=ls_querystrpart + " or u_mtrldef.mtrlname like '%"+trim(sle_usual_query.text)+"%')"
  172. else
  173. ls_querystrpart=ls_querystrpart + "( u_mtrldef.mtrlcode like '"+trim(sle_usual_query.text)+"'"
  174. ls_querystrpart=ls_querystrpart + " or u_mtrldef.mtrlname like '"+trim(sle_usual_query.text)+"')"
  175. end if
  176. if Pos(ls_newselect," where ") <> 0 then
  177. ls_newselect=ls_newselect+" AND ("+ls_querystrpart+')'
  178. else
  179. ls_newselect=ls_newselect+" where ("+ls_querystrpart+')'
  180. end if
  181. end if
  182. wf_retrieveuc(dw_pageretr,ls_newselect,1)
  183. this.triggerevent('retrieve_pageretr')
  184. end event
  185. type cb_func from w_pageretr_ch`cb_func within w_mtrldef_ch_hq
  186. end type
  187. type cb_exit from w_pageretr_ch`cb_exit within w_mtrldef_ch_hq
  188. end type
  189. type sle_usual_query from w_pageretr_ch`sle_usual_query within w_mtrldef_ch_hq
  190. integer x = 887
  191. end type
  192. type cb_retrieveall from w_pageretr_ch`cb_retrieveall within w_mtrldef_ch_hq
  193. end type
  194. type em_pagerowno from w_pageretr_ch`em_pagerowno within w_mtrldef_ch_hq
  195. end type
  196. type dw_pageretr from w_pageretr_ch`dw_pageretr within w_mtrldef_ch_hq
  197. integer x = 997
  198. integer width = 2597
  199. integer height = 1924
  200. string dataobject = "dw_mtrldef_ch_hq"
  201. end type
  202. event dw_pageretr::clicked;if row>0 then
  203. this.setrow(row)
  204. if if_mlselect=1 then
  205. if if_changeselect then
  206. this.selectrow(row,not this.IsSelected(row))
  207. else
  208. if_changeselect=true
  209. end if
  210. else
  211. this.selectrow(0,false)
  212. this.selectrow(row,true)
  213. end if
  214. end if
  215. end event
  216. event dw_pageretr::doubleclicked;cb_choice.TRIGGEREVENT(CLICKED!)
  217. end event
  218. event dw_pageretr::rowfocuschanged;if if_mlselect=1 then
  219. if currentrow <=0 then return
  220. if keydown(keycontrol!) then
  221. if this.isselected(currentrow) then
  222. this.selectrow(currentrow,false)
  223. if_changeselect=false
  224. else
  225. if_changeselect=true
  226. end if
  227. else
  228. if not this.isselected(currentrow) then
  229. this.selectrow(currentrow,true)
  230. if_changeselect=false
  231. else
  232. if_changeselect=true
  233. end if
  234. end if
  235. else
  236. if currentrow <=0 then return
  237. this.selectrow(0,false)
  238. this.selectrow(currentrow,true)
  239. end if
  240. end event
  241. event dw_pageretr::dwnkey;call super::dwnkey;if keydown(keyenter!) then return 1
  242. end event
  243. type st_1 from w_pageretr_ch`st_1 within w_mtrldef_ch_hq
  244. integer x = 539
  245. integer width = 343
  246. string text = "编码/名称含:"
  247. end type
  248. type cb_nextpage from w_pageretr_ch`cb_nextpage within w_mtrldef_ch_hq
  249. string normalpicname = ""
  250. end type
  251. type cb_choice from w_pageretr_ch`cb_choice within w_mtrldef_ch_hq
  252. integer x = 302
  253. integer taborder = 120
  254. end type
  255. event cb_choice::clicked;call super::clicked;Long ROW,ls_i = 0,chC = 0
  256. ROW = dw_pageretr.GetRow()
  257. IF ROW <= 0 THEN
  258. MessageBox('系统提示','请先选择目标行!',StopSign!)
  259. RETURN
  260. END IF
  261. FOR ls_i = 1 TO dw_pageretr.RowCount()
  262. IF dw_pageretr.IsSelected(ls_i) THEN
  263. chC++
  264. INS_RT_STRU.mtrlid[chC] = dw_pageretr.Object.u_mtrldef_mtrlid[ls_i]
  265. INS_RT_STRU.mtrlcode[chC] = dw_pageretr.Object.u_mtrldef_mtrlcode[ls_i]
  266. INS_RT_STRU.mtrlname[chC] = dw_pageretr.Object.u_mtrldef_mtrlname[ls_i]
  267. INS_RT_STRU.mtrlmode[chC] = dw_pageretr.Object.u_mtrldef_mtrlmode[ls_i]
  268. INS_RT_STRU.unit[chC] = dw_pageretr.Object.u_mtrldef_unit[ls_i]
  269. INS_RT_STRU.mtrltype[chC] = dw_pageretr.Object.u_mtrldef_mtrltype[ls_i]
  270. INS_RT_STRU.planprice[chC] = dw_pageretr.Object.u_mtrldef_planprice[ls_i]
  271. INS_RT_STRU.mtrlsectype[chC] = dw_pageretr.Object.u_mtrldef_mtrlsectype[ls_i]
  272. INS_RT_STRU.zxmtrlmode[chC] = dw_pageretr.Object.u_mtrldef_zxmtrlmode[ls_i]
  273. END IF
  274. NEXT
  275. IF chC = 0 THEN
  276. MessageBox('系统提示','请至少选择一个目标行!',StopSign!)
  277. RETURN
  278. END IF
  279. Close(PARENT)
  280. end event
  281. type cb_refresh from w_pageretr_ch`cb_refresh within w_mtrldef_ch_hq
  282. end type
  283. type cb_help from w_pageretr_ch`cb_help within w_mtrldef_ch_hq
  284. integer x = 453
  285. end type
  286. type ln_bar from w_pageretr_ch`ln_bar within w_mtrldef_ch_hq
  287. end type
  288. type ln_bar2 from w_pageretr_ch`ln_bar2 within w_mtrldef_ch_hq
  289. end type
  290. type r_bar from w_pageretr_ch`r_bar within w_mtrldef_ch_hq
  291. integer x = 2670
  292. end type
  293. type ln_1 from w_pageretr_ch`ln_1 within w_mtrldef_ch_hq
  294. end type
  295. type ln_2 from w_pageretr_ch`ln_2 within w_mtrldef_ch_hq
  296. end type
  297. type cbx_mlselect from checkbox within w_mtrldef_ch_hq
  298. integer x = 1454
  299. integer y = 196
  300. integer width = 256
  301. integer height = 60
  302. boolean bringtotop = true
  303. integer textsize = -9
  304. integer weight = 400
  305. fontcharset fontcharset = gb2312charset!
  306. fontpitch fontpitch = variable!
  307. string facename = "宋体"
  308. long backcolor = 134217739
  309. string text = "多选"
  310. end type
  311. event clicked;IF THIS.Checked THEN
  312. if_mlselect = 1
  313. cbx_all.Enabled = TRUE
  314. ELSE
  315. if_mlselect = 0
  316. cbx_all.Enabled = FALSE
  317. cbx_all.Checked = FALSE
  318. Long li
  319. FOR li = 1 TO dw_pageretr.RowCount()
  320. dw_pageretr.SelectRow(li,FALSE)
  321. NEXT
  322. END IF
  323. SetProfileString (sys_inifilename,dw_pageretr.DataObject, "if_mlselect", String(if_mlselect))
  324. end event
  325. event constructor;if_mlselect = Integer(ProfileString (sys_inifilename,dw_pageretr.DataObject, "if_mlselect", '0'))
  326. IF if_mlselect = 0 THEN
  327. THIS.Checked = FALSE
  328. cbx_all.Enabled = FALSE
  329. ELSE
  330. THIS.Checked = TRUE
  331. cbx_all.Enabled = TRUE
  332. END IF
  333. end event
  334. type tv_1 from uo_tv_mtrltype within w_mtrldef_ch_hq
  335. integer y = 288
  336. integer width = 983
  337. integer height = 1924
  338. integer taborder = 60
  339. boolean bringtotop = true
  340. integer textsize = -9
  341. fontcharset fontcharset = gb2312charset!
  342. fontfamily fontfamily = anyfont!
  343. string facename = "宋体"
  344. end type
  345. event selectionchanged;call super::selectionchanged;ls_handtype = THIS.uo_cur_info.handtype
  346. ls_handtype = ls_handtype + '%'
  347. PARENT.TriggerEvent('retrieve_pageretr')
  348. end event
  349. type ddlb_mtrlprp from uo_ddlb_mtrlorigin within w_mtrldef_ch_hq
  350. integer y = 180
  351. integer width = 517
  352. integer height = 480
  353. integer taborder = 20
  354. boolean bringtotop = true
  355. end type
  356. event selectionchanged;call super::selectionchanged;cur_mtrlorigin = this.uo_mtrlorigin
  357. parent.triggerevent('ue_usual_query_retr')
  358. end event
  359. type cbx_all from checkbox within w_mtrldef_ch_hq
  360. integer x = 1673
  361. integer y = 196
  362. integer width = 256
  363. integer height = 60
  364. boolean bringtotop = true
  365. integer textsize = -9
  366. integer weight = 400
  367. fontcharset fontcharset = gb2312charset!
  368. fontpitch fontpitch = variable!
  369. string facename = "宋体"
  370. long backcolor = 134217739
  371. boolean enabled = false
  372. string text = "全选"
  373. end type
  374. event clicked;IF dw_pageretr.RowCount() <= 0 THEN RETURN
  375. Long li
  376. IF THIS.Checked THEN
  377. FOR li = 1 TO dw_pageretr.RowCount()
  378. dw_pageretr.SelectRow(li,TRUE)
  379. NEXT
  380. ELSE
  381. FOR li = 1 TO dw_pageretr.RowCount()
  382. dw_pageretr.SelectRow(li,FALSE)
  383. NEXT
  384. END IF
  385. end event