1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552 |
- $PBExportHeader$uo_workprice_change.sru
- forward
- global type uo_workprice_change from nonvisualobject
- end type
- end forward
- global type uo_workprice_change from nonvisualobject
- end type
- global uo_workprice_change uo_workprice_change
- type variables
- long uo_billid
- string uo_billcode
- long audit_buildtype
- string oppreason = ''
- end variables
- forward prototypes
- public function integer updatebegin (long arg_billid, ref string arg_msg)
- public function integer del (long arg_billid, ref string arg_msg, boolean arg_ifcommit)
- public function integer add_dscrp (long arg_billid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit)
- public function integer audit (long arg_billid, string arg_opemp, ref string arg_msg, boolean arg_ifcommit)
- public function integer getinfo (long arg_billid, ref s_workprice_changemx arg_ref_mx[], ref long arg_arr_cnt, ref string arg_msg)
- public function integer save (s_workprice_change arg_s_workprice, string arg_opemp, ref string arg_msg, boolean arg_ifcommit)
- public function integer uof_mod_rsltflag (long arg_billid, long arg_printid, integer arg_rsltflag, ref string arg_msg, boolean arg_ifcommit)
- public function integer priceaudit (long arg_billid, string arg_opemp, ref string arg_msg, boolean arg_ifcommit)
- public function integer c_priceaudit (long arg_billid, ref string arg_msg, boolean arg_ifcommit)
- public function integer p_getflag (long arg_billid, ref integer arg_flag, ref integer arg_priceflag, ref string arg_msg)
- end prototypes
- public function integer updatebegin (long arg_billid, ref string arg_msg);Int rslt = 1
- Int li_flag,li_priceflag
- Long cnt
- IF arg_billid <= 0 THEN
- rslt = 0
- arg_msg = '错误单据唯一码'
- GOTO ext
- END IF
- IF p_getflag(arg_billid,li_flag,li_priceflag,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- if li_priceflag = 1 then
- rslt = 0
- arg_msg = '单据已经确认,不可以再修改'
- GOTO ext
- END IF
- IF li_flag = 1 THEN
- rslt = 0
- arg_msg = '单据已经审核,不可以再修改'
- GOTO ext
- END IF
- ext:
- RETURN rslt
- end function
- public function integer del (long arg_billid, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
- Int li_flag,li_priceflag
- Long cnt
- If arg_billid <= 0 Then
- rslt = 0
- arg_msg = '错误单据唯一码'
- Goto ext
- End If
- If p_getflag(arg_billid,li_flag,li_priceflag,arg_msg) = 0 Then
- rslt = 0
- Goto ext
- End If
- If li_priceflag = 1 Then
- rslt = 0
- arg_msg = '单据已经确认,不可以删除'
- Goto ext
- End If
- If li_flag = 1 Then
- rslt = 0
- arg_msg = '单据不是在待审状态,不可以删除'
- Goto ext
- End If
- s_workprice_changemx s_workprice_mx[]
- Long ll_arr_cnt,ll_i
- If getinfo(arg_billid,s_workprice_mx,ll_arr_cnt,arg_msg) = 0 Then
- rslt = 0
- Goto ext
- End If
- Delete From u_workprice_change
- Where billid = :arg_billid;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- arg_msg = "删除单据操作失败"+"~n"+sqlca.SQLErrText
- Goto ext
- End If
- Delete From u_workprice_changemx
- Where billid = :arg_billid;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- arg_msg = "删除单据明细操作失败"+"~n"+sqlca.SQLErrText
- Goto ext
- End If
- For ll_i = 1 To ll_arr_cnt
-
- If s_workprice_mx[ll_i].editflag = 0 Then //变更
- If s_workprice_mx[ll_i].workqty > 0 Then
-
- Select count(*)
- Into :cnt
- From u_workprice_changemx
- Where (editflag = 0)
- And (workqty > 0)
- and (rsltflag = 0)
- And (mtrlid = :s_workprice_mx[ll_i].mtrlid)
- And (procode = :s_workprice_mx[ll_i].procode)
- And (wpcode = :s_workprice_mx[ll_i].wpcode);
- If sqlca.SQLCode <> 0 Then cnt = 0
-
- If cnt = 0 Then
- Update u_sc_workprice
- Set ifchangebill = 0
- Where mtrlid = :s_workprice_mx[ll_i].mtrlid
- And procode = :s_workprice_mx[ll_i].procode
- And wpcode = :s_workprice_mx[ll_i].wpcode;
- If sqlca.SQLCode <> 0 Or sqlca.SQLNRows = 0 Then
- rslt = 0
- arg_msg = '更新工价表是否有相关变更单字段失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
- Goto ext
- End If
- End If
- End If
- 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 add_dscrp (long arg_billid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
- Int li_flag,li_priceflag
- IF arg_newdescppart = '' THEN
- rslt = 0
- arG_MSG = "要添加内容为空,操作取消"
- GOTO ext
- END IF
- IF p_getflag(arg_billid,li_flag,li_priceflag,arG_MSG) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- if li_priceflag = 0 then
- rslt = 0
- arG_MSG = "待审核状态下不可用"
- GOTO ext
- END IF
- IF li_flag = 0 THEN
- rslt = 0
- arG_MSG = "待审核状态下不可用"
- GOTO ext
- END IF
- UPDATE u_workprice_change
- SET DSCRP = DSCRP+' '+:arg_newdescppart
- WHERE u_workprice_change.billid = :arg_billid;
- IF SQLCA.SQLCode <> 0 THEN
- rslt = 0
- arG_MSG = "因网络或其它原因导致添加备注操作失败"+"~n"+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 audit (long arg_billid, string arg_opemp, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
- Int li_flag, li_priceflag
- Long ll_scid
- String ls_billcode
- Int li_rsltflag
- DateTime ldt_nulldt
- Int li_ifchangebill
- SetNull(ldt_nulldt)
- uo_workpricetable uo_workprice
- uo_workprice = Create uo_workpricetable
- If arg_billid <= 0 Then
- rslt = 0
- ARG_MSG = '错误单据唯一码'
- Goto ext
- End If
- If p_getflag(arg_billid,li_flag,li_priceflag,ARG_MSG) = 0 Then
- rslt = 0
- Goto ext
- End If
- Select scid,billcode
- Into :ll_scid,:ls_billcode
- From u_workprice_change
- Where billid = :arg_billid;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- ARG_MSG = '查询单据信息失败,'+sqlca.SQLErrText
- Goto ext
- End If
- If sys_option_if_oa_workprice_change = 1 And sys_option_workprice_change_secaudit = 1 And audit_buildtype = 0 Then
- If f_check_if_oaflow(ll_scid,arg_billid,1494,ARG_MSG ) = 0 Then
- rslt = 0
- Goto ext
- End If
- End If
- If li_flag <> 0 Then
- rslt = 0
- ARG_MSG = '单据不是在待审核状态,不可以审核'
- Goto ext
- End If
- If sys_option_workprice_change_secaudit = 1 Then
- If li_priceflag <> 1 Then
- rslt = 0
- ARG_MSG = '系统选项控制,单据使用二级审核,不是在已确认状态,不可以审核'
- Goto ext
- End If
-
- End If
- //更新工价表
- Long ll_sonmtrlid
- s_workprice_changemx s_workprice_mx[]
- Long ll_arr_cnt,ll_i
- Long cnt
- DateTime serdate
- Select Top 1 getdate() Into :serdate From u_user;
- If sqlca.SQLCode <> 0 Then
- ARG_MSG = '查询服务器时间失败'
- rslt = 0
- Goto ext
- End If
- If getinfo(arg_billid,s_workprice_mx,ll_arr_cnt,ARG_MSG) = 0 Then
- rslt = 0
- Goto ext
- End If
- For ll_i = 1 To ll_arr_cnt
- If s_workprice_mx[ll_i].iffinishoa = 1 Then Continue //结束审批的明细不处理
-
- If (s_workprice_mx[ll_i].editflag = 1 And s_workprice_mx[ll_i].rsltflag <> 0) Then Continue //无效变更的,不处理; 如果是新增类且不是同意,不处理
-
- //如果是无效并且类型为变更,更新工价表开单标记 20140729
- If s_workprice_mx[ll_i].rsltflag = 2 Then
- If s_workprice_mx[ll_i].editflag = 0 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_changemx.editflag = 0)
- And (u_workprice_changemx.workqty > 0)
- And (u_workprice_changemx.rsltflag = 0)
- And (u_workprice_change.flag = 0)
- And (u_workprice_changemx.mtrlid = :s_workprice_mx[ll_i].mtrlid)
- And (u_workprice_changemx.procode = :s_workprice_mx[ll_i].procode)
- And (u_workprice_changemx.wpcode = :s_workprice_mx[ll_i].wpcode)
- And (u_workprice_changemx.billid <> :arg_billid) ;
- If sqlca.SQLCode <> 0 Then cnt = 0
-
- If cnt = 0 Then
- li_ifchangebill = 0
- Else
- li_ifchangebill = 1
- End If
-
- Update u_sc_workprice
- Set ifchangebill = :li_ifchangebill
- Where mtrlid = :s_workprice_mx[ll_i].mtrlid
- And procode = :s_workprice_mx[ll_i].procode
- And wpcode = :s_workprice_mx[ll_i].wpcode;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- ARG_MSG = '更新工价表开单标记失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
- Goto ext
- End If
- End If
-
- Continue
- End If
- /////////
-
- If s_workprice_mx[ll_i].wrkid = 0 Then
- rslt = 0
- ARG_MSG = '第'+String(ll_i)+'行,请先选择车间'
- Goto ext
- End If
-
- li_rsltflag = s_workprice_mx[ll_i].rsltflag
-
- If IsNull(s_workprice_mx[ll_i].ifgroup) Then s_workprice_mx[ll_i].ifgroup = 0
-
- If s_workprice_mx[ll_i].editflag = 0 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_changemx.editflag = 0)
- And (u_workprice_changemx.workqty > 0)
- And (u_workprice_changemx.rsltflag = 0)
- And (u_workprice_change.flag = 0)
- And (u_workprice_changemx.mtrlid = :s_workprice_mx[ll_i].mtrlid)
- And (u_workprice_changemx.procode = :s_workprice_mx[ll_i].procode)
- And (u_workprice_changemx.wpcode = :s_workprice_mx[ll_i].wpcode)
- And (u_workprice_changemx.billid <> :arg_billid) ;
- If sqlca.SQLCode <> 0 Then cnt = 0
-
- If cnt = 0 Then
- li_ifchangebill = 0
- Else
- li_ifchangebill = 1
- End If
-
- If li_rsltflag = 0 Then
-
- If s_workprice_mx[ll_i].workqty > 0 Then
- Update u_sc_workprice
- Set proname = :s_workprice_mx[ll_i].proname,
- workqty = :s_workprice_mx[ll_i].workqty,
- workprice = :s_workprice_mx[ll_i].workprice,
- wrkgrpid = :s_workprice_mx[ll_i].wrkgrpid,
- ifstandard = :s_workprice_mx[ll_i].ifstandard,
- lsxtype = :s_workprice_mx[ll_i].lsxtype,
- lastflag = :s_workprice_mx[ll_i].lastflag,
- workhour = :s_workprice_mx[ll_i].workhour_minute / 60,
- workhour_minute = :s_workprice_mx[ll_i].workhour_minute,
- beforehour_minute = :s_workprice_mx[ll_i].beforehour_minute,
- afterhour_minute = :s_workprice_mx[ll_i].afterhour_minute,
- eqworkhour_minute = :s_workprice_mx[ll_i].eqworkhour_minute,
- beforehour = :s_workprice_mx[ll_i].beforehour_minute / 60,
- afterhour = :s_workprice_mx[ll_i].afterhour_minute / 60,
- eqworkhour = :s_workprice_mx[ll_i].eqworkhour_minute / 60,
- dscrp = :s_workprice_mx[ll_i].dscrp,
- worklevel = :s_workprice_mx[ll_i].worklevel,
- techlevel = :s_workprice_mx[ll_i].techlevel,
- ifjd = :s_workprice_mx[ll_i].ifjd,
- status = :s_workprice_mx[ll_i].status,
- auditflag = 1,
- auditrep = :arg_opemp,
- auditdate = getdate(),
- pricestr = :s_workprice_mx[ll_i].pricestr,
- workqtystr = :s_workprice_mx[ll_i].workqtystr,
- wrkid = :s_workprice_mx[ll_i].wrkid,
- u_workqty = :s_workprice_mx[ll_i].u_workqty,
- u_workprice = :s_workprice_mx[ll_i].u_workprice,
- u_workqtystr = :s_workprice_mx[ll_i].u_workqtystr,
- u_pricestr = :s_workprice_mx[ll_i].u_pricestr,
- arg1 = :s_workprice_mx[ll_i].arg1,
- arg2 = :s_workprice_mx[ll_i].arg2,
- arg3 = :s_workprice_mx[ll_i].arg3,
- arg4 = :s_workprice_mx[ll_i].arg4,
- arg5 = :s_workprice_mx[ll_i].arg5,
- arg6 = :s_workprice_mx[ll_i].arg6,
- arg7 = :s_workprice_mx[ll_i].arg7,
- arg8 = :s_workprice_mx[ll_i].arg8,
- arg9 = :s_workprice_mx[ll_i].arg9,
- ifgroup = :s_workprice_mx[ll_i].ifgroup,
- auditflag_gj = 1 ,
- auditrep_gj = :arg_opemp ,
- auditdate_gj = getdate() ,
- oppflag = 0 ,
- opprep = '' ,
- oppdate = :ldt_nulldt,
- changeflag = 2,
- lastprice = :s_workprice_mx[ll_i].workprice,
- replacestr = :s_workprice_mx[ll_i].replacestr,
- relchangecode = :ls_billcode,
- worktype = :s_workprice_mx[ll_i].worktype,
- rpcode = :s_workprice_mx[ll_i].rpcode,
- ifdftpg = :s_workprice_mx[ll_i].ifdftpg,
- ifdftjj = :s_workprice_mx[ll_i].ifdftjj,
- ifchangebill = :li_ifchangebill
- Where mtrlid = :s_workprice_mx[ll_i].mtrlid
- And procode = :s_workprice_mx[ll_i].procode
- And wpcode = :s_workprice_mx[ll_i].wpcode;
- If sqlca.SQLCode <> 0 Then //Or sqlca.SQLNRows = 0 THEN
- rslt = 0
- ARG_MSG = '更新工价表失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
- Goto ext
- End If
-
- If uo_workprice.uof_update_workprice_zl(s_workprice_mx[ll_i].mtrlid,s_workprice_mx[ll_i].wpcode,s_workprice_mx[ll_i].procode,ARG_MSG,False) = 0 Then
- rslt = 0
- Goto ext
- End If
- ElseIf s_workprice_mx[ll_i].workqty = 0 Then //数量为0,删除
- Delete From u_sc_workprice
- Where mtrlid = :s_workprice_mx[ll_i].mtrlid
- And procode = :s_workprice_mx[ll_i].procode
- And wpcode = :s_workprice_mx[ll_i].wpcode;
- If sqlca.SQLCode <> 0 Then //Or sqlca.SQLNRows = 0 THEN
- rslt = 0
- ARG_MSG = '删除工价表失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
- Goto ext
- End If
- End If
-
- Else
- //20141013修改:反对的明细不取消工价审,否则会导致原工价无效 YS
- // auditflag_gj = 0 ,
- // auditrep_gj = '' ,
- // auditdate_gj = :ldt_nulldt ,
-
-
- Update u_sc_workprice
- Set oppflag = 1 ,
- opprep = :arg_opemp ,
- oppdate = getdate(),
- oppreason = :s_workprice_mx[ll_i].reason,
- relchangecode = :ls_billcode,
- ifchangebill = :li_ifchangebill
- Where mtrlid = :s_workprice_mx[ll_i].mtrlid
- And procode = :s_workprice_mx[ll_i].procode
- And wpcode = :s_workprice_mx[ll_i].wpcode;
- If sqlca.SQLCode <> 0 Then //Or sqlca.SQLNRows = 0 THEN
- rslt = 0
- ARG_MSG = '更新工价表反对标记失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
- Goto ext
- End If
- End If
- ElseIf s_workprice_mx[ll_i].editflag = 2 Then //删除
- Delete From u_sc_workprice
- Where mtrlid = :s_workprice_mx[ll_i].mtrlid
- And procode = :s_workprice_mx[ll_i].procode
- And wpcode = :s_workprice_mx[ll_i].wpcode;
- If sqlca.SQLCode <> 0 Then //Or sqlca.SQLNRows = 0 THEN
- rslt = 0
- ARG_MSG = '删除工价表失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
- Goto ext
- End If
- Else // 新增
- cnt = 0
- Select count(*)
- Into :cnt
- From u_sc_workprice
- Where mtrlid = :s_workprice_mx[ll_i].mtrlid
- And procode = :s_workprice_mx[ll_i].procode
- And wpcode = :s_workprice_mx[ll_i].wpcode;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- ARG_MSG = '查询工价表失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
- Goto ext
- End If
-
- If cnt > 0 Then
- rslt = 0
- ARG_MSG = '工价表已存在相同信息,不能插入重复内容,第 '+String(ll_i)+' 行'
- Goto ext
- End If
-
- Select count(*)
- Into :cnt
- From u_mtrl_workprice
- Where mtrlid = :s_workprice_mx[ll_i].mtrlid
- And wpcode = :s_workprice_mx[ll_i].wpcode;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- ARG_MSG = '查询车间工价表失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
- Goto ext
- End If
-
- If cnt = 0 Then
- Insert Into u_mtrl_workprice
- (mtrlid,
- wrkid,
- flag,
- opemp,
- opdate,
- wpcode)
- Values
- (:s_workprice_mx[ll_i].mtrlid,
- :s_workprice_mx[ll_i].wrkid,
- 0,
- :arg_opemp,
- getdate(),
- :s_workprice_mx[ll_i].wpcode);
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- ARG_MSG = '插入车间工价表失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
- Goto ext
- End If
- End If
-
- Insert Into u_sc_workprice
- (
- mtrlid,
- proorder,
- procode,
- proname,
- workqty,
- workprice,
- wrkgrpid,
- ifstandard ,
- lsxtype ,
- lastflag ,
- workhour,
- dscrp ,
- worklevel ,
- techlevel,
- proid,
- auditflag,
- auditrep,
- auditdate,
- status,
- ifjd,
- wrkid,
- workhour_minute,
- beforehour_minute,
- afterhour_minute,
- eqworkhour_minute,
- beforehour,
- afterhour,
- eqworkhour,
- pricestr,
- workqtystr,
- wpcode,
- u_workqty,
- u_workprice,
- u_workqtystr,
- u_pricestr,
- arg1,
- arg2,
- arg3,
- arg4,
- arg5,
- arg6,
- arg7,
- arg8,
- arg9,
- ifgroup,
- lastprice,
- replacestr,
- worktype,
- rpcode,
- ifdftpg,
- ifdftjj)
- Values
- (
- :s_workprice_mx[ll_i].mtrlid,
- :s_workprice_mx[ll_i].proorder,
- :s_workprice_mx[ll_i].procode,
- :s_workprice_mx[ll_i].proname,
- :s_workprice_mx[ll_i].workqty,
- :s_workprice_mx[ll_i].workprice,
- :s_workprice_mx[ll_i].wrkgrpid,
- :s_workprice_mx[ll_i].ifstandard,
- :s_workprice_mx[ll_i].lsxtype,
- :s_workprice_mx[ll_i].lastflag,
- :s_workprice_mx[ll_i].workhour_minute / 60 ,
- :s_workprice_mx[ll_i].dscrp,
- :s_workprice_mx[ll_i].worklevel,
- :s_workprice_mx[ll_i].techlevel,
- 0,
- 1,
- :arg_opemp,
- getdate(),
- :s_workprice_mx[ll_i].status,
- :s_workprice_mx[ll_i].ifjd,
- :s_workprice_mx[ll_i].wrkid,
- :s_workprice_mx[ll_i].workhour_minute,
- :s_workprice_mx[ll_i].beforehour_minute,
- :s_workprice_mx[ll_i].afterhour_minute,
- :s_workprice_mx[ll_i].eqworkhour_minute,
- :s_workprice_mx[ll_i].beforehour_minute / 60,
- :s_workprice_mx[ll_i].afterhour_minute / 60,
- :s_workprice_mx[ll_i].eqworkhour_minute / 60,
- :s_workprice_mx[ll_i].pricestr,
- :s_workprice_mx[ll_i].workqtystr,
- :s_workprice_mx[ll_i].wpcode,
- :s_workprice_mx[ll_i].u_workqty,
- :s_workprice_mx[ll_i].u_workprice,
- :s_workprice_mx[ll_i].u_workqtystr,
- :s_workprice_mx[ll_i].u_pricestr,
- :s_workprice_mx[ll_i].arg1,
- :s_workprice_mx[ll_i].arg2,
- :s_workprice_mx[ll_i].arg3,
- :s_workprice_mx[ll_i].arg4,
- :s_workprice_mx[ll_i].arg5,
- :s_workprice_mx[ll_i].arg6,
- :s_workprice_mx[ll_i].arg7,
- :s_workprice_mx[ll_i].arg8,
- :s_workprice_mx[ll_i].arg9,
- :s_workprice_mx[ll_i].ifgroup,
- :s_workprice_mx[ll_i].workprice,
- :s_workprice_mx[ll_i].replacestr,
- :s_workprice_mx[ll_i].worktype,
- :s_workprice_mx[ll_i].rpcode,
- :s_workprice_mx[ll_i].ifdftpg,
- :s_workprice_mx[ll_i].ifdftjj
- );
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- ARG_MSG = '插入工价表失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
- Goto ext
- End If
- End If
-
- // IF uo_workprice.update_auditflag(s_workprice_mx[ll_i].mtrlid,serdate,arg_opemp,ARG_MSG,FALSE) = 0 THEN
- // rslt = 0
- // GOTO ext
- // END IF
- Next
- //更新审核标记
- Update u_workprice_change
- Set auditingrep = :arg_opemp,
- auditingdate = getdate(),
- flag = 1
- Where billid = :arg_billid
- And flag = 0;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- ARG_MSG = "因网络或其它原因导致单据审核操作失败"+"~n"+sqlca.SQLErrText
- Goto ext
- ElseIf sqlca.SQLNRows = 0 Then
- rslt = 0
- ARG_MSG = "单据正在审核,请稍后查询。"+"~n"+sqlca.SQLErrText
- Goto ext
- End If
- ext:
- If rslt = 0 Then
- Rollback;
- ElseIf rslt = 1 And arg_ifcommit Then
- Commit;
- End If
- Destroy uo_workprice
- Return rslt
- end function
- public function integer getinfo (long arg_billid, ref s_workprice_changemx arg_ref_mx[], ref long arg_arr_cnt, ref string arg_msg);Int rslt = 1
- Long i = 1,no_mxcheck = 0
- IF arg_billid <= 0 THEN
- rslt = 0
- arg_msg = '错误单据唯一码'
- GOTO ext
- END IF
- //用游标读取明细
- DECLARE cur_mx CURSOR FOR
- SELECT billid,
- printid,
- editflag,
- mtrlid,
- proorder,
- procode,
- proname,
- workqty,
- workprice_ori,
- workprice,
- wrkgrpid,
- ifstandard,
- lsxtype,
- lastflag,
- workhour,
- dscrp,
- worklevel,
- techlevel,
- status,
- ifjd,
- wrkid,
- arg1,
- arg2,
- arg3,
- arg4,
- arg5,
- arg6,
- arg7,
- arg8,
- arg9,
- workhour_minute,
- beforehour_minute,
- afterhour_minute,
- eqworkhour_minute,
- pricestr,
- workqtystr,
- rsltflag,
- wpcode,
- u_workqty,
- u_workprice,
- u_workqtystr,
- u_pricestr,
- ifgroup,
- reason,
- replacestr,
- worktype,
- iffinishoa,
- rpcode,
- ifdftpg,
- ifdftjj
- FROM u_workprice_changemx
- WHERE u_workprice_changemx.billid = :arg_billid
- Order By u_workprice_changemx.printid;
-
- OPEN cur_mx;
- FETCH cur_mx INTO
- :arg_ref_mx[i].billid,
- :arg_ref_mx[i].printid,
- :arg_ref_mx[i].editflag,
- :arg_ref_mx[i].mtrlid,
- :arg_ref_mx[i].proorder,
- :arg_ref_mx[i].procode,
- :arg_ref_mx[i].proname,
- :arg_ref_mx[i].workqty,
- :arg_ref_mx[i].workprice_ori,
- :arg_ref_mx[i].workprice,
- :arg_ref_mx[i].wrkgrpid,
- :arg_ref_mx[i].ifstandard,
- :arg_ref_mx[i].lsxtype,
- :arg_ref_mx[i].lastflag,
- :arg_ref_mx[i].workhour,
- :arg_ref_mx[i].dscrp,
- :arg_ref_mx[i].worklevel,
- :arg_ref_mx[i].techlevel,
- :arg_ref_mx[i].status,
- :arg_ref_mx[i].ifjd,
- :arg_ref_mx[i].wrkid,
- :arg_ref_mx[i].arg1,
- :arg_ref_mx[i].arg2,
- :arg_ref_mx[i].arg3,
- :arg_ref_mx[i].arg4,
- :arg_ref_mx[i].arg5,
- :arg_ref_mx[i].arg6,
- :arg_ref_mx[i].arg7,
- :arg_ref_mx[i].arg8,
- :arg_ref_mx[i].arg9,
- :arg_ref_mx[i].workhour_minute,
- :arg_ref_mx[i].beforehour_minute,
- :arg_ref_mx[i].afterhour_minute,
- :arg_ref_mx[i].eqworkhour_minute,
- :arg_ref_mx[i].pricestr,
- :arg_ref_mx[i].workqtystr,
- :arg_ref_mx[i].rsltflag,
- :arg_ref_mx[i].wpcode,
- :arg_ref_mx[i].u_workqty,
- :arg_ref_mx[i].u_workprice,
- :arg_ref_mx[i].u_workqtystr,
- :arg_ref_mx[i].u_pricestr,
- :arg_ref_mx[i].ifgroup,
- :arg_ref_mx[i].reason,
- :arg_ref_mx[i].replacestr,
- :arg_ref_mx[i].worktype,
- :arg_ref_mx[i].iffinishoa,
- :arg_ref_mx[i].rpcode,
- :arg_ref_mx[i].ifdftpg,
- :arg_ref_mx[i].ifdftjj;
-
- DO WHILE sqlca.SQLCode = 0
- i++
- FETCH cur_mx INTO
- :arg_ref_mx[i].billid,
- :arg_ref_mx[i].printid,
- :arg_ref_mx[i].editflag,
- :arg_ref_mx[i].mtrlid,
- :arg_ref_mx[i].proorder,
- :arg_ref_mx[i].procode,
- :arg_ref_mx[i].proname,
- :arg_ref_mx[i].workqty,
- :arg_ref_mx[i].workprice_ori,
- :arg_ref_mx[i].workprice,
- :arg_ref_mx[i].wrkgrpid,
- :arg_ref_mx[i].ifstandard,
- :arg_ref_mx[i].lsxtype,
- :arg_ref_mx[i].lastflag,
- :arg_ref_mx[i].workhour,
- :arg_ref_mx[i].dscrp,
- :arg_ref_mx[i].worklevel,
- :arg_ref_mx[i].techlevel,
- :arg_ref_mx[i].status,
- :arg_ref_mx[i].ifjd,
- :arg_ref_mx[i].wrkid,
- :arg_ref_mx[i].arg1,
- :arg_ref_mx[i].arg2,
- :arg_ref_mx[i].arg3,
- :arg_ref_mx[i].arg4,
- :arg_ref_mx[i].arg5,
- :arg_ref_mx[i].arg6,
- :arg_ref_mx[i].arg7,
- :arg_ref_mx[i].arg8,
- :arg_ref_mx[i].arg9,
- :arg_ref_mx[i].workhour_minute,
- :arg_ref_mx[i].beforehour_minute,
- :arg_ref_mx[i].afterhour_minute,
- :arg_ref_mx[i].eqworkhour_minute,
- :arg_ref_mx[i].pricestr,
- :arg_ref_mx[i].workqtystr,
- :arg_ref_mx[i].rsltflag,
- :arg_ref_mx[i].wpcode,
- :arg_ref_mx[i].u_workqty,
- :arg_ref_mx[i].u_workprice,
- :arg_ref_mx[i].u_workqtystr,
- :arg_ref_mx[i].u_pricestr,
- :arg_ref_mx[i].ifgroup,
- :arg_ref_mx[i].reason,
- :arg_ref_mx[i].replacestr,
- :arg_ref_mx[i].worktype,
- :arg_ref_mx[i].iffinishoa,
- :arg_ref_mx[i].rpcode,
- :arg_ref_mx[i].ifdftpg,
- :arg_ref_mx[i].ifdftjj;
- LOOP
- CLOSE cur_mx;
- //检验明细是否读入完整
- SELECT count(*) INTO :no_mxcheck
- FROM u_workprice_changemx
- Where billid = :arg_billid;
- IF sqlca.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
- arg_arr_cnt = i - 1
- ext:
- RETURN rslt
- end function
- public function integer save (s_workprice_change arg_s_workprice, string arg_opemp, ref string arg_msg, boolean arg_ifcommit);Integer rslt = 1,cnt = 0
- DateTime server_dt
- Long ll_billid,it_mxbt,i,ll_i
- String ls_sccode,ls_billcode
- If IsNull(arg_s_workprice.scid) Then arg_s_workprice.scid = 0
- If IsNull(arg_s_workprice.billid) Then arg_s_workprice.billid = 0
- If IsNull(arg_s_workprice.wrkid) Then arg_s_workprice.wrkid = 0 //备注性质
- If IsNull(arg_s_workprice.procode) Then arg_s_workprice.procode = ''
- If IsNull(arg_s_workprice.proname) Then arg_s_workprice.proname = ''
- If IsNull(arg_s_workprice.rep) Then arg_s_workprice.rep = ''
- If IsNull(arg_s_workprice.dscrp) Then arg_s_workprice.dscrp = ''
- //IF arg_s_workprice.procode = '' THEN
- // arg_msg = '请选择工序'
- // rslt = 0
- // GOTO ext
- //END IF
- If arg_s_workprice.rep = '' Then
- arg_msg = '请输入经手人'
- rslt = 0
- Goto ext
- End If
- If arg_s_workprice.scid < 0 Then
- arg_msg = '请选择分部'
- rslt = 0
- Goto ext
- End If
- Select Top 1 getdate() Into :server_dt From u_user;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- arg_msg = "查询操作失败,日期 "
- Goto ext
- End If
- it_mxbt = UpperBound(arg_s_workprice.arg_s_mx)
- If it_mxbt <= 0 Then
- rslt = 0
- arg_msg = "没有正确明细内容"
- Goto ext
- End If
- //新增类型,检查 工组 对应 车间
- For i = 1 To it_mxbt
- If arg_s_workprice.arg_s_mx[i].wpcode = '' Then
- rslt = 0
- arg_msg = "行"+String(i)+ ",没有工价表号"
- Goto ext
- End If
-
- //新增类型,检查 工组 对应 车间
- //新增类型,检查 流水表打印类型 不能为 不参加打印[0]
- If arg_s_workprice.arg_s_mx[i].editflag = 1 Then
- If arg_s_workprice.arg_s_mx[i].lsxtype = 0 Then
- rslt = 0
- arg_msg = "行"+String(i)+ ",新增工序的流水表打印类型不能为[不参加打印]"
- Goto ext
- End If
-
- Select count(*)
- Into :cnt
- From u_sc_workgroup
- Where u_sc_workgroup.wrkGrpid = :arg_s_workprice.arg_s_mx[i].wrkgrpid
- And u_sc_workgroup.storageid = :arg_s_workprice.arg_s_mx[i].wrkid;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- arg_msg = "行"+String(i)+ ",查询工组对应车间失败,"+sqlca.SQLErrText
- Goto ext
- End If
-
- If cnt = 0 Then
- rslt = 0
- arg_msg = "行"+String(i)+ ",当前工组、车间与资料设置不一致"
- Goto ext
- End If
- End If
-
- //检查是否有未审核的相同物料,工序的单据
- Select count(*)
- Into :cnt
- From u_workprice_change Inner JOIN
- u_workprice_changemx ON
- u_workprice_change.billid = u_workprice_changemx.billid
- Where (u_workprice_change.flag = 0)
- And (u_workprice_changemx.mtrlid = :arg_s_workprice.arg_s_mx[i].mtrlid)
- And(u_workprice_changemx.procode = :arg_s_workprice.arg_s_mx[i].procode)
- And (u_workprice_change.billid <> :arg_s_workprice.billid)
- And (u_workprice_changemx.rsltflag = 0);
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- arg_msg = "行"+String(i)+ ",查询是否有相关未审工价表变更单失败,"+sqlca.SQLErrText
- Goto ext
- End If
-
- If cnt > 0 Then
- rslt = 0
- arg_msg = "行"+String(i)+ ",存在相同物料相同工序的工价表变更单未审核["+String(cnt)+"]"
- Goto ext
- End If
- Next
- If arg_s_workprice.billid = 0 Then
- ll_billid = f_sys_scidentity(0,"u_workprice_change","billid",arg_msg,True,id_sqlca)
-
- If ll_billid <= 0 Then
- rslt = 0
- Goto ext
- End If
-
- If f_get_sccode(0,sqlca,ls_sccode,arg_msg) = 0 Then
- rslt = 0
- Goto ext
- End If
-
- ls_billcode = getid(0,ls_sccode + 'WC',Date(server_dt),False,sqlca)
-
- If ls_billcode = "err" Then
- rslt = 0
- arg_msg = "无法获取单据编号"+"~n"+sqlca.SQLErrText
- Goto ext
- End If
-
- Insert Into u_workprice_change
- (scid,
- billid,
- billcode,
- billdate,
- relcode,
- procode,
- proname,
- rep,
- dscrp,
- opdate,
- opemp,
- wrkid)
- Values
- (:arg_s_workprice.scid,
- :ll_billid,
- :ls_billcode,
- :arg_s_workprice.billdate,
- :arg_s_workprice.relcode,
- :arg_s_workprice.procode,
- :arg_s_workprice.proname,
- :arg_s_workprice.rep,
- :arg_s_workprice.dscrp,
- getdate(),
- :arg_opemp,
- :arg_s_workprice.wrkid);
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- arg_msg = "因网络或其它原因导致建立单据操作失败"+"~n"+sqlca.SQLErrText
- Goto ext
- End If
-
-
-
- uo_billid = ll_billid
- uo_billcode = ls_billcode
-
- Else
- Update u_workprice_change
- Set billdate = :arg_s_workprice.billdate,
- procode = :arg_s_workprice.procode,
- proname = :arg_s_workprice.proname,
- rep = :arg_s_workprice.rep,
- dscrp = :arg_s_workprice.dscrp,
- relcode = :arg_s_workprice.relcode,
- moddate = getdate(),
- modemp = :arg_opemp,
- wrkid = :arg_s_workprice.wrkid
- Where billid = :arg_s_workprice.billid
- And flag = 0 ;
- If sqlca.SQLCode <> 0 Or sqlca.SQLNRows <= 0 Then
- rslt = 0
- arg_msg = "因网络或其它原因导致更新单据操作失败"+"~n"+sqlca.SQLErrText
- Goto ext
- End If
-
- Delete From u_workprice_changemx
- Where billid = :arg_s_workprice.billid;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- arg_msg = "删除旧有明细操作失败"+"~n"+sqlca.SQLErrText
- Goto ext
- End If
-
- uo_billid = arg_s_workprice.billid
-
- End If
- For i = 1 To it_mxbt
- If IsNull(arg_s_workprice.arg_s_mx[i].ifgroup) Then arg_s_workprice.arg_s_mx[i].ifgroup = 0
- If arg_s_workprice.arg_s_mx[i].workqty = 0 then arg_s_workprice.arg_s_mx[i].editflag = 2
-
- Insert Into u_workprice_changemx
- (billid,
- printid,
- editflag,
- mtrlid,
- proorder,
- procode,
- proname,
- workqty_ori,
- workqty,
- workprice_ori,
- workprice,
- wrkgrpid,
- ifstandard,
- lsxtype,
- lastflag,
- dscrp,
- workhour,
- techlevel,
- status,
- ifjd,
- wrkid,
- arg1,
- arg2,
- arg3,
- arg4,
- arg5,
- arg6,
- arg7,
- arg8,
- arg9,
- workhour_minute,
- beforehour_minute,
- afterhour_minute,
- eqworkhour_minute,
- pricestr,
- workqtystr,
- wpcode,
- u_workqty,
- u_workprice,
- u_workqtystr,
- u_pricestr,
- proname_ori,
- ifgroup,
- replacestr,
- worktype,
- rpcode,
- ifdftpg,
- ifdftjj)
- Values
- (:uo_billid,
- :arg_s_workprice.arg_s_mx[i].printid,
- :arg_s_workprice.arg_s_mx[i].editflag,
- :arg_s_workprice.arg_s_mx[i].mtrlid,
- :arg_s_workprice.arg_s_mx[i].proorder,
- :arg_s_workprice.arg_s_mx[i].procode,
- :arg_s_workprice.arg_s_mx[i].proname,
- :arg_s_workprice.arg_s_mx[i].workqty_ori,
- :arg_s_workprice.arg_s_mx[i].workqty,
- :arg_s_workprice.arg_s_mx[i].workprice_ori,
- :arg_s_workprice.arg_s_mx[i].workprice,
- :arg_s_workprice.arg_s_mx[i].wrkgrpid,
- :arg_s_workprice.arg_s_mx[i].ifstandard,
- :arg_s_workprice.arg_s_mx[i].lsxtype,
- :arg_s_workprice.arg_s_mx[i].lastflag,
- :arg_s_workprice.arg_s_mx[i].dscrp,
- :arg_s_workprice.arg_s_mx[i].workhour,
- :arg_s_workprice.arg_s_mx[i].techlevel,
- :arg_s_workprice.arg_s_mx[i].status,
- :arg_s_workprice.arg_s_mx[i].ifjd,
- :arg_s_workprice.arg_s_mx[i].wrkid,
- :arg_s_workprice.arg_s_mx[i].arg1,
- :arg_s_workprice.arg_s_mx[i].arg2,
- :arg_s_workprice.arg_s_mx[i].arg3,
- :arg_s_workprice.arg_s_mx[i].arg4,
- :arg_s_workprice.arg_s_mx[i].arg5,
- :arg_s_workprice.arg_s_mx[i].arg6,
- :arg_s_workprice.arg_s_mx[i].arg7,
- :arg_s_workprice.arg_s_mx[i].arg8,
- :arg_s_workprice.arg_s_mx[i].arg9,
- :arg_s_workprice.arg_s_mx[i].workhour_minute,
- :arg_s_workprice.arg_s_mx[i].beforehour_minute,
- :arg_s_workprice.arg_s_mx[i].afterhour_minute,
- :arg_s_workprice.arg_s_mx[i].eqworkhour_minute,
- :arg_s_workprice.arg_s_mx[i].pricestr,
- :arg_s_workprice.arg_s_mx[i].workqtystr,
- :arg_s_workprice.arg_s_mx[i].wpcode,
- :arg_s_workprice.arg_s_mx[i].u_workqty,
- :arg_s_workprice.arg_s_mx[i].u_workprice,
- :arg_s_workprice.arg_s_mx[i].u_workqtystr,
- :arg_s_workprice.arg_s_mx[i].u_pricestr,
- :arg_s_workprice.arg_s_mx[i].proname_ori,
- :arg_s_workprice.arg_s_mx[i].ifgroup,
- :arg_s_workprice.arg_s_mx[i].replacestr,
- :arg_s_workprice.arg_s_mx[i].worktype,
- :arg_s_workprice.arg_s_mx[i].rpcode,
- :arg_s_workprice.arg_s_mx[i].ifdftpg,
- :arg_s_workprice.arg_s_mx[i].ifdftjj);
- If sqlca.SQLCode <> 0 Then
- uo_billid = arg_s_workprice.billid
- rslt = 0
- arg_msg = "因网络或其它原因导致插入明细操作失败"+"~n"+sqlca.SQLErrText
- Goto ext
- End If
- Next
- For ll_i = 1 To it_mxbt
-
- If arg_s_workprice.arg_s_mx[ll_i].editflag = 0 Then //变更
- If arg_s_workprice.arg_s_mx[ll_i].workqty > 0 Then
- Update u_sc_workprice
- Set ifchangebill = 1
- Where mtrlid = :arg_s_workprice.arg_s_mx[ll_i].mtrlid
- And procode = :arg_s_workprice.arg_s_mx[ll_i].procode
- And wpcode = :arg_s_workprice.arg_s_mx[ll_i].wpcode;
- If sqlca.SQLCode <> 0 Or sqlca.SQLNRows = 0 Then
- rslt = 0
- ARG_MSG = '更新工价表是否有相关变更单字段失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
- Goto ext
- End If
- End If
- End If
-
- Next
- ext:
- If rslt = 0 Then
- Rollback;
- ElseIf arg_ifcommit And rslt = 1 Then
- Commit;
- End If
- Return rslt
- end function
- public function integer uof_mod_rsltflag (long arg_billid, long arg_printid, integer arg_rsltflag, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
- Int li_flag,li_priceflag
- IF arg_billid <= 0 THEN
- rslt = 0
- ARG_MSG = '错误单据唯一码'
- GOTO ext
- END IF
- IF p_getflag(arg_billid,li_flag,li_priceflag,ARG_MSG) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- IF li_flag <> 0 THEN
- rslt = 0
- ARG_MSG = '单据不是在待审核状态,不可以修改结果'
- GOTO ext
- END IF
- UPDATE u_workprice_changemx
- SET rsltflag = :arg_rsltflag
- WHERE billid = :arg_billid
- and printid = :arg_printid ;
- IF sqlca.SQLCode <> 0 Or sqlca.SQLNRows <= 0 THEN
- rslt = 0
- arg_msg = "更新工价表变更单明细结果操作失败"+"~n"+sqlca.SQLErrText
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer priceaudit (long arg_billid, string arg_opemp, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
- Int li_flag, li_priceflag
- Long ll_scid
- String ls_billcode, ls_relcode, ls_dscrp
- DateTime null_dt
- SetNull(null_dt)
- If arg_billid <= 0 Then
- rslt = 0
- ARG_MSG = '错误单据唯一码'
- Goto ext
- End If
- If p_getflag(arg_billid,li_flag,li_priceflag,ARG_MSG) = 0 Then
- rslt = 0
- Goto ext
- End If
- If li_priceflag <> 0 Then
- rslt = 0
- ARG_MSG = '单据不是在待确认状态,不可以确认'
- Goto ext
- End If
- Select scid, billcode, relcode, dscrp
- Into :ll_scid, :ls_billcode, :ls_relcode, :ls_dscrp
- From u_workprice_change
- Where billid = :arg_billid;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- ARG_MSG = '查询单据信息失败,'+sqlca.SQLErrText
- Goto ext
- End If
- //更新确认标记
- Update u_workprice_change
- Set priceemp = :arg_opemp,
- pricedate = getdate(),
- priceflag = 1
- Where billid = :arg_billid
- And priceflag = 0;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- ARG_MSG = "单据确认操作失败"+"~n"+sqlca.SQLErrText
- Goto ext
- ElseIf sqlca.SQLNRows = 0 Then
- rslt = 0
- ARG_MSG = "单据正在确认,请稍后查询。"+"~n"+sqlca.SQLErrText
- Goto ext
- End If
- If sys_option_if_oa_workprice_change = 1 And sys_option_workprice_change_secaudit = 1 And audit_buildtype = 0 Then
- If f_oa(sqlca,False,ARG_MSG,1494,ll_scid,arg_billid,ls_billcode,ls_relcode,ls_dscrp) = 0 Then
- rslt = 0
- Goto ext
- End If
- End If
- s_workprice_changemx s_workprice_mx[]
- Long ll_arr_cnt,ll_i
- If getinfo(arg_billid,s_workprice_mx,ll_arr_cnt,ARG_MSG) = 0 Then
- rslt = 0
- Goto ext
- End If
- For ll_i = 1 To ll_arr_cnt
-
- If s_workprice_mx[ll_i].editflag = 0 Then //变更
- If s_workprice_mx[ll_i].workqty > 0 Then
- Update u_sc_workprice
- Set changeflag_ori = changeflag,
- changeflag = 1,
- oppflag = 0
- Where mtrlid = :s_workprice_mx[ll_i].mtrlid
- And procode = :s_workprice_mx[ll_i].procode
- And wpcode = :s_workprice_mx[ll_i].wpcode;
- If sqlca.SQLCode <> 0 Or sqlca.SQLNRows = 0 Then
- rslt = 0
- ARG_MSG = '更新工价表失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
- Goto ext
- End If
- End If
- 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_priceaudit (long arg_billid, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
- Int li_flag, li_priceflag
- Long ll_scid
- If arg_billid <= 0 Then
- rslt = 0
- ARG_MSG = '错误单据唯一码'
- Goto ext
- End If
- If p_getflag(arg_billid,li_flag,li_priceflag,ARG_MSG) = 0 Then
- rslt = 0
- Goto ext
- End If
- If li_priceflag <> 1 Then
- rslt = 0
- ARG_MSG = '单据不是在已确认状态,不可以反确认'
- Goto ext
- End If
- If li_flag <> 0 Then
- rslt = 0
- ARG_MSG = '单据不是在待审核状态,不可以反确认'
- Goto ext
- End If
- Select scid
- Into :ll_scid
- From u_workprice_change
- Where billid = :arg_billid;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- ARG_MSG = '查询单据信息失败,'+sqlca.SQLErrText
- Goto ext
- End If
- If sys_option_if_oa_workprice_change = 1 And sys_option_workprice_change_secaudit = 1 And audit_buildtype = 0 Then
- If f_check_if_oaflow_caudit(ll_scid,arg_billid,1494,ARG_MSG ) = 0 Then
- rslt = 0
- Goto ext
- End If
- End If
- s_workprice_changemx s_workprice_mx[]
- Long ll_arr_cnt,ll_i
- If getinfo(arg_billid,s_workprice_mx,ll_arr_cnt,ARG_MSG) = 0 Then
- rslt = 0
- Goto ext
- End If
- For ll_i = 1 To ll_arr_cnt
-
- If s_workprice_mx[ll_i].editflag = 0 Then //变更
-
- If audit_buildtype = 0 Then
- If s_workprice_mx[ll_i].workqty > 0 Then
- Update u_sc_workprice
- Set changeflag = changeflag_ori
- Where mtrlid = :s_workprice_mx[ll_i].mtrlid
- And procode = :s_workprice_mx[ll_i].procode
- And wpcode = :s_workprice_mx[ll_i].wpcode;
- If sqlca.SQLCode <> 0 Or sqlca.SQLNRows = 0 Then
- rslt = 0
- ARG_MSG = '更新工价表失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
- Goto ext
- End If
- End If
-
- Else
- Update u_sc_workprice
- Set changeflag = changeflag_ori,
- oppflag = 1,
- opprep = :publ_operator,
- oppdate = getdate(),
- oppreason = :oppreason
- Where mtrlid = :s_workprice_mx[ll_i].mtrlid
- And procode = :s_workprice_mx[ll_i].procode
- And wpcode = :s_workprice_mx[ll_i].wpcode;
- If sqlca.SQLCode <> 0 Or sqlca.SQLNRows = 0 Then
- rslt = 0
- ARG_MSG = '更新工价表失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
- Goto ext
- End If
- End If
-
- End If
-
- Next
- //更新确认标记
- Update u_workprice_change
- Set priceemp = '',
- pricedate = Null,
- priceflag = 0
- Where billid = :arg_billid
- And priceflag = 1
- And flag = 0;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- ARG_MSG = "单据反确认操作失败"+"~n"+sqlca.SQLErrText
- Goto ext
- ElseIf sqlca.SQLNRows = 0 Then
- rslt = 0
- ARG_MSG = "单据正在审核,请稍后查询。"+"~n"+sqlca.SQLErrText
- Goto ext
- End If
- If sys_option_if_oa_workprice_change = 1 And sys_option_workprice_change_secaudit = 1 And audit_buildtype = 0 Then
- Update oa_doc
- Set docflag = 12
- Where powerid = 1494
- And scid = :ll_scid
- And billid = :arg_billid;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- ARG_MSG = '更新相关公文状态失败'+sqlca.SQLErrText
- Goto ext
- End If
- 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 p_getflag (long arg_billid, ref integer arg_flag, ref integer arg_priceflag, ref string arg_msg);Int rslt = 1
- SELECT flag,priceflag
- INTO :arg_flag,:arg_priceflag
- FROM u_workprice_change
- WHERE billid = :arg_billid;
- IF sqlca.SQLCode <> 0 THEN
- ARG_MSG = '查询单据审核标记失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- ext:
- RETURN rslt
- end function
- on uo_workprice_change.create
- call super::create
- TriggerEvent( this, "constructor" )
- end on
- on uo_workprice_change.destroy
- TriggerEvent( this, "destructor" )
- call super::destroy
- end on
|