Oracle - Evolution 1.19.1.2
en una planilla de pago de aguinaldo con formulación en C# el cliente registró un descuento eventual y al generar la planilla dio el siguiente error:
2020-12-08 19:12:24,661 [87] INFO c9f09da1-3a28-41b8-8009-97d7660c550e - Cerrando: [IngresosPlanillaAnterior]
2020-12-08 19:12:24,661 [48] INFO c9f09da1-3a28-41b8-8009-97d7660c550e - Cerrando: [Emp_OtrosIngresos]
2020-12-08 19:12:24,786 [78] FATAL c9f09da1-3a28-41b8-8009-97d7660c550e - Error al actualizar en la base los cursores modificables de la formulación del tipo de planilla 3-Aguinaldo
System.AggregateException: One or more errors occurred. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Oracle.ManagedDataAccess.Client.OracleDataAdapter.OnRowUpdated(RowUpdatedEventArgs value)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
at Oracle.ManagedDataAccess.Client.OracleDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet)
at Aseinfo.VH4.MicroServices.GenPla.Ejecutores.NetLangCursor.CloseCursor() in C:\vh4\VH4\MicroServices\GenPla\NetLang\NetLangCursor.cs:line 78
at Aseinfo.VH4.MicroServices.GenPla.Ejecutores.EjecutorFormulacionNetLang.<>c__DisplayClass7_0.<EjecutarFormulas>b__8(String key) in C:\vh4\VH4\MicroServices\GenPla\NetLang\EjecutorFormulacionNetLang.cs:line 155
at System.Threading.Tasks.Parallel.<>c__DisplayClass31_0`2.<ForEachWorker>b__0(Int32 i)
at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object <p0>)
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IList`1 list, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, Action`1 body)
at Aseinfo.VH4.MicroServices.GenPla.Ejecutores.EjecutorFormulacionNetLang.EjecutarFormulas() in C:\vh4\VH4\MicroServices\GenPla\NetLang\EjecutorFormulacionNetLang.cs:line 149
---> (Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object.
at Oracle.ManagedDataAccess.Client.OracleDataAdapter.OnRowUpdated(RowUpdatedEventArgs value)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
at Oracle.ManagedDataAccess.Client.OracleDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet)
at Aseinfo.VH4.MicroServices.GenPla.Ejecutores.NetLangCursor.CloseCursor() in C:\vh4\VH4\MicroServices\GenPla\NetLang\NetLangCursor.cs:line 78
at Aseinfo.VH4.MicroServices.GenPla.Ejecutores.EjecutorFormulacionNetLang.<>c__DisplayClass7_0.<EjecutarFormulas>b__8(String key) in C:\vh4\VH4\MicroServices\GenPla\NetLang\EjecutorFormulacionNetLang.cs:line 155
at System.Threading.Tasks.Parallel.<>c__DisplayClass31_0`2.<ForEachWorker>b__0(Int32 i)
at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object <p0>)<---
2020-12-08 19:12:24,802 [78] ERROR c9f09da1-3a28-41b8-8009-97d7660c550e - Error al ejecutar las fórmulas del tipo de planilla Aguinaldo periodo 219
Revisando me dí cuenta que el error da si llama al procedimiento agrega descuentos historial revise el cursor de descuentos eventuales y justo solo regresa un registro y esta accesible para el tipo de planilla, verifiqué que el procedimiento insertaba a la tabla tmp dss descuentos, que el cursor DescuentosEstaPlanilla este accesible y que todos los campos esten visibles para el procedimiento, como la analogía de funcionamiento con el ingreso eventual es similar eliminé el descuento eventual y cree un ingreso eventual el cual pagó sin problema.
una característica de la formulación es que la formulación de salarios está en vbscript. a continuación, comparto el factor de descuentos eventuales, el procedimiento de histórico y la configuración del cursor "DescuentosEstaPlanilla".
public double GT_otrosdescuentos_a()
{
double valor =0.00;
double liquido = 0.00;
double sum = 0.00;
short tipo_des = 0;
liquido = Convert.ToDouble(Factores["GT_TotalIngresos_a"].Value);
NetLangCursor rs = Emp_OtrosDescuentos;
if(!rs.BOF)
{
rs.MoveFirst();
while(!rs.EOF)
{
valor = Convert.ToDouble(rs.Fields("ods_valor_a_descontar").Value);
if (valor < liquido )
{
liquido = liquido - valor;
sum = sum + valor;
tipo_des = Convert.ToInt16(rs.Fields("ods_codtdc").Value);
agrega_descuentos_historial_cs( Cursores["DescuentosEstaPlanilla"],
Convert.ToInt32(Emp_InfoSalario.Fields("EMP_CODIGO").Value),
Convert.ToInt32(Pla_Periodo.Fields("ppl_codigo").Value),
tipo_des,
valor,
0,
0,
Pla_Periodo.Fields("tpl_codmon").Value.ToString(),
0,
"Dias"
);
//rs.Fields("ods_aplicado_planilla").Value = 1;
}
else
{
//rs.Fields("ods_aplicado_planilla").Value = 0;
}
rs.MoveNext();
}
}
return sum;
}
public void agrega_descuentos_historial_cs(NetLangCursor dss_descuentos, int codEMP, int codPPL, short codTDC, double Valor, double ValorPatronal, double IngresoAfecto, string codMON, double Tiempo, string UnidadTiempo) {
dss_descuentos.AddNew();
dss_descuentos.Fields("dss_codppl").Value = codPPL;
dss_descuentos.Fields("dss_codemp").Value = codEMP;
dss_descuentos.Fields("dss_codtdc").Value = codTDC;
dss_descuentos.Fields("dss_valor").Value = Valor;
dss_descuentos.Fields("dss_valor_patronal").Value = ValorPatronal;
dss_descuentos.Fields("dss_ingreso_afecto").Value = IngresoAfecto;
dss_descuentos.Fields("dss_codmon").Value = codMON;
dss_descuentos.Fields("dss_tiempo").Value = Tiempo;
if(String.IsNullOrEmpty(UnidadTiempo))
{
dss_descuentos.Fields("dss_unidad_tiempo").Value = "";
}
else
{
dss_descuentos.Fields("dss_unidad_tiempo").Value = UnidadTiempo;
}
Agrupadores.SumaRubro("D", codTDC, Valor);
}
cursor (la prueba también se hizo con select * from ...)
select dss_codigo, dss_codppl, dss_codemp, dss_codtdc, dss_valor, dss_valor_patronal, dss_ingreso_afecto, dss_codmon, dss_tiempo, dss_unidad_tiempo, dss_usuario_grabacion, dss_fecha_grabacion
from tmp_dss_descuentos
where dss_codppl = $$CODPPL$$
and sal.empleado_en_gen_planilla('$$SESSIONID$$', dss_codemp) = 1
