refs #6321 feat: updates
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
bc09ad7da7
commit
871447cc6e
|
@ -1,3 +1,5 @@
|
||||||
-- Auto-generated SQL script #202401191358
|
-- Auto-generated SQL script #202401191358
|
||||||
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||||
VALUES ('Ticket','itemLack','READ','ALLOW','ROLE','employee');
|
VALUES ('Ticket','itemLack','READ','ALLOW','ROLE','employee');
|
||||||
|
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('Ticket','itemLackDetail','READ','ALLOW','ROLE','employee');
|
||||||
|
|
|
@ -167,7 +167,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
'itemFk': 7176,
|
'itemFk': 72176,
|
||||||
'longName': 'Anthurium Olivius x20',
|
'longName': 'Anthurium Olivius x20',
|
||||||
'warehouseFk': 60,
|
'warehouseFk': 60,
|
||||||
'producer': null,
|
'producer': null,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
|
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethod('itemLackDetail', {
|
Self.remoteMethod('itemLackDetail', {
|
||||||
description: 'Download a ticket delivery note document',
|
description: 'Download a ticket delivery note document',
|
||||||
|
@ -8,62 +9,76 @@ module.exports = Self => {
|
||||||
arg: 'id',
|
arg: 'id',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
description: 'The item id',
|
description: 'The item id',
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
returns: [
|
returns: [
|
||||||
{
|
{
|
||||||
arg: 'body',
|
arg: 'body',
|
||||||
type: ['object'],
|
type: ['object'],
|
||||||
root: true
|
root: true,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
http: {
|
http: {
|
||||||
path: `/itemLack/:id/detail`,
|
path: `/itemLack/:id/detail`,
|
||||||
verb: 'GET'
|
verb: 'GET',
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.itemLackDetail = async(id, options) => {
|
Self.itemLackDetail = async(id, options) => {
|
||||||
const myOptions = {};
|
const conn = Self.dataSource.connector;
|
||||||
// const versionSQL = false;
|
|
||||||
if (typeof options == 'object')
|
|
||||||
Object.assign(myOptions, options);
|
|
||||||
|
|
||||||
const detail = await Self.rawSQL(`
|
const myOptions = {};
|
||||||
|
if (typeof options == 'object') Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
const stmt = new ParameterizedSQL(
|
||||||
|
`
|
||||||
SELECT
|
SELECT
|
||||||
s.Id_Movimiento, st.code, t.Id_Ticket, t.Alias, t.Fecha, s.Cantidad, ag.Agencia,
|
s.id saleFk,
|
||||||
|
st.code,
|
||||||
|
t.id ticketFk,
|
||||||
|
t.nickname,
|
||||||
|
t.hour,
|
||||||
|
s.quantity,
|
||||||
|
ag.name,
|
||||||
ts.alertLevel alertLevel,
|
ts.alertLevel alertLevel,
|
||||||
st.name stateName,
|
st.name stateName,
|
||||||
st.id stateId,
|
st.id stateId,
|
||||||
s.Id_Article id,
|
s.itemFk itemFk,
|
||||||
al.code alertLevelCode,
|
al.code alertLevelCode,
|
||||||
z.name,
|
z.name,
|
||||||
z.hour theoreticalhour,
|
z.hour theoreticalhour,
|
||||||
cn.isRookie,
|
cn.isRookie,
|
||||||
sc.saleClonedFk turno,
|
sc.saleClonedFk turno,
|
||||||
tr.saleFk peticionCompra,
|
tr.saleFk peticionCompra,
|
||||||
t.Fecha minTimed
|
t.hour minTimed
|
||||||
FROM
|
FROM
|
||||||
Sale s
|
vn.sale s
|
||||||
JOIN Tickets t ON t.Id_Ticket=s.Id_Ticket -- vn.ticket
|
JOIN vn.ticket t ON t.id=s.ticketFk -- vn.ticket
|
||||||
LEFT JOIN zone z ON z.id = t.zoneFk -- vn.zone
|
LEFT JOIN vn.zone z ON z.id = t.zoneFk -- vn.zone
|
||||||
LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk AND zc.dated = DateValue(t.Fecha)
|
LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk -- AND zc.dated = DateValue(t.Fecha)
|
||||||
JOIN Clientes c ON c.Id_Cliente=t.Id_Cliente -- vn.client
|
JOIN vn.client c ON c.id=t.clientFk -- vn.client
|
||||||
LEFT JOIN clientNewBorn cn ON cn.clientFk=c.Id_Cliente
|
LEFT JOIN bs.clientNewBorn cn ON cn.clientFk=c.id
|
||||||
JOIN Agencias ag ON ag.Id_Agencia=t.Id_Agencia -- vn.agencyMode
|
JOIN vn.agencyMode agm ON agm.id=t.agencyModeFk -- vn.agencyMode
|
||||||
JOIN ticketState tls ON ts.ticketFk=t.Id_Ticket -- vn.sale
|
JOIN vn.agency ag ON ag.id=agm.id -- vn.agencyMode
|
||||||
LEFT JOIN state s ON st.id=ts.state
|
JOIN vn.ticketState ts ON ts.ticketFk=t.id -- vn.sale
|
||||||
LEFT JOIN alertLevel al ON al.id = st.alertLevel
|
LEFT JOIN vn.state st ON st.id=ts.state
|
||||||
LEFT JOIN saleCloned sc ON sc.saleClonedFk = s.Id_Movimiento
|
LEFT JOIN vn.alertLevel al ON al.id = st.alertLevel
|
||||||
LEFT JOIN ticketRequest tr ON tr.saleFk = s.Id_Movimiento
|
LEFT JOIN vn.saleCloned sc ON sc.saleClonedFk = s.id
|
||||||
WHERE
|
LEFT JOIN vn.ticketRequest tr ON tr.saleFk = s.id
|
||||||
AND s.Id_Article = ?
|
LIMIT 1
|
||||||
AND NOT Cantidad
|
`,
|
||||||
AND Fecha >= util.VN_CURDATE()
|
null
|
||||||
AND Fecha < INTERVAL util.VN_CURDATE() + INTERVAL ? + 1 DAY
|
);
|
||||||
ORDER BY s.Id_Movimiento DESC+
|
// WHERE
|
||||||
`, [id, 2], myOptions);
|
// s.itemFk = ?
|
||||||
|
|
||||||
return detail;
|
// AND t.landed >= util.VN_CURDATE()
|
||||||
|
// AND t.landed < INTERVAL util.VN_CURDATE() + INTERVAL ? + 1 DAY
|
||||||
|
// ORDER BY s.id DESC+
|
||||||
|
// [id,2]
|
||||||
|
|
||||||
|
const sql = ParameterizedSQL.join([stmt], ';');
|
||||||
|
const result = await conn.executeStmt(sql, myOptions);
|
||||||
|
return result;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue