uo_sptdef.sru 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. $PBExportHeader$uo_sptdef.sru
  2. forward
  3. global type uo_sptdef from nonvisualobject
  4. end type
  5. type s_spt_rep from structure within uo_sptdef
  6. end type
  7. end forward
  8. type s_spt_rep from structure
  9. long repid
  10. long sptid
  11. string repname
  12. string duty
  13. string sex
  14. string officetel
  15. string handtel
  16. string faxno
  17. string email
  18. string dscrp
  19. end type
  20. global type uo_sptdef from nonvisualobject
  21. end type
  22. global uo_sptdef uo_sptdef
  23. type variables
  24. public protectedwrite long sptid //进仓单表自动增量id
  25. public protectedwrite datetime opdate //建立时间,自动
  26. public protectedwrite string opemp //建立操作员
  27. s_spt s_sptdef
  28. boolean if_getid_ture=false
  29. transaction commit_transaction //数据commit事务
  30. PRIVATE:
  31. s_spt_rep sptmx[] //明细结构数组
  32. long it_mxbt=0 //明细结构数组末指针
  33. boolean it_newbegin=false //新建标志
  34. boolean it_updatebegin=false //修改标志
  35. end variables
  36. forward prototypes
  37. public function integer p_reset ()
  38. public function integer p_getinfo (long arg_sptid, ref string arg_msg)
  39. public function integer save (boolean arg_ifcommit, ref string arg_msg)
  40. public function integer newbegin (long arg_sptid)
  41. public function integer updatebegin (long arg_sptid, ref string arg_msg)
  42. public function integer del (long arg_sptid, string arg_sptcode, ref string arg_msg, boolean arg_ifcommit)
  43. public function integer acceptmx (long arg_repid, long arg_sptid, string arg_repname, string arg_duty, string arg_sex, string arg_officetel, string arg_handtel, string arg_faxno, string arg_email, string arg_dscrp, ref string arg_msg)
  44. public function integer p_clearmx ()
  45. public function integer getinfo (long arg_sptid, ref string arg_msg)
  46. end prototypes
  47. public function integer p_reset ();//int p_reset()
  48. s_sptdef.name = ''
  49. s_sptdef.spttype= ''
  50. s_sptdef.rep= ''
  51. s_sptdef.tele= ''
  52. s_sptdef.tele1= ''
  53. s_sptdef.bank= ''
  54. s_sptdef.cunt= ''
  55. s_sptdef.address= ''
  56. s_sptdef.code= ''
  57. s_sptdef.dscrp= ''
  58. s_sptdef.sptcode= ''
  59. s_sptdef.inuse= 0
  60. s_sptdef.faxno= ''
  61. s_sptdef.email= ''
  62. it_newbegin=false
  63. it_updatebegin=false
  64. //清除明细
  65. p_clearmx()
  66. return 1
  67. end function
  68. public function integer p_getinfo (long arg_sptid, ref string arg_msg);//p_getinfo(arg_scid,arg_inwareid,arg_msg)
  69. //0 失败 1成功
  70. INT rslt=1
  71. IF arg_sptid<=0 THEN
  72. rslt=0
  73. arG_MSG="非法供应商唯一码"
  74. goto ext
  75. end if
  76. SELECT name,
  77. spttype,
  78. rep,
  79. tele,
  80. tele1,
  81. bank,
  82. cunt,
  83. address,
  84. code,
  85. dscrp,
  86. sptcode,
  87. inuse,
  88. faxno,
  89. email
  90. into :s_sptdef.name,
  91. :s_sptdef.spttype,
  92. :s_sptdef.rep,
  93. :s_sptdef.tele,
  94. :s_sptdef.tele1,
  95. :s_sptdef.bank,
  96. :s_sptdef.cunt,
  97. :s_sptdef.address,
  98. :s_sptdef.code,
  99. :s_sptdef.dscrp,
  100. :s_sptdef.sptcode,
  101. :s_sptdef.inuse,
  102. :s_sptdef.faxno,
  103. :s_sptdef.email
  104. FROM u_spt
  105. WHERE sptid = :arg_sptid using commit_transaction;
  106. if commit_transaction.sqlcode<>0 then
  107. rslt=0
  108. if pos(lower(commit_transaction.SQLErrText),'more than') > 0 then
  109. arg_msg = '查询操作失败,查询数据返回值多于一个'
  110. else
  111. arG_MSG="查询操作失败(错误供应商唯一码)"
  112. end if
  113. goto ext
  114. end if
  115. sptid = arg_sptid
  116. ext:
  117. IF rslt=0 THEN p_reset()
  118. return rslt
  119. end function
  120. public function integer save (boolean arg_ifcommit, ref string arg_msg);Long rslt = 1,i
  121. DateTime server_dt
  122. Long ls_newid
  123. Long ls_sptid
  124. IF IsNull(s_sptdef.Name) THEN s_sptdef.Name = ''
  125. IF IsNull(s_sptdef.spttype) THEN s_sptdef.spttype = ''
  126. IF IsNull(s_sptdef.rep) THEN s_sptdef.rep = ''
  127. IF IsNull(s_sptdef.tele) THEN s_sptdef.tele = ''
  128. IF IsNull(s_sptdef.bank) THEN s_sptdef.bank = ''
  129. IF IsNull(s_sptdef.tele1) THEN s_sptdef.tele1 = ''
  130. IF IsNull(s_sptdef.cunt) THEN s_sptdef.cunt = ''
  131. IF IsNull(s_sptdef.Address) THEN s_sptdef.Address = ''
  132. IF IsNull(s_sptdef.code) THEN s_sptdef.code = ''
  133. IF IsNull(s_sptdef.dscrp) THEN s_sptdef.dscrp = ''
  134. IF IsNull(s_sptdef.faxno) THEN s_sptdef.faxno = ''
  135. IF IsNull(s_sptdef.sptcode) THEN s_sptdef.sptcode = ''
  136. IF IsNull(s_sptdef.email) THEN s_sptdef.email = ''
  137. IF IsNull(s_sptdef.inuse) THEN s_sptdef.inuse = 1
  138. IF IsNull(s_sptdef.spttypeid) THEN s_sptdef.spttypeid = 11
  139. IF IsNull(s_sptdef.industry) THEN s_sptdef.industry = ''
  140. IF IsNull(s_sptdef.dftmoneyid) THEN s_sptdef.dftmoneyid = 0
  141. IF IsNull(s_sptdef.dftbanktypeid) THEN s_sptdef.dftbanktypeid = 0
  142. IF IsNull(s_sptdef.tax) THEN s_sptdef.tax = 0
  143. IF it_newbegin = False And it_updatebegin = False THEN
  144. rslt = 0
  145. arg_msg = "非编辑状态不可以提交"
  146. GOTO ext
  147. END IF
  148. SELECT Top 1 getdate() Into :server_dt From u_user Using commit_transaction ;
  149. //取得系统时间,借用操作员表
  150. IF commit_transaction.SQLCode <> 0 THEN
  151. rslt = 0
  152. arg_msg = "查询操作失败,日期 "
  153. GOTO ext
  154. END IF
  155. //////////////////////////////////////////////// //开始区分:新建/更新 处理
  156. IF sptid = 0 THEN //新建
  157. ls_newid = f_sys_scidentity(0,"u_spt","sptid",arg_msg,if_getid_ture,commit_transaction)
  158. IF ls_newid <= 0 THEN
  159. rslt = 0
  160. GOTO ext
  161. END IF
  162. INSERT INTO u_spt
  163. (sptid,
  164. name,
  165. spttype,
  166. rep,
  167. tele,
  168. tele1,
  169. bank,
  170. cunt,
  171. address,
  172. code,
  173. dscrp,
  174. sptcode,
  175. email,
  176. opdate,
  177. opemp,
  178. inuse,
  179. faxno,
  180. spttypeid,
  181. dftmoneyid,
  182. dftbanktypeid,
  183. industry,
  184. tax)
  185. VALUES
  186. (:ls_newid,
  187. :s_sptdef.name,
  188. :s_sptdef.spttype,
  189. :s_sptdef.rep,
  190. :s_sptdef.tele,
  191. :s_sptdef.tele1,
  192. :s_sptdef.bank,
  193. :s_sptdef.cunt,
  194. :s_sptdef.address,
  195. :s_sptdef.code,
  196. :s_sptdef.dscrp,
  197. :s_sptdef.sptcode,
  198. :s_sptdef.email,
  199. :server_dt,
  200. :publ_operator,
  201. :s_sptdef.inuse,
  202. :s_sptdef.faxno,
  203. :s_sptdef.spttypeid,
  204. :s_sptdef.dftmoneyid,
  205. :s_sptdef.dftbanktypeid,
  206. :s_sptdef.industry,
  207. :s_sptdef.tax) Using commit_transaction ;
  208. IF commit_transaction.SQLCode <> 0 THEN
  209. rslt = 0
  210. IF Pos(Lower(commit_transaction.SQLErrText),'pk_u_spt') > 0 THEN
  211. arg_msg = '插入操作供应商失败,关键字供应商ID重复'
  212. ELSEIF Pos(Lower(commit_transaction.SQLErrText),'ix_u_spt_1') > 0 THEN
  213. arg_msg = '插入操作供应商失败,供应商编号重复'
  214. ELSEIF Pos(Lower(commit_transaction.SQLErrText),'ix_u_spt') > 0 THEN
  215. arg_msg = '插入操作供应商失败,供应商名称、联系人重复'
  216. ELSE
  217. arg_msg = "因网络或其它原因导致插入操作失败"+"~n"+commit_transaction.SQLErrText
  218. END IF
  219. GOTO ext
  220. END IF
  221. //读取新sptid
  222. sptid = ls_newid
  223. FOR i = 1 To it_mxbt
  224. INSERT INTO u_spt_rep
  225. (repid,
  226. sptid,
  227. repname,
  228. duty,
  229. sex,
  230. officetel,
  231. handtel,
  232. faxno,
  233. email,
  234. dscrp)
  235. VALUES (
  236. :sptmx[i].repid,
  237. :ls_newid,
  238. :sptmx[i].repname,
  239. :sptmx[i].duty,
  240. :sptmx[i].sex,
  241. :sptmx[i].officetel,
  242. :sptmx[i].handtel,
  243. :sptmx[i].faxno,
  244. :sptmx[i].email,
  245. :sptmx[i].dscrp
  246. ) Using commit_transaction;
  247. IF commit_transaction.SQLCode <> 0 THEN
  248. sptid = 0 //sptid
  249. rslt = 0
  250. IF Pos(Lower(commit_transaction.SQLErrText),'pk_u_spt_rep') > 0 THEN
  251. arg_msg = '插入联系人资料操作失败,关键字联系人ID重复'
  252. ELSEIF Pos(Lower(commit_transaction.SQLErrText),'ix_u_spt_rep') > 0 THEN
  253. arg_msg = '插入联系人资料操作失败,联系人名称重复'
  254. ELSE
  255. arg_msg = "因网络或其它原因导致插入明细操作失败"+"~n"+commit_transaction.SQLErrText
  256. END IF
  257. GOTO ext
  258. END IF
  259. NEXT
  260. ELSE //////////////////////////////////////////////// //更新
  261. UPDATE u_spt
  262. SET name = :s_sptdef.name,
  263. spttype = :s_sptdef.spttype,
  264. rep = :s_sptdef.rep,
  265. tele = :s_sptdef.tele,
  266. tele1 = :s_sptdef.tele1,
  267. bank = :s_sptdef.bank,
  268. cunt = :s_sptdef.cunt,
  269. address = :s_sptdef.address,
  270. code = :s_sptdef.code,
  271. dscrp = :s_sptdef.dscrp,
  272. sptcode = :s_sptdef.sptcode,
  273. email = :s_sptdef.email,
  274. inuse = :s_sptdef.inuse,
  275. faxno = :s_sptdef.faxno,
  276. spttypeid = :s_sptdef.spttypeid ,
  277. dftmoneyid = :s_sptdef.dftmoneyid,
  278. dftbanktypeid = :s_sptdef.dftbanktypeid,
  279. industry = :s_sptdef.industry,
  280. tax = :s_sptdef.tax,
  281. opdate=:server_dt,
  282. opemp=:publ_operator
  283. Where sptid = :sptid Using commit_transaction;
  284. IF commit_transaction.SQLCode <> 0 Or commit_transaction.SQLNRows <= 0 THEN
  285. rslt = 0
  286. IF Pos(Lower(commit_transaction.SQLErrText),'pk_u_spt') > 0 THEN
  287. arg_msg = '更新操作供应商失败,关键字供应商ID重复'
  288. ELSEIF Pos(Lower(commit_transaction.SQLErrText),'ix_u_spt_1') > 0 THEN
  289. arg_msg = '更新操作供应商失败,供应商编号重复'
  290. ELSEIF Pos(Lower(commit_transaction.SQLErrText),'ix_u_spt') > 0 THEN
  291. arg_msg = '更新操作供应商失败,供应商名称、联系人重复'
  292. ELSE
  293. arg_msg = "因网络或其它原因导致更新操作失败"+"~n"+commit_transaction.SQLErrText
  294. END IF
  295. GOTO ext
  296. END IF
  297. //删除原有明细
  298. DELETE FROM u_spt_rep
  299. Where u_spt_rep.sptid = :sptid Using commit_transaction;
  300. IF commit_transaction.SQLCode <> 0 THEN
  301. rslt = 0
  302. arg_msg = "删除供应商联系人明细操作失败"+"~n"+commit_transaction.SQLErrText
  303. GOTO ext
  304. END IF
  305. FOR i = 1 To it_mxbt
  306. INSERT INTO u_spt_rep
  307. (repid,
  308. sptid,
  309. repname,
  310. duty,
  311. sex,
  312. officetel,
  313. handtel,
  314. faxno,
  315. email,
  316. dscrp)
  317. VALUES (
  318. :sptmx[i].repid,
  319. :sptid,
  320. :sptmx[i].repname,
  321. :sptmx[i].duty,
  322. :sptmx[i].sex,
  323. :sptmx[i].officetel,
  324. :sptmx[i].handtel,
  325. :sptmx[i].faxno,
  326. :sptmx[i].email,
  327. :sptmx[i].dscrp
  328. ) Using commit_transaction;
  329. IF commit_transaction.SQLCode <> 0 THEN
  330. sptid = 0 //sptid
  331. rslt = 0
  332. IF Pos(Lower(commit_transaction.SQLErrText),'pk_u_spt_rep') > 0 THEN
  333. arg_msg = '插入联系人资料操作失败,关键字联系人ID重复'
  334. ELSEIF Pos(Lower(commit_transaction.SQLErrText),'ix_u_spt_rep') > 0 THEN
  335. arg_msg = '插入联系人资料操作失败,联系人名称重复'
  336. ELSE
  337. arg_msg = "因网络或其它原因导致插入明细操作失败"+"~n"+commit_transaction.SQLErrText
  338. END IF
  339. GOTO ext
  340. END IF
  341. NEXT
  342. END IF
  343. it_newbegin = False
  344. it_updatebegin = False
  345. ext:
  346. IF rslt = 0 THEN
  347. ROLLBACK Using commit_transaction;
  348. p_clearmx()
  349. ELSEIF rslt = 1 And arg_ifcommit THEN
  350. COMMIT Using commit_transaction;
  351. END IF
  352. arg_msg = '供应商资料,'+ arg_msg
  353. RETURN rslt
  354. end function
  355. public function integer newbegin (long arg_sptid);long rslt = 1
  356. it_newbegin =true
  357. it_updatebegin =false
  358. sptid = arg_sptid
  359. p_clearmx()
  360. return rslt
  361. end function
  362. public function integer updatebegin (long arg_sptid, ref string arg_msg);long rslt=1
  363. if arg_sptid<=0 then
  364. rslt=0
  365. arg_msg = '错误供应商唯一码'
  366. goto ext
  367. end if
  368. rslt=p_getinfo(arg_sptid,arg_msg)
  369. if rslt=0 then goto ext
  370. sptid=arg_sptid
  371. it_newbegin=false
  372. it_updatebegin=true
  373. p_clearmx() //清除明细
  374. ext:
  375. if rslt=0 then p_reset()
  376. arg_msg = '供应商资料,'+ arg_msg
  377. return rslt
  378. end function
  379. public function integer del (long arg_sptid, string arg_sptcode, ref string arg_msg, boolean arg_ifcommit);
  380. int rslt = 1
  381. long ls_long
  382. if arg_sptid = 0 then
  383. rslt = 0
  384. arg_msg = "没有删除对象,操作取消"
  385. goto ext
  386. end if
  387. ls_long = 0
  388. SELECT COUNT(*) INTO :LS_LONG FROM u_buytask Where u_buytask.sptid = :arg_sptid using commit_transaction;
  389. IF commit_transaction.SQLCode <> 0 THEN
  390. rslt = 0
  391. arg_msg = "数据查询操作失败!(请重试!)"
  392. goto ext
  393. END IF
  394. IF LS_LONG > 0 THEN
  395. rslt = 0
  396. arg_msg ="该资料已经使用于采购订单记录,不可以删除!"
  397. goto ext
  398. END IF
  399. LS_LONG = 0
  400. SELECT COUNT(*) INTO :LS_LONG FROM u_inware Where u_inware.sptid = :arg_sptid using commit_transaction;
  401. IF commit_transaction.SQLCode <> 0 THEN
  402. rslt = 0
  403. arg_msg = "数据查询操作失败!(请重试!)"
  404. goto ext
  405. END IF
  406. IF LS_LONG > 0 THEN
  407. rslt = 0
  408. arg_msg = "该资料已经使用于进仓记录,不可以删除!"
  409. goto ext
  410. END IF
  411. LS_LONG = 0
  412. SELECT COUNT(*) INTO :LS_LONG FROM u_bmstpay Where sptid = :arg_sptid using commit_transaction;
  413. IF commit_transaction.SQLCode <> 0 THEN
  414. rslt = 0
  415. arg_msg = "数据查询操作失败!(请重试!)"
  416. goto ext
  417. END IF
  418. IF LS_LONG > 0 THEN
  419. rslt = 0
  420. arg_msg = "该资料已经使用于应付帐,不可以删除!"
  421. goto ext
  422. END IF
  423. delete from u_spt_rep
  424. where sptid = :arg_sptid using commit_transaction;
  425. if commit_transaction.sqlcode <> 0 then
  426. rslt = 0
  427. arg_msg = "删除供应商联系人操作失败"+"~n"+commit_transaction.sqlerrtext
  428. goto ext
  429. end if
  430. delete from u_spt
  431. where sptid = :arg_sptid using commit_transaction;
  432. if commit_transaction.sqlcode <> 0 then
  433. rslt = 0
  434. arg_msg = "删除供应商操作失败"+"~n"+commit_transaction.sqlerrtext
  435. goto ext
  436. end if
  437. if f_setsysoplog('定义资料','供应商定义资料删除,id:'+string(arg_sptid)+',code:'+arg_sptcode,arg_msg,false) = 0 then
  438. rslt = 0
  439. goto ext
  440. end if
  441. it_newbegin = false
  442. it_updatebegin = false
  443. ext:
  444. if rslt=0 then
  445. rollback using commit_transaction;
  446. elseif rslt=1 and arg_ifcommit then
  447. commit using commit_transaction;
  448. end if
  449. p_reset()
  450. arg_msg = '供应商资料,'+ arg_msg
  451. return rslt
  452. end function
  453. public function integer acceptmx (long arg_repid, long arg_sptid, string arg_repname, string arg_duty, string arg_sex, string arg_officetel, string arg_handtel, string arg_faxno, string arg_email, string arg_dscrp, ref string arg_msg);Long rslt = 1,cnt = 0,ls_i
  454. IF it_newbegin = FALSE AND it_updatebegin = FALSE THEN
  455. rslt = 0
  456. arg_msg = "非编辑状态不可以使用,操作取消"
  457. GOTO ext
  458. END IF
  459. //清除空值
  460. IF IsNull(arg_repid) THEN arg_repid = 0
  461. IF IsNull(arg_sptid) THEN arg_sptid = 0
  462. IF IsNull(arg_repname) THEN arg_repname = ''
  463. IF IsNull(arg_duty) THEN arg_duty = ''
  464. IF IsNull(arg_sex) THEN arg_sex = ''
  465. IF IsNull(arg_officetel) THEN arg_officetel = ''
  466. IF IsNull(arg_handtel) THEN arg_handtel = ''
  467. IF IsNull(arg_faxno) THEN arg_faxno = ''
  468. IF IsNull(arg_email) THEN arg_email = ''
  469. IF IsNull(arg_dscrp) THEN arg_dscrp = ''
  470. IF arg_repid = 0 THEN
  471. rslt = 1
  472. GOTO ext
  473. END IF
  474. //检查sptid
  475. cnt = 0
  476. SELECT count(*)
  477. INTO :cnt
  478. FROM u_spt
  479. Where sptid = :arg_sptid USING commit_transaction ;
  480. IF commit_transaction.SQLCode <> 0 THEN
  481. rslt = 0
  482. arg_msg = "查询操作失败,供应商:"+commit_transaction.sqlerrtext
  483. GOTO ext
  484. END IF
  485. //写入内容
  486. it_mxbt++
  487. sptmx[it_mxbt].repid = arg_repid
  488. sptmx[it_mxbt].sptid = arg_sptid
  489. sptmx[it_mxbt].repname = arg_repname
  490. sptmx[it_mxbt].duty = arg_duty
  491. sptmx[it_mxbt].sex = arg_sex
  492. sptmx[it_mxbt].officetel = arg_officetel
  493. sptmx[it_mxbt].handtel = arg_handtel
  494. sptmx[it_mxbt].faxno = arg_faxno
  495. sptmx[it_mxbt].email = arg_email
  496. sptmx[it_mxbt].dscrp = arg_dscrp
  497. ext:
  498. IF rslt = 0 THEN p_clearmx()
  499. arg_msg = '供应商资料,'+ arg_msg
  500. Return(rslt)
  501. end function
  502. public function integer p_clearmx ();//int p_clearmx()
  503. //清除明细
  504. it_mxbt=0
  505. return 1
  506. end function
  507. public function integer getinfo (long arg_sptid, ref string arg_msg);//getinfo(arg_scid,arg_sptid,arg_msg)
  508. //0 失败 1成功
  509. Int rslt = 1,i = 1,no_mxcheck = 0
  510. IF arg_sptid <= 0 THEN
  511. rslt = 0
  512. arg_msg = "非法供应商唯一码"
  513. GOTO ext
  514. END IF
  515. rslt = p_getinfo(arg_sptid,arg_msg)
  516. IF rslt = 0 THEN GOTO ext
  517. //用游标读取明细
  518. DECLARE cur_inwaermx CURSOR FOR
  519. SELECT repid, sptid, repname, duty, sex, officetel, handtel, faxno, email, dscrp
  520. FROM u_spt_rep
  521. WHERE u_spt_rep.sptid = :arg_sptid USING commit_transaction;
  522. OPEN cur_inwaermx;
  523. FETCH cur_inwaermx INTO :sptmx[i].repid,:sptmx[i].sptid,
  524. :sptmx[i].repname,:sptmx[i].duty,:sptmx[i].sex,
  525. :sptmx[i].officetel,:sptmx[i].handtel,:sptmx[i].faxno,
  526. :sptmx[i].email,:sptmx[i].dscrp;
  527. DO WHILE commit_transaction.SQLCode = 0
  528. i++
  529. FETCH cur_inwaermx INTO :sptmx[i].repid,:sptmx[i].sptid,
  530. :sptmx[i].repname,:sptmx[i].duty,:sptmx[i].sex,
  531. :sptmx[i].officetel,:sptmx[i].handtel,:sptmx[i].faxno,
  532. :sptmx[i].email,:sptmx[i].dscrp;
  533. LOOP
  534. CLOSE cur_inwaermx;
  535. //检验明细是否读入完整
  536. SELECT count(*) INTO :no_mxcheck
  537. FROM u_spt_rep
  538. WHERE u_spt_rep.sptid = :arg_sptid USING commit_transaction;
  539. IF commit_transaction.SQLCode <> 0 THEN
  540. rslt = 0
  541. arg_msg = "查询操作失败,供应商表联系人明细"
  542. GOTO ext
  543. END IF
  544. IF i <> (no_mxcheck+1) THEN
  545. rslt = 0
  546. arg_msg = "查询操作失败,供应商表联系人明细"
  547. GOTO ext
  548. END IF
  549. sptid = arg_sptid
  550. it_mxbt = i - 1
  551. it_newbegin = FALSE
  552. it_updatebegin = FALSE
  553. ext:
  554. IF rslt = 0 THEN p_reset()
  555. RETURN rslt
  556. end function
  557. on uo_sptdef.create
  558. call super::create
  559. TriggerEvent( this, "constructor" )
  560. end on
  561. on uo_sptdef.destroy
  562. TriggerEvent( this, "destructor" )
  563. call super::destroy
  564. end on