4075-ticket_boxing #1070
|
@ -1,16 +1,25 @@
|
||||||
CREATE TABLE `vn`.`packingSiteConfig` (
|
CREATE TABLE `vn`.`packingSiteConfig` (
|
||||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||||
`shinobiUrl` varchar(255) NOT NULL,
|
`shinobiUrl` varchar(255) NOT NULL,
|
||||||
|
`shinobiToken` varchar(255) NOT NULL,
|
||||||
`shinobiGroupKey` varchar(255) NOT NULL,
|
`shinobiGroupKey` varchar(255) NOT NULL,
|
||||||
`avgBoxingTime` INT(3) NULL,
|
`avgBoxingTime` INT(3) NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`packingSiteConfig` SET
|
INSERT INTO `vn`.`packingSiteConfig` SET
|
||||||
shinobiUrl = 'http://shinobi.verdnatura.es',
|
shinobiUrl = 'http://shinobi.verdnatura.es',
|
||||||
|
shinobiToken = 'BW4o7FZyJ85she1hlRDe6QnwW3jwEP',
|
||||||
shinobiGroupKey = 'xVqft9LFXg',
|
shinobiGroupKey = 'xVqft9LFXg',
|
||||||
avgBoxingTime = 30;
|
avgBoxingTime = 30;
|
||||||
|
|
||||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
VALUES
|
VALUES
|
||||||
('Boxing', '*', '*', 'ALLOW', 'ROLE', 'employee');
|
('Boxing', '*', '*', 'ALLOW', 'ROLE', 'employee');
|
||||||
|
|
||||||
|
SELECT e.id expeditionFk, e.ticketFk, ps.code, ps.monitorId
|
||||||
|
FROM expedition e
|
||||||
|
JOIN host h ON Convert(h.code USING utf8mb3) COLLATE utf8mb3_unicode_ci = e.hostFk
|
||||||
|
JOIN packingSite ps ON ps.hostFk = h.id
|
||||||
|
WHERE e.ticketFk = 1;
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
ALTER TABLE `vn`.`packingSite` ADD monitorId varchar(255) NULL;
|
||||||
|
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'VbiUcajdaT'
|
||||||
|
WHERE code = 'h1';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'qKMPn9aaVe'
|
||||||
|
WHERE code = 'h2';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = '3CtdIAGPAv'
|
||||||
|
WHERE code = 'h3';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'Xme2hiqz1f'
|
||||||
|
WHERE code = 'h4';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'aulxefgfJU'
|
||||||
|
WHERE code = 'h5';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = '6Ou0D1bhBw'
|
||||||
|
WHERE code = 'h6';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'eVUvnE6pNw'
|
||||||
|
WHERE code = 'h7';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = '0wsmSvqmrs'
|
||||||
|
WHERE code = 'h8';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'r2l2RyyF4I'
|
||||||
|
WHERE code = 'h9';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'EdjHLIiDVD'
|
||||||
|
WHERE code = 'h10';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'czC45kmwqI'
|
||||||
|
WHERE code = 'h11';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'PNsmxPaCwQ'
|
||||||
|
WHERE code = 'h12';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'agVssO0FDC'
|
||||||
|
WHERE code = 'h13';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'f2SPNENHPo'
|
||||||
|
WHERE code = 'h14';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = '6UR7gUZxks'
|
||||||
|
WHERE code = 'h15';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'bOB0f8WZ2V'
|
||||||
|
WHERE code = 'h16';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = 'MIR1nXaL0n'
|
||||||
|
WHERE code = 'h17';
|
||||||
|
UPDATE `vn`.`packingSite`
|
||||||
|
SET monitorId = '0Oj9SgGTXR'
|
||||||
|
WHERE code = 'h18';
|
|
@ -883,18 +883,18 @@ INSERT INTO `vn`.`expeditionStateType`(`id`, `description`, `code`)
|
||||||
(3, 'Perdida', 'LOST');
|
(3, 'Perdida', 'LOST');
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`)
|
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`, `hostFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 15, 1, 18, 'UR9000006041', 94, 1),
|
(1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 15, 1, 18, 'UR9000006041', 94, 1, 'pc1'),
|
||||||
(2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 16, 2, 18, 'UR9000006041', 94, 1),
|
(2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 16, 2, 18, 'UR9000006041', 94, 1, NULL),
|
||||||
(3, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 3, 18, 'UR9000006041', 94, 2),
|
(3, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 3, 18, 'UR9000006041', 94, 2, NULL),
|
||||||
(4, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 4, 18, 'UR9000006041', 94, 2),
|
(4, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 4, 18, 'UR9000006041', 94, 2, NULL),
|
||||||
(5, 1, 2, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 18, NULL, 94, 3),
|
(5, 1, 2, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 18, NULL, 94, 3, NULL),
|
||||||
(6, 7, 3, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL, 1, 18, NULL, 94, 3),
|
(6, 7, 3, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL, 1, 18, NULL, 94, 3, NULL),
|
||||||
(7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL, 1, 18, NULL, 94, NULL),
|
(7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL, 1, 18, NULL, 94, NULL,NULL),
|
||||||
(8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL, 1, 18, NULL, 94, 1),
|
(8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL, 1, 18, NULL, 94, 1, NULL),
|
||||||
(9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 18, NULL, 94, 2),
|
(9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 18, NULL, 94, 2, NULL),
|
||||||
(10, 7, 7, 71, NOW(), NULL, 1, 18, NULL, 94, 3);
|
(10, 7, 7, 71, NOW(), NULL, 1, 18, NULL, 94, 3, NULL);
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`expeditionState`(`id`, `created`, `expeditionFk`, `typeFk`, `userFk`)
|
INSERT INTO `vn`.`expeditionState`(`id`, `created`, `expeditionFk`, `typeFk`, `userFk`)
|
||||||
|
@ -2611,3 +2611,12 @@ INSERT INTO `vn`.`sectorCollectionSaleGroup` (`sectorCollectionFk`, `saleGroupFk
|
||||||
INSERT INTO `vn`.`workerTimeControlConfig` (`id`, `dayBreak`, `dayBreakDriver`, `shortWeekBreak`, `longWeekBreak`, `weekScope`, `mailPass`, `mailHost`, `mailSuccessFolder`, `mailErrorFolder`, `mailUser`, `minHoursToBreak`, `breakHours`, `hoursCompleteWeek`, `startNightlyHours`, `endNightlyHours`, `maxTimePerDay`, `breakTime`, `timeToBreakTime`, `dayMaxTime`, `shortWeekDays`, `longWeekDays`)
|
INSERT INTO `vn`.`workerTimeControlConfig` (`id`, `dayBreak`, `dayBreakDriver`, `shortWeekBreak`, `longWeekBreak`, `weekScope`, `mailPass`, `mailHost`, `mailSuccessFolder`, `mailErrorFolder`, `mailUser`, `minHoursToBreak`, `breakHours`, `hoursCompleteWeek`, `startNightlyHours`, `endNightlyHours`, `maxTimePerDay`, `breakTime`, `timeToBreakTime`, `dayMaxTime`, `shortWeekDays`, `longWeekDays`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 43200, 32400, 129600, 259200, 604800, '', '', 'Leidos.exito', 'Leidos.error', 'timeControl', 5.33, 0.33, 40, '22:00:00', '06:00:00', 57600, 1200, 18000, 57600, 6, 13);
|
(1, 43200, 32400, 129600, 259200, 604800, '', '', 'Leidos.exito', 'Leidos.error', 'timeControl', 5.33, 0.33, 40, '22:00:00', '06:00:00', 57600, 1200, 18000, 57600, 6, 13);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`host` (`id`, `code`, `description`, `warehouseFk`, `bankFk`)
|
||||||
|
VALUES
|
||||||
|
(1, 'pc1', 'pc host', 1, 1);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`packingSite` (`id`, `code`, `hostFk`, `monitorId`)
|
||||||
|
VALUES
|
||||||
|
(1, 'h1', 1, 'VbiUcajdaT');
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,23 @@ module.exports = Self => {
|
||||||
description: 'Time to add'
|
description: 'Time to add'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
returns: {
|
returns: [
|
||||||
type: ['object'],
|
{
|
||||||
root: true,
|
arg: 'body',
|
||||||
|
type: 'file',
|
||||||
|
root: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
arg: 'Content-Type',
|
||||||
|
type: 'String',
|
||||||
|
http: {target: 'header'}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'Content-Disposition',
|
||||||
|
type: 'String',
|
||||||
|
http: {target: 'header'}
|
||||||
|
}
|
||||||
|
],
|
||||||
http: {
|
http: {
|
||||||
path: `/getVideo`,
|
path: `/getVideo`,
|
||||||
verb: 'GET',
|
verb: 'GET',
|
||||||
|
@ -37,31 +50,33 @@ module.exports = Self => {
|
||||||
|
|
||||||
const expedition = await models.Expedition.findById(id, null, myOptions);
|
const expedition = await models.Expedition.findById(id, null, myOptions);
|
||||||
const packingSiteConfig = await models.PackingSiteConfig.findOne({}, myOptions);
|
const packingSiteConfig = await models.PackingSiteConfig.findOne({}, myOptions);
|
||||||
const token = 'BW4o7FZyJ85she1hlRDe6QnwW3jwEP';
|
const monitorId = 'VbiUcajdaT';
|
||||||
const groupKey = 'xVqft9LFXg';
|
console.log(packingSiteConfig);
|
||||||
const monitorId = 'VbiUcajdaT';// 'xVqft9LFXg';
|
|
||||||
|
|
||||||
const start = '2022-07-27T09:00:00';// new Date('2022-07-27'); // new Date(expedition.created);
|
const addTime = (time ? time : packingSiteConfig.avgBoxingTime) * 1000;
|
||||||
const end = '2022-07-27T09:15:00';// start.setTime(start.getTime() + (time ? time : packingSiteConfig.avgBoxingTime));
|
const start = new Date(expedition.created);// '2022-07-27T09:00:00';// new Date('2022-07-27'); //
|
||||||
|
const end = new Date(start.getTime() + addTime);
|
||||||
|
console.log(addTime);
|
||||||
|
console.log(start.toISOString().split('.')[0]);
|
||||||
|
console.log(end.toISOString().split('.')[0]);
|
||||||
|
|
||||||
const videoUrl = `/${token}/videos/${groupKey}/${monitorId}?start=${start}&end=${end}`;
|
const videoUrl = `/${packingSiteConfig.shinobiToken}/videos/${packingSiteConfig.shinobiGroupKey}/${monitorId}`;
|
||||||
const url = `${packingSiteConfig.shinobiUrl}${videoUrl}`;
|
const timeUrl = `?start=${start.toISOString().split('.')[0]}&end=${end.toISOString().split('.')[0]}`;
|
||||||
const data = await axios.post(url);
|
const url = `${packingSiteConfig.shinobiUrl}${videoUrl}${timeUrl}&endIsStartTo`;
|
||||||
|
|
||||||
console.log(data.data.videos);
|
console.log(url);
|
||||||
console.log('-----------------------');
|
const videoList = await axios.post(url);
|
||||||
console.log('-----------------------');
|
console.log(videoList.data);
|
||||||
console.log('-----------------------');
|
const lastVideo = videoList.data.videos[videoList.data.videos.length - 1].href;
|
||||||
console.log('-----------------------');
|
console.log(lastVideo);
|
||||||
|
const stream = await axios({
|
||||||
axios({
|
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: `${packingSiteConfig.shinobiUrl}${data.data.videos[0].href}`,
|
url: `${packingSiteConfig.shinobiUrl}${lastVideo}`,
|
||||||
responseType: 'stream'
|
responseType: 'stream'
|
||||||
})
|
}).then(response => {
|
||||||
.then(response => {
|
return response.data;
|
||||||
console.log(response);
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return [stream, 'video/mp4', `filename="${id}.mp4"`];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,6 +18,9 @@
|
||||||
"shinobiGroupKey":{
|
"shinobiGroupKey":{
|
||||||
"type":"string"
|
"type":"string"
|
||||||
},
|
},
|
||||||
|
"shinobiToken":{
|
||||||
|
"type":"string"
|
||||||
|
},
|
||||||
"avgBoxingTime":{
|
"avgBoxingTime":{
|
||||||
"type":"number"
|
"type":"number"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<vn-card>
|
<vn-card>
|
||||||
<video id="videobcg" muted="muted" controls class="video">
|
<video id="videobcg" muted controls class="video" autoplay>
|
||||||
<source src="http://localhost:5000/api/Boxings/getVideo?id=1" type="video/mp4" autoplay="autoplay" >
|
<source src="http://localhost:5000/api/Boxings/getVideo?id=1" type="video/mp4">
|
||||||
</video>
|
</video>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
|
|
Loading…
Reference in New Issue