w_sc_workprocedure.srw 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. $PBExportHeader$w_sc_workprocedure.srw
  2. forward
  3. global type w_sc_workprocedure from w_publ_edit_index
  4. end type
  5. type st_2 from statictext within w_sc_workprocedure
  6. end type
  7. type ddlb_publ from dropdownlistbox within w_sc_workprocedure
  8. end type
  9. type cbx_ineffect from checkbox within w_sc_workprocedure
  10. end type
  11. end forward
  12. global type w_sc_workprocedure from w_publ_edit_index
  13. integer width = 2930
  14. integer height = 1768
  15. string title = "工序"
  16. boolean minbox = true
  17. windowtype windowtype = popup!
  18. st_2 st_2
  19. ddlb_publ ddlb_publ
  20. cbx_ineffect cbx_ineffect
  21. end type
  22. global w_sc_workprocedure w_sc_workprocedure
  23. type variables
  24. s_workprocedure INS_RT_STRU
  25. //====================================================================
  26. // Declare Instance Variables
  27. // Reason:
  28. //--------------------------------------------------------------------
  29. // Modified By: yyx Date: 2003.10.30
  30. //--------------------------------------------------------------------
  31. //日志参数
  32. //====================================================================
  33. string oldcode,oldname,newcode,newname
  34. long ins_ineffect = 1
  35. end variables
  36. on w_sc_workprocedure.create
  37. int iCurrent
  38. call super::create
  39. this.st_2=create st_2
  40. this.ddlb_publ=create ddlb_publ
  41. this.cbx_ineffect=create cbx_ineffect
  42. iCurrent=UpperBound(this.Control)
  43. this.Control[iCurrent+1]=this.st_2
  44. this.Control[iCurrent+2]=this.ddlb_publ
  45. this.Control[iCurrent+3]=this.cbx_ineffect
  46. end on
  47. on w_sc_workprocedure.destroy
  48. call super::destroy
  49. destroy(this.st_2)
  50. destroy(this.ddlb_publ)
  51. destroy(this.cbx_ineffect)
  52. end on
  53. event ue_usual_query_retr;call super::ue_usual_query_retr;if dw_edit_mode or keydown(keyf4!) or keydown(keyf5!) then return
  54. string ls_querystrpart=''
  55. ls_newselect=lower(ori_oldselect)
  56. if trim(sle_usual_query.text)<>'' then
  57. if pos(trim(sle_usual_query.text),'%')=0 then
  58. ls_querystrpart="(code like '%"+trim(sle_usual_query.text)+"%')"
  59. else
  60. ls_querystrpart="(code like '"+trim(sle_usual_query.text)+"')"
  61. end if
  62. if pos(ls_newselect," where ") <> 0 then
  63. ls_newselect=ls_newselect+" and ("+ls_querystrpart+')'
  64. else
  65. ls_newselect=ls_newselect+" where ("+ls_querystrpart+')'
  66. end if
  67. end if
  68. wf_retrieveuc(dw_uc,ls_newselect,1) //注意必须有此句
  69. this.triggerevent('retrieve_uc')
  70. end event
  71. event ue_usual_query_filt;call super::ue_usual_query_filt;if dw_edit_mode or keydown(keyf4!) or keydown(keyf5!) then return
  72. string obj_expr=''
  73. if trim(sle_usual_query.text)<>'' then
  74. if pos(trim(sle_usual_query.text),'%')=0 then
  75. obj_expr=obj_expr+'( code like "%'+trim(sle_usual_query.text)+'%" )'
  76. else
  77. obj_expr=obj_expr+'( code like "'+trim(sle_usual_query.text)+'" )'
  78. end if
  79. end if
  80. dw_uc.setfilter(obj_expr)
  81. dw_uc.setredraw(false)
  82. dw_index.setredraw(false)
  83. dw_uc.filter()
  84. if dw_index.rowcount()>=1 then
  85. dw_index.selectrow(0,false)
  86. dw_index.selectrow(1,true)
  87. end if
  88. dw_uc.setredraw(true)
  89. dw_index.setredraw(true)
  90. end event
  91. event close;call super::close;CLOSEWITHRETURN(THIS,INS_RT_STRU)
  92. //<INS_RT_STRU> 窗体级子定义结构变量,用于返回
  93. end event
  94. event retrieve_uc;Boolean cb_firstpage_enabled,cb_nextpage_enabled,cb_retrieveall_enabled
  95. Boolean cb_priorpage_enabled,cb_func_enabled,cb_retrieve_enabled
  96. Boolean cbx_ineffect_Enabled
  97. cb_firstpage_enabled = cb_firstpage.Enabled
  98. cb_nextpage_enabled = cb_nextpage.Enabled
  99. cb_retrieveall_enabled = cb_retrieveall.Enabled
  100. cb_priorpage_enabled = cb_priorpage.Enabled
  101. cb_func_enabled = cb_func.Enabled
  102. cb_retrieve_enabled = cb_retrieve.Enabled
  103. cbx_ineffect_Enabled = cbx_ineffect.Enabled
  104. cb_firstpage.Enabled = FALSE
  105. cb_nextpage.Enabled = FALSE
  106. cb_retrieveall.Enabled = FALSE
  107. cb_priorpage.Enabled = FALSE
  108. cb_func.Enabled = FALSE
  109. cb_retrieve.Enabled = FALSE
  110. cbx_ineffect.Enabled = FALSE
  111. dw_UC.SetRedraw(FALSE)
  112. dw_index.ShareDataOff()
  113. SetPointer(HourGlass!)
  114. Int li_ifpubl
  115. IF ddlb_publ.Text = '全部' THEN
  116. li_ifpubl = -1
  117. ELSEIF ddlb_publ.Text = '公共' THEN
  118. li_ifpubl = 1
  119. ELSE
  120. li_ifpubl = 0
  121. END IF
  122. dw_UC.Retrieve(li_ifpubl,ins_ineffect)
  123. SetPointer(Arrow!)
  124. dw_UC.ShareData(dw_index)
  125. dw_UC.SetRedraw(TRUE)
  126. IF dw_index.RowCount() >= 1 THEN
  127. dw_index.SelectRow(0,FALSE)
  128. dw_index.SelectRow(1,TRUE)
  129. END IF
  130. cb_firstpage.Enabled = cb_firstpage_enabled
  131. cb_nextpage.Enabled = cb_nextpage_enabled
  132. cb_retrieveall.Enabled = cb_retrieveall_enabled
  133. cb_priorpage.Enabled = cb_priorpage_enabled
  134. cb_func.Enabled = cb_func_enabled
  135. cb_retrieve.Enabled = cb_retrieve_enabled
  136. cbx_ineffect.Enabled = cbx_ineffect_Enabled
  137. end event
  138. type cb_func from w_publ_edit_index`cb_func within w_sc_workprocedure
  139. end type
  140. type cb_exit from w_publ_edit_index`cb_exit within w_sc_workprocedure
  141. end type
  142. type sle_usual_query from w_publ_edit_index`sle_usual_query within w_sc_workprocedure
  143. end type
  144. type cb_nextpage from w_publ_edit_index`cb_nextpage within w_sc_workprocedure
  145. integer x = 2258
  146. end type
  147. type cb_priorpage from w_publ_edit_index`cb_priorpage within w_sc_workprocedure
  148. integer x = 2112
  149. end type
  150. type cb_firstpage from w_publ_edit_index`cb_firstpage within w_sc_workprocedure
  151. integer x = 1966
  152. end type
  153. type cb_retrieveall from w_publ_edit_index`cb_retrieveall within w_sc_workprocedure
  154. integer x = 1819
  155. end type
  156. type em_pagerowno from w_publ_edit_index`em_pagerowno within w_sc_workprocedure
  157. integer x = 1513
  158. end type
  159. type st_pagerowno from w_publ_edit_index`st_pagerowno within w_sc_workprocedure
  160. end type
  161. type st_1 from w_publ_edit_index`st_1 within w_sc_workprocedure
  162. end type
  163. type cb_add from w_publ_edit_index`cb_add within w_sc_workprocedure
  164. end type
  165. event cb_add::clicked;IF NOT f_power_ind(1014) THEN
  166. MessageBox('提示','你没有使用权限!', Information!, OK! )
  167. RETURN
  168. END IF
  169. Long ll_proid = 0
  170. String errmsg = ''
  171. IF dw_edit_mode THEN
  172. dw_uc.AcceptText()
  173. IF dw_uc.GetNextModified(0, Primary!) = 0 THEN
  174. MessageBox('提示','没有任何修改,不可以保存!', Information!, OK! )
  175. RETURN
  176. END IF
  177. dw_uc.Object.code[dw_uc.GetRow()] = Trim(dw_uc.Object.code[dw_uc.GetRow()])
  178. dw_uc.Object.Name[dw_uc.GetRow()] = Trim(dw_uc.Object.Name[dw_uc.GetRow()])
  179. dw_uc.Object.opemp[dw_uc.GetRow()] = publ_operator
  180. IF dw_uc.Object.code[dw_uc.GetRow()] = '' THEN
  181. MessageBox('提示','请输入工序编号!', Information!, OK! )
  182. dw_uc.SetFocus()
  183. dw_uc.SetColumn('code')
  184. RETURN
  185. END IF
  186. IF IsNull(dw_uc.Object.Name[dw_uc.GetRow()]) THEN
  187. dw_uc.SetColumn('Name')
  188. MessageBox('提示','请输入工序名称!', Information!, OK! )
  189. RETURN
  190. END IF
  191. IF dw_uc.Object.wrkgrpid[dw_uc.GetRow()] = 0 THEN
  192. dw_uc.SetColumn('wrkgrpid')
  193. MessageBox('提示','请输入工组!', Information!, OK! )
  194. RETURN
  195. END IF
  196. IF dw_uc.Object.proid[dw_uc.GetRow()] = 0 THEN
  197. ll_proid = f_sys_scidentity(0,"u_sc_workprocedure","proid",errmsg,TRUE,sqlca)
  198. IF ll_proid < 0 THEN
  199. MessageBox("提示",errmsg, Information!, OK! )
  200. RETURN
  201. ELSE
  202. dw_uc.Object.proid[dw_uc.GetRow()] = ll_proid
  203. END IF
  204. ELSE
  205. newcode = dw_uc.Object.code[dw_uc.GetRow()]
  206. newname = dw_uc.Object.Name[dw_uc.GetRow()]
  207. String arg_msg
  208. f_setsysoplog('定义资料','工序修改,原:'+oldcode+','+oldname+'->新:'+newcode+','+newname,arg_msg,FALSE)
  209. END IF
  210. END IF
  211. CALL SUPER::Clicked
  212. IF dw_edit_mode THEN
  213. dw_uc.SetColumn('code')
  214. END IF
  215. end event
  216. type cb_edit from w_publ_edit_index`cb_edit within w_sc_workprocedure
  217. end type
  218. event cb_edit::clicked;if DW_UC.GETROW() = 0 then return
  219. if not f_power_ind(1014) then
  220. messagebox(publ_operator,'你没有使用权限!')
  221. return
  222. end if
  223. CALL SUPER::CLICKED
  224. if dw_edit_mode then
  225. oldcode=DW_UC.OBJECT.code[DW_UC.GETROW()]
  226. oldname=DW_UC.OBJECT.name[DW_UC.GETROW()]
  227. dw_uc.selecttext(len(string(dw_uc.object.code[dw_uc.getrow()]))+1,0)
  228. else
  229. oldcode=''
  230. oldname=''
  231. end if
  232. parent.triggerevent("refresh_interface")
  233. end event
  234. type cb_delet from w_publ_edit_index`cb_delet within w_sc_workprocedure
  235. end type
  236. event cb_delet::clicked;if not f_power_ind(1014) then
  237. messagebox('提示','你没有使用权限!', Information!, OK! )
  238. return
  239. end if
  240. long cnt = 0,ls_row,ls_id
  241. string ls_proname
  242. ls_row = dw_uc.getrow()
  243. if ls_row = 0 then
  244. messagebox('提示','没有删除对象!', Information!, OK! )
  245. return
  246. end if
  247. ls_id = dw_uc.object.proid[ls_row]
  248. ls_proname = dw_uc.object.code[ls_row]
  249. if messagebox ("询问","是否确定要删除当前记录["+ls_proname+"]?(选择确定后记录将不可恢复)",question!,yesno! ) = 2 then
  250. return
  251. end if
  252. select count(*)
  253. into :cnt
  254. from u_sc_abnormitymx
  255. where u_sc_abnormitymx.proid = :ls_id ;
  256. if sqlca.sqlcode <> 0 then
  257. messagebox('提示','查询工序['+ls_proname+']是否使用操作失败!>>'+sqlca.sqlerrtext, Information!, OK! )
  258. return
  259. end if
  260. if cnt > 0 then
  261. messagebox('提示','工序['+ls_proname+']已经用于计件单,不可以删除!', Information!, OK! )
  262. return
  263. end if
  264. dw_uc.setredraw (false)
  265. dw_uc.deleterow (ls_row)
  266. dw_uc.triggerevent (rowfocuschanged!)
  267. if dw_uc.update() = -1 then
  268. rollback;
  269. messagebox ("提示","删除记录操作失败!", Information!, OK! )
  270. else
  271. commit;
  272. end if
  273. dw_uc.setredraw (true)
  274. wf_index_uc()
  275. end event
  276. type cb_choice from w_publ_edit_index`cb_choice within w_sc_workprocedure
  277. end type
  278. event cb_choice::clicked;call super::clicked;Long ROW,ls_i,chC = 0
  279. ROW = dw_index.GetRow()
  280. IF ROW <= 0 THEN
  281. MessageBox('提示','请先选择目标行!', Information!, OK! )
  282. RETURN
  283. END IF
  284. FOR ls_i = 1 TO dw_index.RowCount()
  285. IF dw_index.IsSelected(ls_i) THEN
  286. chC++
  287. INS_RT_STRU.wrkproid[chC] = dw_index.Object.proid[ls_i]
  288. INS_RT_STRU.wrkprocode[chC] = dw_index.Object.code[ls_i]
  289. INS_RT_STRU.wrkproname[chC] = dw_index.Object.Name[ls_i]
  290. INS_RT_STRU.worklevel[chC] = dw_index.Object.u_sc_workprocedure_worklevel[ls_i]
  291. INS_RT_STRU.techlevel[chC] = dw_index.Object.u_sc_workprocedure_techlevel[ls_i]
  292. INS_RT_STRU.workhour[chC] = dw_index.Object.u_sc_workprocedure_workhour[ls_i]
  293. INS_RT_STRU.workprice[chC] = dw_index.Object.workprice[ls_i]
  294. INS_RT_STRU.wrkGrid[chC] = dw_index.Object.wrkgrpid[ls_i]
  295. END IF
  296. NEXT
  297. IF chC = 0 THEN
  298. MessageBox('提示','请至少选择一个目标行!', Information!, OK! )
  299. RETURN
  300. END IF
  301. CLOSE(PARENT)
  302. end event
  303. type cb_cancel from w_publ_edit_index`cb_cancel within w_sc_workprocedure
  304. end type
  305. type cbx_mlselect from w_publ_edit_index`cbx_mlselect within w_sc_workprocedure
  306. end type
  307. type cbx_allselect from w_publ_edit_index`cbx_allselect within w_sc_workprocedure
  308. end type
  309. type cb_mode_itfchg_b from w_publ_edit_index`cb_mode_itfchg_b within w_sc_workprocedure
  310. end type
  311. type cb_mode_itfchg from w_publ_edit_index`cb_mode_itfchg within w_sc_workprocedure
  312. end type
  313. type gb_1 from w_publ_edit_index`gb_1 within w_sc_workprocedure
  314. end type
  315. type dw_uc from w_publ_edit_index`dw_uc within w_sc_workprocedure
  316. integer x = 1326
  317. integer width = 1568
  318. string dataobject = "dw_sc_workprocedure_edit"
  319. end type
  320. type cb_retrieve from w_publ_edit_index`cb_retrieve within w_sc_workprocedure
  321. end type
  322. type cb_print from w_publ_edit_index`cb_print within w_sc_workprocedure
  323. end type
  324. event cb_print::clicked;//if not f_power_ind(983) then
  325. // messagebox(publ_operator,'你没有使用权限!')
  326. // return
  327. //end if
  328. //
  329. S_print_MSG LS_PRMSG
  330. LS_PRMSG.obj_dwNAME='dw_sc_rp_workprocedure'
  331. LS_PRMSG.SHARE_DW=DW_UC
  332. LS_PRMSG.TAG_TEXT='工序列表'
  333. LS_PRMSG.SETUP_FLAG=0
  334. LS_PRMSG.PAGECH_FLAG=1
  335. LS_PRMSG.retr_pram_falg = 17
  336. Openwithparm(w_publ_preview,LS_PRMSG)
  337. end event
  338. type ln_bar from w_publ_edit_index`ln_bar within w_sc_workprocedure
  339. end type
  340. type ln_bar2 from w_publ_edit_index`ln_bar2 within w_sc_workprocedure
  341. end type
  342. type r_bar from w_publ_edit_index`r_bar within w_sc_workprocedure
  343. end type
  344. type ln_1 from w_publ_edit_index`ln_1 within w_sc_workprocedure
  345. end type
  346. type ln_2 from w_publ_edit_index`ln_2 within w_sc_workprocedure
  347. end type
  348. type dw_index from w_publ_edit_index`dw_index within w_sc_workprocedure
  349. integer width = 1326
  350. string dataobject = "dw_sc_workprocedure_index"
  351. end type
  352. type cb_help from w_publ_edit_index`cb_help within w_sc_workprocedure
  353. end type
  354. type st_2 from statictext within w_sc_workprocedure
  355. integer x = 722
  356. integer y = 204
  357. integer width = 151
  358. integer height = 60
  359. boolean bringtotop = true
  360. integer textsize = -9
  361. integer weight = 400
  362. fontcharset fontcharset = gb2312charset!
  363. fontpitch fontpitch = variable!
  364. string facename = "宋体"
  365. long textcolor = 33554432
  366. long backcolor = 134217739
  367. string text = "类型"
  368. boolean focusrectangle = false
  369. end type
  370. type ddlb_publ from dropdownlistbox within w_sc_workprocedure
  371. integer x = 850
  372. integer y = 184
  373. integer width = 480
  374. integer height = 300
  375. integer taborder = 20
  376. boolean bringtotop = true
  377. integer textsize = -9
  378. integer weight = 400
  379. fontcharset fontcharset = gb2312charset!
  380. fontpitch fontpitch = variable!
  381. string facename = "宋体"
  382. long textcolor = 33554432
  383. string text = "全部"
  384. string item[] = {"非公共","公共","全部"}
  385. borderstyle borderstyle = stylelowered!
  386. end type
  387. event selectionchanged;parent.triggerevent('retrieve_uc')
  388. end event
  389. type cbx_ineffect from checkbox within w_sc_workprocedure
  390. integer x = 2153
  391. integer y = 204
  392. integer width = 466
  393. integer height = 60
  394. boolean bringtotop = true
  395. integer textsize = -9
  396. integer weight = 400
  397. fontcharset fontcharset = gb2312charset!
  398. fontpitch fontpitch = variable!
  399. string facename = "宋体"
  400. long textcolor = 33554432
  401. long backcolor = 67108864
  402. string text = "只显示有效工序"
  403. boolean checked = true
  404. end type
  405. event constructor;THIS.backcolor = parent.backcolor
  406. end event
  407. event clicked;if dw_edit_mode then RETURN
  408. IF THIS.checked = TRUE THEN
  409. //THIS.checked = FALSE
  410. ins_ineffect = 1
  411. ELSE
  412. //THIS.checked = TRUE
  413. ins_ineffect = -1
  414. END IF
  415. parent.triggerevent('retrieve_uc')
  416. end event