fix: also prefix runningNo on generate
This commit is contained in:
parent
8c0932f6d8
commit
eb30202312
1 changed files with 4 additions and 2 deletions
|
|
@ -242,12 +242,14 @@ export class ServiceController extends Controller {
|
||||||
|
|
||||||
const record = await prisma.$transaction(
|
const record = await prisma.$transaction(
|
||||||
async (tx) => {
|
async (tx) => {
|
||||||
|
const branch = productGroup.registeredBranch;
|
||||||
|
const company = (branch.headOffice || branch).code;
|
||||||
const last = await tx.runningNo.upsert({
|
const last = await tx.runningNo.upsert({
|
||||||
where: {
|
where: {
|
||||||
key: `SERVICE_${body.code.toLocaleUpperCase()}`,
|
key: `SERVICE_${company}_${body.code.toLocaleUpperCase()}`,
|
||||||
},
|
},
|
||||||
create: {
|
create: {
|
||||||
key: `SERVICE_${body.code.toLocaleUpperCase()}`,
|
key: `SERVICE_${company}_${body.code.toLocaleUpperCase()}`,
|
||||||
value: 1,
|
value: 1,
|
||||||
},
|
},
|
||||||
update: { value: { increment: 1 } },
|
update: { value: { increment: 1 } },
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue