1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
| try Local ProcessRequest &RQST; Local Record &rec1; Local string &LANGE = %Language; rem 获取入参; Local string &strGpAction = LH_GP_DX_WRK.LH_GP_ACTION.Value; Local string &strCalRunId = LH_GP_DX_WRK.CAL_RUN_ID.Value; Local string &strOprid = LH_GP_DX_WRK.OPRID.Value; rem 校验必填项; If None(&strGpAction) Or None(&strCalRunId) Or None(&strOprid) Then throw CreateException(0, 0, ",errorMsg:必填项未填,请检查数据准确性!,") End-If; rem 判断入参有效性; Local string &Flag; SQLExec("SELECT 'Y' FROM PSOPRDEFN U where u.oprid = :1", &strOprid, &Flag); If None(&Flag) Then throw CreateException(0, 0, ",errorMsg:PS用户不存在,请检查数据!,") End-If;
Local string &strRunId; SQLExec("select L.RUNSTATUS from PS_LH_GP_PDPAE_LOG L WHERE L.CAL_RUN_ID = :1 AND L.RUNSTATUS = '7'", &strCalRunId, &strRunId); If &strRunId = "7" Then throw CreateException(0, 0, ",errorMsg:该日历组ID正在计算处理中,无法同时发起多次!,") End-If; rem 处理薪酬计算进程运行控制表; &rec1 = CreateRecord(Record.GP_RUNCTL); &rec1.RUN_CNTL_ID.Value = "INTF_" | &strCalRunId; &rec1.CAL_RUN_ID.Value = &strCalRunId; &rec1.OPRID.Value = &strOprid; rem 关账数据无法重算; Local string &strRunOpenTS, &strRunFinalizedTS; SQLExec("SELECT c.RUN_OPEN_TS,c.RUN_FINALIZED_TS FROM PS_GP_CAL_RUN C WHERE C.CAL_RUN_ID = :1", &strCalRunId, &strRunOpenTS, &strRunFinalizedTS); If None(&strRunFinalizedTS) Then rem 日历组ID未关帐情况下,日历组ID有效性校验; Local string &strExists; SQLExec("select 'X' from PS_GP_CAL_RUN_SRCH R WHERE R.OPRID = :1 AND R.CAL_RUN_ID = :2", &strOprid, &strCalRunId, &strExists); If None(&strExists) Then throw CreateException(0, 0, ",errorMsg:日历组ID不存在或用户无权限,请检查数据!,") End-If; If All(&strRunOpenTS) Then rem 非第一次,重新计算; If &strGpAction = "A" Then rem 【取消】; &rec1.RUN_CANCEL_IND.Value = "N"; rem 【标识收款人】 ; &rec1.RUN_IDNT_IND.Value = "N"; rem 【计算】; &rec1.RUN_CALC_IND.Value = "Y"; End-If; REM 【取消】计算; If &strGpAction = "C" Then rem 【取消】; &rec1.RUN_CANCEL_IND.Value = "Y"; rem 【标识收款人】 ; &rec1.RUN_IDNT_IND.Value = "N"; rem 【计算】; &rec1.RUN_CALC_IND.Value = "N"; End-If; Else rem 第一次计算; If &strGpAction = "A" Then rem 【取消】; &rec1.RUN_CANCEL_IND.Value = "N"; rem 【标识收款人】 ; &rec1.RUN_IDNT_IND.Value = "Y"; rem 【计算】; &rec1.RUN_CALC_IND.Value = "Y"; End-If; If &strGpAction = "C" Then throw CreateException(0, 0, ",errorMsg:该日历组ID未计算过,无法取消计算!,"); End-If; End-If; Else throw CreateException(0, 0, ",errorMsg:该日历组ID已关账,无法重新计算,请检查数据!,") End-If; &rec1.PRC_NUM.Value = 1; &rec1.SUSP_ACTIVE_IND.Value = "N"; &rec1.RUN_UNFREEZE_IND.Value = "N"; &rec1.RUN_RECALC_ALL_IND.Value = "N"; &rec1.RUN_FREEZE_IND.Value = "N"; &rec1.RUN_FINAL_IND.Value = "N"; &rec1.RUN_SUSPEND_IND.Value = "N"; &rec1.RUN_TRACE_OPTN.Value = "N"; &rec1.RUN_PHASE_OPTN.Value = "1"; &rec1.RUN_PHASE_STEP.Value = "01"; &rec1.UPDATE_STATS_IND.Value = "Y"; &rec1.STOP_BULK_IND.Value = "N"; &rec1.LANGUAGE_CD.Value = "ZHS"; &rec1.PRC_SAVE_TS.Value = %Datetime; &rec1.GP_PROC_MON_IND.Value = "Y"; REM 默认更新,无法更新则插入新数据; If Not &rec1.Insert() Then &rec1.Update(); End-If; &swSession = GetSession(); &swSession.connect(1, "", &strOprid, "", 0); rem 设置默认语言; SetLanguage(&LANGE); rem 调用薪资计算程序; &RQST = CreateProcessRequest(); &RQST.RunControlID = "INTF_" | &strCalRunId; rem 调用PSJob ; &RQST.ProcessType = "PSJob"; &RQST.JobName = "GP_PAYE"; rem 调用AE ; rem &RQST.ProcessType = "AppEngine"; rem &RQST.ProcessName = "GP_PAYE"; &RQST.Schedule();
LH_GP_DX_WRK.PRCSINSTANCE.Value = Value(&RQST.ProcessInstance); rem 日志记录,用于后续查询; Local Record &rcdLog = CreateRecord(Record.LH_GP_PDPAE_LOG); &rcdLog.PRCSINSTANCE.Value = &RQST.ProcessInstance; &rcdLog.RUNCNTLID.Value = "INTF_" | &strCalRunId; &rcdLog.OPRID.Value = &strOprid; &rcdLog.LH_GP_ACTION.Value = &strGpAction; &rcdLog.CAL_RUN_ID.Value = &strCalRunId; &rcdLog.RQSTDTTM.Value = ""; &rcdLog.ENDDTTM.Value = ""; &rcdLog.RUNSTATUS.Value = "7"; &rcdLog.RUNSTATUSDESCR.Value = "正在处理"; &rcdLog.COMMENTS.Value = " "; &rcdLog.Insert(); catch Exception &ex Error &ex.ToString(); end-try;
|