123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906 |
- $PBExportHeader$uo_update_cost_wfjg.sru
- forward
- global type uo_update_cost_wfjg from nonvisualobject
- end type
- end forward
- global type uo_update_cost_wfjg from nonvisualobject
- end type
- global uo_update_cost_wfjg uo_update_cost_wfjg
- type variables
- PUBLIC PROTECTEDWRITE Long billid
- PUBLIC PROTECTEDWRITE string billcode
- PUBLIC PROTECTEDWRITE datetime opdate
- PUBLIC PROTECTEDWRITE datetime moddate
- PUBLIC PROTECTEDWRITE datetime auditingdate
- PUBLIC PROTECTEDWRITE string opemp
- PUBLIC PROTECTEDWRITE string modemp
- PUBLIC PROTECTEDWRITE string auditingrep
- PUBLIC PROTECTEDWRITE int flag
- int sptid
- string relcode
- string dscrp
- datetime billdate
- string rep
- s_updatecostmx_wfjg s_mx[]
- Boolean if_getid_ture = TRUE
- Transaction commit_transaction //数据commit事务
- Long it_mxbt = 0 //明细结构数组末指针
- Boolean it_newbegin = FALSE //新建标志
- Boolean it_updatebegin = FALSE //修改标志
- end variables
- forward prototypes
- public function integer acceptmx (long arg_printid, long arg_mtrlwareid, string arg_mtrlcode, decimal arg_newcost, string arg_mxdscrp, ref string arg_msg)
- public function integer p_clearmx ()
- public function integer p_reset ()
- public function integer newbegin ()
- public function integer p_getinfo (long arg_billid, ref string arg_msg)
- public function integer updatebegin (long arg_billid, ref string arg_msg)
- public function integer getinfo (long arg_billid, ref string arg_msg)
- public function integer del (long arg_billid, ref string arg_msg, boolean arg_ifcommit)
- public function integer save (boolean arg_ifcommit, ref string arg_msg)
- public function integer add_dscrp (long arg_billid, string arg_newdescppart, ref string arg_msg)
- public function integer auditing (long arg_billid, boolean arg_ifcommit, ref string arg_msg)
- end prototypes
- public function integer acceptmx (long arg_printid, long arg_mtrlwareid, string arg_mtrlcode, decimal arg_newcost, string arg_mxdscrp, ref string arg_msg);Long rslt = 1,cnt = 0
- IF it_newbegin = FALSE AND it_updatebegin = FALSE THEN
- rslt = 0
- arg_msg = "非编辑状态不可以使用,操作取消"
- GOTO ext
- END IF
- Long i_mtrlid,i_sptid,i_scid
- String i_plancode,i_status,i_woodcode,i_pcode
- Decimal i_cost,i_noallocqty
- IF IsNull(arg_printid) THEN arg_printid = 0
- IF IsNull(arg_mtrlcode) THEN arg_mtrlcode = ''
- IF IsNull(arg_mtrlwareid) THEN arg_mtrlwareid = 0
- IF IsNull(arg_mxdscrp) THEN arg_mxdscrp = ''
- IF IsNull(arg_newcost) THEN arg_newcost = 0
- IF arg_mtrlwareid <= 0 THEN
- rslt = 0
- GOTO ext
- END IF
- SELECT mtrlid,
- status,
- woodcode,
- pcode,
- sptid,
- noallocqty,
- plancode,
- cost,
- scid
- INTO :i_mtrlid,
- :i_status,
- :i_woodcode,
- :i_pcode,
- :i_sptid,
- :i_noallocqty,
- :i_plancode,
- :i_cost,
- :i_scid
- FROM ow_wfjgware
- WHERE mtrlwareid = :arg_mtrlwareid
- USING commit_transaction;
-
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "查询物料:"+arg_mtrlcode+"外协商库存资料失败,"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- IF i_sptid <> sptid THEN
- arg_msg = '外协商资料与明细库存所属外协商不相符'
- rslt = 0
- GOTO ext
- END IF
- it_mxbt++
- s_mx[it_mxbt].printid = arg_printid
- s_mx[it_mxbt].mtrlwarescid = i_scid
- s_mx[it_mxbt].mtrlwareid = arg_mtrlwareid
- s_mx[it_mxbt].mtrlid = i_mtrlid
- s_mx[it_mxbt].sptid = i_sptid
- s_mx[it_mxbt].status = i_status
- s_mx[it_mxbt].woodcode = i_woodcode
- s_mx[it_mxbt].pcode = i_pcode
- s_mx[it_mxbt].plancode = i_plancode
- s_mx[it_mxbt].noallocqty = i_noallocqty
- s_mx[it_mxbt].cost = i_cost
- s_mx[it_mxbt].mxdscrp = arg_mxdscrp
- s_mx[it_mxbt].newcost = arg_newcost
- ext:
- IF rslt = 0 THEN p_clearmx()
- Return(rslt)
- end function
- public function integer p_clearmx ();it_mxbt=0
- return 1
- end function
- public function integer p_reset ();billid = 0
- billcode = ''
- opemp = ''
- modemp = ''
- auditingrep = ''
- flag = 0
- sptid = 0
- rep = ''
- relcode = ''
- dscrp = ''
- it_newbegin = FALSE
- it_updatebegin = FALSE
- //清除明细
- p_clearmx()
- RETURN 1
- end function
- public function integer newbegin ();Int rslt = 1
- p_reset()
- it_newbegin = TRUE
- it_updatebegin = FALSE
- RETURN rslt
- end function
- public function integer p_getinfo (long arg_billid, ref string arg_msg);Int rslt = 1
- IF arg_billid <= 0 THEN
- rslt = 0
- arG_MSG = "非法单据唯一码"
- GOTO ext
- END IF
- SELECT billid,
- billcode,
- sptid,
- relcode,
- dscrp,
- billdate,
- rep,
- opdate,
- moddate,
- auditingdate,
- opemp,
- modemp,
- auditingrep,
- flag
- INTO
- :billid,
- :billcode,
- :sptid,
- :relcode,
- :dscrp,
- :billdate,
- :rep,
- :opdate,
- :moddate,
- :auditingdate,
- :opemp,
- :modemp,
- :auditingrep,
- :flag
- FROM u_updatecost_wfjg
- Where billid = :arg_billid USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arG_MSG = "查询操作失败(错误单据唯一码)"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN p_reset()
- RETURN rslt
- end function
- public function integer updatebegin (long arg_billid, ref string arg_msg);Long rslt = 1
- IF arg_billid <= 0 THEN
- rslt = 0
- GOTO ext
- END IF
- rslt = p_getinfo(arg_billid,arg_msg)
- IF rslt = 0 THEN GOTO ext
- IF flag = 1 THEN
- rslt = 0
- arg_msg = '单据已经审核,不可以修改'
- GOTO ext
- END IF
- billid = arg_billid
- it_newbegin = FALSE
- it_updatebegin = TRUE
- p_clearmx() //清除明细
- ext:
- IF rslt = 0 THEN p_reset()
- RETURN rslt
- end function
- public function integer getinfo (long arg_billid, ref string arg_msg);Int rslt = 1,i = 1,no_mxcheck = 0
- IF arg_billid <= 0 THEN
- rslt = 0
- arg_msg = "非法单据唯一码"
- GOTO ext
- END IF
- rslt = p_getinfo(arg_billid,arg_msg)
- IF rslt = 0 THEN GOTO ext
- DECLARE cur_mx CURSOR FOR
- SELECT u_updatecostmx_wfjg.printid, u_updatecostmx_wfjg.mtrlwarescid,
- u_updatecostmx_wfjg.mtrlwareid, u_updatecostmx_wfjg.mtrlid,
- u_updatecostmx_wfjg.status, u_updatecostmx_wfjg.woodcode,
- u_updatecostmx_wfjg.pcode, u_updatecostmx_wfjg.sptid,
- u_updatecostmx_wfjg.plancode, u_updatecostmx_wfjg.noallocqty,
- u_updatecostmx_wfjg.cost, u_updatecostmx_wfjg.newcost,
- u_updatecostmx_wfjg.mxdscrp, u_mtrldef.mtrlcode, u_mtrldef.unit
- FROM u_updatecostmx_wfjg INNER JOIN
- u_mtrldef ON u_updatecostmx_wfjg.mtrlid = u_mtrldef.mtrlid
- WHERE u_updatecostmx_wfjg.billid = :arg_billid
- USING commit_transaction;
-
- OPEN cur_mx;
- FETCH cur_mx INTO :s_mx[i].printid,
- :s_mx[i].mtrlwarescid,
- :s_mx[i].mtrlwareid,
- :s_mx[i].mtrlid,
- :s_mx[i].status,
- :s_mx[i].woodcode,
- :s_mx[i].pcode,
- :s_mx[i].sptid,
- :s_mx[i].plancode,
- :s_mx[i].noallocqty,
- :s_mx[i].cost,
- :s_mx[i].newcost,
- :s_mx[i].mxdscrp,
- :s_mx[i].mtrlcode,
- :s_mx[i].unit;
-
- DO WHILE commit_transaction.SQLCode = 0
- i++
- FETCH cur_mx INTO :s_mx[i].printid,
- :s_mx[i].mtrlwarescid,
- :s_mx[i].mtrlwareid,
- :s_mx[i].mtrlid,
- :s_mx[i].status,
- :s_mx[i].woodcode,
- :s_mx[i].pcode,
- :s_mx[i].sptid,
- :s_mx[i].plancode,
- :s_mx[i].noallocqty,
- :s_mx[i].cost,
- :s_mx[i].newcost,
- :s_mx[i].mxdscrp,
- :s_mx[i].mtrlcode,
- :s_mx[i].unit;
-
- LOOP
- CLOSE cur_mx;
- //检验明细是否读入完整
- SELECT count(*) INTO :no_mxcheck
- FROM u_updatecostmx_wfjg
- WHERE billid = :arg_billid
- USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "查询操作失败,单据明细数量"
- GOTO ext
- END IF
- IF i <> (no_mxcheck+1) THEN
- rslt = 0
- arg_msg = "查询操作失败,单据明细"
- GOTO ext
- END IF
- billid = arg_billid
- it_mxbt = i - 1
- it_newbegin = FALSE
- it_updatebegin = FALSE
- ext:
- IF rslt = 0 THEN p_reset()
- RETURN rslt
- end function
- public function integer del (long arg_billid, ref string arg_msg, boolean arg_ifcommit);//del(arg_scid,arg_inwareid,arg_msg)
- //如果单据还没有审核删除单据极其明细
- //0 fail, 1 success
- Int rslt = 1
- IF arg_billid = 0 THEN
- rslt = 0
- arg_msg = "没有删除对象,操作取消"
- GOTO ext
- END IF
- rslt = p_getinfo(arg_billid,arg_msg)
- IF rslt = 0 THEN GOTO ext
- IF flag = 1 THEN
- rslt = 0
- arg_msg = "单据已经审核,不可以删除"
- GOTO ext
- END IF
- DELETE FROM u_updatecostmx_wfjg
- WHERE u_updatecostmx_wfjg.billid = :arg_billid
- USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "删除外协商库存成本价调整单明细操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- DELETE FROM u_updatecost_wfjg
- WHERE u_updatecost_wfjg.billid = :arg_billid
- USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "删除外协商库存成本价调整单操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- it_newbegin = FALSE
- it_updatebegin = FALSE
- ext:
- IF rslt = 0 THEN
- ROLLBACK USING commit_transaction;
- ELSEIF rslt = 1 AND arg_ifcommit THEN
- COMMIT USING commit_transaction;
- END IF
- p_reset()
- RETURN rslt
- end function
- public function integer save (boolean arg_ifcommit, ref string arg_msg);Integer rslt = 1,cnt = 0,i
- DateTime server_dt
- Long ls_newid
- String ls_sccode
- IF IsNull(sptid) THEN sptid = 0
- IF IsNull(relcode) THEN relcode = ''
- IF IsNull(dscrp) THEN dscrp = ''
- IF IsNull(rep) THEN rep = ''
- IF it_newbegin = FALSE AND it_updatebegin = FALSE THEN
- rslt = 0
- arg_msg = "非编辑状态不可以提交"
- GOTO ext
- END IF
- SELECT Top 1 getdate() INTO :server_dt FROM u_user USING commit_transaction ;
- //取得系统时间,借用操作员表
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "查询操作失败,日期 "
- GOTO ext
- END IF
- IF it_mxbt = 0 THEN //如果输入物料资料错则已经清空
- rslt = 0
- arg_msg = "没有正确单据明细内容"
- GOTO ext
- END IF
- cnt = 0
- SELECT count(*)
- INTO :cnt
- FROM u_spt
- Where sptid = :sptid USING commit_transaction ;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "查询操作失败,外协商"
- GOTO ext
- END IF
- IF cnt = 0 THEN
- rslt = 0
- arg_msg = "错误的外协商唯一码: "+String(sptid)
- GOTO ext
- END IF
- IF Year(Date(billdate)) < 2000 OR IsNull(billdate) THEN
- rslt = 0
- arg_msg = "缺少更新发生时间或不合理"
- GOTO ext
- END IF
- IF billid = 0 THEN
- ls_newid = f_sys_scidentity(0,"u_updatecost_wfjg","billid",arg_msg,TRUE,id_sqlca)
- IF ls_newid <= 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- //取分部代号
- IF f_get_sccode(0,commit_transaction,ls_sccode,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- billcode = getid(0,ls_sccode + 'FC',Date(server_dt),if_getid_ture,commit_transaction)
-
-
- IF billcode = "err" THEN
- billcode = ''
- rslt = 0
- arg_msg = "无法获取单据编号"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
-
- INSERT INTO u_updatecost_wfjg
- (billid,
- billcode,
- sptid,
- relcode,
- dscrp,
- billdate,
- rep,
- opdate,
- opemp)
- VALUES (:ls_newid,
- :billcode,
- :sptid,
- :relcode,
- :dscrp,
- :billdate,
- :rep,
- :server_dt,
- :publ_operator) USING commit_transaction ;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "因网络或其它原因导致插入操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
-
- billid = ls_newid
-
-
- FOR i = 1 TO it_mxbt
- INSERT INTO u_updatecostmx_wfjg
- (billid,
- printid,
- mtrlwarescid,
- mtrlwareid,
- mtrlid,
- status,
- woodcode,
- pcode,
- sptid,
- plancode,
- noallocqty,
- cost,
- newcost,
- mxdscrp)
- VALUES (:ls_newid,
- :s_mx[i].printid,
- :s_mx[i].mtrlwarescid,
- :s_mx[i].mtrlwareid,
- :s_mx[i].mtrlid,
- :s_mx[i].status,
- :s_mx[i].woodcode,
- :s_mx[i].pcode,
- :s_mx[i].sptid,
- :s_mx[i].plancode,
- :s_mx[i].noallocqty,
- :s_mx[i].cost,
- :s_mx[i].newcost,
- :s_mx[i].mxdscrp) USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- billid = 0
- rslt = 0
- arg_msg = "因网络或其它原因导致插入明细操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- NEXT
- ELSE
- UPDATE u_updatecost_wfjg
- SET sptid = :sptid,
- billdate = :billdate,
- relcode = :relcode,
- rep = :rep,
- dscrp = :dscrp,
- moddate = :server_dt,
- modemp = :publ_operator
- WHERE billid = :billid
- AND flag = 0 USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 OR commit_transaction.SQLNRows <= 0 THEN
- rslt = 0
- arg_msg = "因网络或其它原因导致更新单据操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
-
- //删除原有明细
- DELETE FROM u_updatecostmx_wfjg
- WHERE billid = :billid
- USING commit_transaction;
-
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "删除旧有明细操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- FOR i = 1 TO it_mxbt
- INSERT INTO u_updatecostmx_wfjg
- (billid,
- printid,
- mtrlwarescid,
- mtrlwareid,
- mtrlid,
- status,
- woodcode,
- pcode,
- sptid,
- plancode,
- noallocqty,
- cost,
- newcost,
- mxdscrp)
- VALUES (:billid,
- :s_mx[i].printid,
- :s_mx[i].mtrlwarescid,
- :s_mx[i].mtrlwareid,
- :s_mx[i].mtrlid,
- :s_mx[i].status,
- :s_mx[i].woodcode,
- :s_mx[i].pcode,
- :s_mx[i].sptid,
- :s_mx[i].plancode,
- :s_mx[i].noallocqty,
- :s_mx[i].cost,
- :s_mx[i].newcost,
- :s_mx[i].mxdscrp) USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- billid = 0
- rslt = 0
- arg_msg = "因网络或其它原因导致插入明细操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- NEXT
- END IF
- it_newbegin = FALSE
- it_updatebegin = FALSE
- ext:
- IF rslt = 0 THEN
- ROLLBACK USING commit_transaction;
- p_clearmx()
- ELSEIF rslt = 1 AND arg_ifcommit THEN
- COMMIT USING commit_transaction;
- END IF
- RETURN rslt
- end function
- public function integer add_dscrp (long arg_billid, string arg_newdescppart, ref string arg_msg);
- Int rslt = 1
- arg_newdescppart = Trim(arg_newdescppart)
- IF it_updatebegin OR it_newbegin THEN
- rslt = 0
- arg_msg = "编辑状态下不可用"
- GOTO ext
- END IF
- IF arg_newdescppart = '' THEN
- rslt = 0
- arg_msg = "要添加内容为空,操作取消"
- GOTO ext
- END IF
- rslt = p_getinfo(arg_billid,arg_msg)
- IF rslt = 0 THEN GOTO ext
- IF flag = 0 THEN
- rslt = 0
- arg_msg = "非审核状态下不可用"
- GOTO ext
- END IF
- UPDATE u_updatecost_wfjg
- SET dscrp = dscrp+' '+:arg_newdescppart
- WHERE billid = :arg_billid
- USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- ROLLBACK USING commit_transaction;
- rslt = 0
- arg_msg = "因网络或其它原因导致添加单据备注操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- COMMIT USING commit_transaction;
- dscrp = dscrp+' '+arg_newdescppart
- ext:
- Return (rslt)
- end function
- public function integer auditing (long arg_billid, boolean arg_ifcommit, ref string arg_msg);Int rslt = 1 ,cnt = 0 ,i
- long ll_printid
- IF arg_billid <= 0 THEN
- rslt = 0
- arg_msg = "没有审核对象"
- GOTO ext
- END IF
- IF getinfo(arg_billid,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- IF flag = 1 THEN
- rslt = 0
- arg_msg = "单据已经审核"
- GOTO ext
- END IF
- UPDATE u_updatecost_wfjg
- SET auditingrep = :publ_operator,
- auditingdate = getdate(),
- flag = 1
- WHERE billid = :arg_billid
- AND flag = 0
- USING commit_transaction;
-
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "因网络或其它原因导致审核单据操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- ELSEIF commit_transaction.SQLNRows = 0 THEN
- rslt = 0
- arg_msg = "单据正在审核,请稍后查询。"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- uo_wfjg_py uo_ware,uo_ware_in
- uo_ware = CREATE uo_wfjg_py
- uo_ware.commit_transaction = sqlca
- uo_ware.if_getid_ture = false
- uo_ware_in = CREATE uo_wfjg_py
- uo_ware_in.commit_transaction = sqlca
- uo_ware_in.if_getid_ture = false
- //生成外协库存进仓单(负)
- IF uo_ware.newbegin(0,9,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- uo_ware.outdate = billdate
- uo_ware.outrep = rep
- uo_ware.dscrp = "库存成本价调整单审核自动生成"
- uo_ware.sptid = sptid
- uo_ware.part = relcode
- //负
- FOR i = 1 TO it_mxbt
- IF s_mx[i].mtrlwareid > 0 AND s_mx[i].noallocqty <> 0 THEN
-
- ll_printid++
- IF uo_ware.acceptmx(0,&
- 0 - s_mx[i].noallocqty,&
- s_mx[i].unit,&
- 0 - s_mx[i].noallocqty,&
- s_mx[i].mxdscrp,&
- ll_printid,&
- arg_msg,&
- 0,&
- 0,&
- s_mx[i].mtrlid,&
- 0,&
- 0,&
- s_mx[i].plancode,&
- s_mx[i].mtrlcode,&
- s_mx[i].status,&
- s_mx[i].woodcode,&
- s_mx[i].pcode,&
- s_mx[i].cost,&
- 1,&
- 0,&
- 1,'','') = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- END IF
-
- NEXT
- //正
- FOR i = 1 TO it_mxbt
- IF s_mx[i].mtrlwareid > 0 AND s_mx[i].noallocqty <> 0 THEN
- ll_printid++
- IF uo_ware.acceptmx(0,&
- s_mx[i].noallocqty,&
- s_mx[i].unit,&
- s_mx[i].noallocqty,&
- s_mx[i].mxdscrp,&
- ll_printid,&
- arg_msg,&
- 0,&
- 0,&
- s_mx[i].mtrlid,&
- 0,&
- 0,&
- s_mx[i].plancode,&
- s_mx[i].mtrlcode,&
- s_mx[i].status,&
- s_mx[i].woodcode,&
- s_mx[i].pcode,&
- s_mx[i].newcost,&
- 1,&
- 0,&
- 1,'','') = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- END IF
-
- NEXT
- IF uo_ware.it_mxbt > 0 THEN
- IF uo_ware.Save(FALSE,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- IF uo_ware.getinfo(uo_ware.scid,uo_ware.outwareid,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- IF uo_ware.auditing(FALSE,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- END IF
- DESTROY uo_ware
- ////生成外协库存进仓单(正)
- //IF uo_ware_in.newbegin(0,9,arg_msg) = 0 THEN
- // rslt = 0
- // GOTO ext
- //END IF
- //
- //uo_ware_in.outdate = billdate
- //uo_ware_in.outrep = rep
- //uo_ware_in.dscrp = "库存成本价调整单审核自动生成"
- //
- //uo_ware_in.sptid = sptid
- //uo_ware_in.part = relcode
- //
- //FOR i = 1 TO it_mxbt
- // IF s_mx[i].mtrlwareid > 0 AND s_mx[i].noallocqty <> 0 THEN
- //
- // IF uo_ware_in.acceptmx(0,&
- // s_mx[i].noallocqty,&
- // s_mx[i].unit,&
- // s_mx[i].noallocqty,&
- // s_mx[i].mxdscrp,&
- // s_mx[i].printid,&
- // arg_msg,&
- // 0,&
- // 0,&
- // s_mx[i].mtrlid,&
- // 0,&
- // 0,&
- // s_mx[i].plancode,&
- // s_mx[i].mtrlcode,&
- // s_mx[i].status,&
- // s_mx[i].woodcode,&
- // s_mx[i].pcode,&
- // s_mx[i].newcost,&
- // 1,&
- // 0,&
- // 1,'','') = 0 THEN
- // rslt = 0
- // GOTO ext
- // END IF
- // END IF
- //
- //NEXT
- //
- //IF uo_ware_in.it_mxbt > 0 THEN
- // IF uo_ware_in.Save(FALSE,arg_msg) = 0 THEN
- // rslt = 0
- // GOTO ext
- // END IF
- //
- // IF uo_ware_in.getinfo(uo_ware_in.scid,uo_ware_in.outwareid,arg_msg) = 0 THEN
- // rslt = 0
- // GOTO ext
- // END IF
- //
- // IF uo_ware_in.auditing(FALSE,arg_msg) = 0 THEN
- // rslt = 0
- // GOTO ext
- // END IF
- //END IF
- DESTROY uo_ware_in
- flag = 1
- ext:
- IF rslt = 0 THEN
- ROLLBACK USING commit_transaction;
- ELSEIF rslt = 1 AND arg_ifcommit THEN
- COMMIT USING commit_transaction;
- END IF
- RETURN rslt
- end function
- on uo_update_cost_wfjg.create
- call super::create
- TriggerEvent( this, "constructor" )
- end on
- on uo_update_cost_wfjg.destroy
- TriggerEvent( this, "destructor" )
- call super::destroy
- end on
|