123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962 |
- $PBExportHeader$uo_outware_wfjg.sru
- forward
- global type uo_outware_wfjg from nonvisualobject
- end type
- end forward
- global type uo_outware_wfjg from nonvisualobject
- end type
- global uo_outware_wfjg uo_outware_wfjg
- type variables
- PUBLIC PROTECTEDWRITE Long scid = 0 //分部id
- PUBLIC PROTECTEDWRITE Long outwareid //进仓单表自动增量id
- PUBLIC PROTECTEDWRITE String outwarecode //单据的唯一编号
- PUBLIC PROTECTEDWRITE Int billtype = 0 //业务类型
- PUBLIC PROTECTEDWRITE DateTime opdate //建立时间,自动
- PUBLIC PROTECTEDWRITE String opemp //建立操作员
- PUBLIC PROTECTEDWRITE DateTime moddate //修改时间,自动
- PUBLIC PROTECTEDWRITE String modemp //修改操作员
- PUBLIC PROTECTEDWRITE Int balcflag = 0 //仓库日结标志
- PUBLIC PROTECTEDWRITE Int flag = 0 //仓库审核标志
- PUBLIC PROTECTEDWRITE DateTime auditingdate //审核时间
- PUBLIC PROTECTEDWRITE String auditingrep //审核操作员
- Long relid = 0 //关联id
- DateTime outdate //进仓发生时间
- String outrep = '' //经手人
- String part = '' //相关号码
- String dscrp = '' //备注
- Long sptid = 0 //供应户id
- String sptname = '' //供应商名称
- Int thflag = 0 //退货标记
- Boolean if_getid_ture = TRUE
- Transaction commit_transaction //数据commit事务
- s_outwaremx_wfjg outwaremx[] //明细结构数组
- Long it_mxbt = 0 //明细结构数组末指针
- Boolean it_newbegin = FALSE //新建标志
- Boolean it_updatebegin = FALSE //修改标志
- end variables
- forward prototypes
- public function integer newbegin (long arg_scid, integer arg_billtype, ref string arg_msg)
- public function integer save (boolean arg_ifcommit, ref string arg_msg)
- public function integer auditing (boolean arg_ifcommit, ref string arg_msg)
- public function integer updatebegin (long arg_scid, long arg_outwareid, integer arg_billtype, ref string arg_msg)
- public function integer getinfo (long arg_scid, long arg_outwareid, ref string arg_msg)
- public function integer del (long arg_scid, long arg_outwareid, ref string arg_msg, boolean arg_ifcommit)
- public function integer add_dscrp (long arg_scid, long arg_outwareid, string arg_newdescppart, ref string arg_msg)
- public function integer c_auditing (boolean arg_ifcommit, ref string arg_msg)
- public function integer p_clearmx ()
- public function integer p_getinfo (long arg_scid, long arg_outwareid, ref string arg_msg)
- public function integer p_reset ()
- public function integer p_update_sptware (long arg_mtrlwareid, long arg_mtrlid, string arg_mtrlcode, string arg_plancode, string arg_status, decimal arg_qty, decimal arg_costamt, decimal arg_planprice, long arg_sptid, string arg_woodcode, string arg_pcode, ref string arg_msg)
- public function integer uf_create_outware (boolean arg_ifcommit, ref string arg_msg)
- public function integer uf_destroy_outware (boolean arg_ifcommit, ref string arg_msg)
- public function integer acceptmx (long arg_mtrlwareid, decimal arg_uqty, string arg_uunit, decimal arg_qty, string arg_mxdscrp, long arg_printid, ref string arg_msg, integer arg_ifrel, long arg_relid, long arg_relprintid, long arg_mtrlid, long arg_storageid, integer arg_dxflag, string arg_plancode, string arg_mtrlcode, string arg_status, string arg_woodcode, string arg_pcode, decimal arg_fprice, decimal arg_rebate, long arg_sptid, decimal arg_rate, string arg_jgdscrp, string arg_mxdscrp2)
- public function integer acceptmx (long arg_mtrlwareid, decimal arg_uqty, string arg_uunit, decimal arg_qty, string arg_mxdscrp, long arg_printid, ref string arg_msg, integer arg_ifrel, long arg_relid, long arg_relprintid, decimal arg_rate, decimal arg_addqty, string arg_jgdscrp, string arg_mxdscrp2)
- end prototypes
- public function integer newbegin (long arg_scid, integer arg_billtype, ref string arg_msg);//====================================================================
- // Function: newbegin(long arg_scid,int arg_billtype,ref string arg_msg)
- //--------------------------------------------------------------------
- // Description: 从置对象,设定业务类型,准备建立新进仓单
- //--------------------------------------------------------------------
- // Arguments:
- // value long arg_scid
- // value integer arg_billtype
- // reference string arg_msg
- //--------------------------------------------------------------------
- // Returns: integer
- //--------------------------------------------------------------------
- // Author: yyx Date: 2003.11.12
- //--------------------------------------------------------------------
- // Modify History:
- //
- //====================================================================
- Int rslt = 1
- IF arg_scid < 0 THEN
- arg_msg = '请选择分部'
- rslt = 0
- GOTO ext
- END IF
- p_reset()
- billtype = arg_billtype
- scid = arg_scid
- it_newbegin = TRUE
- it_updatebegin = FALSE
- ext:
- IF rslt = 0 THEN 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(relid) THEN relid = 0
- IF IsNull(outrep) THEN outrep = ''
- IF IsNull(dscrp) THEN dscrp = ''
- IF IsNull(part) THEN part = ''
- IF IsNull(sptid) THEN sptid = 0
- IF IsNull(sptname) THEN sptname = ''
- IF IsNull(thflag) THEN thflag = 0
- 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
- IF Year(Date(outdate)) < 2000 Or IsNull(outdate) THEN
- rslt = 0
- arg_msg = "缺少出仓发生时间或不合理"
- GOTO ext
- END IF
- //====================================================================
- // Script - save ( boolean arg_ifcommit, ref string arg_msg )
- // Reason:
- //--------------------------------------------------------------------
- // Modified By: yyx Date: 2004.01.02
- //--------------------------------------------------------------------
- IF DaysAfter(Date(String(server_dt,'yyyy-mm-dd')),Date(String(outdate,'yyyy-mm-dd'))) > sys_option_input_days THEN
- rslt = 0
- arg_msg = '出仓日期错误,日期不能超前系统日期'
- GOTO ext
- END IF
- IF DaysAfter(Date(String(outdate,'yyyy-mm-dd')),Date(String(server_dt,'yyyy-mm-dd'))) > sys_option_input_days THEN
- rslt = 0
- arg_msg = '出仓日期错误,日期不能落后系统日期'
- GOTO ext
- END IF
- //====================================================================
- SELECT name INTO :sptname
- FROM u_spt
- Where sptid = :sptid Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "查询操作失败,加工商资料"
- GOTO ext
- END IF
- //检查 不能超过未发出数
- uo_order_wfjg uo_wfjg
- uo_wfjg = Create uo_order_wfjg
- uo_wfjg.commit_transaction = commit_transaction
- IF billtype = 5 THEN //车间外协发出
- FOR i = 1 To it_mxbt
- IF outwaremx[i].relid > 0 THEN
- IF uo_wfjg.check_addmxcmpl_out(scid,outwaremx[i].relid,outwaremx[i].mtrlid,0,outwaremx[i].status,&
- outwaremx[i].woodcode,outwaremx[i].pcode,outwaremx[i].qty,&
- arg_msg,False) = 0 THEN
- arg_msg = '第' + String(i) + '行,物料' +outwaremx[i].mtrlcode + ',' + arg_msg
- rslt = 0
- GOTO ext
- END IF
- END IF
- NEXT
- END IF
- ////////////////////////////////////////////// //开始区分:新建/更新 处理
- IF outwareid = 0 THEN //新建
- ls_newid = f_sys_scidentity(scid,"ow_wfjg_out","outwareid",arg_msg,if_getid_ture,commit_transaction)
- IF ls_newid <= 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- //取分部代号
- IF f_get_sccode(scid,commit_transaction,ls_sccode,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- //取得新单据编号
- CHOOSE CASE billtype
- CASE 4
- IF thflag = 0 THEN
- outwarecode = getid(scid,ls_sccode + 'WL',Date(server_dt),if_getid_ture,commit_transaction)
- ELSE
- outwarecode = getid(scid,ls_sccode + 'SL',Date(server_dt),if_getid_ture,commit_transaction)
- END IF
- CASE 5
- IF thflag = 0 THEN
- outwarecode = getid(scid,ls_sccode + 'WF',Date(server_dt),if_getid_ture,commit_transaction)
- ELSE
- outwarecode = getid(scid,ls_sccode + 'OF',Date(server_dt),if_getid_ture,commit_transaction)
- END IF
-
- CASE 9
- outwarecode = getid(scid,ls_sccode + 'WY',Date(server_dt),if_getid_ture,commit_transaction)
- END CHOOSE
-
- IF outwarecode = "err" THEN
- outwarecode = ''
- rslt = 0
- arg_msg = "无法获取出仓单编号"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
-
-
- INSERT INTO ow_wfjg_out (
- scid,
- outwareid,
- outwarecode,
- billtype,
- relid,
- outdate,
- outrep,
- part,
- dscrp,
- sptid,
- sptname,
- thflag,
- opdate,
- opemp)
- VALUES (
- :scid,
- :ls_newid,
- :outwarecode,
- :billtype,
- :relid,
- :outdate,
- :outrep,
- :part,
- :dscrp,
- :sptid,
- :sptname,
- :thflag,
- :server_dt,
- :publ_operator
- ) Using commit_transaction ;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- IF Pos(Lower(commit_transaction.SQLErrText),'pk_ow_wfjg_out') > 0 THEN
- arg_msg = '插入操作失败,关键字分部ID、单据ID重复'
- ELSEIF Pos(Lower(commit_transaction.SQLErrText),'ix_ow_wfjg_inspt') > 0 THEN
- arg_msg = '插入操作失败,单据编号重复'
- ELSE
- arg_msg = "插入主表操作失败"+"~n"+commit_transaction.SQLErrText
- END IF
- GOTO ext
- END IF
-
- //读取新outwareid
- outwareid = ls_newid
-
-
- ELSE //////////////////////////////////////////////// //更新
-
- UPDATE ow_wfjg_out
- SET
- relid = :relid,
- outdate = :outdate,
- outrep = :outrep,
- part = :part,
- dscrp = :dscrp,
- sptid = :sptid,
- sptname = :sptname,
- thflag = :thflag,
- moddate = :server_dt,
- modemp = :publ_operator
- WHERE ow_wfjg_out.outwareid = :outwareid
- AND ow_wfjg_out.scid = :scid
- And flag = 0 Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 Or commit_transaction.SQLNRows <= 0 THEN
- rslt = 0
- IF Pos(Lower(commit_transaction.SQLErrText),'pk_ow_wfjg_out') > 0 THEN
- arg_msg = '更新操作失败,关键字分部ID、单据ID重复'
- ELSEIF Pos(Lower(commit_transaction.SQLErrText),'ix_ow_wfjg_inspt') > 0 THEN
- arg_msg = '更新操作失败,单据编号重复'
- ELSE
- arg_msg = "更新主表操作失败"+"~n"+commit_transaction.SQLErrText
- END IF
- GOTO ext
- END IF
-
- //删除原有明细
- DELETE FROM ow_wfjgmx_out
- WHERE ow_wfjgmx_out.outwareid = :outwareid
- And ow_wfjgmx_out.scid = :scid Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "删除旧有明细操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
-
- END IF
- FOR i = 1 To it_mxbt
- INSERT INTO ow_wfjgmx_out
- (scid,
- storageid,
- outwareid,
- mtrlwareid,
- printid,
- mtrlid,
- plancode,
- status,
- woodcode,
- pcode,
- qty,
- fprice,
- rebate,
- price,
- mxdscrp,
- costamt,
- ifrel,
- relid,
- relprintid,
- relcode,
- cost,
- uqty,
- uunit,
- rate,
- uprice,
- addqty,
- jgdscrp,
- mxdscrp2)
- VALUES (
- :scid,
- :outwaremx[i].storageid,
- :outwareid,
- :outwaremx[i].mtrlwareid,
- :outwaremx[i].printid,
- :outwaremx[i].mtrlid,
- :outwaremx[i].plancode,
- :outwaremx[i].status,
- :outwaremx[i].woodcode,
- :outwaremx[i].pcode,
- :outwaremx[i].qty,
- :outwaremx[i].fprice,
- :outwaremx[i].rebate,
- :outwaremx[i].price,
- :outwaremx[i].mxdscrp,
- :outwaremx[i].costamt,
- :outwaremx[i].ifrel,
- :outwaremx[i].relid,
- :outwaremx[i].relprintid,
- :outwaremx[i].relcode,
- :outwaremx[i].cost,
- :outwaremx[i].uqty,
- :outwaremx[i].uunit,
- :outwaremx[i].rate,
- :outwaremx[i].uprice,
- :outwaremx[i].addqty,
- :outwaremx[i].jgdscrp,
- :outwaremx[i].mxdscrp2) Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- IF it_newbegin THEN outwareid = 0 //还原outwareid
- rslt = 0
- IF Pos(Lower(commit_transaction.SQLErrText),'pk_ow_wfjgmx_out') > 0 THEN
- arg_msg = '插入明细操作失败,关键字分部ID、单据ID、明细ID重复'
- ELSE
- arg_msg = "插入明细操作失败"+"~n"+commit_transaction.SQLErrText
- END IF
- GOTO ext
- END IF
- NEXT
- it_newbegin = False
- it_updatebegin = False
- ext:
- Destroy uo_wfjg
- IF rslt = 0 THEN
- ROLLBACK Using commit_transaction;
- p_clearmx()
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT Using commit_transaction;
- END IF
- CHOOSE CASE billtype
- CASE 4
- IF thflag = 0 THEN
- arg_msg = '仓库外协发出单,'+ arg_msg
- ELSE
- arg_msg = '仓库外协退回单,'+ arg_msg
- END IF
- CASE 5
- IF thflag = 0 THEN
- arg_msg = '车间外协发出单,'+ arg_msg
- ELSE
- arg_msg = '车间外协退回单,'+ arg_msg
- END IF
- CASE 9
- arg_msg = '外协盘盈单,'+ arg_msg
- END CHOOSE
- RETURN rslt
- end function
- public function integer auditing (boolean arg_ifcommit, ref string arg_msg);Long rslt = 1,cnt = 0,i
- Dec new_noallocqty = 0
- Long ls_newid
- Long ll_orderid
- uo_order_wfjg uo_wfjg
- uo_wfjg = Create uo_order_wfjg
- uo_wfjg.commit_transaction = commit_transaction
- IF outwareid = 0 THEN
- rslt = 0
- arg_msg = "没有审核对象"
- GOTO ext
- END IF
- IF it_newbegin Or it_updatebegin THEN
- rslt = 0
- arg_msg = "编辑状态下不可以执行审核"
- GOTO ext
- END IF
- IF flag = 1 THEN
- rslt = 0
- arg_msg = "单据已经审核"
- GOTO ext
- END IF
- UPDATE ow_wfjg_out
- SET Auditingemp = :publ_operator,
- Auditingdate = getdate(),
- flag = 1
- WHERE ow_wfjg_out.outwareid = :outwareid
- AND flag = 0
- And scid = :scid 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 = "单据正在审核,请稍后查询。"
- GOTO ext
- END IF
- //生成出仓单
- IF billtype = 4 THEN
- IF uf_create_outware(False, arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- END IF
- //更新供应商库存
- FOR i = 1 To it_mxbt
- IF p_update_sptware ( outwaremx[i].mtrlwareid, outwaremx[i].mtrlid, &
- outwaremx[i].mtrlcode, outwaremx[i].plancode,&
- outwaremx[i].status, outwaremx[i].qty, outwaremx[i].costamt,&
- outwaremx[i].planprice, sptid, &
- outwaremx[i].woodcode, outwaremx[i].pcode,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- IF outwaremx[i].relid > 0 THEN
- IF uo_wfjg.addmxcmpl_out(scid,outwaremx[i].relid,outwaremx[i].mtrlid,0,outwaremx[i].status,&
- outwaremx[i].woodcode,outwaremx[i].pcode,outwaremx[i].qty,&
- arg_msg,False) = 0 THEN
- arg_msg = '第' + String(i) + '行,物料' +outwaremx[i].mtrlcode + ',' + arg_msg
- rslt = 0
- GOTO ext
- END IF
- END IF
- NEXT
- flag = 1
- ext:
- Destroy uo_wfjg
- IF rslt = 0 THEN
- ROLLBACK Using commit_transaction;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT Using commit_transaction;
- END IF
- IF thflag = 0 THEN
- arg_msg = '仓库外协发出单,'+ arg_msg
- ELSE
- arg_msg = '仓库外协退回单,'+ arg_msg
- END IF
- RETURN rslt
- end function
- public function integer updatebegin (long arg_scid, long arg_outwareid, integer arg_billtype, ref string arg_msg);//====================================================================
- // Function: updatebegin(arg_scid,arg_inwareid,arg_billtype,arg_msg)
- //--------------------------------------------------------------------
- // Description: 从置对象,设定业务类型与关联ID,准备更新进仓单
- //--------------------------------------------------------------------
- // Arguments:
- // value long arg_scid
- // value long arg_inwareid
- // value integer arg_billtype
- // reference string arg_msg
- //--------------------------------------------------------------------
- // Returns: integer
- //--------------------------------------------------------------------
- // Author: yyx Date: 2003.11.12
- //--------------------------------------------------------------------
- // Modify History:
- //
- //====================================================================
- Long rslt = 1
- IF arg_scid < 0 THEN
- arg_msg = '请选择分部'
- rslt = 0
- GOTO ext
- END IF
- IF arg_outwareid <= 0 THEN
- rslt = 0
- GOTO ext
- END IF
- rslt = p_getinfo(arg_scid,arg_outwareid,arg_msg)
- IF rslt = 0 THEN GOTO ext
- IF flag = 1 THEN
- rslt = 0
- arg_msg = '单据已经审核,不可以修改'
- GOTO ext
- END IF
- outwareid = arg_outwareid
- billtype = arg_billtype
- scid = arg_scid
- it_newbegin = FALSE
- it_updatebegin = TRUE
- p_clearmx() //清除明细
- ext:
- IF rslt = 0 THEN p_reset()
- IF thflag = 0 THEN
- arg_msg = '仓库外协发出单,'+ arg_msg
- ELSE
- arg_msg = '仓库外协退回单,'+ arg_msg
- END IF
- RETURN rslt
- end function
- public function integer getinfo (long arg_scid, long arg_outwareid, ref string arg_msg);//getinfo(arg_scid,arg_outwareid,arg_msg)
- //0 失败 1成功
- Int rslt = 1,i = 1,no_mxcheck = 0
-
- IF arg_outwareid <= 0 THEN
- rslt = 0
- arg_msg = "非法出仓单唯一码"
- GOTO ext
- END IF
- rslt = p_getinfo(arg_scid,arg_outwareid,arg_msg)
- IF rslt = 0 THEN GOTO ext
- //用游标读取明细
- DECLARE cur_inwaermx CURSOR FOR
- SELECT ow_wfjgmx_out.printid,
- ow_wfjgmx_out.mtrlid,
- ow_wfjgmx_out.plancode,
- ow_wfjgmx_out.status,
- ow_wfjgmx_out.qty,
- ow_wfjgmx_out.fprice,
- ow_wfjgmx_out.rebate,
- ow_wfjgmx_out.price,
- ow_wfjgmx_out.mxdscrp,
- u_mtrldef.mtrlcode,
- u_mtrldef.unit,
- ow_wfjgmx_out.mtrlwareid,
- ow_wfjgmx_out.storageid,
- ow_wfjgmx_out.costamt,
- ow_wfjgmx_out.ifrel,
- ow_wfjgmx_out.relid,
- ow_wfjgmx_out.relprintid,
- ow_wfjgmx_out.woodcode,
- ow_wfjgmx_out.pcode,
- ow_wfjgmx_out.cost,
- ow_wfjgmx_out.uprice,
- ow_wfjgmx_out.uqty,
- ow_wfjgmx_out.rate,
- ow_wfjgmx_out.uunit,
- ow_wfjgmx_out.addqty,
- ow_wfjgmx_out.mxdscrp2
- FROM ow_wfjgmx_out,u_mtrldef,ow_wfjg_out
- WHERE ow_wfjg_out.outwareid = :arg_outwareid AND
- ow_wfjgmx_out.mtrlid = u_mtrldef.mtrlid AND
- ow_wfjg_out.scid = :arg_scid AND
- ow_wfjg_out.outwareid = ow_wfjgmx_out.outwareid AND
- ow_wfjg_out.scid = ow_wfjgmx_out.scid USING commit_transaction;
-
- OPEN cur_inwaermx;
- FETCH cur_inwaermx INTO
- :outwaremx[i].printid,:outwaremx[i].mtrlid,:outwaremx[i].plancode,
- :outwaremx[i].status,:outwaremx[i].qty,:outwaremx[i].fprice,
- :outwaremx[i].rebate,:outwaremx[i].price,
- :outwaremx[i].mxdscrp,:outwaremx[i].mtrlcode,:outwaremx[i].unit,
- :outwaremx[i].mtrlwareid,:outwaremx[i].storageid,
- :outwaremx[i].costamt,:outwaremx[i].ifrel,
- :outwaremx[i].relid,
- :outwaremx[i].relprintid,
- :outwaremx[i].woodcode,:outwaremx[i].pcode,
- :outwaremx[i].cost,:outwaremx[i].uprice,
- :outwaremx[i].uqty,
- :outwaremx[i].rate,
- :outwaremx[i].uunit,
- :outwaremx[i].addqty,
- :outwaremx[i].mxdscrp2;
- DO WHILE commit_transaction.SQLCode = 0
-
- i++
- FETCH cur_inwaermx INTO
- :outwaremx[i].printid,:outwaremx[i].mtrlid,:outwaremx[i].plancode,
- :outwaremx[i].status,:outwaremx[i].qty,:outwaremx[i].fprice,
- :outwaremx[i].rebate,:outwaremx[i].price,
- :outwaremx[i].mxdscrp,:outwaremx[i].mtrlcode,:outwaremx[i].unit,
- :outwaremx[i].mtrlwareid,:outwaremx[i].storageid,
- :outwaremx[i].costamt,:outwaremx[i].ifrel,
- :outwaremx[i].relid,
- :outwaremx[i].relprintid,
- :outwaremx[i].woodcode,:outwaremx[i].pcode,
- :outwaremx[i].cost,:outwaremx[i].uprice,
- :outwaremx[i].uqty,
- :outwaremx[i].rate,
- :outwaremx[i].uunit,
- :outwaremx[i].addqty,
- :outwaremx[i].mxdscrp2;
- LOOP
- CLOSE cur_inwaermx;
- //检验明细是否读入完整
- SELECT count(*) INTO :no_mxcheck
- FROM ow_wfjgmx_out
- WHERE ow_wfjgmx_out.outwareid = :arg_outwareid
- AND scid = :arg_scid 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
- outwareid = arg_outwareid
- scid = arg_scid
- 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_scid, long arg_outwareid, ref string arg_msg, boolean arg_ifcommit);//如果单据还没有审核删除单据极其明细
- //0 FAIL, 1 SUCCESS
- Int rslt = 1
- IF arg_outwareid <= 0 THEN
- rslt = 0
- arG_MSG = "没有删除对象,操作取消"
- GOTO ext
- END IF
- IF p_getinfo(arg_scid,arg_outwareid,arG_MSG) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- IF flag = 1 THEN
- rslt = 0
- arG_MSG = "单据已经审核,不可以删除"
- GOTO ext
- END IF
- DELETE FROM ow_wfjg_out
- WHERE ow_wfjg_out.outwareid = :arg_outwareid
- And ow_wfjg_out.scid = :arg_scid Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arG_MSG = "删除进仓单操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- DELETE FROM ow_wfjgmx_out
- WHERE ow_wfjgmx_out.outwareid = :arg_outwareid
- And ow_wfjgmx_out.scid = :arg_scid 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;
- p_reset()
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT Using commit_transaction;
- END IF
- IF thflag = 0 THEN
- arG_MSG = '仓库外协发出单,'+ arG_MSG
- ELSE
- arG_MSG = '仓库外协退回单,'+ arG_MSG
- END IF
- Return (rslt)
- end function
- public function integer add_dscrp (long arg_scid, long arg_outwareid, string arg_newdescppart, ref string arg_msg);//add_dscrp(string arg_newdescppart)
- //0 fail 1 success
- 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_scid,arg_outwareid,arg_msg)
- IF rslt = 0 THEN GOTO ext
- IF flag = 0 THEN
- rslt = 0
- arg_msg = "非审核状态下不可用"
- GOTO ext
- END IF
- UPDATE ow_wfjg_out
- SET dscrp = dscrp+' '+:arg_newdescppart
- WHERE ow_wfjg_out.outwareid = :outwareid
- And scid = :scid Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "添加单据备注操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- dscrp = dscrp+' '+arg_newdescppart
- ext:
- IF rslt = 0 THEN
- ROLLBACK Using commit_transaction;
- ELSE
- COMMIT Using commit_transaction;
- END IF
- IF thflag = 0 THEN
- arg_msg = '仓库外协发出单,'+ arg_msg
- ELSE
- arg_msg = '仓库外协退回单,'+ arg_msg
- END IF
- Return (rslt)
- end function
- public function integer c_auditing (boolean arg_ifcommit, ref string arg_msg);//====================================================================
- // Function: c_auditing(arg_ifcommit,arg_msg)
- //--------------------------------------------------------------------
- // Description:
- //--------------------------------------------------------------------
- // Arguments:
- // value boolean arg_ifcommit
- // reference string arg_msg
- //--------------------------------------------------------------------
- // Returns: integer
- //--------------------------------------------------------------------
- // Author: yyx Date: 2003.11.19
- //--------------------------------------------------------------------
- // Modify History:
- //
- //====================================================================
- Long rslt = 1,cnt = 0,i
- Long ls_newid
- DateTime null_dt
- SetNull(null_dt)
- uo_order_wfjg uo_wfjg
- uo_wfjg = Create uo_order_wfjg
- uo_wfjg.commit_transaction = commit_transaction
- IF outwareid = 0 THEN
- rslt = 0
- arg_msg = "没有审核对象"
- GOTO ext
- END IF
- IF it_newbegin Or it_updatebegin THEN
- rslt = 0
- arg_msg = "编辑状态下不可以执行审核"
- GOTO ext
- END IF
- IF flag = 0 THEN
- rslt = 0
- arg_msg = "单据还未审核"
- GOTO ext
- END IF
- IF balcflag = 1 THEN
- rslt = 0
- arg_msg = "单据已经日结,不能撤审"
- GOTO ext
- END IF
- UPDATE ow_wfjg_out
- SET Auditingemp = '',
- Auditingdate = :null_dt,
- flag = 0
- WHERE ow_wfjg_out.outwareid = :outwareid
- AND flag = 1
- And scid = :scid 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 = "单据正在撤审,请稍后查询。"
- GOTO ext
- END IF
- IF billtype = 4 THEN
- IF uf_destroy_outware(False, arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- END IF
- FOR i = 1 To it_mxbt
- IF p_update_sptware ( outwaremx[i].mtrlwareid, outwaremx[i].mtrlid, &
- outwaremx[i].mtrlcode, outwaremx[i].plancode,&
- outwaremx[i].status, 0 - outwaremx[i].qty, 0 - outwaremx[i].costamt,&
- outwaremx[i].planprice, sptid, &
- outwaremx[i].woodcode, outwaremx[i].pcode,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
-
- IF outwaremx[i].relid > 0 THEN
- IF uo_wfjg.addmxcmpl_out(scid,outwaremx[i].relid,outwaremx[i].mtrlid,0,outwaremx[i].status,&
- outwaremx[i].woodcode,outwaremx[i].pcode,0 - outwaremx[i].qty,&
- arg_msg,False) = 0 THEN
- rslt = 0
- GOTO ext
-
- END IF
- END IF
- NEXT
- flag = 0
- ext:
- Destroy uo_wfjg
- IF rslt = 0 THEN
- ROLLBACK Using commit_transaction;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT Using commit_transaction;
- END IF
- IF thflag = 0 THEN
- arg_msg = '仓库外协发出单,'+ arg_msg
- ELSE
- arg_msg = '仓库外协退回单,'+ arg_msg
- END IF
- RETURN rslt
- end function
- public function integer p_clearmx ();//int p_clearmx()
- //清除明细
- it_mxbt=0
- return 1
- end function
- public function integer p_getinfo (long arg_scid, long arg_outwareid, ref string arg_msg);//p_getinfo(arg_scid,arg_outwareid,arg_msg)
- //0 失败 1成功
- Int rslt = 1
- IF arg_outwareid <= 0 THEN
- rslt = 0
- arG_MSG = "非法出仓单唯一码"
- GOTO ext
- END IF
- SELECT ow_wfjg_out.outwarecode,
- ow_wfjg_out.billtype,
- ow_wfjg_out.relid,
- ow_wfjg_out.outdate,
- ow_wfjg_out.outrep,
- ow_wfjg_out.part,
- ow_wfjg_out.sptid,
- ow_wfjg_out.sptname,
- ow_wfjg_out.dscrp,
- ow_wfjg_out.thflag,
- ow_wfjg_out.flag,
- ow_wfjg_out.balcflag
- INTO :outwarecode,
- :billtype,
- :relid,
- :outdate,
- :outrep,
- :part,
- :sptid,
- :sptname,
- :dscrp,
- :thflag,
- :flag,
- :balcflag
- FROM ow_wfjg_out
- WHERE ow_wfjg_out.outwareid = :arg_outwareid
- AND scid = :arg_scid
- Using commit_transaction;
-
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- IF Pos(Lower(commit_transaction.SQLErrText),'more than') > 0 THEN
- arG_MSG = '查询操作失败,查询数据返回值多于一个'
- ELSE
- arG_MSG = "查询操作失败(错误出仓单唯一码)"
- END IF
- GOTO ext
- END IF
- outwareid = arg_outwareid
- scid = arg_scid
- ext:
- IF rslt = 0 THEN p_reset()
- RETURN rslt
- end function
- public function integer p_reset ();//int p_reset()
- //清除对象及其明细
- scid = 0
- outwareid = 0
- outwarecode = ''
- billtype = 0
- opemp = ''
- modemp = ''
- auditingrep = ''
-
- flag = 0
-
- relid = 0
- //storageid = 0
- outrep = ''
- part = ''
- dscrp = ''
- sptid = 0
- sptname = ''
- thflag = 0
-
- it_newbegin = FALSE
- it_updatebegin = FALSE
- //清除明细
- p_clearmx()
- RETURN 1
- end function
- public function integer p_update_sptware (long arg_mtrlwareid, long arg_mtrlid, string arg_mtrlcode, string arg_plancode, string arg_status, decimal arg_qty, decimal arg_costamt, decimal arg_planprice, long arg_sptid, string arg_woodcode, string arg_pcode, ref string arg_msg);//外协商进仓
- Int rslt = 1
- Long ls_newid
- Decimal ld_cost
- //检查金额
- ld_cost = Round(arg_costamt / arg_qty, 5)
- //arg_sptid 供应商ID
- //IF sys_option_wfjgware_nocost = 0 THEN //核算金额
- UPDATE ow_wfjgware
- SET noallocqty = noallocqty + :arg_qty ,
- wareamt = case when :sys_option_wfjgware_nocost = 1 then 0
- else (case noallocqty + :arg_qty when 0 then 0
- else (case when (wareamt + :arg_costamt) * (noallocqty + :arg_qty) < 0 then 0 - (wareamt + :arg_costamt) else wareamt + :arg_costamt END) END) end,
- cost = case when :sys_option_wfjgware_nocost = 1 then 0
- else (case noallocqty + :arg_qty when 0 then cost
- else (case when round((wareamt + :arg_costamt)/(noallocqty + :arg_qty),:sys_option_cost_dec) < 0 then :ld_cost else round((wareamt + :arg_costamt)/(noallocqty + :arg_qty),:sys_option_cost_dec) END) END ) end,
- waredate = getdate(),
- indate = case when :arg_qty > 0 then getdate() else indate END,
- outdate = case when :arg_qty < 0 then getdate() else outdate END
- WHERE ( mtrlid = :arg_mtrlid )
- AND ( scid = :scid )
- AND (status = :arg_Status)
- AND woodcode = :arg_woodcode
- AND pcode = :arg_pcode
- AND plancode = :arg_plancode
- AND sptid = :arg_sptid
- Using commit_transaction ;
- IF commit_transaction.SQLCode = 0 THEN
- IF commit_transaction.SQLNRows = 0 THEN
- ls_newid = f_sys_scidentity(scid,"ow_wfjgware","mtrlwareid",arg_msg,False,commit_transaction)
- IF ls_newid <= 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- INSERT INTO ow_wfjgware
- ( scid,
- sptid,
- mtrlwareid,
- mtrlid,
- plancode,
- status,
- woodcode,
- pcode,
- noallocqty,
- allocqty,
- wareamt,
- cost,
- planprice,
- indate)
- VALUES (
- :scid,
- :arg_sptid,
- :ls_newid,
- :arg_mtrlid,
- :arg_plancode,
- :arg_status,
- :arg_woodcode,
- :arg_pcode,
- :arg_qty,
- 0,
- case when :sys_option_wfjgware_nocost = 1 then 0 else :arg_costamt end,
- case when :sys_option_wfjgware_nocost = 1 then 0 else :ld_cost end,
- :arg_planprice,
- getdate()) Using commit_transaction ;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- IF Pos(Lower(commit_transaction.SQLErrText),'pk_ow_wfjgware') > 0 THEN
- arg_msg = '插入外协商库存操作失败,关键字分部ID、库存ID重复'
- ELSE
- arg_msg = "物料["+arg_mtrlcode+"]外协商库存建立操作失败"+"~n"+commit_transaction.SQLErrText
- END IF
- GOTO ext
- END IF
- END IF
- ELSE
- rslt = 0
- String or_err_part = 'column insert or update conflicts with a rule imposed by a previous create rule statement'
- IF commit_transaction.SQLCode = 513 Or Pos(Lower(commit_transaction.SQLErrText),or_err_part) > 0 THEN
- arg_msg = "物料["+arg_mtrlcode+"]同外协商内同批号没有足够的库存支持冲减"
- ELSE
- arg_msg = "物料["+arg_mtrlcode+"]外协商库存更新操作失败,没有库存金额不支持冲减"+"~n"+commit_transaction.SQLErrText
- END IF
- GOTO ext
- END IF
- //--------------------更新结存
- Decimal ld_thqty,ld_thamt
- Decimal ld_inqty,ld_inamt
- Decimal ld_balcqty,ld_balcamt
- Decimal ld_pypkqty,ld_pypkamt
- ld_balcqty = arg_qty
- ld_balcamt = arg_costamt
- CHOOSE CASE billtype
- CASE 4,5
- IF thflag = 0 THEN
- ld_inqty = arg_qty
- ld_inamt = arg_costamt
- ld_thqty = 0
- ld_thamt = 0
- ld_pypkqty = 0
- ld_pypkamt = 0
- ELSE
- ld_inqty = 0
- ld_inamt = 0
- ld_thqty = 0 - arg_qty
- ld_thamt = 0 - arg_costamt
- ld_pypkqty = 0
- ld_pypkamt = 0
- END IF
-
- CASE 9
- ld_inqty = 0
- ld_inamt = 0
- ld_thqty = 0
- ld_thamt = 0
- ld_pypkqty = arg_qty
- ld_pypkamt = arg_costamt
-
- END CHOOSE
- UPDATE ow_wfjgbalc
- SET
- balcqty = balcqty + :ld_balcqty,
- balcamt = case when :sys_option_wfjgware_nocost = 1 then 0 else balcamt + :ld_balcamt end,
- inqty = inqty + :ld_inqty,
- inamt = case when :sys_option_wfjgware_nocost = 1 then 0 else inamt + :ld_inamt end,
- thqty = thqty + :ld_thqty,
- thamt = case when :sys_option_wfjgware_nocost = 1 then 0 else thamt + :ld_thamt end,
- pypkqty = pypkqty + :ld_pypkqty,
- pypkamt = case when :sys_option_wfjgware_nocost = 1 then 0 else pypkamt + :ld_pypkamt end
- WHERE ( scid = :scid ) AND
- ( sptid = :arg_sptid ) AND
- ( mtrlid = :arg_mtrlid ) AND
- ( balcdateint = 0 ) AND
- ( status = :arg_status ) AND
- ( woodcode = :arg_woodcode ) AND
- ( pcode = :arg_pcode ) Using commit_transaction ;
- IF commit_transaction.SQLCode = 0 THEN
- IF commit_transaction.SQLNRows = 0 THEN
-
- INSERT INTO ow_wfjgbalc
- (scid,
- balcdateint,
- sptid,
- mtrlid,
- status,
- woodcode,
- pcode,
- thqty,
- thamt,
- inqty,
- inamt,
- balcqty,
- balcamt,
- pypkqty,
- pypkamt)
- VALUES (:scid,
- 0,
- :arg_sptid,
- :arg_mtrlid,
- :arg_status,
- :arg_woodcode,
- :arg_pcode,
- :ld_thqty,
- case when :sys_option_wfjgware_nocost = 1 then 0 else :ld_thamt end,
- :ld_inqty,
- case when :sys_option_wfjgware_nocost = 1 then 0 else :ld_inamt end,
- :ld_balcqty,
- case when :sys_option_wfjgware_nocost = 1 then 0 else :ld_balcamt end,
- :ld_pypkqty,
- case when :sys_option_wfjgware_nocost = 1 then 0 else :ld_pypkamt end) Using commit_transaction;
-
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- IF Pos(Lower(commit_transaction.SQLErrText),'pk_ow_wfjgbalc') > 0 THEN
- arg_msg = '插入外协商结存操作失败,关键字重复'
- ELSE
- arg_msg = "物料["+arg_mtrlcode+"]外协商结存建立操作失败"+"~n"+commit_transaction.SQLErrText
- END IF
- GOTO ext
- END IF
- END IF
- ELSE
- rslt = 0
- or_err_part = 'column insert or update conflicts with a rule imposed by a previous create rule statement'
- IF commit_transaction.SQLCode = 513 Or Pos(Lower(commit_transaction.SQLErrText),or_err_part) > 0 THEN
- arg_msg = "物料["+arg_mtrlcode+"]同外协商内同批号没有足够的结存支持冲减"
- ELSE
- arg_msg = "物料["+arg_mtrlcode+"]外协商结存更新操作失败"+"~n"+commit_transaction.SQLErrText
- END IF
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- END IF
- RETURN rslt
- end function
- public function integer uf_create_outware (boolean arg_ifcommit, ref string arg_msg);Int rslt = 1
- Long lay_storageid[],ll_storageid,rst_outwareid
- Boolean lb_f = False
- Long i,j,k,ch,chc
- Decimal lde_cost
- uo_outware uo_out
- uo_out = Create uo_outware
- uo_out.commit_transaction = commit_transaction
- uo_out.if_getid_ture = False
- //统计仓库数量,确定出仓单数
- FOR i = 1 To it_mxbt
- FOR j = 1 To UpperBound(lay_storageid)
- IF lay_storageid[j] = outwaremx[i].storageid THEN lb_f = True
- NEXT
- IF lb_f = False THEN
- ch++
- lay_storageid[ch] = outwaremx[i].storageid
- END IF
- lb_f = False
- NEXT
- FOR k = 1 To ch
- ll_storageid = lay_storageid[k]
-
- IF uo_out.newbegin(scid,4,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- uo_out.relid = outwareid
- uo_out.outdate = outdate
- uo_out.outrep = outrep
- uo_out.part = outwarecode
- uo_out.dscrp = dscrp
- uo_out.cusname = '外协出仓'
- uo_out.storageid = ll_storageid
- uo_out.cusid = sptid
-
- chc = 0
- FOR i = 1 To it_mxbt
- IF outwaremx[i].storageid <> ll_storageid THEN CONTINUE
- chc++
- IF uo_out.acceptmx(outwaremx[i].mtrlwareid,&
- outwaremx[i].qty,outwaremx[i].addqty,outwaremx[i].price,1,&
- outwaremx[i].mxdscrp,chc,arg_msg,&
- 0,0,0,0,0,0,0,outwaremx[i].unit,1,'','') = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- NEXT
-
-
- IF uo_out.Save(False,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- rst_outwareid = uo_out.outwareid
-
- //2.原事务审核出仓单
- IF uo_out.getinfo( scid,rst_outwareid,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- IF uo_out.auditing(False,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
-
- //用出仓的成本价更新外协发出单的库存成本价
- FOR i = 1 To it_mxbt
- IF outwaremx[i].storageid <> ll_storageid THEN CONTINUE
- SELECT top 1 cost
- INTO :lde_cost
- FROM u_outwaremx
- WHERE scid = :scid
- AND outwareid = :rst_outwareid
- AND mtrlwareid = :outwaremx[i].mtrlwareid
- And unit = :outwaremx[i].unit;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '查询对应出仓明细成本价失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
-
- IF sys_option_2unit = 0 THEN
- outwaremx[i].uprice = lde_cost
- ELSE
- outwaremx[i].uprice = Round(outwaremx[i].qty * lde_cost/outwaremx[i].uqty,5)
- END IF
- outwaremx[i].cost = lde_cost
- outwaremx[i].costamt = Round(lde_cost * outwaremx[i].qty, 2)
- outwaremx[i].fprice = lde_cost
- outwaremx[i].price = lde_cost
-
- UPDATE ow_wfjgmx_out
- SET uprice = :outwaremx[i].uprice,
- cost = :outwaremx[i].cost,
- costamt = :outwaremx[i].costamt,
- fprice = :outwaremx[i].fprice,
- price = :outwaremx[i].price
- WHERE scid = :scid
- AND outwareid = :outwareid
- And printid = :outwaremx[i].printid;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '更新发出明细成本价失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
-
- NEXT
- NEXT
- ext:
- Destroy uo_out
- IF rslt = 0 THEN
- ROLLBACK Using commit_transaction;
- ELSEIF arg_ifcommit THEN
- COMMIT Using commit_transaction;
- END IF
- RETURN rslt
- end function
- public function integer uf_destroy_outware (boolean arg_ifcommit, ref string arg_msg);Int rslt = 1
- Long i
- Long ay_outwareid[],ll_outwareid,ch
- DECLARE getoutware CURSOR FOR
- SELECT outwareid FROM u_outware Where billtype = 4 AND relid = :outwareid USING commit_transaction;
- OPEN getoutware;
- DO WHILE commit_transaction.SQLCode = 0
- FETCH getoutware INTO :ll_outwareid;
- IF commit_transaction.SQLCode <> 0 THEN EXIT
- ch++
- ay_outwareid[ch] = ll_outwareid
- LOOP
- CLOSE getoutware;
- uo_outware uo_out
- uo_out = CREATE uo_outware
- uo_out.commit_transaction = commit_transaction
- uo_out.if_getid_ture = FALSE
- FOR i = 1 TO ch
- IF uo_out.getinfo(scid,ay_outwareid[i],arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- IF uo_out.c_auditing(FALSE,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- IF uo_out.del(scid,ay_outwareid[i],arg_msg,FALSE) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- NEXT
- ext:
- destroy uo_out
- IF rslt = 0 THEN
- ROLLBACK USING commit_transaction;
- ELSEIF arg_ifcommit THEN
- COMMIT USING commit_transaction ;
- END IF
- RETURN rslt
- end function
- public function integer acceptmx (long arg_mtrlwareid, decimal arg_uqty, string arg_uunit, decimal arg_qty, string arg_mxdscrp, long arg_printid, ref string arg_msg, integer arg_ifrel, long arg_relid, long arg_relprintid, long arg_mtrlid, long arg_storageid, integer arg_dxflag, string arg_plancode, string arg_mtrlcode, string arg_status, string arg_woodcode, string arg_pcode, decimal arg_fprice, decimal arg_rebate, long arg_sptid, decimal arg_rate, string arg_jgdscrp, string arg_mxdscrp2);//外协盘盈,车间外协发出,退回 使用
- Long rslt = 1,cnt = 0,LS_i
- Decimal i_planprice,ld_dftsaleprice
- decimal lde_cost
- Double i_newprice
- String ls_relcode
- IF it_newbegin = False And it_updatebegin = False THEN
- rslt = 0
- arg_msg = "非编辑状态不可以使用,操作取消"
- GOTO ext
- END IF
- //清除空值
- IF IsNull(arg_mtrlwareid) THEN arg_mtrlwareid = 0
- IF IsNull(arg_printid) THEN arg_printid = 0
- IF IsNull(arg_qty) THEN arg_qty = 0
- IF IsNull(arg_mxdscrp) THEN arg_mxdscrp = ''
- IF IsNull(arg_ifrel) THEN arg_ifrel = 0
- IF IsNull(arg_relid) THEN arg_relid = 0
- IF IsNull(arg_mtrlid) THEN arg_mtrlid = 0
- IF IsNull(arg_mtrlcode) THEN arg_mtrlcode = ''
- IF IsNull(arg_plancode) THEN arg_plancode = ''
- IF IsNull(arg_status) THEN arg_status = ''
- IF IsNull(arg_fprice) THEN arg_fprice = 0
- IF IsNull(arg_rebate) THEN arg_rebate = 0
- IF IsNull(arg_mxdscrp) THEN arg_mxdscrp = ''
- IF IsNull(arg_relid) THEN arg_relid = 0
- IF IsNull(arg_relprintid) THEN arg_relprintid = 0
- IF IsNull(arg_ifrel) THEN arg_ifrel = 0
- IF IsNull(arg_mxdscrp) THEN arg_woodcode = ''
- IF IsNull(arg_pcode) THEN arg_pcode = ''
- IF IsNull(arg_storageid) THEN arg_storageid = 0
- IF IsNull(arg_uqty) THEN arg_uqty = 0
- IF IsNull(arg_uunit) THEN arg_uunit = ''
- IF IsNull(arg_rate) THEN arg_rate = 1
- IF IsNull(arg_jgdscrp) THEN arg_jgdscrp = ''
- IF IsNull(arg_mxdscrp2) THEN arg_mxdscrp2 = ''
- // 如果出仓数量为 0,或物料编号为空,则不作任何处理
- IF arg_mtrlid = 0 Or arg_qty = 0 THEN
- rslt = 1
- GOTO ext
- END IF
- IF sys_option_2unit = 1 THEN
- IF arg_uqty = 0 THEN
- arg_msg = '行:'+String(arg_printid)+ ',请输入计价数量'
- rslt = 0
- GOTO ext
- END IF
-
- IF Trim(arg_uunit) = '' THEN
- arg_msg = '行:'+String(arg_printid)+ ',请输入计价单位'
- rslt = 0
- GOTO ext
- END IF
- END IF
- //检查物料id
- SELECT planprice
- INTO :i_planprice
- FROM u_mtrldef
- Where u_mtrldef.mtrlid = :arg_mtrlid Using commit_transaction ;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- IF Pos(Lower(commit_transaction.SQLErrText),'more than') > 0 THEN
- arg_msg = '查询物料资料操作失败,查询数据返回值多于一个'
- ELSE
- arg_msg = "查询操作失败,编码:"+arg_mtrlcode
- END IF
- GOTO ext
- END IF
- IF f_check_status(1, arg_status) = 0 THEN
- rslt = 0
- arg_msg = "查询操作失败,可能颜色未定义,编码:"+arg_mtrlcode+",颜色:"+arg_status
- GOTO ext
- END IF
- IF arg_ifrel = 1 THEN
- IF arg_relid = 0 THEN
- rslt = 0
- arg_msg = '请选择加工计划!'
- GOTO ext
- END IF
-
- SELECT taskcode INTO :ls_relcode
- FROM u_order_wfjg
- Where wfjgID = :arg_relid Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '查询加工计划号失败!没有对应的外加工计划'
- GOTO ext
- END IF
-
- SELECT count(*) INTO :cnt
- FROM u_order_wfjgMx_out
- WHERE wfjgid = :arg_relid
- AND mtrlid = :arg_mtrlid
- AND status = :arg_status
- 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 = '出仓物料:'+arg_mtrlcode+'不在加工计划出仓明细中!'
- GOTO ext
- END IF
- END IF
- //***********************************************
- IF thflag = 1 THEN
- //退回单,取供应商库存单价
- SELECT cost
- INTO :lde_cost
- FROM ow_wfjgware
- WHERE ( scid = :scid )
- AND sptid = :sptid
- AND ( mtrlid = :arg_mtrlid )
- AND (status = :arg_Status)
- AND woodcode = :arg_woodcode
- AND pcode = :arg_pcode
- AND plancode = :arg_plancode
- Using commit_transaction ;
- IF commit_transaction.SQLCode <> 0 THEN
- lde_cost = -1
- END IF
-
- IF lde_cost > 0 THEN
- arg_fprice = lde_cost
- END IF
- END IF
- IF arg_fprice * arg_rebate < 0 THEN //检查进仓价
- rslt = 0
- arg_msg = "编码:" + String(arg_mtrlcode)+" 单价错误"
- GOTO ext
- END IF
- //IF sys_option_buyprice_type = 1 THEN
- arg_plancode = arg_plancode
- //ELSE
- // arg_plancode = String(Round(arg_fprice * arg_rebate,10))
- //END IF
- //写入内容
- it_mxbt++
- outwaremx[it_mxbt].printid = arg_printid
- outwaremx[it_mxbt].storageid = arg_storageid
- outwaremx[it_mxbt].mtrlwareid = arg_mtrlwareid
- outwaremx[it_mxbt].mtrlid = arg_mtrlid
- outwaremx[it_mxbt].status = arg_status
- outwaremx[it_mxbt].woodcode = arg_woodcode
- outwaremx[it_mxbt].pcode = arg_pcode
- outwaremx[it_mxbt].qty = arg_qty
- IF sys_option_2unit = 0 THEN
- IF arg_rate <> 0 THEN
- arg_uqty = arg_qty/arg_rate
- outwaremx[it_mxbt].uprice = Round(arg_qty * arg_fprice/arg_uqty,5)
- outwaremx[it_mxbt].uqty = arg_uqty
- ELSE
- outwaremx[it_mxbt].uprice = arg_fprice
- outwaremx[it_mxbt].uqty = arg_qty
- END IF
- ELSE
- outwaremx[it_mxbt].uprice = Round(arg_qty * arg_fprice/arg_uqty,5)
- outwaremx[it_mxbt].uqty = arg_uqty
- END IF
- outwaremx[it_mxbt].uunit = arg_uunit
- outwaremx[it_mxbt].rate = arg_rate
- outwaremx[it_mxbt].rebate = arg_rebate
- outwaremx[it_mxbt].fprice = arg_fprice
- outwaremx[it_mxbt].price = Round(arg_fprice * arg_rebate,10)
- outwaremx[it_mxbt].cost = arg_fprice
- outwaremx[it_mxbt].costamt = Round(arg_fprice * arg_qty,2)
- outwaremx[it_mxbt].newpriceamt = Round(i_newprice * arg_qty,2)
- outwaremx[it_mxbt].plancode = arg_plancode
- outwaremx[it_mxbt].planprice = i_planprice
- outwaremx[it_mxbt].mtrlcode = arg_mtrlcode
- outwaremx[it_mxbt].mxdscrp = arg_mxdscrp
- outwaremx[it_mxbt].mxdscrp2 = arg_mxdscrp2
- outwaremx[it_mxbt].sptid = arg_sptid
- outwaremx[it_mxbt].dxflag = arg_dxflag
- outwaremx[it_mxbt].ifrel = arg_ifrel
- outwaremx[it_mxbt].relid = arg_relid
- outwaremx[it_mxbt].relprintid = arg_relprintid
- outwaremx[it_mxbt].relcode = ls_relcode
- outwaremx[it_mxbt].jgdscrp = arg_jgdscrp
- ext:
- IF rslt = 0 THEN p_clearmx()
- IF thflag = 0 THEN
- arg_msg = '车间外协发出单,'+ arg_msg
- ELSE
- arg_msg = '车间外协退回单,'+ arg_msg
- END IF
- RETURN rslt
- end function
- public function integer acceptmx (long arg_mtrlwareid, decimal arg_uqty, string arg_uunit, decimal arg_qty, string arg_mxdscrp, long arg_printid, ref string arg_msg, integer arg_ifrel, long arg_relid, long arg_relprintid, decimal arg_rate, decimal arg_addqty, string arg_jgdscrp, string arg_mxdscrp2);//仓库外协发出,退回 使用
- Long rslt = 1,cnt = 0,LS_i
- Long i_mtrlid,i_storageid,i_sptid
- Int i_dxflag
- String i_plancode,i_mtrlcode,i_status,i_woodcode,i_pcode
- Decimal i_planprice,ld_dftsaleprice
- Double i_cost,i_newprice, lde_cost
- Decimal i_notauditqty,i_allouseqty,i_addqty
- String ls_relcode
- Decimal ld_rate = 1
- IF it_newbegin = False And it_updatebegin = False THEN
- rslt = 0
- arg_msg = "非编辑状态不可以使用,操作取消"
- GOTO ext
- END IF
- //清除空值
- IF IsNull(arg_mtrlwareid) THEN arg_mtrlwareid = 0
- IF IsNull(arg_printid) THEN arg_printid = 0
- IF IsNull(arg_qty) THEN arg_qty = 0
- IF IsNull(arg_uqty) THEN arg_uqty = 0
- IF IsNull(arg_uunit) THEN arg_uunit = ''
- IF IsNull(arg_mxdscrp) THEN arg_mxdscrp = ''
- IF IsNull(arg_ifrel) THEN arg_ifrel = 0
- IF IsNull(arg_relid) THEN arg_relid = 0
- IF IsNull(arg_relprintid) THEN arg_relprintid = 0
- IF IsNull(arg_rate) THEN arg_rate = 1
- IF IsNull(arg_addqty) THEN arg_addqty = 0
- IF IsNull(arg_jgdscrp) THEN arg_jgdscrp = ''
- IF IsNull(arg_mxdscrp2) THEN arg_mxdscrp2 = ''
- // 如果出仓数量为 0,或物料编号为空,则不作任何处理
- IF arg_mtrlwareid = 0 Or arg_qty = 0 THEN
- rslt = 1
- GOTO ext
- END IF
- IF sys_option_2unit = 1 THEN
- IF arg_uqty = 0 THEN
- arg_msg = '行:'+String(arg_printid)+ ',请输入计价数量'
- rslt = 0
- GOTO ext
- END IF
-
- IF Trim(arg_uunit) = '' THEN
- arg_msg = '行:'+String(arg_printid)+ ',请输入计价单位'
- rslt = 0
- GOTO ext
- END IF
- END IF
- //检查物料库存ID
- SELECT u_mtrlware.mtrlid,
- u_mtrlware.storageid,
- u_mtrlware.plancode,
- u_mtrlware.status,
- u_mtrlware.cost,
- u_mtrldef.planprice,
- u_mtrldef.mtrlcode,
- u_mtrlware.sptid,
- u_mtrlware.dxflag,
- u_mtrlware.woodcode,
- u_mtrlware.pcode,
- isnull(uv_mtrlware_noauditingqty.noauditingqty,0),
- u_mtrlware.noallocqty,
- u_mtrlware.allocaddqty
- INTO :i_mtrlid,
- :i_storageid,
- :i_plancode,
- :i_status,
- :i_cost,
- :i_planprice,
- :i_mtrlcode,
- :i_sptid,
- :i_dxflag,
- :i_woodcode,
- :i_pcode,
- :i_notauditqty,
- :i_allouseqty,
- :i_addqty
- FROM u_mtrlware left OUTER join uv_mtrlware_noauditingqty
- on ( u_mtrlware.mtrlwareid = uv_mtrlware_noauditingqty.mtrlwareid)
- AND ( u_mtrlware.scid = uv_mtrlware_noauditingqty.scid),u_mtrldef
- WHERE ( u_mtrlware.mtrlwareid = :arg_mtrlwareid )
- AND ( u_mtrlware.mtrlid = u_mtrldef.mtrlid )
- And ( u_mtrlware.scid = :scid ) Using commit_transaction;
-
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "查询操作失败,库存编号错误"
- GOTO ext
- END IF
- IF IsNull(ld_dftsaleprice) THEN ld_dftsaleprice = 0
- IF IsNull(i_cost) THEN i_cost = 0
- IF IsNull(i_plancode) THEN i_plancode = ''
- IF IsNull(i_status) THEN i_status = ''
- IF IsNull(i_mtrlid) THEN i_mtrlid = 0
- IF IsNull(i_planprice) THEN i_planprice = 0
- IF IsNull(i_sptid) THEN i_sptid = 0
- IF IsNull(i_dxflag) THEN i_dxflag = 0
- IF IsNull(i_woodcode) THEN i_woodcode = ''
- IF IsNull(i_pcode) THEN i_pcode = ''
- IF arg_ifrel = 1 THEN
- IF arg_relid = 0 THEN
- rslt = 0
- arg_msg = '请选择外协订单!'
- GOTO ext
- END IF
-
- SELECT taskcode INTO :ls_relcode
- FROM u_order_wfjg
- Where wfjgID = :arg_relid Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- IF Pos(Lower(commit_transaction.SQLErrText),'more than') > 0 THEN
- arg_msg = '查询外协订单号失败!查询数据返回值多于一个'
- ELSE
- arg_msg = '查询外协订单号失败!(错误外协订单唯一码)'
- END IF
- GOTO ext
- END IF
-
- SELECT count(*) INTO :cnt
- FROM u_order_wfjgMx_out
- WHERE wfjgid = :arg_relid
- AND mtrlid = :i_mtrlid
- AND status = :i_status
- And woodcode = :i_woodcode 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(arg_printid)+ ',出仓物料:'+i_mtrlcode+'不在外协订单发出明细中!'
- GOTO ext
- END IF
- END IF
- //*****检查大于未开数不可以开单
- IF flag = 0 THEN
- Decimal ol_mtrl_qty = 0
- Int ls_noallocflag
-
- SELECT noallocflag INTO :ls_noallocflag
- FROM u_storage
- Where storageid = :i_storageid Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '查询仓库允许使用未开单库存属性失败'+commit_transaction.SQLErrText
- GOTO ext
- END IF
-
- IF ls_noallocflag = 1 THEN
-
- IF it_updatebegin THEN
- SELECT sum(ow_wfjgmx_out.qty)
- INTO :ol_mtrl_qty
- FROM ow_wfjgmx_out
- WHERE ow_wfjgmx_out.outwareid = :outwareid
- AND ow_wfjgmx_out.mtrlwareid = :arg_mtrlwareid
- And scid = :scid Using commit_transaction;
- IF commit_transaction.SQLCode = -1 THEN
- rslt = 0
- arg_msg = '查询原开单数量失败'
- GOTO ext
- END IF
- END IF
-
- IF arg_qty > ( i_allouseqty - i_notauditqty + ol_mtrl_qty ) THEN
- rslt = 0
- arg_msg = String(i_mtrlcode)+"库存未开单数不够,不能开单.未开单数{"+String(i_allouseqty - i_notauditqty + ol_mtrl_qty,'#####,0.00##')+"}"
- GOTO ext
- END IF
-
- IF arg_addqty > i_addqty THEN
- rslt = 0
- arg_msg = String(i_mtrlcode)+"库存辅数不够,不能开单.库存辅数{"+String(i_addqty,'#####,0.00##')+"}"
- GOTO ext
- END IF
- END IF
- END IF
- //***********************************************
- IF thflag = 1 THEN
- //退回单,取供应商库存单价
- SELECT cost
- INTO :lde_cost
- FROM ow_wfjgware
- WHERE ( scid = :scid )
- AND sptid = :sptid
- AND ( mtrlid = :i_mtrlid )
- AND (status = :i_Status)
- AND woodcode = :i_woodcode
- AND pcode = :i_pcode
- AND plancode = :i_plancode
- Using commit_transaction ;
- IF commit_transaction.SQLCode <> 0 THEN
- lde_cost = -1
- END IF
-
- IF lde_cost > 0 THEN
- i_cost = lde_cost
- END IF
- END IF
- IF i_cost < 0 THEN //检查进仓价
- rslt = 0
- arg_msg = "编码:" + String(i_mtrlcode)+" 单价错误"
- GOTO ext
- END IF
- //写入内容
- it_mxbt++
- outwaremx[it_mxbt].printid = arg_printid
- outwaremx[it_mxbt].storageid = i_storageid
- outwaremx[it_mxbt].mtrlwareid = arg_mtrlwareid
- outwaremx[it_mxbt].mtrlid = i_mtrlid
- outwaremx[it_mxbt].status = i_status
- outwaremx[it_mxbt].woodcode = i_woodcode
- outwaremx[it_mxbt].pcode = i_pcode
- outwaremx[it_mxbt].qty = arg_qty
- outwaremx[it_mxbt].uunit = arg_uunit
- outwaremx[it_mxbt].rate = arg_rate
- outwaremx[it_mxbt].addqty = arg_addqty
- IF sys_option_2unit = 0 THEN
- // outwaremx[it_mxbt].uqty = arg_qty
- // outwaremx[it_mxbt].uprice = i_cost
- arg_uqty = arg_qty/arg_rate
- outwaremx[it_mxbt].uqty = arg_uqty
- outwaremx[it_mxbt].uprice = Round(arg_qty * i_cost/arg_uqty,5)
- ELSE
- outwaremx[it_mxbt].uqty = arg_uqty
- outwaremx[it_mxbt].uprice = Round(arg_qty * i_cost/arg_uqty,5)
- END IF
- outwaremx[it_mxbt].cost = i_cost
- outwaremx[it_mxbt].costamt = Round(i_cost * arg_qty,2)
- outwaremx[it_mxbt].newpriceamt = Round(i_newprice * arg_qty,2)
- outwaremx[it_mxbt].rebate = 1
- outwaremx[it_mxbt].fprice = i_cost
- outwaremx[it_mxbt].price = i_cost
- outwaremx[it_mxbt].plancode = i_plancode
- outwaremx[it_mxbt].planprice = i_planprice
- outwaremx[it_mxbt].mtrlcode = i_mtrlcode
- outwaremx[it_mxbt].mxdscrp = arg_mxdscrp
- outwaremx[it_mxbt].mxdscrp2 = arg_mxdscrp2
- outwaremx[it_mxbt].sptid = i_sptid
- outwaremx[it_mxbt].dxflag = i_dxflag
- outwaremx[it_mxbt].ifrel = arg_ifrel
- outwaremx[it_mxbt].relid = arg_relid
- outwaremx[it_mxbt].relprintid = arg_relprintid
- outwaremx[it_mxbt].relcode = ls_relcode
- outwaremx[it_mxbt].jgdscrp = arg_jgdscrp
- ext:
- IF rslt = 0 THEN p_clearmx()
- IF thflag = 0 THEN
- arg_msg = '仓库外协发出单,'+ arg_msg
- ELSE
- arg_msg = '仓库外协退回单,'+ arg_msg
- END IF
- RETURN rslt
- end function
- on uo_outware_wfjg.create
- call super::create
- TriggerEvent( this, "constructor" )
- end on
- on uo_outware_wfjg.destroy
- TriggerEvent( this, "destructor" )
- call super::destroy
- end on
|