feat: #6184 Minor changes
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
d5a145ba1b
commit
25fa154f60
|
@ -70,21 +70,17 @@ module.exports = Self => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const dms = await models.TicketDms.findOne({
|
const dms = await models.TicketDms.findOne({
|
||||||
where: {
|
where: {ticketFk: ticketId},
|
||||||
ticketFk: ticketId
|
include: [{
|
||||||
},
|
relation: 'dms',
|
||||||
include: [
|
fields: ['id'],
|
||||||
{
|
scope: {
|
||||||
relation: 'dms',
|
relation: 'dmsType',
|
||||||
fields: ['id'],
|
|
||||||
scope: {
|
scope: {
|
||||||
relation: 'dmsType',
|
where: {code: 'cmr'}
|
||||||
where: {
|
|
||||||
code: 'cmr'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
}]
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
if (!dms) throw new UserError('Cmr file does not exist');
|
if (!dms) throw new UserError('Cmr file does not exist');
|
||||||
|
|
|
@ -59,18 +59,18 @@ module.exports = Self => {
|
||||||
|
|
||||||
async function hasSignDms(ticketId) {
|
async function hasSignDms(ticketId) {
|
||||||
const ticketDms = await models.TicketDms.findOne({
|
const ticketDms = await models.TicketDms.findOne({
|
||||||
where: {
|
where: {ticketFk: ticketId},
|
||||||
ticketFk: ticketId
|
include: [
|
||||||
},
|
{
|
||||||
fields: ['dmsFk'],
|
relation: 'dms',
|
||||||
include: [{
|
fields: ['id'],
|
||||||
relation: 'dms',
|
scope: {
|
||||||
scope: {
|
where: {dmsTypeFk: dmsTypeTicket.id}
|
||||||
where: {dmsType: dmsTypeTicket.id}
|
}
|
||||||
}
|
}
|
||||||
}]
|
]
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
if (ticketDms.dms().id) return true;
|
if (ticketDms.dms()?.id) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createGestDoc(id) {
|
async function createGestDoc(id) {
|
||||||
|
@ -133,9 +133,9 @@ module.exports = Self => {
|
||||||
if (await ticket.isSigned)
|
if (await ticket.isSigned)
|
||||||
throw new UserError('Ticket is already signed');
|
throw new UserError('Ticket is already signed');
|
||||||
|
|
||||||
if (location) setLocation(ticketId);
|
if (location) await setLocation(ticketId);
|
||||||
if (!await hasSignDms(ticketId))
|
if (!await hasSignDms(ticketId))
|
||||||
createGestDoc(ticketId);
|
await createGestDoc(ticketId);
|
||||||
await ticket.updateAttribute('isSigned', true, myOptions);
|
await ticket.updateAttribute('isSigned', true, myOptions);
|
||||||
|
|
||||||
const deliveryState = await models.State.findOne({
|
const deliveryState = await models.State.findOne({
|
||||||
|
|
Loading…
Reference in New Issue