uo_oppose.sru 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455
  1. $PBExportHeader$uo_oppose.sru
  2. forward
  3. global type uo_oppose from nonvisualobject
  4. end type
  5. type s_opposemx_mtrl from structure within uo_oppose
  6. end type
  7. type s_opposemx_dept from structure within uo_oppose
  8. end type
  9. end forward
  10. type s_opposemx_mtrl from structure
  11. long mtrlid
  12. string status
  13. decimal { 10 } qty
  14. string mxdscrp
  15. string status_mode
  16. string woodcode
  17. string pcode
  18. end type
  19. type s_opposemx_dept from structure
  20. long deptid
  21. string wkpname
  22. string productieda
  23. end type
  24. global type uo_oppose from nonvisualobject
  25. end type
  26. global uo_oppose uo_oppose
  27. type variables
  28. public protectedwrite long billid
  29. public protectedwrite string billcode
  30. public protectedwrite int billtype
  31. public protectedwrite datetime opdate
  32. public protectedwrite string opemp
  33. public protectedwrite datetime moddate
  34. public protectedwrite string modemp
  35. public protectedwrite int flag
  36. public protectedwrite datetime auditingdate
  37. public protectedwrite string auditingrep
  38. public protectedwrite int secflag
  39. long relid
  40. datetime billdate
  41. string opposedept
  42. datetime thdate
  43. datetime fhdate
  44. string threason
  45. string custdscrp
  46. string saleidea
  47. string productieda
  48. string qualityidea
  49. string manageridea
  50. string improveidea
  51. string wkpdscrp
  52. decimal opposeamt
  53. decimal selfamt
  54. long itemid
  55. string opposetype
  56. string dealdscrp
  57. string relcode
  58. boolean if_getid_ture=true
  59. transaction commit_transaction
  60. private:
  61. long it_mxbt=0
  62. s_opposemx_mtrl opposemx_mtrl[]
  63. long it_depmxbt=0
  64. s_opposemx_dept opposemx_dept[]
  65. boolean it_newbegin=false
  66. boolean it_updatebegin=false
  67. end variables
  68. forward prototypes
  69. public function integer save (boolean arg_ifcommit, ref string arg_msg)
  70. public function integer p_clearmx ()
  71. public function integer p_reset ()
  72. public function integer getinfo (long arg_scid, long arg_billid, ref string arg_msg)
  73. public function integer updatebegin (long arg_billid, ref string arg_msg)
  74. public function integer p_getinfo (long arg_billid, ref string arg_msg)
  75. public function integer del (long arg_billid, ref string arg_msg, boolean arg_ifcommit)
  76. public function integer auditing (long arg_billid, boolean arg_ifcommit, ref string arg_msg)
  77. public function integer c_auditing (long arg_billid, boolean arg_ifcommit, ref string arg_msg)
  78. public function integer newbegin (integer arg_billtype, ref string arg_msg)
  79. public function integer add_qualityidea (long arg_billid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit)
  80. public function integer add_manageridea (long arg_billid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit)
  81. public function integer add_improveidea (long arg_billid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit)
  82. public function integer add_productieda (long arg_billid, long arg_deptid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit)
  83. public function integer secauditing (long arg_billid, boolean arg_ifcommit, ref string arg_msg)
  84. public function integer c_secauditing (long arg_billid, boolean arg_ifcommit, ref string arg_msg)
  85. public function long acceptdeptid (long arg_deptid, string arg_productieda, ref string arg_msg)
  86. public function integer acceptmx (long arg_mtrlid, string arg_status, decimal arg_qty, string arg_status_mode, string arg_woodcode, string arg_pcode, string arg_mxdscrp, ref string arg_msg)
  87. public function integer update_saleamt (long arg_billid, decimal arg_opposeamt, decimal arg_selfamt, ref string arg_msg, boolean arg_ifcommit)
  88. end prototypes
  89. public function integer save (boolean arg_ifcommit, ref string arg_msg);Integer rslt = 1
  90. Long cnt = 0,i,ll_i
  91. DateTime server_dt
  92. Long ls_newid
  93. String ls_wkpdscrp,ls_opposedept
  94. IF IsNull(opposedept) THEN opposedept = ""
  95. IF IsNull(threason) THEN threason = ""
  96. IF IsNull(custdscrp) THEN custdscrp = ""
  97. IF IsNull(saleidea) THEN saleidea = ""
  98. IF IsNull(productieda) THEN productieda = ""
  99. IF IsNull(manageridea) THEN manageridea = ""
  100. IF IsNull(qualityidea) THEN qualityidea = ""
  101. IF IsNull(relid) THEN relid = 0
  102. IF IsNull(opposeamt) THEN opposeamt = 0
  103. IF IsNull(itemid) THEN itemid = 0
  104. IF IsNull(opposetype) THEN opposetype = ""
  105. IF IsNull(dealdscrp) THEN dealdscrp = ""
  106. IF IsNull(selfamt) THEN selfamt = 0
  107. IF IsNull(relcode) THEN relcode = ''
  108. IF it_newbegin = FALSE AND it_updatebegin = FALSE THEN
  109. rslt = 0
  110. arg_msg = "非编辑状态不可以提交"
  111. GOTO ext
  112. END IF
  113. SELECT Top 1 getdate() INTO :server_dt FROM u_user USING commit_transaction ;
  114. IF commit_transaction.SQLCode <> 0 THEN
  115. rslt = 0
  116. arg_msg = "查询操作失败,日期 "
  117. GOTO ext
  118. END IF
  119. ////2015-03-30 取消限制 (youshi)
  120. //IF selfamt > opposeamt THEN
  121. // rslt = 0
  122. // arg_msg = '个人金额不能大于总金额'
  123. // GOTO ext
  124. //END IF
  125. SELECT count(*) INTO :cnt
  126. FROM u_oppose_item
  127. Where itemid = :itemid;
  128. IF sqlca.SQLCode <> 0 THEN
  129. arg_msg = '查询投拆项目资料失败'
  130. rslt = 0
  131. GOTO ext
  132. END IF
  133. IF cnt = 0 THEN
  134. arg_msg = '系统不存在项目资料'
  135. rslt = 0
  136. GOTO ext
  137. END IF
  138. IF billtype = 0 OR billtype = 2 THEN
  139. IF billtype = 0 THEN
  140. IF opposedept = '' THEN
  141. arg_msg = '请输入投诉部门'
  142. rslt = 0
  143. GOTO ext
  144. END IF
  145. ELSE
  146. SELECT name INTO :ls_opposedept
  147. FROM u_cust
  148. Where cusid = :relid USING commit_transaction;
  149. IF commit_transaction.SQLCode <> 0 THEN
  150. arg_msg = '查询客户资料失败,可能客户资料不存在'
  151. rslt = 0
  152. GOTO ext
  153. END IF
  154. opposedept = ls_opposedept
  155. END IF
  156. IF it_mxbt = 0 THEN //如果输入物料资料错则已经清空
  157. rslt = 0
  158. arg_msg = "没有正确产品明细内容"
  159. GOTO ext
  160. END IF
  161. IF it_depmxbt = 0 THEN //如果输入物料资料错则已经清空
  162. rslt = 0
  163. arg_msg = "没有正确部门明细内容"
  164. GOTO ext
  165. END IF
  166. //***************************
  167. FOR ll_i = 1 TO it_depmxbt
  168. ls_wkpdscrp = ls_wkpdscrp + opposemx_dept[ll_i].wkpname +','
  169. NEXT
  170. IF Len(ls_wkpdscrp) > 0 THEN
  171. ls_wkpdscrp = Left(ls_wkpdscrp,Len(ls_wkpdscrp) - 1)
  172. END IF
  173. //****************************
  174. ELSE
  175. cnt = 0
  176. SELECT count(*) INTO :cnt
  177. FROM u_spt
  178. Where sptid = :relid USING commit_transaction ;
  179. IF commit_transaction.SQLCode <> 0 OR cnt = 0 THEN
  180. arg_msg = '查询供应商资料失败,可能供应商资料不存在'
  181. rslt = 0
  182. GOTO ext
  183. END IF
  184. IF cnt <> 1 THEN
  185. arg_msg = '供应商资料不存在或重复,请检查'
  186. rslt = 0
  187. GOTO ext
  188. END IF
  189. END IF
  190. IF billtype <> 2 THEN
  191. IF f_check_inoutdate(0,billdate,FALSE,arg_msg) = 0 THEN
  192. rslt = 0
  193. GOTO ext
  194. END IF
  195. END IF
  196. ////////////////////////////////////////////// //开始区分:新建/更新 处理
  197. IF billid = 0 THEN //新建
  198. ls_newid = f_sys_scidentity(0,"u_oppose","billid",arg_msg,TRUE,id_sqlca)
  199. IF ls_newid <= 0 THEN
  200. rslt = 0
  201. GOTO ext
  202. END IF
  203. //取得新单据编号
  204. IF billtype = 0 THEN
  205. billcode = getid(0,'TS',Date(server_dt),if_getid_ture,commit_transaction)
  206. ELSEIF billtype = 1 THEN
  207. billcode = getid(0,'SS',Date(server_dt),if_getid_ture,commit_transaction)
  208. ELSEIF billtype = 2 THEN
  209. billcode = getid(0,'CS',Date(server_dt),if_getid_ture,commit_transaction)
  210. END IF
  211. IF billcode = "err" THEN
  212. billcode = ''
  213. rslt = 0
  214. arg_msg = "无法获取单据编号"+"~n"+commit_transaction.SQLErrText
  215. GOTO ext
  216. END IF
  217. INSERT INTO u_oppose(billid,
  218. billdate,
  219. opposedept,
  220. thdate,
  221. fhdate,
  222. threason,
  223. custdscrp,
  224. saleidea,
  225. productieda,
  226. qualityidea,
  227. manageridea,
  228. improveidea,
  229. billcode,
  230. opdate,
  231. opemp,
  232. billtype,
  233. relid,
  234. wkpdscrp,
  235. opposeamt,
  236. itemid,
  237. opposetype,
  238. dealdscrp,
  239. selfamt,
  240. relcode
  241. )
  242. VALUES(:ls_newid,
  243. :billdate,
  244. :opposedept,
  245. :thdate,
  246. :fhdate,
  247. :threason,
  248. :custdscrp,
  249. :saleidea,
  250. :productieda,
  251. :qualityidea,
  252. :manageridea,
  253. :improveidea,
  254. :billcode,
  255. getdate(),
  256. :publ_operator,
  257. :billtype,
  258. :relid,
  259. :ls_wkpdscrp,
  260. :opposeamt,
  261. :itemid,
  262. :opposetype,
  263. :dealdscrp,
  264. :selfamt,
  265. :relcode
  266. ) USING commit_transaction ;
  267. IF commit_transaction.SQLCode <> 0 THEN
  268. rslt = 0
  269. arg_msg = "因网络或其它原因导致插入操作失败"+"~n"+commit_transaction.SQLErrText
  270. GOTO ext
  271. END IF
  272. FOR i = 1 TO it_depmxbt
  273. INSERT INTO u_opposemx_dept(deptid,
  274. billid,
  275. productieda,
  276. opemp,
  277. opdate)
  278. Values (:opposemx_dept[i].deptid,
  279. :ls_newid,
  280. :opposemx_dept[i].productieda,
  281. :publ_operator,
  282. getdate()) USING commit_transaction ;
  283. IF commit_transaction.SQLCode <> 0 THEN
  284. billid = 0
  285. rslt = 0
  286. arg_msg = "因网络或其它原因导致插入操作失败"+"~n"+commit_transaction.SQLErrText
  287. GOTO ext
  288. END IF
  289. NEXT
  290. //读取新inwareid
  291. billid = ls_newid
  292. FOR i = 1 TO it_mxbt
  293. INSERT INTO u_opposemx_mtrl(
  294. mtrlid,
  295. status,
  296. qty,
  297. mxdscrp ,
  298. billid,
  299. status_mode,
  300. woodcode,
  301. pcode)
  302. VALUES ( :opposemx_mtrl[i].mtrlid,
  303. :opposemx_mtrl[i].status,
  304. :opposemx_mtrl[i].qty,
  305. :opposemx_mtrl[i].mxdscrp,
  306. :ls_newid,
  307. :opposemx_mtrl[i].status_mode,
  308. :opposemx_mtrl[i].woodcode,
  309. :opposemx_mtrl[i].pcode
  310. ) USING commit_transaction;
  311. IF commit_transaction.SQLCode <> 0 THEN
  312. billid = 0 //还原inwareid
  313. rslt = 0
  314. arg_msg = "因网络或其它原因导致插入明细操作失败"+"~n"+commit_transaction.SQLErrText
  315. GOTO ext
  316. END IF
  317. NEXT
  318. ELSE //////////////////////////////////////////////// //更新
  319. UPDATE u_oppose
  320. SET billid = :billid,
  321. billdate = :billdate,
  322. opposedept = :opposedept,
  323. thdate = :thdate,
  324. fhdate = :fhdate,
  325. threason = :threason,
  326. custdscrp = :custdscrp,
  327. saleidea = :saleidea,
  328. productieda = :productieda,
  329. qualityidea = :qualityidea,
  330. manageridea = :manageridea,
  331. improveidea = :improveidea,
  332. billcode = :billcode,
  333. moddate = getdate(),
  334. modemp = :publ_operator,
  335. relid = :relid,
  336. wkpdscrp = :ls_wkpdscrp,
  337. opposeamt = :opposeamt,
  338. itemid = :itemid,
  339. opposetype = :opposetype,
  340. dealdscrp = :dealdscrp,
  341. selfamt = :selfamt,
  342. relcode = :relcode
  343. WHERE u_oppose.billid = :billid
  344. AND flag = 0 USING commit_transaction;
  345. IF commit_transaction.SQLCode <> 0 OR commit_transaction.SQLNRows <= 0 THEN
  346. rslt = 0
  347. arg_msg = "因网络或其它原因导致更新单据操作失败"+"~n"+commit_transaction.SQLErrText
  348. GOTO ext
  349. END IF
  350. //删除原有明细
  351. DELETE FROM u_opposemx_dept
  352. Where u_opposemx_dept.billid = :billid USING commit_transaction;
  353. IF commit_transaction.SQLCode <> 0 THEN
  354. rslt = 0
  355. arg_msg = "删除旧有明细操作失败"+"~n"+commit_transaction.SQLErrText
  356. GOTO ext
  357. END IF
  358. FOR i = 1 TO it_depmxbt
  359. INSERT INTO u_opposemx_dept(deptid,
  360. productieda,
  361. billid,
  362. opemp,
  363. opdate)
  364. Values (:opposemx_dept[i].deptid,
  365. :opposemx_dept[i].productieda,
  366. :billid,:publ_operator,getdate()) USING commit_transaction ;
  367. IF commit_transaction.SQLCode <> 0 THEN
  368. rslt = 0
  369. arg_msg = "因网络或其它原因导致插入操作失败"+"~n"+commit_transaction.SQLErrText
  370. GOTO ext
  371. END IF
  372. NEXT
  373. //删除原有明细
  374. DELETE FROM u_opposemx_mtrl
  375. Where u_opposemx_mtrl.billid = :billid USING commit_transaction;
  376. IF commit_transaction.SQLCode <> 0 THEN
  377. rslt = 0
  378. arg_msg = "删除旧有明细操作失败"+"~n"+commit_transaction.SQLErrText
  379. GOTO ext
  380. END IF
  381. FOR i = 1 TO it_mxbt
  382. INSERT INTO u_opposemx_mtrl(
  383. mtrlid,
  384. status,
  385. qty,
  386. mxdscrp ,
  387. billid,
  388. status_mode,
  389. woodcode,
  390. pcode)
  391. VALUES ( :opposemx_mtrl[i].mtrlid,
  392. :opposemx_mtrl[i].status,
  393. :opposemx_mtrl[i].qty,
  394. :opposemx_mtrl[i].mxdscrp,
  395. :billid,
  396. :opposemx_mtrl[i].status_mode,
  397. :opposemx_mtrl[i].woodcode,
  398. :opposemx_mtrl[i].pcode
  399. ) USING commit_transaction;
  400. IF commit_transaction.SQLCode <> 0 THEN
  401. rslt = 0
  402. arg_msg = "因网络或其它原因导致插入明细操作失败"+"~n"+commit_transaction.SQLErrText
  403. GOTO ext
  404. END IF
  405. NEXT
  406. END IF
  407. it_newbegin = FALSE
  408. it_updatebegin = FALSE
  409. ext:
  410. IF rslt = 0 THEN
  411. ROLLBACK USING commit_transaction;
  412. p_clearmx()
  413. ELSEIF rslt = 1 AND arg_ifcommit THEN
  414. COMMIT USING commit_transaction;
  415. END IF
  416. RETURN rslt
  417. end function
  418. public function integer p_clearmx ();//int p_clearmx()
  419. //清除明细
  420. it_mxbt=0
  421. it_depmxbt=0
  422. return 1
  423. end function
  424. public function integer p_reset ();//int p_reset()
  425. //清除对象及其明细
  426. billid = 0
  427. billcode = ''
  428. opemp = ''
  429. modemp = ''
  430. auditingrep = ''
  431. flag = 0
  432. opposedept = ''
  433. threason = ''
  434. custdscrp = ''
  435. saleidea = ''
  436. productieda = ''
  437. qualityidea = ''
  438. manageridea = ''
  439. improveidea = ''
  440. opposeamt = 0
  441. itemid = 0
  442. opposetype = ''
  443. dealdscrp = ''
  444. it_newbegin = false
  445. it_updatebegin = false
  446. //清除明细
  447. p_clearmx()
  448. return 1
  449. end function
  450. public function integer getinfo (long arg_scid, long arg_billid, ref string arg_msg);Int rslt = 1
  451. Long i = 1,no_mxcheck = 0,j = 1
  452. IF arg_billid <= 0 THEN
  453. rslt = 0
  454. arg_msg = "非法单据唯一码"
  455. GOTO ext
  456. END IF
  457. rslt = p_getinfo(arg_billid,arg_msg)
  458. IF rslt = 0 THEN GOTO ext
  459. //用游标读取明细
  460. DECLARE cur_inwaermx CURSOR FOR
  461. SELECT u_opposemx_mtrl.mtrlid,
  462. u_opposemx_mtrl.status,
  463. u_opposemx_mtrl.qty,
  464. u_opposemx_mtrl.mxdscrp,
  465. u_opposemx_mtrl.status_mode,
  466. u_opposemx_mtrl.woodcode,
  467. u_opposemx_mtrl.pcode
  468. FROM u_opposemx_mtrl
  469. Where u_opposemx_mtrl.billid = :arg_billid Using commit_transaction;
  470. OPEN cur_inwaermx;
  471. FETCH cur_inwaermx INTO :opposemx_mtrl[i].mtrlid,
  472. :opposemx_mtrl[i].status,:opposemx_mtrl[i].qty ,
  473. :opposemx_mtrl[i].mxdscrp ,:opposemx_mtrl[i].status_mode,
  474. :opposemx_mtrl[i].woodcode,:opposemx_mtrl[i].pcode;
  475. DO WHILE commit_transaction.SQLCode = 0
  476. i++
  477. FETCH cur_inwaermx INTO :opposemx_mtrl[i].mtrlid,
  478. :opposemx_mtrl[i].status,:opposemx_mtrl[i].qty ,
  479. :opposemx_mtrl[i].mxdscrp ,:opposemx_mtrl[i].status_mode,
  480. :opposemx_mtrl[i].woodcode,:opposemx_mtrl[i].pcode;
  481. LOOP
  482. CLOSE cur_inwaermx;
  483. //检验明细是否读入完整
  484. SELECT count(*) INTO :no_mxcheck
  485. FROM u_opposemx_mtrl
  486. WHERE u_opposemx_mtrl.billid = :arg_billid
  487. Using commit_transaction;
  488. IF commit_transaction.SQLCode <> 0 THEN
  489. rslt = 0
  490. arg_msg = "查询操作失败,进仓单明细数量"
  491. GOTO ext
  492. END IF
  493. IF i <> (no_mxcheck+1) THEN
  494. rslt = 0
  495. arg_msg = "查询操作失败,投诉单产品明细"
  496. GOTO ext
  497. END IF
  498. //用游标读取明细
  499. DECLARE cur_depmx CURSOR FOR
  500. SELECT u_opposemx_dept.deptid
  501. FROM u_opposemx_dept
  502. Where u_opposemx_dept.billid = :arg_billid Using commit_transaction;
  503. OPEN cur_depmx;
  504. FETCH cur_depmx Into :opposemx_dept[i].deptid ;
  505. DO WHILE commit_transaction.SQLCode = 0
  506. j++
  507. FETCH cur_depmx Into :opposemx_dept[i].deptid ;
  508. LOOP
  509. CLOSE cur_depmx;
  510. //检验明细是否读入完整
  511. SELECT count(*) INTO :no_mxcheck
  512. FROM u_opposemx_dept
  513. WHERE u_opposemx_dept.billid = :arg_billid
  514. Using commit_transaction;
  515. IF commit_transaction.SQLCode <> 0 THEN
  516. rslt = 0
  517. arg_msg = "查询操作失败,投诉单部门明细"
  518. GOTO ext
  519. END IF
  520. IF j <> (no_mxcheck+1) THEN
  521. rslt = 0
  522. arg_msg = "查询操作失败,进仓单明细"
  523. GOTO ext
  524. END IF
  525. billid = arg_billid
  526. it_mxbt = i - 1
  527. it_depmxbt = j - 1
  528. it_newbegin = False
  529. it_updatebegin = False
  530. ext:
  531. IF rslt = 0 THEN p_reset()
  532. RETURN rslt
  533. end function
  534. public function integer updatebegin (long arg_billid, ref string arg_msg);long rslt = 1
  535. if arg_billid <= 0 then
  536. rslt = 0
  537. goto ext
  538. end if
  539. rslt = p_getinfo(arg_billid,arg_msg)
  540. if rslt = 0 then goto ext
  541. if flag = 1 then
  542. rslt = 0
  543. arg_msg = '单据已经审核,不可以修改'
  544. goto ext
  545. end if
  546. billid = arg_billid
  547. it_newbegin = false
  548. it_updatebegin = true
  549. p_clearmx() //清除明细
  550. ext:
  551. if rslt = 0 then p_reset()
  552. return rslt
  553. end function
  554. public function integer p_getinfo (long arg_billid, ref string arg_msg);//p_getinfo(arg_scid,arg_inwareid,arg_msg)
  555. //0 失败 1成功
  556. INT rslt=1
  557. IF arg_billid<=0 THEN
  558. rslt=0
  559. arG_MSG="非法单据唯一码"
  560. goto ext
  561. end if
  562. SELECT u_oppose.billid,
  563. u_oppose.billdate,
  564. u_oppose.billtype,
  565. u_oppose.relid,
  566. u_oppose.opposedept,
  567. u_oppose.thdate,
  568. u_oppose.fhdate,
  569. u_oppose.threason,
  570. u_oppose.custdscrp,
  571. u_oppose.saleidea,
  572. u_oppose.productieda,
  573. u_oppose.qualityidea,
  574. u_oppose.manageridea,
  575. u_oppose.improveidea,
  576. u_oppose.billcode,
  577. u_oppose.opdate,
  578. u_oppose.opemp,
  579. u_oppose.moddate,
  580. u_oppose.modemp,
  581. u_oppose.flag,
  582. u_oppose.secflag,
  583. u_oppose.auditdate,
  584. u_oppose.auditemp ,
  585. u_oppose.wkpdscrp,
  586. u_oppose.opposeamt,
  587. u_oppose.selfamt,
  588. u_oppose.itemid,
  589. u_oppose.opposetype,
  590. u_oppose.dealdscrp,
  591. u_oppose.relcode
  592. into :billid,
  593. :billdate,
  594. :billtype,
  595. :relid,
  596. :opposedept,
  597. :thdate,
  598. :fhdate,
  599. :threason,
  600. :custdscrp,
  601. :saleidea,
  602. :productieda,
  603. :qualityidea,
  604. :manageridea,
  605. :improveidea,
  606. :billcode,
  607. :opdate,
  608. :opemp,
  609. :moddate,
  610. :modemp,
  611. :flag,
  612. :secflag,
  613. :auditingdate,
  614. :auditingrep,
  615. :wkpdscrp,
  616. :opposeamt,
  617. :selfamt,
  618. :itemid,
  619. :opposetype,
  620. :dealdscrp,
  621. :relcode
  622. FROM u_oppose
  623. WHERE u_oppose.billid =:arg_billid using commit_transaction;
  624. if commit_transaction.sqlcode<>0 then
  625. rslt=0
  626. arG_MSG="查询操作失败(错误单据唯一码)"+commit_transaction.sqlerrtext
  627. goto ext
  628. end if
  629. billid = arg_billid
  630. ext:
  631. IF rslt=0 THEN p_reset()
  632. return rslt
  633. end function
  634. public function integer del (long arg_billid, ref string arg_msg, boolean arg_ifcommit);
  635. int rslt = 1
  636. if arg_billid = 0 then
  637. rslt = 0
  638. arg_msg = "没有删除对象,操作取消"
  639. goto ext
  640. end if
  641. rslt = p_getinfo(arg_billid,arg_msg)
  642. if rslt = 0 then goto ext
  643. if flag = 1 then
  644. rslt = 0
  645. arg_msg = "单据已经审核,不可以删除"
  646. goto ext
  647. end if
  648. delete from u_opposemx_mtrl
  649. where u_opposemx_mtrl.billid = :arg_billid using commit_transaction;
  650. if commit_transaction.sqlcode <> 0 then
  651. rslt = 0
  652. arg_msg = "删除客户投诉单明细操作失败"+"~n"+commit_transaction.sqlerrtext
  653. goto ext
  654. end if
  655. delete from u_opposemx_dept
  656. where u_opposemx_dept.billid = :arg_billid using commit_transaction;
  657. if commit_transaction.sqlcode <> 0 then
  658. rslt = 0
  659. arg_msg = "删除客户投诉单部门明细操作失败"+"~n"+commit_transaction.sqlerrtext
  660. goto ext
  661. end if
  662. delete from u_oppose
  663. where u_oppose.billid = :arg_billid using commit_transaction;
  664. if commit_transaction.sqlcode <> 0 then
  665. rslt = 0
  666. arg_msg = "删除客户投诉单操作失败"+"~n"+commit_transaction.sqlerrtext
  667. goto ext
  668. end if
  669. it_newbegin = false
  670. it_updatebegin = false
  671. ext:
  672. if rslt=0 then
  673. rollback using commit_transaction;
  674. elseif rslt=1 and arg_ifcommit then
  675. commit using commit_transaction;
  676. end if
  677. p_reset()
  678. return rslt
  679. end function
  680. public function integer auditing (long arg_billid, boolean arg_ifcommit, ref string arg_msg);Long rslt = 1
  681. IF arg_billid = 0 THEN
  682. rslt = 0
  683. arg_msg = "没有审核对象"
  684. GOTO ext
  685. END IF
  686. IF p_getinfo(arg_billid,arg_msg) = 0 THEN
  687. rslt = 0
  688. GOTO ext
  689. END IF
  690. IF flag = 1 THEN
  691. rslt = 0
  692. arg_msg = "单据已经审核"
  693. GOTO ext
  694. END IF
  695. IF billtype = 2 THEN
  696. UPDATE u_oppose
  697. SET auditemp = :publ_operator,
  698. auditdate = getdate(),
  699. flag = 1
  700. WHERE u_oppose.billid = :billid
  701. AND flag = 0
  702. AND secflag = 0 USING commit_transaction;
  703. ELSE
  704. UPDATE u_oppose
  705. SET auditemp = :publ_operator,
  706. auditdate = getdate(),
  707. flag = 1,
  708. secflag = 1,
  709. secauditdate = getdate(),
  710. secauditemp = :publ_operator
  711. WHERE u_oppose.billid = :billid
  712. AND flag = 0 USING commit_transaction;
  713. END IF
  714. IF commit_transaction.SQLCode <> 0 THEN
  715. rslt = 0
  716. arg_msg = "因网络或其它原因导致审核单据操作失败"+"~n"+commit_transaction.SQLErrText
  717. GOTO ext
  718. ELSEIF commit_transaction.SQLNRows = 0 THEN
  719. rslt = 0
  720. arg_msg = "单据正在审核,请稍后查询。"+"~n"+commit_transaction.SQLErrText
  721. GOTO ext
  722. END IF
  723. flag = 1
  724. ext:
  725. IF rslt = 0 THEN
  726. ROLLBACK USING commit_transaction;
  727. ELSEIF rslt = 1 AND arg_ifcommit THEN
  728. COMMIT USING commit_transaction;
  729. END IF
  730. RETURN rslt
  731. end function
  732. public function integer c_auditing (long arg_billid, boolean arg_ifcommit, ref string arg_msg);Long rslt = 1
  733. DateTime null_dt
  734. SetNull(null_dt)
  735. IF arg_billid = 0 THEN
  736. rslt = 0
  737. arg_msg = "没有审核对象"
  738. GOTO ext
  739. END IF
  740. //IF it_newbegin OR it_updatebegin THEN
  741. // rslt = 0
  742. // arg_msg = "编辑状态下不可以执行审核"
  743. // GOTO ext
  744. //END IF
  745. IF p_getinfo(arg_billid,arg_msg) = 0 THEN
  746. rslt = 0
  747. GOTO ext
  748. END IF
  749. IF flag = 0 THEN
  750. rslt = 0
  751. arg_msg = "单据还未审核"
  752. GOTO ext
  753. END IF
  754. IF billtype = 2 THEN
  755. IF secflag = 1 THEN
  756. rslt = 0
  757. arg_msg = "单据已终审,不能撤审"
  758. GOTO ext
  759. END IF
  760. END IF
  761. IF billtype = 2 THEN
  762. UPDATE u_oppose
  763. SET auditemp = '',
  764. auditdate = :null_dt,
  765. flag = 0
  766. WHERE u_oppose.billid = :billid
  767. AND flag = 1
  768. AND secflag = 0 USING commit_transaction;
  769. ELSE
  770. UPDATE u_oppose
  771. SET auditemp = '',
  772. auditdate = :null_dt,
  773. flag = 0,
  774. secauditemp = '',
  775. secauditdate = :null_dt,
  776. secflag = 0
  777. WHERE u_oppose.billid = :billid
  778. AND flag = 1
  779. AND secflag = 1 USING commit_transaction;
  780. END IF
  781. IF commit_transaction.SQLCode <> 0 THEN
  782. rslt = 0
  783. arg_msg = "因网络或其它原因导致审核单据操作失败"+"~n"+commit_transaction.SQLErrText
  784. GOTO ext
  785. ELSEIF commit_transaction.SQLNRows = 0 THEN
  786. rslt = 0
  787. arg_msg = "单据正在审核,请稍后查询。"+"~n"+commit_transaction.SQLErrText
  788. GOTO ext
  789. END IF
  790. flag = 0
  791. ext:
  792. IF rslt = 0 THEN
  793. ROLLBACK USING commit_transaction;
  794. ELSEIF rslt = 1 AND arg_ifcommit THEN
  795. COMMIT USING commit_transaction;
  796. END IF
  797. RETURN rslt
  798. end function
  799. public function integer newbegin (integer arg_billtype, ref string arg_msg);int rslt=1
  800. if arg_billtype <> 0 and arg_billtype <> 1 and arg_billtype <> 2 then
  801. arg_msg = '错误的单据类型:0-内部投诉单,1-供应商投诉单,2-客户/部门投诉单'
  802. rslt = 0
  803. goto ext
  804. end if
  805. p_reset()
  806. it_newbegin=true
  807. it_updatebegin=false
  808. billtype =arg_billtype
  809. ext :
  810. if rslt = 0 then p_reset()
  811. return rslt
  812. end function
  813. public function integer add_qualityidea (long arg_billid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
  814. arg_newdescppart = Trim(arg_newdescppart)
  815. IF it_updatebegin OR it_newbegin THEN
  816. rslt = 0
  817. arG_MSG = "编辑状态下不可用"
  818. GOTO ext
  819. END IF
  820. IF arg_newdescppart = '' THEN
  821. rslt = 0
  822. arG_MSG = "要添加内容为空,操作取消"
  823. GOTO ext
  824. END IF
  825. IF p_getinfo(arg_billid,arG_MSG) = 0 THEN
  826. rslt = 0
  827. GOTO ext
  828. END IF
  829. IF flag = 1 THEN
  830. rslt = 0
  831. arG_MSG = "审核状态下不可用"
  832. GOTO ext
  833. END IF
  834. UPDATE u_oppose
  835. SET qualityidea = qualityidea+' '+:arg_newdescppart
  836. Where u_oppose.billid = :arg_billid USING commit_transaction ;
  837. IF commit_transaction.SQLCode <> 0 THEN
  838. rslt = 0
  839. arG_MSG = "因网络或其它原因导致添加操作失败"+"~n"+ commit_transaction.SQLErrText
  840. GOTO ext
  841. END IF
  842. qualityidea = qualityidea+' '+arg_newdescppart
  843. it_newbegin = FALSE
  844. it_updatebegin = FALSE
  845. ext:
  846. IF rslt = 0 THEN
  847. ROLLBACK USING commit_transaction;
  848. ELSEIF arg_ifcommit THEN
  849. COMMIT USING commit_transaction;
  850. END IF
  851. p_reset()
  852. Return (rslt)
  853. end function
  854. public function integer add_manageridea (long arg_billid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
  855. arg_newdescppart = Trim(arg_newdescppart)
  856. IF it_updatebegin OR it_newbegin THEN
  857. rslt = 0
  858. arG_MSG = "编辑状态下不可用"
  859. GOTO ext
  860. END IF
  861. IF arg_newdescppart = '' THEN
  862. rslt = 0
  863. arG_MSG = "要添加内容为空,操作取消"
  864. GOTO ext
  865. END IF
  866. IF p_getinfo(arg_billid,arG_MSG) = 0 THEN
  867. rslt = 0
  868. GOTO ext
  869. END IF
  870. IF flag = 1 THEN
  871. rslt = 0
  872. arG_MSG = "审核状态下不可用"
  873. GOTO ext
  874. END IF
  875. UPDATE u_oppose
  876. SET manageridea = manageridea+' '+:arg_newdescppart
  877. Where u_oppose.billid = :arg_billid USING commit_transaction ;
  878. IF commit_transaction.SQLCode <> 0 THEN
  879. rslt = 0
  880. arG_MSG = "因网络或其它原因导致添加操作失败"+"~n"+ commit_transaction.SQLErrText
  881. GOTO ext
  882. END IF
  883. manageridea = manageridea+' '+arg_newdescppart
  884. it_newbegin = FALSE
  885. it_updatebegin = FALSE
  886. ext:
  887. IF rslt = 0 THEN
  888. ROLLBACK USING commit_transaction;
  889. ELSEIF arg_ifcommit THEN
  890. COMMIT USING commit_transaction;
  891. END IF
  892. p_reset()
  893. Return (rslt)
  894. end function
  895. public function integer add_improveidea (long arg_billid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
  896. arg_newdescppart = Trim(arg_newdescppart)
  897. IF it_updatebegin OR it_newbegin THEN
  898. rslt = 0
  899. arG_MSG = "编辑状态下不可用"
  900. GOTO ext
  901. END IF
  902. IF arg_newdescppart = '' THEN
  903. rslt = 0
  904. arG_MSG = "要添加内容为空,操作取消"
  905. GOTO ext
  906. END IF
  907. IF p_getinfo(arg_billid,arG_MSG) = 0 THEN
  908. rslt = 0
  909. GOTO ext
  910. END IF
  911. IF flag = 1 THEN
  912. rslt = 0
  913. arG_MSG = "审核状态下不可用"
  914. GOTO ext
  915. END IF
  916. UPDATE u_oppose
  917. SET improveidea = improveidea+' '+:arg_newdescppart
  918. Where u_oppose.billid = :arg_billid USING commit_transaction ;
  919. IF commit_transaction.SQLCode <> 0 THEN
  920. rslt = 0
  921. arG_MSG = "因网络或其它原因导致添加操作失败"+"~n"+ commit_transaction.SQLErrText
  922. GOTO ext
  923. END IF
  924. improveidea = improveidea+' '+arg_newdescppart
  925. it_newbegin = FALSE
  926. it_updatebegin = FALSE
  927. ext:
  928. IF rslt = 0 THEN
  929. ROLLBACK USING commit_transaction;
  930. ELSEIF arg_ifcommit THEN
  931. COMMIT USING commit_transaction;
  932. END IF
  933. p_reset()
  934. Return (rslt)
  935. end function
  936. public function integer add_productieda (long arg_billid, long arg_deptid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
  937. arg_newdescppart = Trim(arg_newdescppart)
  938. IF it_updatebegin OR it_newbegin THEN
  939. rslt = 0
  940. arG_MSG = "编辑状态下不可用"
  941. GOTO ext
  942. END IF
  943. //IF arg_newdescppart = '' THEN
  944. // rslt = 0
  945. // arG_MSG = "要添加内容为空,操作取消"
  946. // GOTO ext
  947. //END IF
  948. IF p_getinfo(arg_billid,arG_MSG) = 0 THEN
  949. rslt = 0
  950. GOTO ext
  951. END IF
  952. IF flag = 1 THEN
  953. rslt = 0
  954. arG_MSG = "审核状态下不可用"
  955. GOTO ext
  956. END IF
  957. UPDATE u_opposemx_dept
  958. SET productieda = :arg_newdescppart,
  959. opemp = :publ_operator,
  960. opdate = getdate()
  961. WHERE u_opposemx_dept.billid = :arg_billid
  962. AND u_opposemx_dept.deptid = :arg_deptid USING commit_transaction ;
  963. IF commit_transaction.SQLCode <> 0 THEN
  964. rslt = 0
  965. arG_MSG = "因网络或其它原因导致添加操作失败"+"~n"+ commit_transaction.SQLErrText
  966. GOTO ext
  967. END IF
  968. it_newbegin = FALSE
  969. it_updatebegin = FALSE
  970. ext:
  971. IF rslt = 0 THEN
  972. ROLLBACK USING commit_transaction;
  973. ELSEIF arg_ifcommit THEN
  974. COMMIT USING commit_transaction;
  975. END IF
  976. p_reset()
  977. Return (rslt)
  978. end function
  979. public function integer secauditing (long arg_billid, boolean arg_ifcommit, ref string arg_msg);Long rslt = 1
  980. IF arg_billid = 0 THEN
  981. rslt = 0
  982. arg_msg = "没有审核对象"
  983. GOTO ext
  984. END IF
  985. IF p_getinfo(arg_billid,arg_msg) = 0 THEN
  986. rslt = 0
  987. GOTO ext
  988. END IF
  989. IF billtype <> 2 THEN
  990. arg_msg = '不是客户投诉单,不能终审'
  991. rslt = 0
  992. GOTO ext
  993. END IF
  994. IF flag = 0 THEN
  995. rslt = 0
  996. arg_msg = "单据未初审,不能终审"
  997. GOTO ext
  998. END IF
  999. IF secflag = 1 THEN
  1000. rslt = 0
  1001. arg_msg = "单据已终审,不能终审"
  1002. GOTO ext
  1003. END IF
  1004. UPDATE u_oppose
  1005. SET secauditemp = :publ_operator,
  1006. secauditdate = getdate(),
  1007. secflag = 1
  1008. WHERE u_oppose.billid = :billid
  1009. AND flag = 1
  1010. AND secflag = 0 USING commit_transaction;
  1011. IF commit_transaction.SQLCode <> 0 THEN
  1012. rslt = 0
  1013. arg_msg = "因网络或其它原因导致审核单据操作失败"+"~n"+commit_transaction.SQLErrText
  1014. GOTO ext
  1015. ELSEIF commit_transaction.SQLNRows = 0 THEN
  1016. rslt = 0
  1017. arg_msg = "单据正在审核,请稍后查询。"+"~n"+commit_transaction.SQLErrText
  1018. GOTO ext
  1019. END IF
  1020. secflag = 1
  1021. ext:
  1022. IF rslt = 0 THEN
  1023. ROLLBACK USING commit_transaction;
  1024. ELSEIF rslt = 1 AND arg_ifcommit THEN
  1025. COMMIT USING commit_transaction;
  1026. END IF
  1027. RETURN rslt
  1028. end function
  1029. public function integer c_secauditing (long arg_billid, boolean arg_ifcommit, ref string arg_msg);Long rslt = 1
  1030. DateTime null_dt
  1031. SetNull(null_dt)
  1032. IF arg_billid = 0 THEN
  1033. rslt = 0
  1034. arg_msg = "没有审核对象"
  1035. GOTO ext
  1036. END IF
  1037. //IF it_newbegin OR it_updatebegin THEN
  1038. // rslt = 0
  1039. // arg_msg = "编辑状态下不可以执行审核"
  1040. // GOTO ext
  1041. //END IF
  1042. IF p_getinfo(arg_billid,arg_msg) = 0 THEN
  1043. rslt = 0
  1044. GOTO ext
  1045. END IF
  1046. IF billtype <> 2 THEN
  1047. arg_msg = '不是客户投诉单,不能终审撤审'
  1048. rslt = 0
  1049. GOTO ext
  1050. END IF
  1051. IF secflag = 0 THEN
  1052. rslt = 0
  1053. arg_msg = "单据还未终审"
  1054. GOTO ext
  1055. END IF
  1056. UPDATE u_oppose
  1057. SET secauditemp = '',
  1058. secauditdate = :null_dt,
  1059. secflag = 0
  1060. WHERE u_oppose.billid = :billid
  1061. AND secflag = 1 USING commit_transaction;
  1062. IF commit_transaction.SQLCode <> 0 THEN
  1063. rslt = 0
  1064. arg_msg = "因网络或其它原因导致审核单据操作失败"+"~n"+commit_transaction.SQLErrText
  1065. GOTO ext
  1066. ELSEIF commit_transaction.SQLNRows = 0 THEN
  1067. rslt = 0
  1068. arg_msg = "单据正在审核,请稍后查询。"+"~n"+commit_transaction.SQLErrText
  1069. GOTO ext
  1070. END IF
  1071. secflag = 0
  1072. ext:
  1073. IF rslt = 0 THEN
  1074. ROLLBACK USING commit_transaction;
  1075. ELSEIF rslt = 1 AND arg_ifcommit THEN
  1076. COMMIT USING commit_transaction;
  1077. END IF
  1078. RETURN rslt
  1079. end function
  1080. public function long acceptdeptid (long arg_deptid, string arg_productieda, ref string arg_msg);int rslt = 1
  1081. long i
  1082. string ls_wrkGrpName
  1083. if isnull(arg_deptid) then arg_deptid = 0
  1084. if arg_deptid = 0 then
  1085. rslt = 1
  1086. goto ext
  1087. end if
  1088. select wrkGrpName into :ls_wrkGrpName
  1089. from u_sc_workgroup
  1090. where wrkGrpid = :arg_deptid;
  1091. if sqlca.sqlcode <> 0 then
  1092. arg_msg = '查询责任部门资料失败'
  1093. rslt = 0
  1094. goto ext
  1095. end if
  1096. for i = 1 to it_depmxbt
  1097. if opposemx_dept[i].deptid = arg_deptid then
  1098. rslt = 1
  1099. goto ext
  1100. end if
  1101. next
  1102. it_depmxbt++
  1103. opposemx_dept[it_depmxbt].deptid = arg_deptid
  1104. opposemx_dept[it_depmxbt].wkpname = ls_wrkGrpName
  1105. opposemx_dept[it_depmxbt].productieda = arg_productieda
  1106. ext:
  1107. if rslt = 0 then p_clearmx()
  1108. return rslt
  1109. end function
  1110. public function integer acceptmx (long arg_mtrlid, string arg_status, decimal arg_qty, string arg_status_mode, string arg_woodcode, string arg_pcode, string arg_mxdscrp, ref string arg_msg);Int rslt = 1
  1111. Long cnt = 0,ls_i
  1112. IF it_newbegin = False And it_updatebegin = False THEN
  1113. rslt = 0
  1114. arg_msg = "非编辑状态不可以使用,操作取消"
  1115. GOTO ext
  1116. END IF
  1117. //清除空值
  1118. IF IsNull(arg_mtrlid) THEN arg_mtrlid = 0
  1119. IF IsNull(arg_status) THEN arg_status = ''
  1120. IF IsNull(arg_qty) THEN arg_qty = 0
  1121. IF IsNull(arg_mxdscrp) THEN arg_mxdscrp = ''
  1122. // 如果进仓数量为 0,或物料编号为空,则不作任何处理
  1123. IF arg_mtrlid = 0 Or arg_qty = 0 THEN
  1124. rslt = 1
  1125. GOTO ext
  1126. END IF
  1127. FOR ls_i = 1 To it_mxbt
  1128. IF opposemx_mtrl[ls_i].mtrlid = arg_mtrlid And opposemx_mtrl[ls_i].status = arg_status THEN
  1129. rslt = 1
  1130. GOTO ext
  1131. END IF
  1132. NEXT
  1133. //写入内容
  1134. it_mxbt++
  1135. opposemx_mtrl[it_mxbt].mtrlid = arg_mtrlid
  1136. opposemx_mtrl[it_mxbt].status = arg_status
  1137. opposemx_mtrl[it_mxbt].qty = arg_qty
  1138. opposemx_mtrl[it_mxbt].mxdscrp = arg_mxdscrp
  1139. opposemx_mtrl[it_mxbt].status_mode = arg_status_mode
  1140. opposemx_mtrl[it_mxbt].woodcode = arg_woodcode
  1141. opposemx_mtrl[it_mxbt].pcode = arg_pcode
  1142. ext:
  1143. IF rslt = 0 THEN p_clearmx()
  1144. Return(rslt)
  1145. end function
  1146. public function integer update_saleamt (long arg_billid, decimal arg_opposeamt, decimal arg_selfamt, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
  1147. IF it_updatebegin OR it_newbegin THEN
  1148. rslt = 0
  1149. arG_MSG = "编辑状态下不可用"
  1150. GOTO ext
  1151. END IF
  1152. IF arg_selfamt < 0 THEN
  1153. rslt = 0
  1154. arG_MSG = "个人金额不能为负数,操作取消"
  1155. GOTO ext
  1156. END IF
  1157. IF arg_opposeamt < 0 THEN
  1158. rslt = 0
  1159. arG_MSG = "总金额不能为负数,操作取消"
  1160. GOTO ext
  1161. END IF
  1162. IF p_getinfo(arg_billid,arG_MSG) = 0 THEN
  1163. rslt = 0
  1164. GOTO ext
  1165. END IF
  1166. IF flag = 0 THEN
  1167. rslt = 0
  1168. arG_MSG = "待审核状态下不可用"
  1169. GOTO ext
  1170. END IF
  1171. ////2015-03-30 取消限制 (youshi)
  1172. //IF arg_selfamt > arg_opposeamt THEN
  1173. // rslt = 0
  1174. // arG_MSG = '个人金额不能大于总金额'
  1175. // GOTO ext
  1176. //END IF
  1177. UPDATE u_oppose
  1178. SET opposeamt = :arg_opposeamt,
  1179. selfamt = :arg_selfamt
  1180. Where u_oppose.billid = :arg_billid USING commit_transaction ;
  1181. IF commit_transaction.SQLCode <> 0 THEN
  1182. rslt = 0
  1183. arG_MSG = "因网络或其它原因导致添加操作失败"+"~n"+ commit_transaction.SQLErrText
  1184. GOTO ext
  1185. END IF
  1186. opposeamt = arg_opposeamt
  1187. selfamt = arg_selfamt
  1188. it_newbegin = FALSE
  1189. it_updatebegin = FALSE
  1190. ext:
  1191. IF rslt = 0 THEN
  1192. ROLLBACK USING commit_transaction;
  1193. ELSEIF arg_ifcommit THEN
  1194. COMMIT USING commit_transaction;
  1195. END IF
  1196. p_reset()
  1197. Return (rslt)
  1198. end function
  1199. on uo_oppose.create
  1200. call super::create
  1201. TriggerEvent( this, "constructor" )
  1202. end on
  1203. on uo_oppose.destroy
  1204. TriggerEvent( this, "destructor" )
  1205. call super::destroy
  1206. end on