w_pz_code_add_edit.srw 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. $PBExportHeader$w_pz_code_add_edit.srw
  2. forward
  3. global type w_pz_code_add_edit from w_publ_base
  4. end type
  5. type dw_1 from datawindow within w_pz_code_add_edit
  6. end type
  7. type cb_savenew from uo_imflatbutton within w_pz_code_add_edit
  8. end type
  9. type cb_save from uo_imflatbutton within w_pz_code_add_edit
  10. end type
  11. end forward
  12. global type w_pz_code_add_edit from w_publ_base
  13. integer width = 1893
  14. integer height = 568
  15. string title = "配置增加"
  16. boolean minbox = false
  17. windowtype windowtype = response!
  18. dw_1 dw_1
  19. cb_savenew cb_savenew
  20. cb_save cb_save
  21. end type
  22. global w_pz_code_add_edit w_pz_code_add_edit
  23. type variables
  24. long ins_type // 0 - status,1 -woodcode,2-pcode
  25. long ins_relid
  26. long ins_configtype = 0
  27. end variables
  28. forward prototypes
  29. public function integer wf_save ()
  30. public function integer wf_insertrow ()
  31. end prototypes
  32. public function integer wf_save ();Int rslt = 1
  33. Long ll_row,ll_newid, ll_relid
  34. String arg_msg
  35. dw_1.AcceptText()
  36. ll_row = dw_1.GetRow()
  37. IF ll_row <= 0 THEN
  38. MessageBox(publ_operator,'请选择资料')
  39. rslt = 0
  40. GOTO ext
  41. END IF
  42. IF ins_type = 0 THEN
  43. dw_1.Object.status[ll_row] = Trim(dw_1.Object.status[ll_row])
  44. IF dw_1.Object.status[ll_row] = '' THEN
  45. MessageBox(publ_operator,'请输入内容!')
  46. dw_1.SetColumn('status')
  47. dw_1.SetFocus()
  48. rslt = 0
  49. GOTO ext
  50. END IF
  51. IF dw_1.Object.colorid[ll_row] = 0 THEN
  52. ll_newid = f_sys_scidentity(0,"u_color","colorid",arg_msg,TRUE,sqlca)
  53. IF ll_newid <= 0 THEN
  54. MessageBox('提示','取ID失败,'+arg_msg)
  55. rslt = 0
  56. GOTO ext
  57. END IF
  58. dw_1.Object.colorid[ll_row] = ll_newid
  59. END IF
  60. ELSEIF ins_type = 1 THEN
  61. dw_1.Object.woodcode[ll_row] = Trim(dw_1.Object.woodcode[ll_row])
  62. IF dw_1.Object.woodcode[ll_row] = '' THEN
  63. MessageBox(publ_operator,'请输入内容!')
  64. dw_1.SetColumn('woodcode')
  65. dw_1.SetFocus()
  66. rslt = 0
  67. GOTO ext
  68. END IF
  69. IF dw_1.Object.woodcodeid[ll_row] = 0 THEN
  70. ll_newid = f_sys_scidentity(0,"u_color_wood","woodcodeid",arg_msg,TRUE,sqlca)
  71. IF ll_newid <= 0 THEN
  72. MessageBox('提示','取ID失败,'+arg_msg)
  73. rslt = 0
  74. GOTO ext
  75. END IF
  76. dw_1.Object.woodcodeid[ll_row] = ll_newid
  77. END IF
  78. ELSEIF ins_type = 2 THEN
  79. dw_1.Object.pcode[ll_row] = Trim(dw_1.Object.pcode[ll_row])
  80. IF dw_1.Object.pcode[ll_row] = '' THEN
  81. MessageBox(publ_operator,'请输入内容!')
  82. dw_1.SetColumn('pcode')
  83. dw_1.SetFocus()
  84. rslt = 0
  85. GOTO ext
  86. END IF
  87. IF dw_1.Object.pcodeid[ll_row] = 0 THEN
  88. ll_newid = f_sys_scidentity(0,"u_color_pcode","pcodeid",arg_msg,TRUE,sqlca)
  89. IF ll_newid <= 0 THEN
  90. MessageBox('提示','取ID失败,'+arg_msg)
  91. rslt = 0
  92. GOTO ext
  93. END IF
  94. dw_1.Object.pcodeid[ll_row] = ll_newid
  95. END IF
  96. ELSEIF ins_type = 3 THEN
  97. dw_1.Object.contfigtypename[ll_row] = Trim(dw_1.Object.contfigtypename[ll_row])
  98. IF dw_1.Object.contfigtypename[ll_row] = '' THEN
  99. MessageBox(publ_operator,'请输入内容!')
  100. dw_1.SetColumn('contfigtypename')
  101. dw_1.SetFocus()
  102. rslt = 0
  103. GOTO ext
  104. END IF
  105. IF dw_1.Object.contfigtypeid[ll_row] = 0 THEN
  106. ll_newid = f_sys_scidentity(0,"u_configure_type","contfigtypeid",arg_msg,FALSE,sqlca)
  107. IF ll_newid <= 0 THEN
  108. MessageBox('提示','取ID失败,'+arg_msg)
  109. rslt = 0
  110. GOTO ext
  111. END IF
  112. dw_1.Object.contfigtypeid[ll_row] = ll_newid
  113. END IF
  114. ELSEIF ins_type = 4 THEN
  115. dw_1.Object.pzcode[ll_row] = Trim(dw_1.Object.pzcode[ll_row])
  116. IF dw_1.Object.pzcode[ll_row] = '' THEN
  117. MessageBox(publ_operator,'请输入配置项编号!')
  118. rslt = 0
  119. GOTO ext
  120. END IF
  121. dw_1.Object.Name[ll_row] = Trim(dw_1.Object.Name[ll_row])
  122. IF dw_1.Object.Name[ll_row] = '' THEN
  123. MessageBox(publ_operator,'请输入配置项名称!')
  124. rslt = 0
  125. GOTO ext
  126. END IF
  127. // IF dw_1.Object.typeid[ll_row] <= 0 THEN
  128. // MessageBox(publ_operator,'非法的配置类型id!')
  129. // rslt = 0
  130. // GOTO ext
  131. // END IF
  132. IF dw_1.Object.pzid[ll_row] = 0 THEN
  133. ll_newid = f_sys_scidentity(0,"u_configure_code","pzid",arg_msg,FALSE,sqlca)
  134. IF ll_newid <= 0 THEN
  135. MessageBox('提示','取ID失败,'+arg_msg)
  136. rslt = 0
  137. GOTO ext
  138. END IF
  139. dw_1.Object.pzid[ll_row] = ll_newid
  140. END IF
  141. ELSEIF ins_type = 5 THEN
  142. dw_1.Object.pzcodemx[ll_row] = Trim(dw_1.Object.pzcodemx[ll_row])
  143. IF dw_1.Object.pzcodemx[ll_row] = '' THEN
  144. MessageBox(publ_operator,'请输入配置项明细编号!')
  145. rslt = 0
  146. GOTO ext
  147. END IF
  148. dw_1.Object.namemx[ll_row] = Trim(dw_1.Object.namemx[ll_row])
  149. IF dw_1.Object.namemx[ll_row] = '' THEN
  150. MessageBox(publ_operator,'请输入配置项明细名称!')
  151. rslt = 0
  152. GOTO ext
  153. END IF
  154. ll_relid = dw_1.Object.pzid[ll_row]
  155. IF ll_relid <= 0 THEN
  156. MessageBox(publ_operator,'非法的配置项id!')
  157. rslt = 0
  158. GOTO ext
  159. END IF
  160. ll_newid = dw_1.Object.printid[ll_row]
  161. IF ll_newid <= 0 or isnull(ll_newid) THEN
  162. SELECT isnull(max(printid),0) + 1
  163. INTO :ll_newid
  164. FROM u_configure_codemx
  165. Where pzid = :ll_relid;
  166. IF sqlca.SQLCode = 100 THEN
  167. ll_newid = 1
  168. ELSEIF sqlca.SQLCode <> 0 THEN
  169. MessageBox(publ_operator,'查询配置项明细id失败!')
  170. rslt = 0
  171. GOTO ext
  172. END IF
  173. if ll_newid = 0 then
  174. ll_newid = 1
  175. end if
  176. dw_1.Object.printid[ll_row] = ll_newid
  177. END IF
  178. END IF
  179. dw_1.AcceptText()
  180. IF dw_1.Update() = 1 THEN
  181. COMMIT;
  182. ELSE
  183. ROLLBACK;
  184. MessageBox('系统提示','保存操作失败!')
  185. rslt = 0
  186. GOTO ext
  187. END IF
  188. ext:
  189. RETURN rslt
  190. end function
  191. public function integer wf_insertrow ();Long ll_row
  192. dw_1.SetRedraw(FALSE)
  193. dw_1.Reset()
  194. ll_row = dw_1.InsertRow(0)
  195. dw_1.SetRow(ll_row)
  196. dw_1.ScrollToRow(ll_row)
  197. dw_1.SetFocus()
  198. if ins_type = 4 then
  199. dw_1.Object.configtype[ll_row] = ins_configtype
  200. dw_1.Object.typeid[ll_row] = ins_relid
  201. elseif ins_type = 5 then
  202. dw_1.Object.pzid[ll_row] = ins_relid
  203. end if
  204. dw_1.SetRedraw(TRUE)
  205. RETURN 1
  206. end function
  207. on w_pz_code_add_edit.create
  208. int iCurrent
  209. call super::create
  210. this.dw_1=create dw_1
  211. this.cb_savenew=create cb_savenew
  212. this.cb_save=create cb_save
  213. iCurrent=UpperBound(this.Control)
  214. this.Control[iCurrent+1]=this.dw_1
  215. this.Control[iCurrent+2]=this.cb_savenew
  216. this.Control[iCurrent+3]=this.cb_save
  217. end on
  218. on w_pz_code_add_edit.destroy
  219. call super::destroy
  220. destroy(this.dw_1)
  221. destroy(this.cb_savenew)
  222. destroy(this.cb_save)
  223. end on
  224. event open;call super::open;Long ll_id
  225. s_edit_index_tran s_inscust
  226. s_inscust = Message.PowerObjectParm
  227. ins_type = s_inscust.b_long
  228. ll_id = s_inscust.c_long
  229. IF NOT IsNull(s_inscust.d_long) THEN
  230. ins_relid = s_inscust.d_long
  231. END IF
  232. String ls_newmod
  233. IF ll_id = 0 THEN
  234. ls_newmod = '增加'
  235. ELSE
  236. ls_newmod = '修改'
  237. END IF
  238. String ls_pzname
  239. IF ins_type = 0 THEN
  240. dw_1.DataObject = 'dw_status_code_add'
  241. IF sys_option_change_status = '' THEN
  242. ls_pzname = '配置'
  243. ELSE
  244. ls_pzname = sys_option_change_status
  245. END IF
  246. ELSEIF ins_type = 1 THEN
  247. dw_1.DataObject = 'dw_woodcode_code_add'
  248. IF sys_option_change_woodcode = '' THEN
  249. ls_pzname = '配置1'
  250. ELSE
  251. ls_pzname = sys_option_change_woodcode
  252. END IF
  253. ELSEIF ins_type = 2 THEN
  254. dw_1.DataObject = 'dw_pcode_code_add'
  255. IF sys_option_change_pcode = '' THEN
  256. ls_pzname = '配置2'
  257. ELSE
  258. ls_pzname = sys_option_change_pcode
  259. END IF
  260. ELSEIF ins_type = 3 THEN
  261. dw_1.DataObject = 'dw_configure_type_add'
  262. ls_pzname = '部件选配类型'
  263. ELSEIF ins_type = 4 THEN
  264. ins_configtype = s_inscust.f_long
  265. dw_1.DataObject = 'dw_configure_code_add'
  266. ls_pzname = '部件选配项'
  267. ELSEIF ins_type = 5 THEN
  268. dw_1.DataObject = 'dw_configure_codemx_add'
  269. ls_pzname = '部件选配项明细'
  270. END IF
  271. THIS.Title = ls_pzname + ' ' + ls_newmod
  272. dw_1.SetTransObject(sqlca)
  273. f_title_change(dw_1)
  274. IF ll_id = 0 THEN
  275. wf_insertrow()
  276. ELSE
  277. dw_1.Retrieve(ll_id,ins_relid)
  278. dw_1.SetFocus()
  279. END IF
  280. end event
  281. type cb_func from w_publ_base`cb_func within w_pz_code_add_edit
  282. boolean visible = false
  283. end type
  284. type cb_exit from w_publ_base`cb_exit within w_pz_code_add_edit
  285. integer x = 1417
  286. integer y = 352
  287. integer width = 329
  288. integer picsize = 16
  289. end type
  290. type dw_1 from datawindow within w_pz_code_add_edit
  291. integer x = 59
  292. integer y = 64
  293. integer width = 1719
  294. integer height = 264
  295. integer taborder = 30
  296. boolean bringtotop = true
  297. string title = "none"
  298. string dataobject = "dw_status_code_add"
  299. boolean border = false
  300. boolean livescroll = true
  301. end type
  302. type cb_savenew from uo_imflatbutton within w_pz_code_add_edit
  303. integer x = 178
  304. integer y = 352
  305. integer width = 407
  306. integer taborder = 20
  307. boolean bringtotop = true
  308. string text = "保存&增加"
  309. string normalpicname = "new.bmp"
  310. integer picsize = 16
  311. end type
  312. event clicked;call super::clicked;IF wf_save() = 1 THEN
  313. wf_insertrow()
  314. END IF
  315. end event
  316. type cb_save from uo_imflatbutton within w_pz_code_add_edit
  317. integer x = 818
  318. integer y = 352
  319. integer width = 329
  320. integer taborder = 20
  321. boolean bringtotop = true
  322. string text = "保存"
  323. string normalpicname = "save.bmp"
  324. integer picsize = 16
  325. end type
  326. event clicked;call super::clicked;IF wf_save() = 1 THEN
  327. Close(PARENT)
  328. END IF
  329. end event