123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577 |
- $PBExportHeader$uo_workpricetable.sru
- forward
- global type uo_workpricetable from nonvisualobject
- end type
- end forward
- global type uo_workpricetable from nonvisualobject
- end type
- global uo_workpricetable uo_workpricetable
- type variables
- long mtrlid //产品id
- long wrkid
- string wpcode
- long wpmtrlid
- int if_hourpay
- decimal eoq
- decimal wprate
- s_workpricetable workpricemx[] //明细结构数组
- long it_mxbt=0 //明细结构数组末指针
- boolean it_updatebegin=false//修改标志
- Long deep_count = 0
- long il_printid = 0
- int uo_option_orderrqwp_auditgj
- end variables
- forward prototypes
- public function integer p_clearmx ()
- public function integer p_reset ()
- public function integer c_auditing (long arg_mtrlid, ref string arg_msg, boolean arg_ifcommit)
- public function integer acceptsumrec (long arg_mtrlid, ref string arg_msg, boolean arg_ifcommit)
- public function integer save (boolean arg_ifcommit, ref string arg_msg)
- public function integer uof_del_action (long arg_mtrlid, string arg_procode, boolean arg_ifcommit, ref string arg_msg)
- public function integer uof_add_action (long arg_mtrlid, string arg_procode, long arg_actionid, string arg_actionname, decimal arg_qty, decimal arg_actiontime, string arg_dscrp, boolean arg_ifcommit, ref string arg_msg)
- public function integer uof_workhour_update (long arg_mtrlid, string arg_procode, decimal arg_workhour, boolean arg_ifcommit, ref string arg_msg)
- public function integer uof_add_list (long arg_mtrlid, string arg_wpcode, long arg_wrkid, integer arg_templet, string arg_dscrp, integer arg_ifdft, string arg_opemp, ref string arg_msg, boolean arg_ifcommit)
- public function integer updatebegin (long arg_mtrlid, string arg_wpcode, long arg_wrkid, ref string arg_msg)
- public function integer f_clearpfmx (long arg_mtrlid, string arg_wpcode, ref string arg_msg, boolean arg_ifcommit)
- public function integer uof_del_list (long arg_mtrlid, string arg_wpcode, ref string arg_msg, boolean arg_ifcommit)
- public function integer uof_set_templet (long arg_mtrlid, string arg_wpcode, integer arg_templet, ref string arg_msg, boolean arg_ifcommit)
- public function integer update_auditflag (long arg_mtrlid, string arg_wpcode, datetime arg_auditdate, string arg_auditingrep, ref string arg_msg, boolean arg_ifcommit)
- public function integer auditing (long arg_mtrlid, string arg_wpcode, long arg_wrkgrpid, string arg_auditingrep, ref string arg_msg, boolean arg_ifcommit)
- public function integer c_auditing (long arg_mtrlid, string arg_wpcode, long arg_wrkgrpid, ref string arg_msg, boolean arg_ifcommit)
- public function integer auditing_gs (long arg_mtrlid, string arg_wpcode, long arg_wrkgrpid, string arg_auditingrep, ref string arg_msg, boolean arg_ifcommit)
- public function integer c_auditing_gs (long arg_mtrlid, string arg_wpcode, long arg_wrkgrpid, ref string arg_msg, boolean arg_ifcommit)
- public function integer f_addworkprice (long arg_mtrlid, string arg_wpcode, ref string arg_msg, boolean arg_ifcommit)
- public function integer uof_setdft (long arg_mtrlid, string arg_wpcode, integer arg_dft, ref string arg_msg, boolean arg_ifcommit)
- public function integer auditing_gj (long arg_mtrlid, string arg_wpcode, long arg_wrkgrpid, string arg_auditingrep, ref string arg_msg, boolean arg_ifcommit)
- public function integer c_auditing_gj (long arg_mtrlid, string arg_wpcode, long arg_wrkgrpid, ref string arg_msg, boolean arg_ifcommit)
- public function integer auditing_mx (long arg_mtrlid, string arg_wpcode, string arg_procode[], string arg_auditingrep, ref string arg_msg, boolean arg_ifcommit)
- public function integer auditing_gj_mx (long arg_mtrlid, string arg_wpcode, string arg_procode[], string arg_auditingrep, ref string arg_msg, boolean arg_ifcommit)
- public function integer c_auditing_mx (long arg_mtrlid, string arg_wpcode, string arg_procode[], ref string arg_msg, boolean arg_ifcommit)
- public function integer c_auditing_gj_mx (long arg_mtrlid, string arg_wpcode, string arg_procode[], ref string arg_msg, boolean arg_ifcommit)
- public function integer auditing_gs_mx (long arg_mtrlid, string arg_wpcode, string arg_procode[], string arg_auditingrep, ref string arg_msg, boolean arg_ifcommit)
- public function integer c_auditing_gs_mx (long arg_mtrlid, string arg_wpcode, string arg_procode[], ref string arg_msg, boolean arg_ifcommit)
- public function integer acceptmx (long arg_proid, string arg_procode, string arg_proname, decimal arg_workqty, decimal arg_workprice, long arg_wrkgrpid, string arg_worklevel, string arg_techlevel, decimal arg_workhour_minute, string arg_dscrp, integer arg_lastflag, long arg_proorder, integer arg_ifownpro, integer arg_lsxtype, integer arg_ifstandard, string arg_status, integer arg_ifjd, string arg_utcode, integer arg_sctype, long arg_equipmentid, decimal arg_workdays, decimal arg_beforehour_minute, decimal arg_afterhour_minute, string arg_pricestr, string arg_partname, decimal arg_eqworkhour_minute, string arg_worktype, decimal arg_arg1, decimal arg_arg2, decimal arg_arg3, decimal arg_arg4, decimal arg_arg5, decimal arg_arg6, decimal arg_arg7, decimal arg_arg8, decimal arg_arg9, decimal arg_eq_empnum, decimal arg_fzrate, decimal arg_factor, string arg_workqtystr, integer arg_ifgroup, decimal arg_u_workqty, decimal arg_u_workprice, string arg_u_workqtystr, string arg_u_pricestr, string arg_rpcode, integer arg_ifdftpg, integer arg_ifdftjj, decimal arg_waittime, decimal arg_lasthour, ref string arg_msg)
- public function integer uof_update_workprice_zl (long arg_mtrlid, string arg_wpcode, string arg_procode, ref string arg_msg, boolean arg_ifcommit)
- public function integer f_addpfmx (long arg_mtrlid, string arg_wpcode, string arg_pfcode, decimal arg_qty, long arg_lp, ref string arg_msg, boolean arg_ifcommit, integer arg_protype)
- end prototypes
- public function integer p_clearmx ();//INT p_clearmx()
- //清除明细
- it_mxbt=0
- RETURN 1
- end function
- public function integer p_reset ();//INT p_RESET()
- //清除对象及其明细
- wpmtrlid = 0
- wprate = 0
- it_updatebegin=FALSE
- //清除明细
- P_CLEARMX()
- RETURN 1
- end function
- public function integer c_auditing (long arg_mtrlid, ref string arg_msg, boolean arg_ifcommit);Long rslt = 1,ll_count,ll_Auditflag
- DateTime serdate
- IF IsNull(arg_mtrlid) THEN
- rslt = 0
- arg_msg = '没有撤核对象!'
- GOTO ext
- END IF
-
- SELECT Auditflag INTO :ll_Auditflag FROM u_mtrldef Where mtrlid = :arg_mtrlid;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '该产品没有审核!'
- GOTO ext
- END IF
- SetNull(serdate)
- UPDATE u_mtrldef
- SET Auditflag = 0,
- Audit_emp = '',
- Audit_date = :serdate
- Where mtrlid = :arg_mtrlid;
-
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '撤核失败!原因:'+sqlca.SQLErrText
- ROLLBACK;
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer acceptsumrec (long arg_mtrlid, ref string arg_msg, boolean arg_ifcommit);////acceptsumrec(long arg_mtrlid,string arg_msg, boolean arg_ifcommit)
- //s_workpricetable s_pricetable[]
- //dec ls_sumhour,ls_sumprice
- //long ls_wrkgrpid,i=1,k,ls_mxid,ls_proid,procount
- //int rslt=1
- //string ls_procode
- //
- //declare getworkprosum cursor for
- // SELECT SUM(u_sc_workprice.Workhour), SUM(u_sc_workprice.workPrice),
- // u_sc_workgroup.wrkgrpid
- // FROM u_sc_workprice, u_sc_workprocedure, u_sc_workgroup
- // WHERE (u_sc_workprice.proid = u_sc_workprocedure.proid) AND
- // (u_sc_workprocedure.wrkgrpid = u_sc_workgroup.wrkgrpid) AND
- // ((u_sc_workprice.Mtrlid = :arg_mtrlid)) AND u_sc_workprice.sumflag = 0
- // GROUP BY u_sc_workgroup.wrkgrpid;
- //open getworkprosum;
- //Do While sqlca.sqlcode=0
- // Fetch getworkprosum into :ls_sumhour,:ls_sumprice,:ls_wrkgrpid;
- // if sqlca.sqlcode<>0 then exit;
- // s_pricetable[i].wrkgrpid=ls_wrkgrpid
- // s_pricetable[i].workhour=ls_sumhour
- // s_pricetable[i].workprice=ls_sumprice
- // i++
- //loop
- //Close getworkprosum;
- //delete from u_sc_workprice where mtrlid=:arg_mtrlid and sumflag=1;
- //if sqlca.sqlcode=-1 then
- // rslt=0
- // arg_msg='删除工序失败!'
- // goto ext
- //end if
- //
- //for k= 1 to upperbound(s_pricetable)
- //// ls_mxid=f_sys_scidentity(0,"u_sc_workprice","mxid",arg_msg,false)
- //// if ls_mxid<0 then
- //// rslt=0
- //// goto ext
- //// end if
- //
- // select proid,code into :ls_proid,:ls_procode from u_sc_workprocedure where wrkgrpid=:s_pricetable[K].wrkgrpid and sysflag=1;
- // if sqlca.sqlcode=-1 then
- // arg_msg='查询工序资料失败,原因:'+sqlca.sqlerrtext
- // rslt=0
- // goto ext
- // end if
- //
- // SELECT count(*) into :procount FROM u_sc_workprice INNER JOIN
- // u_sc_workprocedure ON u_sc_workprice.proid = u_sc_workprocedure.proid AND
- // u_sc_workprocedure.wrkgrpid = :s_pricetable[k].wrkgrpid AND u_sc_workprice.mtrlid = :arg_mtrlid AND
- // u_sc_workprice.sumflag = 0;
- // if sqlca.sqlcode=-1 then
- // arg_msg='查询该产品工序资料失败,原因:'+sqlca.sqlerrtext
- // rslt=0
- // goto ext
- // end if
- //
- // if procount>1 then
- //
- // insert into u_sc_workprice
- // (mtrlid,
- // proid,
- // Procode,
- // workPrice,
- // Workhour,
- // sumflag)
- // values(:arg_mtrlid,
- // :ls_proid,
- // :ls_Procode,
- // :s_pricetable[K].workPrice,
- // :s_pricetable[K].Workhour,
- // 1);
- //
- // if sqlca.sqlcode<>0 then
- // rslt=0
- // arg_msg="插入工序明细表错误!原因:"+sqlca.sqlerrtext
- // rollback;
- // goto ext
- // end if
- // end if
- //next
- //
- //
- //ext:
- //if rslt=1 and arg_ifcommit then
- // commit;
- //end if
- //
- //if rslt=0 then
- // rollback;
- //end if
- //return rslt
- return 1
-
-
- end function
- public function integer save (boolean arg_ifcommit, ref string arg_msg);Long rslt = 1,i
- Long cnt
- DateTime serdate
- String ls_newemp
- DateTime ldt_newdate,ldt_nulldt
- Decimal ld_lastprice
- Int li_auditflag,li_auditflag_gj
- String ls_auditrep,ls_auditrep_gs
- DateTime ldt_auditdate,ldt_auditdate_gs
- int li_changeflag,li_ifchangebill
- SetNull(ldt_nulldt)
- If it_updatebegin = True Then
- If IsNull(mtrlid) Or mtrlid = 0 Then
- arg_msg = '产品错误,没有对应的产品'
- rslt = 0
- Goto ext
- End If
-
- If wpmtrlid > 0 Then
- cnt = 0
- Select count(*) Into :cnt
- From u_mtrldef
- Where mtrlid = :wpmtrlid;
- If sqlca.SQLCode <> 0 Then
- arg_msg = '查询标准产品资料失败'
- rslt = 0
- Goto ext
- End If
-
- If cnt <> 1 Then
- arg_msg = '不存在标准产品资料或资料重复'
- rslt = 0
- Goto ext
- End If
-
- If wprate <= 0 Then
- arg_msg = '请正确输入标准产品工价的比率'
- rslt = 0
- Goto ext
- End If
- End If
-
- Select Top 1 getdate() Into :serdate From u_user;
- If sqlca.SQLCode <> 0 Then
- arg_msg = '取服务器时间失败'
- rslt = 0
- Goto ext
- End If
-
- //先读取原明细信息
- For i = 1 To it_mxbt
- Select newemp,
- newdate,
- lastprice,
- auditflag,
- auditflag_gj,
- auditrep,
- auditrep_gs,
- auditdate,
- auditdate_gs,
- changeflag,
- ifchangebill
- Into :ls_newemp,
- :ldt_newdate,
- :ld_lastprice,
- :li_auditflag,
- :li_auditflag_gj,
- :ls_auditrep,
- :ls_auditrep_gs,
- :ldt_auditdate,
- :ldt_auditdate_gs,
- :li_changeflag,
- :li_ifchangebill
- From u_sc_workprice
- Where mtrlid = :mtrlid
- And wpcode = :wpcode
- And procode = :workpricemx[i].procode;
- If sqlca.SQLCode <> 0 Then
- workpricemx[i].newemp = publ_operator
- workpricemx[i].newdate = serdate
- workpricemx[i].modemp = ''
- workpricemx[i].moddate = ldt_nulldt
- workpricemx[i].lastprice = 0
- workpricemx[i].auditflag = 0
- workpricemx[i].auditflag_gj = 0
- workpricemx[i].auditrep = ''
- workpricemx[i].auditrep_gs = ''
- workpricemx[i].auditdate = ldt_nulldt
- workpricemx[i].auditdate_gs = ldt_nulldt
- workpricemx[i].changeflag = 0
- workpricemx[i].ifchangebill = 0
- Else
- workpricemx[i].newemp = ls_newemp
- workpricemx[i].newdate = ldt_newdate
- workpricemx[i].modemp = publ_operator
- workpricemx[i].moddate = serdate
- workpricemx[i].lastprice = ld_lastprice
- workpricemx[i].auditflag = li_auditflag
- workpricemx[i].auditflag_gj = li_auditflag_gj
- workpricemx[i].auditrep = ls_auditrep
- workpricemx[i].auditrep_gs = ls_auditrep_gs
- workpricemx[i].auditdate = ldt_auditdate
- workpricemx[i].auditdate_gs = ldt_auditdate_gs
- workpricemx[i].changeflag = li_changeflag
- workpricemx[i].ifchangebill = li_ifchangebill
- End If
- Next
-
- Update u_mtrldef
- Set popdate = :serdate,
- popemp = :publ_operator,
- wpmtrlid = :wpmtrlid,
- wprate = :wprate
- Where mtrlid = :mtrlid;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- arg_msg = '写入操作日期和操作人失败!'+sqlca.SQLErrText
- Goto ext
- End If
-
- Update u_mtrl_workprice
- Set u_mtrl_workprice.opdate = :serdate,
- u_mtrl_workprice.opemp = :publ_operator
- Where mtrlid = :mtrlid
- And wpcode = :wpcode;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- arg_msg = '写入操作日期和操作人失败!'+sqlca.SQLErrText
- Goto ext
- End If
-
- Delete From u_sc_workprice
- Where mtrlid = :mtrlid
- And wpcode = :wpcode
- And (auditflag = 0 Or auditflag_gj = 0 );
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- arg_msg = '删除工价表明细失败!'
- Goto ext
- End If
-
- For i = 1 To it_mxbt
- Insert Into u_sc_workprice
- (mtrlid,
- wpcode,
- wrkid,
- proid,
- proname,
- procode,
- workprice,
- worklevel,
- techlevel,
- workhour,
- dscrp,
- lastflag,
- proorder,
- workqty,
- wrkgrpid,
- ifownpro,
- lsxtype,
- ifstandard,
- status,
- ifjd,
- utcode,
- sctype,
- equipmentid,
- workdays,
- beforehour,
- afterhour,
- pricestr,
- partname,
- eqworkhour,
- worktype,
- arg1,
- arg2,
- arg3,
- arg4,
- arg5,
- arg6,
- arg7,
- arg8,
- arg9,
- workhour_minute,
- beforehour_minute,
- afterhour_minute,
- eqworkhour_minute,
- totalhour,
- eq_empnum,
- fzrate,
- factor,
- workqtystr,
- ifgroup,
- u_workqty,
- u_workprice,
- u_workqtystr,
- u_pricestr,
- newemp,
- newdate,
- modemp,
- moddate,
- lastprice,
- auditflag,
- auditflag_gj,
- auditrep,
- auditrep_gs,
- auditdate,
- auditdate_gs,
- changeflag,
- rpcode,
- ifdftpg,
- ifdftjj,
- waittime,
- lasthour,
- ifchangebill)
- Values(:mtrlid,
- :wpcode,
- :wrkid,
- :workpricemx[i].proid,
- :workpricemx[i].proname,
- :workpricemx[i].procode,
- :workpricemx[i].workprice,
- :workpricemx[i].worklevel,
- :workpricemx[i].techlevel,
- :workpricemx[i].workhour,
- :workpricemx[i].dscrp,
- :workpricemx[i].lastflag,
- :workpricemx[i].proorder,
- :workpricemx[i].workqty,
- :workpricemx[i].wrkgrpid,
- :workpricemx[i].ifownpro,
- :workpricemx[i].lsxtype,
- :workpricemx[i].ifstandard,
- :workpricemx[i].status,
- :workpricemx[i].ifjd,
- :workpricemx[i].utcode,
- :workpricemx[i].sctype,
- :workpricemx[i].equipmentid,
- :workpricemx[i].workdays,
- :workpricemx[i].beforehour,
- :workpricemx[i].afterhour,
- :workpricemx[i].pricestr,
- :workpricemx[i].partname,
- :workpricemx[i].eqworkhour,
- :workpricemx[i].worktype,
- :workpricemx[i].arg1,
- :workpricemx[i].arg2,
- :workpricemx[i].arg3,
- :workpricemx[i].arg4,
- :workpricemx[i].arg5,
- :workpricemx[i].arg6,
- :workpricemx[i].arg7,
- :workpricemx[i].arg8,
- :workpricemx[i].arg9,
- :workpricemx[i].workhour_minute,
- :workpricemx[i].beforehour_minute,
- :workpricemx[i].afterhour_minute,
- :workpricemx[i].eqworkhour_minute,
- :workpricemx[i].totalhour,
- :workpricemx[i].eq_empnum,
- :workpricemx[i].fzrate,
- :workpricemx[i].factor,
- :workpricemx[i].workqtystr,
- :workpricemx[i].ifgroup,
- :workpricemx[i].u_workqty,
- :workpricemx[i].u_workprice,
- :workpricemx[i].u_workqtystr,
- :workpricemx[i].u_pricestr,
- :workpricemx[i].newemp,
- :workpricemx[i].newdate,
- :workpricemx[i].modemp,
- :workpricemx[i].moddate,
- :workpricemx[i].lastprice,
- :workpricemx[i].auditflag,
- :workpricemx[i].auditflag_gj,
- :workpricemx[i].auditrep,
- :workpricemx[i].auditrep_gs,
- :workpricemx[i].auditdate,
- :workpricemx[i].auditdate_gs,
- :workpricemx[i].changeflag,
- :workpricemx[i].rpcode,
- :workpricemx[i].ifdftpg,
- :workpricemx[i].ifdftjj,
- :workpricemx[i].waittime,
- :workpricemx[i].lasthour,
- :workpricemx[i].ifchangebill);
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- arg_msg = "插入工序明细表错误!原因:"+sqlca.SQLErrText
- Goto ext
- End If
- Next
- End If
- If update_auditflag(mtrlid,wpcode,serdate,publ_operator,arg_msg,False) = 0 Then
- rslt = 0
- Goto ext
- End If
- it_updatebegin = False
- ext:
- If rslt = 0 Then
- Rollback;
- mtrlid = 0
- p_clearmx()
- ElseIf rslt = 1 And arg_ifcommit Then
- Commit;
- End If
- Return rslt
- end function
- public function integer uof_del_action (long arg_mtrlid, string arg_procode, boolean arg_ifcommit, ref string arg_msg);Int rslt = 1
- DELETE FROM u_sc_workprice_action_mx
- WHERE mtrlid = :arg_mtrlid
- AND procode = :arg_procode;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 AND arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer uof_add_action (long arg_mtrlid, string arg_procode, long arg_actionid, string arg_actionname, decimal arg_qty, decimal arg_actiontime, string arg_dscrp, boolean arg_ifcommit, ref string arg_msg);Int rslt = 1
- Long cnt
- SELECT count(*) INTO :cnt
- FROM u_sc_workprice_action
- Where actionid = :arg_actionid;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '查询动作:'+arg_actionname+',资料失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- IF cnt = 0 THEN
- arg_msg = '查询动作:'+arg_actionname+',资料未定义,请检查'
- rslt = 0
- GOTO ext
- END IF
- INSERT INTO u_sc_workprice_action_mx
- (mtrlid,procode,actionid,qty,actiontime,dscrp)
- Values(:arg_mtrlid,:arg_procode,:arg_actionid,:arg_qty,:arg_actiontime,:arg_dscrp);
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '建立动作:'+arg_actionname+',资料失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 AND arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer uof_workhour_update (long arg_mtrlid, string arg_procode, decimal arg_workhour, boolean arg_ifcommit, ref string arg_msg);Int rslt = 1
- UPDATE u_sc_workprice
- SET Workhour = :arg_workhour
- WHERE mtrlid = :arg_mtrlid
- AND procode = :arg_procode;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '更新工序工时失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 AND arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer uof_add_list (long arg_mtrlid, string arg_wpcode, long arg_wrkid, integer arg_templet, string arg_dscrp, integer arg_ifdft, string arg_opemp, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
- Long cnt
- String ls_wrkGrpName
- SELECT wrkGrpName INTO :ls_wrkGrpName
- FROM u_sc_wkp
- Where wrkgrpid = :arg_wrkid;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '查询车间信息失败,'+sqlca.SQLErrText
- GOTO ext
- END IF
- //SELECT count(*)
- // INTO :cnt
- // FROM u_mtrl_workprice
- // WHERE mtrlid = :arg_mtrlid
- // And wrkid = :arg_wrkid;
- //IF sqlca.SQLCode <> 0 THEN
- // rslt = 0
- // arg_msg = '查询该产品车间是否已存在工价表失败,'+sqlca.SQLErrText
- // GOTO ext
- //END IF
- //
- //IF cnt > 0 THEN
- // rslt = 0
- // arg_msg = '该产品在'+ls_wrkGrpName+'中已存在工价表,不能重复建立'
- // GOTO ext
- //END IF
- INSERT INTO u_mtrl_workprice
- (mtrlid,
- wrkid,
- templet,
- opdate,
- opemp,
- dscrp,
- wpcode,
- ifdft)
- VALUES (:arg_mtrlid,
- :arg_wrkid,
- :arg_templet,
- getdate(),
- :arg_opemp,
- :arg_dscrp,
- :arg_wpcode,
- :arg_ifdft);
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '新建产品工价表失败,'+sqlca.SQLErrText
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer updatebegin (long arg_mtrlid, string arg_wpcode, long arg_wrkid, ref string arg_msg);Long ll_auditflag,rslt = 1,ll_mtrlid,ll_count,ll_auditflag_gj
- //SELECT mtrlid,flag
- // INTO :ll_mtrlid,:ll_auditflag
- // FROM u_mtrl_workprice
- // WHERE mtrlid = :arg_mtrlid
- // And wpcode = :arg_wpcode;
- //IF sqlca.SQLCode <> 0 THEN
- // rslt = 0
- // arg_msg = '查询该产品的车间工价表资料失败! 原因:['+String(sqlca.SQLCode)+']'+sqlca.SQLErrText
- // GOTO ext
- //END IF
- //
- //IF ll_auditflag = 1 THEN
- // rslt = 0
- // arg_msg = '该工价表已审核,不能修改!'
- // GOTO ext
- //END IF
- SELECT if_hourpay,eoq
- INTO :if_hourpay,:eoq
- FROM u_mtrldef
- Where mtrlid = :arg_mtrlid;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '查询产品资料失败! 原因:['+String(sqlca.SQLCode)+']'+sqlca.SQLErrText
- GOTO ext
- END IF
- IF eoq <= 0 THEN eoq = 1
- //SELECT count(*)
- // INTO :ll_count
- // From u_sc_workprice
- // Where mtrlid = :arg_mtrlid
- // and wrkid = :arg_wrkid;
- //IF sqlca.SQLCode <> 0 THEN
- // rslt = 0
- // arg_msg = '查询该产品的工价表失败,原因:'+sqlca.SQLErrText
- // GOTO ext
- //END IF
- //
- mtrlid = ll_mtrlid
- wrkid = arg_wrkid
- wpcode = arg_wpcode
- p_clearmx()
- it_updatebegin = True
- ext:
- IF rslt = 0 THEN p_reset()
- RETURN rslt
- end function
- public function integer f_clearpfmx (long arg_mtrlid, string arg_wpcode, ref string arg_msg, boolean arg_ifcommit);Long rslt = 1
- DELETE FROM u_sc_workprice_mx
- WHERE parentmtrlid = :arg_mtrlid
- and wpcode = :arg_wpcode;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = "删除下级工价表失败,"+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- ext:
- if rslt = 0 then
- rollback;
- elseif rslt = 1 and arg_ifcommit then
- commit;
- end if
- RETURN rslt
- end function
- public function integer uof_del_list (long arg_mtrlid, string arg_wpcode, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
- Int li_flag
- Long cnt
- SELECT flag INTO :li_flag
- FROM u_mtrl_workprice
- WHERE mtrlid = :arg_mtrlid
- And wpcode = :arg_wpcode;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '查询产品工价表信息失败,'+sqlca.SQLErrText
- GOTO ext
- END IF
- IF li_flag = 1 THEN
- rslt = 0
- arg_msg = '产品工价表已审核,不能删除'
- GOTO ext
- END IF
- SELECT count(*)
- INTO :cnt
- FROM u_sc_workprice
- WHERE mtrlid = :arg_mtrlid
- AND wpcode = :arg_wpcode
- And ( (auditflag = 1) Or (auditflag_gj = 1));
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '查询产品工价表工序明细信息失败,'+sqlca.SQLErrText
- GOTO ext
- END IF
- IF cnt > 0 THEN
- rslt = 0
- arg_msg = '产品工价表工序明细存在已工序审核或已工价审核明细,不能删除'
- GOTO ext
- END IF
- DELETE FROM u_sc_workprice
- WHERE mtrlid = :arg_mtrlid
- And wpcode = :arg_wpcode;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '删除产品工价表信息失败,'+sqlca.SQLErrText
- GOTO ext
- END IF
- DELETE FROM u_mtrl_workprice
- WHERE mtrlid = :arg_mtrlid
- And wpcode = :arg_wpcode;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '删除产品工价表信息失败,'+sqlca.SQLErrText
- GOTO ext
- END IF
- DELETE FROM u_sc_workprice_mx
- WHERE parentMtrlid = :arg_mtrlid
- And wpcode = :arg_wpcode;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '删除产品工价表全套工价信息失败,'+sqlca.SQLErrText
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer uof_set_templet (long arg_mtrlid, string arg_wpcode, integer arg_templet, ref string arg_msg, boolean arg_ifcommit);Int rslt
- rslt = 1
- Int li_templet
- SELECT templet
- INTO :li_templet
- FROM u_mtrl_workprice
- WHERE mtrlid = :arg_mtrlid
- And wpcode = :arg_wpcode;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '查询车间工价表信息失败,'+sqlca.SQLErrText
- GOTO ext
- END IF
- IF arg_templet = li_templet THEN
- IF arg_templet = 1 THEN
- rslt = 0
- arg_msg = '工价表已经是模板,不能重复设置'
- GOTO ext
- ELSEIF arg_templet = 0 THEN
- rslt = 0
- arg_msg = '工价表还不是模板,不能取消设置'
- GOTO ext
- END IF
- END IF
- UPDATE u_mtrl_workprice
- SET templet = :arg_templet
- WHERE mtrlid = :arg_mtrlid
- And wpcode = :arg_wpcode;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '更新车间工价表模板属性失败,'+sqlca.SQLErrText
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer update_auditflag (long arg_mtrlid, string arg_wpcode, datetime arg_auditdate, string arg_auditingrep, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
- Long cnt,cnt_all
- SELECT count(*) INTO :cnt_all
- FROM u_sc_workprice
- WHERE mtrlid = :arg_mtrlid
- and wpcode = :arg_wpcode;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '查询工价表明细工序数失败'
- rslt = 0
- GOTO ext
- END IF
- SELECT count(*) INTO :cnt
- FROM u_sc_workprice
- WHERE auditflag = 0
- AND mtrlid = :arg_mtrlid
- and wpcode = :arg_wpcode;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '查询工价表明细未审核工序数失败'
- rslt = 0
- GOTO ext
- END IF
- IF cnt = 0 and cnt_all > 0 THEN
- UPDATE u_mtrl_workprice
- SET flag = 1,
- auditemp = :arg_auditingrep,
- auditdate = :arg_auditdate
- Where mtrlid = :arg_mtrlid
- and wpcode = :arg_wpcode;
- ELSE
- UPDATE u_mtrl_workprice
- SET flag = 0,
- auditemp = :arg_auditingrep,
- auditdate = :arg_auditdate
- Where mtrlid = :arg_mtrlid
- and wpcode = :arg_wpcode;
- END IF
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '更新工价表审核标记失败,原因:'+sqlca.SQLErrText
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 AND arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer auditing (long arg_mtrlid, string arg_wpcode, long arg_wrkgrpid, string arg_auditingrep, ref string arg_msg, boolean arg_ifcommit);//====================================================================
- // Function: auditing()
- //--------------------------------------------------------------------
- // Description: 审核工价表
- //--------------------------------------------------------------------
- // Arguments:
- // value long arg_mtrlid
- // value string arg_auditingrep
- // reference string arg_msg
- // value boolean arg_ifcommit
- //--------------------------------------------------------------------
- // Returns: integer
- //--------------------------------------------------------------------
- // Author: yyx Date: 2003.11.01
- //--------------------------------------------------------------------
- // Modify History:
- //
- //====================================================================
- Long rslt = 1,ll_count,ll_Auditflag
- DateTime serdate
- IF IsNull(arg_mtrlid) THEN
- rslt = 0
- arg_msg = '没有审核对象!'
- GOTO ext
- END IF
- ll_count = 0
- SELECT count(*)
- Into :ll_count
- From u_sc_workprice
- Where mtrlid = :arg_mtrlid
- and wpcode = :arg_wpcode;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '查询该产品的工价表失败,原因:'+sqlca.SQLErrText
- GOTO ext
- END IF
- IF ll_count = 0 THEN
- rslt = 0
- arg_msg = '该产品工价表没有工序,不能审核'
- GOTO ext
- END IF
- SELECT Top 1 getdate() Into :serdate From u_user;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '查询服务器时间失败'
- rslt = 0
- GOTO ext
- END IF
- ll_count = 0
- IF arg_wrkGrpid > 0 THEN
- SELECT count(*) INTO :ll_count
- FROM u_sc_workgroup
- Where wrkGrpid = :arg_wrkGrpid;
- IF sqlca.SQLCode <> 0 Or ll_count <> 1 THEN
- arg_msg = '查询工组资料失败,或者不存在工组资料'
- rslt = 0
- GOTO ext
- END IF
- END IF
- UPDATE u_sc_workprice
- SET auditflag = 1,
- auditrep = :arg_auditingrep,
- auditdate = :serdate
- WHERE (mtrlid = :arg_mtrlid)
- and (wpcode = :arg_wpcode)
- And (wrkGrpid = :arg_wrkGrpid Or :arg_wrkGrpid = -1 );
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '更新工价表明细审核标记失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- IF update_auditflag(arg_mtrlid,arg_wpcode,serdate,arg_auditingrep,arg_msg,False) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer c_auditing (long arg_mtrlid, string arg_wpcode, long arg_wrkgrpid, ref string arg_msg, boolean arg_ifcommit);Long rslt = 1,ll_count,ll_Auditflag
- DateTime serdate,null_dt
- SetNull(null_dt)
- Long cnt
- If IsNull(arg_mtrlid) Then
- rslt = 0
- arg_msg = '没有审核对象!'
- Goto ext
- End If
- //ll_count = 0
- //SELECT count(*)
- //INTO :ll_count
- //FROM u_sc_workprice
- //Where mtrlid = :arg_mtrlid
- //and wpcode = :arg_wpcode;
- //IF sqlca.SQLCode <> 0 THEN
- // rslt = 0
- // arg_msg = '查询该产品的工价表失败,原因:'+sqlca.SQLErrText
- // GOTO ext
- //END IF
- //
- //IF ll_count = 0 THEN
- // rslt = 0
- // arg_msg = '该产品工价表没有工序,不能撤审'
- // GOTO ext
- //END IF
- //
- //ll_count = 0
- //IF arg_wrkGrpid > 0 THEN
- // SELECT count(*) INTO :ll_count
- // FROM u_sc_workgroup
- // Where wrkGrpid = :arg_wrkGrpid;
- // IF sqlca.SQLCode <> 0 OR ll_count <> 1 THEN
- // arg_msg = '查询工组资料失败,或者不存在工组资料'
- // rslt = 0
- // GOTO ext
- // END IF
- //END IF
- If sys_option_if_oa_workprice_change = 1 And sys_option_workprice_change_secaudit = 1 Then
-
- Select count(*)
- Into :cnt
- From u_workprice_changemx Inner JOIN
- u_workprice_change ON
- u_workprice_changemx.billid = u_workprice_change.billid
- Where (u_workprice_change.priceflag = 1)
- And (u_workprice_change.flag = 0)
- And (u_workprice_changemx.rsltflag = 0)
- And (u_workprice_changemx.mtrlid = :arg_mtrlid)
- And (u_workprice_changemx.wpcode = :arg_wpcode)
- And (u_workprice_changemx.wrkGrpid = :arg_wrkGrpid Or :arg_wrkGrpid = -1 );
- If sqlca.SQLCode <> 0 Then
- arg_msg = '查询工序是否有在进行审批流程的工价变更单失败,'+sqlca.SQLErrText
- rslt = 0
- Goto ext
- End If
-
- If cnt > 0 Then
- arg_msg = '工价表有在进行审批流程的工价变更单,不能撤审'
- rslt = 0
- Goto ext
- End If
-
- End If
- Update u_sc_workprice
- Set auditflag = 0,
- auditrep = '',
- auditdate = :null_dt
- Where (mtrlid = :arg_mtrlid)
- And (wpcode = :arg_wpcode)
- And (wrkGrpid = :arg_wrkGrpid Or :arg_wrkGrpid = -1 );
- If sqlca.SQLCode <> 0 Then
- arg_msg = '更新工价表明细审核标记失败,'+sqlca.SQLErrText
- rslt = 0
- Goto ext
- End If
- If update_auditflag(arg_mtrlid,arg_wpcode,null_dt,'',arg_msg,False) = 0 Then
- rslt = 0
- Goto ext
- End If
- ext:
- If rslt = 0 Then
- Rollback;
- ElseIf rslt = 1 And arg_ifcommit Then
- Commit;
- End If
- Return rslt
- end function
- public function integer auditing_gs (long arg_mtrlid, string arg_wpcode, long arg_wrkgrpid, string arg_auditingrep, ref string arg_msg, boolean arg_ifcommit);Long rslt = 1,ll_count,ll_Auditflag
- DateTime serdate
- IF IsNull(arg_mtrlid) THEN
- rslt = 0
- arg_msg = '没有审核对象!'
- GOTO ext
- END IF
- ll_count = 0
- SELECT count(*)
- INTO :ll_count
- FROM u_sc_workprice
- Where mtrlid = :arg_mtrlid
- and wpcode = :arg_wpcode;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '查询该产品的工价表失败,原因:'+sqlca.SQLErrText
- GOTO ext
- END IF
- IF ll_count = 0 THEN
- rslt = 0
- arg_msg = '该产品工价表没有工序,不能审核'
- GOTO ext
- END IF
- SELECT Top 1 getdate() INTO :serdate FROM u_user;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '查询服务器时间失败'
- rslt = 0
- GOTO ext
- END IF
- ll_count = 0
- IF arg_wrkGrpid > 0 THEN
- SELECT count(*) INTO :ll_count
- FROM u_sc_workgroup
- Where wrkGrpid = :arg_wrkGrpid;
- IF sqlca.SQLCode <> 0 OR ll_count <> 1 THEN
- arg_msg = '查询工组资料失败,或者不存在工组资料'
- rslt = 0
- GOTO ext
- END IF
- END IF
- UPDATE u_sc_workprice
- SET auditflag_gs = 1,
- auditrep_gs = :arg_auditingrep,
- auditdate_gs = :serdate
- WHERE (mtrlid = :arg_mtrlid)
- and (wpcode = :arg_wpcode)
- And (wrkGrpid = :arg_wrkGrpid OR :arg_wrkGrpid = -1 );
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '更新工价表明细工时审核标记失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer c_auditing_gs (long arg_mtrlid, string arg_wpcode, long arg_wrkgrpid, ref string arg_msg, boolean arg_ifcommit);Long rslt = 1,ll_count,ll_Auditflag
- DateTime serdate,null_dt
- SetNull(null_dt)
- IF IsNull(arg_mtrlid) THEN
- rslt = 0
- arg_msg = '没有审核对象!'
- GOTO ext
- END IF
- ll_count = 0
- SELECT count(*)
- INTO :ll_count
- FROM u_sc_workprice
- WHERE mtrlid = :arg_mtrlid
- And wpcode = :arg_wpcode;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '查询该产品的工价表失败,原因:'+sqlca.SQLErrText
- GOTO ext
- END IF
- IF ll_count = 0 THEN
- rslt = 0
- arg_msg = '该产品没有工序,不能审核'
- GOTO ext
- END IF
- ll_count = 0
- IF arg_wrkGrpid > 0 THEN
- SELECT count(*) INTO :ll_count
- FROM u_sc_workgroup
- Where wrkGrpid = :arg_wrkGrpid;
- IF sqlca.SQLCode <> 0 Or ll_count <> 1 THEN
- arg_msg = '查询工组资料失败,或者不存在工组资料'
- rslt = 0
- GOTO ext
- END IF
- END IF
- UPDATE u_sc_workprice
- SET auditflag_gs = 0,
- auditrep_gs = '',
- auditdate_gs = :null_dt
- WHERE mtrlid = :arg_mtrlid
- AND wpcode = :arg_wpcode
- And (wrkGrpid = :arg_wrkGrpid Or :arg_wrkGrpid = -1 );
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '更新工价表明细工时审核标记失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer f_addworkprice (long arg_mtrlid, string arg_wpcode, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
- Long ll_j
- Long proid
- Long proorder
- String procode
- String proname
- Long wrkgrpid
- Decimal workprice
- Decimal workqty
- String worklevel
- Decimal workhour
- String dscrp
- Long auditflag
- String auditrep
- DateTime auditdate
- Long lastflag
- string status
- int ifjd
- long ll_wrkid
- datastore ds_workprice
- ds_workprice = CREATE datastore
- ds_workprice.DataObject = 'dw_sc_workpricetable_mx_ds'
- ds_workprice.SetTransObject(sqlca)
- ds_workprice.Retrieve(arg_mtrlid,arg_wpcode)
- FOR ll_j = 1 TO ds_workprice.RowCount()
- il_printid++
- proid = ds_workprice.Object.proid[ll_j]
- proorder = ds_workprice.Object.proorder[ll_j]
- procode = ds_workprice.Object.procode[ll_j]
- proname = ds_workprice.Object.u_sc_workprice_proname[ll_j]
- wrkgrpid = ds_workprice.Object.wrkgrpid[ll_j]
- workprice = ds_workprice.Object.workprice[ll_j]
- workqty = ds_workprice.Object.workqty[ll_j]
- worklevel = ds_workprice.Object.worklevel[ll_j]
- workhour = ds_workprice.Object.workhour[ll_j]
- dscrp = ds_workprice.Object.dscrp[ll_j]
- auditflag = ds_workprice.Object.auditflag[ll_j]
- auditrep = ds_workprice.Object.auditrep[ll_j]
- auditdate = ds_workprice.Object.auditdate[ll_j]
- status = ds_workprice.Object.u_sc_workprice_status[ll_j]
- ifjd = ds_workprice.Object.u_sc_workprice_ifjd[ll_j]
- ll_wrkid = ds_workprice.Object.u_sc_workprice_wrkid[ll_j]
-
- INSERT INTO u_sc_workprice_mx
- (parentmtrlid,
- printid,
- mtrlid,
- proid,
- proorder,
- procode,
- proname,
- wrkgrpid,
- workprice,
- workqty,
- worklevel,
- workhour,
- dscrp,
- auditflag,
- auditrep,
- auditdate,
- lastflag,
- lp,
- status,
- ifjd,
- wrkid,
- wpcode)
- VALUES
- (:arg_mtrlid,
- :il_printid,
- :arg_mtrlid,
- :proid,
- :proorder,
- :procode,
- :proname,
- :wrkgrpid,
- :workprice,
- :workqty,
- :worklevel,
- :workhour,
- :dscrp,
- :auditflag,
- :auditrep,
- :auditdate,
- :lastflag,
- 0,
- :status,
- :ifjd,
- :ll_wrkid,
- :arg_wpcode);
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '插入下级自制部件工价表失败'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
-
- NEXT
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 AND arg_ifcommit THEN
- COMMIT;
- END IF
- destroy ds_workprice
- RETURN rslt
- end function
- public function integer uof_setdft (long arg_mtrlid, string arg_wpcode, integer arg_dft, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
- Int li_ifdft,li_di
- Long cnt = 0
- SELECT ifdft
- INTO :li_ifdft
- FROM u_mtrl_workprice
- WHERE mtrlid = :arg_mtrlid
- And wpcode = :arg_wpcode;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '查询工价表失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- IF li_ifdft = 1 THEN
- IF arg_dft = 1 THEN
- arg_msg = '工价表已设置为默认,不能再设置'
- rslt = 0
- GOTO ext
- END IF
- ELSE
- IF arg_dft = 0 THEN
- arg_msg = '工价表未设置为默认,不能取消设置'
- rslt = 0
- GOTO ext
- END IF
-
- SELECT count(*) INTO :cnt
- FROM u_mtrl_workprice
- WHERE mtrlid = :arg_mtrlid
- AND wpcode <> :arg_wpcode
- And ifdft = 1;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '查询物料默认工价表数量失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
-
- IF cnt > 0 THEN
- arg_msg = '工价表只能设置一个默认工价表'
- rslt = 0
- GOTO ext
- END IF
- END IF
- UPDATE u_mtrl_workprice
- SET ifdft = :arg_dft
- WHERE mtrlid = :arg_mtrlid
- And wpcode = :arg_wpcode;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '更新工价表默认标记失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer auditing_gj (long arg_mtrlid, string arg_wpcode, long arg_wrkgrpid, string arg_auditingrep, ref string arg_msg, boolean arg_ifcommit);Long rslt = 1,ll_count,ll_Auditflag
- String ls_procode_arr[]
- Long ll_cnt = 1,ll_i
- DateTime serdate
- If IsNull(arg_mtrlid) Then
- rslt = 0
- arg_msg = '没有审核对象!'
- Goto ext
- End If
- ll_count = 0
- Select count(*)
- Into :ll_count
- From u_sc_workprice
- Where mtrlid = :arg_mtrlid
- And wpcode = :arg_wpcode;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- arg_msg = '查询该产品的工价表失败,原因:'+sqlca.SQLErrText
- Goto ext
- End If
- If ll_count = 0 Then
- rslt = 0
- arg_msg = '该产品工价表没有工序,不能审核'
- Goto ext
- End If
- Select Top 1 getdate() Into :serdate From u_user;
- If sqlca.SQLCode <> 0 Then
- arg_msg = '查询服务器时间失败'
- rslt = 0
- Goto ext
- End If
- ll_count = 0
- If arg_wrkGrpid > 0 Then
- Select count(*) Into :ll_count
- From u_sc_workgroup
- Where wrkGrpid = :arg_wrkGrpid;
- If sqlca.SQLCode <> 0 Or ll_count <> 1 Then
- arg_msg = '查询工组资料失败,或者不存在工组资料'
- rslt = 0
- Goto ext
- End If
- End If
- Update u_sc_workprice
- Set auditflag_gj = 1,
- auditrep_gj = :arg_auditingrep,
- auditdate_gj = :serdate
- Where (mtrlid = :arg_mtrlid)
- And (wpcode = :arg_wpcode)
- And (wrkGrpid = :arg_wrkGrpid Or :arg_wrkGrpid = -1 );
- If sqlca.SQLCode <> 0 Then
- arg_msg = '更新工价表明细工价审核标记失败,'+sqlca.SQLErrText
- rslt = 0
- Goto ext
- End If
- If arg_wrkGrpid = -1 Then
- If uof_update_workprice_zl(arg_mtrlid,arg_wpcode,'',arg_msg,False) = 0 Then
- rslt = 0
- Goto ext
- End If
- Else
- Declare cur_procode Cursor For
- Select procode
- From u_sc_workprice
- Where (mtrlid = :arg_mtrlid)
- And (wpcode = :arg_wpcode)
- And (wrkGrpid = :arg_wrkGrpid Or :arg_wrkGrpid = -1 );
-
- Open cur_procode;
- Fetch cur_procode Into :ls_procode_arr[ll_cnt];
- Do While sqlca.SQLCode = 0
- ll_cnt++
- Fetch cur_procode Into :ls_procode_arr[ll_cnt];
- Loop
-
- Close cur_procode;
-
- For ll_i = 1 To ll_cnt - 1
- If uof_update_workprice_zl(arg_mtrlid,arg_wpcode,ls_procode_arr[ll_i],arg_msg,False) = 0 Then
- rslt = 0
- Goto ext
- End If
- Next
-
- End If
- ext:
- If rslt = 0 Then
- Rollback;
- ElseIf rslt = 1 And arg_ifcommit Then
- Commit;
- End If
- Return rslt
- end function
- public function integer c_auditing_gj (long arg_mtrlid, string arg_wpcode, long arg_wrkgrpid, ref string arg_msg, boolean arg_ifcommit);Long rslt = 1,ll_count,ll_Auditflag
- DateTime serdate,null_dt
- SetNull(null_dt)
- IF IsNull(arg_mtrlid) THEN
- rslt = 0
- arg_msg = '没有审核对象!'
- GOTO ext
- END IF
- ll_count = 0
- SELECT count(*)
- INTO :ll_count
- FROM u_sc_workprice
- WHERE mtrlid = :arg_mtrlid
- And wpcode = :arg_wpcode;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '查询该产品的工价表失败,原因:'+sqlca.SQLErrText
- GOTO ext
- END IF
- IF ll_count = 0 THEN
- rslt = 0
- arg_msg = '该产品没有工序,不能审核'
- GOTO ext
- END IF
- ll_count = 0
- IF arg_wrkGrpid > 0 THEN
- SELECT count(*) INTO :ll_count
- FROM u_sc_workgroup
- Where wrkGrpid = :arg_wrkGrpid;
- IF sqlca.SQLCode <> 0 Or ll_count <> 1 THEN
- arg_msg = '查询工组资料失败,或者不存在工组资料'
- rslt = 0
- GOTO ext
- END IF
- END IF
- UPDATE u_sc_workprice
- SET auditflag_gj = 0,
- auditrep_gj = '',
- auditdate_gj = :null_dt
- WHERE mtrlid = :arg_mtrlid
- AND wpcode = :arg_wpcode
- And (wrkGrpid = :arg_wrkGrpid Or :arg_wrkGrpid = -1 );
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '更新工价表明细工价审核标记失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer auditing_mx (long arg_mtrlid, string arg_wpcode, string arg_procode[], string arg_auditingrep, ref string arg_msg, boolean arg_ifcommit);
- Long rslt = 1,ll_count,ll_Auditflag
- Long ll_i
- DateTime serdate
- IF IsNull(arg_mtrlid) THEN
- rslt = 0
- arg_msg = '没有审核对象!'
- GOTO ext
- END IF
- SELECT Top 1 getdate() Into :serdate From u_user;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '查询服务器时间失败'
- rslt = 0
- GOTO ext
- END IF
- FOR ll_i = 1 To UpperBound(arg_procode)
- UPDATE u_sc_workprice
- SET auditflag = 1,
- auditrep = :arg_auditingrep,
- auditdate = :serdate
- WHERE (mtrlid = :arg_mtrlid)
- AND (wpcode = :arg_wpcode)
- And (procode = :arg_procode[ll_i]);
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '更新工价表明细审核标记失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- NEXT
- IF update_auditflag(arg_mtrlid,arg_wpcode,serdate,arg_auditingrep,arg_msg,False) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer auditing_gj_mx (long arg_mtrlid, string arg_wpcode, string arg_procode[], string arg_auditingrep, ref string arg_msg, boolean arg_ifcommit);
- Long rslt = 1,ll_count,ll_Auditflag
- Long ll_i
- DateTime serdate
- IF IsNull(arg_mtrlid) THEN
- rslt = 0
- arg_msg = '没有审核对象!'
- GOTO ext
- END IF
- SELECT Top 1 getdate() Into :serdate From u_user;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '查询服务器时间失败'
- rslt = 0
- GOTO ext
- END IF
- FOR ll_i = 1 To UpperBound(arg_procode)
- UPDATE u_sc_workprice
- SET auditflag_gj = 1,
- auditrep_gj = :arg_auditingrep,
- auditdate_gj = :serdate
- WHERE (mtrlid = :arg_mtrlid)
- AND (wpcode = :arg_wpcode)
- And (procode = :arg_procode[ll_i]);
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '更新工价表明细工价审核标记失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
-
- if uof_update_workprice_zl(arg_mtrlid,arg_wpcode,arg_procode[ll_i],arg_msg,false) = 0 then
- rslt = 0
- goto ext
- end if
- NEXT
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer c_auditing_mx (long arg_mtrlid, string arg_wpcode, string arg_procode[], ref string arg_msg, boolean arg_ifcommit);Long rslt = 1,ll_count,ll_Auditflag
- Long ll_i
- DateTime serdate,null_dt
- Long cnt
- SetNull(null_dt)
- If IsNull(arg_mtrlid) Then
- rslt = 0
- arg_msg = '没有审核对象!'
- Goto ext
- End If
- If sys_option_if_oa_workprice_change = 1 And sys_option_workprice_change_secaudit = 1 Then
- For ll_i = 1 To UpperBound(arg_procode)
- Select count(*)
- Into :cnt
- From u_workprice_changemx Inner JOIN
- u_workprice_change ON
- u_workprice_changemx.billid = u_workprice_change.billid
- Where (u_workprice_change.priceflag = 1)
- And (u_workprice_change.flag = 0)
- And (u_workprice_changemx.rsltflag = 0)
- And (u_workprice_changemx.mtrlid = :arg_mtrlid)
- And (u_workprice_changemx.wpcode = :arg_wpcode)
- And (u_workprice_changemx.procode = :arg_procode[ll_i]);
- If sqlca.SQLCode <> 0 Then
- arg_msg = '查询工序是否有在进行审批流程的工价变更单失败,'+sqlca.SQLErrText
- rslt = 0
- Goto ext
- End If
-
- If cnt > 0 Then
- arg_msg = '工序:'+arg_procode[ll_i]+' 有在进行审批流程的工价变更单,不能撤审'
- rslt = 0
- Goto ext
- End If
-
- Next
- End If
- For ll_i = 1 To UpperBound(arg_procode)
- Update u_sc_workprice
- Set auditflag = 0,
- auditrep = '',
- auditdate = :null_dt
- Where (mtrlid = :arg_mtrlid)
- And (wpcode = :arg_wpcode)
- And (procode = :arg_procode[ll_i] );
- If sqlca.SQLCode <> 0 Then
- arg_msg = '更新工价表明细审核标记失败,'+sqlca.SQLErrText
- rslt = 0
- Goto ext
- End If
- Next
- If update_auditflag(arg_mtrlid,arg_wpcode,null_dt,'',arg_msg,False) = 0 Then
- rslt = 0
- Goto ext
- End If
- ext:
- If rslt = 0 Then
- Rollback;
- ElseIf rslt = 1 And arg_ifcommit Then
- Commit;
- End If
- Return rslt
- end function
- public function integer c_auditing_gj_mx (long arg_mtrlid, string arg_wpcode, string arg_procode[], ref string arg_msg, boolean arg_ifcommit);Long rslt = 1,ll_count,ll_Auditflag
- Long ll_i
- DateTime serdate,null_dt
- SetNull(null_dt)
- IF IsNull(arg_mtrlid) THEN
- rslt = 0
- arg_msg = '没有审核对象!'
- GOTO ext
- END IF
- FOR ll_i = 1 To UpperBound(arg_procode)
- UPDATE u_sc_workprice
- SET auditflag_gj = 0,
- auditrep_gj = '',
- auditdate_gj = :null_dt
- WHERE (mtrlid = :arg_mtrlid)
- AND (wpcode = :arg_wpcode)
- And (procode = :arg_procode[ll_i] );
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '更新工价表明细工价审核标记失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- NEXT
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer auditing_gs_mx (long arg_mtrlid, string arg_wpcode, string arg_procode[], string arg_auditingrep, ref string arg_msg, boolean arg_ifcommit);
- Long rslt = 1,ll_count,ll_Auditflag
- Long ll_i
- DateTime serdate
- IF IsNull(arg_mtrlid) THEN
- rslt = 0
- arg_msg = '没有审核对象!'
- GOTO ext
- END IF
- SELECT Top 1 getdate() Into :serdate From u_user;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '查询服务器时间失败'
- rslt = 0
- GOTO ext
- END IF
- FOR ll_i = 1 To UpperBound(arg_procode)
- UPDATE u_sc_workprice
- SET auditflag_gs = 1,
- auditrep_gs = :arg_auditingrep,
- auditdate_gs = :serdate
- WHERE (mtrlid = :arg_mtrlid)
- AND (wpcode = :arg_wpcode)
- And (procode = :arg_procode[ll_i]);
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '更新工价表明细工时审核标记失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- NEXT
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer c_auditing_gs_mx (long arg_mtrlid, string arg_wpcode, string arg_procode[], ref string arg_msg, boolean arg_ifcommit);Long rslt = 1,ll_count,ll_Auditflag
- Long ll_i
- DateTime serdate,null_dt
- SetNull(null_dt)
- IF IsNull(arg_mtrlid) THEN
- rslt = 0
- arg_msg = '没有审核对象!'
- GOTO ext
- END IF
- FOR ll_i = 1 To UpperBound(arg_procode)
- UPDATE u_sc_workprice
- SET auditflag_gs = 0,
- auditrep_gs = '',
- auditdate_gs = :null_dt
- WHERE (mtrlid = :arg_mtrlid)
- AND (wpcode = :arg_wpcode)
- And (procode = :arg_procode[ll_i] );
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '更新工价表明细工时审核标记失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- NEXT
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer acceptmx (long arg_proid, string arg_procode, string arg_proname, decimal arg_workqty, decimal arg_workprice, long arg_wrkgrpid, string arg_worklevel, string arg_techlevel, decimal arg_workhour_minute, string arg_dscrp, integer arg_lastflag, long arg_proorder, integer arg_ifownpro, integer arg_lsxtype, integer arg_ifstandard, string arg_status, integer arg_ifjd, string arg_utcode, integer arg_sctype, long arg_equipmentid, decimal arg_workdays, decimal arg_beforehour_minute, decimal arg_afterhour_minute, string arg_pricestr, string arg_partname, decimal arg_eqworkhour_minute, string arg_worktype, decimal arg_arg1, decimal arg_arg2, decimal arg_arg3, decimal arg_arg4, decimal arg_arg5, decimal arg_arg6, decimal arg_arg7, decimal arg_arg8, decimal arg_arg9, decimal arg_eq_empnum, decimal arg_fzrate, decimal arg_factor, string arg_workqtystr, integer arg_ifgroup, decimal arg_u_workqty, decimal arg_u_workprice, string arg_u_workqtystr, string arg_u_pricestr, string arg_rpcode, integer arg_ifdftpg, integer arg_ifdftjj, decimal arg_waittime, decimal arg_lasthour, ref string arg_msg);Long rslt = 1,ll_proid
- String ll_procode
- Decimal ld_hourpay
- IF it_updatebegin = False THEN
- rslt = 0
- arG_MSG = "非编辑状态不可以使用,操作取消"
- GOTO ext
- END IF
- //清空值
- IF IsNull(arg_workqty) THEN arg_workqty = 1
- IF IsNull(arg_workPrice) THEN arg_workPrice = 0
- IF IsNull(arg_workhour_minute) THEN arg_workhour_minute = 0
- IF IsNull(arg_lastflag) THEN arg_lastflag = 0
- IF IsNull(arg_proid) THEN arg_proid = 0
- IF IsNull(arg_procode) THEN arg_procode = ''
- IF IsNull(arg_proname) THEN arg_proname = ''
- IF IsNull(arg_techlevel) THEN arg_techlevel = ''
- IF IsNull(arg_worklevel) THEN arg_worklevel = ''
- IF IsNull(arg_proorder) THEN arg_proorder = 0
- IF IsNull(arg_wrkgrpid) THEN arg_wrkgrpid = 0
- IF IsNull(arg_ifownpro) THEN arg_ifownpro = 0
- IF IsNull(arg_lsxtype) THEN arg_lsxtype = 0
- IF IsNull(arg_ifstandard) THEN arg_ifstandard = 0
- IF IsNull(arg_ifjd) THEN arg_ifjd = 0
- IF IsNull(arg_utcode) THEN arg_utcode = ''
- IF IsNull(arg_sctype) THEN arg_sctype = 0
- IF IsNull(arg_equipmentid) THEN arg_equipmentid = 0
- IF IsNull(arg_workdays) THEN arg_workdays = 0
- IF IsNull(arg_partname) THEN arg_partname = ''
- IF IsNull(arg_beforehour_minute) THEN arg_beforehour_minute = 0
- IF IsNull(arg_afterhour_minute) THEN arg_afterhour_minute = 0
- IF IsNull(arg_pricestr) THEN arg_pricestr = ''
- IF IsNull(arg_eqworkhour_minute) THEN arg_eqworkhour_minute = 0
- IF IsNull(arg_worktype) THEN arg_worktype = ''
- IF IsNull(arg_fzrate) THEN arg_fzrate = 1
- if isnull(arg_factor) then arg_factor = 0
- if isnull(arg_ifgroup) then arg_ifgroup = 0
- IF IsNull(arg_arg1) THEN arg_arg1 = 0
- IF IsNull(arg_arg2) THEN arg_arg2 = 0
- IF IsNull(arg_arg3) THEN arg_arg3 = 0
- IF IsNull(arg_arg4) THEN arg_arg4 = 0
- IF IsNull(arg_arg5) THEN arg_arg5 = 0
- IF IsNull(arg_arg6) THEN arg_arg6 = 0
- IF IsNull(arg_arg7) THEN arg_arg7 = 0
- IF IsNull(arg_arg8) THEN arg_arg8 = 0
- IF IsNull(arg_arg9) THEN arg_arg9 = 0
- if isnull(arg_workqtystr) then arg_workqtystr = ''
- if isnull(arg_u_workqty) then arg_u_workqty = 0
- if isnull(arg_u_workprice) then arg_u_workprice = 0
- if isnull(arg_u_workqtystr) then arg_u_workqtystr = ''
- if isnull(arg_u_pricestr) then arg_u_pricestr = ''
- if isnull(arg_rpcode) then arg_rpcode = ''
- if isnull(arg_ifdftpg) then arg_ifdftpg = 0
- if isnull(arg_ifdftjj) then arg_ifdftjj = 0
- if isnull(arg_waittime) then arg_waittime = 0
- if isnull(arg_lasthour) then arg_lasthour = 0
- IF Trim(arg_procode) = '' And Trim(arg_proname) = '' THEN
- rslt = 1
- GOTO ext
- END IF
- IF Trim(arg_procode) = '' THEN
- rslt = 0
- arG_MSG = "工序号不能为空"
- GOTO ext
- END IF
- IF Trim(arg_proname) = '' THEN
- rslt = 0
- arG_MSG = "工序名称不能为空"
- GOTO ext
- END IF
- IF arg_workqty <= 0 THEN
- rslt = 0
- arG_MSG = "数量不能少于1"
- GOTO ext
- END IF
- IF arg_wrkgrpid = 0 THEN
- rslt = 0
- arG_MSG = "请选择工序所属工组"
- GOTO ext
- END IF
- IF if_hourpay > 0 And Trim(arg_worktype) = '' THEN
- rslt = 0
- arG_MSG = '请选择工种'
- GOTO ext
- END IF
- IF if_hourpay = 1 And eoq > 0 THEN
- SELECT hourpay INTO :ld_hourpay
- FROM u_worktype
- Where worktype = :arg_worktype;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arG_MSG = '查询工种标准时薪失败,'+sqlca.SQLErrText
- GOTO ext
- END IF
-
- arg_workPrice = (eoq * (arg_workhour_minute / 60 + arg_eqworkhour_minute / 60 * arg_eq_empnum) + arg_beforehour_minute / 60 + arg_afterhour_minute / 60) / eoq * ld_hourpay
-
- END IF
- //写入内容
- it_mxbt++
- workpricemx[it_mxbt].proid = arg_proid
- workpricemx[it_mxbt].Procode = arg_procode
- workpricemx[it_mxbt].proname = arg_proname
- workpricemx[it_mxbt].workqty = arg_workqty
- workpricemx[it_mxbt].workPrice = arg_workPrice
- workpricemx[it_mxbt].worklevel = arg_worklevel
- workpricemx[it_mxbt].Techlevel = arg_techlevel
- workpricemx[it_mxbt].Dscrp = arg_Dscrp
- workpricemx[it_mxbt].lastflag = arg_lastflag
- workpricemx[it_mxbt].proorder = arg_proorder
- workpricemx[it_mxbt].wrkgrpid = arg_wrkgrpid
- workpricemx[it_mxbt].ifownpro = arg_ifownpro
- workpricemx[it_mxbt].lsxtype = arg_lsxtype
- workpricemx[it_mxbt].ifstandard = arg_ifstandard
- workpricemx[it_mxbt].status = arg_status
- workpricemx[it_mxbt].ifjd = arg_ifjd
- workpricemx[it_mxbt].utcode = arg_utcode
- workpricemx[it_mxbt].sctype = arg_sctype
- workpricemx[it_mxbt].equipmentid = arg_equipmentid
- workpricemx[it_mxbt].workdays = arg_workdays
- workpricemx[it_mxbt].Workhour = arg_workhour_minute / 60
- workpricemx[it_mxbt].beforehour = arg_beforehour_minute / 60
- workpricemx[it_mxbt].afterhour = arg_afterhour_minute / 60
- workpricemx[it_mxbt].eqworkhour = arg_eqworkhour_minute / 60
- workpricemx[it_mxbt].pricestr = arg_pricestr
- workpricemx[it_mxbt].partname = arg_partname
- workpricemx[it_mxbt].eqworkhour_minute = arg_eqworkhour_minute
- workpricemx[it_mxbt].worktype = arg_worktype
- workpricemx[it_mxbt].workhour_minute = arg_workhour_minute
- workpricemx[it_mxbt].beforehour_minute = arg_beforehour_minute
- workpricemx[it_mxbt].afterhour_minute = arg_afterhour_minute
- workpricemx[it_mxbt].arg1 = arg_arg1
- workpricemx[it_mxbt].arg2 = arg_arg2
- workpricemx[it_mxbt].arg3 = arg_arg3
- workpricemx[it_mxbt].arg4 = arg_arg4
- workpricemx[it_mxbt].arg5 = arg_arg5
- workpricemx[it_mxbt].arg6 = arg_arg6
- workpricemx[it_mxbt].arg7 = arg_arg7
- workpricemx[it_mxbt].arg8 = arg_arg8
- workpricemx[it_mxbt].arg9 = arg_arg9
- workpricemx[it_mxbt].eq_empnum = arg_eq_empnum
- workpricemx[it_mxbt].fzrate = arg_fzrate
- workpricemx[it_mxbt].totalhour = (workpricemx[it_mxbt].beforehour + workpricemx[it_mxbt].afterhour + (workpricemx[it_mxbt].Workhour + workpricemx[it_mxbt].eqworkhour * workpricemx[it_mxbt].eq_empnum) * eoq) / eoq
- workpricemx[it_mxbt].factor = arg_factor
- workpricemx[it_mxbt].workqtystr = arg_workqtystr
- workpricemx[it_mxbt].ifgroup = arg_ifgroup
- workpricemx[it_mxbt].u_workqty = arg_u_workqty
- workpricemx[it_mxbt].u_workprice = arg_u_workprice
- workpricemx[it_mxbt].u_workqtystr = arg_u_workqtystr
- workpricemx[it_mxbt].u_pricestr = arg_u_pricestr
- workpricemx[it_mxbt].rpcode = arg_rpcode
- workpricemx[it_mxbt].ifdftpg = arg_ifdftpg
- workpricemx[it_mxbt].ifdftjj = arg_ifdftjj
- workpricemx[it_mxbt].waittime = arg_waittime
- workpricemx[it_mxbt].lasthour = arg_lasthour
- ext:
- IF rslt = 0 THEN p_clearmx()
- Return(rslt)
- end function
- public function integer uof_update_workprice_zl (long arg_mtrlid, string arg_wpcode, string arg_procode, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
- If uo_option_orderrqwp_auditgj = 0 Then
- rslt = 1
- Goto ext
- End If
- //完工单 常规模式
- Update u_finishmx
- Set u_finishmx.workprice = u_sc_workprice.workPrice
- FROM u_finishmx INNER JOIN
- u_sc_task ON u_finishmx.taskid = u_sc_task.taskid INNER JOIN
- u_Order_ml ON u_Order_ml.OrderID = u_sc_task.orderid AND
- u_Order_ml.scid = u_sc_task.scid INNER JOIN
- U_OrderRqwp ON u_Order_ml.scid = U_OrderRqwp.scid AND
- u_Order_ml.OrderID = U_OrderRqwp.orderid AND
- u_sc_task.procode = U_OrderRqwp.Procode INNER JOIN
- u_sc_workprice ON U_OrderRqwp.Mtrlid = u_sc_workprice.Mtrlid AND
- U_OrderRqwp.Procode = u_sc_workprice.procode AND
- u_Order_ml.wpcode = u_sc_workprice.wpcode INNER JOIN
- u_finish ON u_finishmx.finishid = u_finish.finishid
- Where U_OrderRqwp.auditflag_gj = 0
- And ( U_OrderRqwp.mtrlid = :arg_mtrlid And u_Order_ml.wpcode = :arg_wpcode)
- And (U_OrderRqwp.procode = :arg_procode Or :arg_procode = '')
- and U_OrderRqwp.sonmtrlid = 0
- and u_finish.thrflag = 0;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- arg_msg = '更新相关未工价审的工序完工单工价失败(常规模式),'+sqlca.SQLErrText
- Goto ext
- End If
- //完工单 合并下级虚拟部件模式
- Update u_finishmx
- Set u_finishmx.workprice = u_sc_workprice.workPrice
- FROM u_finishmx INNER JOIN
- u_sc_task ON u_finishmx.taskid = u_sc_task.taskid INNER JOIN
- u_Order_ml ON u_Order_ml.OrderID = u_sc_task.orderid AND
- u_Order_ml.scid = u_sc_task.scid INNER JOIN
- U_OrderRqwp ON u_Order_ml.scid = U_OrderRqwp.scid AND
- u_Order_ml.OrderID = U_OrderRqwp.orderid AND
- u_sc_task.procode = U_OrderRqwp.Procode INNER JOIN
- u_sc_workprice ON U_OrderRqwp.procode_ori = u_sc_workprice.procode AND
- U_OrderRqwp.sonmtrlid = u_sc_workprice.Mtrlid INNER JOIN
- (SELECT mtrlid, wpcode
- FROM u_mtrl_workprice
- WHERE (Ifdft = 1)) v_wpcode_dft ON
- u_sc_workprice.Mtrlid = v_wpcode_dft.mtrlid AND
- u_sc_workprice.wpcode = v_wpcode_dft.wpcode COLLATE Chinese_PRC_CI_AS INNER
- JOIN
- u_finish ON u_finishmx.finishid = u_finish.finishid
- Where U_OrderRqwp.auditflag_gj = 0
- And (U_OrderRqwp.sonmtrlid = :arg_mtrlid And v_wpcode_dft.wpcode = :arg_wpcode)
- And (U_OrderRqwp.procode_ori = :arg_procode Or :arg_procode = '')
- and U_OrderRqwp.sonmtrlid <> 0
- and u_finish.thrflag = 0;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- arg_msg = '更新相关未工价审的工序完工单工价失败(合并下级虚拟部件模式),'+sqlca.SQLErrText
- Goto ext
- End If
- //常规模式
- Update U_OrderRqwp
- Set U_OrderRqwp.workPrice = u_sc_workprice.workPrice,
- U_OrderRqwp.ori_workprice = u_sc_workprice.workPrice,
- U_OrderRqwp.auditflag_gj = 1
- FROM U_OrderRqwp INNER JOIN
- u_Order_ml ON U_OrderRqwp.scid = u_Order_ml.scid AND
- U_OrderRqwp.orderid = u_Order_ml.OrderID INNER JOIN
- u_sc_workprice ON U_OrderRqwp.Mtrlid = u_sc_workprice.Mtrlid AND
- U_OrderRqwp.procode_ori = u_sc_workprice.procode AND
- u_Order_ml.wpcode = u_sc_workprice.wpcode
- Where U_OrderRqwp.auditflag_gj = 0
- And (U_OrderRqwp.mtrlid = :arg_mtrlid And u_Order_ml.wpcode = :arg_wpcode)
- And (U_OrderRqwp.procode = :arg_procode Or :arg_procode = '')
- and U_OrderRqwp.sonmtrlid = 0;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- arg_msg = '更新相关未工价审的工序进度工价失败(常规模式),'+sqlca.SQLErrText
- Goto ext
- End If
- //合并下级虚拟部件模式
- Update U_OrderRqwp
- Set U_OrderRqwp.workPrice = u_sc_workprice.workPrice,
- U_OrderRqwp.ori_workprice = u_sc_workprice.workPrice,
- U_OrderRqwp.auditflag_gj = 1
- FROM (SELECT mtrlid, wpcode
- FROM u_mtrl_workprice
- WHERE (Ifdft = 1)) v_wpcode_dft INNER JOIN
- u_sc_workprice ON
- v_wpcode_dft.wpcode COLLATE Chinese_PRC_CI_AS = u_sc_workprice.wpcode INNER
- JOIN
- U_OrderRqwp ON u_sc_workprice.Mtrlid = U_OrderRqwp.sonmtrlid AND
- u_sc_workprice.procode = U_OrderRqwp.procode_ori AND
- v_wpcode_dft.mtrlid = U_OrderRqwp.sonmtrlid
- Where U_OrderRqwp.auditflag_gj = 0
- And (U_OrderRqwp.sonmtrlid = :arg_mtrlid And v_wpcode_dft.wpcode = :arg_wpcode)
- And (U_OrderRqwp.procode_ori = :arg_procode Or :arg_procode = '')
- and U_OrderRqwp.sonmtrlid <> 0;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- arg_msg = '更新相关未工价审的工序进度工价失败(合并下级虚拟部件模式),'+sqlca.SQLErrText
- Goto ext
- End If
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer f_addpfmx (long arg_mtrlid, string arg_wpcode, string arg_pfcode, decimal arg_qty, long arg_lp, ref string arg_msg, boolean arg_ifcommit, integer arg_protype);Int rslt = 1
- Long ll_i,cnt,ll_j
- String ls_pfcode
- Decimal ld_qty
- Long count = 0
- Long proid
- Long proorder
- String procode
- String proname
- Long wrkgrpid
- Decimal workprice
- Decimal workqty
- String worklevel
- Decimal workhour
- String dscrp
- Long auditflag
- String auditrep
- DateTime auditdate
- Long lastflag
- String status
- string ls_retr_wpcode,ls_wpcode_top1
- long ll_wrkid
- Long ll_cnt_wp_wrkgrpid,ll_retr_wrkgrpid,ll_dftwrkgrpid_top1
- IF IsNull(mtrlid) Or mtrlid = 0 THEN
- arg_msg = '产品错误,没有对应的产品'
- rslt = 0
- GOTO ext
- END IF
- s_pfmx ls_s_pfmx[]
- //查询默认清单
- deep_count++
- datastore ds_workprice
- ds_workprice = Create datastore
- ds_workprice.DataObject = 'dw_sc_workpricetable_mx_ds'
- ds_workprice.SetTransObject(sqlca)
- IF deep_count > 2000 THEN //防止死递归
- arg_msg = '递归太深'+String(deep_count)
- rslt = 0
- GOTO ext
- END IF
- DECLARE pf_cur CURSOR FOR
- SELECT u_PrdPF.Sonscale,
- u_PrdPF.SonLoss,
- u_PrdPF.SonDECLosS,
- u_PrdPF.SonMtrlid,
- u_mtrldef.mtrlcode,
- u_mtrldef.mtrlorigin,
- u_PrdPF.sonpfcode,
- u_mtrldef.dftwrkgrpid,
- u_mtrldef.protype
- FROM u_PrdPF INNER JOIN
- u_mtrldef ON u_PrdPF.SonMtrlid = u_mtrldef.mtrlid INNER JOIN
- u_mtrldef u_mtrldef_p ON u_PrdPF.mtrlid = u_mtrldef_p.mtrlid
- where ( u_PrdPF.mtrlid = :arg_mtrlid )
- AND ( u_PrdPF.pfcode = :arg_pfcode )
- and ((u_mtrldef.ifselforder <> 0 or u_mtrldef.mtrlorigin <> 0) and :arg_protype = 0 or :arg_protype = 1 );
- // and (u_mtrldef.mtrlorigin = 0);
-
- OPEN pf_cur;
- count = 1
- FETCH pf_cur INTO :ls_s_pfmx[count].Sonscale,:ls_s_pfmx[count].SonLoss,&
- :ls_s_pfmx[count].SonDECLosS,:ls_s_pfmx[count].SonMtrlid,&
- :ls_s_pfmx[count].mtrlcode,:ls_s_pfmx[count].mtrlorigin,:ls_s_pfmx[count].sonpfcode,&
- :ls_s_pfmx[count].dftwrkgrpid,:ls_s_pfmx[count].protype;
-
- DO WHILE sqlca.SQLCode = 0
- count++
- FETCH pf_cur INTO :ls_s_pfmx[count].Sonscale,:ls_s_pfmx[count].SonLoss,&
- :ls_s_pfmx[count].SonDECLosS,:ls_s_pfmx[count].SonMtrlid,&
- :ls_s_pfmx[count].mtrlcode,:ls_s_pfmx[count].mtrlorigin,:ls_s_pfmx[count].sonpfcode,&
- :ls_s_pfmx[count].dftwrkgrpid,:ls_s_pfmx[count].protype;
-
- LOOP
- count = count - 1
- CLOSE pf_cur;
- FOR ll_i = 1 To count
- SELECT count(*) INTO :cnt
- FROM u_PrdPF
- WHERE ( u_PrdPF.mtrlid = :ls_s_pfmx[ll_i].SonMtrlid ) AND
- ( u_PrdPF.pfcode = :ls_s_pfmx[ll_i].sonpfcode );
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '查询物料:'+ls_s_pfmx[ll_i].mtrlcode+'物料清单失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
-
- ld_qty = arg_qty * (ls_s_pfmx[ll_i].Sonscale/(1 - ls_s_pfmx[ll_i].SonLoss)+ls_s_pfmx[ll_i].SonDECLosS)
-
-
- //如果自制,将其工价表插入
- IF ls_s_pfmx[ll_i].mtrlorigin = 0 THEN
-
- //yyx20120903
- ll_cnt_wp_wrkgrpid = 0
- SELECT count(*)
- INTO :ll_cnt_wp_wrkgrpid
- FROM u_mtrl_workprice
- Where u_mtrl_workprice.mtrlid = :ls_s_pfmx[ll_i].SonMtrlid;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '查询物料:'+ls_s_pfmx[ll_i].mtrlcode+'车间工价表数目失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
-
- IF ll_cnt_wp_wrkgrpid > 0 THEN
- SELECT top 1 u_mtrl_workprice.wrkid,u_mtrl_workprice.wpcode
- INTO :ll_dftwrkgrpid_top1,:ls_wpcode_top1
- FROM u_mtrl_workprice
- Where u_mtrl_workprice.mtrlid = :ls_s_pfmx[ll_i].SonMtrlid
- order by u_mtrl_workprice.ifdft desc;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '查询物料:'+ls_s_pfmx[ll_i].mtrlcode+'车间工价表id失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- ls_retr_wpcode = ls_wpcode_top1
- ll_retr_wrkgrpid = ll_dftwrkgrpid_top1
- ELSE
- ls_retr_wpcode = ''
- ll_retr_wrkgrpid = ls_s_pfmx[ll_i].dftwrkgrpid
- END IF
- //
- ds_workprice.Retrieve(ls_s_pfmx[ll_i].SonMtrlid,ls_retr_wpcode)
-
- FOR ll_j = 1 To ds_workprice.RowCount()
- il_printid++
- proid = ds_workprice.Object.proid[ll_j]
- proorder = ds_workprice.Object.proorder[ll_j]
- procode = ds_workprice.Object.procode[ll_j]
- proname = ds_workprice.Object.u_sc_workprice_proname[ll_j]
- wrkgrpid = ds_workprice.Object.wrkgrpid[ll_j]
- workprice = ds_workprice.Object.workprice[ll_j]
- workqty = ds_workprice.Object.workqty[ll_j] * ld_qty
- worklevel = ds_workprice.Object.worklevel[ll_j]
- workhour = ds_workprice.Object.workhour[ll_j] * ld_qty
- dscrp = ds_workprice.Object.dscrp[ll_j]
- auditflag = ds_workprice.Object.auditflag[ll_j]
- auditrep = ds_workprice.Object.auditrep[ll_j]
- auditdate = ds_workprice.Object.auditdate[ll_j]
- status = ds_workprice.Object.u_sc_workprice_status[ll_j]
- ll_wrkid = ds_workprice.Object.u_sc_workprice_wrkid[ll_j]
-
- INSERT INTO u_sc_workprice_mx
- (parentmtrlid,
- printid,
- mtrlid,
- proid,
- proorder,
- procode,
- proname,
- wrkgrpid,
- workprice,
- workqty,
- worklevel,
- workhour,
- dscrp,
- auditflag,
- auditrep,
- auditdate,
- lastflag,
- lp,
- status,
- wrkid,
- wpcode)
- VALUES
- (:mtrlid,
- :il_printid,
- :ls_s_pfmx[ll_i].SonMtrlid,
- :proid,
- :proorder,
- :procode,
- :proname,
- :wrkgrpid,
- :workprice,
- :workqty,
- :worklevel,
- :workhour,
- :dscrp,
- :auditflag,
- :auditrep,
- :auditdate,
- :lastflag,
- :arg_lp,
- :status,
- :ll_wrkid,
- :arg_wpcode);
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '插入下级自制部件工价表失败'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
-
- NEXT
- END IF
-
- IF f_addpfmx(ls_s_pfmx[ll_i].SonMtrlid,arg_wpcode,ls_s_pfmx[ll_i].sonpfcode,ld_qty,arg_lp + 1 ,arg_msg,arg_ifcommit,ls_s_pfmx[ll_i].protype) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- NEXT
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT;
- END IF
- destroy ds_workprice
- RETURN rslt
- end function
- on uo_workpricetable.create
- call super::create
- TriggerEvent( this, "constructor" )
- end on
- on uo_workpricetable.destroy
- TriggerEvent( this, "destructor" )
- call super::destroy
- end on
- event constructor;String str_optionvalue,arg_msg
- str_optionvalue = ''
- f_get_sys_option_value('398',str_optionvalue,arg_msg)
- uo_option_orderrqwp_auditgj = Long(str_optionvalue)
- end event
|