7983-testToMaster_2438 #2977
|
@ -2,7 +2,7 @@ DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticket_isTooLittle`(
|
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticket_isTooLittle`(
|
||||||
vSelf INT
|
vSelf INT
|
||||||
)
|
)
|
||||||
RETURNS tinyint(1)
|
RETURNS BOOL
|
||||||
READS SQL DATA
|
READS SQL DATA
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
|
@ -11,14 +11,21 @@ BEGIN
|
||||||
* @param vSelf Id ticket
|
* @param vSelf Id ticket
|
||||||
* @return BOOL
|
* @return BOOL
|
||||||
*/
|
*/
|
||||||
DECLARE vIsTooLittle TINYINT(1);
|
DECLARE vIsTooLittle BOOL;
|
||||||
|
|
||||||
|
WITH ticketData AS (
|
||||||
|
SELECT addressFk, DATE(shipped) dated
|
||||||
|
FROM vn.ticket
|
||||||
|
WHERE id = vSelf
|
||||||
|
)
|
||||||
SELECT (SUM(IFNULL(sv.litros, 0)) < vc.minTicketVolume
|
SELECT (SUM(IFNULL(sv.litros, 0)) < vc.minTicketVolume
|
||||||
AND IFNULL(t.totalWithoutVat, 0) < vc.minTicketValue) INTO vIsTooLittle
|
AND SUM(IFNULL(t.totalWithoutVat, 0)) < vc.minTicketValue) INTO vIsTooLittle
|
||||||
FROM ticket t
|
FROM ticketData td
|
||||||
LEFT JOIN saleVolume sv ON sv.ticketFk = t.id
|
JOIN vn.ticket t ON t.addressFk = td.addressFk
|
||||||
JOIN volumeConfig vc
|
LEFT JOIN vn.saleVolume sv ON sv.ticketFk = t.id
|
||||||
WHERE t.id = vSelf;
|
JOIN vn.volumeConfig vc
|
||||||
|
WHERE t.shipped BETWEEN td.dated AND util.dayEnd(td.dated)
|
||||||
|
AND ticket_isProblemCalcNeeded(t.id);
|
||||||
|
|
||||||
RETURN vIsTooLittle;
|
RETURN vIsTooLittle;
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -8,17 +8,27 @@ BEGIN
|
||||||
*
|
*
|
||||||
* @param vSelf Id del ticket
|
* @param vSelf Id del ticket
|
||||||
*/
|
*/
|
||||||
|
DECLARE vTicketIsTooLittle BOOL;
|
||||||
|
|
||||||
|
SELECT ticket_isTooLittle(vSelf) INTO vTicketIsTooLittle;
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||||
(INDEX(ticketFk, isProblemCalcNeeded))
|
(INDEX(ticketFk, isProblemCalcNeeded))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT vSelf ticketFk,
|
WITH ticketData AS (
|
||||||
ticket_isTooLittle(vSelf) hasProblem,
|
SELECT addressFk, DATE(shipped) dated
|
||||||
ticket_isProblemCalcNeeded(vSelf) isProblemCalcNeeded;
|
FROM vn.ticket
|
||||||
|
WHERE id = vSelf
|
||||||
|
)
|
||||||
|
SELECT t.id ticketFk,
|
||||||
|
vTicketIsTooLittle hasProblem,
|
||||||
|
ticket_isProblemCalcNeeded(t.id) isProblemCalcNeeded
|
||||||
|
FROM vn.ticket t
|
||||||
|
JOIN ticketData td ON td.addressFk = t.addressFk
|
||||||
|
WHERE t.shipped BETWEEN td.dated AND util.dayEnd(td.dated);
|
||||||
|
|
||||||
CALL ticket_setProblem('isTooLittle');
|
CALL ticket_setProblem('isTooLittle');
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.ticket;
|
DROP TEMPORARY TABLE tmp.ticket;
|
||||||
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
|
@ -0,0 +1,5 @@
|
||||||
|
ALTER TABLE vn.ormConfig
|
||||||
|
MODIFY COLUMN id INT NOT NULL,
|
||||||
|
DROP PRIMARY KEY,
|
||||||
|
ADD CONSTRAINT ormConfig_check CHECK (id = 1),
|
||||||
|
ADD PRIMARY KEY (id);
|
|
@ -56,6 +56,8 @@ export default class App {
|
||||||
}
|
}
|
||||||
|
|
||||||
getUrl(route, appName = 'lilium') {
|
getUrl(route, appName = 'lilium') {
|
||||||
|
const index = window.location.hash.indexOf(route.toLowerCase());
|
||||||
|
const newRoute = index < 0 ? route : window.location.hash.substring(index);
|
||||||
const env = process.env.NODE_ENV;
|
const env = process.env.NODE_ENV;
|
||||||
const filter = {
|
const filter = {
|
||||||
where: {and: [
|
where: {and: [
|
||||||
|
@ -67,7 +69,7 @@ export default class App {
|
||||||
return this.logger.$http.get('Urls/findOne', {filter})
|
return this.logger.$http.get('Urls/findOne', {filter})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res && res.data)
|
if (res && res.data)
|
||||||
return res.data.url + route;
|
return res.data.url + newRoute;
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.showError('Direction not found');
|
this.showError('Direction not found');
|
||||||
|
|
|
@ -108,7 +108,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
async function notifyStateChange(ctx, workerId, claim, newState) {
|
async function notifyStateChange(ctx, workerId, claim, newState) {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const url = await models.Url.getUrl('lilium');
|
const url = await models.Url.getUrl();
|
||||||
const $t = ctx.req.__;
|
const $t = ctx.req.__;
|
||||||
|
|
||||||
const message = $t(`Claim state has changed to`, {
|
const message = $t(`Claim state has changed to`, {
|
||||||
|
@ -122,7 +122,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
async function notifyPickUp(ctx, workerId, claim) {
|
async function notifyPickUp(ctx, workerId, claim) {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const url = await models.Url.getUrl('lilium');
|
const url = await models.Url.getUrl();
|
||||||
const $t = ctx.req.__; // $translate
|
const $t = ctx.req.__; // $translate
|
||||||
|
|
||||||
const message = $t('Claim will be picked', {
|
const message = $t('Claim will be picked', {
|
||||||
|
|
|
@ -7,7 +7,7 @@ export default class Claim extends ModuleMain {
|
||||||
}
|
}
|
||||||
async $onInit() {
|
async $onInit() {
|
||||||
this.$state.go('home');
|
this.$state.go('home');
|
||||||
window.location.href = await this.vnApp.getUrl(`Claim/`);
|
window.location.href = await this.vnApp.getUrl(`claim/`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue