w_workgroup.srw 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. $PBExportHeader$w_workgroup.srw
  2. forward
  3. global type w_workgroup from w_publ_edit_choice
  4. end type
  5. type cb_print from uo_imflatbutton within w_workgroup
  6. end type
  7. end forward
  8. global type w_workgroup from w_publ_edit_choice
  9. integer width = 3611
  10. integer height = 2380
  11. string title = "工作中心"
  12. boolean minbox = true
  13. windowtype windowtype = popup!
  14. cb_print cb_print
  15. end type
  16. global w_workgroup w_workgroup
  17. on w_workgroup.create
  18. int iCurrent
  19. call super::create
  20. this.cb_print=create cb_print
  21. iCurrent=UpperBound(this.Control)
  22. this.Control[iCurrent+1]=this.cb_print
  23. end on
  24. on w_workgroup.destroy
  25. call super::destroy
  26. destroy(this.cb_print)
  27. end on
  28. event ue_before_open;call super::ue_before_open;if_ue_sentdataout=true
  29. end event
  30. event ue_sentdataout;call super::ue_sentdataout;IF dw_edit_mode THEN
  31. MessageBox(publ_operator,'编辑状态下不能使用')
  32. RETURN
  33. END IF
  34. OpenWithParm(w_sentdataout,dw_uc)
  35. end event
  36. type cb_func from w_publ_edit_choice`cb_func within w_workgroup
  37. integer width = 165
  38. end type
  39. type cb_exit from w_publ_edit_choice`cb_exit within w_workgroup
  40. integer x = 1166
  41. end type
  42. type cb_add from w_publ_edit_choice`cb_add within w_workgroup
  43. integer x = 315
  44. end type
  45. event cb_add::clicked;call super::clicked;IF NOT f_power_ind(688) THEN
  46. MessageBox(publ_operator,'你没有使用权限!')
  47. RETURN
  48. END IF
  49. Long ll_newid,i
  50. String errmsg
  51. IF dw_edit_mode THEN
  52. dw_uc.AcceptText()
  53. IF dw_uc.GetNextModified(0, Primary!) = 0 THEN
  54. MessageBox(publ_operator,'没有任何修改,不可以保存!')
  55. RETURN
  56. END IF
  57. dw_uc.Object.workgroupcode[dw_uc.GetRow()] = Trim(dw_uc.Object.workgroupcode[dw_uc.GetRow()])
  58. dw_uc.Object.workgroupname[dw_uc.GetRow()] = Trim(dw_uc.Object.workgroupname[dw_uc.GetRow()])
  59. dw_uc.Object.workshop[dw_uc.GetRow()] = Trim(dw_uc.Object.workshop[dw_uc.GetRow()])
  60. IF dw_uc.Object.workgroupcode[dw_uc.GetRow()] = '' THEN
  61. MessageBox(publ_operator,'请输入工作中心号!')
  62. RETURN
  63. END IF
  64. IF dw_uc.Object.workgroupname[dw_uc.GetRow()] = '' THEN
  65. MessageBox(publ_operator,'请输入工作中心名称!')
  66. RETURN
  67. END IF
  68. IF dw_uc.Object.wrkgrpid[dw_uc.GetRow()] = 0 THEN
  69. MessageBox(publ_operator,'请选择所属工组!')
  70. RETURN
  71. END IF
  72. IF dw_uc.Object.workgroupid[dw_uc.GetRow()] = 0 THEN
  73. ll_newid = f_sys_scidentity(0,"u_workgroup","workgroupid",errmsg,FALSE,sqlca)
  74. IF ll_newid <= 0 THEN
  75. MessageBox(publ_operator,errmsg)
  76. RETURN
  77. ELSE
  78. dw_uc.Object.workgroupid[dw_uc.GetRow()] = ll_newid
  79. END IF
  80. dw_uc.Object.opemp[dw_uc.GetRow()] = publ_operator
  81. ELSE
  82. dw_uc.Object.modemp[dw_uc.GetRow()] = publ_operator
  83. dw_uc.Object.moddate[dw_uc.GetRow()] = DateTime(Today(),Now())
  84. END IF
  85. END IF
  86. IF dw_edit_mode THEN
  87. String ls_errmsg
  88. dw_uc.AcceptText()
  89. IF dw_uc.UPDATE() = -1 THEN
  90. IF Pos(ins_sqlerrtext,"Cannot insert duplicate key row") > 0 THEN
  91. ls_errmsg = "关键内容重复"
  92. ELSE
  93. ls_errmsg = "因为网络或其他原因>"+ins_sqlerrtext
  94. END IF
  95. ROLLBACK;
  96. MessageBox (publ_operator,ls_errmsg+",保存操作失败!",Exclamation!,OK!)
  97. LS_UPDATE_FLAG = FALSE
  98. RETURN
  99. ELSE
  100. COMMIT;
  101. FOR i = 1 TO 8
  102. dw_uc.SetTabOrder ( i, 0 )
  103. NEXT
  104. LS_UPDATE_FLAG = TRUE
  105. END IF
  106. ins_sqlerrtext = ""
  107. ELSE
  108. Long li_row, li_cur_row
  109. li_cur_row = dw_uc.GetRow()
  110. li_row = dw_uc.InsertRow (0)
  111. FOR i = 1 TO 8
  112. dw_uc.SetTabOrder ( i, i*10 )
  113. NEXT
  114. dw_uc.SelectRow(0,FALSE)
  115. dw_uc.ScrollToRow (li_row)
  116. dw_uc.SelectRow(li_row,TRUE)
  117. dw_uc.SetFocus()
  118. modifyrow_no = li_row
  119. END IF
  120. dw_edit_mode = NOT dw_edit_mode
  121. WF_FACE_CHANGE()
  122. end event
  123. type cb_edit from w_publ_edit_choice`cb_edit within w_workgroup
  124. integer x = 507
  125. end type
  126. event cb_edit::clicked;call super::clicked;if not f_power_ind(688) then
  127. messagebox(publ_operator,'你没有使用权限!')
  128. return
  129. end if
  130. long i
  131. IF dw_edit_mode THEN
  132. if dw_uc.GetItemStatus(dw_UC.getrow(), 0, Primary!)=NewModified! or dw_uc.GetItemStatus(dw_UC.getrow(), 0, Primary!)=New! then
  133. dw_UC.deleterow(dw_UC.getrow())
  134. else
  135. dw_UC.ReselectRow(dw_UC.getrow())
  136. end if
  137. for i=1 to 8
  138. dw_UC.SetTabOrder ( i, 0 )
  139. next
  140. modifyrow_no = 0
  141. ELSE
  142. modifyrow_no = dw_UC.getrow()
  143. for i=1 to 8
  144. dw_UC.SetTabOrder ( i, i*10 )
  145. next
  146. dw_UC.SetFocus()
  147. dw_UC.selectrow(0,false)
  148. dw_UC.ScrollToRow (modifyrow_no)
  149. dw_uc.selectrow(modifyrow_no,true)
  150. END IF
  151. dw_edit_mode= NOT dw_edit_mode
  152. WF_FACE_CHANGE()
  153. end event
  154. type cb_delet from w_publ_edit_choice`cb_delet within w_workgroup
  155. integer x = 699
  156. end type
  157. event cb_delet::clicked;call super::clicked;IF NOT f_power_ind(688) THEN
  158. MessageBox(publ_operator,'你没有使用权限!')
  159. RETURN
  160. END IF
  161. IF MessageBox (publ_operator,"是否确定要删除当前记录?(选择确定后记录将不可恢复)",question!,yesno! ) = 2 THEN
  162. RETURN
  163. END IF
  164. Long ls_id
  165. Long ls_long = 0
  166. String ls_code,arg_msg
  167. IF dw_uc.GetRow() <= 0 THEN
  168. MessageBox('','没有操作目标记录!')
  169. RETURN
  170. END IF
  171. ls_id = dw_uc.Object.workgroupid[dw_uc.GetRow()]
  172. SELECT count(*) INTO :ls_long FROM u_outware
  173. WHERE u_outware.relid = :ls_id
  174. AND u_outware.billtype = 3;
  175. IF sqlca.SQLCode <> 0 THEN
  176. MessageBox (publ_operator,"数据查询操作失败!(请重试!)",exclamation!,ok!)
  177. RETURN
  178. END IF
  179. IF ls_long > 0 THEN
  180. MessageBox (publ_operator,"该资料已经使用于领料单,不可以删除!",exclamation!,ok!)
  181. RETURN
  182. END IF
  183. //ls_long = 0
  184. //SELECT count(*) INTO :ls_long FROM u_workgroupmx
  185. // WHERE u_workgroupmx.workgroupid = :ls_id;
  186. //IF sqlca.SQLCode <> 0 THEN
  187. // MessageBox (publ_operator,"数据查询操作失败!(请重试!)",exclamation!,ok!)
  188. // RETURN
  189. //END IF
  190. //IF ls_long > 0 THEN
  191. // MessageBox (publ_operator,"该资料已经使用于工作员员工,不可以删除!",exclamation!,ok!)
  192. // RETURN
  193. //END IF
  194. dw_uc.SetRedraw (FALSE)
  195. dw_uc.DeleteRow (0)
  196. dw_uc.TriggerEvent (RowFocusChanged!)
  197. IF dw_uc.Update() = -1 THEN
  198. ROLLBACK;
  199. MessageBox (publ_operator,"删除记录操作失败!",exclamation!,ok!)
  200. ELSE
  201. COMMIT;
  202. END IF
  203. dw_uc.SetRedraw (TRUE)
  204. end event
  205. type cb_choice from w_publ_edit_choice`cb_choice within w_workgroup
  206. boolean visible = false
  207. integer x = 878
  208. integer width = 165
  209. boolean enabled = false
  210. end type
  211. type dw_uc from w_publ_edit_choice`dw_uc within w_workgroup
  212. integer width = 3593
  213. integer height = 2108
  214. string dataobject = "dw_workgroup_edit"
  215. boolean hscrollbar = true
  216. end type
  217. type cb_rtr from w_publ_edit_choice`cb_rtr within w_workgroup
  218. end type
  219. type cb_help from w_publ_edit_choice`cb_help within w_workgroup
  220. integer x = 1015
  221. end type
  222. type ln_bar from w_publ_edit_choice`ln_bar within w_workgroup
  223. end type
  224. type ln_bar2 from w_publ_edit_choice`ln_bar2 within w_workgroup
  225. end type
  226. type r_bar from w_publ_edit_choice`r_bar within w_workgroup
  227. end type
  228. type cb_print from uo_imflatbutton within w_workgroup
  229. integer x = 850
  230. integer width = 165
  231. integer height = 164
  232. integer taborder = 60
  233. boolean bringtotop = true
  234. string text = "打印"
  235. string normalpicname = "print.BMP"
  236. integer picsize = 16
  237. toolbaralignment pic_align = alignattop!
  238. boolean border = false
  239. end type
  240. event clicked;call super::clicked;S_print_MSG LS_PRMSG
  241. LS_PRMSG.obj_dwNAME='dw_rp_workgroup_print'
  242. LS_PRMSG.SHARE_DW=DW_UC
  243. LS_PRMSG.TAG_TEXT='工作中心表'
  244. LS_PRMSG.SETUP_FLAG=0
  245. LS_PRMSG.PAGECH_FLAG=1
  246. Openwithparm(w_publ_preview,LS_PRMSG)
  247. end event