uo_update_cost.sru 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282
  1. $PBExportHeader$uo_update_cost.sru
  2. forward
  3. global type uo_update_cost from nonvisualobject
  4. end type
  5. end forward
  6. global type uo_update_cost from nonvisualobject
  7. end type
  8. global uo_update_cost uo_update_cost
  9. type variables
  10. public protectedwrite long scid =0 //分部id
  11. public protectedwrite long wareid //进仓单表自动增量id
  12. public protectedwrite string warecode //单据的唯一编号
  13. public protectedwrite int billtype=0 //业务类型
  14. //业务类型
  15. //1-采购进仓[记帐模式]
  16. //2-采购进仓[不记帐模式]
  17. //3-成品进仓
  18. //8-其他进仓
  19. //9-盘盈进仓
  20. //12-调拨入仓
  21. public protectedwrite datetime opdate //建立时间,自动
  22. public protectedwrite string opemp //建立人
  23. public protectedwrite datetime modidate //修改时间,自动
  24. public protectedwrite string modiemp //修改操作员
  25. public protectedwrite int flag=0 //仓库审核标志
  26. public protectedwrite int balcflag=0 //仓库结存标志
  27. public protectedwrite datetime auditingdate //审核时间
  28. public protectedwrite string auditingrep //审核操作员
  29. long storageid=0 //进仓仓库
  30. datetime moddate //进仓发生时间
  31. string modrep='' //经手人
  32. string part='' //相关号码
  33. string dscrp='' //备注
  34. int relint_1
  35. int relint_2
  36. boolean if_getid_ture=true
  37. transaction commit_transaction //数据commit事务
  38. //uo_unit uo_unit_change
  39. s_inwaremx inwaremx[] //明细结构数组
  40. long it_mxbt=0 //明细结构数组末指针
  41. boolean it_newbegin=false //新建标志
  42. boolean it_updatebegin=false //修改标志
  43. end variables
  44. forward prototypes
  45. public function integer newbegin (long arg_scid, integer arg_billtype, ref string arg_msg)
  46. public function integer save (boolean arg_ifcommit, ref string arg_msg)
  47. public function integer auditing (boolean arg_ifcommit, ref string arg_msg)
  48. public function integer p_clearmx ()
  49. public function integer p_reset ()
  50. public function integer updatebegin (long arg_scid, long arg_wareid, integer arg_billtype, ref string arg_msg)
  51. public function integer p_getinfo (long arg_scid, long arg_wareid, ref string arg_msg)
  52. public function integer getinfo (long arg_scid, long arg_wareid, ref string arg_msg)
  53. public function integer add_dscrp (long arg_scid, long arg_wareid, string arg_newdescppart, ref string arg_msg)
  54. public function integer del (long arg_scid, long arg_wareid, ref string arg_msg, boolean arg_ifcommit)
  55. public function integer c_auditing (boolean arg_ifcommit, ref string arg_msg)
  56. public function integer uof_create_inware (ref string arg_msg)
  57. public function integer acceptmx (long arg_printid, long arg_mtrlwareid, long arg_mtrlid, string arg_mtrlcode, string arg_plancode, string arg_status, decimal arg_qty, decimal arg_newprice, string arg_mxdscrp, ref string arg_msg, string arg_woodcode, string arg_pcode, decimal arg_cost, decimal arg_newcost, decimal arg_amt, decimal arg_planprice, string arg_unit, decimal arg_cost_notax, decimal arg_newcost_notax)
  58. end prototypes
  59. public function integer newbegin (long arg_scid, integer arg_billtype, ref string arg_msg);//====================================================================
  60. // Function: newbegin(long arg_scid,int arg_billtype,ref string arg_msg)
  61. //--------------------------------------------------------------------
  62. // Description: 从置对象,设定业务类型,准备建立新进仓单
  63. //--------------------------------------------------------------------
  64. // Arguments:
  65. // value long arg_scid
  66. // value integer arg_billtype
  67. // reference string arg_msg
  68. //--------------------------------------------------------------------
  69. // Returns: integer
  70. //--------------------------------------------------------------------
  71. // Author: yyx Date: 2003.11.12
  72. //--------------------------------------------------------------------
  73. // Modify History:
  74. //
  75. //====================================================================
  76. int rslt=1
  77. if arg_scid < 0 then
  78. arg_msg = '请选择分部'
  79. rslt = 0
  80. goto ext
  81. end if
  82. //if not (arg_billtype=1 or arg_billtype=2 or arg_billtype=3 or arg_billtype=4 or arg_billtype=8 or arg_billtype=9 or arg_billtype=12 or arg_billtype=15) then
  83. // rslt=0
  84. // arg_msg='此单据类型必须为:'
  85. // arg_msg=arg_msg+'1-采购进仓[记帐模式],'
  86. // arg_msg=arg_msg+'2-采购进仓[不记帐模式],'
  87. // arg_msg=arg_msg+'3-成品进仓,'
  88. // arg_msg=arg_msg+'4-外发加工进仓,'
  89. // arg_msg=arg_msg+'8-其他进仓,'
  90. // arg_msg=arg_msg+'9-盘盈进仓,'
  91. // arg_msg=arg_msg+'12-调拨进仓'
  92. // arg_msg=arg_msg+'15-拆装进仓'
  93. // goto ext
  94. //end if
  95. p_reset()
  96. billtype=arg_billtype
  97. scid=arg_scid
  98. it_newbegin=true
  99. it_updatebegin=false
  100. ext:
  101. if rslt=0 then p_reset()
  102. return rslt
  103. end function
  104. public function integer save (boolean arg_ifcommit, ref string arg_msg);Integer rslt = 1,cnt = 0,i
  105. DateTime server_dt
  106. Long ls_newid
  107. String ls_sccode
  108. IF IsNull(storageid) THEN storageid = 0
  109. IF IsNull(modrep) THEN modrep = ''
  110. IF IsNull(dscrp) THEN dscrp = ''
  111. IF IsNull(part) THEN part = ''
  112. IF it_newbegin = FALSE AND it_updatebegin = FALSE THEN
  113. rslt = 0
  114. arg_msg = "非编辑状态不可以提交"
  115. GOTO ext
  116. END IF
  117. SELECT Top 1 getdate() INTO :server_dt FROM u_user USING commit_transaction ;
  118. //取得系统时间,借用操作员表
  119. IF commit_transaction.SQLCode <> 0 THEN
  120. rslt = 0
  121. arg_msg = "查询操作失败,日期 "
  122. GOTO ext
  123. END IF
  124. IF it_mxbt = 0 THEN //如果输入物料资料错则已经清空
  125. rslt = 0
  126. arg_msg = "没有正确进仓内容"
  127. GOTO ext
  128. END IF
  129. cnt = 0
  130. //检查仓库
  131. SELECT count(*)
  132. INTO :cnt
  133. FROM u_storage
  134. Where u_storage.storageid = :storageid USING commit_transaction ;
  135. IF commit_transaction.SQLCode <> 0 THEN
  136. rslt = 0
  137. arg_msg = "查询操作失败,仓库"
  138. GOTO ext
  139. END IF
  140. IF cnt = 0 THEN
  141. rslt = 0
  142. arg_msg = "错误的仓库编号: "+String(storageid)
  143. GOTO ext
  144. END IF
  145. IF Year(Date(moddate)) < 2000 OR IsNull(moddate) THEN
  146. rslt = 0
  147. arg_msg = "缺少更新发生时间或不合理"
  148. GOTO ext
  149. END IF
  150. //====================================================================
  151. // Script - save ( boolean arg_ifcommit, ref string arg_msg )
  152. // Reason:
  153. //--------------------------------------------------------------------
  154. // Modified By: yyx Date: 2004.01.02
  155. //--------------------------------------------------------------------
  156. IF DaysAfter(Date(String(server_dt,'yyyy-mm-dd')),Date(String(moddate,'yyyy-mm-dd'))) > sys_option_input_days THEN
  157. rslt = 0
  158. arg_msg = '更新日期错误,日期不能超前系统日期'
  159. GOTO ext
  160. END IF
  161. IF DaysAfter(Date(String(moddate,'yyyy-mm-dd')),Date(String(server_dt,'yyyy-mm-dd'))) > sys_option_input_days THEN
  162. rslt = 0
  163. arg_msg = '更新日期错误,日期不能落后系统日期'
  164. GOTO ext
  165. END IF
  166. ////////////////////////////////////////////////开始区分:新建/更新 处理
  167. IF wareid = 0 THEN //新建
  168. ls_newid = f_sys_scidentity(scid,"u_updatecost","wareid",arg_msg,if_getid_ture,commit_transaction)
  169. IF ls_newid <= 0 THEN
  170. rslt = 0
  171. GOTO ext
  172. END IF
  173. //取分部代号
  174. IF f_get_sccode(scid,commit_transaction,ls_sccode,arg_msg) = 0 THEN
  175. rslt = 0
  176. GOTO ext
  177. END IF
  178. //取得新单据编号
  179. CHOOSE CASE billtype
  180. CASE 1,2
  181. warecode = getid(scid,ls_sccode + 'CG',Date(server_dt),if_getid_ture,commit_transaction)
  182. CASE 3
  183. warecode = getid(scid,ls_sccode + 'CP',Date(server_dt),if_getid_ture,commit_transaction)
  184. CASE 4
  185. warecode = getid(scid,ls_sccode + 'WI',Date(server_dt),if_getid_ture,commit_transaction)
  186. CASE 8
  187. warecode = getid(scid,ls_sccode + 'JC',Date(server_dt),if_getid_ture,commit_transaction)
  188. CASE 9
  189. warecode = getid(scid,ls_sccode + 'PY',Date(server_dt),if_getid_ture,commit_transaction)
  190. CASE 12
  191. warecode = getid(scid,ls_sccode + 'IC',Date(server_dt),if_getid_ture,commit_transaction)
  192. CASE 15
  193. warecode = getid(scid,ls_sccode + 'DI',Date(server_dt),if_getid_ture,commit_transaction)
  194. CASE 0
  195. warecode = getid(scid,ls_sccode + 'JG',Date(server_dt),if_getid_ture,commit_transaction)
  196. END CHOOSE
  197. IF warecode = "err" THEN
  198. warecode = ''
  199. rslt = 0
  200. arg_msg = "无法获取进仓单编号"+"~n"+commit_transaction.SQLErrText
  201. GOTO ext
  202. END IF
  203. INSERT INTO u_updatecost (
  204. scid,
  205. wareid,
  206. warecode,
  207. storageid,
  208. part,
  209. moddate,
  210. modrep,
  211. dscrp,
  212. opdate,
  213. opemp)
  214. VALUES (
  215. :scid,
  216. :ls_newid,
  217. :warecode,
  218. :storageid,
  219. :part,
  220. :moddate,
  221. :modrep,
  222. :dscrp,
  223. :server_dt,
  224. :publ_operator) USING commit_transaction ;
  225. IF commit_transaction.SQLCode <> 0 THEN
  226. rslt = 0
  227. IF Pos(Lower(commit_transaction.SQLErrText),'PK_u_updatecost') > 0 THEN
  228. arg_msg = '插入单据资料失败,关键字ID重复'
  229. ELSEIF Pos(Lower(commit_transaction.SQLErrText),'IX_u_updatecost') > 0 THEN
  230. arg_msg = '插入单据资料失败,单据编号重复'
  231. ELSE
  232. arg_msg = '因网络或其它原因导致插入单据资料失败,'+commit_transaction.SQLErrText
  233. END IF
  234. GOTO ext
  235. END IF
  236. //读取新inwareid
  237. wareid = ls_newid
  238. FOR i = 1 TO it_mxbt
  239. INSERT INTO u_updatecostmx
  240. (scid,
  241. wareid,
  242. mtrlwareid,
  243. mtrlid,
  244. plancode,
  245. status,
  246. mxdscrp,
  247. noallocqty,
  248. wareamt,
  249. planprice,
  250. newprice,
  251. woodcode,
  252. pcode,
  253. cost,
  254. newcost,
  255. printid,
  256. waredscrp,
  257. inworkdate,
  258. cost_notax,
  259. newcost_notax)
  260. VALUES (
  261. :scid,
  262. :ls_newid,
  263. :inwaremx[i].mtrlwareid,
  264. :inwaremx[i].mtrlid,
  265. :inwaremx[i].plancode,
  266. :inwaremx[i].status,
  267. :inwaremx[i].mxdscrp,
  268. :inwaremx[i].qty,
  269. :inwaremx[i].amt,
  270. :inwaremx[i].planprice,
  271. :inwaremx[i].fprice,
  272. :inwaremx[i].woodcode,
  273. :inwaremx[i].pcode,
  274. :inwaremx[i].cost,
  275. :inwaremx[i].newcost,
  276. :inwaremx[i].printid,
  277. :inwaremx[i].waredscrp,
  278. :inwaremx[i].inworkdate,
  279. :inwaremx[i].cost_notax,
  280. :inwaremx[i].newcost_notax) USING commit_transaction;
  281. IF commit_transaction.SQLCode <> 0 THEN
  282. wareid = 0 //还原inwareid
  283. rslt = 0
  284. IF Pos(Lower(commit_transaction.SQLErrText),'PK_u_updatecostmx') > 0 THEN
  285. arg_msg = '插入单据明细资料失败,关键字ID,序号重复'
  286. ELSE
  287. arg_msg = '因网络或其它原因导致插入单据明细资料失败,'+commit_transaction.SQLErrText
  288. END IF
  289. GOTO ext
  290. END IF
  291. NEXT
  292. ELSE //////////////////////////////////////////////////更新
  293. UPDATE u_updatecost
  294. SET
  295. storageid = :storageid,
  296. moddate = :moddate,
  297. modrep = :modrep,
  298. part = :part,
  299. dscrp = :dscrp,
  300. modidate = :server_dt,
  301. modiemp = :publ_operator
  302. WHERE u_updatecost.wareid = :wareid
  303. AND u_updatecost.scid = :scid
  304. AND flag = 0 USING commit_transaction;
  305. IF commit_transaction.SQLCode <> 0 OR commit_transaction.SQLNRows <= 0 THEN
  306. rslt = 0
  307. arg_msg = "因网络或其它原因导致更新单据操作失败"+"~n"+commit_transaction.SQLErrText
  308. GOTO ext
  309. END IF
  310. //删除原有明细
  311. DELETE FROM u_updatecostmx
  312. WHERE u_updatecostmx.wareid = :wareid
  313. AND u_updatecostmx.scid = :scid USING commit_transaction;
  314. IF commit_transaction.SQLCode <> 0 THEN
  315. rslt = 0
  316. arg_msg = "删除旧有明细操作失败"+"~n"+commit_transaction.SQLErrText
  317. GOTO ext
  318. END IF
  319. FOR i = 1 TO it_mxbt
  320. INSERT INTO u_updatecostmx
  321. (scid,
  322. wareid,
  323. mtrlwareid,
  324. mtrlid,
  325. plancode,
  326. status,
  327. mxdscrp,
  328. noallocqty,
  329. wareamt,
  330. planprice,
  331. newprice,
  332. woodcode,
  333. pcode,
  334. cost,
  335. newcost,
  336. printid,
  337. waredscrp,
  338. inworkdate,
  339. cost_notax,
  340. newcost_notax)
  341. VALUES (
  342. :scid,
  343. :wareid,
  344. :inwaremx[i].mtrlwareid,
  345. :inwaremx[i].mtrlid,
  346. :inwaremx[i].plancode,
  347. :inwaremx[i].status,
  348. :inwaremx[i].mxdscrp,
  349. :inwaremx[i].qty,
  350. :inwaremx[i].amt,
  351. :inwaremx[i].planprice,
  352. :inwaremx[i].fprice,
  353. :inwaremx[i].woodcode,
  354. :inwaremx[i].pcode,
  355. :inwaremx[i].cost,
  356. :inwaremx[i].newcost,
  357. :inwaremx[i].printid,
  358. :inwaremx[i].waredscrp,
  359. :inwaremx[i].inworkdate,
  360. :inwaremx[i].cost_notax,
  361. :inwaremx[i].newcost_notax) USING commit_transaction;
  362. IF commit_transaction.SQLCode <> 0 THEN
  363. rslt = 0
  364. IF Pos(Lower(commit_transaction.SQLErrText),'PK_u_updatecostmx') > 0 THEN
  365. arg_msg = '插入单据明细资料失败,关键字ID,序号重复'
  366. ELSE
  367. arg_msg = '因网络或其它原因导致插入单据明细资料失败,'+commit_transaction.SQLErrText
  368. END IF
  369. GOTO ext
  370. END IF
  371. NEXT
  372. END IF
  373. it_newbegin = FALSE
  374. it_updatebegin = FALSE
  375. ext:
  376. IF rslt = 0 THEN
  377. ROLLBACK USING commit_transaction;
  378. p_clearmx()
  379. ELSEIF rslt = 1 AND arg_ifcommit THEN
  380. COMMIT USING commit_transaction;
  381. END IF
  382. RETURN rslt
  383. end function
  384. public function integer auditing (boolean arg_ifcommit, ref string arg_msg);//====================================================================
  385. // Function: auditing(arg_ifcommit,arg_msg)
  386. //--------------------------------------------------------------------
  387. // Description: 审核单据
  388. //--------------------------------------------------------------------
  389. // Arguments:
  390. // value boolean arg_ifcommit
  391. // reference string arg_msg
  392. //--------------------------------------------------------------------
  393. // Returns: integer
  394. //--------------------------------------------------------------------
  395. // Author: yyx Date: 2003.11.12
  396. //--------------------------------------------------------------------
  397. // Modify History:
  398. //
  399. //====================================================================
  400. Long rslt = 1,cnt = 0,i
  401. Dec new_noallocqty = 0
  402. Long ls_newid
  403. IF wareid = 0 THEN
  404. rslt = 0
  405. arg_msg = "没有审核对象"
  406. GOTO ext
  407. END IF
  408. IF it_newbegin Or it_updatebegin THEN
  409. rslt = 0
  410. arg_msg = "编辑状态下不可以执行审核"
  411. GOTO ext
  412. END IF
  413. IF flag = 1 THEN
  414. rslt = 0
  415. arg_msg = "单据已经审核"
  416. GOTO ext
  417. END IF
  418. IF uof_create_inware(arg_msg) = 0 THEN
  419. rslt = 0
  420. GOTO ext
  421. END IF
  422. UPDATE u_updatecost
  423. SET auditingrep = :publ_operator,
  424. auditingdate = getdate(),
  425. flag = 1
  426. WHERE u_updatecost.wareid = :wareid
  427. And flag = 0 And scid = :scid Using commit_transaction;
  428. IF commit_transaction.SQLCode <> 0 THEN
  429. rslt = 0
  430. arg_msg = "因网络或其它原因导致审核单据操作失败"+"~n"+commit_transaction.SQLErrText
  431. GOTO ext
  432. END IF
  433. flag = 1
  434. ext:
  435. IF rslt = 0 THEN
  436. ROLLBACK Using commit_transaction;
  437. ELSEIF rslt = 1 And arg_ifcommit THEN
  438. COMMIT Using commit_transaction;
  439. END IF
  440. //DESTROY uo_in_other
  441. RETURN rslt
  442. end function
  443. public function integer p_clearmx ();//int p_clearmx()
  444. //清除明细
  445. it_mxbt=0
  446. return 1
  447. end function
  448. public function integer p_reset ();//int p_reset()
  449. //清除对象及其明细
  450. scid=0
  451. wareid=0
  452. warecode=''
  453. billtype=0
  454. opemp=''
  455. modiemp=''
  456. auditingrep=''
  457. flag=0
  458. storageid=0
  459. modrep=''
  460. part=''
  461. dscrp=''
  462. it_newbegin=false
  463. it_updatebegin=false
  464. //清除明细
  465. p_clearmx()
  466. return 1
  467. end function
  468. public function integer updatebegin (long arg_scid, long arg_wareid, integer arg_billtype, ref string arg_msg);//====================================================================
  469. // Function: updatebegin(arg_scid,arg_inwareid,arg_billtype,arg_msg)
  470. //--------------------------------------------------------------------
  471. // Description: 从置对象,设定业务类型与关联ID,准备更新进仓单
  472. //--------------------------------------------------------------------
  473. // Arguments:
  474. // value long arg_scid
  475. // value long arg_inwareid
  476. // value integer arg_billtype
  477. // reference string arg_msg
  478. //--------------------------------------------------------------------
  479. // Returns: integer
  480. //--------------------------------------------------------------------
  481. // Author: yyx Date: 2003.11.12
  482. //--------------------------------------------------------------------
  483. // Modify History:
  484. //
  485. //====================================================================
  486. long rslt=1
  487. if arg_scid < 0 then
  488. arg_msg = '请选择分部'
  489. rslt = 0
  490. goto ext
  491. end if
  492. if arg_wareid<=0 then
  493. rslt=0
  494. goto ext
  495. end if
  496. //if not(arg_billtype=1 or arg_billtype=2 or arg_billtype=3 or arg_billtype=4 or arg_billtype=8 or arg_billtype=9 or arg_billtype=12) then
  497. // rslt=0
  498. // arg_msg='此单据类型必须为:'
  499. // arg_msg=arg_msg+'1-采购进仓[记帐模式],'
  500. // arg_msg=arg_msg+'2-采购进仓[不记帐模式],'
  501. // arg_msg=arg_msg+'3-成品进仓,'
  502. // arg_msg=arg_msg+'4-外发加工进仓,'
  503. // arg_msg=arg_msg+'8-其他进仓,'
  504. // arg_msg=arg_msg+'9-盘盈进仓,'
  505. // arg_msg=arg_msg+'12-调拨进仓'
  506. // goto ext
  507. //end if
  508. //if arg_billtype=12 then
  509. // rslt=0
  510. // arg_msg='单据类型:12-调拨进仓>>不能修改'
  511. // goto ext
  512. //end if
  513. //
  514. rslt=p_getinfo(arg_scid,arg_wareid,arg_msg)
  515. if rslt=0 then goto ext
  516. if flag=1 then
  517. rslt=0
  518. arg_msg='单据已经审核,不可以修改'
  519. goto ext
  520. end if
  521. wareid=arg_wareid
  522. billtype=arg_billtype
  523. scid=arg_scid
  524. it_newbegin=false
  525. it_updatebegin=true
  526. p_clearmx() //清除明细
  527. ext:
  528. if rslt=0 then p_reset()
  529. return rslt
  530. end function
  531. public function integer p_getinfo (long arg_scid, long arg_wareid, ref string arg_msg);//p_getinfo(arg_scid,arg_inwareid,arg_msg)
  532. //0 失败 1成功
  533. INT rslt=1
  534. IF arg_wareid<=0 THEN
  535. rslt=0
  536. arG_MSG="非法进仓单唯一码"
  537. goto ext
  538. end if
  539. SELECT u_updatecost.warecode,
  540. u_updatecost.storageid,
  541. u_updatecost.moddate,
  542. u_updatecost.modrep,
  543. u_updatecost.part,
  544. u_updatecost.dscrp,
  545. u_updatecost.modidate,
  546. u_updatecost.modiemp,
  547. u_updatecost.auditingdate,
  548. u_updatecost.auditingrep,
  549. u_updatecost.flag,
  550. u_updatecost.relint_1
  551. INTO :warecode,
  552. :storageid,
  553. :moddate,
  554. :modrep,
  555. :part,
  556. :dscrp,
  557. :modidate,
  558. :modiemp,
  559. :auditingdate,
  560. :auditingrep,
  561. :flag,
  562. :relint_1
  563. FROM u_updatecost
  564. WHERE u_updatecost.wareid = :arg_wareid
  565. and scid=:arg_scid
  566. using commit_transaction;
  567. if commit_transaction.sqlcode<>0 then
  568. rslt=0
  569. arG_MSG="查询操作失败(错误进仓单唯一码),进仓单"+commit_transaction.sqlerrtext
  570. goto ext
  571. end if
  572. wareid = arg_wareid
  573. scid = arg_scid
  574. ext:
  575. IF rslt=0 THEN p_reset()
  576. return rslt
  577. end function
  578. public function integer getinfo (long arg_scid, long arg_wareid, ref string arg_msg);//getinfo(arg_scid,arg_inwareid,arg_msg)
  579. //0 失败 1成功
  580. Int rslt = 1,i = 1,no_mxcheck = 0
  581. IF arg_wareid <= 0 THEN
  582. rslt = 0
  583. arg_msg = "非法进仓单唯一码"
  584. GOTO ext
  585. END IF
  586. rslt = p_getinfo(arg_scid,arg_wareid,arg_msg)
  587. IF rslt = 0 THEN GOTO ext
  588. //用游标读取明细
  589. DECLARE cur_waremx CURSOR FOR
  590. SELECT u_updatecostmx.printid,
  591. u_updatecostmx.mtrlwareid,
  592. u_updatecostmx.mtrlid,
  593. u_updatecostmx.plancode,
  594. u_updatecostmx.status,
  595. u_updatecostmx.noallocqty,
  596. u_updatecostmx.newprice,
  597. u_updatecostmx.planprice,
  598. u_updatecostmx.mxdscrp,
  599. u_mtrldef.mtrlcode,
  600. u_updatecostmx.woodcode,
  601. u_updatecostmx.pcode,
  602. u_updatecostmx.cost,
  603. u_updatecostmx.newcost,
  604. u_mtrldef.unit,
  605. u_mtrldef.mtrlcode,
  606. u_updatecostmx.waredscrp,
  607. u_updatecostmx.inworkdate,
  608. u_mtrlware.sptid,
  609. u_updatecostmx.cost_notax,
  610. u_updatecostmx.newcost_notax
  611. FROM u_updatecostmx,u_mtrldef,u_updatecost ,u_mtrlware
  612. WHERE u_updatecost.wareid = :arg_wareid AND
  613. u_updatecostmx.mtrlid = u_mtrldef.mtrlid AND
  614. u_updatecost.scid = :arg_scid AND
  615. u_updatecost.wareid = u_updatecostmx.wareid AND
  616. u_updatecost.scid = u_updatecostmx.scid and
  617. u_mtrlware.mtrlwareid = u_updatecostmx.mtrlwareid
  618. order by u_updatecostmx.printid
  619. USING commit_transaction;
  620. OPEN cur_waremx;
  621. FETCH cur_waremx INTO :inwaremx[i].printid,
  622. :inwaremx[i].mtrlwareid,
  623. :inwaremx[i].mtrlid,
  624. :inwaremx[i].plancode,
  625. :inwaremx[i].status,
  626. :inwaremx[i].qty,
  627. :inwaremx[i].fprice,
  628. :inwaremx[i].planprice,
  629. :inwaremx[i].mxdscrp,
  630. :inwaremx[i].mtrlcode,
  631. :inwaremx[i].woodcode,
  632. :inwaremx[i].pcode,
  633. :inwaremx[i].cost,
  634. :inwaremx[i].newcost,
  635. :inwaremx[i].unit,
  636. :inwaremx[i].mtrlcode,
  637. :inwaremx[i].waredscrp,
  638. :inwaremx[i].inworkdate,
  639. :inwaremx[i].sptid,
  640. :inwaremx[i].cost_notax,
  641. :inwaremx[i].newcost_notax;
  642. DO WHILE commit_transaction.SQLCode = 0
  643. i++
  644. FETCH cur_waremx INTO :inwaremx[i].printid,:inwaremx[i].mtrlwareid,:inwaremx[i].mtrlid,
  645. :inwaremx[i].plancode,:inwaremx[i].status,:inwaremx[i].qty,:inwaremx[i].fprice,
  646. :inwaremx[i].planprice,:inwaremx[i].mxdscrp,:inwaremx[i].mtrlcode,
  647. :inwaremx[i].woodcode,:inwaremx[i].pcode,:inwaremx[i].cost,:inwaremx[i].newcost,
  648. :inwaremx[i].unit,:inwaremx[i].mtrlcode,
  649. :inwaremx[i].waredscrp,
  650. :inwaremx[i].inworkdate,
  651. :inwaremx[i].sptid,
  652. :inwaremx[i].cost_notax,
  653. :inwaremx[i].newcost_notax;
  654. LOOP
  655. CLOSE cur_waremx;
  656. //检验明细是否读入完整
  657. SELECT count(*) INTO :no_mxcheck
  658. FROM u_updatecostmx
  659. WHERE u_updatecostmx.wareid = :arg_wareid
  660. AND scid = :arg_scid USING commit_transaction;
  661. IF commit_transaction.SQLCode <> 0 THEN
  662. rslt = 0
  663. arg_msg = "查询操作失败,进仓单明细数量"
  664. GOTO ext
  665. END IF
  666. IF i <> (no_mxcheck+1) THEN
  667. rslt = 0
  668. arg_msg = "查询操作失败,进仓单明细"
  669. GOTO ext
  670. END IF
  671. wareid = arg_wareid
  672. scid = arg_scid
  673. it_mxbt = i - 1
  674. it_newbegin = FALSE
  675. it_updatebegin = FALSE
  676. ext:
  677. IF rslt = 0 THEN p_reset()
  678. RETURN rslt
  679. end function
  680. public function integer add_dscrp (long arg_scid, long arg_wareid, string arg_newdescppart, ref string arg_msg);//add_dscrp(string arg_newdescppart)
  681. //0 fail 1 success
  682. int rslt=1
  683. arg_newdescppart=trim(arg_newdescppart)
  684. if it_updatebegin or it_newbegin then
  685. rslt=0
  686. arg_msg="编辑状态下不可用"
  687. goto ext
  688. end if
  689. if arg_newdescppart='' then
  690. rslt=0
  691. arg_msg="要添加内容为空,操作取消"
  692. goto ext
  693. end if
  694. rslt=p_getinfo(arg_scid,arg_wareid,arg_msg)
  695. if rslt=0 then goto ext
  696. if flag=0 then
  697. rslt=0
  698. arg_msg="非审核状态下不可用"
  699. goto ext
  700. end if
  701. update u_updatecost
  702. set dscrp = dscrp+' '+:arg_newdescppart
  703. where u_updatecost.wareid = :wareid
  704. and scid=:scid using commit_transaction;
  705. if commit_transaction.sqlcode<>0 then
  706. rollback using commit_transaction;
  707. rslt=0
  708. arg_msg="因网络或其它原因导致添加单据备注操作失败"+"~n"+commit_transaction.sqlerrtext
  709. goto ext
  710. end if
  711. commit using commit_transaction;
  712. dscrp = dscrp+' '+arg_newdescppart
  713. ext:
  714. return (rslt)
  715. end function
  716. public function integer del (long arg_scid, long arg_wareid, ref string arg_msg, boolean arg_ifcommit);//del(arg_scid,arg_inwareid,arg_msg)
  717. //如果单据还没有审核删除单据极其明细
  718. //0 fail, 1 success
  719. int rslt = 1
  720. if arg_wareid = 0 then
  721. rslt = 0
  722. arg_msg = "没有删除对象,操作取消"
  723. goto ext
  724. end if
  725. rslt = p_getinfo(arg_scid,arg_wareid,arg_msg)
  726. if rslt = 0 then goto ext
  727. if flag = 1 then
  728. rslt = 0
  729. arg_msg = "单据已经审核,不可以删除"
  730. goto ext
  731. end if
  732. delete from u_updatecostmx
  733. where u_updatecostmx.mtrlwareid = :arg_wareid
  734. and scid = :arg_scid using commit_transaction;
  735. if commit_transaction.sqlcode <> 0 then
  736. rslt = 0
  737. arg_msg = "删除进仓单明细操作失败"+"~n"+commit_transaction.sqlerrtext
  738. goto ext
  739. end if
  740. delete from u_updatecost
  741. where u_updatecost.wareid = :arg_wareid
  742. and scid = :arg_scid using commit_transaction;
  743. if commit_transaction.sqlcode <> 0 then
  744. rslt = 0
  745. arg_msg = "删除进仓单操作失败"+"~n"+commit_transaction.sqlerrtext
  746. goto ext
  747. end if
  748. it_newbegin = false
  749. it_updatebegin = false
  750. ext:
  751. if rslt=0 then
  752. rollback using commit_transaction;
  753. elseif rslt=1 and arg_ifcommit then
  754. commit using commit_transaction;
  755. end if
  756. p_reset()
  757. return rslt
  758. end function
  759. public function integer c_auditing (boolean arg_ifcommit, ref string arg_msg);//====================================================================
  760. // Function: c_auditing(arg_ifcommit,arg_msg)
  761. //--------------------------------------------------------------------
  762. // Description: 撤审
  763. //--------------------------------------------------------------------
  764. // Arguments:
  765. // value boolean arg_ifcommit
  766. // reference string arg_msg
  767. //--------------------------------------------------------------------
  768. // Returns: integer
  769. //--------------------------------------------------------------------
  770. // Author: yyx Date: 2003.11.19
  771. //--------------------------------------------------------------------
  772. // Modify History:
  773. //
  774. //====================================================================
  775. long rslt = 1,cnt = 0,i
  776. dec new_noallocqty = 0
  777. long ls_newid
  778. datetime null_dt
  779. goto ext
  780. //setnull(null_dt)
  781. //
  782. //if wareid = 0 then
  783. // rslt = 0
  784. // arg_msg = "没有审核对象"
  785. // goto ext
  786. //end if
  787. //
  788. //if it_newbegin or it_updatebegin then
  789. // rslt = 0
  790. // arg_msg = "编辑状态下不可以执行审核"
  791. // goto ext
  792. //end if
  793. //
  794. //if flag = 0 then
  795. // rslt = 0
  796. // arg_msg = "单据还未审核"
  797. // goto ext
  798. //end if
  799. //
  800. ////if balcflag=1 then
  801. //// rslt = 0
  802. //// arg_msg = "单据已经结存,不能撤审"
  803. //// goto ext
  804. ////end if
  805. //
  806. //update u_updatecost
  807. // set auditingrep = '',
  808. // auditingdate = :null_dt,
  809. // flag = 0
  810. // where u_updatecost.wareid = :wareid
  811. // and flag = 1 and scid = :scid using commit_transaction;
  812. //
  813. //if commit_transaction.sqlcode <> 0 then
  814. // rslt = 0
  815. // arg_msg = "因网络或其它原因导致审核单据操作失败"+"~n"+commit_transaction.sqlerrtext
  816. // goto ext
  817. //elseif commit_transaction.sqlnrows = 0 then
  818. // rslt = 0
  819. // arg_msg = "单据正在审核,请稍后查询。"+"~n"+commit_transaction.sqlerrtext
  820. // goto ext
  821. //end if
  822. //
  823. ////uo_outware_other uo_ware_other
  824. ////uo_ware_other = create uo_outware_other
  825. ////uo_ware_other.commit_transaction = sqlca
  826. ////
  827. ////IF uo_ware_other.getinfo(scid,relint_1,arg_msg) = 0 THEN
  828. //// ROLLBACK USING sqlca;
  829. //// rslt = 0
  830. //// goto ext
  831. ////END IF
  832. ////
  833. ////IF uo_ware_other.c_auditing(true,arg_msg) = 0 then
  834. //// ROLLBACK USING sqlca;
  835. //// rslt = 0
  836. //// goto ext
  837. ////end if
  838. ////
  839. //////for i = 1 to it_mxbt
  840. ////// if p_update_mtrlware(inwaremx[i].mtrlid,inwaremx[i].mtrlcode,&
  841. ////// storageid,inwaremx[i].plancode,inwaremx[i].status,&
  842. ////// 0 - inwaremx[i].qty,inwaremx[i].cost,inwaremx[i].planprice,&
  843. ////// 0,inwaremx[i].dxflag,inwaremx[i].woodcode,&
  844. ////// inwaremx[i].pcode,arg_msg) = 0 then
  845. ////// rslt = 0
  846. ////// goto ext
  847. ////// end if
  848. //////next
  849. ////
  850. ////if uo_ware_other.del(scid,relint_1,arg_msg,false) = 0 then
  851. //// rslt = 0
  852. //// goto ext
  853. ////end if
  854. //
  855. //update u_updatecost
  856. //set relint_1 = 0
  857. //where wareid=:wareid and scid=:scid using commit_transaction;
  858. //if commit_transaction.sqlcode <> 0 then
  859. // rslt = 0
  860. // arg_msg = "因网络或其它原因导致单据更新操作失败"+"~n"+commit_transaction.sqlerrtext
  861. // goto ext
  862. //end if
  863. //
  864. //flag = 0
  865. ext:
  866. //
  867. //if rslt = 0 then
  868. // rollback using commit_transaction;
  869. //elseif rslt = 1 and arg_ifcommit then
  870. // commit using commit_transaction;
  871. //end if
  872. //Destroy uo_ware_other
  873. return rslt
  874. end function
  875. public function integer uof_create_inware (ref string arg_msg);
  876. Long rslt = 1,ll_printid = 0,i
  877. Decimal lde_qty
  878. uo_inware uo_in_other
  879. uo_in_other = Create uo_inware
  880. s_inwaremx s_mx
  881. //生成进仓单 负
  882. IF uo_in_other.newbegin(scid,8,arg_msg) = 0 THEN //
  883. rslt = 0
  884. GOTO ext
  885. END IF
  886. uo_in_other.indate = moddate // DateTime(today(),time(0)) // 发生时间
  887. uo_in_other.inrep = modrep // 经手人
  888. IF part = '' THEN
  889. uo_in_other.part = warecode //相关部门
  890. ELSE
  891. uo_in_other.part = warecode + "["+part+"]"
  892. END IF
  893. uo_in_other.dscrp = dscrp //备注
  894. uo_in_other.storageid = storageid
  895. uo_in_other.sptname = '成本价调整单审核自动生成'
  896. uo_in_other.relid = wareid
  897. uo_in_other.commit_transaction = commit_transaction
  898. uo_in_other.sysautobuild = True
  899. FOR i = 1 To it_mxbt
  900. IF inwaremx[i].mtrlwareid > 0 THEN
  901. ll_printid++
  902. IF inwaremx[i].qty > 0 THEN
  903. lde_qty = 0 - inwaremx[i].qty
  904. ELSE
  905. lde_qty = -1
  906. END IF
  907. s_mx.printid = ll_printid
  908. s_mx.mtrlid = inwaremx[i].mtrlid
  909. s_mx.mtrlcode = inwaremx[i].mtrlcode
  910. s_mx.plancode = inwaremx[i].plancode
  911. s_mx.status = inwaremx[i].status
  912. s_mx.uqty = lde_qty
  913. s_mx.addqty = 0
  914. s_mx.uprice = inwaremx[i].cost
  915. s_mx.uprice_notax = inwaremx[i].cost_notax
  916. s_mx.rebate = 1
  917. s_mx.mxdscrp = inwaremx[i].mxdscrp
  918. s_mx.jgprice = 0
  919. s_mx.relid = 0
  920. s_mx.relprintid = 0
  921. s_mx.ifrel = 0
  922. s_mx.woodcode = inwaremx[i].woodcode
  923. s_mx.pcode = inwaremx[i].pcode
  924. s_mx.mtrlcuscode = ''
  925. s_mx.sptid = inwaremx[i].sptid
  926. s_mx.unit = inwaremx[i].unit
  927. s_mx.rate = 1
  928. s_mx.formula = ''
  929. s_mx.waredscrp = inwaremx[i].waredscrp
  930. s_mx.inworkdate = inwaremx[i].inworkdate
  931. s_mx.cost= inwaremx[i].cost
  932. s_mx.cost_notax = inwaremx[i].cost_notax
  933. IF uo_in_other.acceptmx(s_mx,arg_msg) = 0 THEN
  934. rslt = 0
  935. GOTO ext
  936. END IF
  937. END IF
  938. NEXT
  939. FOR i = 1 To it_mxbt
  940. IF inwaremx[i].mtrlwareid > 0 THEN
  941. ll_printid++
  942. IF inwaremx[i].qty > 0 THEN
  943. lde_qty = inwaremx[i].qty
  944. ELSE
  945. lde_qty = 1
  946. END IF
  947. s_mx.printid = ll_printid
  948. s_mx.mtrlid = inwaremx[i].mtrlid
  949. s_mx.mtrlcode = inwaremx[i].mtrlcode
  950. s_mx.plancode = inwaremx[i].plancode
  951. s_mx.status = inwaremx[i].status
  952. s_mx.uqty = lde_qty
  953. s_mx.addqty = 0
  954. s_mx.uprice = inwaremx[i].newcost
  955. s_mx.uprice_notax = inwaremx[i].newcost_notax
  956. s_mx.rebate = 1
  957. s_mx.mxdscrp = inwaremx[i].mxdscrp
  958. s_mx.jgprice = 0
  959. s_mx.relid = 0
  960. s_mx.relprintid = 0
  961. s_mx.ifrel = 0
  962. s_mx.woodcode = inwaremx[i].woodcode
  963. s_mx.pcode = inwaremx[i].pcode
  964. s_mx.mtrlcuscode = ''
  965. s_mx.sptid = inwaremx[i].sptid
  966. s_mx.unit = inwaremx[i].unit
  967. s_mx.rate = 1
  968. s_mx.formula = ''
  969. s_mx.waredscrp = inwaremx[i].waredscrp
  970. s_mx.inworkdate = inwaremx[i].inworkdate
  971. s_mx.cost = inwaremx[i].newcost
  972. s_mx.cost_notax = inwaremx[i].newcost_notax
  973. IF uo_in_other.acceptmx(s_mx,arg_msg) = 0 THEN
  974. rslt = 0
  975. GOTO ext
  976. END IF
  977. END IF
  978. NEXT
  979. IF uo_in_other.it_mxbt > 0 THEN
  980. IF uo_in_other.Save(False,arg_msg) = 0 THEN
  981. rslt = 0
  982. GOTO ext
  983. END IF
  984. IF uo_in_other.getinfo(scid,uo_in_other.inwareid,arg_msg) = 0 THEN
  985. rslt = 0
  986. GOTO ext
  987. END IF
  988. IF uo_in_other.auditing(False,arg_msg) = 0 THEN
  989. rslt = 0
  990. GOTO ext
  991. END IF
  992. END IF
  993. ext:
  994. Destroy uo_in_other
  995. RETURN rslt
  996. end function
  997. public function integer acceptmx (long arg_printid, long arg_mtrlwareid, long arg_mtrlid, string arg_mtrlcode, string arg_plancode, string arg_status, decimal arg_qty, decimal arg_newprice, string arg_mxdscrp, ref string arg_msg, string arg_woodcode, string arg_pcode, decimal arg_cost, decimal arg_newcost, decimal arg_amt, decimal arg_planprice, string arg_unit, decimal arg_cost_notax, decimal arg_newcost_notax);Long rslt = 1,cnt = 0,ls_i
  998. Decimal ld_planprice,ld_cost
  999. String ls_relcode
  1000. Decimal ld_rate
  1001. Int i_dxflag
  1002. Long i_mtrlid,i_storageid,i_sptid
  1003. String i_plancode,i_status,i_mtrlcode,i_woodcode,i_pcode
  1004. Dec i_cost,i_planprice,i_notauditqty,i_allouseqty
  1005. String i_waredscrp
  1006. DateTime i_inworkdate
  1007. IF it_newbegin = False And it_updatebegin = False THEN
  1008. rslt = 0
  1009. arg_msg = "非编辑状态不可以使用,操作取消"
  1010. GOTO ext
  1011. END IF
  1012. IF arg_mtrlwareid < 0 THEN
  1013. rslt = 0
  1014. GOTO ext
  1015. END IF
  1016. //清除空值
  1017. IF IsNull(arg_printid) THEN arg_printid = 0
  1018. IF IsNull(arg_mtrlid) THEN arg_mtrlid = 0
  1019. IF IsNull(arg_mtrlcode) THEN arg_mtrlcode = ''
  1020. IF IsNull(arg_plancode) THEN arg_plancode = ''
  1021. IF IsNull(arg_status) THEN arg_status = ''
  1022. IF IsNull(arg_qty) THEN arg_qty = 0
  1023. IF IsNull(arg_newprice) THEN arg_newprice = 0
  1024. IF IsNull(arg_mxdscrp) THEN arg_mxdscrp = ''
  1025. IF IsNull(arg_woodcode) THEN arg_woodcode = ''
  1026. IF IsNull(arg_pcode) THEN arg_pcode = ''
  1027. IF IsNull(arg_cost) THEN arg_cost = 0
  1028. IF IsNull(arg_newcost) THEN arg_newcost = 0
  1029. IF IsNull(arg_unit) THEN arg_unit = ''
  1030. IF IsNull(arg_amt) THEN arg_amt = 0
  1031. IF IsNull(arg_planprice) THEN arg_planprice = 0
  1032. IF IsNull(arg_cost_notax) THEN arg_cost_notax = 0
  1033. IF IsNull(arg_newcost_notax) THEN arg_newcost_notax = 0
  1034. // 如果出仓数量为 0,或物料编号为空,则不作任何处理
  1035. IF arg_mtrlwareid = 0 Or arg_qty = 0 THEN
  1036. rslt = 1
  1037. GOTO ext
  1038. END IF
  1039. //检查物料库存ID
  1040. SELECT u_mtrlware.mtrlid,
  1041. u_mtrlware.storageid,
  1042. u_mtrlware.plancode,
  1043. u_mtrlware.status,
  1044. u_mtrlware.cost,
  1045. u_mtrldef.planprice,
  1046. u_mtrldef.mtrlcode,
  1047. u_mtrlware.sptid,
  1048. u_mtrlware.dxflag,
  1049. u_mtrlware.woodcode,
  1050. u_mtrlware.pcode,
  1051. isnull(uv_mtrlware_noauditingqty.noauditingqty,0),
  1052. u_mtrlware.noallocqty,
  1053. u_mtrlware.waredscrp,
  1054. u_mtrlware.inworkdate
  1055. INTO :i_mtrlid,
  1056. :i_storageid,
  1057. :i_plancode,
  1058. :i_status,
  1059. :i_cost,
  1060. :i_planprice,
  1061. :i_mtrlcode,
  1062. :i_sptid,
  1063. :i_dxflag,
  1064. :i_woodcode,
  1065. :i_pcode,
  1066. :i_notauditqty,
  1067. :i_allouseqty,
  1068. :i_waredscrp,
  1069. :i_inworkdate
  1070. FROM u_mtrlware left OUTER join uv_mtrlware_noauditingqty
  1071. on ( u_mtrlware.mtrlwareid = uv_mtrlware_noauditingqty.mtrlwareid)
  1072. AND ( u_mtrlware.scid = uv_mtrlware_noauditingqty.scid),u_mtrldef
  1073. WHERE ( u_mtrlware.mtrlid = u_mtrldef.mtrlid )
  1074. And ( u_mtrlware.mtrlwareid = :arg_mtrlwareid )
  1075. AND ( u_mtrlware.scid = :scid ) Using commit_transaction;
  1076. IF commit_transaction.SQLCode <> 0 THEN
  1077. rslt = 0
  1078. arg_msg = "查询操作失败,库存编号错误"
  1079. GOTO ext
  1080. END IF
  1081. it_mxbt++
  1082. inwaremx[it_mxbt].mtrlwareid = arg_mtrlwareid
  1083. inwaremx[it_mxbt].printid = arg_printid
  1084. inwaremx[it_mxbt].mtrlid = i_mtrlid
  1085. inwaremx[it_mxbt].mtrlcode = arg_mtrlcode
  1086. inwaremx[it_mxbt].plancode = i_plancode
  1087. inwaremx[it_mxbt].status = i_status
  1088. inwaremx[it_mxbt].qty = i_allouseqty
  1089. inwaremx[it_mxbt].fprice = arg_newprice
  1090. inwaremx[it_mxbt].planprice = arg_planprice
  1091. inwaremx[it_mxbt].mxdscrp = arg_mxdscrp
  1092. inwaremx[it_mxbt].woodcode = i_woodcode
  1093. inwaremx[it_mxbt].pcode = i_pcode
  1094. inwaremx[it_mxbt].aunit = arg_unit
  1095. inwaremx[it_mxbt].cost = arg_cost
  1096. inwaremx[it_mxbt].newcost = arg_newcost
  1097. // //inwaremx[it_mxbt].amt = arg_amt
  1098. inwaremx[it_mxbt].dxflag = i_dxflag
  1099. inwaremx[it_mxbt].sptid = i_sptid
  1100. inwaremx[it_mxbt].waredscrp = i_waredscrp
  1101. inwaremx[it_mxbt].inworkdate = i_inworkdate
  1102. inwaremx[it_mxbt].cost_notax = arg_cost_notax
  1103. inwaremx[it_mxbt].newcost_notax = arg_newcost_notax
  1104. ext:
  1105. IF rslt = 0 THEN
  1106. p_clearmx()
  1107. arg_msg = "第" + String(arg_printid) + "行," + arg_msg
  1108. END IF
  1109. Return(rslt)
  1110. end function
  1111. on uo_update_cost.create
  1112. call super::create
  1113. TriggerEvent( this, "constructor" )
  1114. end on
  1115. on uo_update_cost.destroy
  1116. TriggerEvent( this, "destructor" )
  1117. call super::destroy
  1118. end on
  1119. event constructor;//uo_unit_change = create uo_unit
  1120. end event
  1121. event destructor;//destroy uo_unit_change
  1122. end event