w_fileway_edit.srw 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. $PBExportHeader$w_fileway_edit.srw
  2. forward
  3. global type w_fileway_edit from w_publ_edit_choice
  4. end type
  5. end forward
  6. global type w_fileway_edit from w_publ_edit_choice
  7. integer width = 3712
  8. integer height = 1308
  9. string title = "打开方式"
  10. boolean minbox = true
  11. windowtype windowtype = popup!
  12. end type
  13. global w_fileway_edit w_fileway_edit
  14. type variables
  15. uo_usergroup uo_user
  16. end variables
  17. on w_fileway_edit.create
  18. call super::create
  19. end on
  20. on w_fileway_edit.destroy
  21. call super::destroy
  22. end on
  23. event close;
  24. call super::close
  25. //f_sc_array('0')
  26. destroy uo_user
  27. end event
  28. event open;call super::open;uo_user=create uo_usergroup
  29. end event
  30. type cb_func from w_publ_edit_choice`cb_func within w_fileway_edit
  31. boolean visible = false
  32. integer x = 1152
  33. integer width = 165
  34. boolean enabled = false
  35. end type
  36. type cb_exit from w_publ_edit_choice`cb_exit within w_fileway_edit
  37. integer x = 837
  38. end type
  39. type cb_add from w_publ_edit_choice`cb_add within w_fileway_edit
  40. end type
  41. event cb_add::clicked;String arg_msg = ''
  42. Long ll_newid,i
  43. String ls_sccode,ls_ffpsw
  44. String ls_way,ls_type,ls_path
  45. Long cnt
  46. Boolean if_newarea = FALSE
  47. IF dw_edit_mode THEN
  48. dw_uc.AcceptText()
  49. IF dw_uc.GetNextModified(0, Primary!) = 0 THEN
  50. MessageBox(publ_operator,'没有任何修改,不可以保存!')
  51. RETURN
  52. END IF
  53. ls_way = dw_uc.Object.way[dw_uc.GetRow()]
  54. ls_type = dw_uc.Object.filetype[dw_uc.GetRow()]
  55. ls_path = dw_uc.Object.path[dw_uc.GetRow()]
  56. IF ls_way = '' OR ls_type = '' OR ls_path = '' THEN
  57. MessageBox(publ_operator,'资料不能为空!')
  58. RETURN
  59. END IF
  60. SELECT count(*) INTO :cnt FROM u_file_way
  61. where filetype = :ls_type and way = :ls_way;
  62. IF SQLCA.SQLCODE<>0 THEN
  63. MessageBox(publ_operator,'查询打开方式数据失败!')
  64. RETURN
  65. END IF
  66. IF cnt>0 THEN
  67. MessageBox(publ_operator,'资料重复,请检查!')
  68. RETURN
  69. END IF
  70. IF dw_uc.Object.id[dw_uc.GetRow()] = 0 THEN
  71. //参数0表示取得目标本身的ID
  72. ll_newid = f_sys_scidentity(0,"u_file_way","id",arg_msg,TRUE,id_sqlca)
  73. IF ll_newid < 0 THEN
  74. MessageBox(publ_operator,arg_msg)
  75. RETURN
  76. ELSE
  77. dw_uc.Object.id[dw_uc.GetRow()] = ll_newid
  78. if_newarea = TRUE
  79. END IF
  80. END IF
  81. END IF
  82. IF dw_edit_mode THEN
  83. String ls_errmsg
  84. IF dw_uc.UPDATE() = -1 THEN
  85. IF Pos(ins_sqlerrtext,"Cannot insert duplicate key row") > 0 THEN
  86. ls_errmsg = "关键内容重复"
  87. ELSE
  88. ls_errmsg = "因为网络或其他原因>"+ins_sqlerrtext
  89. END IF
  90. ROLLBACK;
  91. MessageBox (publ_operator,ls_errmsg+",保存操作失败!",Exclamation!,OK!)
  92. LS_UPDATE_FLAG = FALSE
  93. RETURN
  94. ELSE
  95. commit;
  96. FOR i = 1 TO 4
  97. dw_uc.SetTabOrder ( i, 0 )
  98. NEXT
  99. LS_UPDATE_FLAG = TRUE
  100. END IF
  101. ins_sqlerrtext = ""
  102. ELSE
  103. Long li_row, li_cur_row
  104. li_cur_row = dw_uc.GetRow()
  105. li_row = dw_uc.InsertRow (0)
  106. FOR i = 1 TO 4
  107. dw_uc.SetTabOrder ( i, i*10 )
  108. NEXT
  109. dw_uc.SelectRow(0,FALSE)
  110. dw_uc.ScrollToRow (li_row)
  111. dw_uc.SelectRow(li_row,TRUE)
  112. dw_uc.SetFocus()
  113. modifyrow_no = li_row
  114. END IF
  115. dw_edit_mode = NOT dw_edit_mode
  116. WF_FACE_CHANGE()
  117. end event
  118. type cb_edit from w_publ_edit_choice`cb_edit within w_fileway_edit
  119. end type
  120. event cb_edit::clicked;String arg_msg = ''
  121. Long i
  122. IF dw_edit_mode THEN
  123. IF dw_uc.GetItemStatus(dw_uc.GetRow(), 0, Primary!) = NewModified! OR dw_uc.GetItemStatus(dw_uc.GetRow(), 0, Primary!) = New! THEN
  124. dw_uc.DeleteRow(dw_uc.GetRow())
  125. ELSE
  126. dw_uc.ReselectRow(dw_uc.GetRow())
  127. END IF
  128. FOR i = 1 TO 4
  129. dw_uc.SetTabOrder ( i, 0 )
  130. NEXT
  131. modifyrow_no = 0
  132. ELSE
  133. modifyrow_no = dw_uc.GetRow()
  134. IF modifyrow_no > 0 THEN
  135. FOR i = 1 TO 4
  136. dw_uc.SetTabOrder ( i, i*10)
  137. NEXT
  138. ELSE
  139. MessageBox('','没有可修改的资料!')
  140. RETURN
  141. END IF
  142. dw_uc.SetFocus()
  143. dw_uc.SelectRow(0,FALSE)
  144. dw_uc.ScrollToRow (modifyrow_no)
  145. dw_uc.SelectRow(modifyrow_no,TRUE)
  146. END IF
  147. dw_edit_mode = NOT dw_edit_mode
  148. WF_FACE_CHANGE()
  149. end event
  150. type cb_delet from w_publ_edit_choice`cb_delet within w_fileway_edit
  151. end type
  152. event cb_delet::clicked;call super::clicked;string arg_msg=''
  153. IF MessageBox (publ_operator,"是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN
  154. RETURN
  155. END IF
  156. long LS_id
  157. LONG LS_LONG=0
  158. string ls_code
  159. IF DW_UC.GETROW()<=0 THEN
  160. MESSAGEBOX('','没有操作目标记录!')
  161. RETURN
  162. END IF
  163. LS_id=DW_UC.OBJECT.id[DW_UC.GETROW()]
  164. dw_uc.SetRedraw (false)
  165. dw_UC.DeleteRow (0)
  166. dw_UC.TriggerEvent (rowfocuschanged!)
  167. if dw_UC.Update() = -1 then
  168. rollback;
  169. MessageBox (publ_operator,"删除记录操作失败!",Exclamation!,OK!)
  170. else
  171. commit;
  172. end if
  173. dw_uc.SetRedraw (true)
  174. end event
  175. type cb_choice from w_publ_edit_choice`cb_choice within w_fileway_edit
  176. boolean visible = false
  177. integer x = 987
  178. integer width = 165
  179. boolean enabled = false
  180. end type
  181. type dw_uc from w_publ_edit_choice`dw_uc within w_fileway_edit
  182. integer width = 3680
  183. integer height = 1036
  184. string dataobject = "dw_fileway"
  185. boolean hscrollbar = true
  186. boolean hsplitscroll = true
  187. end type
  188. type cb_rtr from w_publ_edit_choice`cb_rtr within w_fileway_edit
  189. end type
  190. type cb_help from w_publ_edit_choice`cb_help within w_fileway_edit
  191. integer x = 686
  192. end type
  193. type ln_bar from w_publ_edit_choice`ln_bar within w_fileway_edit
  194. end type
  195. type ln_bar2 from w_publ_edit_choice`ln_bar2 within w_fileway_edit
  196. end type
  197. type r_bar from w_publ_edit_choice`r_bar within w_fileway_edit
  198. integer x = 1381
  199. end type