123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984 |
- $PBExportHeader$uo_empinfo.sru
- forward
- global type uo_empinfo from nonvisualobject
- end type
- type s_outwaremx from structure within uo_empinfo
- end type
- end forward
- type s_outwaremx from structure
- long mtrlwareid
- long mtrlid
- long storageid
- decimal { 5 } qty
- decimal { 10 } price
- decimal { 10 } cost
- string plancode
- decimal { 10 } planprice
- string mtrlcode
- long printid
- decimal { 10 } dsaleprice
- end type
- global type uo_empinfo from nonvisualobject
- end type
- global uo_empinfo uo_empinfo
- type variables
- protectedwrite long empID //人员ID
- int status //人员状态,0离职,1在职
- long deptid //部门ID
- long wrkgrpid //工组ID
- string wrktpye
- string empname
- string empcode
- string sex
- decimal Stature
- datetime birthday
- string homeplace
- string idcard
- datetime joindate
- string duty
- string Language
- string introducer
- string diploma
- string hometel
- string handtel
- string officetel
- string bedcode
- string cardcode
- string address
- string postcode
- string bankcode
- decimal wage
- string dscrp
- datetime opdate
- datetime opemp
- S_noticemx noticemx[] //明细结构数组
- long it_MXBT=0 //明细结构数组末指针
- BOOLEAN IT_NEWBEGIN=TRUE //新建标志
- BOOLEAN IT_UPDATEBEGIN=FALSE//修改标志
- end variables
- forward prototypes
- public function integer p_save (ref string arg_msg)
- public function integer p_clearmx ()
- public function integer p_reset ()
- public function integer cancel (long arg_noticeid, ref string arg_msg)
- public function integer newbegin (ref string arg_msg)
- public function integer acceptmx (long arg_mtrlid, decimal arg_preqty, decimal arg_qty, string arg_qinggan, string arg_dihe, string arg_fushou, string arg_ziao, string arg_lun, string arg_fctao, string arg_xian, string arg_x_mode, string arg_dscrp, integer arg_ordercode, ref string arg_msg)
- public function integer updatebegin (long arg_empid, ref string arg_msg)
- public function integer f_empdimission (long arg_empid, string arg_empcode, datetime arg_movedate, string arg_filecode, string arg_dept, string arg_duty, string arg_cause, string arg_opemp, ref string arg_msg, boolean arg_ifcommit)
- public function integer del_leftemp (long arg_empid, ref string arg_msg, boolean arg_ifcommit)
- public function integer f_empmove (long arg_empid, datetime arg_movedate, string arg_filecode, string arg_sdept, long arg_ddept, string arg_sjob, string arg_djob, decimal arg_wage, string arg_cause, string arg_opemp, ref string arg_msg, boolean arg_ifcommit)
- public function integer uof_del_leftemp (long arg_empid, ref string arg_msg, boolean arg_ifcommit)
- end prototypes
- public function integer p_save (ref string arg_msg);//submit(string arg_msg)
- // 新建(empid=0)\更新(empid>0)
- //0 fail 1 success
- //
- Integer rslt=1,cnt=0,i
- decimal LS_KTSL
- long LS_NEWoutWAREID
- datetime server_datetime
- long ls_newid
- string errmsg=''
- if empid<=0 then
- rslt=0
- goto ext
- end if
- if isnull(wrktpye ) then wrktpye =''
- IF ISNULL(Stature) THEN Stature=0
- if isnull(Homeplace) then Homeplace=''
- if isnull(introducer) then introducer=''
- if isnull(diploma) then diploma=''
- if isnull(Language) then Language=''
- if isnull(hometel) then hometel=''
- if isnull(officetel) then officetel=''
- if isnull(Bedcode) then Bedcode=''
- if isnull(Cardcode) then Cardcode=''
- if isnull(handtel) then handtel=''
- if isnull(Address) then Address=''
- if isnull(Postcode) then Postcode=''
- if isnull(Bankcode) then Bankcode=''
- if isnull(wage) then wage=0
- if isnull(Duty) then Duty=''
- if isnull(dscrp) then dscrp=''
- IF it_newbegin=FALSE AND it_updatebegin=FALSE THEN
- rslt=0
- arG_MSG="非编辑状态不可以提交"
- goto ext
- END IF
- if isnull(Empname) or Empname='' then
- rslt=0
- arg_msg="姓名不能为空!"
- end if
- if isnull(Empcode) or Empcode='' then
- rslt=0
- arg_msg="人员编号不能为空!"
- end if
- select count(*) into :cnt from u_rs_empinfo where Empcode =:Empcode;
- if sqlca.sqlcode<>0 then
- rslt=0
- arg_msg='查询人员编号失败!'
- end if
- if cnt>0 then
- rslt=0
- arg_msg='人员编号重复,请重新输入另一个编号。'
- end if
- if isnull(Sex) or sex='' then
- rslt=0
- arg_msg='性别不能为空,请选择。'
- end if
- if isnull(Birthday) then
- rslt=0
- arg_msg='出生日期不能为空,请输入。'
- end if
- if Joindate<=Birthday then
- rslt=0
- arg_msg='出生日期不能大于入职日期,出错!'
- end if
- cnt=0
- SELECT count(*) INTO :cnt
- FROM u_user
- WHERE username=:opemp ;
- if sqlca.sqlcode<>0 then
- rslt=0
- arG_MSG="查询操作失败,操作员"
- goto ext
- end if
- if cnt=0 then
- rslt=0
- arG_MSG="操作员姓名未登记或已取消"
- goto ext
- end if
- cnt=0
- select count(*) into :cnt from u_rs_empinfo where empid=:empid;
- if sqlca.sqlcode<>0 then
- rslt=0
- arG_MSG="查询人员资料操作失败!"
- goto ext
- end if
- if cnt=0 then
- rslt=0
- arG_MSG="不存在该人员资料!"
- goto ext
- end if
- server_datetime=f_getserdate()
- opdate=server_datetime //(最近修改时间)
- ////////////////////////////////////////////////开始区分:新建/更新 处理
- IF empid=0 THEN //新建
- /////////////////////////////////////
- ls_newid=f_sys_scidentity(0,"u_rs_empinfo","empid",errmsg,false,sqlca)
- if ls_newid<0 then
- arG_MSG=errmsg
- rslt=0
- rollback;
- goto ext
- end if
- Status=1 //人员状态为在职
- /////////////////////////////////////
- INSERT INTO u_rs_empinfo (
- empid,
- Deptid,
- wrkgrpID,
- wrktpye,
- Empname,
- Empcode,
- Sex,
- Birthday,
- Homeplace,
- Stature,
- introducer,
- Language,
- Idcard,
- Joindate,
- diploma,
- hometel,
- officetel,
- Bedcode,
- Cardcode,
- handtel,
- Address,
- Postcode,
- Bankcode,
- wage,
- Duty,
- status,
- Dscrp,
- Opdate,
- Opemp)
- VALUES ( :empid,
- :Deptid,
- :wrkgrpID,
- :wrktpye,
- :Empname,
- :Empcode,
- :Sex,
- :Birthday,
- :Homeplace,
- :Stature,
- :introducer,
- :Language,
- :Idcard,
- :Joindate,
- :diploma,
- :hometel,
- :officetel,
- :Bedcode,
- :Cardcode,
- :handtel,
- :Address,
- :Postcode,
- :Bankcode,
- :wage,
- :Duty,
- :status,
- :Dscrp,
- :Opdate,
- :Opemp);
- if SQLCA.SQLCode<>0 then
- rslt=0
- arG_MSG="因网络或其它原因导致插入操作失败"+"~n"+SQLCA.SQLErrText
- ROLLBACK ;
- goto ext
- end if
- //读取新outWAREID
- //select outWAREid INTO :LS_NEWoutWAREID
- // from u_outWARE
- // where outWAREcode=:outWAREcode ;
- //if sqlca.sqlcode<>0 then
- // rslt=0
- // arG_MSG="查询操作失败,进仓唯一码"
- // ROLLBACK;
- // goto ext
- //end if
- //outWAREID=LS_NEWoutWAREID
- empid=ls_newid
- ELSE //////////////////////////////////////////////////更新
- UPDATE u_rs_empinfo
- SET Deptid=:Deptid,
- wrkgrpID=:wrkgrpID,
- wrktpye=:wrktpye,
- Empname=:Empname,
- Empcode=:Empcode,
- Sex=:Sex,
- Birthday=:Birthday,
- Homeplace=:Homeplace,
- Stature=:Stature,
- introducer=:introducer,
- Language=:Language,
- Idcard=:Idcard,
- Joindate=:Joindate,
- diploma=:diploma,
- hometel=:hometel,
- officetel=:officetel,
- Bedcode=:Bedcode,
- Cardcode=:Cardcode,
- handtel=:handtel,
- Address=:Address,
- Postcode=:Postcode,
- Bankcode=:Bankcode,
- wage=:wage,
- Duty=:Duty,
- status=:status,
- Dscrp=:Dscrp,
- Opdate=:Opdate,
- Opemp=:Opemp
- WHERE u_rs_empinfo.empid = :empid;
- if SQLCA.SQLCode<>0 then
- rslt=0
- arG_MSG="因网络或其它原因导致更新人员资料操作失败"+"~n"+SQLCA.SQLErrText
- ROLLBACK ;
- goto ext
- end if
- end if
- it_newbegin=FALSE
- it_updatebegin=FALSE
- ext:
- if rslt=0 then
- empid=0
- p_clearmx()
- end if
- return(rslt)
- end function
- public function integer p_clearmx ();//INT p_clearmx()
- //清除明细
- it_mxbt=0
- RETURN 1
- end function
- public function integer p_reset ();//INT p_RESET()
- //清除对象及其明细
- empid=0
- //flag=0
- it_newbegin=FALSE
- it_updatebegin=FALSE
- //清除明细
- P_CLEARMX()
- RETURN 1
- end function
- public function integer cancel (long arg_noticeid, ref string arg_msg);//cancel()
- //如果单据还没有审核删除单据极其明细
- //0 FAIL, 1 SUCCESS
- INT rslt=1
- //IF arg_noticeid<=0 THEN
- // rslt=0
- // arG_MSG="没有删除对象,操作取消"
- // goto ext
- //END IF
- ////IF it_newbegin THEN
- //// rslt=0
- //// arG_MSG="新建状态下不可以执行,操作取消"
- //// goto ext
- ////END IF
- //
- // SELECT u_sc_notice.auditflag ,u_sc_notice.Status
- // INTO :flag ,:Status
- // FROM u_sc_notice
- // WHERE u_sc_notice.noticeid = :arg_noticeid;
- //if sqlca.sqlcode<>0 then
- // rslt=0
- // noticeid=0
- // arG_MSG='查询生产通知单操作失败'
- // goto ext
- //end if
- //
- //IF flag=1 THEN
- // rslt=0
- // arG_MSG="单据已经审核,不可以删除"
- // goto ext
- //END IF
- //
- //if Status=1 then
- // rslt=0
- // arG_MSG="生产通知单已经完成,不可以删除"
- // goto ext
- //END IF
- //
- //DELETE FROM u_sc_notice
- // WHERE u_sc_notice.noticeid = :arg_noticeid;
- //if sqlca.sqlcode<>0 then
- // ROLLBACK;
- // rslt=0
- // arG_MSG="删除生产通知单操作失败"+"~n"+SQLCA.SQLErrText
- // goto ext
- //end if
- //
- //DELETE FROM u_sc_noticemx
- // WHERE u_sc_noticemx.noticeid = :arg_noticeid;
- //if sqlca.sqlcode<>0 then
- // ROLLBACK;
- // rslt=0
- // arG_MSG="删除生产通知单明细操作失败"+"~n"+SQLCA.SQLErrText
- // goto ext
- //end if
- //
- //COMMIT;
- //it_newbegin=FALSE
- //it_updatebegin=FALSE
- //
- //IF rslt=0 THEN p_reset()
- //
- //EXT:
- return (rslt)
- end function
- public function integer newbegin (ref string arg_msg);p_reset()
- it_newbegin=TRUE
- it_updatebegin=FALSE
- return 1
- end function
- public function integer acceptmx (long arg_mtrlid, decimal arg_preqty, decimal arg_qty, string arg_qinggan, string arg_dihe, string arg_fushou, string arg_ziao, string arg_lun, string arg_fctao, string arg_xian, string arg_x_mode, string arg_dscrp, integer arg_ordercode, ref string arg_msg);//acceptmx(long arg_mtrlwareid,decimal arg_qty,decimal arg_price,string arg_msg)
- //i_plancode :生产批次(计划编号)生效于仓库记录,进仓明细中不记录
- //RETURN 0 fail 1 success
- // 函数增加出仓单的一个出仓明细项
- long rslt=1,cnt=0,LS_i
- long i_mtrlid,i_storageid
- STRING i_plancode,i_mtrlcode=''
- decimal i_cost,i_planprice,i_dsaleprice
- IF it_newbegin=FALSE AND it_updatebegin=FALSE THEN
- rslt=0
- arG_MSG="非编辑状态不可以使用,操作取消"
- goto ext
- END IF
- //清除空值
- IF ISNULL(arg_Mtrlid) THEN arg_Mtrlid=0
- IF ISNULL(arg_Preqty) THEN arg_Preqty=0
- IF ISNULL(arg_qty) THEN arg_qty=0
- IF ISNULL(arg_qinggan) THEN arg_qinggan=''
- IF ISNULL(arg_dihe) THEN arg_dihe=''
- IF ISNULL(arg_fushou) THEN arg_fushou=''
- IF ISNULL(arg_ziao) THEN arg_ziao=''
- IF ISNULL(arg_lun) THEN arg_lun=''
- IF ISNULL(arg_fctao) THEN arg_fctao=''
- IF ISNULL(arg_xian) THEN arg_xian=''
- IF ISNULL(arg_x_mode) THEN arg_x_mode=''
- IF ISNULL(arg_dscrp) THEN arg_dscrp=''
- if arg_Mtrlid=0 or arg_qty=0 then// 如果生产数量为 0,或物料编号为空,则不作任何处理
- rslt=1
- goto ext
- end if
- if arg_qty<0 or arg_Preqty<0 then //检查生产数量
- rslt=0
- arg_msg="生产数量错误"
- goto ext
- end if
- ////检查物料库存ID
- // SELECT u_sc_Mtrldef.mtrlid,
- //
- // INTO :i_mtrlid,:i_storageid,:i_plancode,:i_cost,:i_planprice,:i_mtrlcode,:i_dsaleprice
- // FROM u_mtrlware,u_mtrldef
- // WHERE ( u_mtrlware.mtrlwareid = :arg_mtrlwareid ) and
- // ( u_mtrlware.mtrlid=u_mtrldef.mtrlid );
- //
- //if sqlca.sqlcode<>0 then
- // rslt=0
- // arG_MSG="查询操作失败,库存编号错误"
- // goto ext
- //end if
- //
- //IF ISNULL(i_cost) THEN i_cost=0
- //IF ISNULL(i_plancode) THEN i_plancode=''
- //IF ISNULL(i_mtrlid) THEN i_mtrlid=0
- //IF ISNULL(i_storageid) THEN i_storageid=0
- //IF ISNULL(i_planprice) THEN i_planprice=0
- //IF ISNULL(i_dsaleprice) THEN i_dsaleprice=0
- //
- //for LS_i=1 to it_mxbt //合并重复项
- // if outwaremx[LS_i].mtrlwareid=arg_mtrlwareid then
- // outwaremx[LS_i].Qty=outwaremx[LS_i].Qty+arg_qty
- // rslt=1
- // goto ext
- // end if
- //next
- //写入内容
- it_mxbt++
- noticemx[it_mxbt].Mtrlid=arg_Mtrlid
- noticemx[it_mxbt].Preqty=arg_Preqty
- noticemx[it_mxbt].Qty=arg_qty
- noticemx[it_mxbt].Qinggan=arg_Qinggan
- noticemx[it_mxbt].Dihe=arg_Dihe
- noticemx[it_mxbt].fushou=arg_fushou
- noticemx[it_mxbt].Ziao=arg_Ziao
- noticemx[it_mxbt].Lun=arg_Lun
- noticemx[it_mxbt].Fctao=arg_Fctao
- noticemx[it_mxbt].Xian=arg_Xian
- noticemx[it_mxbt].X_mode=arg_X_mode
- noticemx[it_mxbt].dscrp=arg_dscrp
- noticemx[it_mxbt].ordercode=arg_ordercode
- ext:
- IF rslt=0 THEN p_clearmx()
- return(rslt)
- end function
- public function integer updatebegin (long arg_empid, ref string arg_msg);////UPDATEbegin(long arg_outwareid,INT arg_billtype,long arg_relid)
- ////从置对象,设定业务类型与关联ID,准备更新出仓单
- ////0 fail 1 success
- int rslt=1,CNT=0
- IF arg_empid<=0 THEN
- rslt=0
- empid=0
- goto ext
- end if
- SELECT u_rs_empinfo.empid,u_rs_empinfo.status
- into :empid,
- :status
- FROM u_rs_empinfo where u_rs_empinfo.empid=:arg_empid;
- if sqlca.sqlcode<>0 then
- rslt=0
- ARG_MSG='查询人员资料操作失败!'
- goto ext
- end if
- if status=0 then
- rslt=0
- ARG_MSG='该人员的已离职,不可以修改'
- goto ext
- end if
- empid=arg_empid
- p_CLEARMX()
- it_newbegin=FALSE
- it_updatebegin=TRUE
- ext:
- IF rslt=0 THEN p_RESET()
- return rslt
- end function
- public function integer f_empdimission (long arg_empid, string arg_empcode, datetime arg_movedate, string arg_filecode, string arg_dept, string arg_duty, string arg_cause, string arg_opemp, ref string arg_msg, boolean arg_ifcommit);//arg_empid,arg_movedate,arg_filecode,arg_dept,arg_duty,arg_cause,arg_opemp,arg_msg,arg_ifcommit
- Int rslt = 1
- Long ls_newid,ls_status
- String errmsg
- DateTime serdate
- SetNull(ls_status)
- SELECT status INTO :ls_status FROM u_rs_empinfo Where empid = :arg_empid;
- IF sqlca.SQLCode <> 0 AND sqlca.SQLCode <> 100 THEN
- arg_msg = '查询人员资料失败,原因:'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- IF ls_status = 0 THEN
- arg_msg = '该人员不在职,不能进行离职。'
- rslt = 0
- GOTO ext
- END IF
- ls_newid = f_sys_scidentity(0,"u_rs_moverecord","moveid",errmsg,FALSE,sqlca)
- IF ls_newid < 0 THEN
- arg_msg = errmsg
- rslt = 0
- GOTO ext
- END IF
- serdate = f_getserdate()
- INSERT INTO u_rs_moverecord
- (Moveid,
- empid,
- Movedate,
- Movetype,
- cause,
- Sdept,
- Ddept,
- Sjob,
- Djob,
- wage,
- Filecode,
- Opemp,
- Opdate)
- VALUES(:ls_newid,
- :arg_empid,
- :arg_Movedate,
- 2,
- :arg_cause,
- :arg_dept,
- '',
- :arg_duty,
- '',
- 0,
- :arg_filecode,
- :arg_opemp,
- :serdate);
-
- IF sqlca.SQLCode <> 0 THEN
- IF Pos(Lower(sqlca.SQLErrText),'PK_u_moverec') > 0 THEN
- arg_msg = '插入调动记录操作失败,关键字单据ID重复'
- ELSE
- arg_msg = "因网络或其它原因导致插入调动记录操作失败"+"~n"+sqlca.SQLErrText
- END IF
-
- rslt = 0
- GOTO ext
- END IF
-
- String ordercode
- Long cnt = 0
- SELECT count(*) INTO :cnt FROM u_rs_empinfo Where empcode Like 'LZ_'+:arg_empcode+'%' AND status = 0;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '查询人员编号失败。原因:'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- ordercode = String(cnt+1)
- UPDATE u_rs_empinfo Set empcode = 'LZ'+rtrim(empcode)+'-'+:ordercode,status = 0 Where empid = :arg_empid;
- IF sqlca.SQLCode <> 0 AND sqlca.SQLCode <> 100 THEN
- arg_msg = '更新人员资料失败,原因:'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- END IF
- IF rslt = 1 AND arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer del_leftemp (long arg_empid, ref string arg_msg, boolean arg_ifcommit);//删除离职人员
- Int rslt = 1
- Long ls_newid
- Int ls_status
- SELECT status INTO :ls_status
- FROM u_rs_empinfo Where empid = :arg_empid;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '查询人员资料失败,原因:'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- IF ls_status <> 0 THEN
- arg_msg = '该人员在职,不能进行删除。'
- rslt = 0
- GOTO ext
- END IF
- delete from u_gz_wage where empid = :arg_empid;
- if sqlca.sqlcode <> 0 then
- arg_msg = '删除人员相关工资表资料失败,'+sqlca.sqlerrtext
- rslt = 0
- goto ext
- end if
- delete from u_gz_wagemx where empid = :arg_empid;
- if sqlca.sqlcode <> 0 then
- arg_msg = '删除人员相关工资表明细资料失败,'+sqlca.sqlerrtext
- rslt = 0
- goto ext
- end if
- delete from u_rs_emprecord where empid = :arg_empid;
- if sqlca.sqlcode <> 0 then
- arg_msg = '删除人员相关简历资料失败,'+sqlca.sqlerrtext
- rslt = 0
- goto ext
- end if
- delete from u_rs_insure where empid = :arg_empid;
- if sqlca.sqlcode <> 0 then
- arg_msg = '删除人员相关社保资料失败,'+sqlca.sqlerrtext
- rslt = 0
- goto ext
- end if
- delete from u_rs_Train where empid = :arg_empid;
- if sqlca.sqlcode <> 0 then
- arg_msg = '删除人员相关培训资料失败,'+sqlca.sqlerrtext
- rslt = 0
- goto ext
- end if
- delete from u_rs_moverecord where empid = :arg_empid;
- if sqlca.sqlcode <> 0 then
- arg_msg = '删除人员相关调动资料失败,'+sqlca.sqlerrtext
- rslt = 0
- goto ext
- end if
- delete from u_rs_emppic where empid = :arg_empid;
- if sqlca.sqlcode <> 0 then
- arg_msg = '删除人员相关相片资料失败,'+sqlca.sqlerrtext
- rslt = 0
- goto ext
- end if
- delete from u_rs_empinfo where empid = :arg_empid;
- if sqlca.sqlcode <> 0 then
- arg_msg = '删除人员基本资料失败,'+sqlca.sqlerrtext
- rslt = 0
- goto ext
- end if
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- END IF
- IF rslt = 1 AND arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer f_empmove (long arg_empid, datetime arg_movedate, string arg_filecode, string arg_sdept, long arg_ddept, string arg_sjob, string arg_djob, decimal arg_wage, string arg_cause, string arg_opemp, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
- Long ls_newid,ls_status
- String errmsg
- DateTime serdate
- SetNull(ls_status)
- SELECT status INTO :ls_status FROM u_rs_empinfo Where empid = :arg_empid;
- IF sqlca.SQLCode <> 0 AND sqlca.SQLCode <> 100 THEN
- arg_msg = '查询人员资料失败,原因:'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- IF ls_status = 0 THEN
- arg_msg = '该人员不在职,不能进行调动。'
- rslt = 0
- GOTO ext
- END IF
- IF IsNull(arg_Sdept) OR arg_Sdept = '' THEN
- arg_msg = '不存在的原部门。'
- rslt = 0
- GOTO ext
- END IF
- IF IsNull(arg_Ddept) OR arg_Ddept = 0 THEN
- arg_msg = '不存在的接受部门。'
- rslt = 0
- GOTO ext
- END IF
- IF IsNull(arg_sjob) OR arg_sjob = '' THEN
- arg_msg = '调动前职位不能为空或不存在的职位。'
- rslt = 0
- GOTO ext
- END IF
- IF IsNull(arg_djob) OR arg_djob = '' THEN
- arg_msg = '调动后职位不能为空或不存在的职位。'
- rslt = 0
- GOTO ext
- END IF
- ls_newid = f_sys_scidentity(0,"u_rs_moverecord","moveid",errmsg,FALSE,sqlca)
- IF ls_newid <= 0 THEN
- arg_msg = errmsg
- rslt = 0
- GOTO ext
- END IF
- serdate = f_getserdate()
- Long ls_deptid
- string ls_ddept,ls_handtype
- SELECT departmentid,departmentname,handtype
- INTO :ls_deptid,:ls_ddept,:ls_handtype
- FROM cw_department
- Where departmentid = :arg_Ddept;
- If (sqlca.SQLCode <> 0 AND sqlca.SQLCode <> 100) Or (sqlca.SQLCode = 100) THEN
- arg_msg = '查询部门资料失败,原因:'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- INSERT INTO u_rs_moverecord
- (Moveid,
- empid,
- Movedate,
- Movetype,
- cause,
- Sdept,
- Ddept,
- Sjob,
- Djob,
- wage,
- Filecode,
- Opemp,
- Opdate)
- VALUES(:ls_newid,
- :arg_empid,
- :arg_Movedate,
- 1,
- :arg_cause,
- :arg_Sdept,
- :arg_Ddept,
- :arg_sjob,
- :arg_djob,
- :arg_wage,
- :arg_filecode,
- :arg_opemp,
- :serdate);
-
- IF sqlca.SQLCode <> 0 THEN
- IF Pos(Lower(sqlca.SQLErrText),'PK_u_moverec') > 0 THEN
- arg_msg = '插入调动记录操作失败,关键字单据ID重复'
- ELSE
- arg_msg = "因网络或其它原因导致插入调动记录操作失败"+"~n"+sqlca.SQLErrText
- END IF
-
- rslt = 0
- GOTO ext
- END IF
- UPDATE u_rs_empinfo
- Set Deptid = :ls_deptid,
- deptype = :ls_ddept,
- handtype = :ls_handtype,
- duty = :arg_djob,
- wage = :arg_wage
- Where empid = :arg_empid;
- IF sqlca.SQLCode <> 0 AND sqlca.SQLCode <> 100 THEN
- arg_msg = '更新人员资料失败,原因:'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- END IF
- IF rslt = 1 AND arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer uof_del_leftemp (long arg_empid, ref string arg_msg, boolean arg_ifcommit);//删除离职员工
- Int rslt = 1
- Long ls_newid
- Int ls_status
- SELECT status INTO :ls_status
- FROM u_rs_empinfo Where empid = :arg_empid;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '查询员工资料失败,原因:'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- IF ls_status <> 0 THEN
- arg_msg = '该员工在职,不能进行删除。'
- rslt = 0
- GOTO ext
- END IF
- delete from u_gz_wage where empid = :arg_empid;
- if sqlca.sqlcode <> 0 then
- arg_msg = '删除员工相关工资表资料失败,'+sqlca.sqlerrtext
- rslt = 0
- goto ext
- end if
- delete from u_gz_wagemx where empid = :arg_empid;
- if sqlca.sqlcode <> 0 then
- arg_msg = '删除员工相关工资表明细资料失败,'+sqlca.sqlerrtext
- rslt = 0
- goto ext
- end if
- delete from u_rs_emprecord where empid = :arg_empid;
- if sqlca.sqlcode <> 0 then
- arg_msg = '删除员工相关简历资料失败,'+sqlca.sqlerrtext
- rslt = 0
- goto ext
- end if
- delete from u_rs_insure where empid = :arg_empid;
- if sqlca.sqlcode <> 0 then
- arg_msg = '删除员工相关社保资料失败,'+sqlca.sqlerrtext
- rslt = 0
- goto ext
- end if
- delete from u_rs_Train where empid = :arg_empid;
- if sqlca.sqlcode <> 0 then
- arg_msg = '删除员工相关培训资料失败,'+sqlca.sqlerrtext
- rslt = 0
- goto ext
- end if
- delete from u_rs_moverecord where empid = :arg_empid;
- if sqlca.sqlcode <> 0 then
- arg_msg = '删除员工相关调动资料失败,'+sqlca.sqlerrtext
- rslt = 0
- goto ext
- end if
- delete from u_rs_emppic where empid = :arg_empid;
- if sqlca.sqlcode <> 0 then
- arg_msg = '删除员工相关相片资料失败,'+sqlca.sqlerrtext
- rslt = 0
- goto ext
- end if
- delete from u_rs_empinfo where empid = :arg_empid;
- if sqlca.sqlcode <> 0 then
- arg_msg = '删除员工基本资料失败,'+sqlca.sqlerrtext
- rslt = 0
- goto ext
- end if
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- END IF
- IF rslt = 1 AND arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- on uo_empinfo.create
- call super::create
- TriggerEvent( this, "constructor" )
- end on
- on uo_empinfo.destroy
- TriggerEvent( this, "destructor" )
- call super::destroy
- end on
|