uo_transqty_ws.sru 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811
  1. $PBExportHeader$uo_transqty_ws.sru
  2. forward
  3. global type uo_transqty_ws from nonvisualobject
  4. end type
  5. end forward
  6. global type uo_transqty_ws from nonvisualobject
  7. end type
  8. global uo_transqty_ws uo_transqty_ws
  9. type variables
  10. Long uo_billid
  11. String uo_billcode
  12. end variables
  13. forward prototypes
  14. public function integer add_dscrp (long arg_billid, string arg_newdescppart, ref string arg_msg)
  15. public function integer del (long arg_billid, ref string arg_msg, boolean arg_ifcommit)
  16. public function integer updatebegin (long arg_billid, ref string arg_msg)
  17. public function integer audit (long arg_billid, string arg_opemp, ref string arg_msg, boolean arg_ifcommit)
  18. public function integer caudit (long arg_billid, ref string arg_msg, boolean arg_ifcommit)
  19. public function integer save (s_transqty_ws arg_s_transqty, string arg_opemp, ref string arg_msg, boolean arg_ifcommit)
  20. public function integer getinfo (long arg_billid, ref s_transqty_wsmx arg_s_mx[], ref long arg_arr_cnt, ref string arg_msg)
  21. public function integer p_getflag (long arg_billid, ref long arg_flag, ref string arg_msg)
  22. end prototypes
  23. public function integer add_dscrp (long arg_billid, string arg_newdescppart, ref string arg_msg);
  24. Int rslt = 1
  25. long ll_flag
  26. IF arg_newdescppart = '' THEN
  27. rslt = 0
  28. arG_MSG = "要添加内容为空,操作取消"
  29. GOTO ext
  30. END IF
  31. IF p_getflag(arg_billid,ll_flag,arg_msg) = 0 THEN
  32. rslt = 0
  33. GOTO ext
  34. END IF
  35. IF ll_flag = 0 THEN
  36. rslt = 0
  37. arG_MSG = "待审核状态下不可用"
  38. GOTO ext
  39. END IF
  40. UPDATE u_transqty_ws
  41. SET DSCRP = DSCRP+' '+:arg_newdescppart
  42. WHERE u_transqty_ws.billid = :arg_billid;
  43. IF SQLCA.SQLCode <> 0 THEN
  44. rslt = 0
  45. arG_MSG = "因网络或其它原因导致添加备注操作失败"+"~n"+SQLCA.SQLErrText
  46. GOTO ext
  47. END IF
  48. ext:
  49. IF rslt = 1 THEN
  50. COMMIT;
  51. ELSE
  52. ROLLBACK;
  53. END IF
  54. Return (rslt)
  55. end function
  56. public function integer del (long arg_billid, ref string arg_msg, boolean arg_ifcommit);int rslt = 1
  57. long ll_flag
  58. if arg_billid <= 0 then
  59. rslt = 0
  60. arg_msg = '错误单据唯一码'
  61. GOTO ext
  62. END IF
  63. IF p_getflag(arg_billid,ll_flag,arg_msg) = 0 THEN
  64. rslt = 0
  65. GOTO ext
  66. END IF
  67. if ll_flag <> 0 then
  68. rslt = 0
  69. arg_msg = '单据不是在待审核状态,不能删除'
  70. GOTO ext
  71. END IF
  72. DELETE FROM u_transqty_wsmx
  73. WHERE billid = :arg_billid;
  74. IF sqlca.SQLCode <> 0 THEN
  75. rslt = 0
  76. arg_msg = "删除单据明细操作失败"+"~n"+sqlca.SQLErrText
  77. GOTO ext
  78. END IF
  79. DELETE FROM u_transqty_ws
  80. WHERE billid = :arg_billid
  81. AND flag = 0;
  82. IF sqlca.SQLCode <> 0 THEN
  83. rslt = 0
  84. arg_msg = "删除单据操作失败"+"~n"+sqlca.SQLErrText
  85. GOTO ext
  86. END IF
  87. ext:
  88. IF rslt = 0 THEN
  89. ROLLBACK;
  90. ELSEIF rslt = 1 AND arg_ifcommit THEN
  91. COMMIT;
  92. END IF
  93. RETURN rslt
  94. end function
  95. public function integer updatebegin (long arg_billid, ref string arg_msg);Int rslt = 1
  96. long li_flag
  97. IF arg_billid <= 0 THEN
  98. rslt = 0
  99. arg_msg = '错误单据唯一码'
  100. GOTO ext
  101. END IF
  102. IF p_getflag(arg_billid,li_flag,arg_msg) = 0 THEN
  103. rslt = 0
  104. GOTO ext
  105. END IF
  106. IF li_flag = 1 THEN
  107. rslt = 0
  108. arg_msg = '单据已经审核,不可以修改,要修改请先撤销审核'
  109. GOTO ext
  110. END IF
  111. ext:
  112. RETURN rslt
  113. end function
  114. public function integer audit (long arg_billid, string arg_opemp, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
  115. Long ll_flag
  116. IF arg_billid <= 0 THEN
  117. rslt = 0
  118. ARG_MSG = '错误单据唯一码'
  119. GOTO ext
  120. END IF
  121. IF p_getflag(arg_billid,ll_flag,ARG_MSG) = 0 THEN
  122. rslt = 0
  123. GOTO ext
  124. END IF
  125. IF ll_flag <> 0 THEN
  126. rslt = 0
  127. ARG_MSG = '单据不是在待审核状态,不可以再审'
  128. GOTO ext
  129. END IF
  130. DateTime ld_billdate
  131. Long ll_scid,ll_storageid
  132. String ls_rep,ls_billcode,ls_dscrp
  133. long ll_billtype
  134. long rst_outwareid,rst_inwareid
  135. SELECT billdate,scid,storageid,rep,billcode,dscrp,billtype
  136. INTO :ld_billdate,:ll_scid,:ll_storageid,:ls_rep,:ls_billcode,:ls_dscrp,:ll_billtype
  137. FROM u_transqty_ws
  138. Where billid = :arg_billid;
  139. IF sqlca.SQLCode <> 0 THEN
  140. rslt = 0
  141. ARG_MSG = '查询单据相关信息失败,'+sqlca.SQLErrText
  142. GOTO ext
  143. END IF
  144. s_transqty_wsmx s_mx[]
  145. Long ll_arr_cnt,i
  146. IF getinfo(arg_billid,s_mx,ll_arr_cnt,ARG_MSG) = 0 THEN
  147. rslt = 0
  148. GOTO ext
  149. END IF
  150. uo_outware uo_out
  151. uo_out = CREATE uo_outware
  152. uo_out.commit_transaction = sqlca
  153. uo_out.if_getid_ture = FALSE
  154. uo_inware uo_in
  155. uo_in = CREATE uo_inware
  156. uo_in.commit_transaction = sqlca
  157. uo_in.if_getid_ture = FALSE
  158. //////
  159. IF uo_out.newbegin(ll_scid,20,ARG_MSG) = 0 THEN
  160. rslt = 0
  161. GOTO ext
  162. END IF
  163. uo_out.relid = arg_billid
  164. uo_out.outdate = ld_billdate
  165. uo_out.outrep = ls_rep
  166. uo_out.part = ls_billcode
  167. uo_out.dscrp = ls_dscrp
  168. uo_out.cusname = '车间库存分配数转换单自动生成'
  169. uo_out.storageid = ll_storageid
  170. Decimal ld_qty
  171. FOR i = 1 TO ll_arr_cnt
  172. IF ll_billtype = 0 THEN
  173. ld_qty = s_mx[i].transqty
  174. ELSE
  175. ld_qty = 0 - s_mx[i].transqty
  176. END IF
  177. IF uo_out.acceptmx(s_mx[i].mtrlwareid,&
  178. ld_qty,s_mx[i].fprice,1,&
  179. s_mx[i].mxdscrp,s_mx[i].printid,ARG_MSG,0,0,0,0,'',0,0,&
  180. s_mx[i].unit,ld_qty,1,'','',0,0,'',0,0,0,0,'','') = 0 THEN
  181. rslt = 0
  182. GOTO ext
  183. END IF
  184. NEXT
  185. IF uo_out.Save(FALSE,arg_msg) = 0 THEN
  186. rslt = 0
  187. GOTO ext
  188. END IF
  189. rst_outwareid = uo_out.outwareid
  190. IF uo_out.getinfo(ll_scid,rst_outwareid,arg_msg) = 0 THEN
  191. rslt = 0
  192. GOTO ext
  193. END IF
  194. IF uo_out.auditing(FALSE,arg_msg) = 0 THEN
  195. rslt = 0
  196. GOTO ext
  197. END IF
  198. /////////
  199. ////////////////
  200. IF uo_in.newbegin(ll_scid,21,arg_msg) = 0 THEN
  201. rslt = 0
  202. GOTO ext
  203. END IF
  204. uo_in.relid = arg_billid
  205. uo_in.indate = ld_billdate
  206. uo_in.inrep = ls_rep
  207. uo_in.part = ls_billcode
  208. uo_in.dscrp = ls_dscrp
  209. uo_in.storageid = ll_storageid
  210. uo_in.sptname = '车间库存分配数转换单自动生成'
  211. FOR i = 1 TO ll_arr_cnt
  212. IF ll_billtype = 0 THEN
  213. ld_qty = s_mx[i].transqty
  214. ELSE
  215. ld_qty = 0 - s_mx[i].transqty
  216. END IF
  217. IF uo_in.acceptmx(s_mx[i].printid,&
  218. s_mx[i].mtrlid,&
  219. s_mx[i].mtrlcode,&
  220. s_mx[i].plancode,&
  221. s_mx[i].status,&
  222. ld_qty,&
  223. s_mx[i].fprice,&
  224. 1,&
  225. s_mx[i].mxdscrp,&
  226. arg_msg,&
  227. 0,0,0,s_mx[i].woodcode,&
  228. s_mx[i].pcode,&
  229. s_mx[i].sptid,&
  230. s_mx[i].unit,&
  231. 1,&
  232. ld_qty,0,0,'','',0,0,'','',&
  233. ld_qty,&
  234. 0) = 0 THEN
  235. rslt = 0
  236. GOTO ext
  237. END IF
  238. NEXT
  239. IF uo_in.Save(FALSE,arg_msg) = 0 THEN
  240. rslt = 0
  241. GOTO ext
  242. END IF
  243. rst_inwareid = uo_in.inwareid
  244. //4.原事务审核进仓单
  245. IF uo_in.getinfo(ll_scid,rst_inwareid,arg_msg) = 0 THEN
  246. rslt = 0
  247. GOTO ext
  248. END IF
  249. IF uo_in.auditing(FALSE,arg_msg) = 0 THEN
  250. rslt = 0
  251. GOTO ext
  252. END IF
  253. ///////////////
  254. //更新审核标记
  255. UPDATE u_transqty_ws
  256. SET auditemp = :arg_opemp,
  257. auditdate = getdate(),
  258. flag = 1
  259. WHERE billid = :arg_billid
  260. AND flag = 0;
  261. IF sqlca.SQLCode <> 0 THEN
  262. rslt = 0
  263. ARG_MSG = "因网络或其它原因导致单据审核操作失败"+"~n"+sqlca.SQLErrText
  264. GOTO ext
  265. END IF
  266. ext:
  267. IF rslt = 0 THEN
  268. ROLLBACK;
  269. ELSEIF rslt = 1 AND arg_ifcommit THEN
  270. COMMIT;
  271. END IF
  272. DESTROY uo_in
  273. DESTROY uo_out
  274. RETURN rslt
  275. end function
  276. public function integer caudit (long arg_billid, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
  277. Long ll_flag
  278. DateTime null_dt
  279. SetNull(null_dt)
  280. uo_outware uo_out
  281. uo_out = CREATE uo_outware
  282. uo_out.commit_transaction = sqlca
  283. uo_out.if_getid_ture = FALSE
  284. uo_inware uo_in
  285. uo_in = CREATE uo_inware
  286. uo_in.commit_transaction = sqlca
  287. uo_in.if_getid_ture = FALSE
  288. IF arg_billid <= 0 THEN
  289. rslt = 0
  290. ARG_MSG = '错误单据唯一码'
  291. GOTO ext
  292. END IF
  293. IF p_getflag(arg_billid,ll_flag,ARG_MSG) = 0 THEN
  294. rslt = 0
  295. GOTO ext
  296. END IF
  297. IF ll_flag <> 1 THEN
  298. rslt = 0
  299. ARG_MSG = '单据不是在审核状态,不可以撤审'
  300. GOTO ext
  301. END IF
  302. Long ll_scid
  303. SELECT scid INTO :ll_scid
  304. FROM u_transqty_ws
  305. Where billid = :arg_billid;
  306. IF sqlca.SQLCode <> 0 THEN
  307. rslt = 0
  308. ARG_MSG = '查询单据相关信息失败,'+sqlca.SQLErrText
  309. GOTO ext
  310. END IF
  311. Long rst_outwareid,rst_inwareid
  312. ///////////
  313. SELECT inwareid INTO :rst_inwareid
  314. FROM u_inware
  315. WHERE scid = :ll_scid
  316. AND relid = :arg_billid
  317. AND billtype = 21;
  318. IF sqlca.SQLCode <> 0 THEN
  319. ARG_MSG = '查询该单据相关进仓单失败,'+sqlca.SQLErrText
  320. rslt = 0
  321. GOTO ext
  322. END IF
  323. IF uo_in.getinfo(ll_scid,rst_inwareid,ARG_MSG) = 0 THEN
  324. rslt = 0
  325. GOTO ext
  326. END IF
  327. IF uo_in.c_auditing(FALSE,ARG_MSG) = 0 THEN
  328. rslt = 0
  329. GOTO ext
  330. END IF
  331. IF uo_in.del(ll_scid,rst_inwareid,ARG_MSG,FALSE) = 0 THEN
  332. rslt = 0
  333. GOTO ext
  334. END IF
  335. /////////////
  336. /////////////////
  337. SELECT outwareid INTO :rst_outwareid
  338. FROM u_outware
  339. WHERE scid = :ll_scid
  340. AND relid = :arg_billid
  341. AND billtype = 20;
  342. IF sqlca.SQLCode <> 0 THEN
  343. ARG_MSG = '查询该单据相关出仓单失败,'+sqlca.SQLErrText
  344. rslt = 0
  345. GOTO ext
  346. END IF
  347. IF uo_out.getinfo(ll_scid,rst_outwareid,ARG_MSG) = 0 THEN
  348. rslt = 0
  349. GOTO ext
  350. END IF
  351. IF uo_out.c_auditing(FALSE,ARG_MSG) = 0 THEN
  352. rslt = 0
  353. GOTO ext
  354. END IF
  355. IF uo_out.del(ll_scid,rst_outwareid,0,ARG_MSG,FALSE) = 0 THEN
  356. rslt = 0
  357. GOTO ext
  358. END IF
  359. ////////////
  360. //更新审核标记
  361. UPDATE u_transqty_ws
  362. SET auditemp = '',
  363. auditdate = :null_dt,
  364. flag = 0
  365. Where billid = :arg_billid;
  366. IF sqlca.SQLCode <> 0 THEN
  367. rslt = 0
  368. ARG_MSG = "因网络或其它原因导致单据撤审操作失败"+"~n"+sqlca.SQLErrText
  369. GOTO ext
  370. END IF
  371. ext:
  372. IF rslt = 0 THEN
  373. ROLLBACK;
  374. ELSEIF rslt = 1 AND arg_ifcommit THEN
  375. COMMIT;
  376. END IF
  377. DESTROY uo_in
  378. DESTROY uo_out
  379. RETURN rslt
  380. end function
  381. public function integer save (s_transqty_ws arg_s_transqty, string arg_opemp, ref string arg_msg, boolean arg_ifcommit);Integer rslt = 1,cnt = 0
  382. DateTime server_dt
  383. Long ll_billid,it_mxbt,i
  384. String ls_sccode,ls_billcode
  385. IF IsNull(arg_s_transqty.scid) THEN arg_s_transqty.scid = 0
  386. IF IsNull(arg_s_transqty.billid) THEN arg_s_transqty.billid = 0
  387. IF IsNull(arg_s_transqty.rep) THEN arg_s_transqty.rep = ''
  388. IF IsNull(arg_s_transqty.dscrp) THEN arg_s_transqty.dscrp = ''
  389. IF IsNull(arg_s_transqty.storageid) THEN arg_s_transqty.storageid = 0
  390. IF arg_s_transqty.rep = '' THEN
  391. arg_msg = '请输入经手人'
  392. rslt = 0
  393. GOTO ext
  394. END IF
  395. IF arg_s_transqty.storageid = 0 THEN
  396. arg_msg = '请选择车间仓'
  397. rslt = 0
  398. GOTO ext
  399. END IF
  400. SELECT Top 1 getdate() INTO :server_dt FROM u_user;
  401. IF sqlca.SQLCode <> 0 THEN
  402. rslt = 0
  403. arg_msg = "查询操作失败,日期 "
  404. GOTO ext
  405. END IF
  406. it_mxbt = UpperBound(arg_s_transqty.arg_s_mx)
  407. IF it_mxbt <= 0 THEN
  408. rslt = 0
  409. arg_msg = "没有正确明细内容"
  410. GOTO ext
  411. END IF
  412. IF arg_s_transqty.billid = 0 THEN
  413. ll_billid = f_sys_scidentity(0,"u_transqty_ws","billid",arg_msg,TRUE,id_sqlca)
  414. IF ll_billid <= 0 THEN
  415. rslt = 0
  416. GOTO ext
  417. END IF
  418. IF f_get_sccode(arg_s_transqty.scid,sqlca,ls_sccode,arg_msg) = 0 THEN
  419. rslt = 0
  420. GOTO ext
  421. END IF
  422. ls_billcode = getid(arg_s_transqty.scid,ls_sccode + 'TQ',Date(server_dt),FALSE,sqlca)
  423. IF ls_billcode = "err" THEN
  424. rslt = 0
  425. arg_msg = "无法获取单据编号"+"~n"+sqlca.SQLErrText
  426. GOTO ext
  427. END IF
  428. INSERT INTO u_transqty_ws
  429. (scid,
  430. billid,
  431. billcode,
  432. billtype,
  433. storageid,
  434. relcode,
  435. flag,
  436. rep,
  437. billdate,
  438. dscrp,
  439. opemp,
  440. opdate
  441. )
  442. VALUES
  443. (:arg_s_transqty.scid,
  444. :ll_billid,
  445. :ls_billcode,
  446. :arg_s_transqty.billtype,
  447. :arg_s_transqty.storageid,
  448. :arg_s_transqty.relcode,
  449. :arg_s_transqty.flag,
  450. :arg_s_transqty.rep,
  451. :arg_s_transqty.billdate,
  452. :arg_s_transqty.dscrp,
  453. :arg_opemp,
  454. getdate()
  455. );
  456. IF sqlca.SQLCode <> 0 THEN
  457. rslt = 0
  458. arg_msg = "因网络或其它原因导致建立单据操作失败"+"~n"+sqlca.SQLErrText
  459. GOTO ext
  460. END IF
  461. FOR i = 1 TO it_mxbt
  462. INSERT INTO u_transqty_wsmx
  463. (scid,
  464. billid,
  465. printid,
  466. mtrlwareid,
  467. mtrlid,
  468. status,
  469. woodcode,
  470. pcode,
  471. plancode,
  472. sptid,
  473. transqty,
  474. fprice,
  475. mxdscrp)
  476. VALUES
  477. (:arg_s_transqty.scid,
  478. :ll_billid,
  479. :arg_s_transqty.arg_s_mx[i].printid,
  480. :arg_s_transqty.arg_s_mx[i].mtrlwareid,
  481. :arg_s_transqty.arg_s_mx[i].mtrlid,
  482. :arg_s_transqty.arg_s_mx[i].status,
  483. :arg_s_transqty.arg_s_mx[i].woodcode,
  484. :arg_s_transqty.arg_s_mx[i].pcode,
  485. :arg_s_transqty.arg_s_mx[i].plancode,
  486. :arg_s_transqty.arg_s_mx[i].sptid,
  487. :arg_s_transqty.arg_s_mx[i].transqty,
  488. :arg_s_transqty.arg_s_mx[i].fprice,
  489. :arg_s_transqty.arg_s_mx[i].mxdscrp
  490. );
  491. IF sqlca.SQLCode <> 0 THEN
  492. rslt = 0
  493. arg_msg = "因网络或其它原因导致插入明细操作失败"+"~n"+sqlca.SQLErrText
  494. GOTO ext
  495. END IF
  496. NEXT
  497. uo_billid = ll_billid
  498. uo_billcode = ls_billcode
  499. ELSE
  500. UPDATE u_transqty_ws
  501. SET billdate = :arg_s_transqty.billdate,
  502. rep = :arg_s_transqty.rep,
  503. relcode = :arg_s_transqty.relcode,
  504. dscrp = :arg_s_transqty.dscrp,
  505. moddate = getdate(),
  506. modemp = :arg_opemp,
  507. storageid = :arg_s_transqty.storageid
  508. WHERE billid = :arg_s_transqty.billid
  509. AND flag = 0 ;
  510. IF sqlca.SQLCode <> 0 OR sqlca.SQLNRows <= 0 THEN
  511. rslt = 0
  512. arg_msg = "因网络或其它原因导致更新单据操作失败"+"~n"+sqlca.SQLErrText
  513. GOTO ext
  514. END IF
  515. DELETE FROM u_transqty_wsmx
  516. Where billid = :arg_s_transqty.billid;
  517. IF sqlca.SQLCode <> 0 THEN
  518. rslt = 0
  519. arg_msg = "删除旧有明细操作失败"+"~n"+sqlca.SQLErrText
  520. GOTO ext
  521. END IF
  522. FOR i = 1 TO it_mxbt
  523. INSERT INTO u_transqty_wsmx
  524. (scid,
  525. billid,
  526. printid,
  527. mtrlwareid,
  528. mtrlid,
  529. status,
  530. woodcode,
  531. pcode,
  532. plancode,
  533. sptid,
  534. transqty,
  535. fprice,
  536. mxdscrp)
  537. VALUES
  538. (:arg_s_transqty.scid,
  539. :arg_s_transqty.billid,
  540. :arg_s_transqty.arg_s_mx[i].printid,
  541. :arg_s_transqty.arg_s_mx[i].mtrlwareid,
  542. :arg_s_transqty.arg_s_mx[i].mtrlid,
  543. :arg_s_transqty.arg_s_mx[i].status,
  544. :arg_s_transqty.arg_s_mx[i].woodcode,
  545. :arg_s_transqty.arg_s_mx[i].pcode,
  546. :arg_s_transqty.arg_s_mx[i].plancode,
  547. :arg_s_transqty.arg_s_mx[i].sptid,
  548. :arg_s_transqty.arg_s_mx[i].transqty,
  549. :arg_s_transqty.arg_s_mx[i].fprice,
  550. :arg_s_transqty.arg_s_mx[i].mxdscrp
  551. );
  552. IF sqlca.SQLCode <> 0 THEN
  553. rslt = 0
  554. arg_msg = "因网络或其它原因导致插入明细操作失败"+"~n"+sqlca.SQLErrText
  555. GOTO ext
  556. END IF
  557. NEXT
  558. uo_billid = arg_s_transqty.billid
  559. END IF
  560. ext:
  561. IF rslt = 0 THEN
  562. ROLLBACK;
  563. ELSEIF arg_ifcommit AND rslt = 1 THEN
  564. COMMIT;
  565. END IF
  566. RETURN rslt
  567. end function
  568. public function integer getinfo (long arg_billid, ref s_transqty_wsmx arg_s_mx[], ref long arg_arr_cnt, ref string arg_msg);Int rslt = 1
  569. Long i = 1 ,no_mxcheck
  570. IF arg_billid <= 0 THEN
  571. rslt = 0
  572. arg_msg = '错误单据唯一码'
  573. GOTO ext
  574. END IF
  575. DECLARE cur_mx CURSOR FOR
  576. SELECT u_mtrldef.mtrlcode,
  577. u_transqty_wsmx.transqty,
  578. u_transqty_wsmx.mxdscrp,
  579. u_transqty_wsmx.scid,
  580. u_transqty_wsmx.billid,
  581. u_transqty_wsmx.printid,
  582. u_transqty_wsmx.mtrlwareid,
  583. u_transqty_wsmx.mtrlid,
  584. u_transqty_wsmx.status,
  585. u_transqty_wsmx.woodcode,
  586. u_transqty_wsmx.pcode,
  587. u_transqty_wsmx.plancode,
  588. u_transqty_wsmx.sptid,
  589. u_transqty_wsmx.fprice,
  590. u_mtrldef.unit
  591. FROM u_transqty_wsmx INNER JOIN
  592. u_mtrldef ON u_transqty_wsmx.mtrlid = u_mtrldef.mtrlid
  593. WHERE u_transqty_wsmx.billid = :arg_billid
  594. Order By u_transqty_wsmx.printid;
  595. OPEN cur_mx;
  596. FETCH cur_mx INTO :arg_s_mx[i].mtrlcode,
  597. :arg_s_mx[i].transqty,
  598. :arg_s_mx[i].mxdscrp,
  599. :arg_s_mx[i].scid,
  600. :arg_s_mx[i].billid,
  601. :arg_s_mx[i].printid,
  602. :arg_s_mx[i].mtrlwareid,
  603. :arg_s_mx[i].mtrlid,
  604. :arg_s_mx[i].status,
  605. :arg_s_mx[i].woodcode,
  606. :arg_s_mx[i].pcode,
  607. :arg_s_mx[i].plancode,
  608. :arg_s_mx[i].sptid,
  609. :arg_s_mx[i].fprice,
  610. :arg_s_mx[i].unit;
  611. DO WHILE sqlca.SQLCode = 0
  612. i++
  613. FETCH cur_mx INTO :arg_s_mx[i].mtrlcode,
  614. :arg_s_mx[i].transqty,
  615. :arg_s_mx[i].mxdscrp,
  616. :arg_s_mx[i].scid,
  617. :arg_s_mx[i].billid,
  618. :arg_s_mx[i].printid,
  619. :arg_s_mx[i].mtrlwareid,
  620. :arg_s_mx[i].mtrlid,
  621. :arg_s_mx[i].status,
  622. :arg_s_mx[i].woodcode,
  623. :arg_s_mx[i].pcode,
  624. :arg_s_mx[i].plancode,
  625. :arg_s_mx[i].sptid,
  626. :arg_s_mx[i].fprice,
  627. :arg_s_mx[i].unit;
  628. LOOP
  629. CLOSE cur_mx;
  630. SELECT count(*) INTO :no_mxcheck
  631. FROM u_transqty_wsmx
  632. Where billid = :arg_billid;
  633. IF sqlca.SQLCode <> 0 THEN
  634. rslt = 0
  635. arg_msg = "查询操作失败,单据汇总数量"
  636. GOTO ext
  637. END IF
  638. IF i <> (no_mxcheck + 1) THEN
  639. rslt = 0
  640. arg_msg = "查询操作失败,单据汇总内容"
  641. GOTO ext
  642. END IF
  643. arg_arr_cnt = i - 1
  644. ext:
  645. RETURN rslt
  646. end function
  647. public function integer p_getflag (long arg_billid, ref long arg_flag, ref string arg_msg);Int rslt = 1
  648. SELECT flag
  649. INTO :arg_flag
  650. FROM u_transqty_ws
  651. WHERE billid = :arg_billid;
  652. IF sqlca.SQLCode <> 0 THEN
  653. ARG_MSG = '查询单据审核标记失败,'+sqlca.SQLErrText
  654. rslt = 0
  655. GOTO ext
  656. END IF
  657. ext:
  658. RETURN rslt
  659. end function
  660. on uo_transqty_ws.create
  661. call super::create
  662. TriggerEvent( this, "constructor" )
  663. end on
  664. on uo_transqty_ws.destroy
  665. TriggerEvent( this, "destructor" )
  666. call super::destroy
  667. end on