uo_saletask_altermtrl.sru 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  1. $PBExportHeader$uo_saletask_altermtrl.sru
  2. forward
  3. global type uo_saletask_altermtrl from nonvisualobject
  4. end type
  5. end forward
  6. global type uo_saletask_altermtrl from nonvisualobject
  7. end type
  8. global uo_saletask_altermtrl uo_saletask_altermtrl
  9. type variables
  10. long uo_billid
  11. string uo_billcode
  12. int uo_option_m_msttake
  13. int uo_option_price_rmb
  14. end variables
  15. forward prototypes
  16. public function integer p_getflag (long arg_billid, ref integer arg_flag, ref string arg_msg)
  17. public function integer updatebegin (long arg_billid, ref string arg_msg)
  18. public function integer save (s_saletask_altermtrl arg_s_altermtrl, string arg_opemp, ref string arg_msg, boolean arg_ifcommit)
  19. public function integer del (long arg_billid, ref string arg_msg, boolean arg_ifcommit)
  20. public function integer getinfo (long arg_billid, ref s_saletask_altermtrl_mx arg_ref_mx[], ref long arg_arr_cnt, ref string arg_msg)
  21. public function integer audit (long arg_billid, string arg_opemp, ref string arg_msg, boolean arg_ifcommit)
  22. public function integer add_dscrp (long arg_billid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit)
  23. end prototypes
  24. public function integer p_getflag (long arg_billid, ref integer arg_flag, ref string arg_msg);Int rslt = 1
  25. SELECT flag
  26. INTO :arg_flag
  27. FROM u_saletask_altermtrl
  28. WHERE billid = :arg_billid;
  29. IF sqlca.SQLCode <> 0 THEN
  30. ARG_MSG = '查询单据审核标记失败,'+sqlca.SQLErrText
  31. rslt = 0
  32. GOTO ext
  33. END IF
  34. ext:
  35. RETURN rslt
  36. end function
  37. public function integer updatebegin (long arg_billid, ref string arg_msg);Int rslt = 1
  38. Int li_flag
  39. Long cnt
  40. If arg_billid <= 0 Then
  41. rslt = 0
  42. arg_msg = '错误单据唯一码'
  43. Goto ext
  44. End If
  45. If p_getflag(arg_billid,li_flag,arg_msg) = 0 Then
  46. rslt = 0
  47. Goto ext
  48. End If
  49. If li_flag = 1 Then
  50. rslt = 0
  51. arg_msg = '单据已经审核,不可以再修改'
  52. Goto ext
  53. End If
  54. ext:
  55. Return rslt
  56. end function
  57. public function integer save (s_saletask_altermtrl arg_s_altermtrl, string arg_opemp, ref string arg_msg, boolean arg_ifcommit);Integer rslt = 1,cnt = 0
  58. DateTime server_dt
  59. Long ll_billid,it_mxbt,i
  60. String ls_sccode,ls_billcode
  61. If IsNull(arg_s_altermtrl.scid) Then arg_s_altermtrl.scid = 0
  62. If IsNull(arg_s_altermtrl.billid) Then arg_s_altermtrl.billid = 0
  63. If IsNull(arg_s_altermtrl.relcode) Then arg_s_altermtrl.relcode = ''
  64. If IsNull(arg_s_altermtrl.rep) Then arg_s_altermtrl.rep = ''
  65. If IsNull(arg_s_altermtrl.dscrp) Then arg_s_altermtrl.dscrp = ''
  66. If arg_s_altermtrl.rep = '' Then
  67. arg_msg = '请输入经手人'
  68. rslt = 0
  69. Goto ext
  70. End If
  71. If arg_s_altermtrl.scid < 0 Then
  72. arg_msg = '请选择分部'
  73. rslt = 0
  74. Goto ext
  75. End If
  76. Select Top 1 getdate() Into :server_dt From u_user;
  77. If sqlca.SQLCode <> 0 Then
  78. rslt = 0
  79. arg_msg = "查询操作失败,日期 "
  80. Goto ext
  81. End If
  82. it_mxbt = UpperBound(arg_s_altermtrl.arg_s_mx)
  83. If it_mxbt <= 0 Then
  84. rslt = 0
  85. arg_msg = "没有正确明细内容"
  86. Goto ext
  87. End If
  88. //新增类型,检查 工组 对应 车间
  89. For i = 1 To it_mxbt
  90. If arg_s_altermtrl.arg_s_mx[i].taskid = 0 Then
  91. rslt = 0
  92. arg_msg = "行"+String(i)+ ",请选择订单明细"
  93. Goto ext
  94. End If
  95. If arg_s_altermtrl.arg_s_mx[i].mtrlid_ori = arg_s_altermtrl.arg_s_mx[i].mtrlid_new And &
  96. arg_s_altermtrl.arg_s_mx[i].status_ori = arg_s_altermtrl.arg_s_mx[i].status_new And &
  97. arg_s_altermtrl.arg_s_mx[i].woodcode_ori = arg_s_altermtrl.arg_s_mx[i].woodcode_new And &
  98. arg_s_altermtrl.arg_s_mx[i].pcode_ori = arg_s_altermtrl.arg_s_mx[i].pcode_new And &
  99. arg_s_altermtrl.arg_s_mx[i].enprice_ori = arg_s_altermtrl.arg_s_mx[i].enprice_new Then
  100. rslt = 0
  101. arg_msg = '行'+String(i)+',没有任何修改,请检查'
  102. Goto ext
  103. End If
  104. Next
  105. If arg_s_altermtrl.billid = 0 Then
  106. ll_billid = f_sys_scidentity(0,"u_saletask_altermtrl","billid",arg_msg,True,id_sqlca)
  107. If ll_billid <= 0 Then
  108. rslt = 0
  109. Goto ext
  110. End If
  111. If f_get_sccode(0,sqlca,ls_sccode,arg_msg) = 0 Then
  112. rslt = 0
  113. Goto ext
  114. End If
  115. ls_billcode = getid(0,ls_sccode + 'TA',Date(server_dt),False,sqlca)
  116. If ls_billcode = "err" Then
  117. rslt = 0
  118. arg_msg = "无法获取单据编号"+"~n"+sqlca.SQLErrText
  119. Goto ext
  120. End If
  121. Insert Into u_saletask_altermtrl
  122. (scid,
  123. billid,
  124. billcode,
  125. billdate,
  126. relcode,
  127. rep,
  128. dscrp,
  129. opdate,
  130. opemp)
  131. Values
  132. (:arg_s_altermtrl.scid,
  133. :ll_billid,
  134. :ls_billcode,
  135. :arg_s_altermtrl.billdate,
  136. :arg_s_altermtrl.relcode,
  137. :arg_s_altermtrl.rep,
  138. :arg_s_altermtrl.dscrp,
  139. getdate(),
  140. :arg_opemp);
  141. If sqlca.SQLCode <> 0 Then
  142. rslt = 0
  143. arg_msg = "因网络或其它原因导致建立单据操作失败"+"~n"+sqlca.SQLErrText
  144. Goto ext
  145. End If
  146. uo_billid = ll_billid
  147. uo_billcode = ls_billcode
  148. Else
  149. Update u_saletask_altermtrl
  150. Set billdate = :arg_s_altermtrl.billdate,
  151. rep = :arg_s_altermtrl.rep,
  152. dscrp = :arg_s_altermtrl.dscrp,
  153. relcode = :arg_s_altermtrl.relcode,
  154. moddate = getdate(),
  155. modemp = :arg_opemp
  156. Where billid = :arg_s_altermtrl.billid
  157. And flag = 0 ;
  158. If sqlca.SQLCode <> 0 Or sqlca.SQLNRows <= 0 Then
  159. rslt = 0
  160. arg_msg = "因网络或其它原因导致更新单据操作失败"+"~n"+sqlca.SQLErrText
  161. Goto ext
  162. End If
  163. Delete From u_saletask_altermtrl_mx
  164. Where billid = :arg_s_altermtrl.billid;
  165. If sqlca.SQLCode <> 0 Then
  166. rslt = 0
  167. arg_msg = "删除旧有明细操作失败"+"~n"+sqlca.SQLErrText
  168. Goto ext
  169. End If
  170. uo_billid = arg_s_altermtrl.billid
  171. End If
  172. For i = 1 To it_mxbt
  173. Insert Into u_saletask_altermtrl_mx
  174. (scid,
  175. billid,
  176. printid,
  177. taskid,
  178. taskprintid,
  179. taskcode,
  180. cusid,
  181. mtrlid_ori,
  182. mtrlid_new,
  183. status_ori,
  184. status_new,
  185. woodcode_ori,
  186. woodcode_new,
  187. pcode_ori,
  188. pcode_new,
  189. enprice_ori,
  190. enprice_new,
  191. mxdscrp)
  192. Values
  193. (:arg_s_altermtrl.scid,
  194. :uo_billid,
  195. :arg_s_altermtrl.arg_s_mx[i].printid,
  196. :arg_s_altermtrl.arg_s_mx[i].taskid,
  197. :arg_s_altermtrl.arg_s_mx[i].taskprintid,
  198. :arg_s_altermtrl.arg_s_mx[i].taskcode,
  199. :arg_s_altermtrl.arg_s_mx[i].cusid,
  200. :arg_s_altermtrl.arg_s_mx[i].mtrlid_ori,
  201. :arg_s_altermtrl.arg_s_mx[i].mtrlid_new,
  202. :arg_s_altermtrl.arg_s_mx[i].status_ori,
  203. :arg_s_altermtrl.arg_s_mx[i].status_new,
  204. :arg_s_altermtrl.arg_s_mx[i].woodcode_ori,
  205. :arg_s_altermtrl.arg_s_mx[i].woodcode_new,
  206. :arg_s_altermtrl.arg_s_mx[i].pcode_ori,
  207. :arg_s_altermtrl.arg_s_mx[i].pcode_new,
  208. :arg_s_altermtrl.arg_s_mx[i].enprice_ori,
  209. :arg_s_altermtrl.arg_s_mx[i].enprice_new,
  210. :arg_s_altermtrl.arg_s_mx[i].mxdscrp);
  211. If sqlca.SQLCode <> 0 Then
  212. uo_billid = arg_s_altermtrl.billid
  213. rslt = 0
  214. arg_msg = "因网络或其它原因导致插入明细操作失败"+"~n"+sqlca.SQLErrText
  215. Goto ext
  216. End If
  217. Next
  218. ext:
  219. If rslt = 0 Then
  220. Rollback;
  221. ElseIf arg_ifcommit And rslt = 1 Then
  222. Commit;
  223. End If
  224. Return rslt
  225. end function
  226. public function integer del (long arg_billid, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
  227. Int li_flag,li_priceflag
  228. IF arg_billid <= 0 THEN
  229. rslt = 0
  230. arg_msg = '错误单据唯一码'
  231. GOTO ext
  232. END IF
  233. IF p_getflag(arg_billid,li_flag,arg_msg) = 0 THEN
  234. rslt = 0
  235. GOTO ext
  236. END IF
  237. IF li_flag = 1 THEN
  238. rslt = 0
  239. arg_msg = '单据不是在待审状态,不可以删除'
  240. GOTO ext
  241. END IF
  242. DELETE FROM u_saletask_altermtrl
  243. WHERE billid = :arg_billid;
  244. IF sqlca.SQLCode <> 0 THEN
  245. rslt = 0
  246. arg_msg = "删除单据操作失败"+"~n"+sqlca.SQLErrText
  247. GOTO ext
  248. END IF
  249. DELETE FROM u_saletask_altermtrl_mx
  250. WHERE billid = :arg_billid;
  251. IF sqlca.SQLCode <> 0 THEN
  252. rslt = 0
  253. arg_msg = "删除单据明细操作失败"+"~n"+sqlca.SQLErrText
  254. GOTO ext
  255. END IF
  256. ext:
  257. IF rslt = 0 THEN
  258. ROLLBACK;
  259. ELSEIF rslt = 1 AND arg_ifcommit THEN
  260. COMMIT;
  261. END IF
  262. RETURN rslt
  263. end function
  264. public function integer getinfo (long arg_billid, ref s_saletask_altermtrl_mx arg_ref_mx[], ref long arg_arr_cnt, ref string arg_msg);Int rslt = 1
  265. Long i = 1,no_mxcheck = 0
  266. If arg_billid <= 0 Then
  267. rslt = 0
  268. arg_msg = '错误单据唯一码'
  269. Goto ext
  270. End If
  271. //用游标读取明细
  272. Declare cur_mx Cursor For
  273. Select scid,
  274. printid,
  275. taskid,
  276. taskprintid,
  277. taskcode,
  278. cusid,
  279. mtrlid_ori,
  280. mtrlid_new,
  281. status_ori,
  282. status_new,
  283. woodcode_ori,
  284. woodcode_new,
  285. pcode_ori,
  286. pcode_new,
  287. enprice_ori,
  288. enprice_new,
  289. mxdscrp
  290. From u_saletask_altermtrl_mx
  291. Where u_saletask_altermtrl_mx.billid = :arg_billid
  292. Order By u_saletask_altermtrl_mx.printid;
  293. Open cur_mx;
  294. Fetch cur_mx Into
  295. :arg_ref_mx[i].scid,
  296. :arg_ref_mx[i].printid,
  297. :arg_ref_mx[i].taskid,
  298. :arg_ref_mx[i].taskprintid,
  299. :arg_ref_mx[i].taskcode,
  300. :arg_ref_mx[i].cusid,
  301. :arg_ref_mx[i].mtrlid_ori,
  302. :arg_ref_mx[i].mtrlid_new,
  303. :arg_ref_mx[i].status_ori,
  304. :arg_ref_mx[i].status_new,
  305. :arg_ref_mx[i].woodcode_ori,
  306. :arg_ref_mx[i].woodcode_new,
  307. :arg_ref_mx[i].pcode_ori,
  308. :arg_ref_mx[i].pcode_new,
  309. :arg_ref_mx[i].enprice_ori,
  310. :arg_ref_mx[i].enprice_new,
  311. :arg_ref_mx[i].mxdscrp;
  312. Do While sqlca.SQLCode = 0
  313. i++
  314. Fetch cur_mx Into
  315. :arg_ref_mx[i].scid,
  316. :arg_ref_mx[i].printid,
  317. :arg_ref_mx[i].taskid,
  318. :arg_ref_mx[i].taskprintid,
  319. :arg_ref_mx[i].taskcode,
  320. :arg_ref_mx[i].cusid,
  321. :arg_ref_mx[i].mtrlid_ori,
  322. :arg_ref_mx[i].mtrlid_new,
  323. :arg_ref_mx[i].status_ori,
  324. :arg_ref_mx[i].status_new,
  325. :arg_ref_mx[i].woodcode_ori,
  326. :arg_ref_mx[i].woodcode_new,
  327. :arg_ref_mx[i].pcode_ori,
  328. :arg_ref_mx[i].pcode_new,
  329. :arg_ref_mx[i].enprice_ori,
  330. :arg_ref_mx[i].enprice_new,
  331. :arg_ref_mx[i].mxdscrp;
  332. Loop
  333. Close cur_mx;
  334. //检验明细是否读入完整
  335. Select count(*) Into :no_mxcheck
  336. From u_saletask_altermtrl_mx
  337. Where billid = :arg_billid;
  338. If sqlca.SQLCode <> 0 Then
  339. rslt = 0
  340. arg_msg = "查询操作失败,单据明细数量"
  341. Goto ext
  342. End If
  343. If i <> (no_mxcheck + 1) Then
  344. rslt = 0
  345. arg_msg = "查询操作失败,单据明细"
  346. Goto ext
  347. End If
  348. arg_arr_cnt = i - 1
  349. ext:
  350. Return rslt
  351. end function
  352. public function integer audit (long arg_billid, string arg_opemp, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
  353. Int li_flag
  354. Long ll_arr_cnt
  355. Long ll_i
  356. If uo_option_m_msttake = -1000 Then
  357. arg_msg = '选项:[045]系统使用多币种应收帐,读取初始默认值失败,操作取消!'
  358. rslt = 0
  359. Goto ext
  360. End If
  361. If uo_option_price_rmb = -1000 Then
  362. arg_msg = '选项:[238]销售单价按人民币单价折算,读取初始默认值失败,操作取消!'
  363. rslt = 0
  364. Goto ext
  365. End If
  366. s_saletask_altermtrl_mx s_ref_mx[]
  367. If arg_billid <= 0 Then
  368. rslt = 0
  369. arg_msg = '错误单据唯一码'
  370. Goto ext
  371. End If
  372. If p_getflag(arg_billid,li_flag,arg_msg) = 0 Then
  373. rslt = 0
  374. Goto ext
  375. End If
  376. If li_flag <> 0 Then
  377. rslt = 0
  378. arg_msg = '单据不是在待审核状态,不可以审核'
  379. Goto ext
  380. End If
  381. If getinfo(arg_billid,s_ref_mx,ll_arr_cnt,arg_msg) = 0 Then
  382. rslt = 0
  383. Goto ext
  384. End If
  385. Decimal mrate,msttakeamt,saleqty,rebate
  386. Decimal msttakeamt_new,fprice_new,enacprice_new,price_new
  387. decimal consignedQty
  388. Long cnt
  389. For ll_i = 1 To ll_arr_cnt
  390. //查询是否已排产
  391. cnt = 0
  392. Select count(*)
  393. Into :cnt
  394. From u_order_ml_mx
  395. Where scid = :s_ref_mx[ll_i].scid
  396. And taskid = :s_ref_mx[ll_i].taskid
  397. And taskmxid = :s_ref_mx[ll_i].taskprintid;
  398. If sqlca.SQLCode <> 0 Then
  399. rslt = 0
  400. arg_msg = '第'+String(ll_i)+'行,查询订单明细是否已排产失败 '+sqlca.SQLErrText
  401. Goto ext
  402. End If
  403. If cnt > 0 Then
  404. rslt = 0
  405. arg_msg = '第'+String(ll_i)+'行,订单明细已排产,不能变更'
  406. Goto ext
  407. End If
  408. //查询是否有库存分配
  409. cnt = 0
  410. Select count(*)
  411. Into :cnt
  412. From u_mtrlware_assign
  413. Where u_mtrlware_assign.Scid = :s_ref_mx[ll_i].scid And
  414. u_mtrlware_assign.Relbillid = :s_ref_mx[ll_i].taskid And
  415. u_mtrlware_assign.Relprintid = :s_ref_mx[ll_i].taskprintid And
  416. u_mtrlware_assign.assigntype = 1;
  417. If sqlca.SQLCode <> 0 Then
  418. rslt = 0
  419. arg_msg = '第'+String(ll_i)+'行,查询订单明细是否已有库存分配失败 '+sqlca.SQLErrText
  420. Goto ext
  421. End If
  422. If cnt > 0 Then
  423. rslt = 0
  424. arg_msg = '第'+String(ll_i)+'行,订单明细有库存分配,不能变更'
  425. Goto ext
  426. End If
  427. Select u_SaleTask.mrate,
  428. u_SaleTask.msttakeamt,
  429. u_SaleTaskMx.SaleQty,
  430. u_SaleTaskMx.rebate,
  431. u_SaleTaskMx.consignedQty
  432. Into :mrate,
  433. :msttakeamt,
  434. :saleqty,
  435. :rebate,
  436. :consignedQty
  437. From u_SaleTaskMx Inner JOIN
  438. u_SaleTask ON u_SaleTaskMx.scid = u_SaleTask.scid And
  439. u_SaleTaskMx.TaskID = u_SaleTask.TaskID
  440. Where u_SaleTaskMx.scid = :s_ref_mx[ll_i].scid
  441. And u_SaleTaskMx.taskid = :s_ref_mx[ll_i].taskid
  442. And u_SaleTaskMx.printid = :s_ref_mx[ll_i].taskprintid;
  443. If sqlca.SQLCode <> 0 Then
  444. rslt = 0
  445. arg_msg = '第'+String(ll_i)+'行,查询订单明细信息失败 '+sqlca.SQLErrText
  446. Goto ext
  447. End If
  448. if consignedQty > 0 then
  449. rslt = 0
  450. arg_msg = '第'+String(ll_i)+'行,订单明细有已发货数,不能变更'
  451. Goto ext
  452. End If
  453. If uo_option_price_rmb = 0 Then
  454. fprice_new = s_ref_mx[ll_i].enprice_new * mrate
  455. If mrate = 0 Then
  456. enacprice_new = fprice_new * rebate
  457. Else
  458. enacprice_new = fprice_new * rebate / mrate
  459. End If
  460. price_new = fprice_new * rebate
  461. Else
  462. fprice_new = Round(s_ref_mx[ll_i].enprice_new * mrate,2)
  463. If mrate = 0 Then
  464. enacprice_new = Round(fprice_new * rebate,2)
  465. Else
  466. enacprice_new = Round(fprice_new * rebate / mrate,2)
  467. End If
  468. price_new = Round(fprice_new * rebate,2)
  469. End If
  470. Update u_saletaskmx
  471. Set mtrlid = :s_ref_mx[ll_i].mtrlid_new,
  472. status = :s_ref_mx[ll_i].status_new,
  473. woodcode = :s_ref_mx[ll_i].woodcode_new,
  474. pcode = :s_ref_mx[ll_i].pcode_new,
  475. enprice = :s_ref_mx[ll_i].enprice_new,
  476. fprice = :fprice_new,
  477. price = :price_new,
  478. enacprice = :enacprice_new
  479. Where scid = :s_ref_mx[ll_i].scid
  480. And taskid = :s_ref_mx[ll_i].taskid
  481. And printid = :s_ref_mx[ll_i].taskprintid;
  482. If sqlca.SQLCode <> 0 Then
  483. rslt = 0
  484. arg_msg = '第'+String(ll_i)+'行,更新订单明细信息失败 '+sqlca.SQLErrText
  485. Goto ext
  486. End If
  487. If uo_option_m_msttake = 1 Then //使用多币种
  488. msttakeamt_new = msttakeamt + Round((s_ref_mx[ll_i].enprice_new - s_ref_mx[ll_i].enprice_ori) * saleqty * rebate,2)
  489. Else // 系统不使用多币种,转换为人民币
  490. msttakeamt_new = msttakeamt + Round((s_ref_mx[ll_i].enprice_new - s_ref_mx[ll_i].enprice_ori) * mrate * saleqty * rebate,2)
  491. End If
  492. Update u_saletask
  493. Set msttakeamt = :msttakeamt_new
  494. Where scid = :s_ref_mx[ll_i].scid
  495. And taskid = :s_ref_mx[ll_i].taskid;
  496. If sqlca.SQLCode <> 0 Then
  497. rslt = 0
  498. arg_msg = '第'+String(ll_i)+'行,更新订单应收金额失败 '+sqlca.SQLErrText
  499. Goto ext
  500. End If
  501. Next
  502. //更新审核标记
  503. Update u_saletask_altermtrl
  504. Set auditemp = :arg_opemp,
  505. auditdate = getdate(),
  506. flag = 1
  507. Where billid = :arg_billid
  508. And flag = 0;
  509. If sqlca.SQLCode <> 0 Then
  510. rslt = 0
  511. arg_msg = "因网络或其它原因导致单据审核操作失败"+"~n"+sqlca.SQLErrText
  512. Goto ext
  513. ElseIf sqlca.SQLNRows = 0 Then
  514. rslt = 0
  515. arg_msg = "单据正在审核,请稍后查询。"+"~n"+sqlca.SQLErrText
  516. Goto ext
  517. End If
  518. ext:
  519. If rslt = 0 Then
  520. Rollback;
  521. ElseIf rslt = 1 And arg_ifcommit Then
  522. Commit;
  523. End If
  524. Return rslt
  525. end function
  526. public function integer add_dscrp (long arg_billid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
  527. Int li_flag
  528. IF arg_newdescppart = '' THEN
  529. rslt = 0
  530. arG_MSG = "要添加内容为空,操作取消"
  531. GOTO ext
  532. END IF
  533. IF p_getflag(arg_billid,li_flag,arG_MSG) = 0 THEN
  534. rslt = 0
  535. GOTO ext
  536. END IF
  537. IF li_flag = 0 THEN
  538. rslt = 0
  539. arG_MSG = "待审核状态下不可用"
  540. GOTO ext
  541. END IF
  542. UPDATE u_saletask_altermtrl
  543. SET DSCRP = DSCRP+' '+:arg_newdescppart
  544. WHERE u_saletask_altermtrl.billid = :arg_billid;
  545. IF SQLCA.SQLCode <> 0 THEN
  546. rslt = 0
  547. arG_MSG = "因网络或其它原因导致添加备注操作失败"+"~n"+SQLCA.SQLErrText
  548. GOTO ext
  549. END IF
  550. ext:
  551. IF rslt = 0 THEN
  552. ROLLBACK;
  553. ELSEIF rslt = 1 AND arg_ifcommit THEN
  554. COMMIT;
  555. END IF
  556. Return (rslt)
  557. end function
  558. on uo_saletask_altermtrl.create
  559. call super::create
  560. TriggerEvent( this, "constructor" )
  561. end on
  562. on uo_saletask_altermtrl.destroy
  563. TriggerEvent( this, "destructor" )
  564. call super::destroy
  565. end on