uo_empinfo.sru 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984
  1. $PBExportHeader$uo_empinfo.sru
  2. forward
  3. global type uo_empinfo from nonvisualobject
  4. end type
  5. type s_outwaremx from structure within uo_empinfo
  6. end type
  7. end forward
  8. type s_outwaremx from structure
  9. long mtrlwareid
  10. long mtrlid
  11. long storageid
  12. decimal { 5 } qty
  13. decimal { 10 } price
  14. decimal { 10 } cost
  15. string plancode
  16. decimal { 10 } planprice
  17. string mtrlcode
  18. long printid
  19. decimal { 10 } dsaleprice
  20. end type
  21. global type uo_empinfo from nonvisualobject
  22. end type
  23. global uo_empinfo uo_empinfo
  24. type variables
  25. protectedwrite long empID //人员ID
  26. int status //人员状态,0离职,1在职
  27. long deptid //部门ID
  28. long wrkgrpid //工组ID
  29. string wrktpye
  30. string empname
  31. string empcode
  32. string sex
  33. decimal Stature
  34. datetime birthday
  35. string homeplace
  36. string idcard
  37. datetime joindate
  38. string duty
  39. string Language
  40. string introducer
  41. string diploma
  42. string hometel
  43. string handtel
  44. string officetel
  45. string bedcode
  46. string cardcode
  47. string address
  48. string postcode
  49. string bankcode
  50. decimal wage
  51. string dscrp
  52. datetime opdate
  53. datetime opemp
  54. S_noticemx noticemx[] //明细结构数组
  55. long it_MXBT=0 //明细结构数组末指针
  56. BOOLEAN IT_NEWBEGIN=TRUE //新建标志
  57. BOOLEAN IT_UPDATEBEGIN=FALSE//修改标志
  58. end variables
  59. forward prototypes
  60. public function integer p_save (ref string arg_msg)
  61. public function integer p_clearmx ()
  62. public function integer p_reset ()
  63. public function integer cancel (long arg_noticeid, ref string arg_msg)
  64. public function integer newbegin (ref string arg_msg)
  65. 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)
  66. public function integer updatebegin (long arg_empid, ref string arg_msg)
  67. 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)
  68. public function integer del_leftemp (long arg_empid, ref string arg_msg, boolean arg_ifcommit)
  69. 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)
  70. public function integer uof_del_leftemp (long arg_empid, ref string arg_msg, boolean arg_ifcommit)
  71. end prototypes
  72. public function integer p_save (ref string arg_msg);//submit(string arg_msg)
  73. // 新建(empid=0)\更新(empid>0)
  74. //0 fail 1 success
  75. //
  76. Integer rslt=1,cnt=0,i
  77. decimal LS_KTSL
  78. long LS_NEWoutWAREID
  79. datetime server_datetime
  80. long ls_newid
  81. string errmsg=''
  82. if empid<=0 then
  83. rslt=0
  84. goto ext
  85. end if
  86. if isnull(wrktpye ) then wrktpye =''
  87. IF ISNULL(Stature) THEN Stature=0
  88. if isnull(Homeplace) then Homeplace=''
  89. if isnull(introducer) then introducer=''
  90. if isnull(diploma) then diploma=''
  91. if isnull(Language) then Language=''
  92. if isnull(hometel) then hometel=''
  93. if isnull(officetel) then officetel=''
  94. if isnull(Bedcode) then Bedcode=''
  95. if isnull(Cardcode) then Cardcode=''
  96. if isnull(handtel) then handtel=''
  97. if isnull(Address) then Address=''
  98. if isnull(Postcode) then Postcode=''
  99. if isnull(Bankcode) then Bankcode=''
  100. if isnull(wage) then wage=0
  101. if isnull(Duty) then Duty=''
  102. if isnull(dscrp) then dscrp=''
  103. IF it_newbegin=FALSE AND it_updatebegin=FALSE THEN
  104. rslt=0
  105. arG_MSG="非编辑状态不可以提交"
  106. goto ext
  107. END IF
  108. if isnull(Empname) or Empname='' then
  109. rslt=0
  110. arg_msg="姓名不能为空!"
  111. end if
  112. if isnull(Empcode) or Empcode='' then
  113. rslt=0
  114. arg_msg="人员编号不能为空!"
  115. end if
  116. select count(*) into :cnt from u_rs_empinfo where Empcode =:Empcode;
  117. if sqlca.sqlcode<>0 then
  118. rslt=0
  119. arg_msg='查询人员编号失败!'
  120. end if
  121. if cnt>0 then
  122. rslt=0
  123. arg_msg='人员编号重复,请重新输入另一个编号。'
  124. end if
  125. if isnull(Sex) or sex='' then
  126. rslt=0
  127. arg_msg='性别不能为空,请选择。'
  128. end if
  129. if isnull(Birthday) then
  130. rslt=0
  131. arg_msg='出生日期不能为空,请输入。'
  132. end if
  133. if Joindate<=Birthday then
  134. rslt=0
  135. arg_msg='出生日期不能大于入职日期,出错!'
  136. end if
  137. cnt=0
  138. SELECT count(*) INTO :cnt
  139. FROM u_user
  140. WHERE username=:opemp ;
  141. if sqlca.sqlcode<>0 then
  142. rslt=0
  143. arG_MSG="查询操作失败,操作员"
  144. goto ext
  145. end if
  146. if cnt=0 then
  147. rslt=0
  148. arG_MSG="操作员姓名未登记或已取消"
  149. goto ext
  150. end if
  151. cnt=0
  152. select count(*) into :cnt from u_rs_empinfo where empid=:empid;
  153. if sqlca.sqlcode<>0 then
  154. rslt=0
  155. arG_MSG="查询人员资料操作失败!"
  156. goto ext
  157. end if
  158. if cnt=0 then
  159. rslt=0
  160. arG_MSG="不存在该人员资料!"
  161. goto ext
  162. end if
  163. server_datetime=f_getserdate()
  164. opdate=server_datetime //(最近修改时间)
  165. ////////////////////////////////////////////////开始区分:新建/更新 处理
  166. IF empid=0 THEN //新建
  167. /////////////////////////////////////
  168. ls_newid=f_sys_scidentity(0,"u_rs_empinfo","empid",errmsg,false,sqlca)
  169. if ls_newid<0 then
  170. arG_MSG=errmsg
  171. rslt=0
  172. rollback;
  173. goto ext
  174. end if
  175. Status=1 //人员状态为在职
  176. /////////////////////////////////////
  177. INSERT INTO u_rs_empinfo (
  178. empid,
  179. Deptid,
  180. wrkgrpID,
  181. wrktpye,
  182. Empname,
  183. Empcode,
  184. Sex,
  185. Birthday,
  186. Homeplace,
  187. Stature,
  188. introducer,
  189. Language,
  190. Idcard,
  191. Joindate,
  192. diploma,
  193. hometel,
  194. officetel,
  195. Bedcode,
  196. Cardcode,
  197. handtel,
  198. Address,
  199. Postcode,
  200. Bankcode,
  201. wage,
  202. Duty,
  203. status,
  204. Dscrp,
  205. Opdate,
  206. Opemp)
  207. VALUES ( :empid,
  208. :Deptid,
  209. :wrkgrpID,
  210. :wrktpye,
  211. :Empname,
  212. :Empcode,
  213. :Sex,
  214. :Birthday,
  215. :Homeplace,
  216. :Stature,
  217. :introducer,
  218. :Language,
  219. :Idcard,
  220. :Joindate,
  221. :diploma,
  222. :hometel,
  223. :officetel,
  224. :Bedcode,
  225. :Cardcode,
  226. :handtel,
  227. :Address,
  228. :Postcode,
  229. :Bankcode,
  230. :wage,
  231. :Duty,
  232. :status,
  233. :Dscrp,
  234. :Opdate,
  235. :Opemp);
  236. if SQLCA.SQLCode<>0 then
  237. rslt=0
  238. arG_MSG="因网络或其它原因导致插入操作失败"+"~n"+SQLCA.SQLErrText
  239. ROLLBACK ;
  240. goto ext
  241. end if
  242. //读取新outWAREID
  243. //select outWAREid INTO :LS_NEWoutWAREID
  244. // from u_outWARE
  245. // where outWAREcode=:outWAREcode ;
  246. //if sqlca.sqlcode<>0 then
  247. // rslt=0
  248. // arG_MSG="查询操作失败,进仓唯一码"
  249. // ROLLBACK;
  250. // goto ext
  251. //end if
  252. //outWAREID=LS_NEWoutWAREID
  253. empid=ls_newid
  254. ELSE //////////////////////////////////////////////////更新
  255. UPDATE u_rs_empinfo
  256. SET Deptid=:Deptid,
  257. wrkgrpID=:wrkgrpID,
  258. wrktpye=:wrktpye,
  259. Empname=:Empname,
  260. Empcode=:Empcode,
  261. Sex=:Sex,
  262. Birthday=:Birthday,
  263. Homeplace=:Homeplace,
  264. Stature=:Stature,
  265. introducer=:introducer,
  266. Language=:Language,
  267. Idcard=:Idcard,
  268. Joindate=:Joindate,
  269. diploma=:diploma,
  270. hometel=:hometel,
  271. officetel=:officetel,
  272. Bedcode=:Bedcode,
  273. Cardcode=:Cardcode,
  274. handtel=:handtel,
  275. Address=:Address,
  276. Postcode=:Postcode,
  277. Bankcode=:Bankcode,
  278. wage=:wage,
  279. Duty=:Duty,
  280. status=:status,
  281. Dscrp=:Dscrp,
  282. Opdate=:Opdate,
  283. Opemp=:Opemp
  284. WHERE u_rs_empinfo.empid = :empid;
  285. if SQLCA.SQLCode<>0 then
  286. rslt=0
  287. arG_MSG="因网络或其它原因导致更新人员资料操作失败"+"~n"+SQLCA.SQLErrText
  288. ROLLBACK ;
  289. goto ext
  290. end if
  291. end if
  292. it_newbegin=FALSE
  293. it_updatebegin=FALSE
  294. ext:
  295. if rslt=0 then
  296. empid=0
  297. p_clearmx()
  298. end if
  299. return(rslt)
  300. end function
  301. public function integer p_clearmx ();//INT p_clearmx()
  302. //清除明细
  303. it_mxbt=0
  304. RETURN 1
  305. end function
  306. public function integer p_reset ();//INT p_RESET()
  307. //清除对象及其明细
  308. empid=0
  309. //flag=0
  310. it_newbegin=FALSE
  311. it_updatebegin=FALSE
  312. //清除明细
  313. P_CLEARMX()
  314. RETURN 1
  315. end function
  316. public function integer cancel (long arg_noticeid, ref string arg_msg);//cancel()
  317. //如果单据还没有审核删除单据极其明细
  318. //0 FAIL, 1 SUCCESS
  319. INT rslt=1
  320. //IF arg_noticeid<=0 THEN
  321. // rslt=0
  322. // arG_MSG="没有删除对象,操作取消"
  323. // goto ext
  324. //END IF
  325. ////IF it_newbegin THEN
  326. //// rslt=0
  327. //// arG_MSG="新建状态下不可以执行,操作取消"
  328. //// goto ext
  329. ////END IF
  330. //
  331. // SELECT u_sc_notice.auditflag ,u_sc_notice.Status
  332. // INTO :flag ,:Status
  333. // FROM u_sc_notice
  334. // WHERE u_sc_notice.noticeid = :arg_noticeid;
  335. //if sqlca.sqlcode<>0 then
  336. // rslt=0
  337. // noticeid=0
  338. // arG_MSG='查询生产通知单操作失败'
  339. // goto ext
  340. //end if
  341. //
  342. //IF flag=1 THEN
  343. // rslt=0
  344. // arG_MSG="单据已经审核,不可以删除"
  345. // goto ext
  346. //END IF
  347. //
  348. //if Status=1 then
  349. // rslt=0
  350. // arG_MSG="生产通知单已经完成,不可以删除"
  351. // goto ext
  352. //END IF
  353. //
  354. //DELETE FROM u_sc_notice
  355. // WHERE u_sc_notice.noticeid = :arg_noticeid;
  356. //if sqlca.sqlcode<>0 then
  357. // ROLLBACK;
  358. // rslt=0
  359. // arG_MSG="删除生产通知单操作失败"+"~n"+SQLCA.SQLErrText
  360. // goto ext
  361. //end if
  362. //
  363. //DELETE FROM u_sc_noticemx
  364. // WHERE u_sc_noticemx.noticeid = :arg_noticeid;
  365. //if sqlca.sqlcode<>0 then
  366. // ROLLBACK;
  367. // rslt=0
  368. // arG_MSG="删除生产通知单明细操作失败"+"~n"+SQLCA.SQLErrText
  369. // goto ext
  370. //end if
  371. //
  372. //COMMIT;
  373. //it_newbegin=FALSE
  374. //it_updatebegin=FALSE
  375. //
  376. //IF rslt=0 THEN p_reset()
  377. //
  378. //EXT:
  379. return (rslt)
  380. end function
  381. public function integer newbegin (ref string arg_msg);p_reset()
  382. it_newbegin=TRUE
  383. it_updatebegin=FALSE
  384. return 1
  385. end function
  386. 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)
  387. //i_plancode :生产批次(计划编号)生效于仓库记录,进仓明细中不记录
  388. //RETURN 0 fail 1 success
  389. // 函数增加出仓单的一个出仓明细项
  390. long rslt=1,cnt=0,LS_i
  391. long i_mtrlid,i_storageid
  392. STRING i_plancode,i_mtrlcode=''
  393. decimal i_cost,i_planprice,i_dsaleprice
  394. IF it_newbegin=FALSE AND it_updatebegin=FALSE THEN
  395. rslt=0
  396. arG_MSG="非编辑状态不可以使用,操作取消"
  397. goto ext
  398. END IF
  399. //清除空值
  400. IF ISNULL(arg_Mtrlid) THEN arg_Mtrlid=0
  401. IF ISNULL(arg_Preqty) THEN arg_Preqty=0
  402. IF ISNULL(arg_qty) THEN arg_qty=0
  403. IF ISNULL(arg_qinggan) THEN arg_qinggan=''
  404. IF ISNULL(arg_dihe) THEN arg_dihe=''
  405. IF ISNULL(arg_fushou) THEN arg_fushou=''
  406. IF ISNULL(arg_ziao) THEN arg_ziao=''
  407. IF ISNULL(arg_lun) THEN arg_lun=''
  408. IF ISNULL(arg_fctao) THEN arg_fctao=''
  409. IF ISNULL(arg_xian) THEN arg_xian=''
  410. IF ISNULL(arg_x_mode) THEN arg_x_mode=''
  411. IF ISNULL(arg_dscrp) THEN arg_dscrp=''
  412. if arg_Mtrlid=0 or arg_qty=0 then// 如果生产数量为 0,或物料编号为空,则不作任何处理
  413. rslt=1
  414. goto ext
  415. end if
  416. if arg_qty<0 or arg_Preqty<0 then //检查生产数量
  417. rslt=0
  418. arg_msg="生产数量错误"
  419. goto ext
  420. end if
  421. ////检查物料库存ID
  422. // SELECT u_sc_Mtrldef.mtrlid,
  423. //
  424. // INTO :i_mtrlid,:i_storageid,:i_plancode,:i_cost,:i_planprice,:i_mtrlcode,:i_dsaleprice
  425. // FROM u_mtrlware,u_mtrldef
  426. // WHERE ( u_mtrlware.mtrlwareid = :arg_mtrlwareid ) and
  427. // ( u_mtrlware.mtrlid=u_mtrldef.mtrlid );
  428. //
  429. //if sqlca.sqlcode<>0 then
  430. // rslt=0
  431. // arG_MSG="查询操作失败,库存编号错误"
  432. // goto ext
  433. //end if
  434. //
  435. //IF ISNULL(i_cost) THEN i_cost=0
  436. //IF ISNULL(i_plancode) THEN i_plancode=''
  437. //IF ISNULL(i_mtrlid) THEN i_mtrlid=0
  438. //IF ISNULL(i_storageid) THEN i_storageid=0
  439. //IF ISNULL(i_planprice) THEN i_planprice=0
  440. //IF ISNULL(i_dsaleprice) THEN i_dsaleprice=0
  441. //
  442. //for LS_i=1 to it_mxbt //合并重复项
  443. // if outwaremx[LS_i].mtrlwareid=arg_mtrlwareid then
  444. // outwaremx[LS_i].Qty=outwaremx[LS_i].Qty+arg_qty
  445. // rslt=1
  446. // goto ext
  447. // end if
  448. //next
  449. //写入内容
  450. it_mxbt++
  451. noticemx[it_mxbt].Mtrlid=arg_Mtrlid
  452. noticemx[it_mxbt].Preqty=arg_Preqty
  453. noticemx[it_mxbt].Qty=arg_qty
  454. noticemx[it_mxbt].Qinggan=arg_Qinggan
  455. noticemx[it_mxbt].Dihe=arg_Dihe
  456. noticemx[it_mxbt].fushou=arg_fushou
  457. noticemx[it_mxbt].Ziao=arg_Ziao
  458. noticemx[it_mxbt].Lun=arg_Lun
  459. noticemx[it_mxbt].Fctao=arg_Fctao
  460. noticemx[it_mxbt].Xian=arg_Xian
  461. noticemx[it_mxbt].X_mode=arg_X_mode
  462. noticemx[it_mxbt].dscrp=arg_dscrp
  463. noticemx[it_mxbt].ordercode=arg_ordercode
  464. ext:
  465. IF rslt=0 THEN p_clearmx()
  466. return(rslt)
  467. end function
  468. public function integer updatebegin (long arg_empid, ref string arg_msg);////UPDATEbegin(long arg_outwareid,INT arg_billtype,long arg_relid)
  469. ////从置对象,设定业务类型与关联ID,准备更新出仓单
  470. ////0 fail 1 success
  471. int rslt=1,CNT=0
  472. IF arg_empid<=0 THEN
  473. rslt=0
  474. empid=0
  475. goto ext
  476. end if
  477. SELECT u_rs_empinfo.empid,u_rs_empinfo.status
  478. into :empid,
  479. :status
  480. FROM u_rs_empinfo where u_rs_empinfo.empid=:arg_empid;
  481. if sqlca.sqlcode<>0 then
  482. rslt=0
  483. ARG_MSG='查询人员资料操作失败!'
  484. goto ext
  485. end if
  486. if status=0 then
  487. rslt=0
  488. ARG_MSG='该人员的已离职,不可以修改'
  489. goto ext
  490. end if
  491. empid=arg_empid
  492. p_CLEARMX()
  493. it_newbegin=FALSE
  494. it_updatebegin=TRUE
  495. ext:
  496. IF rslt=0 THEN p_RESET()
  497. return rslt
  498. end function
  499. 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
  500. Int rslt = 1
  501. Long ls_newid,ls_status
  502. String errmsg
  503. DateTime serdate
  504. SetNull(ls_status)
  505. SELECT status INTO :ls_status FROM u_rs_empinfo Where empid = :arg_empid;
  506. IF sqlca.SQLCode <> 0 AND sqlca.SQLCode <> 100 THEN
  507. arg_msg = '查询人员资料失败,原因:'+sqlca.SQLErrText
  508. rslt = 0
  509. GOTO ext
  510. END IF
  511. IF ls_status = 0 THEN
  512. arg_msg = '该人员不在职,不能进行离职。'
  513. rslt = 0
  514. GOTO ext
  515. END IF
  516. ls_newid = f_sys_scidentity(0,"u_rs_moverecord","moveid",errmsg,FALSE,sqlca)
  517. IF ls_newid < 0 THEN
  518. arg_msg = errmsg
  519. rslt = 0
  520. GOTO ext
  521. END IF
  522. serdate = f_getserdate()
  523. INSERT INTO u_rs_moverecord
  524. (Moveid,
  525. empid,
  526. Movedate,
  527. Movetype,
  528. cause,
  529. Sdept,
  530. Ddept,
  531. Sjob,
  532. Djob,
  533. wage,
  534. Filecode,
  535. Opemp,
  536. Opdate)
  537. VALUES(:ls_newid,
  538. :arg_empid,
  539. :arg_Movedate,
  540. 2,
  541. :arg_cause,
  542. :arg_dept,
  543. '',
  544. :arg_duty,
  545. '',
  546. 0,
  547. :arg_filecode,
  548. :arg_opemp,
  549. :serdate);
  550. IF sqlca.SQLCode <> 0 THEN
  551. IF Pos(Lower(sqlca.SQLErrText),'PK_u_moverec') > 0 THEN
  552. arg_msg = '插入调动记录操作失败,关键字单据ID重复'
  553. ELSE
  554. arg_msg = "因网络或其它原因导致插入调动记录操作失败"+"~n"+sqlca.SQLErrText
  555. END IF
  556. rslt = 0
  557. GOTO ext
  558. END IF
  559. String ordercode
  560. Long cnt = 0
  561. SELECT count(*) INTO :cnt FROM u_rs_empinfo Where empcode Like 'LZ_'+:arg_empcode+'%' AND status = 0;
  562. IF sqlca.SQLCode <> 0 THEN
  563. arg_msg = '查询人员编号失败。原因:'+sqlca.SQLErrText
  564. rslt = 0
  565. GOTO ext
  566. END IF
  567. ordercode = String(cnt+1)
  568. UPDATE u_rs_empinfo Set empcode = 'LZ'+rtrim(empcode)+'-'+:ordercode,status = 0 Where empid = :arg_empid;
  569. IF sqlca.SQLCode <> 0 AND sqlca.SQLCode <> 100 THEN
  570. arg_msg = '更新人员资料失败,原因:'+sqlca.SQLErrText
  571. rslt = 0
  572. GOTO ext
  573. END IF
  574. ext:
  575. IF rslt = 0 THEN
  576. ROLLBACK;
  577. END IF
  578. IF rslt = 1 AND arg_ifcommit THEN
  579. COMMIT;
  580. END IF
  581. RETURN rslt
  582. end function
  583. public function integer del_leftemp (long arg_empid, ref string arg_msg, boolean arg_ifcommit);//删除离职人员
  584. Int rslt = 1
  585. Long ls_newid
  586. Int ls_status
  587. SELECT status INTO :ls_status
  588. FROM u_rs_empinfo Where empid = :arg_empid;
  589. IF sqlca.SQLCode <> 0 THEN
  590. arg_msg = '查询人员资料失败,原因:'+sqlca.SQLErrText
  591. rslt = 0
  592. GOTO ext
  593. END IF
  594. IF ls_status <> 0 THEN
  595. arg_msg = '该人员在职,不能进行删除。'
  596. rslt = 0
  597. GOTO ext
  598. END IF
  599. delete from u_gz_wage where empid = :arg_empid;
  600. if sqlca.sqlcode <> 0 then
  601. arg_msg = '删除人员相关工资表资料失败,'+sqlca.sqlerrtext
  602. rslt = 0
  603. goto ext
  604. end if
  605. delete from u_gz_wagemx where empid = :arg_empid;
  606. if sqlca.sqlcode <> 0 then
  607. arg_msg = '删除人员相关工资表明细资料失败,'+sqlca.sqlerrtext
  608. rslt = 0
  609. goto ext
  610. end if
  611. delete from u_rs_emprecord where empid = :arg_empid;
  612. if sqlca.sqlcode <> 0 then
  613. arg_msg = '删除人员相关简历资料失败,'+sqlca.sqlerrtext
  614. rslt = 0
  615. goto ext
  616. end if
  617. delete from u_rs_insure where empid = :arg_empid;
  618. if sqlca.sqlcode <> 0 then
  619. arg_msg = '删除人员相关社保资料失败,'+sqlca.sqlerrtext
  620. rslt = 0
  621. goto ext
  622. end if
  623. delete from u_rs_Train where empid = :arg_empid;
  624. if sqlca.sqlcode <> 0 then
  625. arg_msg = '删除人员相关培训资料失败,'+sqlca.sqlerrtext
  626. rslt = 0
  627. goto ext
  628. end if
  629. delete from u_rs_moverecord where empid = :arg_empid;
  630. if sqlca.sqlcode <> 0 then
  631. arg_msg = '删除人员相关调动资料失败,'+sqlca.sqlerrtext
  632. rslt = 0
  633. goto ext
  634. end if
  635. delete from u_rs_emppic where empid = :arg_empid;
  636. if sqlca.sqlcode <> 0 then
  637. arg_msg = '删除人员相关相片资料失败,'+sqlca.sqlerrtext
  638. rslt = 0
  639. goto ext
  640. end if
  641. delete from u_rs_empinfo where empid = :arg_empid;
  642. if sqlca.sqlcode <> 0 then
  643. arg_msg = '删除人员基本资料失败,'+sqlca.sqlerrtext
  644. rslt = 0
  645. goto ext
  646. end if
  647. ext:
  648. IF rslt = 0 THEN
  649. ROLLBACK;
  650. END IF
  651. IF rslt = 1 AND arg_ifcommit THEN
  652. COMMIT;
  653. END IF
  654. RETURN rslt
  655. end function
  656. 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
  657. Long ls_newid,ls_status
  658. String errmsg
  659. DateTime serdate
  660. SetNull(ls_status)
  661. SELECT status INTO :ls_status FROM u_rs_empinfo Where empid = :arg_empid;
  662. IF sqlca.SQLCode <> 0 AND sqlca.SQLCode <> 100 THEN
  663. arg_msg = '查询人员资料失败,原因:'+sqlca.SQLErrText
  664. rslt = 0
  665. GOTO ext
  666. END IF
  667. IF ls_status = 0 THEN
  668. arg_msg = '该人员不在职,不能进行调动。'
  669. rslt = 0
  670. GOTO ext
  671. END IF
  672. IF IsNull(arg_Sdept) OR arg_Sdept = '' THEN
  673. arg_msg = '不存在的原部门。'
  674. rslt = 0
  675. GOTO ext
  676. END IF
  677. IF IsNull(arg_Ddept) OR arg_Ddept = 0 THEN
  678. arg_msg = '不存在的接受部门。'
  679. rslt = 0
  680. GOTO ext
  681. END IF
  682. IF IsNull(arg_sjob) OR arg_sjob = '' THEN
  683. arg_msg = '调动前职位不能为空或不存在的职位。'
  684. rslt = 0
  685. GOTO ext
  686. END IF
  687. IF IsNull(arg_djob) OR arg_djob = '' THEN
  688. arg_msg = '调动后职位不能为空或不存在的职位。'
  689. rslt = 0
  690. GOTO ext
  691. END IF
  692. ls_newid = f_sys_scidentity(0,"u_rs_moverecord","moveid",errmsg,FALSE,sqlca)
  693. IF ls_newid <= 0 THEN
  694. arg_msg = errmsg
  695. rslt = 0
  696. GOTO ext
  697. END IF
  698. serdate = f_getserdate()
  699. Long ls_deptid
  700. string ls_ddept,ls_handtype
  701. SELECT departmentid,departmentname,handtype
  702. INTO :ls_deptid,:ls_ddept,:ls_handtype
  703. FROM cw_department
  704. Where departmentid = :arg_Ddept;
  705. If (sqlca.SQLCode <> 0 AND sqlca.SQLCode <> 100) Or (sqlca.SQLCode = 100) THEN
  706. arg_msg = '查询部门资料失败,原因:'+sqlca.SQLErrText
  707. rslt = 0
  708. GOTO ext
  709. END IF
  710. INSERT INTO u_rs_moverecord
  711. (Moveid,
  712. empid,
  713. Movedate,
  714. Movetype,
  715. cause,
  716. Sdept,
  717. Ddept,
  718. Sjob,
  719. Djob,
  720. wage,
  721. Filecode,
  722. Opemp,
  723. Opdate)
  724. VALUES(:ls_newid,
  725. :arg_empid,
  726. :arg_Movedate,
  727. 1,
  728. :arg_cause,
  729. :arg_Sdept,
  730. :arg_Ddept,
  731. :arg_sjob,
  732. :arg_djob,
  733. :arg_wage,
  734. :arg_filecode,
  735. :arg_opemp,
  736. :serdate);
  737. IF sqlca.SQLCode <> 0 THEN
  738. IF Pos(Lower(sqlca.SQLErrText),'PK_u_moverec') > 0 THEN
  739. arg_msg = '插入调动记录操作失败,关键字单据ID重复'
  740. ELSE
  741. arg_msg = "因网络或其它原因导致插入调动记录操作失败"+"~n"+sqlca.SQLErrText
  742. END IF
  743. rslt = 0
  744. GOTO ext
  745. END IF
  746. UPDATE u_rs_empinfo
  747. Set Deptid = :ls_deptid,
  748. deptype = :ls_ddept,
  749. handtype = :ls_handtype,
  750. duty = :arg_djob,
  751. wage = :arg_wage
  752. Where empid = :arg_empid;
  753. IF sqlca.SQLCode <> 0 AND sqlca.SQLCode <> 100 THEN
  754. arg_msg = '更新人员资料失败,原因:'+sqlca.SQLErrText
  755. rslt = 0
  756. GOTO ext
  757. END IF
  758. ext:
  759. IF rslt = 0 THEN
  760. ROLLBACK;
  761. END IF
  762. IF rslt = 1 AND arg_ifcommit THEN
  763. COMMIT;
  764. END IF
  765. RETURN rslt
  766. end function
  767. public function integer uof_del_leftemp (long arg_empid, ref string arg_msg, boolean arg_ifcommit);//删除离职员工
  768. Int rslt = 1
  769. Long ls_newid
  770. Int ls_status
  771. SELECT status INTO :ls_status
  772. FROM u_rs_empinfo Where empid = :arg_empid;
  773. IF sqlca.SQLCode <> 0 THEN
  774. arg_msg = '查询员工资料失败,原因:'+sqlca.SQLErrText
  775. rslt = 0
  776. GOTO ext
  777. END IF
  778. IF ls_status <> 0 THEN
  779. arg_msg = '该员工在职,不能进行删除。'
  780. rslt = 0
  781. GOTO ext
  782. END IF
  783. delete from u_gz_wage where empid = :arg_empid;
  784. if sqlca.sqlcode <> 0 then
  785. arg_msg = '删除员工相关工资表资料失败,'+sqlca.sqlerrtext
  786. rslt = 0
  787. goto ext
  788. end if
  789. delete from u_gz_wagemx where empid = :arg_empid;
  790. if sqlca.sqlcode <> 0 then
  791. arg_msg = '删除员工相关工资表明细资料失败,'+sqlca.sqlerrtext
  792. rslt = 0
  793. goto ext
  794. end if
  795. delete from u_rs_emprecord where empid = :arg_empid;
  796. if sqlca.sqlcode <> 0 then
  797. arg_msg = '删除员工相关简历资料失败,'+sqlca.sqlerrtext
  798. rslt = 0
  799. goto ext
  800. end if
  801. delete from u_rs_insure where empid = :arg_empid;
  802. if sqlca.sqlcode <> 0 then
  803. arg_msg = '删除员工相关社保资料失败,'+sqlca.sqlerrtext
  804. rslt = 0
  805. goto ext
  806. end if
  807. delete from u_rs_Train where empid = :arg_empid;
  808. if sqlca.sqlcode <> 0 then
  809. arg_msg = '删除员工相关培训资料失败,'+sqlca.sqlerrtext
  810. rslt = 0
  811. goto ext
  812. end if
  813. delete from u_rs_moverecord where empid = :arg_empid;
  814. if sqlca.sqlcode <> 0 then
  815. arg_msg = '删除员工相关调动资料失败,'+sqlca.sqlerrtext
  816. rslt = 0
  817. goto ext
  818. end if
  819. delete from u_rs_emppic where empid = :arg_empid;
  820. if sqlca.sqlcode <> 0 then
  821. arg_msg = '删除员工相关相片资料失败,'+sqlca.sqlerrtext
  822. rslt = 0
  823. goto ext
  824. end if
  825. delete from u_rs_empinfo where empid = :arg_empid;
  826. if sqlca.sqlcode <> 0 then
  827. arg_msg = '删除员工基本资料失败,'+sqlca.sqlerrtext
  828. rslt = 0
  829. goto ext
  830. end if
  831. ext:
  832. IF rslt = 0 THEN
  833. ROLLBACK;
  834. END IF
  835. IF rslt = 1 AND arg_ifcommit THEN
  836. COMMIT;
  837. END IF
  838. RETURN rslt
  839. end function
  840. on uo_empinfo.create
  841. call super::create
  842. TriggerEvent( this, "constructor" )
  843. end on
  844. on uo_empinfo.destroy
  845. TriggerEvent( this, "destructor" )
  846. call super::destroy
  847. end on