refs #4632 dmsRecover deprecated
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
88cde4b8a1
commit
423ae85212
|
@ -44,9 +44,6 @@
|
||||||
"DmsType": {
|
"DmsType": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"DmsRecover": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"Docuware": {
|
"Docuware": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
|
|
||||||
{
|
|
||||||
"name": "DmsRecover",
|
|
||||||
"description": "Documental Managment System Recover",
|
|
||||||
"base": "VnModel",
|
|
||||||
"log": {
|
|
||||||
"showField": "ticketFk"
|
|
||||||
},
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "dmsRecover"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "number",
|
|
||||||
"id": true,
|
|
||||||
"description": "Identifier"
|
|
||||||
},
|
|
||||||
"ticketFk": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"sign": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"created": {
|
|
||||||
"type": "date"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"relations": {
|
|
||||||
"ticket": {
|
|
||||||
"type": "belongsTo",
|
|
||||||
"model": "Ticket",
|
|
||||||
"foreignKey": "ticketFk"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
DROP TABLE `vn`.`dmsRecover`;
|
||||||
|
|
||||||
ALTER TABLE `vn`.`delivery` DROP FOREIGN KEY delivery_FK;
|
ALTER TABLE `vn`.`delivery` DROP FOREIGN KEY delivery_FK;
|
||||||
ALTER TABLE `vn`.`delivery` DROP COLUMN addressFk;
|
ALTER TABLE `vn`.`delivery` DROP COLUMN addressFk;
|
||||||
ALTER TABLE `vn`.`delivery` ADD ticketFk INT NOT NULL;
|
ALTER TABLE `vn`.`delivery` ADD ticketFk INT NOT NULL;
|
|
@ -51,7 +51,7 @@ module.exports = Self => {
|
||||||
ticketFk: ticketId,
|
ticketFk: ticketId,
|
||||||
longitude: args.location.Longitude,
|
longitude: args.location.Longitude,
|
||||||
latitude: args.location.Latitude,
|
latitude: args.location.Latitude,
|
||||||
dated: args.signedTime
|
dated: args.signedTime || new Date()
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,8 @@ module.exports = Self => {
|
||||||
if (!ticketDms) return false;
|
if (!ticketDms) return false;
|
||||||
|
|
||||||
const ticket = await models.Ticket.findById(ticketId, {fields: ['isSigned']}, myOptions);
|
const ticket = await models.Ticket.findById(ticketId, {fields: ['isSigned']}, myOptions);
|
||||||
if (ticket.isSigned == true) return true;
|
if (ticket.isSigned == true)
|
||||||
|
return true;
|
||||||
else
|
else
|
||||||
await models.Dms.destroyAll({where: {reference: ticketId}}, myOptions);
|
await models.Dms.destroyAll({where: {reference: ticketId}}, myOptions);
|
||||||
|
|
||||||
|
@ -108,10 +109,6 @@ module.exports = Self => {
|
||||||
await models.Ticket.uploadFile(ctxUploadFile, id, myOptions);
|
await models.Ticket.uploadFile(ctxUploadFile, id, myOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
// async function dmsRecover(ticketFk, sign) {
|
|
||||||
// await models.DmsRecover.create({ticketFk, sign}, myOptions);
|
|
||||||
// }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (let i = 0; i < args.tickets.length; i++) {
|
for (let i = 0; i < args.tickets.length; i++) {
|
||||||
const ticketState = await models.TicketState.findOne(
|
const ticketState = await models.TicketState.findOne(
|
||||||
|
@ -120,35 +117,15 @@ module.exports = Self => {
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
if (ticketState.alertLevel >= 2 && !await gestDocExists(args.tickets[i])) {
|
if (ticketState.alertLevel >= 2 && !await gestDocExists(args.tickets[i])) {
|
||||||
if (!args.signedTime) args.signedTime = Date.vnNew();
|
|
||||||
if (args.location) setLocation(args.tickets[i]);
|
if (args.location) setLocation(args.tickets[i]);
|
||||||
await createGestDoc(args.tickets[i]);
|
await createGestDoc(args.tickets[i]);
|
||||||
|
|
||||||
// if (image) {
|
|
||||||
// if (!fs.existsSync(dir))
|
|
||||||
// dmsRecover(args.tickets[i], args.signContent);
|
|
||||||
// else {
|
|
||||||
// fs.writeFile(image, args.signContent, 'base64', async function(err) {
|
|
||||||
// if (err) {
|
|
||||||
// await tx.rollback();
|
|
||||||
// throw err.message;
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// } else
|
|
||||||
// dmsRecover(args.tickets[i], args.signContent);
|
|
||||||
|
|
||||||
// if (id && fileName) {
|
|
||||||
// await models.TicketDms.replaceOrCreate({ticketFk: args.tickets[i], dmsFk: id}, myOptions);
|
|
||||||
await Self.rawSql(`CALL vn.ticket_setState(?, ?)`, [args.tickets[i], 'DELIVERED'], myOptions);
|
await Self.rawSql(`CALL vn.ticket_setState(?, ?)`, [args.tickets[i], 'DELIVERED'], myOptions);
|
||||||
// await models.Dms.updateAll({id}, {file: fileName, contentType: 'image/png'}, myOptions);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
|
|
||||||
return 'Sign uploaded correctly';
|
return 'Signs uploaded correctly';
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (tx) await tx.rollback();
|
if (tx) await tx.rollback();
|
||||||
throw e;
|
throw e;
|
||||||
|
|
Loading…
Reference in New Issue