-แก้ไขระบบ Login Add
All checks were successful
Build Docker Image / Build Docker Image (push) Successful in 3m19s

This commit is contained in:
x2Skyz
2025-11-21 15:00:37 +07:00
parent 2237163847
commit 02b1a6f31b
3 changed files with 27 additions and 13 deletions

View File

@@ -27,13 +27,13 @@ export class accountingAdd {
let latSeq = []
try {
let token = req.headers.authorization?.split(' ')[1];
const decoded = verifyToken(token);
var decoded = verifyToken(token);
let actnum = req.body.request.actnum;
database = decoded.organization;
aryResult = await this.accountingAddService.getAccountingAdd(database, actnum);
latSeq = await this.accountingAddService.getLatestAccountingSeq(database);
latSeq = await this.accountingAddService.genNum(database);
} catch (error) {
idx = 1;
} finally {
@@ -41,7 +41,7 @@ export class accountingAdd {
// if (!aryResult) return sendError('ไม่พบการมีอยู่ของข้อมูล', 'Cannot Find Any Data');
if (aryResult == 0) {
let prommis = await this.makeArySave(req, latSeq[0].actseq);
let prommis = await this.makeArySave(req, latSeq, decoded.id);
return prommis
} else {
return sendError('คีย์หลักซ้ำในระบบ', 'Duplicate Primary Key');
@@ -50,11 +50,11 @@ export class accountingAdd {
}
async makeArySave(req, seq) {
async makeArySave(req, seq, actnum) {
let arysave = {
methods: 'post',
actseq: seq + 1,
actnum: req.body.request.actnum,
actseq: seq,
actnum: actnum,
actacpdtm: req.body.request.actacpdtm,
actcat: req.body.request.actcat,
actqty: req.body.request.actqty,