Merge branch 'test' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2024-02-01 12:17:48 +01:00
commit a9a1f97366
5 changed files with 26 additions and 22 deletions

3
Jenkinsfile vendored
View File

@ -20,6 +20,9 @@ pipeline {
stage('Checkout') { stage('Checkout') {
steps { steps {
script { script {
// Uncomment to enable debugging
//env.DEBUG = 'strong-remoting:http-context,strong-remoting:shared-method'
switch (env.BRANCH_NAME) { switch (env.BRANCH_NAME) {
case 'dev': case 'dev':
env.NODE_ENV = 'dev' env.NODE_ENV = 'dev'

View File

@ -22,6 +22,7 @@ services:
- 3000 - 3000
environment: environment:
- NODE_ENV - NODE_ENV
- DEBUG
configs: configs:
- source: datasources - source: datasources
target: /etc/salix/datasources.json target: /etc/salix/datasources.json

View File

@ -72,24 +72,25 @@ module.exports = Self => {
async function createGestDoc(id) { async function createGestDoc(id) {
const ticket = await models.Ticket.findById(id, const ticket = await models.Ticket.findById(id,
{include: [ {
{ include: [
relation: 'warehouse', {
scope: { relation: 'warehouse',
fields: ['id'] scope: {
fields: ['id']
}
}, {
relation: 'client',
scope: {
fields: ['name']
}
}, {
relation: 'route',
scope: {
fields: ['id']
}
} }
}, { ]
relation: 'client',
scope: {
fields: ['name']
}
}, {
relation: 'route',
scope: {
fields: ['id']
}
}
]
}, myOptions); }, myOptions);
const dmsType = await models.DmsType.findOne({where: {code: 'Ticket'}, fields: ['id']}, myOptions); const dmsType = await models.DmsType.findOne({where: {code: 'Ticket'}, fields: ['id']}, myOptions);
const ctxUploadFile = Object.assign({}, ctx); const ctxUploadFile = Object.assign({}, ctx);
@ -125,17 +126,17 @@ module.exports = Self => {
if (await gestDocExists(ticketId)) if (await gestDocExists(ticketId))
throw new UserError('Ticket is already signed'); throw new UserError('Ticket is already signed');
if (location) setLocation(ticketId); if (location) await setLocation(ticketId);
if (!gestDocCreated) await createGestDoc(ticketId); if (!gestDocCreated) await createGestDoc(ticketId);
await models.TicketDms.create({ticketFk: ticketId, dmsFk: dms[0].id}, myOptions); await models.TicketDms.create({ticketFk: ticketId, dmsFk: dms[0].id}, myOptions);
const ticket = await models.Ticket.findById(ticketId, null, myOptions); const ticket = await models.Ticket.findById(ticketId, null, myOptions);
await ticket.updateAttribute('isSigned', true, myOptions); await ticket.updateAttribute('isSigned', true, myOptions);
const deliveryState = await models.State.find({ const deliveryState = await models.State.findOne({
where: { where: {
code: 'DELIVERED' code: 'DELIVERED'
} }
}, options); }, myOptions);
await models.Ticket.state(ctx, { await models.Ticket.state(ctx, {
ticketFk: ticketId, ticketFk: ticketId,

View File

@ -18,7 +18,6 @@ module.exports = {
} }
}, },
async serverPrefetch() { async serverPrefetch() {
await this.rawSql('SET @hasPrevia := 0');
let ticketIds; let ticketIds;
const res = await this.rawSqlFromDef('tickets', [this.id]); const res = await this.rawSqlFromDef('tickets', [this.id]);
if (res.length) { if (res.length) {

View File

@ -16,7 +16,7 @@ SELECT c.itemPackingTypeFk code,
DATE_FORMAT(t.shipped, '%d/%m/%y') shipped, DATE_FORMAT(t.shipped, '%d/%m/%y') shipped,
tt.labelCount, tt.labelCount,
t.nickName, t.nickName,
SUM(IF(sgd.id, IF(@hasPrevia, 0, @hasPrevia := 1), 1)) lineCount, SUM(IF(sgd.id IS NULL, 1, 0)) + IF(sgd.id , 1, 0) lineCount,
rm.routeFk rm.routeFk
FROM vn.ticket t FROM vn.ticket t
JOIN vn.ticketCollection tc ON tc.ticketFk = t.id JOIN vn.ticketCollection tc ON tc.ticketFk = t.id