w_scdef_ch.srw 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. $PBExportHeader$w_scdef_ch.srw
  2. forward
  3. global type w_scdef_ch from w_publ_edit_choice
  4. end type
  5. end forward
  6. global type w_scdef_ch from w_publ_edit_choice
  7. integer width = 1637
  8. integer height = 1308
  9. string title = "分部"
  10. end type
  11. global w_scdef_ch w_scdef_ch
  12. type variables
  13. uo_usergroup uo_user
  14. s_scdef s_sc
  15. end variables
  16. on w_scdef_ch.create
  17. call super::create
  18. end on
  19. on w_scdef_ch.destroy
  20. call super::destroy
  21. end on
  22. event close;call super::close;
  23. destroy uo_user
  24. closewithreturn(this,s_sc)
  25. end event
  26. event open;call super::open;uo_user=create uo_usergroup
  27. s_sc.returnflag = false
  28. end event
  29. type cb_func from w_publ_edit_choice`cb_func within w_scdef_ch
  30. boolean visible = false
  31. integer x = 1152
  32. integer width = 165
  33. boolean enabled = false
  34. end type
  35. type cb_exit from w_publ_edit_choice`cb_exit within w_scdef_ch
  36. integer x = 466
  37. integer y = 4
  38. end type
  39. type cb_add from w_publ_edit_choice`cb_add within w_scdef_ch
  40. boolean visible = false
  41. end type
  42. event cb_add::clicked;String arg_msg = ''
  43. Long ll_newid,i
  44. String ls_sccode,ls_ffpsw
  45. Boolean if_newarea = FALSE
  46. IF dw_edit_mode THEN
  47. dw_uc.AcceptText()
  48. IF dw_uc.GetNextModified(0, Primary!) = 0 THEN
  49. MessageBox('提示','没有任何修改,不可以保存!', Information!, OK! )
  50. RETURN
  51. END IF
  52. dw_uc.Object.sccode[dw_uc.GetRow()] = Trim(dw_uc.Object.sccode[dw_uc.GetRow()])
  53. ls_sccode = dw_uc.Object.sccode[dw_uc.GetRow()]
  54. IF dw_uc.Object.scid[dw_uc.GetRow()] > 0 THEN
  55. IF dw_uc.Object.sccode[dw_uc.GetRow()] = '' THEN
  56. MessageBox('提示','请输分部代号!', Information!, OK! )
  57. RETURN
  58. END IF
  59. IF Len(ls_sccode) > 2 THEN
  60. MessageBox('',String(Len(ls_sccode)))
  61. MessageBox('提示','代号不能超过两位!', Information!, OK! )
  62. RETURN
  63. END IF
  64. END IF
  65. IF dw_uc.Object.scid[dw_uc.GetRow()] = -1 THEN
  66. //参数0表示取得目标本身的ID
  67. ll_newid = f_sys_scidentity(0,"u_scdef","scid",arg_msg,FALSE,sqlca)
  68. IF ll_newid < 0 THEN
  69. MessageBox('提示',arg_msg, Information!, OK! )
  70. RETURN
  71. ELSE
  72. dw_uc.Object.scid[dw_uc.GetRow()] = ll_newid
  73. if_newarea = TRUE
  74. END IF
  75. END IF
  76. ls_ffpsw = Trim(dw_uc.Object.ffpsw[dw_uc.GetRow()])
  77. dw_uc.Object.mffpsw[dw_uc.GetRow()] = f_psw_bczh(ls_sccode + ls_ffpsw,0,sys_power_key) //加密
  78. END IF
  79. IF dw_edit_mode THEN
  80. String ls_errmsg
  81. IF dw_uc.UPDATE() = -1 THEN
  82. IF Pos(ins_sqlerrtext,"Cannot insert duplicate key row") > 0 THEN
  83. ls_errmsg = "关键内容重复"
  84. ELSE
  85. ls_errmsg = "因为网络或其他原因>"+ins_sqlerrtext
  86. END IF
  87. ROLLBACK;
  88. MessageBox ('提示',ls_errmsg+",保存操作失败!", Information!, OK! )
  89. LS_UPDATE_FLAG = FALSE
  90. RETURN
  91. ELSE
  92. FOR i = 1 TO 3
  93. dw_uc.SetTabOrder ( i, 0 )
  94. NEXT
  95. LS_UPDATE_FLAG = TRUE
  96. END IF
  97. ins_sqlerrtext = ""
  98. ELSE
  99. Long li_row, li_cur_row
  100. li_cur_row = dw_uc.GetRow()
  101. li_row = dw_uc.InsertRow (0)
  102. FOR i = 1 TO 3
  103. dw_uc.SetTabOrder ( i, i*10 )
  104. NEXT
  105. dw_uc.SelectRow(0,FALSE)
  106. dw_uc.ScrollToRow (li_row)
  107. dw_uc.SelectRow(li_row,TRUE)
  108. dw_uc.SetFocus()
  109. modifyrow_no = li_row
  110. END IF
  111. dw_edit_mode = NOT dw_edit_mode
  112. WF_FACE_CHANGE()
  113. end event
  114. type cb_edit from w_publ_edit_choice`cb_edit within w_scdef_ch
  115. boolean visible = false
  116. end type
  117. event cb_edit::clicked;String arg_msg = ''
  118. Long i
  119. IF dw_edit_mode THEN
  120. IF dw_uc.GetItemStatus(dw_uc.GetRow(), 0, Primary!) = NewModified! OR dw_uc.GetItemStatus(dw_uc.GetRow(), 0, Primary!) = New! THEN
  121. dw_uc.DeleteRow(dw_uc.GetRow())
  122. ELSE
  123. dw_uc.ReselectRow(dw_uc.GetRow())
  124. END IF
  125. FOR i = 1 TO 4
  126. dw_uc.SetTabOrder ( i, 0 )
  127. NEXT
  128. modifyrow_no = 0
  129. ELSE
  130. modifyrow_no = dw_uc.GetRow()
  131. IF modifyrow_no > 0 THEN
  132. IF dw_uc.Object.scid[modifyrow_no] = 0 THEN
  133. FOR i = 3 TO 4
  134. dw_uc.SetTabOrder ( i, i*10)
  135. NEXT
  136. ELSE
  137. FOR i = 1 TO 4
  138. dw_uc.SetTabOrder ( i, i*10)
  139. NEXT
  140. END IF
  141. ELSE
  142. MessageBox('提示','没有可修改的资料!', Information!, OK! )
  143. RETURN
  144. END IF
  145. dw_uc.SetFocus()
  146. dw_uc.SelectRow(0,FALSE)
  147. dw_uc.ScrollToRow (modifyrow_no)
  148. dw_uc.SelectRow(modifyrow_no,TRUE)
  149. END IF
  150. dw_edit_mode = NOT dw_edit_mode
  151. WF_FACE_CHANGE()
  152. end event
  153. type cb_delet from w_publ_edit_choice`cb_delet within w_scdef_ch
  154. boolean visible = false
  155. end type
  156. event cb_delet::clicked;call super::clicked;string arg_msg=''
  157. IF MessageBox ('询问',"是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN
  158. RETURN
  159. END IF
  160. long LS_id
  161. LONG LS_LONG=0
  162. string ls_code
  163. IF DW_UC.GETROW()<=0 THEN
  164. MESSAGEBOX('提示','没有操作目标记录!', Information!, OK! )
  165. RETURN
  166. END IF
  167. LS_id=DW_UC.OBJECT.scid[DW_UC.GETROW()]
  168. if dw_UC.object.scid[DW_UC.GETROW()]=0 then
  169. messagebox('提示','总部记录不可以删除!', Information!, OK! )
  170. return
  171. end if
  172. select COUNT(*) into :LS_LONG from u_bsnno
  173. where u_bsnno.scid=:LS_id;
  174. if SQLCA.SQLCode =-1 then
  175. MessageBox ('提示',"数据查询操作失败!(请重试!)", Information!, OK! )
  176. return
  177. end if
  178. IF LS_LONG>0 THEN
  179. MessageBox ('提示',"该分部代号已经使用于业务编号表中,不可以删除!", Information!, OK! )
  180. RETURN
  181. END IF
  182. if uo_user.deluser(true,LS_id,0,arg_msg,false)=0 then
  183. messagebox('提示','删除失败>>'+arg_msg, Information!, OK! )
  184. return
  185. end if
  186. dw_uc.SetRedraw (false)
  187. dw_UC.DeleteRow (0)
  188. dw_UC.TriggerEvent (rowfocuschanged!)
  189. if dw_UC.Update() = -1 then
  190. rollback;
  191. MessageBox ('提示',"删除记录操作失败!", Information!, OK! )
  192. else
  193. commit;
  194. end if
  195. dw_uc.SetRedraw (true)
  196. end event
  197. type cb_choice from w_publ_edit_choice`cb_choice within w_scdef_ch
  198. integer x = 151
  199. integer y = 4
  200. integer width = 165
  201. end type
  202. event cb_choice::clicked;call super::clicked;Long li_row
  203. li_row = dw_uc.GetRow()
  204. if li_row <= 0 then
  205. messagebox('提示','请选择目标颜色', Information!, OK! )
  206. return
  207. end if
  208. s_sc.scid = dw_uc.object.scid[li_row]
  209. s_sc.returnflag = true
  210. close(parent)
  211. end event
  212. type dw_uc from w_publ_edit_choice`dw_uc within w_scdef_ch
  213. integer width = 1614
  214. integer height = 1036
  215. string dataobject = "dw_scdef"
  216. end type
  217. event dw_uc::doubleclicked;call super::doubleclicked;IF dw_edit_mode THEN RETURN
  218. cb_choice.TriggerEvent(Clicked!)
  219. end event
  220. type cb_rtr from w_publ_edit_choice`cb_rtr within w_scdef_ch
  221. integer x = 0
  222. integer y = 4
  223. end type
  224. type cb_help from w_publ_edit_choice`cb_help within w_scdef_ch
  225. integer x = 315
  226. integer y = 4
  227. end type
  228. type ln_bar from w_publ_edit_choice`ln_bar within w_scdef_ch
  229. end type
  230. type ln_bar2 from w_publ_edit_choice`ln_bar2 within w_scdef_ch
  231. end type
  232. type r_bar from w_publ_edit_choice`r_bar within w_scdef_ch
  233. integer x = 1381
  234. end type