changes in order index
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
d414db73de
commit
c42c6c19d6
|
@ -0,0 +1,47 @@
|
|||
USE `vn`;
|
||||
CREATE
|
||||
OR REPLACE ALGORITHM = UNDEFINED
|
||||
DEFINER = `root`@`%`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn`.`zoneEstimatedDelivery` AS
|
||||
SELECT
|
||||
`t`.`zoneFk` AS `zoneFk`,
|
||||
CAST((CURDATE() + INTERVAL ((HOUR(`zc`.`hour`) * 60) + MINUTE(`zc`.`hour`)) MINUTE)
|
||||
AS TIME) AS `hourTheoretical`,
|
||||
CAST(SUM(`sv`.`volume`) AS DECIMAL (5 , 1 )) AS `totalVolume`,
|
||||
CAST(SUM(IF((`s`.`alertLevel` < 2),
|
||||
`sv`.`volume`,
|
||||
0))
|
||||
AS DECIMAL (5 , 1 )) AS `remainingVolume`,
|
||||
GREATEST(IFNULL(`lhp`.`m3`, 0),
|
||||
IFNULL(`dl`.`minSpeed`, 0)) AS `speed`,
|
||||
CAST((`zc`.`hour` + INTERVAL ((-(SUM(IF((`s`.`alertLevel` < 2),
|
||||
`sv`.`volume`,
|
||||
0))) * 60) / GREATEST(IFNULL(`lhp`.`m3`, 0),
|
||||
IFNULL(`dl`.`minSpeed`, 0))) MINUTE)
|
||||
AS TIME) AS `hourEffective`,
|
||||
FLOOR(((-(SUM(IF((`s`.`alertLevel` < 2),
|
||||
`sv`.`volume`,
|
||||
0))) * 60) / GREATEST(IFNULL(`lhp`.`m3`, 0),
|
||||
IFNULL(`dl`.`minSpeed`, 0)))) AS `minutesLess`,
|
||||
CAST((`zc`.`hour` + INTERVAL ((-(SUM(IF((`s`.`alertLevel` < 2),
|
||||
`sv`.`volume`,
|
||||
0))) * 60) / GREATEST(IFNULL(`lhp`.`m3`, 0),
|
||||
IFNULL(`dl`.`minSpeed`, 0))) MINUTE)
|
||||
AS TIME) AS `etc`
|
||||
FROM
|
||||
((((((((`ticket` `t`
|
||||
JOIN `ticketStateToday` `tst` ON ((`tst`.`ticket` = `t`.`id`)))
|
||||
JOIN `state` `s` ON ((`s`.`id` = `tst`.`state`)))
|
||||
JOIN `saleVolume` `sv` ON ((`sv`.`ticketFk` = `t`.`id`)))
|
||||
LEFT JOIN `lastHourProduction` `lhp` ON ((`lhp`.`warehouseFk` = `t`.`warehouseFk`)))
|
||||
JOIN `warehouse` `w` ON ((`w`.`id` = `t`.`warehouseFk`)))
|
||||
JOIN `warehouseAlias` `wa` ON ((`wa`.`id` = `w`.`aliasFk`)))
|
||||
LEFT JOIN `zoneClosure` `zc` ON (((`zc`.`zoneFk` = `t`.`zoneFk`)
|
||||
AND (`zc`.`dated` = CURDATE()))))
|
||||
LEFT JOIN `cache`.`departure_limit` `dl` ON (((`dl`.`warehouse_id` = `t`.`warehouseFk`)
|
||||
AND (`dl`.`fecha` = CURDATE()))))
|
||||
WHERE
|
||||
((`wa`.`name` = 'Silla')
|
||||
AND (CAST(`t`.`shipped` AS DATE) = CURDATE()))
|
||||
GROUP BY `t`.`zoneFk`;
|
|
@ -0,0 +1,16 @@
|
|||
CREATE
|
||||
OR REPLACE ALGORITHM = UNDEFINED
|
||||
DEFINER = `root`@`%`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn`.`zone_ETD` AS
|
||||
SELECT
|
||||
`zed`.`zoneFk` AS `zoneFk`,
|
||||
`zed`.`hourTheoretical` AS `HoraTeórica`,
|
||||
`zed`.`totalVolume` AS `volumenTotal`,
|
||||
`zed`.`remainingVolume` AS `volumenPendiente`,
|
||||
`zed`.`speed` AS `velocidad`,
|
||||
`zed`.`hourEffective` AS `HoraPráctica`,
|
||||
`zed`.`minutesLess` AS `minutesLess`,
|
||||
`zed`.`etc` AS `etc`
|
||||
FROM
|
||||
`vn`.`zoneEstimatedDelivery` `zed`
|
|
@ -88,13 +88,18 @@ INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`,
|
|||
(19,'Francia', 1, 'FR', 1, 27),
|
||||
(30,'Canarias', 1, 'IC', 1, 24);
|
||||
|
||||
INSERT INTO `vn`.`warehouse`(`id`, `name`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`, `hasStowaway`, `hasDms`, `hasComission`)
|
||||
INSERT INTO `vn`.`warehouseAlias`(`id`, `name`)
|
||||
VALUES
|
||||
(1, 'Warehouse One', 1, 1, 1, 1, 1, 1, 1),
|
||||
(2, 'Warehouse Two', 1, 1, 1, 1, 0, 0, 1),
|
||||
(3, 'Warehouse Three', 1, 1, 1, 1, 0, 0, 0),
|
||||
(4, 'Warehouse Four', 1, 1, 1, 1, 0, 0, 0),
|
||||
(5, 'Warehouse Five', 1, 1, 1, 1, 0, 0, 0);
|
||||
(1, 'Main Warehouse'),
|
||||
(2, 'Silla');
|
||||
|
||||
INSERT INTO `vn`.`warehouse`(`id`, `name`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`, `hasStowaway`, `hasDms`, `hasComission`, `aliasFk`)
|
||||
VALUES
|
||||
(1, 'Warehouse One', 1, 1, 1, 1, 1, 1, 1, 2),
|
||||
(2, 'Warehouse Two', 1, 1, 1, 1, 0, 0, 1, 2),
|
||||
(3, 'Warehouse Three', 1, 1, 1, 1, 0, 0, 0, 2),
|
||||
(4, 'Warehouse Four', 1, 1, 1, 1, 0, 0, 0, 2),
|
||||
(5, 'Warehouse Five', 1, 1, 1, 1, 0, 0, 0, 2);
|
||||
|
||||
INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `isPreviousPreparedByPacking`, `code`, `pickingPlacement`, `path`)
|
||||
VALUES
|
||||
|
@ -111,10 +116,6 @@ INSERT INTO `vn`.`shelving` (`code`, `parkingFk`, `isPrinted`, `priority`, `park
|
|||
('GVC', '1', '0', '1', '0', '106'),
|
||||
('HEJ', '2', '0', '1', '0', '106');
|
||||
|
||||
INSERT INTO `vn`.`warehouseAlias`(`id`, `name`)
|
||||
VALUES
|
||||
(1, 'Main Warehouse');
|
||||
|
||||
INSERT INTO `vn`.`accountingType`(`id`, `description`)
|
||||
VALUES
|
||||
(1, 'Digital money'),
|
||||
|
@ -511,6 +512,22 @@ INSERT INTO `vn`.`zoneWarehouse` (`id`, `zoneFk`, `warehouseFk`)
|
|||
(12, 12, 4),
|
||||
(13, 13, 5);
|
||||
|
||||
INSERT INTO `vn`.`zoneClosure` (`zoneFk`, `dated`, `hour`)
|
||||
VALUES
|
||||
(1, CURDATE(), '23:59'),
|
||||
(2, CURDATE(), '23:59'),
|
||||
(3, CURDATE(), '23:59'),
|
||||
(4, CURDATE(), '23:59'),
|
||||
(5, CURDATE(), '23:59'),
|
||||
(6, CURDATE(), '23:59'),
|
||||
(7, CURDATE(), '23:59'),
|
||||
(8, CURDATE(), '23:59'),
|
||||
(9, CURDATE(), '23:59'),
|
||||
(10, CURDATE(), '23:59'),
|
||||
(11, CURDATE(), '23:59'),
|
||||
(12, CURDATE(), '23:59'),
|
||||
(13, CURDATE(), '23:59');
|
||||
|
||||
INSERT INTO `vn`.`zoneConfig` (`scope`) VALUES ('1');
|
||||
|
||||
INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`, `zoneFk`)
|
||||
|
|
|
@ -8,6 +8,7 @@ describe('Order summary path', () => {
|
|||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'order');
|
||||
await page.waitFor(2000);
|
||||
await page.accessToSearchResult('16');
|
||||
});
|
||||
|
||||
|
|
|
@ -157,14 +157,20 @@ module.exports = Self => {
|
|||
c.salesPersonFk,
|
||||
u.nickname workerNickname,
|
||||
u.name name,
|
||||
co.code companyCode
|
||||
co.code companyCode,
|
||||
zed.zoneFk,
|
||||
zed.hourTheoretical,
|
||||
zed.hourEffective
|
||||
FROM hedera.order o
|
||||
LEFT JOIN address a ON a.id = o.address_id
|
||||
LEFT JOIN agencyMode am ON am.id = o.agency_id
|
||||
LEFT JOIN client c ON c.id = o.customer_id
|
||||
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
||||
LEFT JOIN account.user u ON u.id = wk.userFk
|
||||
LEFT JOIN company co ON co.id = o.company_id`);
|
||||
LEFT JOIN company co ON co.id = o.company_id
|
||||
LEFT JOIN orderTicket ot ON ot.orderFk = o.id
|
||||
LEFT JOIN ticket t ON t.id = ot.ticketFk
|
||||
LEFT JOIN zoneEstimatedDelivery zed ON zed.zoneFk = t.zoneFk`);
|
||||
|
||||
if (args && args.ticketFk) {
|
||||
stmt.merge({
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
<vn-th field="isConfirmed" center>Confirmed</vn-th>
|
||||
<vn-th field="created" center>Created</vn-th>
|
||||
<vn-th field="landed" default-order="DESC" center>Landed</vn-th>
|
||||
<vn-th field="created" center title ="Theoretical hour" >T. Hour</vn-th>
|
||||
<vn-th field="created" center>Real hour </vn-th>
|
||||
<vn-th center>Total</vn-th>
|
||||
</vn-tr>
|
||||
</vn-thead>
|
||||
|
@ -50,6 +52,8 @@
|
|||
{{::order.landed | date:'dd/MM/yyyy'}}
|
||||
</span>
|
||||
</vn-td>
|
||||
<vn-td shrink>{{::order.hourTheoretical | date: 'HH:mm'}}</vn-td>
|
||||
<vn-td shrink>{{::ticket.hourEffective | date: 'HH:mm'}}</vn-td>
|
||||
<vn-td number>{{::order.total | currency: 'EUR': 2 | dashIfEmpty}}</vn-td>
|
||||
<vn-td shrink>
|
||||
<vn-icon-button
|
||||
|
|
|
@ -3,7 +3,6 @@ import Section from 'salix/components/section';
|
|||
|
||||
export default class Controller extends Section {
|
||||
preview(order) {
|
||||
console.log('order', order);
|
||||
this.selectedOrder = order;
|
||||
this.$.summary.show();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
import './index.js';
|
||||
describe('Component vnOrderIndex', () => {
|
||||
let controller;
|
||||
let $window;
|
||||
let orders = [{
|
||||
id: 1,
|
||||
clientFk: 1,
|
||||
isConfirmed: false
|
||||
}, {
|
||||
id: 2,
|
||||
clientFk: 1,
|
||||
isConfirmed: false
|
||||
}, {
|
||||
id: 3,
|
||||
clientFk: 1,
|
||||
isConfirmed: true
|
||||
}];
|
||||
|
||||
beforeEach(ngModule('order'));
|
||||
|
||||
beforeEach(inject(($componentController, _$window_,) => {
|
||||
$window = _$window_;
|
||||
const $element = angular.element('<vn-order-index></vn-order-index>');
|
||||
controller = $componentController('vnOrderIndex', {$element});
|
||||
}));
|
||||
|
||||
describe('compareDate()', () => {
|
||||
it('should return warning when the date is the present', () => {
|
||||
let curDate = new Date();
|
||||
let result = controller.compareDate(curDate);
|
||||
|
||||
expect(result).toEqual('warning');
|
||||
});
|
||||
|
||||
it('should return sucess when the date is in the future', () => {
|
||||
let futureDate = new Date();
|
||||
futureDate = futureDate.setDate(futureDate.getDate() + 10);
|
||||
let result = controller.compareDate(futureDate);
|
||||
|
||||
expect(result).toEqual('success');
|
||||
});
|
||||
|
||||
it('should return undefined when the date is in the past', () => {
|
||||
let pastDate = new Date();
|
||||
pastDate = pastDate.setDate(pastDate.getDate() - 10);
|
||||
let result = controller.compareDate(pastDate);
|
||||
|
||||
expect(result).toEqual(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
describe('preview()', () => {
|
||||
it('should show the dialog summary', () => {
|
||||
controller.$.summary = {show: () => {}};
|
||||
jest.spyOn(controller.$.summary, 'show');
|
||||
|
||||
let event = new MouseEvent('click', {
|
||||
view: $window,
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
});
|
||||
controller.preview(event, orders[0]);
|
||||
|
||||
expect(controller.$.summary.show).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -28,5 +28,8 @@
|
|||
},
|
||||
"ZoneWarehouse": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"ZoneEstimatedDelivery": {
|
||||
"dataSource": "vn"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"name": "ZoneEstimatedDelivery",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "zoneEstimatedDelivery"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"zoneFk": {
|
||||
"id": true,
|
||||
"type": "Number"
|
||||
},
|
||||
"hourTheoretical": {
|
||||
"type": "date"
|
||||
},
|
||||
"totalVolume": {
|
||||
"type": "Number"
|
||||
},
|
||||
"remainingVolume": {
|
||||
"type": "Number"
|
||||
},
|
||||
"speed": {
|
||||
"type": "Number"
|
||||
},
|
||||
"hourEffective": {
|
||||
"type": "Date"
|
||||
},
|
||||
"minutesLess": {
|
||||
"type": "Date"
|
||||
},
|
||||
"etc": {
|
||||
"type": "Date"
|
||||
}
|
||||
|
||||
},
|
||||
"relations": {
|
||||
"zone": {
|
||||
"type": "belongsTo",
|
||||
"model": "Zone",
|
||||
"foreignKey": "zoneFk"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue