added new api in carnet app
This commit is contained in:
parent
c5b5a8e541
commit
49e4f45073
@ -113,6 +113,16 @@ export class CarnetApplicationController {
|
|||||||
return this.carnetApplicationService.CloseCarnet(body);
|
return this.carnetApplicationService.CloseCarnet(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Patch('ResetCarnet')
|
||||||
|
@Roles('sa')
|
||||||
|
ResetCarnet(@Body() body: CarnetProcessingCenterDTO) {
|
||||||
|
return this.carnetApplicationService.ResetCarnet(body);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Delete('DeleteCarnet')
|
||||||
|
DeleteCarnet(@Body() body: CarnetProcessingCenterDTO) {
|
||||||
|
return this.carnetApplicationService.DeleteCarnet(body);
|
||||||
|
}
|
||||||
// [ CARNETCONTROLCENTER_PKG ]
|
// [ CARNETCONTROLCENTER_PKG ]
|
||||||
|
|
||||||
@Get('GetHolderstoEdit/:P_SPID/:P_USERID/:P_HEADERID')
|
@Get('GetHolderstoEdit/:P_SPID/:P_USERID/:P_HEADERID')
|
||||||
|
|||||||
@ -639,7 +639,7 @@ export class CarnetApplicationService {
|
|||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
`BEGIN
|
`BEGIN
|
||||||
PROCESSINGCENTER_PKG.ProcessCarnet(
|
PROCESSINGCENTER_PKG.ProcessCarnet(
|
||||||
:P_USERID, :P_HEADERID :P_CURSOR
|
:P_USERID, :P_HEADERID, :P_CURSOR
|
||||||
);
|
);
|
||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
@ -681,7 +681,7 @@ export class CarnetApplicationService {
|
|||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
`BEGIN
|
`BEGIN
|
||||||
PROCESSINGCENTER_PKG.UpdatePrintCarnet(
|
PROCESSINGCENTER_PKG.UpdatePrintCarnet(
|
||||||
:P_USERID, :P_HEADERID :P_CURSOR
|
:P_USERID, :P_HEADERID, :P_CURSOR
|
||||||
);
|
);
|
||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
@ -723,7 +723,7 @@ export class CarnetApplicationService {
|
|||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
`BEGIN
|
`BEGIN
|
||||||
PROCESSINGCENTER_PKG.VoidCarnet(
|
PROCESSINGCENTER_PKG.VoidCarnet(
|
||||||
:P_USERID, :P_HEADERID :P_CURSOR
|
:P_USERID, :P_HEADERID, :P_CURSOR
|
||||||
);
|
);
|
||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
@ -765,7 +765,7 @@ export class CarnetApplicationService {
|
|||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
`BEGIN
|
`BEGIN
|
||||||
PROCESSINGCENTER_PKG.DuplicateCarnet(
|
PROCESSINGCENTER_PKG.DuplicateCarnet(
|
||||||
:P_USERID, :P_HEADERID :P_CURSOR
|
:P_USERID, :P_HEADERID, :P_CURSOR
|
||||||
);
|
);
|
||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
@ -807,7 +807,7 @@ export class CarnetApplicationService {
|
|||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
`BEGIN
|
`BEGIN
|
||||||
PROCESSINGCENTER_PKG.CloseCarnet(
|
PROCESSINGCENTER_PKG.CloseCarnet(
|
||||||
:P_USERID, :P_HEADERID :P_CURSOR
|
:P_USERID, :P_HEADERID, :P_CURSOR
|
||||||
);
|
);
|
||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
@ -841,6 +841,90 @@ export class CarnetApplicationService {
|
|||||||
await closeOracleDbConnection(connection, CarnetApplicationService.name)
|
await closeOracleDbConnection(connection, CarnetApplicationService.name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
async ResetCarnet(body: CarnetProcessingCenterDTO) {
|
||||||
|
let connection;
|
||||||
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
|
||||||
|
const result = await connection.execute(
|
||||||
|
`BEGIN
|
||||||
|
PROCESSINGCENTER_PKG.ResetCarnet(
|
||||||
|
:P_USERID, :P_HEADERID, :P_CURSOR
|
||||||
|
);
|
||||||
|
END;`,
|
||||||
|
{
|
||||||
|
P_USERID: { val: body.P_USERID, type: oracledb.DB_TYPE_NUMBER },
|
||||||
|
P_HEADERID: { val: body.P_HEADERID, type: oracledb.DB_TYPE_NUMBER },
|
||||||
|
P_CURSOR: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR },
|
||||||
|
// P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
|
||||||
|
},
|
||||||
|
{ outFormat: oracledb.OUT_FORMAT_OBJECT }
|
||||||
|
);
|
||||||
|
|
||||||
|
await connection.commit();
|
||||||
|
|
||||||
|
const outBinds = result.outBinds;
|
||||||
|
if (!outBinds?.P_CURSOR) {
|
||||||
|
this.logger.error('One or more expected cursors are missing from stored procedure output.');
|
||||||
|
throw new InternalServerException("Incomplete data received from the database.");
|
||||||
|
}
|
||||||
|
|
||||||
|
const fres: any = await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name);
|
||||||
|
|
||||||
|
if (fres.length > 0 && fres[0].ERRORMESG) {
|
||||||
|
this.logger.warn(fres[0].ERRORMESG);
|
||||||
|
throw new BadRequestException(fres[0].ERRORMESG)
|
||||||
|
}
|
||||||
|
|
||||||
|
return { statusCode: 200, message: "Reset Successfull", ...fres[0] };
|
||||||
|
} catch (error) {
|
||||||
|
handleError(error, CarnetApplicationService.name)
|
||||||
|
} finally {
|
||||||
|
await closeOracleDbConnection(connection, CarnetApplicationService.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async DeleteCarnet(body: CarnetProcessingCenterDTO) {
|
||||||
|
let connection;
|
||||||
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
|
||||||
|
const result = await connection.execute(
|
||||||
|
`BEGIN
|
||||||
|
PROCESSINGCENTER_PKG.DeleteCarnet(
|
||||||
|
:P_USERID, :P_HEADERID, :P_CURSOR
|
||||||
|
);
|
||||||
|
END;`,
|
||||||
|
{
|
||||||
|
P_USERID: { val: body.P_USERID, type: oracledb.DB_TYPE_NUMBER },
|
||||||
|
P_HEADERID: { val: body.P_HEADERID, type: oracledb.DB_TYPE_NUMBER },
|
||||||
|
P_CURSOR: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR },
|
||||||
|
// P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
|
||||||
|
},
|
||||||
|
{ outFormat: oracledb.OUT_FORMAT_OBJECT }
|
||||||
|
);
|
||||||
|
|
||||||
|
await connection.commit();
|
||||||
|
|
||||||
|
const outBinds = result.outBinds;
|
||||||
|
if (!outBinds?.P_CURSOR) {
|
||||||
|
this.logger.error('One or more expected cursors are missing from stored procedure output.');
|
||||||
|
throw new InternalServerException("Incomplete data received from the database.");
|
||||||
|
}
|
||||||
|
|
||||||
|
const fres: any = await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name);
|
||||||
|
|
||||||
|
if (fres.length > 0 && fres[0].ERRORMESG) {
|
||||||
|
this.logger.warn(fres[0].ERRORMESG);
|
||||||
|
throw new BadRequestException(fres[0].ERRORMESG)
|
||||||
|
}
|
||||||
|
|
||||||
|
return { statusCode: 200, message: "Deleted Successfully", ...fres[0] };
|
||||||
|
} catch (error) {
|
||||||
|
handleError(error, CarnetApplicationService.name)
|
||||||
|
} finally {
|
||||||
|
await closeOracleDbConnection(connection, CarnetApplicationService.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// [ CARNETCONTROLCENTER_PKG ]
|
// [ CARNETCONTROLCENTER_PKG ]
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user