forked from ttc/micro-service-api
49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
import { GeneralService } from '../share/generalservice.js'
|
|
|
|
export class AccountingAddService {
|
|
|
|
constructor() {
|
|
this.generalService = new GeneralService()
|
|
}
|
|
|
|
async getAccountingAdd(database, number) {
|
|
const sql = `
|
|
SELECT
|
|
actseq,
|
|
actnum
|
|
FROM ${database}.actmst
|
|
WHERE actnum = $1
|
|
`
|
|
|
|
const params = [number]
|
|
const result = await this.generalService.executeQueryParam(database, sql, params);
|
|
return result
|
|
}
|
|
|
|
// async getLatestAccountingSeq(database) {
|
|
// const sql = `
|
|
// SELECT
|
|
// actseq
|
|
// FROM ${database}.actmst
|
|
// WHERE actseq=(SELECT max(actseq) FROM ${database}.actmst)
|
|
// `
|
|
|
|
// const params = []
|
|
// const result = await this.generalService.executeQueryParam(database, sql, params);
|
|
// return result
|
|
// }
|
|
|
|
async genNum(database) {
|
|
const sql = `
|
|
SELECT
|
|
MAX(actseq) as max_seq
|
|
FROM ${database}.actmst
|
|
`
|
|
const params = []
|
|
const aryResult = await this.generalService.executeQueryParam(database, sql, params);
|
|
|
|
const lastSeq = aryResult[0]?.max_seq || 0;
|
|
|
|
return lastSeq + 1;
|
|
}
|
|
} |