Compare commits
2 Commits
dev
...
6941-dmsHa
Author | SHA1 | Date |
---|---|---|
Juanjo Breso | 0d06a7a7e0 | |
Juanjo Breso | 9cc714e045 |
|
@ -36,7 +36,3 @@ rules:
|
||||||
jasmine/no-focused-tests: 0
|
jasmine/no-focused-tests: 0
|
||||||
jasmine/prefer-toHaveBeenCalledWith: 0
|
jasmine/prefer-toHaveBeenCalledWith: 0
|
||||||
arrow-spacing: ["error", { "before": true, "after": true }]
|
arrow-spacing: ["error", { "before": true, "after": true }]
|
||||||
no-restricted-syntax:
|
|
||||||
- "error"
|
|
||||||
- selector: "NewExpression[callee.name='Date']"
|
|
||||||
message: "Use Date.vnNew() instead of new Date()."
|
|
||||||
|
|
254
CHANGELOG.md
254
CHANGELOG.md
|
@ -1,257 +1,3 @@
|
||||||
# Version 24.38 - 2024-09-17
|
|
||||||
|
|
||||||
### Added 🆕
|
|
||||||
|
|
||||||
- chore: refs #7323 filter data by:jorgep
|
|
||||||
- chore: refs #7323 fix test by:jorgep
|
|
||||||
- chore: refs #7323 worker changes by:jorgep
|
|
||||||
- chore: refs #7323 worker changes wip by:jorgep
|
|
||||||
- chore: refs #7524 add select limit by:jorgep
|
|
||||||
- feat(AccessToken&ACL): refs #7547 upgrade security by:alexm
|
|
||||||
- feat: deleted code and redirect to Lilium by:Jon
|
|
||||||
- feat: refs #4515 New throw buy_checkItem by:guillermo
|
|
||||||
- feat: refs #6650 Added saleGroupLog by:guillermo
|
|
||||||
- feat: refs #6650 new itemShelvingLog by:guillermo
|
|
||||||
- feat: refs #6760 refs #actualiza campo nickname by:jgallego
|
|
||||||
- feat: refs #7277 fdescribe by:jgallego
|
|
||||||
- feat: refs #7277 fit by:jgallego
|
|
||||||
- feat: refs #7277 refundInvoices by:jgallego
|
|
||||||
- feat: refs #7277 test with warehouse by:jgallego
|
|
||||||
- feat: refs #7277 traducciones by:jgallego
|
|
||||||
- feat: refs #7277 transfer addressFk by:jgallego
|
|
||||||
- feat: refs #7532 Requested changes by:guillermo
|
|
||||||
- feat: refs #7564 Added proc by:guillermo
|
|
||||||
- feat: refs #7564 Added ticket_setVolumeItemCost by:guillermo
|
|
||||||
- feat: refs #7564 Added volume column by:guillermo
|
|
||||||
- feat: refs #7564 Fix version by:guillermo
|
|
||||||
- feat: refs #7564 Requested changes by:guillermo
|
|
||||||
- feat: refs #7615 setDeleted by:robert
|
|
||||||
- feat: refs #7650 Added no transfer lines to inventory entry and fixtures by:guillermo
|
|
||||||
- feat: refs #7650 Fix tests by:guillermo
|
|
||||||
- feat: refs #7747 Delete buyUltimate and buyUltimateFromInterval by:ivanm
|
|
||||||
- feat: refs #7759 Changed defined only of vn objects by:guillermo
|
|
||||||
- feat: refs #7759 Changed definer root to vn-admin by:guillermo
|
|
||||||
- feat: refs #7759 Changed name by:guillermo
|
|
||||||
- feat: refs #7759 Deleted version 11163-maroonEucalyptus by:guillermo
|
|
||||||
- feat: refs #7759 Revoke routine grants vn by:guillermo
|
|
||||||
- feat: refs #7811 Added comment by:guillermo
|
|
||||||
- feat: refs #7811 Added new params in datasources.json by:guillermo
|
|
||||||
- feat: refs #7898 Add column "floor" in vn.parking by:ivanm
|
|
||||||
- feat: refs #7898 Modify default by:ivanm
|
|
||||||
- feat: refs #7905 Added new method getBuysCsv by:guillermo
|
|
||||||
- feat: refs #7905 Added param toCsv by:guillermo
|
|
||||||
- feat: refs #7938 remove unnecessary insert in clientLog by:alexm
|
|
||||||
- feat: refs #7953 pullinfo (7953-devToTest_2438) by:alexm
|
|
||||||
- feat(salix): #7671 define isDestiny field in model by:Javier Segarra
|
|
||||||
- feat(salix): refs #7896 update version and changelog (origin/7896_down_devToTest_2436) by:Javier Segarra
|
|
||||||
- feat(salix): refs #7905 #7905 use getBuys toCSV flattened by:Javier Segarra
|
|
||||||
- feat(ssalix): refs #7671 #7671 checkDates by:Javier Segarra
|
|
||||||
- feat(ssalix): refs #7671 #7671 checkDates to present by:Javier Segarra
|
|
||||||
- feat: ticket 215005 Changed acl show transferClient by:guillermo
|
|
||||||
|
|
||||||
### Changed 📦
|
|
||||||
|
|
||||||
- perf: refs #7671 improve showBadDates by:Javier Segarra
|
|
||||||
- perf(salix): refs #7671 #7671 imrpove and revert where changes by:Javier Segarra
|
|
||||||
- refactor: deleted e2e & added back descriptor and summary by:Jon
|
|
||||||
|
|
||||||
### Fixed 🛠️
|
|
||||||
|
|
||||||
- chore: refs #7323 fix test by:jorgep
|
|
||||||
- feat: refs #7650 Added no transfer lines to inventory entry and fixtures by:guillermo
|
|
||||||
- fix by:guillermo
|
|
||||||
- fixes: refs #7760 collection problems by:Carlos Andrés
|
|
||||||
- fix merge dev (7407-workerMedical) by:alexm
|
|
||||||
- fix: refs #6727 No delete log tables data in clean procedures by:guillermo
|
|
||||||
- fix: refs #6897 back and tests by:carlossa
|
|
||||||
- fix: refs #6897 back by:carlossa
|
|
||||||
- fix: refs #6897 fix filter by:carlossa
|
|
||||||
- fix: refs #6897 fix json by:carlossa
|
|
||||||
- fix: refs #6897 travel filter by:carlossa
|
|
||||||
- fix: refs #6897 error test by:jgallego
|
|
||||||
- fix: refs #7323 fetch from right source by:jorgep
|
|
||||||
- fix: refs #7564 Deleted query by:guillermo
|
|
||||||
- fix: refs #7759 Added user 'vn'@'localhost' & grants by:guillermo
|
|
||||||
- fix: refs #7760 collection problems by:Carlos Andrés
|
|
||||||
- fix: refs #7760 tmp.ticketIPT by:Carlos Andrés
|
|
||||||
- fix: refs #7905 added comments to flatten.js by:guillermo
|
|
||||||
- fix: refs ##7905 Handle error by:guillermo
|
|
||||||
- fix(salix): refs #7905 #7905 use right fn to flatten data by:Javier Segarra
|
|
||||||
- perf(salix): refs #7671 #7671 imrpove and revert where changes by:Javier Segarra
|
|
||||||
- refs #6898 fix supplier remove by:carlossa
|
|
||||||
- refs #7407 fix acls fixtures by:carlossa
|
|
||||||
- test: fix connections e2e (7547-accessToken-security) by:alexm
|
|
||||||
- test: refs #7277 fix test proposal by:Javier Segarra
|
|
||||||
- test(salix): refs #7671 #7671 improve and revert where changes by:Javier Segarra
|
|
||||||
|
|
||||||
# Version 24.36 - 2024-09-03
|
|
||||||
|
|
||||||
### Added 🆕
|
|
||||||
|
|
||||||
- chore: refs #7524 WIP limit call by:jorgep
|
|
||||||
- chore: refs #7524 modify ormConfig table col (origin/7524-warmfix-modifyColumn) by:jorgep
|
|
||||||
- feat(update-user): refs #7848 add twoFactor by:alexm
|
|
||||||
- feat: #3199 Requested changes by:guillermo
|
|
||||||
- feat: refs #3199 Added more scopes ticket_recalcByScope by:guillermo
|
|
||||||
- feat: refs #3199 Added one more scope ticket_recalcByScope by:guillermo
|
|
||||||
- feat: refs #3199 Created ticket_recalcItemTaxCountryByScope by:guillermo
|
|
||||||
- feat: refs #3199 Requested changes by:guillermo
|
|
||||||
- feat: refs #7346 add multiple feature by:jgallego
|
|
||||||
- feat: refs #7346 backTest checks new implementation by:jgallego
|
|
||||||
- feat: refs #7346 mas intuitivo by:jgallego
|
|
||||||
- feat: refs #7514 Changes to put srt log (origin/7514-srtLog) by:guillermo
|
|
||||||
- feat: refs #7524 add default limit (origin/7524-limitSelect) by:jorgep
|
|
||||||
- feat: refs #7524 add mock limit on find query by:jorgep
|
|
||||||
- feat: refs #7524 wip remote hooks by:jorgep
|
|
||||||
- feat: refs #7562 Requested changes by:guillermo
|
|
||||||
- feat: refs #7567 Changed time to call event by:guillermo
|
|
||||||
- feat: refs #7567 Requested changes by:guillermo
|
|
||||||
- feat: refs #7710 pr revision by:jgallego
|
|
||||||
- feat: refs #7710 test fixed (origin/7710-cloneWithTicketPackaging, 7710-cloneWithTicketPackaging) by:jgallego
|
|
||||||
- feat: refs #7712 Fix by:guillermo
|
|
||||||
- feat: refs #7712 Unify by:guillermo
|
|
||||||
- feat: refs #7712 sizeLimit (origin/7712-sizeLimit) by:guillermo
|
|
||||||
- feat: refs #7758 Add code mandateType and accountDetailType by:ivanm
|
|
||||||
- feat: refs #7758 Modify code lowerCamelCase and UNIQUE by:ivanm
|
|
||||||
- feat: refs #7758 accountDetailType fix deploy error by:ivanm
|
|
||||||
- feat: refs #7784 Changes in entry-order-pdf by:guillermo
|
|
||||||
- feat: refs #7784 Requested changes by:guillermo
|
|
||||||
- feat: refs #7799 Added Fk in vn.item.itemPackingTypeFk by:guillermo
|
|
||||||
- feat: refs #7800 Added company Fk by:guillermo
|
|
||||||
- feat: refs #7842 Added editorFk in vn.host by:guillermo
|
|
||||||
- feat: refs #7860 Update new packagings (origin/7860-newPackaging) by:guillermo
|
|
||||||
- feat: refs #7862 roadmap new fields by:ivanm
|
|
||||||
- feat: refs #7882 Added quadMindsConfig table by:guillermo
|
|
||||||
|
|
||||||
### Changed 📦
|
|
||||||
|
|
||||||
- refactor: refs #7567 Fix and improvement by:guillermo
|
|
||||||
- refactor: refs #7567 Minor change by:guillermo
|
|
||||||
- refactor: refs #7756 Fix tests by:guillermo
|
|
||||||
- refactor: refs #7798 Drop bi.Greuges_comercial_detail by:guillermo
|
|
||||||
- refactor: refs #7848 adapt to lilium by:alexm
|
|
||||||
|
|
||||||
### Fixed 🛠️
|
|
||||||
|
|
||||||
- feat: refs #7710 test fixed (origin/7710-cloneWithTicketPackaging, 7710-cloneWithTicketPackaging) by:jgallego
|
|
||||||
- feat: refs #7758 accountDetailType fix deploy error by:ivanm
|
|
||||||
- fix(salix): #7283 ItemFixedPrice duplicated (origin/7283_itemFixedPrice_duplicated) by:Javier Segarra
|
|
||||||
- fix: refs #7346 minor error (origin/7346, 7346) by:jgallego
|
|
||||||
- fix: refs #7355 remove and tests accounts (origin/7355-accountMigration2) by:carlossa
|
|
||||||
- fix: refs #7355 remove and tests accounts by:carlossa
|
|
||||||
- fix: refs #7524 default limit select by:jorgep
|
|
||||||
- fix: refs #7756 Foreign keys invoiceOut (origin/7756-fixRefFk) by:guillermo
|
|
||||||
- fix: refs #7756 id 0 by:guillermo
|
|
||||||
- fix: refs #7800 tpvMerchantEnable PRIMARY KEY (origin/7800-tpvMerchantEnable) by:guillermo
|
|
||||||
- fix: refs #7800 tpvMerchantEnable PRIMARY KEY by:guillermo
|
|
||||||
- fix: refs #7916 itemShelving_transfer (origin/test, test) by:guillermo
|
|
||||||
- fix: refs #pako Deleted duplicated version by:guillermo
|
|
||||||
|
|
||||||
# Version 24.34 - 2024-08-20
|
|
||||||
|
|
||||||
### Added 🆕
|
|
||||||
|
|
||||||
- #6900 feat: clear empty by:jorgep
|
|
||||||
- #6900 feat: empty commit by:jorgep
|
|
||||||
- chore: refs #6900 beautify code by:jorgep
|
|
||||||
- chore: refs #6989 add config model by:jorgep
|
|
||||||
- feat workerActivity refs #6078 by:sergiodt
|
|
||||||
- feat: #6453 Refactor (origin/6453-orderConfirm) by:guillermo
|
|
||||||
- feat: #6453 Rollback always split by itemPackingType by:guillermo
|
|
||||||
- feat: deleted worker module code & redirect to Lilium by:Jon
|
|
||||||
- feat: refs #6453 Added new ticket search by:guillermo
|
|
||||||
- feat: refs #6453 Fixes by:guillermo
|
|
||||||
- feat: refs #6453 Minor changes by:guillermo
|
|
||||||
- feat: refs #6453 Requested changes by:guillermo
|
|
||||||
- feat: refs #6900 drop section by:jorgep
|
|
||||||
- feat: refs #7283 order by desc date by:jorgep
|
|
||||||
- feat: refs #7323 add locale by:jorgep
|
|
||||||
- feat: refs #7323 redirect to lilium by:jorgep
|
|
||||||
- feat: refs #7646 delete scannableCodeType by:robert
|
|
||||||
- feat: refs #7713 Created ACLLog by:guillermo
|
|
||||||
- feat: refs #7774 (origin/7774-ticket_cloneWeekly) by:robert
|
|
||||||
- feat: refs #7774 #7774 Changes ticket_cloneWeekly by:guillermo
|
|
||||||
- feat: refs #7774 ticket_cloneWeekly by:robert
|
|
||||||
|
|
||||||
### Changed 📦
|
|
||||||
|
|
||||||
- refactor: refs #6453 Major changes by:guillermo
|
|
||||||
- refactor: refs #6453 Minor changes by:guillermo
|
|
||||||
- refactor: refs #6453 order_confirmWithUser by:guillermo
|
|
||||||
- refactor: refs #7646 #7646 Deleted scannable* variables productionConfig by:guillermo
|
|
||||||
- refactor: refs #7820 Deprecated silexACL by:guillermo
|
|
||||||
|
|
||||||
### Fixed 🛠️
|
|
||||||
|
|
||||||
- #6900 fix: #6900 rectificative filter by:jorgep
|
|
||||||
- #6900 fix: empty commit by:jorgep
|
|
||||||
- fix(orders_filter): add sourceApp accepts by:alexm
|
|
||||||
- fix: refs #6130 commit lint by:pablone
|
|
||||||
- fix: refs #6453 order_confirmWithUser by:guillermo
|
|
||||||
- fix: refs #7283 sql by:jorgep
|
|
||||||
- fix: refs #7713 ACL Log by:guillermo
|
|
||||||
- test: fix claim descriptor redirect to lilium by:alexm
|
|
||||||
- test: fix ticket redirect to lilium by:alexm
|
|
||||||
- test: fix ticket sale e2e by:alexm
|
|
||||||
|
|
||||||
# Version 24.32 - 2024-08-06
|
|
||||||
|
|
||||||
### Added 🆕
|
|
||||||
|
|
||||||
- chore: refs #7197 add supplierActivityFk filter by:jorgep
|
|
||||||
- feat checkExpeditionPrintOut refs #7751 by:sergiodt
|
|
||||||
- feat(defaulter_filter): add department by:alexm
|
|
||||||
- feat: redirect to lilium page not found by:alexm
|
|
||||||
- feat: refactor buyUltimate refs #7736 by:Carlos Andrés
|
|
||||||
- feat: refs #6403 add delete by:pablone
|
|
||||||
- feat: refs #7126 Added manaClaim calc by:guillermo
|
|
||||||
- feat: refs #7126 Refactor and added columns in bs.waste table & proc by:guillermo
|
|
||||||
- feat: refs #7197 filter by correcting by:jorgep
|
|
||||||
- feat: refs #7297 add new columns by:pablone
|
|
||||||
- feat: refs #7356 new parameters in sql for Weekly tickets front by:Jon
|
|
||||||
- feat: refs #7401 redirect lilium by:pablone
|
|
||||||
- feat: refs #7511 Fix tests by:guillermo
|
|
||||||
- feat: refs #7511 Rename to multiConfig tables by:guillermo
|
|
||||||
- feat: refs #7589 Added display (item_valuateInventory) by:guillermo
|
|
||||||
- feat: refs #7589 Added vItemTypeFk & vItemCategoryFk (item_valuateInventory) by:guillermo
|
|
||||||
- feat: refs #7681 Changes by:guillermo
|
|
||||||
- feat: refs #7681 Optimization and refactor by:guillermo
|
|
||||||
- feat: refs #7683 drop temporary table by:robert
|
|
||||||
- feat: refs #7683 productionControl by:robert
|
|
||||||
- feat: refs #7728 Added throw due date by:guillermo
|
|
||||||
- feat: refs #7740 Ticket before update added restriction by:guillermo
|
|
||||||
- feat(salix): #7648 Add field for endpoint as buyLabel report by:Javier Segarra
|
|
||||||
- feat(salix): #7648 remove white line by:Javier Segarra
|
|
||||||
- feat: tabla config dias margen vctos. refs #7728 by:Carlos Andrés
|
|
||||||
|
|
||||||
### Changed 📦
|
|
||||||
|
|
||||||
- eat: refactor buyUltimate refs #7736 by:Carlos Andrés
|
|
||||||
- feat: refactor buyUltimate refs #7736 by:Carlos Andrés
|
|
||||||
- feat: refs #7681 Optimization and refactor by:guillermo
|
|
||||||
- refactor: refs #7126 Requested changes by:guillermo
|
|
||||||
- refactor: refs #7511 Minor change by:guillermo
|
|
||||||
- refactor: refs #7640 Multipleinventory available by:guillermo
|
|
||||||
- refactor: refs #7681 Changes by:guillermo
|
|
||||||
- refactor: refs #7681 Requested changes by:guillermo
|
|
||||||
|
|
||||||
### Fixed 🛠️
|
|
||||||
|
|
||||||
- add prefix (hotFix_liliumRedirection) by:alexm
|
|
||||||
- fix(client_filter): add recovery by:alexm
|
|
||||||
- fix: defaulter filter correct sql (6943-fix_defaulter_filter) by:alexm
|
|
||||||
- fix(deletExpeditions): merge test → dev by:guillermo
|
|
||||||
- fix: refs #6403 fix mrw cancel shipment return type by:pablone
|
|
||||||
- fix: refs #7126 Added addressWaste type by:guillermo
|
|
||||||
- fix: refs #7126 Fix by:guillermo
|
|
||||||
- fix: refs #7126 Minor change by:guillermo
|
|
||||||
- fix: refs #7126 Primary key no unique data by:guillermo
|
|
||||||
- fix: refs #7126 Slow update by:guillermo
|
|
||||||
- fix: refs #7511 Minor change by:guillermo
|
|
||||||
- fix: refs #7546 Deleted insert util.binlogQueue by:guillermo
|
|
||||||
- fix: refs #7811 Variables pm2 by:guillermo
|
|
||||||
- fix: without path by:alexm
|
|
||||||
|
|
||||||
# Version 24.28 - 2024-07-09
|
# Version 24.28 - 2024-07-09
|
||||||
|
|
||||||
### Added 🆕
|
### Added 🆕
|
||||||
|
|
|
@ -32,7 +32,8 @@ RUN apt-get update \
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
samba-common-bin samba-dsdb-modules\
|
samba-common-bin samba-dsdb-modules\
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& npm -g install pm2
|
||||||
|
|
||||||
# Salix
|
# Salix
|
||||||
|
|
||||||
|
@ -54,4 +55,7 @@ COPY \
|
||||||
README.md \
|
README.md \
|
||||||
./
|
./
|
||||||
|
|
||||||
CMD ["node", "--tls-min-v1.0", "--openssl-legacy-provider", "./loopback/server/server.js"]
|
CMD ["pm2-runtime", "./back/process.yml"]
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=15s --timeout=10s \
|
||||||
|
CMD curl -f http://localhost:3000/api/Applications/status || exit 1
|
||||||
|
|
|
@ -19,15 +19,8 @@ module.exports = Self => {
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
const [info, info2, [{'@vCollectionFk': collectionFk}]] = await Self.rawSql(
|
||||||
const randStr = Math.random().toString(36).substring(3);
|
'CALL vn.collection_getAssigned(?, @vCollectionFk);SELECT @vCollectionFk', [userId], myOptions);
|
||||||
const result = await Self.rawSql(`
|
|
||||||
CALL vn.collection_getAssigned(?, @vCollectionFk);
|
|
||||||
SELECT @vCollectionFk ?
|
|
||||||
`, [userId, randStr], myOptions);
|
|
||||||
|
|
||||||
const collectionFk = result.find(item => item[0]?.[randStr] !== undefined)?.[0]?.[randStr];
|
|
||||||
|
|
||||||
if (!collectionFk) throw new UserError('There are not picking tickets');
|
if (!collectionFk) throw new UserError('There are not picking tickets');
|
||||||
await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk], myOptions);
|
await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk], myOptions);
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,10 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.getSales = async(ctx, collectionOrTicketFk, print, source, options) => {
|
Self.getSales = async(ctx, collectionOrTicketFk, print, source, options) => {
|
||||||
|
const models = Self.app.models;
|
||||||
const userId = ctx.req.accessToken.userId;
|
const userId = ctx.req.accessToken.userId;
|
||||||
const myOptions = {userId};
|
const myOptions = {userId};
|
||||||
|
const $t = ctx.req.__;
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
@ -57,6 +59,22 @@ module.exports = Self => {
|
||||||
|
|
||||||
if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions);
|
if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions);
|
||||||
|
|
||||||
|
for (let ticket of tickets) {
|
||||||
|
if (ticket.observaciones) {
|
||||||
|
let observations = ticket.observaciones.split(' ');
|
||||||
|
|
||||||
|
for (let observation of observations) {
|
||||||
|
const salesPerson = ticket.salesPersonFk;
|
||||||
|
if (observation.startsWith('#') || observation.startsWith('@')) {
|
||||||
|
await models.Chat.send(ctx,
|
||||||
|
observation,
|
||||||
|
$t('ticketCommercial', {ticket: ticket.ticketFk, salesPerson})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return getCollection(id, tickets, sales, placements, myOptions);
|
return getCollection(id, tickets, sales, placements, myOptions);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -57,13 +57,12 @@ module.exports = Self => {
|
||||||
ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY pickingOrder) currentItemShelving,
|
ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY pickingOrder) currentItemShelving,
|
||||||
COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) totalItemShelving,
|
COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) totalItemShelving,
|
||||||
sh.code,
|
sh.code,
|
||||||
p2.code parkingCodePrevia,
|
p2.code parkingCode,
|
||||||
p2.pickingOrder pickingOrderPrevia,
|
p2.pickingOrder pickingOrder,
|
||||||
p.code parkingCode,
|
p.code parkingCodePrevia,
|
||||||
p.pickingOrder pickingOrder,
|
p.pickingOrder pickingOrderPrevia,
|
||||||
iss.id itemShelvingSaleFk,
|
iss.id itemShelvingSaleFk,
|
||||||
iss.isPicked,
|
iss.isPicked
|
||||||
iss.itemShelvingFk
|
|
||||||
FROM ticketCollection tc
|
FROM ticketCollection tc
|
||||||
LEFT JOIN collection c ON c.id = tc.collectionFk
|
LEFT JOIN collection c ON c.id = tc.collectionFk
|
||||||
JOIN sale s ON s.ticketFk = tc.ticketFk
|
JOIN sale s ON s.ticketFk = tc.ticketFk
|
||||||
|
@ -73,7 +72,7 @@ module.exports = Self => {
|
||||||
JOIN item i ON i.id = s.itemFk
|
JOIN item i ON i.id = s.itemFk
|
||||||
JOIN itemShelvingSale iss ON iss.saleFk = s.id
|
JOIN itemShelvingSale iss ON iss.saleFk = s.id
|
||||||
LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
||||||
LEFT JOIN shelving sh ON sh.id = ish.shelvingFk
|
LEFT JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||||
LEFT JOIN parking p ON p.id = sh.parkingFk
|
LEFT JOIN parking p ON p.id = sh.parkingFk
|
||||||
LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk
|
LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk
|
||||||
LEFT JOIN origin o ON o.id = i.originFk
|
LEFT JOIN origin o ON o.id = i.originFk
|
||||||
|
@ -103,8 +102,7 @@ module.exports = Self => {
|
||||||
p.code,
|
p.code,
|
||||||
p.pickingOrder,
|
p.pickingOrder,
|
||||||
iss.id itemShelvingSaleFk,
|
iss.id itemShelvingSaleFk,
|
||||||
iss.isPicked,
|
iss.isPicked
|
||||||
iss.itemShelvingFk
|
|
||||||
FROM sectorCollection sc
|
FROM sectorCollection sc
|
||||||
JOIN sectorCollectionSaleGroup ss ON ss.sectorCollectionFk = sc.id
|
JOIN sectorCollectionSaleGroup ss ON ss.sectorCollectionFk = sc.id
|
||||||
JOIN saleGroup sg ON sg.id = ss.saleGroupFk
|
JOIN saleGroup sg ON sg.id = ss.saleGroupFk
|
||||||
|
@ -114,7 +112,7 @@ module.exports = Self => {
|
||||||
JOIN item i ON i.id = s.itemFk
|
JOIN item i ON i.id = s.itemFk
|
||||||
JOIN itemShelvingSale iss ON iss.saleFk = s.id
|
JOIN itemShelvingSale iss ON iss.saleFk = s.id
|
||||||
LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
||||||
LEFT JOIN shelving sh ON sh.id = ish.shelvingFk
|
LEFT JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||||
LEFT JOIN parking p ON p.id = sh.parkingFk
|
LEFT JOIN parking p ON p.id = sh.parkingFk
|
||||||
LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk
|
LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk
|
||||||
LEFT JOIN origin o ON o.id = i.originFk
|
LEFT JOIN origin o ON o.id = i.originFk
|
||||||
|
|
|
@ -28,10 +28,9 @@ describe('ticket assign()', () => {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw an error when there are no picking tickets', async() => {
|
it('should throw an error when there is not picking tickets', async() => {
|
||||||
try {
|
try {
|
||||||
await models.Collection.assign(ctx, options);
|
await models.Collection.assign(ctx, options);
|
||||||
fail('Expected an error to be thrown, but none was thrown.');
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
expect(e.message).toEqual('There are not picking tickets');
|
expect(e.message).toEqual('There are not picking tickets');
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,9 @@ describe('ticket assignCollection()', () => {
|
||||||
args: {}
|
args: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({active: ctx.req});
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: ctx.req
|
||||||
|
});
|
||||||
|
|
||||||
options = {transaction: tx};
|
options = {transaction: tx};
|
||||||
tx = await models.Sale.beginTransaction({});
|
tx = await models.Sale.beginTransaction({});
|
||||||
|
@ -23,7 +25,7 @@ describe('ticket assignCollection()', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async() => {
|
afterEach(async() => {
|
||||||
if (tx) await tx.rollback();
|
await tx.rollback();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw an error when there is not picking tickets', async() => {
|
it('should throw an error when there is not picking tickets', async() => {
|
||||||
|
|
|
@ -38,7 +38,7 @@ module.exports = Self => {
|
||||||
{
|
{
|
||||||
arg: 'hasFile',
|
arg: 'hasFile',
|
||||||
type: 'Boolean',
|
type: 'Boolean',
|
||||||
description: 'True if has the original in paper'
|
description: 'True if has an attached file'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'hasFileAttached',
|
arg: 'hasFileAttached',
|
||||||
|
|
|
@ -4,45 +4,21 @@ module.exports = Self => {
|
||||||
/**
|
/**
|
||||||
* Returns basic headers
|
* Returns basic headers
|
||||||
*
|
*
|
||||||
|
* @param {string} cookie - The docuware cookie
|
||||||
* @return {object} - The headers
|
* @return {object} - The headers
|
||||||
*/
|
*/
|
||||||
Self.getOptions = async() => {
|
Self.getOptions = async() => {
|
||||||
const docuwareConfig = await Self.app.models.DocuwareConfig.findOne();
|
const docuwareConfig = await Self.app.models.DocuwareConfig.findOne();
|
||||||
const now = Date.vnNow();
|
|
||||||
let {url, username, password, token, expired} = docuwareConfig;
|
|
||||||
|
|
||||||
if (process.env.NODE_ENV && (!expired || expired < now + 60)) {
|
|
||||||
const {data: {IdentityServiceUrl}} = await axios.get(`${url}/Home/IdentityServiceInfo`);
|
|
||||||
const {data: {token_endpoint}} = await axios.get(`${IdentityServiceUrl}/.well-known/openid-configuration`);
|
|
||||||
const {data} = await axios.post(token_endpoint, {
|
|
||||||
grant_type: 'password',
|
|
||||||
scope: 'docuware.platform',
|
|
||||||
client_id: 'docuware.platform.net.client',
|
|
||||||
username,
|
|
||||||
password
|
|
||||||
}, {headers: {
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
|
||||||
}});
|
|
||||||
|
|
||||||
const newToken = data.access_token;
|
|
||||||
token = data.token_type + ' ' + newToken;
|
|
||||||
await docuwareConfig.updateAttributes({
|
|
||||||
token,
|
|
||||||
expired: now + data.expires_in
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const headers = {
|
const headers = {
|
||||||
headers: {
|
headers: {
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': token
|
'Cookie': docuwareConfig.cookie
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url,
|
url: docuwareConfig.url,
|
||||||
headers
|
headers
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,54 +2,87 @@ const axios = require('axios');
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('Docuware core', () => {
|
describe('Docuware core', () => {
|
||||||
const fileCabinetCode = 'deliveryNote';
|
beforeAll(() => {
|
||||||
beforeAll(async() => {
|
|
||||||
process.env.NODE_ENV = 'testing';
|
process.env.NODE_ENV = 'testing';
|
||||||
|
});
|
||||||
|
|
||||||
const docuwareInfo = await models.Docuware.findOne({
|
afterAll(() => {
|
||||||
where: {
|
delete process.env.NODE_ENV;
|
||||||
code: fileCabinetCode
|
});
|
||||||
}
|
|
||||||
|
describe('getOptions()', () => {
|
||||||
|
it('should return url and headers', async() => {
|
||||||
|
const result = await models.Docuware.getOptions();
|
||||||
|
|
||||||
|
expect(result.url).toBeDefined();
|
||||||
|
expect(result.headers).toBeDefined();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
spyOn(axios, 'get').and.callFake(url => {
|
describe('getDialog()', () => {
|
||||||
if (url.includes('IdentityServiceInfo')) return {data: {IdentityServiceUrl: 'IdentityServiceUrl'}};
|
it('should return dialogId', async() => {
|
||||||
if (url.includes('IdentityServiceUrl')) return {data: {token_endpoint: 'token_endpoint'}};
|
const dialogs = {
|
||||||
if (url.includes('dialogs')) {
|
data: {
|
||||||
return {
|
Dialog: [
|
||||||
data: {
|
{
|
||||||
Dialog: [
|
DisplayName: 'find',
|
||||||
{
|
Id: 'getDialogTest'
|
||||||
DisplayName: 'find',
|
}
|
||||||
Id: 'getDialogTest'
|
]
|
||||||
}
|
}
|
||||||
]
|
};
|
||||||
}
|
spyOn(axios, 'get').and.returnValue(new Promise(resolve => resolve(dialogs)));
|
||||||
};
|
const result = await models.Docuware.getDialog('deliveryNote', 'find', 'randomFileCabinetId');
|
||||||
}
|
|
||||||
|
|
||||||
if (url.includes('FileCabinets')) {
|
expect(result).toEqual('getDialogTest');
|
||||||
return {data: {
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('getFileCabinet()', () => {
|
||||||
|
it('should return fileCabinetId', async() => {
|
||||||
|
const code = 'deliveryNote';
|
||||||
|
const docuwareInfo = await models.Docuware.findOne({
|
||||||
|
where: {
|
||||||
|
code
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const dialogs = {
|
||||||
|
data: {
|
||||||
FileCabinet: [
|
FileCabinet: [
|
||||||
{
|
{
|
||||||
Name: docuwareInfo.fileCabinetName,
|
Name: docuwareInfo.fileCabinetName,
|
||||||
Id: 'getFileCabinetTest'
|
Id: 'getFileCabinetTest'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}};
|
}
|
||||||
}
|
};
|
||||||
|
spyOn(axios, 'get').and.returnValue(new Promise(resolve => resolve(dialogs)));
|
||||||
|
const result = await models.Docuware.getFileCabinet(code);
|
||||||
|
|
||||||
|
expect(result).toEqual('getFileCabinetTest');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('get()', () => {
|
||||||
|
it('should return data without parse', async() => {
|
||||||
|
spyOn(models.Docuware, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random()))));
|
||||||
|
spyOn(models.Docuware, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random()))));
|
||||||
|
const data = {
|
||||||
|
data: {
|
||||||
|
id: 1
|
||||||
|
}
|
||||||
|
};
|
||||||
|
spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(data)));
|
||||||
|
const result = await models.Docuware.get('deliveryNote');
|
||||||
|
|
||||||
|
expect(result.id).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
spyOn(axios, 'post').and.callFake(url => {
|
it('should return data with parse', async() => {
|
||||||
if (url.includes('token_endpoint')) {
|
spyOn(models.Docuware, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random()))));
|
||||||
return {data: {
|
spyOn(models.Docuware, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random()))));
|
||||||
access_token: 'access_token',
|
const data = {
|
||||||
token_type: 'bearer',
|
data: {
|
||||||
expires_in: 10000
|
|
||||||
}};
|
|
||||||
}
|
|
||||||
if (url.includes('DialogExpression')) {
|
|
||||||
return {data: {
|
|
||||||
Items: [{
|
Items: [{
|
||||||
Fields: [
|
Fields: [
|
||||||
{
|
{
|
||||||
|
@ -70,52 +103,12 @@ describe('Docuware core', () => {
|
||||||
]
|
]
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(() => {
|
|
||||||
delete process.env.NODE_ENV;
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('getOptions()', () => {
|
|
||||||
it('should return url and headers', async() => {
|
|
||||||
const result = await models.Docuware.getOptions();
|
|
||||||
|
|
||||||
expect(result.url).toBeDefined();
|
|
||||||
expect(result.headers).toBeDefined();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Dialog()', () => {
|
|
||||||
it('should return dialogId', async() => {
|
|
||||||
const result = await models.Docuware.getDialog('deliveryNote', 'find', 'randomFileCabinetId');
|
|
||||||
|
|
||||||
expect(result).toEqual('getDialogTest');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('getFileCabinet()', () => {
|
|
||||||
it('should return fileCabinetId', async() => {
|
|
||||||
const result = await models.Docuware.getFileCabinet(fileCabinetCode);
|
|
||||||
|
|
||||||
expect(result).toEqual('getFileCabinetTest');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('get()', () => {
|
|
||||||
it('should return data without parse', async() => {
|
|
||||||
const [result] = await models.Docuware.get('deliveryNote');
|
|
||||||
|
|
||||||
expect(result.firstRequiredField).toEqual(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return data with parse', async() => {
|
|
||||||
const parse = {
|
const parse = {
|
||||||
'firstRequiredField': 'id',
|
'firstRequiredField': 'id',
|
||||||
'secondRequiredField': 'name',
|
'secondRequiredField': 'name',
|
||||||
};
|
};
|
||||||
|
spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(data)));
|
||||||
const [result] = await models.Docuware.get('deliveryNote', null, parse);
|
const [result] = await models.Docuware.get('deliveryNote', null, parse);
|
||||||
|
|
||||||
expect(result.id).toEqual(1);
|
expect(result.id).toEqual(1);
|
||||||
|
@ -126,14 +119,17 @@ describe('Docuware core', () => {
|
||||||
|
|
||||||
describe('getById()', () => {
|
describe('getById()', () => {
|
||||||
it('should return data', async() => {
|
it('should return data', async() => {
|
||||||
spyOn(models.Docuware, 'get');
|
spyOn(models.Docuware, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random()))));
|
||||||
await models.Docuware.getById('deliveryNote', 1);
|
spyOn(models.Docuware, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random()))));
|
||||||
|
const data = {
|
||||||
|
data: {
|
||||||
|
id: 1
|
||||||
|
}
|
||||||
|
};
|
||||||
|
spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(data)));
|
||||||
|
const result = await models.Docuware.getById('deliveryNote', 1);
|
||||||
|
|
||||||
expect(models.Docuware.get).toHaveBeenCalledWith(
|
expect(result.id).toEqual(1);
|
||||||
'deliveryNote',
|
|
||||||
{condition: [Object({DBName: 'N__ALBAR_N', Value: [1]})]},
|
|
||||||
undefined
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -143,7 +143,7 @@ module.exports = Self => {
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'multipart/form-data',
|
'Content-Type': 'multipart/form-data',
|
||||||
'X-File-ModifiedDate': Date.vnNew(),
|
'X-File-ModifiedDate': Date.vnNew(),
|
||||||
'Authorization': docuwareOptions.headers.headers.Authorization,
|
'Cookie': docuwareOptions.headers.headers.Cookie,
|
||||||
...data.getHeaders()
|
...data.getHeaders()
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,132 @@
|
||||||
|
const {models} = require('vn-loopback/server/server');
|
||||||
|
|
||||||
|
describe('machineWorker updateInTime()', () => {
|
||||||
|
const itBoss = 104;
|
||||||
|
const davidCharles = 1106;
|
||||||
|
|
||||||
|
beforeAll(async() => {
|
||||||
|
ctx = {
|
||||||
|
req: {
|
||||||
|
accessToken: {},
|
||||||
|
headers: {origin: 'http://localhost'},
|
||||||
|
__: value => value
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should throw an error if the plate does not exist', async() => {
|
||||||
|
const tx = await models.MachineWorker.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
const plate = 'RE-123';
|
||||||
|
ctx.req.accessToken.userId = 1106;
|
||||||
|
try {
|
||||||
|
await models.MachineWorker.updateInTime(ctx, plate, options);
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
const error = e;
|
||||||
|
|
||||||
|
expect(error.message).toContain('the plate does not exist');
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should grab a machine where is not in use', async() => {
|
||||||
|
const tx = await models.MachineWorker.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
const plate = 'RE-003';
|
||||||
|
ctx.req.accessToken.userId = 1107;
|
||||||
|
try {
|
||||||
|
const totalBefore = await models.MachineWorker.find(null, options);
|
||||||
|
await models.MachineWorker.updateInTime(ctx, plate, options);
|
||||||
|
const totalAfter = await models.MachineWorker.find(null, options);
|
||||||
|
|
||||||
|
expect(totalAfter.length).toEqual(totalBefore.length + 1);
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('less than 12h', () => {
|
||||||
|
const plate = 'RE-001';
|
||||||
|
it('should trow an error if it is not himself', async() => {
|
||||||
|
const tx = await models.MachineWorker.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
ctx.req.accessToken.userId = davidCharles;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await models.MachineWorker.updateInTime(ctx, plate, options);
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
const error = e;
|
||||||
|
|
||||||
|
expect(error.message).toContain('This machine is already in use');
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should throw an error if it is himself with a different machine', async() => {
|
||||||
|
const tx = await models.MachineWorker.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
ctx.req.accessToken.userId = itBoss;
|
||||||
|
const plate = 'RE-003';
|
||||||
|
try {
|
||||||
|
await models.MachineWorker.updateInTime(ctx, plate, options);
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
const error = e;
|
||||||
|
|
||||||
|
expect(error.message).toEqual('You are already using a machine');
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should set the out time if it is himself', async() => {
|
||||||
|
const tx = await models.MachineWorker.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
ctx.req.accessToken.userId = itBoss;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const isNotParked = await models.MachineWorker.findOne({
|
||||||
|
where: {workerFk: itBoss}
|
||||||
|
}, options);
|
||||||
|
await models.MachineWorker.updateInTime(ctx, plate, options);
|
||||||
|
const isParked = await models.MachineWorker.findOne({
|
||||||
|
where: {workerFk: itBoss}
|
||||||
|
}, options);
|
||||||
|
|
||||||
|
expect(isNotParked.outTime).toBeNull();
|
||||||
|
expect(isParked.outTime).toBeDefined();
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('equal or more than 12h', () => {
|
||||||
|
const plate = 'RE-002';
|
||||||
|
it('should set the out time and grab the machine', async() => {
|
||||||
|
const tx = await models.MachineWorker.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
ctx.req.accessToken.userId = davidCharles;
|
||||||
|
const filter = {
|
||||||
|
where: {workerFk: davidCharles, machineFk: 2}
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
const isNotParked = await models.MachineWorker.findOne(filter, options);
|
||||||
|
const totalBefore = await models.MachineWorker.find(null, options);
|
||||||
|
await models.MachineWorker.updateInTime(ctx, plate, options);
|
||||||
|
const isParked = await models.MachineWorker.findOne(filter, options);
|
||||||
|
const totalAfter = await models.MachineWorker.find(null, options);
|
||||||
|
|
||||||
|
expect(isNotParked.outTime).toBeNull();
|
||||||
|
expect(isParked.outTime).toBeDefined();
|
||||||
|
expect(totalAfter.length).toEqual(totalBefore.length + 1);
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,77 @@
|
||||||
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('updateInTime', {
|
||||||
|
description: 'Updates the corresponding registry if the worker has been registered in the last few hours',
|
||||||
|
accessType: 'WRITE',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'plate',
|
||||||
|
type: 'string',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
http: {
|
||||||
|
path: `/updateInTime`,
|
||||||
|
verb: 'POST'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.updateInTime = async(ctx, plate, options) => {
|
||||||
|
const models = Self.app.models;
|
||||||
|
const userId = ctx.req.accessToken.userId;
|
||||||
|
const $t = ctx.req.__;
|
||||||
|
|
||||||
|
let tx;
|
||||||
|
const myOptions = {};
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
if (!myOptions.transaction) {
|
||||||
|
tx = await Self.beginTransaction({});
|
||||||
|
myOptions.transaction = tx;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const machine = await models.Machine.findOne({
|
||||||
|
fields: ['id', 'plate'],
|
||||||
|
where: {plate}
|
||||||
|
}, myOptions);
|
||||||
|
|
||||||
|
if (!machine)
|
||||||
|
throw new UserError($t('the plate does not exist', {plate}));
|
||||||
|
|
||||||
|
const machineWorker = await Self.findOne({
|
||||||
|
where: {
|
||||||
|
or: [{machineFk: machine.id}, {workerFk: userId}],
|
||||||
|
outTime: null,
|
||||||
|
}
|
||||||
|
}, myOptions);
|
||||||
|
|
||||||
|
const {maxHours} = await models.MachineWorkerConfig.findOne({fields: ['maxHours']}, myOptions);
|
||||||
|
const hoursDifference = (Date.vnNow() - machineWorker?.inTime?.getTime() ?? 0) / (60 * 60 * 1000);
|
||||||
|
|
||||||
|
if (machineWorker) {
|
||||||
|
const isHimself = userId == machineWorker.workerFk;
|
||||||
|
const isSameMachine = machine.id == machineWorker.machineFk;
|
||||||
|
|
||||||
|
if (hoursDifference < maxHours && !isHimself)
|
||||||
|
throw new UserError($t('This machine is already in use.'));
|
||||||
|
|
||||||
|
if (hoursDifference < maxHours && isHimself && !isSameMachine)
|
||||||
|
throw new UserError($t('You are already using a machine'));
|
||||||
|
|
||||||
|
await machineWorker.updateAttributes({
|
||||||
|
outTime: Date.vnNew()
|
||||||
|
}, myOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!machineWorker || hoursDifference >= maxHours)
|
||||||
|
await models.MachineWorker.create({machineFk: machine.id, workerFk: userId}, myOptions);
|
||||||
|
|
||||||
|
if (tx) await tx.commit();
|
||||||
|
} catch (e) {
|
||||||
|
if (tx) await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
|
@ -39,9 +39,6 @@ module.exports = Self => {
|
||||||
const xmlString = response.data;
|
const xmlString = response.data;
|
||||||
const parser = new DOMParser();
|
const parser = new DOMParser();
|
||||||
const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
|
const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
|
||||||
|
|
||||||
await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipment', xmlDoc]);
|
|
||||||
|
|
||||||
const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent;
|
const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent;
|
||||||
return result.toLowerCase().includes('se ha cancelado correctamente');
|
return result.toLowerCase().includes('se ha cancelado correctamente');
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,8 +12,9 @@ const ticket1 = {
|
||||||
'addressFk': 1,
|
'addressFk': 1,
|
||||||
'agencyModeFk': 999
|
'agencyModeFk': 999
|
||||||
};
|
};
|
||||||
let expedition;
|
|
||||||
const expedition1 = {
|
const expedition1 = {
|
||||||
|
'id': 17,
|
||||||
'agencyModeFk': 999,
|
'agencyModeFk': 999,
|
||||||
'ticketFk': 44,
|
'ticketFk': 44,
|
||||||
'freightItemFk': 71,
|
'freightItemFk': 71,
|
||||||
|
@ -46,7 +47,7 @@ describe('MRWConfig createShipment()', () => {
|
||||||
await createMrwConfig();
|
await createMrwConfig();
|
||||||
|
|
||||||
await models.Ticket.create(ticket1);
|
await models.Ticket.create(ticket1);
|
||||||
expedition = await models.Expedition.create(expedition1);
|
await models.Expedition.create(expedition1);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async() => {
|
afterAll(async() => {
|
||||||
|
@ -92,7 +93,7 @@ describe('MRWConfig createShipment()', () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
it('should create a shipment and return a base64Binary label', async() => {
|
it('should create a shipment and return a base64Binary label', async() => {
|
||||||
const {file} = await models.MrwConfig.createShipment(expedition.id);
|
const {file} = await models.MrwConfig.createShipment(expedition1.id);
|
||||||
|
|
||||||
expect(file).toEqual(mockBase64Binary);
|
expect(file).toEqual(mockBase64Binary);
|
||||||
});
|
});
|
||||||
|
@ -100,7 +101,7 @@ describe('MRWConfig createShipment()', () => {
|
||||||
it('should fail if mrwConfig has no data', async() => {
|
it('should fail if mrwConfig has no data', async() => {
|
||||||
let error;
|
let error;
|
||||||
await models.MrwConfig.destroyAll();
|
await models.MrwConfig.destroyAll();
|
||||||
await models.MrwConfig.createShipment(expedition.id).catch(e => {
|
await models.MrwConfig.createShipment(expedition1.id).catch(e => {
|
||||||
error = e;
|
error = e;
|
||||||
}).finally(async() => {
|
}).finally(async() => {
|
||||||
expect(error.message).toEqual(`MRW service is not configured`);
|
expect(error.message).toEqual(`MRW service is not configured`);
|
||||||
|
@ -125,7 +126,7 @@ describe('MRWConfig createShipment()', () => {
|
||||||
yesterday.setDate(yesterday.getDate() - 1);
|
yesterday.setDate(yesterday.getDate() - 1);
|
||||||
|
|
||||||
await models.Ticket.updateAll({id: ticket1.id}, {shipped: yesterday});
|
await models.Ticket.updateAll({id: ticket1.id}, {shipped: yesterday});
|
||||||
await models.MrwConfig.createShipment(expedition.id).catch(e => {
|
await models.MrwConfig.createShipment(expedition1.id).catch(e => {
|
||||||
error = e;
|
error = e;
|
||||||
}).finally(async() => {
|
}).finally(async() => {
|
||||||
expect(error.message).toEqual(`This ticket has a shipped date earlier than today`);
|
expect(error.message).toEqual(`This ticket has a shipped date earlier than today`);
|
||||||
|
@ -135,7 +136,7 @@ describe('MRWConfig createShipment()', () => {
|
||||||
|
|
||||||
it('should send mail if you are past the dead line and is not notified today', async() => {
|
it('should send mail if you are past the dead line and is not notified today', async() => {
|
||||||
await models.MrwConfig.updateAll({id: 1}, {expeditionDeadLine: '10:00:00', notified: null});
|
await models.MrwConfig.updateAll({id: 1}, {expeditionDeadLine: '10:00:00', notified: null});
|
||||||
await models.MrwConfig.createShipment(expedition.id);
|
await models.MrwConfig.createShipment(expedition1.id);
|
||||||
const notification = await getLastNotification();
|
const notification = await getLastNotification();
|
||||||
|
|
||||||
expect(notification.notificationFk).toEqual(filter.notificationFk);
|
expect(notification.notificationFk).toEqual(filter.notificationFk);
|
||||||
|
@ -143,7 +144,7 @@ describe('MRWConfig createShipment()', () => {
|
||||||
|
|
||||||
it('should send mail if you are past the dead line and it is notified from another day', async() => {
|
it('should send mail if you are past the dead line and it is notified from another day', async() => {
|
||||||
await models.MrwConfig.updateAll({id: 1}, {expeditionDeadLine: '10:00:00', notified: new Date()});
|
await models.MrwConfig.updateAll({id: 1}, {expeditionDeadLine: '10:00:00', notified: new Date()});
|
||||||
await models.MrwConfig.createShipment(expedition.id);
|
await models.MrwConfig.createShipment(expedition1.id);
|
||||||
const notification = await getLastNotification();
|
const notification = await getLastNotification();
|
||||||
|
|
||||||
expect(notification.notificationFk).toEqual(filter.notificationFk);
|
expect(notification.notificationFk).toEqual(filter.notificationFk);
|
||||||
|
@ -151,7 +152,7 @@ describe('MRWConfig createShipment()', () => {
|
||||||
|
|
||||||
it('should not send mail if you are past the dead line and it is notified', async() => {
|
it('should not send mail if you are past the dead line and it is notified', async() => {
|
||||||
await models.MrwConfig.updateAll({id: 1}, {expeditionDeadLine: '10:00:00', notified: Date.vnNew()});
|
await models.MrwConfig.updateAll({id: 1}, {expeditionDeadLine: '10:00:00', notified: Date.vnNew()});
|
||||||
await models.MrwConfig.createShipment(expedition.id);
|
await models.MrwConfig.createShipment(expedition1.id);
|
||||||
const notification = await getLastNotification();
|
const notification = await getLastNotification();
|
||||||
|
|
||||||
expect(notification).toEqual(null);
|
expect(notification).toEqual(null);
|
||||||
|
|
|
@ -29,7 +29,7 @@ describe('Postcode filter()', () => {
|
||||||
}
|
}
|
||||||
}, options);
|
}, options);
|
||||||
|
|
||||||
expect(results.length).toEqual(5);
|
expect(results.length).toEqual(4);
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
|
@ -63,7 +63,7 @@ describe('Postcode filter()', () => {
|
||||||
search: 'one',
|
search: 'one',
|
||||||
}}, options);
|
}}, options);
|
||||||
|
|
||||||
expect(results.length).toEqual(5);
|
expect(results.length).toEqual(4);
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
|
|
|
@ -1,88 +0,0 @@
|
||||||
const axios = require('axios');
|
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
|
||||||
const moment = require('moment');
|
|
||||||
|
|
||||||
module.exports = Self => {
|
|
||||||
Self.remoteMethod('sendOrders', {
|
|
||||||
description: 'Sends a set of orders',
|
|
||||||
accessType: 'WRITE',
|
|
||||||
accepts: [{
|
|
||||||
arg: 'tickets',
|
|
||||||
type: ['number'],
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
returns: {
|
|
||||||
type: 'string',
|
|
||||||
root: true
|
|
||||||
},
|
|
||||||
http: {
|
|
||||||
path: `/sendOrders`,
|
|
||||||
verb: 'POST'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Self.sendOrders = async tickets => {
|
|
||||||
const config = await Self.app.models.QuadmindsApiConfig.findOne();
|
|
||||||
if (!config) throw new UserError('Config params not set');
|
|
||||||
|
|
||||||
if (tickets.length > config.maxObjects)
|
|
||||||
throw new UserError(`Quadminds does not support more than ${config.maxObjects} tickets`);
|
|
||||||
|
|
||||||
let poisData = [];
|
|
||||||
let isOk;
|
|
||||||
for (let offset = 0; !isOk; offset = offset + config.limit) {
|
|
||||||
const pois = await axios.get(`${config.url}pois/search?limit=${config.limit}&offset=${offset}`, {
|
|
||||||
headers: {
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'X-Saas-Apikey': config.key
|
|
||||||
}
|
|
||||||
});
|
|
||||||
pois.data.data.length ? poisData.push(...pois.data.data) : isOk = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const poiMap = new Map(poisData.map(poi => [poi.code, poi._id]));
|
|
||||||
|
|
||||||
let orders = await Self.rawSql(`
|
|
||||||
SELECT a.id poiCode,
|
|
||||||
t.id code,
|
|
||||||
t.shipped date,
|
|
||||||
'PEDIDO' operation,
|
|
||||||
t.totalWithVat totalAmount,
|
|
||||||
t.totalWithoutVat totalAmountWithoutTaxes,
|
|
||||||
SUM(sv.volume) volume
|
|
||||||
FROM ticket t
|
|
||||||
JOIN address a ON a.id = t.addressFk
|
|
||||||
JOIN saleVolume sv ON sv.ticketFk = t.id
|
|
||||||
WHERE t.id IN (?)
|
|
||||||
GROUP BY t.id
|
|
||||||
`, [tickets]);
|
|
||||||
|
|
||||||
// Transformo code en string ya que lo obtenermos como integer
|
|
||||||
orders = orders.map(order => {
|
|
||||||
return {
|
|
||||||
...order,
|
|
||||||
poiId: poiMap.get(order.poiCode.toString()) || undefined,
|
|
||||||
code: order.code.toString(),
|
|
||||||
date: moment(order.date).format('YYYY-MM-DD'),
|
|
||||||
totalAmount: order.totalAmount || undefined,
|
|
||||||
totalAmountWithoutTaxes: order.totalAmountWithoutTaxes || undefined,
|
|
||||||
timeWindow: [{
|
|
||||||
from: config.orderTimeFrom,
|
|
||||||
to: config.orderTimeTo
|
|
||||||
}],
|
|
||||||
orderMeasures: [{
|
|
||||||
constraintId: 3, // Volumen
|
|
||||||
value: order.volume
|
|
||||||
}]
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
await axios.post(`${config.url}orders`, orders, {
|
|
||||||
headers: {
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'X-Saas-Apikey': config.key
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
};
|
|
|
@ -1,87 +0,0 @@
|
||||||
const axios = require('axios');
|
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
|
||||||
|
|
||||||
module.exports = Self => {
|
|
||||||
Self.remoteMethod('sendPois', {
|
|
||||||
description: 'Sends a set of pois',
|
|
||||||
accessType: 'WRITE',
|
|
||||||
accepts: [{
|
|
||||||
arg: 'tickets',
|
|
||||||
type: ['number'],
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
returns: {
|
|
||||||
type: 'string',
|
|
||||||
root: true
|
|
||||||
},
|
|
||||||
http: {
|
|
||||||
path: `/sendPois`,
|
|
||||||
verb: 'POST'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Self.sendPois = async tickets => {
|
|
||||||
const config = await Self.app.models.QuadmindsApiConfig.findOne();
|
|
||||||
if (!config) throw new UserError('Config params not set');
|
|
||||||
|
|
||||||
if (tickets.length > config.maxObjects)
|
|
||||||
throw new UserError(`Quadminds does not support more than ${config.maxObjects} tickets`);
|
|
||||||
|
|
||||||
let pois = await Self.rawSql(`
|
|
||||||
WITH deliveryNotes AS (
|
|
||||||
SELECT t.id, t.routeFk, tn.description
|
|
||||||
FROM ticket t
|
|
||||||
JOIN ticketObservation tn ON tn.ticketFk = t.id
|
|
||||||
JOIN observationType ot ON ot.id = tn.observationTypeFk
|
|
||||||
WHERE ot.code = 'delivery'
|
|
||||||
)
|
|
||||||
SELECT a.id code,
|
|
||||||
c.socialName name,
|
|
||||||
IF(ABS(a.latitude - ROUND(a.latitude)) < 0.000001, NULL, a.latitude) latitude,
|
|
||||||
IF(ABS(a.longitude - ROUND(a.longitude)) < 0.000001, NULL, a.longitude) longitude,
|
|
||||||
a.street,
|
|
||||||
a.city locality,
|
|
||||||
p.name state,
|
|
||||||
co.name country,
|
|
||||||
CONCAT_WS(', ', IFNULL(a.street, ''), IFNULL(a.city, ''), IFNULL(p.name, '')) longAddress,
|
|
||||||
CONCAT(IFNULL(a.mobile, c.mobile)) phoneNumber,
|
|
||||||
dn.description poiDeliveryComments,
|
|
||||||
c.email email
|
|
||||||
FROM ticket t
|
|
||||||
JOIN address a ON a.id = t.addressFk
|
|
||||||
JOIN province p ON p.id = a.provinceFk
|
|
||||||
JOIN country co ON co.id = p.countryFk
|
|
||||||
JOIN client c ON c.id = t.clientFk
|
|
||||||
LEFT JOIN deliveryNotes dn ON dn.id = t.id
|
|
||||||
WHERE t.id IN (?)
|
|
||||||
GROUP BY t.id
|
|
||||||
`, [tickets]);
|
|
||||||
|
|
||||||
// Transformo code en string ya que lo obtenermos como integer
|
|
||||||
pois = pois.map(poi => {
|
|
||||||
return {
|
|
||||||
...poi,
|
|
||||||
code: poi.code.toString(),
|
|
||||||
latitude: poi.latitude || undefined,
|
|
||||||
longitude: poi.longitude || undefined,
|
|
||||||
address: {
|
|
||||||
street: poi.street || undefined,
|
|
||||||
locality: poi.locality || undefined,
|
|
||||||
state: poi.state || undefined,
|
|
||||||
country: poi.country || undefined
|
|
||||||
},
|
|
||||||
poiDeliveryComments: poi.poiDeliveryComments || undefined,
|
|
||||||
phoneNumber: poi.phoneNumber || undefined,
|
|
||||||
email: poi.email || undefined
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
await axios.post(`${config.url}pois`, pois, {
|
|
||||||
headers: {
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'X-Saas-Apikey': config.key
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
};
|
|
|
@ -1,29 +0,0 @@
|
||||||
module.exports = Self => {
|
|
||||||
Self.remoteMethodCtx('killSession', {
|
|
||||||
description: 'Kill session',
|
|
||||||
accepts: [{
|
|
||||||
arg: 'userId',
|
|
||||||
type: 'integer',
|
|
||||||
description: 'The user id',
|
|
||||||
required: true,
|
|
||||||
}, {
|
|
||||||
arg: 'created',
|
|
||||||
type: 'date',
|
|
||||||
description: 'The created time',
|
|
||||||
required: true,
|
|
||||||
}],
|
|
||||||
accessType: 'WRITE',
|
|
||||||
http: {
|
|
||||||
path: `/killSession`,
|
|
||||||
verb: 'POST'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Self.killSession = async function(ctx, userId, created) {
|
|
||||||
await Self.app.models.VnUser.userSecurity(ctx, ctx.req.accessToken.userId);
|
|
||||||
const tokens = await Self.app.models.AccessToken.find({where: {userId, created}});
|
|
||||||
if (!tokens?.length) return;
|
|
||||||
for (const token of tokens)
|
|
||||||
await Self.app.models.AccessToken.deleteById(token.id);
|
|
||||||
};
|
|
||||||
};
|
|
|
@ -30,10 +30,16 @@ module.exports = Self => {
|
||||||
|
|
||||||
// Schedule to remove current token
|
// Schedule to remove current token
|
||||||
setTimeout(async() => {
|
setTimeout(async() => {
|
||||||
|
let exists;
|
||||||
try {
|
try {
|
||||||
await Self.logout(token.id);
|
exists = await models.AccessToken.findById(token.id);
|
||||||
|
exists && await Self.logout(token.id);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// FIXME: Crash if do throw new Error(error)
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(error);
|
||||||
|
const body = {error: error.message, now: Date.now(), userId: token?.userId ?? null, exists};
|
||||||
|
await handleError(body);
|
||||||
|
throw new Error(error);
|
||||||
}
|
}
|
||||||
}, courtesyTime * 1000);
|
}, courtesyTime * 1000);
|
||||||
|
|
||||||
|
@ -47,20 +53,14 @@ module.exports = Self => {
|
||||||
|
|
||||||
return {id: accessToken.id, ttl: accessToken.ttl};
|
return {id: accessToken.id, ttl: accessToken.ttl};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const body = {
|
const body = {error: error.message, now: Date.now(), userId: token?.userId ?? null, createTokenOptions, isNotExceeded};
|
||||||
error: error.message,
|
await handleError(body);
|
||||||
userId: token?.userId ?? null,
|
|
||||||
token: token?.id,
|
|
||||||
scopes: token?.scopes,
|
|
||||||
createTokenOptions,
|
|
||||||
isNotExceeded
|
|
||||||
};
|
|
||||||
await handleError(JSON.stringify(body));
|
|
||||||
throw new Error(error);
|
throw new Error(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
async function handleError(body) {
|
async function handleError(body, tag = 'renewToken') {
|
||||||
await models.Application.rawSql('CALL util.debugAdd(?,?);', ['renewToken', body]);
|
body = JSON.stringify(body);
|
||||||
|
await models.Application.rawSql('CALL util.debugAdd(?,?);', [tag, body]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,9 +67,7 @@ module.exports = Self => {
|
||||||
if (vnUser.twoFactor === 'email') {
|
if (vnUser.twoFactor === 'email') {
|
||||||
const $ = Self.app.models;
|
const $ = Self.app.models;
|
||||||
|
|
||||||
const min = 100000;
|
const code = String(Math.floor(Math.random() * 999999));
|
||||||
const max = 999999;
|
|
||||||
const code = String(Math.floor(Math.random() * (max - min + 1)) + min);
|
|
||||||
const maxTTL = ((60 * 1000) * 5); // 5 min
|
const maxTTL = ((60 * 1000) * 5); // 5 min
|
||||||
await $.AuthCode.upsertWithWhere({userFk: vnUser.id}, {
|
await $.AuthCode.upsertWithWhere({userFk: vnUser.id}, {
|
||||||
userFk: vnUser.id,
|
userFk: vnUser.id,
|
||||||
|
|
|
@ -72,9 +72,9 @@ describe('Renew Token', () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(error).toBeDefined();
|
expect(error).toBeDefined();
|
||||||
|
const query = 'SELECT * FROM util.debug';
|
||||||
|
|
||||||
const query = 'SELECT * FROM util.debug WHERE variable = "renewToken"';
|
const debugLog = await models.Application.rawSql(query, null);
|
||||||
const debugLog = await models.Application.rawSql(query);
|
|
||||||
|
|
||||||
expect(debugLog.length).toEqual(1);
|
expect(debugLog.length).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
|
@ -24,10 +24,6 @@ module.exports = Self => {
|
||||||
arg: 'lang',
|
arg: 'lang',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description: 'The user lang'
|
description: 'The user lang'
|
||||||
}, {
|
|
||||||
arg: 'twoFactor',
|
|
||||||
type: 'any',
|
|
||||||
description: 'The user twoFactor'
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
http: {
|
http: {
|
||||||
|
@ -36,8 +32,8 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.updateUser = async(ctx, id, name, nickname, email, lang, twoFactor) => {
|
Self.updateUser = async(ctx, id, name, nickname, email, lang) => {
|
||||||
await Self.userSecurity(ctx, id);
|
await Self.userSecurity(ctx, id);
|
||||||
await Self.upsertWithWhere({id}, {name, nickname, email, lang, twoFactor});
|
await Self.upsertWithWhere({id}, {name, nickname, email, lang});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -58,7 +58,7 @@ module.exports = Self => {
|
||||||
fields: ['name', 'twoFactor']
|
fields: ['name', 'twoFactor']
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
if (user.name.toLowerCase() !== username.toLowerCase())
|
if (user.name !== username)
|
||||||
throw new UserError('Authentication failed');
|
throw new UserError('Authentication failed');
|
||||||
|
|
||||||
await authCode.destroy(myOptions);
|
await authCode.destroy(myOptions);
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
module.exports = Self => {
|
|
||||||
Self.remoteMethodCtx('add', {
|
|
||||||
description: 'Add activity if the activity is different or is the same but have exceed time for break',
|
|
||||||
accessType: 'WRITE',
|
|
||||||
accepts: [
|
|
||||||
{
|
|
||||||
arg: 'code',
|
|
||||||
type: 'string',
|
|
||||||
description: 'Code for activity'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
arg: 'model',
|
|
||||||
type: 'string',
|
|
||||||
description: 'Origin model from insert'
|
|
||||||
},
|
|
||||||
|
|
||||||
],
|
|
||||||
http: {
|
|
||||||
path: `/add`,
|
|
||||||
verb: 'POST'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Self.add = async(ctx, code, model, options) => {
|
|
||||||
const userId = ctx.req.accessToken.userId;
|
|
||||||
const myOptions = {};
|
|
||||||
|
|
||||||
if (typeof options == 'object')
|
|
||||||
Object.assign(myOptions, options);
|
|
||||||
|
|
||||||
return await Self.rawSql(`
|
|
||||||
INSERT INTO workerActivity (workerFk, workerActivityTypeFk, model)
|
|
||||||
SELECT ?, ?, ?
|
|
||||||
FROM workerTimeControlConfig wtcc
|
|
||||||
LEFT JOIN (
|
|
||||||
SELECT wa.workerFk,
|
|
||||||
wa.created,
|
|
||||||
wat.code
|
|
||||||
FROM workerActivity wa
|
|
||||||
LEFT JOIN workerActivityType wat ON wat.code = wa.workerActivityTypeFk
|
|
||||||
WHERE wa.workerFk = ?
|
|
||||||
ORDER BY wa.created DESC
|
|
||||||
LIMIT 1
|
|
||||||
) sub ON TRUE
|
|
||||||
WHERE sub.workerFk IS NULL
|
|
||||||
OR sub.code <> ?
|
|
||||||
OR TIMESTAMPDIFF(SECOND, sub.created, util.VN_NOW()) > wtcc.dayBreak;`
|
|
||||||
, [userId, code, model, userId, code], myOptions);
|
|
||||||
};
|
|
||||||
};
|
|
|
@ -1,30 +0,0 @@
|
||||||
const {models} = require('vn-loopback');
|
|
||||||
|
|
||||||
describe('workerActivity insert()', () => {
|
|
||||||
const ctx = beforeAll.getCtx(1106);
|
|
||||||
|
|
||||||
it('should insert in workerActivity', async() => {
|
|
||||||
const tx = await models.WorkerActivity.beginTransaction({});
|
|
||||||
let count = 0;
|
|
||||||
const options = {transaction: tx};
|
|
||||||
|
|
||||||
try {
|
|
||||||
await models.WorkerActivityType.create(
|
|
||||||
{'code': 'STOP', 'description': 'STOP'}, options
|
|
||||||
);
|
|
||||||
|
|
||||||
await models.WorkerActivity.add(ctx, 'STOP', 'APP', options);
|
|
||||||
|
|
||||||
count = await models.WorkerActivity.count(
|
|
||||||
{'workerFK': 1106}, options
|
|
||||||
);
|
|
||||||
|
|
||||||
await tx.rollback();
|
|
||||||
} catch (e) {
|
|
||||||
await tx.rollback();
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
|
|
||||||
expect(count).toEqual(1);
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -79,9 +79,6 @@
|
||||||
"ImageCollectionSize": {
|
"ImageCollectionSize": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"ImageConfig": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"ImageContainer": {
|
"ImageContainer": {
|
||||||
"dataSource": "imageStorage"
|
"dataSource": "imageStorage"
|
||||||
},
|
},
|
||||||
|
@ -91,6 +88,12 @@
|
||||||
"Machine": {
|
"Machine": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"MachineWorker": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"MachineWorkerConfig": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"MobileAppVersionControl": {
|
"MobileAppVersionControl": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
@ -115,15 +118,9 @@
|
||||||
"NotificationSubscription": {
|
"NotificationSubscription": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"OrmConfig": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"Province": {
|
"Province": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"QuadmindsApiConfig": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"Autonomy": {
|
"Autonomy": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
@ -142,12 +139,6 @@
|
||||||
"StarredModule": {
|
"StarredModule": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"SaySimpleCountry": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"SaySimpleConfig": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"TempContainer": {
|
"TempContainer": {
|
||||||
"dataSource": "tempStorage"
|
"dataSource": "tempStorage"
|
||||||
},
|
},
|
||||||
|
@ -178,15 +169,9 @@
|
||||||
"PrintConfig": {
|
"PrintConfig": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"QueueMember": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"ViaexpressConfig": {
|
"ViaexpressConfig": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"VnToken": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"VnUser": {
|
"VnUser": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,10 +16,6 @@
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
|
||||||
"hasDailyInvoice": {
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "Indicates if the autonomy has daily invoice enabled"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
@ -44,4 +40,4 @@
|
||||||
"permission": "ALLOW"
|
"permission": "ALLOW"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -28,10 +28,6 @@
|
||||||
},
|
},
|
||||||
"continentFk": {
|
"continentFk": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
|
||||||
"hasDailyInvoice": {
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "Indicates if the autonomy has daily invoice enabled"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
@ -44,11 +40,6 @@
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Continent",
|
"model": "Continent",
|
||||||
"foreignKey": "continentFk"
|
"foreignKey": "continentFk"
|
||||||
},
|
|
||||||
"saySimpleCountry": {
|
|
||||||
"type": "hasOne",
|
|
||||||
"model": "SaySimpleCountry",
|
|
||||||
"foreignKey": "countryFk"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"acls": [
|
"acls": [
|
||||||
|
@ -59,4 +50,4 @@
|
||||||
"permission": "ALLOW"
|
"permission": "ALLOW"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,17 +16,17 @@
|
||||||
"url": {
|
"url": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"token": {
|
"cookie": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
|
||||||
"username": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"password": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"expired":{
|
|
||||||
"type": "number"
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"acls": [
|
||||||
|
{
|
||||||
|
"property": "*",
|
||||||
|
"accessType": "*",
|
||||||
|
"principalType": "ROLE",
|
||||||
|
"principalId": "$everyone",
|
||||||
|
"permission": "ALLOW"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,9 @@
|
||||||
},
|
},
|
||||||
"itemFk": {
|
"itemFk": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
|
},
|
||||||
|
"isChecked": {
|
||||||
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,22 +0,0 @@
|
||||||
{
|
|
||||||
"name": "ImageConfig",
|
|
||||||
"base": "VnModel",
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "hedera.imageConfig"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"url": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"acls": [
|
|
||||||
{
|
|
||||||
"accessType": "READ",
|
|
||||||
"principalType": "ROLE",
|
|
||||||
"principalId": "$authenticated",
|
|
||||||
"permission": "ALLOW"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"name": "MachineWorkerConfig",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "vn.machineWorkerConfig"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true
|
||||||
|
},
|
||||||
|
"maxHours": {
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
require('../methods/machine-worker/updateInTime')(Self);
|
||||||
|
};
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"name": "MachineWorker",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "vn.machineWorker"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true
|
||||||
|
},
|
||||||
|
"workerFk": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"machineFk": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"inTime": {
|
||||||
|
"type": "date",
|
||||||
|
"mysql": {
|
||||||
|
"columnName": "inTimed"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outTime": {
|
||||||
|
"type": "date",
|
||||||
|
"mysql": {
|
||||||
|
"columnName": "outTimed"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,26 +0,0 @@
|
||||||
{
|
|
||||||
"name": "OrmConfig",
|
|
||||||
"base": "VnModel",
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "ormConfig"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "number",
|
|
||||||
"id": true
|
|
||||||
},
|
|
||||||
"selectLimit": {
|
|
||||||
"type": "number"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"acls": [
|
|
||||||
{
|
|
||||||
"accessType": "*",
|
|
||||||
"principalType": "ROLE",
|
|
||||||
"principalId": "$authenticated",
|
|
||||||
"permission": "ALLOW"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -16,9 +16,6 @@
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
|
||||||
"autonomyFk": {
|
|
||||||
"type": "number"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
@ -58,4 +55,4 @@
|
||||||
"permission": "ALLOW"
|
"permission": "ALLOW"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -1,4 +0,0 @@
|
||||||
module.exports = Self => {
|
|
||||||
require('../methods/quadminds-api-config/sendPois')(Self);
|
|
||||||
require('../methods/quadminds-api-config/sendOrders')(Self);
|
|
||||||
};
|
|
|
@ -1,34 +0,0 @@
|
||||||
{
|
|
||||||
"name": "QuadmindsApiConfig",
|
|
||||||
"base": "VnModel",
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "quadmindsApiConfig"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "number",
|
|
||||||
"id": true,
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
"url": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"key": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"maxObjects": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"limit": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"orderTimeFrom": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"orderTimeTo": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
{
|
|
||||||
"name": "QueueMember",
|
|
||||||
"base": "VnModel",
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "pbx.queueMember"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "number",
|
|
||||||
"id": true
|
|
||||||
},
|
|
||||||
"queue": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"extension": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"relations": {
|
|
||||||
"queueRelation": {
|
|
||||||
"type": "belongsTo",
|
|
||||||
"model": "Queue",
|
|
||||||
"foreignKey": "queue",
|
|
||||||
"primaryKey": "name"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"acls": [
|
|
||||||
{
|
|
||||||
"property": "*",
|
|
||||||
"accessType": "READ",
|
|
||||||
"principalType": "ROLE",
|
|
||||||
"principalId": "employee",
|
|
||||||
"permission": "ALLOW"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
{
|
|
||||||
"name": "SaySimpleConfig",
|
|
||||||
"base": "VnModel",
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "saySimpleConfig"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "number",
|
|
||||||
"id": true
|
|
||||||
},
|
|
||||||
"url": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"defaultChannel": {
|
|
||||||
"type": "number"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"acls": [
|
|
||||||
{
|
|
||||||
"accessType": "READ",
|
|
||||||
"principalType": "ROLE",
|
|
||||||
"principalId": "$authenticated",
|
|
||||||
"permission": "ALLOW"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
{
|
|
||||||
"name": "SaySimpleCountry",
|
|
||||||
"base": "VnModel",
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "saySimpleCountry"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"countryFk": {
|
|
||||||
"type": "number",
|
|
||||||
"id": true
|
|
||||||
},
|
|
||||||
"channel": {
|
|
||||||
"type": "number"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"acls": [
|
|
||||||
{
|
|
||||||
"accessType": "READ",
|
|
||||||
"principalType": "ROLE",
|
|
||||||
"principalId": "$authenticated",
|
|
||||||
"permission": "ALLOW"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
const vnModel = require('vn-loopback/common/models/vn-model');
|
|
||||||
module.exports = function(Self) {
|
|
||||||
vnModel(Self);
|
|
||||||
require('../methods/vn-token/killSession')(Self);
|
|
||||||
};
|
|
|
@ -1,22 +0,0 @@
|
||||||
{
|
|
||||||
"name": "VnToken",
|
|
||||||
"base": "AccessToken",
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "salix.AccessToken"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"created": {
|
|
||||||
"type": "date"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"relations": {
|
|
||||||
"user": {
|
|
||||||
"type": "belongsTo",
|
|
||||||
"model": "VnUser",
|
|
||||||
"foreignKey": "userId"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"hidden": ["id"]
|
|
||||||
}
|
|
|
@ -101,10 +101,9 @@ module.exports = function(Self) {
|
||||||
const headers = httpRequest.headers;
|
const headers = httpRequest.headers;
|
||||||
const origin = headers.origin;
|
const origin = headers.origin;
|
||||||
|
|
||||||
const defaultHash = '!/reset-password?access_token=$token$';
|
const defaultHash = '/reset-password?access_token=$token$';
|
||||||
const recoverHashes = {
|
const recoverHashes = {
|
||||||
hedera: '!verificationToken=$token$',
|
hedera: 'verificationToken=$token$'
|
||||||
lilium: '/resetPassword?access_token=$token$'
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const app = info.options?.app;
|
const app = info.options?.app;
|
||||||
|
@ -116,7 +115,7 @@ module.exports = function(Self) {
|
||||||
const params = {
|
const params = {
|
||||||
recipient: info.email,
|
recipient: info.email,
|
||||||
lang: user.lang,
|
lang: user.lang,
|
||||||
url: origin + '/#' + recoverHash
|
url: origin + '/#!' + recoverHash
|
||||||
};
|
};
|
||||||
|
|
||||||
const options = Object.assign({}, info.options);
|
const options = Object.assign({}, info.options);
|
||||||
|
|
|
@ -165,8 +165,7 @@
|
||||||
"hasGrant",
|
"hasGrant",
|
||||||
"realm",
|
"realm",
|
||||||
"email",
|
"email",
|
||||||
"emailVerified",
|
"emailVerified"
|
||||||
"twoFactor"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,9 +25,6 @@
|
||||||
"isManaged": {
|
"isManaged": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"isDestiny": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"countryFk": {
|
"countryFk": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
module.exports = Self => {
|
|
||||||
require('../methods/workerActivity/add')(Self);
|
|
||||||
};
|
|
|
@ -22,18 +22,18 @@
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
|
||||||
},
|
|
||||||
"relations": {
|
|
||||||
"workerFk": {
|
|
||||||
"type": "belongsTo",
|
|
||||||
"model": "Worker",
|
|
||||||
"foreignKey": "workerFk"
|
|
||||||
},
|
},
|
||||||
"workerActivityTypeFk": {
|
"relations": {
|
||||||
"type": "belongsTo",
|
"workerFk": {
|
||||||
"model": "WorkerActivityType",
|
"type": "belongsTo",
|
||||||
"foreignKey": "workerActivityTypeFk"
|
"model": "Worker",
|
||||||
|
"foreignKey": "workerFk"
|
||||||
|
},
|
||||||
|
"workerActivityTypeFk": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "WorkerActivityType",
|
||||||
|
"foreignKey": "workerActivityTypeFk"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
apps:
|
||||||
|
- script: ./loopback/server/server.js
|
||||||
|
name: salix-back
|
||||||
|
instances: 1
|
||||||
|
max_restarts: 0
|
||||||
|
node_args: --tls-min-v1.0 --openssl-legacy-provider
|
|
@ -9,7 +9,7 @@
|
||||||
},
|
},
|
||||||
"vn": {
|
"vn": {
|
||||||
"view": {
|
"view": {
|
||||||
"expeditionPallet_Print": "99f75145ac2e7b612a6d71e74b6e55f194a465780fd9875a15eb01e6596b447e"
|
"expeditionPallet_Print": "ced2b84a114fcb99fce05f0c34f4fc03f3fa387bef92621be1bc306608a84345"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,14 +1 @@
|
||||||
-- Executed before dump
|
-- Executed before dump
|
||||||
|
|
||||||
CREATE USER 'vn'@'localhost';
|
|
||||||
|
|
||||||
GRANT SELECT,
|
|
||||||
INSERT,
|
|
||||||
UPDATE,
|
|
||||||
DELETE,
|
|
||||||
DROP,
|
|
||||||
CREATE TEMPORARY TABLES,
|
|
||||||
EXECUTE,
|
|
||||||
EVENT,
|
|
||||||
TRIGGER
|
|
||||||
ON *.* TO 'vn'@'localhost';
|
|
||||||
|
|
|
@ -108,7 +108,6 @@ INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `bossFk`)
|
||||||
UPDATE `vn`.`worker` SET bossFk = NULL WHERE id = 20;
|
UPDATE `vn`.`worker` SET bossFk = NULL WHERE id = 20;
|
||||||
UPDATE `vn`.`worker` SET bossFk = 20 WHERE id = 1 OR id = 9;
|
UPDATE `vn`.`worker` SET bossFk = 20 WHERE id = 1 OR id = 9;
|
||||||
UPDATE `vn`.`worker` SET bossFk = 19 WHERE id = 18;
|
UPDATE `vn`.`worker` SET bossFk = 19 WHERE id = 18;
|
||||||
UPDATE `vn`.`worker` SET bossFk = 50 WHERE id = 49;
|
|
||||||
|
|
||||||
DELETE FROM `vn`.`worker` WHERE firstName ='customer';
|
DELETE FROM `vn`.`worker` WHERE firstName ='customer';
|
||||||
|
|
||||||
|
@ -185,7 +184,6 @@ INSERT INTO `vn`.`warehouse`(`id`, `name`, `code`, `isComparative`, `isInventory
|
||||||
(3, 'Warehouse Three', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0),
|
(3, 'Warehouse Three', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0),
|
||||||
(4, 'Warehouse Four', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1),
|
(4, 'Warehouse Four', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1),
|
||||||
(5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0),
|
(5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0),
|
||||||
(6, 'Warehouse six', 'vnh', 1, 1, 1, 1, 0, 0, 1, 1, 0, 0),
|
|
||||||
(13, 'Inventory', 'inv', 1, 1, 1, 0, 0, 0, 1, 0, 0, 0),
|
(13, 'Inventory', 'inv', 1, 1, 1, 0, 0, 0, 1, 0, 0, 0),
|
||||||
(60, 'Algemesi', NULL, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0);
|
(60, 'Algemesi', NULL, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0);
|
||||||
|
|
||||||
|
@ -336,21 +334,21 @@ INSERT INTO `vn`.`payDem`(`id`, `payDem`)
|
||||||
(2, 20),
|
(2, 20),
|
||||||
(7, 0);
|
(7, 0);
|
||||||
|
|
||||||
INSERT INTO `vn`.`autonomy`(`id`, `name`, `countryFk`, `hasDailyInvoice`)
|
INSERT INTO `vn`.`autonomy`(`id`, `name`, `countryFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Autonomy one', 1, 1),
|
(1, 'Autonomy one', 1),
|
||||||
(2, 'Autonomy two', 1, 0),
|
(2, 'Autonomy two', 1),
|
||||||
(3, 'Autonomy three', 2, 0),
|
(3, 'Autonomy three', 2),
|
||||||
(4, 'Autonomy four', 13, 0);
|
(4, 'Autonomy four', 13);
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`province`(`id`, `name`, `countryFk`, `autonomyFk`, `warehouseFk`)
|
INSERT INTO `vn`.`province`(`id`, `name`, `countryFk`, `autonomyFk`, `warehouseFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Province one', 1, 1, NULL),
|
(1, 'Province one', 1, 1, NULL),
|
||||||
(2, 'Province two', 1, 1, NULL),
|
(2, 'Province two', 1, 1, NULL),
|
||||||
(3, 'Province three', 30, 2, NULL),
|
(3, 'Province three', 30, 2, NULL),
|
||||||
(4, 'Province four', 2, 3, NULL),
|
(4, 'Province four', 2, 3, NULL),
|
||||||
(5, 'Province five', 13, 4, NULL);
|
(5, 'Province five', 13, 4, NULL);
|
||||||
|
|
||||||
INSERT INTO `vn`.`town`(`id`, `name`, `provinceFk`)
|
INSERT INTO `vn`.`town`(`id`, `name`, `provinceFk`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -366,7 +364,6 @@ INSERT INTO `vn`.`postCode`(`code`, `townFk`, `geoFk`)
|
||||||
('46460', 2, 6),
|
('46460', 2, 6),
|
||||||
('46680', 3, 6),
|
('46680', 3, 6),
|
||||||
('46600', 4, 7),
|
('46600', 4, 7),
|
||||||
('46600',1, 6),
|
|
||||||
('EC170150', 5, 8);
|
('EC170150', 5, 8);
|
||||||
|
|
||||||
INSERT INTO `vn`.`clientType`(`code`, `type`)
|
INSERT INTO `vn`.`clientType`(`code`, `type`)
|
||||||
|
@ -388,23 +385,23 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`)
|
||||||
(4, 'GCN Channel'),
|
(4, 'GCN Channel'),
|
||||||
(5, 'The Newspaper');
|
(5, 'The Newspaper');
|
||||||
|
|
||||||
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`businessTypeFk`,`typeFk`)
|
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`businessTypeFk`,`typeFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
(1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
||||||
(1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
(1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
||||||
(1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
(1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
||||||
(1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
(1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
||||||
(1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 18, 0, 'florist','normal'),
|
(1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 18, 0, 'florist','normal'),
|
||||||
(1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 19, 0, 'florist','normal'),
|
(1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 19, 0, 'florist','normal'),
|
||||||
(1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 19, 0, 'florist','normal'),
|
(1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 19, 0, 'florist','normal'),
|
||||||
(1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 19, 0, 'florist','normal'),
|
(1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 19, 0, 'florist','normal'),
|
||||||
(1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 9, 0, 'florist','normal'),
|
(1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 9, 0, 'florist','normal'),
|
||||||
(1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, NULL, 1, 'florist','normal'),
|
(1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, NULL, 0, 'florist','normal'),
|
||||||
(1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 0, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses'),
|
(1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses'),
|
||||||
(1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 0, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses');
|
(1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses');
|
||||||
|
|
||||||
INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`)
|
INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`)
|
||||||
SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), UPPER(CONCAT(name, 'Social')), CONCAT(name, 'Contact'), UPPER(CONCAT(name, 'Street')), 'GOTHAM', 46460, 0, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1
|
SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), UPPER(CONCAT(name, 'Social')), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1
|
||||||
FROM `account`.`role` `r`
|
FROM `account`.`role` `r`
|
||||||
WHERE `r`.`hasLogin` = 1;
|
WHERE `r`.`hasLogin` = 1;
|
||||||
|
|
||||||
|
@ -415,7 +412,7 @@ INSERT INTO `vn`.`clientManaCache`(`clientFk`, `mana`, `dated`)
|
||||||
(1103, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
|
(1103, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
|
||||||
(1104, -30, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH));
|
(1104, -30, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH));
|
||||||
|
|
||||||
INSERT INTO `vn`.`mandateType`(`id`, `code`)
|
INSERT INTO `vn`.`mandateType`(`id`, `name`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'B2B'),
|
(1, 'B2B'),
|
||||||
(2, 'CORE'),
|
(2, 'CORE'),
|
||||||
|
@ -546,8 +543,7 @@ INSERT INTO `vn`.`observationType`(`id`,`description`, `code`)
|
||||||
(6, 'Weight', 'weight'),
|
(6, 'Weight', 'weight'),
|
||||||
(7, 'InvoiceOut', 'invoiceOut'),
|
(7, 'InvoiceOut', 'invoiceOut'),
|
||||||
(8, 'DropOff', 'dropOff'),
|
(8, 'DropOff', 'dropOff'),
|
||||||
(9, 'Sustitución', 'substitution'),
|
(9, 'Sustitución', 'substitution');
|
||||||
(10, 'Finance', 'finance');
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`addressObservation`(`id`,`addressFk`,`observationTypeFk`,`description`)
|
INSERT INTO `vn`.`addressObservation`(`id`,`addressFk`,`observationTypeFk`,`description`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -586,7 +582,6 @@ INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'PLANTS SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'GOTHAM', 1, 46000, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
|
(1, 'PLANTS SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'GOTHAM', 1, 46000, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
|
||||||
(2, 'FARMER KING', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 46000, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
|
(2, 'FARMER KING', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 46000, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
|
||||||
(4, 'INVENTARIO', 'INVENTARIO', 4000000004, NULL, NULL, 0, util.VN_CURDATE(), 1, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL, NULL),
|
|
||||||
(69, 'PACKAGING', 'Packaging nick', 4100000069, 1, '94935005K', 0, util.VN_CURDATE(), 1, 'supplier address 5', 'ASGARD', 3, 46600, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
|
(69, 'PACKAGING', 'Packaging nick', 4100000069, 1, '94935005K', 0, util.VN_CURDATE(), 1, 'supplier address 5', 'ASGARD', 3, 46600, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
|
||||||
(442, 'VERDNATURA LEVANTE SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 46000, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'),
|
(442, 'VERDNATURA LEVANTE SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 46000, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'),
|
||||||
(567, 'HOLLAND', 'Holland nick', 4000020567, 1, '14364089Z', 0, util.VN_CURDATE(), 1, 'supplier address 6', 'ASGARD', 3, 46600, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
|
(567, 'HOLLAND', 'Holland nick', 4000020567, 1, '14364089Z', 0, util.VN_CURDATE(), 1, 'supplier address 6', 'ASGARD', 3, 46600, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
|
||||||
|
@ -632,21 +627,14 @@ INSERT INTO vn.invoiceOutConfig
|
||||||
SET id = 1,
|
SET id = 1,
|
||||||
parallelism = 8;
|
parallelism = 8;
|
||||||
|
|
||||||
INSERT INTO `vn`.`invoiceOutSerial`
|
INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaFk`, `isCEE`, `type`)
|
||||||
(`code`,`description`, `isTaxed`, `taxAreaFk`, `isCEE`, `type`)
|
|
||||||
VALUES
|
VALUES
|
||||||
('A', 'Global nacional', 1, 'NATIONAL', 0, 'global'),
|
('A', 'Global nacional', 1, 'NATIONAL', 0, 'global'),
|
||||||
('T', 'Española rapida', 1, 'NATIONAL', 0, 'quick'),
|
('T', 'Española rapida', 1, 'NATIONAL', 0, 'quick'),
|
||||||
('V', 'Intracomunitaria global', 0, 'CEE', 1, 'global'),
|
('V', 'Intracomunitaria global', 0, 'CEE', 1, 'global'),
|
||||||
('M', 'Múltiple nacional', 1, 'NATIONAL', 0, 'multiple'),
|
('M', 'Múltiple nacional', 1, 'NATIONAL', 0, 'quick'),
|
||||||
('R', 'Rectificativa', 1, 'NATIONAL', 0, NULL),
|
('R', 'Rectificativa', 1, 'NATIONAL', 0, NULL),
|
||||||
('E', 'Exportación rápida', 0, 'WORLD', 0, 'quick'),
|
('E', 'Exportación rápida', 0, 'WORLD', 0, 'quick');
|
||||||
('H', 'Intracomunitaria rápida', 0, 'CEE', 1, 'quick'),
|
|
||||||
('P', 'Factura simplificada', 1, 'NATIONAL', 0, NULL),
|
|
||||||
('PE', 'COOPERATIE FLORAHOLLAND UA', 0, 'CEE', 1, NULL),
|
|
||||||
('S', 'Simplificada', 1, 'NATIONAL', 0, NULL),
|
|
||||||
('X', 'Exportación global', 0, 'WORLD', 0, 'global'),
|
|
||||||
('N', 'Múltiple Intracomunitaria', 0, 'CEE', 1, 'multiple');
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`)
|
INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -755,45 +743,45 @@ INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agen
|
||||||
(6, NULL, 57, util.VN_CURDATE(), 5, 7, 'sixth route', 1.7, 60, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 3),
|
(6, NULL, 57, util.VN_CURDATE(), 5, 7, 'sixth route', 1.7, 60, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 3),
|
||||||
(7, NULL, 57, util.VN_CURDATE(), 6, 8, 'seventh route', 0, 70, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 5);
|
(7, NULL, 57, util.VN_CURDATE(), 6, 8, 'seventh route', 0, 70, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 5);
|
||||||
|
|
||||||
INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`, `weight`, `cmrFk`, `problem`, `risk`)
|
INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`, `weight`, `cmrFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1 , 3, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 121, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 'hasHighRisk', 901.4),
|
(1 , 3, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 121, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1),
|
||||||
(2 , 1, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 1, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 2, 'hasHighRisk', 901.4),
|
(2 , 1, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 1, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 2),
|
||||||
(3 , 1, 7, 1, 6, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL, 3, NULL, NULL),
|
(3 , 1, 7, 1, 6, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL, 3),
|
||||||
(4 , 3, 2, 1, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 9, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL, NULL, NULL, NULL),
|
(4 , 3, 2, 1, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 9, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL, NULL),
|
||||||
(5 , 3, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL, NULL, NULL, NULL),
|
(5 , 3, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL, NULL),
|
||||||
(6 , 1, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, NULL, 'hasHighRisk', 901.4),
|
(6 , 1, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, NULL),
|
||||||
(7 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL, 'hasHighRisk', 901.4),
|
(7 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(8 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Bat cave', 121, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL, 'hasHighRisk', 901.4),
|
(8 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Bat cave', 121, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(9 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
|
(9 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(10, 1, 1, 5, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'Ingram Street', 2, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL, 'isTooLittle', NULL),
|
(10, 1, 1, 5, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'Ingram Street', 2, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(11, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'NY roofs', 122, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL, 'hasTicketRequest', NULL),
|
(11, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'NY roofs', 122, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(12, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
|
(12, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(13, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
|
(13, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(14, 1, 2, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1104, 'Malibu Point', 4, NULL, 0, 9, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
|
(14, 1, 2, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1104, 'Malibu Point', 4, NULL, 0, 9, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(15, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1105, 'An incredibly long alias for testing purposes', 125, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL, 'isFreezed', NULL),
|
(15, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1105, 'An incredibly long alias for testing purposes', 125, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(16, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, 388.7),
|
(16, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(17, 1, 7, 2, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, 388.7),
|
(17, 1, 7, 2, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(18, 1, 4, 4, 4, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1108, 'Cerebro', 128, NULL, 0, 12, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +12 HOUR), NULL, NULL, 'isFreezed', NULL),
|
(18, 1, 4, 4, 4, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1108, 'Cerebro', 128, NULL, 0, 12, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +12 HOUR), NULL, NULL),
|
||||||
(19, 1, 5, 5, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 1, NULL, 5, 1, util.VN_CURDATE(), NULL, NULL, 'isTaxDataChecked', NULL),
|
(19, 1, 5, 5, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 1, NULL, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(20, 1, 5, 5, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL, NULL, 'isTaxDataChecked', NULL),
|
(20, 1, 5, 5, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL, NULL),
|
||||||
(21, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Holland', 102, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL, NULL, 'isTaxDataChecked', NULL),
|
(21, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Holland', 102, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL, NULL),
|
||||||
(22, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Japan', 103, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL, NULL, 'isTaxDataChecked', NULL),
|
(22, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Japan', 103, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL, NULL),
|
||||||
(23, NULL, 8, 1, 7, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'address 21', 121, NULL, 0, 5, 5, 1, util.VN_CURDATE(), NULL, NULL, 'hasTicketRequest, hasHighRisk', 901.4),
|
(23, NULL, 8, 1, 7, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'address 21', 121, NULL, 0, 5, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(24 ,NULL, 8, 1, 7, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 5, 5, 1, util.VN_CURDATE(), NULL, NULL, 'hasHighRisk', 901.4),
|
(24 ,NULL, 8, 1, 7, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 5, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(25 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL, 'hasHighRisk', 901.4),
|
(25 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(26 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'An incredibly long alias for testing purposes', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL, 'hasHighRisk', 901.4),
|
(26 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'An incredibly long alias for testing purposes', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(27 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Wolverine', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, 901.4),
|
(27 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Wolverine', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(28, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
|
(28, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(29, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
|
(29, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(30, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
|
(30, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(31, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
|
(31, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(32, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
|
(32, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(33, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'NY roofs', 122, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
|
(33, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'NY roofs', 122, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||||
(34, 1, 1, 1, 3, util.VN_CURDATE(), util.VN_CURDATE(), 1103, 'BEJAR', 123, NULL, 0, 1, 16, 0, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
|
(34, 1, 1, 1, 3, util.VN_CURDATE(), util.VN_CURDATE(), 1103, 'BEJAR', 123, NULL, 0, 1, 16, 0, util.VN_CURDATE(), NULL, NULL),
|
||||||
(35, 1, 1, 1, 3, util.VN_CURDATE(), util.VN_CURDATE(), 1102, 'Somewhere in Philippines', 123, NULL, 0, 1, 16, 0, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
|
(35, 1, 1, 1, 3, util.VN_CURDATE(), util.VN_CURDATE(), 1102, 'Somewhere in Philippines', 123, NULL, 0, 1, 16, 0, util.VN_CURDATE(), NULL, NULL),
|
||||||
(36, 1, 1, 1, 3, util.VN_CURDATE(), util.VN_CURDATE(), 1102, 'Ant-Man Adventure', 123, NULL, 0, 1, 16, 0, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
|
(36, 1, 1, 1, 3, util.VN_CURDATE(), util.VN_CURDATE(), 1102, 'Ant-Man Adventure', 123, NULL, 0, 1, 16, 0, util.VN_CURDATE(), NULL, NULL),
|
||||||
(37, 1, 1, 1, 3, util.VN_CURDATE(), util.VN_CURDATE(), 1110, 'Deadpool swords', 123, NULL, 0, 1, 16, 0, util.VN_CURDATE(), NULL, NULL, NULL, NULL);
|
(37, 1, 1, 1, 3, util.VN_CURDATE(), util.VN_CURDATE(), 1110, 'Deadpool swords', 123, NULL, 0, 1, 16, 0, util.VN_CURDATE(), NULL, NULL);
|
||||||
|
|
||||||
INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`)
|
INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -831,10 +819,10 @@ INSERT INTO `vn`.`ticketTracking`(`ticketFk`, `stateFk`, `userFk`, `created`)
|
||||||
(12, 3, 19, util.VN_NOW()),
|
(12, 3, 19, util.VN_NOW()),
|
||||||
(13, 3, 19, util.VN_NOW()),
|
(13, 3, 19, util.VN_NOW()),
|
||||||
(14, 3, 19, util.VN_NOW()),
|
(14, 3, 19, util.VN_NOW()),
|
||||||
(15, 10, 19, util.VN_NOW()),
|
(15, 2, 19, util.VN_NOW()),
|
||||||
(16, 3, 19, util.VN_NOW()),
|
(16, 3, 19, util.VN_NOW()),
|
||||||
(17, 2, 19, util.VN_NOW()),
|
(17, 2, 19, util.VN_NOW()),
|
||||||
(37, 10, 19, util.VN_NOW()),
|
(18, 2, 19, util.VN_NOW()),
|
||||||
(19, 2, 19, util.VN_NOW()),
|
(19, 2, 19, util.VN_NOW()),
|
||||||
(20, 1, 19, DATE_ADD(util.VN_NOW(), INTERVAL +1 MONTH)),
|
(20, 1, 19, DATE_ADD(util.VN_NOW(), INTERVAL +1 MONTH)),
|
||||||
(21, 1, 19, DATE_ADD(util.VN_NOW(), INTERVAL +1 MONTH)),
|
(21, 1, 19, DATE_ADD(util.VN_NOW(), INTERVAL +1 MONTH)),
|
||||||
|
@ -1041,20 +1029,19 @@ INSERT INTO `vn`.`expeditionStateType`(`id`, `description`, `code`)
|
||||||
|
|
||||||
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `freightItemFk`, `created`, `counter`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`, `hostFk`)
|
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `freightItemFk`, `created`, `counter`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`, `hostFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, 'UR9000006041', 94, 1, 'pc1'),
|
(1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, 'UR9000006041', 94, 1, 'pc1'),
|
||||||
(2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 18, 'UR9000006041', 94, 1, NULL),
|
(2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 18, 'UR9000006041', 94, 1, NULL),
|
||||||
(3, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 18, 'UR9000006041', 94, 2, NULL),
|
(3, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 18, 'UR9000006041', 94, 2, NULL),
|
||||||
(4, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 18, 'UR9000006041', 94, 2, NULL),
|
(4, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 18, 'UR9000006041', 94, 2, NULL),
|
||||||
(5, 1, 2, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, NULL, 94, 3, NULL),
|
(5, 1, 2, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, NULL, 94, 3, NULL),
|
||||||
(6, 7, 3, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 18, NULL, 94, 3, NULL),
|
(6, 7, 3, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 18, NULL, 94, 3, NULL),
|
||||||
(7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), 1, 18, NULL, 94, NULL,NULL),
|
(7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), 1, 18, NULL, 94, NULL,NULL),
|
||||||
(8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), 1, 18, NULL, 94, 1, NULL),
|
(8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), 1, 18, NULL, 94, 1, NULL),
|
||||||
(9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, NULL, 94, 2, NULL),
|
(9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, NULL, 94, 2, NULL),
|
||||||
(10, 7, 7, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
|
(10, 7, 7, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
|
||||||
(11, 7, 8, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
|
(11, 7, 8, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
|
||||||
(12, 7, 9, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
|
(12, 7, 9, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
|
||||||
(13, 1, 10, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
|
(13, 1, 10,71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL);
|
||||||
(14, 1, 37, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL);
|
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`expeditionState`(`id`, `created`, `expeditionFk`, `typeFk`, `userFk`)
|
INSERT INTO `vn`.`expeditionState`(`id`, `created`, `expeditionFk`, `typeFk`, `userFk`)
|
||||||
|
@ -1072,50 +1059,50 @@ INSERT INTO `vn`.`ticketPackaging`(`id`, `ticketFk`, `packagingFk`, `quantity`,
|
||||||
(2, 2, 2, 1, util.VN_CURDATE(), NULL),
|
(2, 2, 2, 1, util.VN_CURDATE(), NULL),
|
||||||
(3, 3, 2, 4, util.VN_CURDATE(), NULL);
|
(3, 3, 2, 4, util.VN_CURDATE(), NULL);
|
||||||
|
|
||||||
INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `price`, `discount`, `reserved`, `isPicked`, `created`, `problem`)
|
INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `price`, `discount`, `reserved`, `isPicked`, `created`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 1, 'Ranged weapon longbow 200cm', 5, 100.39, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 'hasComponentLack'),
|
(1, 1, 1, 'Ranged weapon longbow 200cm', 5, 100.39, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
|
||||||
(2, 2, 1, 'Melee weapon combat fist 15cm', 10, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 'hasComponentLack'),
|
(2, 2, 1, 'Melee weapon combat fist 15cm', 10, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
|
||||||
(3, 1, 1, 'Ranged weapon longbow 200cm', 2, 100.39, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 'hasComponentLack'),
|
(3, 1, 1, 'Ranged weapon longbow 200cm', 2, 100.39, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
|
||||||
(4, 4, 1, 'Melee weapon heavy shield 100cm', 20, 1.69, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 'hasComponentLack'),
|
(4, 4, 1, 'Melee weapon heavy shield 100cm', 20, 1.69, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
|
||||||
(5, 1, 2, 'Ranged weapon longbow 200cm', 1, 110.33, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 'hasComponentLack'),
|
(5, 1, 2, 'Ranged weapon longbow 200cm', 1, 110.33, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
|
||||||
(6, 1, 3, 'Ranged weapon longbow 200cm', 1, 110.33, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 'hasComponentLack'),
|
(6, 1, 3, 'Ranged weapon longbow 200cm', 1, 110.33, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH)),
|
||||||
(7, 2, 11, 'Melee weapon combat fist 15cm', 15, 7.74, 0, 0, 0, util.VN_CURDATE(), NULL),
|
(7, 2, 11, 'Melee weapon combat fist 15cm', 15, 7.74, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(8, 4, 11, 'Melee weapon heavy shield 100cm', 10, 1.79, 0, 0, 0, util.VN_CURDATE(), NULL),
|
(8, 4, 11, 'Melee weapon heavy shield 100cm', 10, 1.79, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(9, 1, 16, 'Ranged weapon longbow 200cm', 1, 103.49, 0, 0, 0, util.VN_CURDATE(), NULL),
|
(9, 1, 16, 'Ranged weapon longbow 200cm', 1, 103.49, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(10, 2, 16, 'Melee weapon combat fist 15cm', 10, 7.09, 0, 0, 0, util.VN_CURDATE(), NULL),
|
(10, 2, 16, 'Melee weapon combat fist 15cm', 10, 7.09, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(11, 1, 16, 'Ranged weapon longbow 200cm', 1, 103.49, 0, 0, 0, util.VN_CURDATE(), NULL),
|
(11, 1, 16, 'Ranged weapon longbow 200cm', 1, 103.49, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(12, 4, 16, 'Melee weapon heavy shield 100cm', 20, 1.71, 0, 0, 0, util.VN_CURDATE(), NULL),
|
(12, 4, 16, 'Melee weapon heavy shield 100cm', 20, 1.71, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(13, 2, 8, 'Melee weapon combat fist 15cm', 10, 7.08, 0, 0, 0, util.VN_CURDATE(), NULL),
|
(13, 2, 8, 'Melee weapon combat fist 15cm', 10, 7.08, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(14, 1, 8, 'Ranged weapon longbow 200cm', 2, 103.49, 0, 0, 0, util.VN_CURDATE(), NULL),
|
(14, 1, 8, 'Ranged weapon longbow 200cm', 2, 103.49, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(15, 1, 19, 'Ranged weapon longbow 200cm', 1, 103.49, 0, 0, 0, util.VN_CURDATE(), NULL),
|
(15, 1, 19, 'Ranged weapon longbow 200cm', 1, 103.49, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(16, 2, 20, 'Melee weapon combat fist 15cm', 20, 7.07, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
|
(16, 2, 20, 'Melee weapon combat fist 15cm', 20, 7.07, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(17, 2, 22, 'Melee weapon combat fist 15cm', 30, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), 'hasComponentLack'),
|
(17, 2, 22, 'Melee weapon combat fist 15cm', 30, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)),
|
||||||
(18, 4, 22, 'Melee weapon heavy shield 100cm', 20, 1.69, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), 'hasComponentLack'),
|
(18, 4, 22, 'Melee weapon heavy shield 100cm', 20, 1.69, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)),
|
||||||
(19, 1, 4, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), 'hasComponentLack'),
|
(19, 1, 4, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH)),
|
||||||
(20, 1, 5, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), 'hasComponentLack'),
|
(20, 1, 5, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH)),
|
||||||
(21, 1, 6, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 'hasComponentLack'),
|
(21, 1, 6, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
|
||||||
(22, 1, 7, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
|
(22, 1, 7, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(23, 1, 9, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
|
(23, 1, 9, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(24, 1, 10, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
|
(24, 1, 10, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(25, 4, 12, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
|
(25, 4, 12, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(26, 4, 13, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
|
(26, 4, 13, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(27, 4, 14, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
|
(27, 4, 14, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(28, 4, 15, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
|
(28, 4, 15, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(29, 4, 17, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
|
(29, 4, 17, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(30, 4, 18, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
|
(30, 4, 18, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(31, 2, 23, 'Melee weapon combat fist 15cm', -5, 7.08, 0, 0, 0, util.VN_CURDATE(), NULL),
|
(31, 2, 23, 'Melee weapon combat fist 15cm', -5, 7.08, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(32, 1, 24, 'Ranged weapon longbow 200cm', -1, 8.07, 0, 0, 0, util.VN_CURDATE(), NULL),
|
(32, 1, 24, 'Ranged weapon longbow 200cm', -1, 8.07, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(33, 5, 14, 'Ranged weapon pistol 9mm', 50, 1.79, 0, 0, 0, util.VN_CURDATE(), NULL),
|
(33, 5, 14, 'Ranged weapon pistol 9mm', 50, 1.79, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(34, 4, 28, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
|
(34, 4, 28, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(35, 4, 29, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
|
(35, 4, 29, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(37, 4, 31, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE(), NULL),
|
(37, 4, 31, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(36, 4, 30, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
|
(36, 4, 30, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(38, 2, 32, 'Melee weapon combat fist 15cm', 30, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), 'hasComponentLack'),
|
(38, 2, 32, 'Melee weapon combat fist 15cm', 30, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)),
|
||||||
(39, 1, 32, 'Ranged weapon longbow 200cm', 2, 103.49, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
|
(39, 1, 32, 'Ranged weapon longbow 200cm', 2, 103.49, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(40, 2, 34, 'Melee weapon combat fist 15cm', 10.00, 3.91, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
|
(40, 2, 34, 'Melee weapon combat fist 15cm', 10.00, 3.91, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(41, 2, 35, 'Melee weapon combat fist 15cm', 8.00, 3.01, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
|
(41, 2, 35, 'Melee weapon combat fist 15cm', 8.00, 3.01, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(42, 2, 36, 'Melee weapon combat fist 15cm', 6.00, 2.50, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack');
|
(42, 2, 36, 'Melee weapon combat fist 15cm', 6.00, 2.50, 0, 0, 0, util.VN_CURDATE());
|
||||||
|
|
||||||
INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
|
INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -1254,9 +1241,9 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
|
||||||
|
|
||||||
INSERT INTO `vn`.`itemShelving` (`itemFk`, `shelvingFk`, `visible`, `grouping`, `packing`,`buyFk`, `userFk`)
|
INSERT INTO `vn`.`itemShelving` (`itemFk`, `shelvingFk`, `visible`, `grouping`, `packing`,`buyFk`, `userFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(2, 11, 1, 1, 1, 2,1106),
|
(2, 'GVC', 1, 1, 1, 2,1106),
|
||||||
(4, 12, 1, 1, 1, NULL,1106),
|
(4, 'HEJ', 1, 1, 1, NULL,1106),
|
||||||
(1, 13, 2, 12, 12, NULL,1106);
|
(1, 'UXN', 2, 12, 12, NULL,1106);
|
||||||
|
|
||||||
INSERT INTO `vn`.`itemShelvingSale` (`itemShelvingFk`, `saleFk`, `quantity`, `created`, `userFk`)
|
INSERT INTO `vn`.`itemShelvingSale` (`itemShelvingFk`, `saleFk`, `quantity`, `created`, `userFk`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -1489,8 +1476,7 @@ INSERT INTO `vn`.`ticketWeekly`(`ticketFk`, `weekDay`)
|
||||||
(2, 1),
|
(2, 1),
|
||||||
(3, 2),
|
(3, 2),
|
||||||
(5, 6),
|
(5, 6),
|
||||||
(15, 6),
|
(15, 6);
|
||||||
(17, 6);
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk, taxFk)
|
INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk, taxFk)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -1505,55 +1491,50 @@ INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk
|
||||||
(9, '99610289193', 302, 2972, util.VN_CURDATE(), 3871, 442, 1),
|
(9, '99610289193', 302, 2972, util.VN_CURDATE(), 3871, 442, 1),
|
||||||
(10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1);
|
(10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyModeFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`, `awbFK`, `isRaid`, `daysInForward`)
|
INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyModeFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`, `awbFK`)
|
||||||
VALUES (1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000, 'first travel', 1, 1, 1, FALSE, NULL),
|
|
||||||
(2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150.00, 2000, 'second travel', 2, 2, 2, FALSE, NULL),
|
|
||||||
(3, util.VN_CURDATE(), util.VN_CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1, 1, 3, FALSE, NULL),
|
|
||||||
(4, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 3, 1, 50.00, 500, 'fourth travel', 0, 2, 4, FALSE, NULL),
|
|
||||||
(5, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1, 5, FALSE, NULL),
|
|
||||||
(6, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2, 6, FALSE,NULL),
|
|
||||||
(7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1, 7, TRUE, 2),
|
|
||||||
(8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2, 10, FALSE, NULL),
|
|
||||||
(10, DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), 5, 1, 1, 50.00, 500, 'nineth travel', 1, 2, 10, TRUE, 2),
|
|
||||||
(11, util.VN_CURDATE() - INTERVAL 1 DAY , util.VN_CURDATE(), 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4, FALSE, NULL),
|
|
||||||
(12, util.VN_CURDATE() , util.VN_CURDATE() + INTERVAL 1 DAY, 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4, FALSE, NULL);
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `evaNotes`, `typeFk`)
|
|
||||||
VALUES
|
|
||||||
(1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, '', 'packaging'),
|
|
||||||
(2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 'observation two', 'product'),
|
|
||||||
(3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 'observation three', 'product'),
|
|
||||||
(4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 'observation four', 'product'),
|
|
||||||
(5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 'observation five', 'product'),
|
|
||||||
(6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 'observation six', 'product'),
|
|
||||||
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 'observation seven', 'product'),
|
|
||||||
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, '', 'product'),
|
|
||||||
(9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, '', 'product'),
|
|
||||||
(10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 10', 1, '', 'product'),
|
|
||||||
(99, 69, util.VN_CURDATE() - INTERVAL 1 MONTH, 11, 0, 442, 'IN2009', 'Movement 99', 0, '', 'product');
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`entryConfig` (`defaultEntry`, `inventorySupplierFk`, `defaultSupplierFk`)
|
|
||||||
VALUES (2, 4, 1);
|
|
||||||
|
|
||||||
INSERT INTO `bs`.`waste`(`buyerFk`, `year`, `week`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWasteQuantity`, `saleExternalWaste`, `saleFaultWaste`, `saleContainerWaste`, `saleBreakWaste`, `saleOtherWaste`)
|
|
||||||
VALUES
|
VALUES
|
||||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 1, 1, '1062', '51', '56.20', '56.20', '56.20', '56.20', '56.20'),
|
(1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000, 'first travel', 1, 1, 1),
|
||||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '35074', '687', '53.12', '89.69', '56.20', '56.20', '56.20'),
|
(2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150, 2000, 'second travel', 2, 2, 2),
|
||||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '1777', '13', '12.02', '53.12', '56.20', '56.20', '56.20'),
|
(3, util.VN_CURDATE(), util.VN_CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1, 1, 3),
|
||||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '3182', '59', '51', '56.20', '56.20', '56.20', '56.20'),
|
(4, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 3, 1, 50.00, 500, 'fourth travel', 0, 2, 4),
|
||||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '1747', '13', '53.12', '53.12', '56.20', '56.20', '56.20'),
|
(5, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1, 5),
|
||||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '7182', '59', '51', '53.12', '56.20', '56.20', '56.20'),
|
(6, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2, 6),
|
||||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '1777', '13', '89.69', '89.69', '56.20', '56.20', '56.20'),
|
(7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1, 7),
|
||||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 8, 1, '4181', '59', '53.12', '53.12', '56.20', '56.20', '56.20'),
|
(8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2, 10),
|
||||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 9, 1, '7268', '59', '12.02', '56.20', '56.20', '56.20', '56.20'),
|
(10, DATE_ADD(util.VN_CURDATE(), INTERVAL + 5 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 5 DAY), 5, 1, 1, 50.00, 500, 'nineth travel', 1, 2, 10);
|
||||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '-74', '0', '51', '89.69', '56.20', '56.20', '56.20'),
|
|
||||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '-7', '0', '12.02', '53.12', '56.20', '56.20', '56.20'),
|
|
||||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '1100', '0', '51', '56.20', '56.20', '56.20', '56.20'),
|
|
||||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '848', '-187', '12.02', '89.69', '56.20', '56.20', '56.20'),
|
|
||||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '186', '0', '51', '53.12', '56.20', '56.20', '56.20'),
|
|
||||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '277', '0', '53.12', '56.20', '56.20', '56.20', '56.20');
|
|
||||||
|
|
||||||
INSERT INTO vn.buy(id,entryFk,itemFk,buyingValue,quantity,packagingFk,stickers,freightValue,packageValue,comissionValue,packing,grouping,groupingMode,location,price1,price2,price3,printedStickers,isChecked,isIgnored,weight,created)
|
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `evaNotes`)
|
||||||
|
VALUES
|
||||||
|
(1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, 0, ''),
|
||||||
|
(2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 0, 'observation two'),
|
||||||
|
(3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 0, 'observation three'),
|
||||||
|
(4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 0, 'observation four'),
|
||||||
|
(5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 0, 'observation five'),
|
||||||
|
(6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 0, 'observation six'),
|
||||||
|
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 0, 'observation seven'),
|
||||||
|
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, 1, ''),
|
||||||
|
(9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, 1, ''),
|
||||||
|
(10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, 1, '');
|
||||||
|
|
||||||
|
INSERT INTO `bs`.`waste`(`buyerFk`, `year`, `week`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleQuantity`, `saleInternalWaste`, `saleExternalWaste`)
|
||||||
|
VALUES
|
||||||
|
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 1, 1, '1062', '51', '56.20', '56.20'),
|
||||||
|
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '35074', '687', '53.12', '89.69'),
|
||||||
|
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '1777', '13', '12.02', '53.12'),
|
||||||
|
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '3182', '59', '51', '56.20'),
|
||||||
|
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '1747', '13', '53.12', '53.12'),
|
||||||
|
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '7182', '59', '51', '53.12'),
|
||||||
|
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '1777', '13', '89.69', '89.69'),
|
||||||
|
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 8, 1, '4181', '59', '53.12', '53.12'),
|
||||||
|
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 9, 1, '7268', '59', '12.02', '56.20'),
|
||||||
|
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '-74', '0', '51', '89.69'),
|
||||||
|
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '-7', '0', '12.02', '53.12'),
|
||||||
|
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '1100', '0', '51', '56.20'),
|
||||||
|
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '848', '-187', '12.02', '89.69'),
|
||||||
|
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '186', '0', '51', '53.12'),
|
||||||
|
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '277', '0', '53.12', '56.20');
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`packagingFk`,`stickers`,`freightValue`,`packageValue`,`comissionValue`,`packing`,`grouping`,`groupingMode`,`location`,`price1`,`price2`,`price3`, `printedStickers`,`isChecked`,`isIgnored`,`weight`, `created`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE() - INTERVAL 2 MONTH),
|
(1, 1, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE() - INTERVAL 2 MONTH),
|
||||||
(2, 2, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE() - INTERVAL 1 MONTH),
|
(2, 2, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE() - INTERVAL 1 MONTH),
|
||||||
|
@ -1569,8 +1550,7 @@ INSERT INTO `bs`.`waste`(`buyerFk`, `year`, `week`, `itemFk`, `itemTypeFk`, `sal
|
||||||
(12, 6, 4, 1.25, 0, 3, 1, 2.500, 2.500, 0.000, 10, 10, 'grouping', NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()),
|
(12, 6, 4, 1.25, 0, 3, 1, 2.500, 2.500, 0.000, 10, 10, 'grouping', NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()),
|
||||||
(13, 7, 1, 50, 0, 3, 1, 2.000, 2.000, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 4, util.VN_CURDATE()),
|
(13, 7, 1, 50, 0, 3, 1, 2.000, 2.000, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 4, util.VN_CURDATE()),
|
||||||
(14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 'grouping', NULL, 0.00, 7.30, 7.00, 0, 1, 0, 4, util.VN_CURDATE()),
|
(14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 'grouping', NULL, 0.00, 7.30, 7.00, 0, 1, 0, 4, util.VN_CURDATE()),
|
||||||
(15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 'grouping', NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()),
|
(15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 'grouping', NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE());
|
||||||
(16, 99,1,50.0000, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.60, 99.40, 0, 1, 0, 1.00, '2024-07-30 08:13:51.000');
|
|
||||||
|
|
||||||
INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`,`total`, `date_make`, `first_row_stamp`, `confirm_date`)
|
INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`,`total`, `date_make`, `first_row_stamp`, `confirm_date`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -2451,33 +2431,30 @@ INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `manual`, `direction`, `
|
||||||
(1107, CONCAT(util.VN_CURDATE(), ' 10:20'), TRUE, 'middle', 1),
|
(1107, CONCAT(util.VN_CURDATE(), ' 10:20'), TRUE, 'middle', 1),
|
||||||
(1107, CONCAT(util.VN_CURDATE(), ' 14:50'), TRUE, 'out', 1);
|
(1107, CONCAT(util.VN_CURDATE(), ' 14:50'), TRUE, 'out', 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`dmsType`
|
INSERT INTO `vn`.`dmsType`(`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`)
|
||||||
(`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`)
|
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Facturas Recibidas', 1, 1, 'invoiceIn'),
|
(1, 'Facturas Recibidas', NULL, NULL, 'invoiceIn'),
|
||||||
(2, 'Doc oficial', NULL, NULL, 'officialDoc'),
|
(2, 'Doc oficial', NULL, NULL, 'officialDoc'),
|
||||||
(3, 'Laboral', 37, 37, 'hhrrData'),
|
(3, 'Laboral', 37, 37, 'hhrrData'),
|
||||||
(4, 'Albaranes recibidos', NULL, NULL, 'deliveryNote'),
|
(4, 'Albaranes recibidos', NULL, NULL, 'deliveryNote'),
|
||||||
(5, 'Otros', 1, 1, 'miscellaneous'),
|
(5, 'Otros', 1, 1, 'miscellaneous'),
|
||||||
(6, 'Pruebas', NULL, NULL, 'tests'),
|
(6, 'Pruebas', NULL, NULL, 'tests'),
|
||||||
(7, 'IAE Clientes', 1, 1, 'economicActivitiesTax'),
|
(7, 'IAE Clientes', 1, 1, 'economicActivitiesTax'),
|
||||||
(8, 'Fiscal', NULL, NULL, 'fiscal'),
|
(8, 'Fiscal', NULL, NULL, 'fiscal'),
|
||||||
(9, 'Vehiculos', NULL, NULL, 'vehicles'),
|
(9, 'Vehiculos', NULL, NULL, 'vehicles'),
|
||||||
(10, 'Plantillas', NULL, NULL, 'templates'),
|
(10, 'Plantillas', NULL, NULL, 'templates'),
|
||||||
(11, 'Contratos', NULL, NULL, 'contracts'),
|
(11, 'Contratos', NULL, NULL, 'contracts'),
|
||||||
(12, 'ley de pagos', 1, 1, 'paymentsLaw'),
|
(12, 'ley de pagos', 1, 1, 'paymentsLaw'),
|
||||||
(13, 'Basura', 1, 1, 'trash'),
|
(13, 'Basura', 1, 1, 'trash'),
|
||||||
(14, 'Ticket', 1, 1, 'ticket'),
|
(14, 'Ticket', 1, 1, 'ticket'),
|
||||||
(15, 'Presupuestos', NULL, NULL, 'budgets'),
|
(15, 'Presupuestos', NULL, NULL, 'budgets'),
|
||||||
(16, 'Logistica', NULL, NULL, 'logistics'),
|
(16, 'Logistica', NULL, NULL, 'logistics'),
|
||||||
(17, 'cmr', 1, 1, 'cmr'),
|
(17, 'cmr', 1, 1, 'cmr'),
|
||||||
(18, 'dua', NULL, NULL, 'dua'),
|
(18, 'dua', NULL, NULL, 'dua'),
|
||||||
(19, 'inmovilizado', NULL, NULL, 'fixedAssets'),
|
(19, 'inmovilizado', NULL, NULL, 'fixedAssets'),
|
||||||
(20, 'Reclamación', 1, 1, 'claim'),
|
(20, 'Reclamación', 1, 1, 'claim'),
|
||||||
(21, 'Entrada', 1, 1, 'entry'),
|
(21, 'Entrada', 1, 1, 'entry'),
|
||||||
(22, 'Proveedor', 1, 1, 'supplier'),
|
(22, 'Proveedor', 1, 1, 'supplier');
|
||||||
(23, 'Termografos', 35, 35, 'thermograph'),
|
|
||||||
(24, 'Sello de calidad', 1, 1, 'qualitySeal');
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`)
|
INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -2485,7 +2462,7 @@ INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `wa
|
||||||
(2, 5, '2.txt', 'text/plain', 5, 1, 442, 1, TRUE, 'Client:104', 'Client:104 dms for the client', util.VN_CURDATE()),
|
(2, 5, '2.txt', 'text/plain', 5, 1, 442, 1, TRUE, 'Client:104', 'Client:104 dms for the client', util.VN_CURDATE()),
|
||||||
(3, 5, '3.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Client: 104', 'Client:104 readme', util.VN_CURDATE()),
|
(3, 5, '3.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Client: 104', 'Client:104 readme', util.VN_CURDATE()),
|
||||||
(4, 3, '4.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Worker: 106', 'Worker:106 readme', util.VN_CURDATE()),
|
(4, 3, '4.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Worker: 106', 'Worker:106 readme', util.VN_CURDATE()),
|
||||||
(5, 23, '5.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'travel: 1', 'dmsForThermograph', util.VN_CURDATE()),
|
(5, 5, '5.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'travel: 1', 'dmsForThermograph', util.VN_CURDATE()),
|
||||||
(6, 5, '6.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'NotExists', 'DoesNotExists', util.VN_CURDATE()),
|
(6, 5, '6.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'NotExists', 'DoesNotExists', util.VN_CURDATE()),
|
||||||
(7, 20, '7.jpg', 'image/jpeg', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()),
|
(7, 20, '7.jpg', 'image/jpeg', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()),
|
||||||
(8, 20, '8.mp4', 'video/mp4', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()),
|
(8, 20, '8.mp4', 'video/mp4', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()),
|
||||||
|
@ -2506,7 +2483,7 @@ INSERT INTO `vn`.`clientDms`(`clientFk`, `dmsFk`)
|
||||||
(1104, 2),
|
(1104, 2),
|
||||||
(1104, 3);
|
(1104, 3);
|
||||||
|
|
||||||
INSERT INTO `vn`.`workerDms`(`id`, `workerFk`, `dmsFk`,`isReadableByWorker`)
|
INSERT INTO `vn`.`workerDocument`(`id`, `worker`, `document`,`isReadableByWorker`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1106, 4, TRUE),
|
(1, 1106, 4, TRUE),
|
||||||
(2, 1107, 3, FALSE);
|
(2, 1107, 3, FALSE);
|
||||||
|
@ -2521,6 +2498,10 @@ INSERT INTO `vn`.`queuePriority`(`id`, `priority`, `code`)
|
||||||
(2, 'Normal', 'normal'),
|
(2, 'Normal', 'normal'),
|
||||||
(3, 'Baja', 'low');
|
(3, 'Baja', 'low');
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`workerTimeControlParams` (`id`, `dayBreak`, `weekBreak`, `weekScope`, `dayWorkMax`, `dayStayMax`, `weekMaxBreak`, `weekMaxScope`, `askInOut`)
|
||||||
|
VALUES
|
||||||
|
(1, 43200, 129600, 734400, 43200, 50400, 259200, 1296000, 36000);
|
||||||
|
|
||||||
INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11');
|
INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11');
|
||||||
|
|
||||||
INSERT INTO `vn`.`thermograph`(`id`, `model`)
|
INSERT INTO `vn`.`thermograph`(`id`, `model`)
|
||||||
|
@ -2531,15 +2512,14 @@ INSERT INTO `vn`.`thermograph`(`id`, `model`)
|
||||||
('138350-0', 'DISPOSABLE');
|
('138350-0', 'DISPOSABLE');
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`travelThermograph`
|
INSERT INTO `vn`.`travelThermograph`(`thermographFk`, `created`, `warehouseFk`, `travelFk`, `temperatureFk`, `result`, `dmsFk`)
|
||||||
(`thermographFk`, `created`, `warehouseFk`, `travelFk`, `temperatureFk`, `minTemperature`, `maxTemperature`, `result`, `dmsFk`)
|
|
||||||
VALUES
|
VALUES
|
||||||
('TMM190901395', util.VN_CURDATE(), 1, 1, 'WARM', NULL, NULL, 'Ok', NULL),
|
('TMM190901395', util.VN_CURDATE(), 1, 1, 'WARM', 'Ok', NULL),
|
||||||
('TL.BBA85422', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 2, 'COOL', NULL, NULL, 'Ok', NULL),
|
('TL.BBA85422', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 2, 'COOL', 'Ok', NULL),
|
||||||
('TL.BBA85422', util.VN_CURDATE(), 2, 1, 'COOL', NULL, NULL, 'can not read the temperature', NULL),
|
('TL.BBA85422', util.VN_CURDATE(), 2, 1, 'COOL', 'can not read the temperature', NULL),
|
||||||
('TZ1905012010', util.VN_CURDATE(), 1, 1, 'WARM', NULL, NULL, 'Temperature in range', 5),
|
('TZ1905012010', util.VN_CURDATE(), 1, 1, 'WARM', 'Temperature in range', 5),
|
||||||
('138350-0', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 'WARM', 2, 12, NULL, 5),
|
('138350-0', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 'WARM', NULL, 5),
|
||||||
('138350-0', util.VN_CURDATE(), 1, NULL, 'COOL', NULL, NULL, NULL, NULL);
|
('138350-0', util.VN_CURDATE(), 1, NULL, 'COOL', NULL, NULL);
|
||||||
|
|
||||||
REPLACE INTO `vn`.`incoterms`(`code`, `name`)
|
REPLACE INTO `vn`.`incoterms`(`code`, `name`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -2588,18 +2568,18 @@ INSERT INTO `vn`.`rate`(`dated`, `warehouseFk`, `rate0`, `rate1`, `rate2`, `rate
|
||||||
(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR), 1, 10, 15, 20, 25),
|
(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR), 1, 10, 15, 20, 25),
|
||||||
(util.VN_CURDATE(), 1, 12, 17, 22, 27);
|
(util.VN_CURDATE(), 1, 12, 17, 22, 27);
|
||||||
|
|
||||||
INSERT INTO `vn`.`dua` (id, code, issued, operated, booked, bookEntried, gestdocFk, customsValue, companyFk)
|
INSERT INTO `vn`.`dua` (id, code, awbFk__, issued, operated, booked, bookEntried, gestdocFk, customsValue, companyFk)
|
||||||
VALUES
|
VALUES
|
||||||
(1, '19ES0028013A481523', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 1, 11276.95, 442),
|
(1, '19ES0028013A481523', 1, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 1, 11276.95, 442),
|
||||||
(2, '21ES00280136115760', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 1376.20, 442),
|
(2, '21ES00280136115760', 2, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 1376.20, 442),
|
||||||
(3, '19ES00280131956004', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 3, 14268.50, 442),
|
(3, '19ES00280131956004', 3, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 3, 14268.50, 442),
|
||||||
(4, '19ES00280131955995', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 1, 8242.50, 442),
|
(4, '19ES00280131955995', 4, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 1, 8242.50, 442),
|
||||||
(5, '19ES00280132022070', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 10012.49, 442),
|
(5, '19ES00280132022070', 5, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 10012.49, 442),
|
||||||
(6, '19ES00280132032308', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 19914.25, 442),
|
(6, '19ES00280132032308', 6, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 19914.25, 442),
|
||||||
(7, '19ES00280132025489', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 1934.06, 442),
|
(7, '19ES00280132025489', 7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 1934.06, 442),
|
||||||
(8, '19ES00280132025490', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 3618.52, 442),
|
(8, '19ES00280132025490', 8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 3618.52, 442),
|
||||||
(9, '19ES00280132025491', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 7126.23, 442),
|
(9, '19ES00280132025491', 9, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 7126.23, 442),
|
||||||
(10, '19ES00280132025492', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 4631.45, 442);
|
(10, '19ES00280132025492', 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 4631.45, 442);
|
||||||
|
|
||||||
INSERT INTO `vn`.`duaEntry` (`duaFk`, `entryFk`, `value`, `customsValue`, `euroValue`)
|
INSERT INTO `vn`.`duaEntry` (`duaFk`, `entryFk`, `value`, `customsValue`, `euroValue`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -2839,6 +2819,12 @@ INSERT INTO `vn`.`machine` (`plate`, `maker`, `model`, `warehouseFk`, `departmen
|
||||||
('RE-001', 'STILL', 'LTX-20', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442),
|
('RE-001', 'STILL', 'LTX-20', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442),
|
||||||
('RE-002', 'STILL', 'LTX-20', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442);
|
('RE-002', 'STILL', 'LTX-20', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`machineWorker` (`workerFk`, `machineFk`, `inTimed`, `outTimed`)
|
||||||
|
VALUES
|
||||||
|
(1106, 1, util.VN_CURDATE(), util.VN_CURDATE()),
|
||||||
|
(1106, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 DAY)),
|
||||||
|
(1106, 2, util.VN_CURDATE(), NULL),
|
||||||
|
(1106, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 DAY));
|
||||||
|
|
||||||
INSERT INTO `vn`.`zoneExclusion` (`id`, `zoneFk`, `dated`, `created`, `userFk`)
|
INSERT INTO `vn`.`zoneExclusion` (`id`, `zoneFk`, `dated`, `created`, `userFk`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -2909,8 +2895,7 @@ INSERT INTO `util`.`notification` (`id`, `name`, `description`)
|
||||||
(6, 'book-entry-deleted', 'accounting entries deleted'),
|
(6, 'book-entry-deleted', 'accounting entries deleted'),
|
||||||
(7, 'zone-included','An email to notify zoneCollisions'),
|
(7, 'zone-included','An email to notify zoneCollisions'),
|
||||||
(8, 'backup-printer-selected','A backup printer has been selected'),
|
(8, 'backup-printer-selected','A backup printer has been selected'),
|
||||||
(9, 'mrw-deadline','The MRW deadline has passed'),
|
(9, 'mrw-deadline','The MRW deadline has passed');
|
||||||
(10,'invoice-ticket-closure','Tickets not invoiced during the nightly closure ticket process');
|
|
||||||
|
|
||||||
TRUNCATE `util`.`notificationAcl`;
|
TRUNCATE `util`.`notificationAcl`;
|
||||||
INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`)
|
INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`)
|
||||||
|
@ -2951,9 +2936,9 @@ INSERT INTO `vn`.`routeConfig` (`id`, `defaultWorkCenterFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 9);
|
(1, 9);
|
||||||
|
|
||||||
INSERT INTO `vn`.`productionConfig` (`isPreviousPreparationRequired`, `ticketPrintedMax`, `ticketTrolleyMax`, `rookieDays`, `notBuyingMonths`, `id`, `isZoneClosedByExpeditionActivated`, `maxNotReadyCollections`, `minTicketsToCloseZone`, `movingTicketDelRoute`, `defaultZone`, `defautlAgencyMode`, `hasUniqueCollectionTime`, `maxCollectionWithoutUser`, `pendingCollectionsOrder`, `pendingCollectionsAge`, `backupPrinterNotificationDelay`, `clientSelfConsumptionFk`, `addressSelfConsumptionFk`)
|
INSERT INTO `vn`.`productionConfig` (`isPreviousPreparationRequired`, `ticketPrintedMax`, `ticketTrolleyMax`, `rookieDays`, `notBuyingMonths`, `id`, `isZoneClosedByExpeditionActivated`, `maxNotReadyCollections`, `minTicketsToCloseZone`, `movingTicketDelRoute`, `defaultZone`, `defautlAgencyMode`, `hasUniqueCollectionTime`, `maxCollectionWithoutUser`, `pendingCollectionsOrder`, `pendingCollectionsAge`, `backupPrinterNotificationDelay`)
|
||||||
VALUES
|
VALUES
|
||||||
(0, 8, 80, 0, 0, 1, 0, 15, 25, -1, 697, 1328, 0, 1, 8, 6, 3600, 1112, 12);
|
(0, 8, 80, 0, 0, 1, 0, 15, 25, -1, 697, 1328, 0, 1, 8, 6, 3600);
|
||||||
|
|
||||||
INSERT INTO `vn`.`collection` (`id`, `created`, `workerFk`, `stateFk`, `itemPackingTypeFk`, `saleTotalCount`, `salePickedCount`, `trainFk`, `sectorFk`, `wagons`)
|
INSERT INTO `vn`.`collection` (`id`, `created`, `workerFk`, `stateFk`, `itemPackingTypeFk`, `saleTotalCount`, `salePickedCount`, `trainFk`, `sectorFk`, `wagons`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -3067,6 +3052,9 @@ INSERT INTO `vn`.`workerTimeControlMail` (`id`, `workerFk`, `year`, `week`, `sta
|
||||||
(3, 9, 2000, 51, 'CONFIRMED', util.VN_NOW(), 1, NULL),
|
(3, 9, 2000, 51, 'CONFIRMED', util.VN_NOW(), 1, NULL),
|
||||||
(4, 9, 2001, 1, 'SENDED', util.VN_NOW(), 1, NULL);
|
(4, 9, 2001, 1, 'SENDED', util.VN_NOW(), 1, NULL);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`wagonConfig` (`id`, `width`, `height`, `maxWagonHeight`, `minHeightBetweenTrays`, `maxTrays`)
|
||||||
|
VALUES
|
||||||
|
(1, 1350, 1900, 200, 50, 6);
|
||||||
|
|
||||||
INSERT INTO `vn`.`wagonTypeColor` (`id`, `name`, `rgb`)
|
INSERT INTO `vn`.`wagonTypeColor` (`id`, `name`, `rgb`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -3075,19 +3063,15 @@ INSERT INTO `vn`.`wagonTypeColor` (`id`, `name`, `rgb`)
|
||||||
(3, 'green', '#00ff00'),
|
(3, 'green', '#00ff00'),
|
||||||
(4, 'blue', '#0000ff');
|
(4, 'blue', '#0000ff');
|
||||||
|
|
||||||
INSERT INTO `vn`.`wagonConfig` (`id`, `width`, `height`, `maxWagonHeight`, `minHeightBetweenTrays`, `maxTrays`, `defaultTrayColorFk`)
|
|
||||||
VALUES
|
|
||||||
(1, 1350, 1900, 200, 50, 6, 1);
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`wagonType` (`id`, `name`, `divisible`)
|
INSERT INTO `vn`.`wagonType` (`id`, `name`, `divisible`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Wagon Type #1', 1);
|
(1, 'Wagon Type #1', 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`wagonTypeTray` (`id`, `wagonTypeFk`, `height`, `wagonTypeColorFk`)
|
INSERT INTO `vn`.`wagonTypeTray` (`id`, `typeFk`, `height`, `colorFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 0, 1),
|
(1, 1, 100, 1),
|
||||||
(2, 1, 50, 2),
|
(2, 1, 50, 2),
|
||||||
(3, 1, 100, 3);
|
(3, 1, 0, 3);
|
||||||
|
|
||||||
INSERT INTO `salix`.`accessTokenConfig` (`id`, `renewPeriod`, `courtesyTime`, `renewInterval`)
|
INSERT INTO `salix`.`accessTokenConfig` (`id`, `renewPeriod`, `courtesyTime`, `renewInterval`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -3191,7 +3175,7 @@ UPDATE vn.department
|
||||||
SET workerFk = null;
|
SET workerFk = null;
|
||||||
|
|
||||||
INSERT INTO vn.packaging
|
INSERT INTO vn.packaging
|
||||||
VALUES('--', 2745600.00, 100.00, 120.00, 220.00, 0.00, 1, '2001-01-01 00:00:00.000', NULL, NULL, NULL, 0.00, 16, 0.00, 0, NULL, 0.00, NULL, NULL, 0, NULL, 0, 0,0,1);
|
VALUES('--', 2745600.00, 100.00, 120.00, 220.00, 0.00, 1, '2001-01-01 00:00:00.000', NULL, NULL, NULL, 0.00, 16, 0.00, 0, NULL, 0.00, NULL, NULL, 0, NULL, 0, 0);
|
||||||
|
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.intrastat
|
INSERT IGNORE INTO vn.intrastat
|
||||||
|
@ -3421,7 +3405,7 @@ INSERT INTO vn.buy
|
||||||
INSERT INTO vn.itemShelving
|
INSERT INTO vn.itemShelving
|
||||||
SET id = 9931,
|
SET id = 9931,
|
||||||
itemFk = 999993,
|
itemFk = 999993,
|
||||||
shelvingFk = 16,
|
shelvingFk = 'NCC',
|
||||||
visible = 10,
|
visible = 10,
|
||||||
`grouping` = 5,
|
`grouping` = 5,
|
||||||
packing = 10;
|
packing = 10;
|
||||||
|
@ -3748,7 +3732,7 @@ INSERT vn.sale
|
||||||
|
|
||||||
USE vn;
|
USE vn;
|
||||||
DELETE ish.* FROM vn.itemShelving ish
|
DELETE ish.* FROM vn.itemShelving ish
|
||||||
JOIN vn.shelving sh ON sh.id = ish.shelvingFk
|
JOIN vn.shelving sh ON sh.code = ish.shelvingFk
|
||||||
JOIN vn.parking p ON p.id = sh.parkingFk
|
JOIN vn.parking p ON p.id = sh.parkingFk
|
||||||
JOIN vn.sector s ON s.id = p.sectorFk
|
JOIN vn.sector s ON s.id = p.sectorFk
|
||||||
JOIN vn.warehouse w ON w.id = s.warehouseFk
|
JOIN vn.warehouse w ON w.id = s.warehouseFk
|
||||||
|
@ -3757,22 +3741,22 @@ DELETE ish.* FROM vn.itemShelving ish
|
||||||
INSERT INTO vn.itemShelving
|
INSERT INTO vn.itemShelving
|
||||||
(itemFk, shelvingFk, visible, created, `grouping`, packing, packagingFk, userFk, isChecked)
|
(itemFk, shelvingFk, visible, created, `grouping`, packing, packagingFk, userFk, isChecked)
|
||||||
VALUES
|
VALUES
|
||||||
(999991, 14, 8, '2023-09-20', 1, 20, NULL, 103, NULL),
|
(999991, 'NAA', 8, '2023-09-20', 1, 20, NULL, 103, NULL),
|
||||||
(999998, 14, 80, '2023-09-20', 10, 30, NULL, 103, NULL),
|
(999998, 'NAA', 80, '2023-09-20', 10, 30, NULL, 103, NULL),
|
||||||
(1000001, 14, 6, '2023-09-20', 3, 50, NULL, 103, NULL),
|
(1000001, 'NAA', 6, '2023-09-20', 3, 50, NULL, 103, NULL),
|
||||||
(1000000, 15, 50, '2023-09-18', 25, 500, NULL, 103, NULL),
|
(1000000, 'NBB', 50, '2023-09-18', 25, 500, NULL, 103, NULL),
|
||||||
(999993, 15, 25, '2023-09-18', NULL, 10, NULL, 103, NULL),
|
(999993, 'NBB', 25, '2023-09-18', NULL, 10, NULL, 103, NULL),
|
||||||
(999999, 15, 30, '2023-09-18', 10, 500, NULL, 103, NULL),
|
(999999, 'NBB', 30, '2023-09-18', 10, 500, NULL, 103, NULL),
|
||||||
(999993, 16, 25, '2023-09-20', 5, 10, NULL, 103, NULL),
|
(999993, 'NCC', 25, '2023-09-20', 5, 10, NULL, 103, NULL),
|
||||||
(999997, 16, 10, '2023-09-20', NULL, 100, NULL, 103, NULL),
|
(999997, 'NCC', 10, '2023-09-20', NULL, 100, NULL, 103, NULL),
|
||||||
(999999, 16, 40, '2023-09-20', 10, 500, NULL, 103, NULL),
|
(999999, 'NCC', 40, '2023-09-20', 10, 500, NULL, 103, NULL),
|
||||||
(999995, 17, 10, '2023-09-19', NULL, 20, NULL, 103, NULL),
|
(999995, 'NDD', 10, '2023-09-19', NULL, 20, NULL, 103, NULL),
|
||||||
(999994, 17, 48, '2023-09-19', 4, 20, NULL, 103, NULL),
|
(999994, 'NDD', 48, '2023-09-19', 4, 20, NULL, 103, NULL),
|
||||||
(1000001, 18, 6, '2023-09-21', 3, 50, NULL, 103, NULL),
|
(1000001, 'NEE', 6, '2023-09-21', 3, 50, NULL, 103, NULL),
|
||||||
(999992, 18, 50, '2023-09-21', NULL, 1, NULL, 103, NULL),
|
(999992, 'NEE', 50, '2023-09-21', NULL, 1, NULL, 103, NULL),
|
||||||
(1000000, 18, 25, '2023-09-21', 25, 500, NULL, 103, NULL),
|
(1000000, 'NEE', 25, '2023-09-21', 25, 500, NULL, 103, NULL),
|
||||||
(999996, 19, 5, '2023-09-27', 1, 5, NULL, 103, NULL),
|
(999996, 'PAA', 5, '2023-09-27', 1, 5, NULL, 103, NULL),
|
||||||
(999997, 21, 10, '2023-09-27', 5, 100, NULL, 103, NULL);
|
(999997, 'PCC', 10, '2023-09-27', 5, 100, NULL, 103, NULL);
|
||||||
|
|
||||||
-- Previous for Bolas de madera
|
-- Previous for Bolas de madera
|
||||||
INSERT IGNORE INTO vn.sectorCollection
|
INSERT IGNORE INTO vn.sectorCollection
|
||||||
|
@ -3822,6 +3806,8 @@ UPDATE vn.collection
|
||||||
UPDATE vn.sale
|
UPDATE vn.sale
|
||||||
SET isPicked =FALSE;
|
SET isPicked =FALSE;
|
||||||
|
|
||||||
|
INSERT INTO vn.machineWorkerConfig(id, maxHours)
|
||||||
|
VALUES(1, 12);
|
||||||
|
|
||||||
INSERT INTO vn.workerAppTester(workerFk) VALUES(66);
|
INSERT INTO vn.workerAppTester(workerFk) VALUES(66);
|
||||||
|
|
||||||
|
@ -3829,6 +3815,9 @@ INSERT INTO `vn`.`machine` (`plate`, `maker`, `model`, `warehouseFk`, `departmen
|
||||||
VALUES
|
VALUES
|
||||||
('RE-003', 'IRON', 'JPH-24', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442);
|
('RE-003', 'IRON', 'JPH-24', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442);
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO vn.machineWorker(workerFk,machineFk,inTimed) VALUES (104,1,'2001-01-01 10:00:00.00.000');
|
||||||
|
|
||||||
UPDATE vn.buy SET itemOriginalFk = 1 WHERE id = 1;
|
UPDATE vn.buy SET itemOriginalFk = 1 WHERE id = 1;
|
||||||
|
|
||||||
UPDATE vn.saleTracking SET stateFk = 26 WHERE id = 5;
|
UPDATE vn.saleTracking SET stateFk = 26 WHERE id = 5;
|
||||||
|
@ -3927,21 +3916,6 @@ INSERT INTO `vn`.`calendarHolidays` (calendarHolidaysTypeFk, dated, calendarHoli
|
||||||
(1, '2001-05-17', 1, 5),
|
(1, '2001-05-17', 1, 5),
|
||||||
(1, '2001-05-18', 1, 5);
|
(1, '2001-05-18', 1, 5);
|
||||||
|
|
||||||
INSERT INTO vn.medicalReview
|
|
||||||
(id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark)
|
|
||||||
VALUES(1, 1106, 1, '2000-01-01', '08:10', 1, 200.0, NULL, '');
|
|
||||||
INSERT INTO vn.medicalReview
|
|
||||||
(id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark)
|
|
||||||
VALUES(2, 1106, 2, '2001-01-01', '09:10', 0, 10.0, NULL, NULL);
|
|
||||||
INSERT INTO vn.medicalReview
|
|
||||||
(id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark)
|
|
||||||
VALUES(3, 9, 2, '2000-01-01', '8:00', 1, 150.0, NULL, NULL);
|
|
||||||
|
|
||||||
INSERT INTO vn.stockBought (workerFk, bought, reserve, dated)
|
|
||||||
VALUES(35, 1.00, 1.00, '2001-01-01');
|
|
||||||
INSERT INTO vn.auctionConfig (id,conversionCoefficient,warehouseFk)
|
|
||||||
VALUES (1,0.6,6);
|
|
||||||
|
|
||||||
INSERT INTO vn.payrollComponent
|
INSERT INTO vn.payrollComponent
|
||||||
(id, name, isSalaryAgreed, isVariable, isException)
|
(id, name, isSalaryAgreed, isVariable, isException)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -3971,65 +3945,11 @@ VALUES
|
||||||
(35, 'ES12346B12345679', 3, 241);
|
(35, 'ES12346B12345679', 3, 241);
|
||||||
|
|
||||||
INSERT INTO vn.accountDetailType
|
INSERT INTO vn.accountDetailType
|
||||||
(id, description, code)
|
(id, description)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'IBAN', 'iban'),
|
(1, 'IBAN'),
|
||||||
(2, 'SWIFT', 'swift'),
|
(2, 'SWIFT'),
|
||||||
(3, 'Referencia Remesas', 'remRef'),
|
(3, 'Referencia Remesas'),
|
||||||
(4, 'Referencia Transferencias', 'trnRef'),
|
(4, 'Referencia Transferencias'),
|
||||||
(5, 'Referencia Nominas', 'payRef'),
|
(5, 'Referencia Nominas'),
|
||||||
(6, 'ABA', 'aba');
|
(6, 'ABA');
|
||||||
|
|
||||||
INSERT IGNORE INTO ormConfig
|
|
||||||
SET id =1,
|
|
||||||
selectLimit = 1000;
|
|
||||||
|
|
||||||
INSERT INTO pbx.queueMultiConfig
|
|
||||||
SET id = 'ring',
|
|
||||||
strategy = 20,
|
|
||||||
timeout = 2,
|
|
||||||
retry = 0,
|
|
||||||
weight = 0,
|
|
||||||
maxLen = 0,
|
|
||||||
ringInUse = 0;
|
|
||||||
|
|
||||||
INSERT INTO pbx.queue (description, name, config)
|
|
||||||
VALUES ('X-men', '1000', 1),
|
|
||||||
('Avengers', '2000', 1);
|
|
||||||
|
|
||||||
INSERT IGNORE INTO pbx.queueMember
|
|
||||||
SET queue = '1000',
|
|
||||||
extension = '1010';
|
|
||||||
|
|
||||||
UPDATE vn.department SET pbxQueue = '1000' WHERE name = "CAMARA";
|
|
||||||
UPDATE vn.department SET pbxQueue = '2000' WHERE name = "VENTAS";
|
|
||||||
|
|
||||||
INSERT INTO vn.workerRelatives (workerFk, isDescendant, disabilityGradeFk, birthed, adoptionYear, isDependend, isJointCustody, updated)
|
|
||||||
VALUES
|
|
||||||
(1106, 1, NULL, 0, NULL, 0, 0, '2024-10-29 08:42:44.000');
|
|
||||||
INSERT INTO vn.routeAction (id, name, price, isMainlineDelivered) VALUES(1, 'Pintar traje', 50.00, 0);
|
|
||||||
INSERT INTO vn.routeComplement (id, dated, workerFk, price, routeActionFk) VALUES(1, util.VN_CURDATE(), 9, 50.00, 1);
|
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO srt.buffer (id, x, y, `size`, `length`, stateFk, typeFk, isActive, code, stratus, hasWorkerWaiting, reserve, routeFk, dayMinute, lastUnloaded, hasStrapper, typeDefaultFk, motors, editorFk)
|
|
||||||
VALUES (0, 0, 0, 0, NULL, 3, 1, 0, 'ENT', 0, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
|
|
||||||
(1, 0, 9900, 0, NULL, 1, 0, 0, 'NOK', 0, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
|
|
||||||
(2, 0, 0, 450, 13000, 1, 0, 1, '01A', 1, 1, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
|
|
||||||
(3, 1400, 0, 450, 13000, 1, 0, 1, '01B', 1, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
|
|
||||||
(4, 0, 500, 500, 13000, 1, 4, 1, '02A', 2, 1, NULL, NULL, NULL, NULL, 1, 4, 13, NULL),
|
|
||||||
(5, 1400, 500, 500, 13000, 1, 4, 1, '02B', 2, 1, NULL, NULL, NULL, NULL, 1, 4, 13, NULL),
|
|
||||||
(6, 0, 1000, 500, 13000, 1, 1, 1, '03A', 3, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
|
|
||||||
(7, 1400, 1000, 500, 13000, 1, 1, 1, '03B', 3, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
|
|
||||||
(8, 0, 1500, 500, 13000, 1, 0, 1, '04A', 4, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
|
|
||||||
(9, 1400, 1500, 500, 13000, 1, 1, 1, '04B', 4, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
|
|
||||||
(10, 0, 2000, 500, 13000, 1, 1, 1, '05A', 5, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL);
|
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.saySimpleCountry (countryFk, channel)
|
|
||||||
VALUES (19, '1169'),
|
|
||||||
(8, '1183');
|
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.saySimpleConfig (url, defaultChannel)
|
|
||||||
VALUES ('saysimle-url-mock', 1320);
|
|
||||||
|
|
||||||
INSERT INTO vn.workerIrpf (workerFk,spouseNif, geographicMobilityDate)
|
|
||||||
VALUES (1106,'26493101E','2019-09-20');
|
|
||||||
|
|
|
@ -7,7 +7,8 @@ AS SELECT `u`.`id` AS `id`,
|
||||||
`u`.`email` AS `email`,
|
`u`.`email` AS `email`,
|
||||||
`u`.`nickname` AS `nickname`,
|
`u`.`nickname` AS `nickname`,
|
||||||
`u`.`lang` AS `lang`,
|
`u`.`lang` AS `lang`,
|
||||||
`u`.`role` AS `role`
|
`u`.`role` AS `role`,
|
||||||
|
`u`.`recoverPass` AS `recoverPass`
|
||||||
FROM `account`.`user` `u`
|
FROM `account`.`user` `u`
|
||||||
WHERE `u`.`name` = `myUser_getName`()
|
WHERE `u`.`name` = `myUser_getName`()
|
||||||
WITH CASCADED CHECK OPTION
|
WITH CASCADED CHECK OPTION
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`clean`()
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`clean`()
|
||||||
BEGIN
|
BEGIN
|
||||||
DECLARE vDateShort DATETIME;
|
DECLARE vDateShort DATETIME;
|
||||||
DECLARE vDateLong DATETIME;
|
DECLARE vDateLong DATETIME;
|
||||||
|
@ -15,5 +15,5 @@ BEGIN
|
||||||
|
|
||||||
DELETE FROM bi.defaulters WHERE `date` < vDateLong;
|
DELETE FROM bi.defaulters WHERE `date` < vDateLong;
|
||||||
DELETE FROM bi.defaulting WHERE `date` < vDateLong;
|
DELETE FROM bi.defaulting WHERE `date` < vDateLong;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`facturacion_media_anual_update`()
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`facturacion_media_anual_update`()
|
||||||
BEGIN
|
BEGIN
|
||||||
TRUNCATE TABLE bs.clientAnnualConsumption;
|
TRUNCATE TABLE bs.clientAnnualConsumption;
|
||||||
|
|
||||||
|
@ -12,5 +12,5 @@ BEGIN
|
||||||
GROUP BY clientFk, year, month
|
GROUP BY clientFk, year, month
|
||||||
) vol
|
) vol
|
||||||
GROUP BY clientFk;
|
GROUP BY clientFk;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`carteras_add`()
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`carteras_add`()
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Inserta en la tabla @bs.carteras las ventas desde el año pasado
|
* Inserta en la tabla @bs.carteras las ventas desde el año pasado
|
||||||
|
@ -23,5 +23,5 @@ BEGIN
|
||||||
GROUP BY w.code, t.`year`, t.`month`;
|
GROUP BY w.code, t.`year`, t.`month`;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.time;
|
DROP TEMPORARY TABLE tmp.time;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -6,27 +6,25 @@ BLOCK1: BEGIN
|
||||||
DECLARE vShipped DATE;
|
DECLARE vShipped DATE;
|
||||||
DECLARE vPreviousShipped DATE;
|
DECLARE vPreviousShipped DATE;
|
||||||
DECLARE vDone boolean;
|
DECLARE vDone boolean;
|
||||||
|
DECLARE cur cursor for
|
||||||
DECLARE cur CURSOR FOR
|
|
||||||
SELECT clientFk, firstShipped
|
SELECT clientFk, firstShipped
|
||||||
FROM bs.clientNewBorn;
|
FROM bs.clientNewBorn;
|
||||||
|
|
||||||
DECLARE continue HANDLER FOR NOT FOUND SET vDone = TRUE;
|
DECLARE continue HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
SET vDone := FALSE;
|
SET vDone := FALSE;
|
||||||
|
|
||||||
DELETE FROM bs.clientNewBorn WHERE isModified = FALSE;
|
DELETE FROM bs.clientNewBorn WHERE isModified = FALSE;
|
||||||
|
|
||||||
INSERT INTO clientNewBorn(clientFk, firstShipped, lastShipped)
|
INSERT INTO clientNewBorn(clientFk, firstShipped, lastShipped)
|
||||||
SELECT c.id, DATE(MAX(t.shipped)), DATE(MAX(t.shipped))
|
SELECT c.id, MAX(t.shipped), MAX(t.shipped)
|
||||||
FROM vn.client c
|
FROM vn.client c
|
||||||
JOIN vn.ticket t ON t.clientFk = c.id
|
JOIN vn.ticket t on t.clientFk = c.id
|
||||||
LEFT JOIN clientNewBorn cb ON cb.clientFk = c.id
|
LEFT JOIN clientNewBorn cb on cb.clientFk = c.id
|
||||||
WHERE t.shipped BETWEEN util.VN_CURDATE() - INTERVAL 1 YEAR
|
WHERE t.shipped BETWEEN TIMESTAMPADD(YEAR, -1, util.VN_CURDATE()) AND util.VN_CURDATE() AND cb.isModified is null
|
||||||
AND util.VN_CURDATE()
|
GROUP BY c.id;
|
||||||
AND cb.isModified IS NULL
|
|
||||||
GROUP BY c.id;
|
|
||||||
|
|
||||||
OPEN cur;
|
OPEN cur;
|
||||||
|
|
||||||
LOOP1: LOOP
|
LOOP1: LOOP
|
||||||
SET vDone := FALSE;
|
SET vDone := FALSE;
|
||||||
FETCH cur INTO vClientFk, vShipped;
|
FETCH cur INTO vClientFk, vShipped;
|
||||||
|
|
|
@ -32,7 +32,7 @@ BEGIN
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tVisible
|
CREATE OR REPLACE TEMPORARY TABLE tVisible
|
||||||
SELECT itemFk, SUM(visible) totalVisible
|
SELECT itemFk, SUM(visible) totalVisible
|
||||||
FROM vn.itemShelving ish
|
FROM vn.itemShelving ish
|
||||||
JOIN vn.shelving sh ON sh.id = ish.shelvingFk
|
JOIN vn.shelving sh ON sh.code = ish.shelvingFk
|
||||||
JOIN vn.parking p ON p.id = sh.parkingFk
|
JOIN vn.parking p ON p.id = sh.parkingFk
|
||||||
JOIN vn.sector sc ON sc.id = p.sectorFk
|
JOIN vn.sector sc ON sc.id = p.sectorFk
|
||||||
WHERE sc.warehouseFk = vWarehouseFk
|
WHERE sc.warehouseFk = vWarehouseFk
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`nightTask_launchAll`()
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`nightTask_launchAll`()
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Runs all nightly tasks.
|
* Runs all nightly tasks.
|
||||||
|
@ -76,5 +76,5 @@ BEGIN
|
||||||
END IF;
|
END IF;
|
||||||
END LOOP;
|
END LOOP;
|
||||||
CLOSE vQueue;
|
CLOSE vQueue;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`salesByItemTypeDay_addLauncher`()
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`salesByItemTypeDay_addLauncher`()
|
||||||
BEGIN
|
BEGIN
|
||||||
CALL bs.salesByItemTypeDay_add(util.VN_CURDATE() - INTERVAL 30 DAY, util.VN_CURDATE());
|
CALL bs.salesByItemTypeDay_add(util.VN_CURDATE() - INTERVAL 30 DAY, util.VN_CURDATE());
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -1,22 +1,8 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`(
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`()
|
||||||
vDateFrom DATE,
|
|
||||||
vDateTo DATE
|
|
||||||
)
|
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL WEEKDAY(CURDATE()) DAY;
|
||||||
* Recalcula las mermas de un periodo.
|
DECLARE vDateTo DATE DEFAULT vDateFrom + INTERVAL 6 DAY;
|
||||||
*
|
|
||||||
* @param vDateFrom Fecha desde
|
|
||||||
* @param vDateTo Fecha hasta
|
|
||||||
*/
|
|
||||||
IF vDateFrom IS NULL THEN
|
|
||||||
SET vDateFrom = util.VN_CURDATE() - INTERVAL WEEKDAY(util.VN_CURDATE()) DAY;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF vDateTo IS NULL THEN
|
|
||||||
SET vDateTo = vDateFrom + INTERVAL 6 DAY;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
CALL cache.last_buy_refresh(FALSE);
|
CALL cache.last_buy_refresh(FALSE);
|
||||||
|
|
||||||
|
@ -26,38 +12,25 @@ BEGIN
|
||||||
it.workerFk,
|
it.workerFk,
|
||||||
it.id,
|
it.id,
|
||||||
s.itemFk,
|
s.itemFk,
|
||||||
SUM((b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity),
|
SUM(s.quantity),
|
||||||
SUM(IF(aw.`type`, s.quantity, 0)),
|
SUM((b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity) `value`,
|
||||||
SUM(IF(
|
SUM (
|
||||||
|
IF(
|
||||||
|
aw.`type` = 'internal',
|
||||||
|
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
|
||||||
|
0
|
||||||
|
)
|
||||||
|
) internalWaste,
|
||||||
|
SUM (
|
||||||
|
IF(
|
||||||
aw.`type` = 'external',
|
aw.`type` = 'external',
|
||||||
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
|
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
|
||||||
0
|
IF(c.code = 'manaClaim',
|
||||||
|
sc.value * s.quantity,
|
||||||
|
0
|
||||||
|
)
|
||||||
)
|
)
|
||||||
),
|
) externalWaste
|
||||||
SUM(IF(
|
|
||||||
aw.`type` = 'fault',
|
|
||||||
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
|
|
||||||
0
|
|
||||||
)
|
|
||||||
),
|
|
||||||
SUM(IF(
|
|
||||||
aw.`type` = 'container',
|
|
||||||
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
|
|
||||||
0
|
|
||||||
)
|
|
||||||
),
|
|
||||||
SUM(IF(
|
|
||||||
aw.`type` = 'break',
|
|
||||||
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
|
|
||||||
0
|
|
||||||
)
|
|
||||||
),
|
|
||||||
SUM(IF(
|
|
||||||
aw.`type` = 'other',
|
|
||||||
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
|
|
||||||
0
|
|
||||||
)
|
|
||||||
)
|
|
||||||
FROM vn.sale s
|
FROM vn.sale s
|
||||||
JOIN vn.item i ON i.id = s.itemFk
|
JOIN vn.item i ON i.id = s.itemFk
|
||||||
JOIN vn.itemType it ON it.id = i.typeFk
|
JOIN vn.itemType it ON it.id = i.typeFk
|
||||||
|
@ -68,8 +41,10 @@ BEGIN
|
||||||
JOIN cache.last_buy lb ON lb.item_id = i.id
|
JOIN cache.last_buy lb ON lb.item_id = i.id
|
||||||
AND lb.warehouse_id = w.id
|
AND lb.warehouse_id = w.id
|
||||||
JOIN vn.buy b ON b.id = lb.buy_id
|
JOIN vn.buy b ON b.id = lb.buy_id
|
||||||
|
LEFT JOIN vn.saleComponent sc ON sc.saleFk = s.id
|
||||||
|
LEFT JOIN vn.component c ON c.id = sc.componentFk
|
||||||
WHERE t.shipped BETWEEN vDateFrom AND vDateTo
|
WHERE t.shipped BETWEEN vDateFrom AND vDateTo
|
||||||
AND w.isManaged
|
AND w.isManaged
|
||||||
GROUP BY YEAR(t.shipped), WEEK(t.shipped, 4), i.id;
|
GROUP BY it.id, i.id;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSalesLauncher`()
|
|
||||||
BEGIN
|
|
||||||
CALL waste_addSales(NULL, NULL);
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -53,7 +53,7 @@ proc: BEGIN
|
||||||
WHERE t.landed BETWEEN vInventoryDate AND vStartDate
|
WHERE t.landed BETWEEN vInventoryDate AND vStartDate
|
||||||
AND t.warehouseInFk = vWarehouse
|
AND t.warehouseInFk = vWarehouse
|
||||||
AND s.name != 'INVENTARIO'
|
AND s.name != 'INVENTARIO'
|
||||||
AND NOT t.isRaid
|
AND NOT e.isRaid
|
||||||
GROUP BY b.itemFk
|
GROUP BY b.itemFk
|
||||||
) c
|
) c
|
||||||
JOIN vn.item i ON i.id = c.itemFk
|
JOIN vn.item i ON i.id = c.itemFk
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_refresh`(
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_refresh`(OUT `vCalc` INT, IN `vRefresh` INT, IN `vWarehouse` INT, IN `vDated` DATE)
|
||||||
OUT `vCalc` INT,
|
|
||||||
`vRefresh` INT,
|
|
||||||
`vWarehouse` INT,
|
|
||||||
`vDated` DATE
|
|
||||||
)
|
|
||||||
proc: BEGIN
|
proc: BEGIN
|
||||||
DECLARE vStartDate DATE;
|
DECLARE vStartDate DATE;
|
||||||
DECLARE vReserveDate DATETIME;
|
DECLARE vReserveDate DATETIME;
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_updateItem`(
|
|
||||||
`vItem` INT,
|
|
||||||
`vWarehouse` INT,
|
|
||||||
`vDated` DATE,
|
|
||||||
`vQuantity` INT
|
|
||||||
)
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Immediately deduct/add an amount from the available cache (if exists).
|
|
||||||
*
|
|
||||||
* @param vItem The item id
|
|
||||||
* @param vWarehouse The warehouse id
|
|
||||||
* @param vDated Available cache date
|
|
||||||
* @param vQuantity The amount to be deducted from the cache
|
|
||||||
*/
|
|
||||||
DECLARE vCalc INT;
|
|
||||||
|
|
||||||
SELECT id INTO vCalc
|
|
||||||
FROM cache_calc
|
|
||||||
WHERE cacheName = 'available'
|
|
||||||
AND params = CONCAT_WS('/', vWarehouse, vDated);
|
|
||||||
|
|
||||||
IF vCalc IS NOT NULL THEN
|
|
||||||
UPDATE available
|
|
||||||
SET available = available - vQuantity
|
|
||||||
WHERE calc_id = vCalc
|
|
||||||
AND item_id = vItem;
|
|
||||||
END IF;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`cache_calc_end`(IN `v_calc` INT)
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`cache_calc_end`(IN `v_calc` INT)
|
||||||
BEGIN
|
BEGIN
|
||||||
DECLARE v_cache_name VARCHAR(255);
|
DECLARE v_cache_name VARCHAR(255);
|
||||||
DECLARE v_params VARCHAR(255);
|
DECLARE v_params VARCHAR(255);
|
||||||
|
@ -21,5 +21,5 @@ BEGIN
|
||||||
IF v_cache_name IS NOT NULL THEN
|
IF v_cache_name IS NOT NULL THEN
|
||||||
DO RELEASE_LOCK(CONCAT_WS('/', v_cache_name, IFNULL(v_params, '')));
|
DO RELEASE_LOCK(CONCAT_WS('/', v_cache_name, IFNULL(v_params, '')));
|
||||||
END IF;
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`cache_calc_start`(OUT `v_calc` INT, INOUT `v_refresh` INT, IN `v_cache_name` VARCHAR(50), IN `v_params` VARCHAR(100))
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`cache_calc_start`(OUT `v_calc` INT, INOUT `v_refresh` INT, IN `v_cache_name` VARCHAR(50), IN `v_params` VARCHAR(100))
|
||||||
proc: BEGIN
|
proc: BEGIN
|
||||||
DECLARE v_valid BOOL;
|
DECLARE v_valid BOOL;
|
||||||
DECLARE v_lock_id VARCHAR(100);
|
DECLARE v_lock_id VARCHAR(100);
|
||||||
|
@ -83,5 +83,5 @@ proc: BEGIN
|
||||||
-- Si se debe recalcular mantiene el bloqueo y devuelve su identificador.
|
-- Si se debe recalcular mantiene el bloqueo y devuelve su identificador.
|
||||||
|
|
||||||
SET v_refresh = TRUE;
|
SET v_refresh = TRUE;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -4,7 +4,7 @@ proc: BEGIN
|
||||||
/**
|
/**
|
||||||
* Crea o actualiza la cache con la última compra y fecha de cada
|
* Crea o actualiza la cache con la última compra y fecha de cada
|
||||||
* artículo hasta ayer. Para obtener la última compra hasta una fecha
|
* artículo hasta ayer. Para obtener la última compra hasta una fecha
|
||||||
* determinada utilizar el procedimiento vn.buy_getUltimate().
|
* determinada utilizar el procedimiento vn.buyUltimate().
|
||||||
*
|
*
|
||||||
* @param vRefresh %TRUE para forzar el recálculo de la cache
|
* @param vRefresh %TRUE para forzar el recálculo de la cache
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `edi`.`floramondo`
|
||||||
|
ON SCHEDULE EVERY 6 MINUTE
|
||||||
|
STARTS '2022-01-28 09:52:45.000'
|
||||||
|
ON COMPLETION NOT PRESERVE
|
||||||
|
DISABLE
|
||||||
|
DO CALL edi.floramondo_offerRefresh()$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,522 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `edi`.`floramondo_offerRefresh`()
|
||||||
|
proc: BEGIN
|
||||||
|
DECLARE vLanded DATETIME;
|
||||||
|
DECLARE vDone INT DEFAULT FALSE;
|
||||||
|
DECLARE vFreeId INT;
|
||||||
|
DECLARE vSupplyResponseFk INT;
|
||||||
|
DECLARE vLastInserted DATETIME;
|
||||||
|
DECLARE vIsAuctionDay BOOLEAN;
|
||||||
|
DECLARE vMaxNewItems INT DEFAULT 10000;
|
||||||
|
DECLARE vStartingTime DATETIME;
|
||||||
|
DECLARE vAalsmeerMarketPlaceID VARCHAR(13) DEFAULT '8713783439043';
|
||||||
|
DECLARE vDayRange INT;
|
||||||
|
|
||||||
|
DECLARE cur1 CURSOR FOR
|
||||||
|
SELECT id
|
||||||
|
FROM edi.item_free;
|
||||||
|
|
||||||
|
DECLARE cur2 CURSOR FOR
|
||||||
|
SELECT srId
|
||||||
|
FROM itemToInsert;
|
||||||
|
|
||||||
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
|
DECLARE EXIT HANDLER FOR SQLSTATE '45000'
|
||||||
|
BEGIN
|
||||||
|
ROLLBACK;
|
||||||
|
RESIGNAL;
|
||||||
|
END;
|
||||||
|
|
||||||
|
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
|
||||||
|
BEGIN
|
||||||
|
DO RELEASE_LOCK('edi.floramondo_offerRefresh');
|
||||||
|
SET @isTriggerDisabled = FALSE;
|
||||||
|
RESIGNAL;
|
||||||
|
END;
|
||||||
|
|
||||||
|
IF 'test' = (SELECT environment FROM util.config) THEN
|
||||||
|
LEAVE proc;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF !GET_LOCK('edi.floramondo_offerRefresh', 0) THEN
|
||||||
|
LEAVE proc;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
SELECT dayRange INTO vDayRange
|
||||||
|
FROM offerRefreshConfig;
|
||||||
|
|
||||||
|
IF vDayRange IS NULL THEN
|
||||||
|
CALL util.throw("Variable vDayRange not declared");
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
SET vStartingTime = util.VN_NOW();
|
||||||
|
|
||||||
|
TRUNCATE edi.offerList;
|
||||||
|
|
||||||
|
INSERT INTO edi.offerList(supplier, total)
|
||||||
|
SELECT v.name, COUNT(DISTINCT sr.ID) total
|
||||||
|
FROM edi.supplyResponse sr
|
||||||
|
JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID
|
||||||
|
WHERE sr.NumberOfUnits > 0
|
||||||
|
AND sr.EmbalageCode != 999
|
||||||
|
GROUP BY sr.vmpID;
|
||||||
|
|
||||||
|
UPDATE edi.offerList o
|
||||||
|
JOIN (SELECT v.name, COUNT(*) total
|
||||||
|
FROM edi.supplyOffer sr
|
||||||
|
JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID
|
||||||
|
GROUP BY sr.vmpID) sub ON o.supplier = sub.name
|
||||||
|
SET o.`filter` = sub.total;
|
||||||
|
|
||||||
|
-- Elimina de la lista de items libres aquellos que ya existen
|
||||||
|
DELETE itf.*
|
||||||
|
FROM edi.item_free itf
|
||||||
|
JOIN vn.item i ON i.id = itf.id;
|
||||||
|
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tmp
|
||||||
|
(INDEX (`Item_ArticleCode`))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT t.*
|
||||||
|
FROM (
|
||||||
|
SELECT *
|
||||||
|
FROM edi.supplyOffer
|
||||||
|
ORDER BY (MarketPlaceID = vAalsmeerMarketPlaceID) DESC,
|
||||||
|
NumberOfUnits DESC LIMIT 10000000000000000000) t
|
||||||
|
GROUP BY t.srId;
|
||||||
|
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE edi.offer (INDEX (`srID`), INDEX (`EmbalageCode`),
|
||||||
|
INDEX (`ef1`), INDEX (`ef2`), INDEX (`ef3`), INDEX (`ef4`),INDEX (`ef5`), INDEX (`ef6`),
|
||||||
|
INDEX (`s1Value`), INDEX (`s2Value`), INDEX (`s3Value`), INDEX (`s4Value`),INDEX (`s5Value`), INDEX (`s6Value`))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT so.*,
|
||||||
|
ev1.type_description s1Value,
|
||||||
|
ev2.type_description s2Value,
|
||||||
|
ev3.type_description s3Value,
|
||||||
|
ev4.type_description s4Value,
|
||||||
|
ev5.type_description s5Value,
|
||||||
|
ev6.type_description s6Value,
|
||||||
|
eif1.feature ef1,
|
||||||
|
eif2.feature ef2,
|
||||||
|
eif3.feature ef3,
|
||||||
|
eif4.feature ef4,
|
||||||
|
eif5.feature ef5,
|
||||||
|
eif6.feature ef6
|
||||||
|
FROM tmp so
|
||||||
|
LEFT JOIN edi.item_feature eif1 ON eif1.item_id = so.Item_ArticleCode
|
||||||
|
AND eif1.presentation_order = 1
|
||||||
|
AND eif1.expiry_date IS NULL
|
||||||
|
LEFT JOIN edi.item_feature eif2 ON eif2.item_id = so.Item_ArticleCode
|
||||||
|
AND eif2.presentation_order = 2
|
||||||
|
AND eif2.expiry_date IS NULL
|
||||||
|
LEFT JOIN edi.item_feature eif3 ON eif3.item_id = so.Item_ArticleCode
|
||||||
|
AND eif3.presentation_order = 3
|
||||||
|
AND eif3.expiry_date IS NULL
|
||||||
|
LEFT JOIN edi.item_feature eif4 ON eif4.item_id = so.Item_ArticleCode
|
||||||
|
AND eif4.presentation_order = 4
|
||||||
|
AND eif4.expiry_date IS NULL
|
||||||
|
LEFT JOIN edi.item_feature eif5 ON eif5.item_id = so.Item_ArticleCode
|
||||||
|
AND eif5.presentation_order = 5
|
||||||
|
AND eif5.expiry_date IS NULL
|
||||||
|
LEFT JOIN edi.item_feature eif6 ON eif6.item_id = so.Item_ArticleCode
|
||||||
|
AND eif6.presentation_order = 6
|
||||||
|
AND eif6.expiry_date IS NULL
|
||||||
|
LEFT JOIN edi.`value` ev1 ON ev1.type_id = eif1.feature
|
||||||
|
AND so.s1 = ev1.type_value
|
||||||
|
LEFT JOIN edi.`value` ev2 ON ev2.type_id = eif2.feature
|
||||||
|
AND so.s2 = ev2.type_value
|
||||||
|
LEFT JOIN edi.`value` ev3 ON ev3.type_id = eif3.feature
|
||||||
|
AND so.s3 = ev3.type_value
|
||||||
|
LEFT JOIN edi.`value` ev4 ON ev4.type_id = eif4.feature
|
||||||
|
AND so.s4 = ev4.type_value
|
||||||
|
LEFT JOIN edi.`value` ev5 ON ev5.type_id = eif5.feature
|
||||||
|
AND so.s5 = ev5.type_value
|
||||||
|
LEFT JOIN edi.`value` ev6 ON ev6.type_id = eif6.feature
|
||||||
|
AND so.s6 = ev6.type_value
|
||||||
|
ORDER BY Price;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE tmp;
|
||||||
|
|
||||||
|
DELETE o
|
||||||
|
FROM edi.offer o
|
||||||
|
LEFT JOIN vn.tag t1 ON t1.ediTypeFk = o.ef1 AND t1.overwrite = 'size'
|
||||||
|
LEFT JOIN vn.tag t2 ON t2.ediTypeFk = o.ef2 AND t2.overwrite = 'size'
|
||||||
|
LEFT JOIN vn.tag t3 ON t3.ediTypeFk = o.ef3 AND t3.overwrite = 'size'
|
||||||
|
LEFT JOIN vn.tag t4 ON t4.ediTypeFk = o.ef4 AND t4.overwrite = 'size'
|
||||||
|
LEFT JOIN vn.tag t5 ON t5.ediTypeFk = o.ef5 AND t5.overwrite = 'size'
|
||||||
|
LEFT JOIN vn.tag t6 ON t6.ediTypeFk = o.ef6 AND t6.overwrite = 'size'
|
||||||
|
JOIN vn.floramondoConfig fc ON TRUE
|
||||||
|
WHERE (t1.id IS NOT NULL AND CONVERT(s1Value, UNSIGNED) > fc.itemMaxSize)
|
||||||
|
OR (t2.id IS NOT NULL AND CONVERT(s2Value, UNSIGNED) > fc.itemMaxSize)
|
||||||
|
OR (t3.id IS NOT NULL AND CONVERT(s3Value, UNSIGNED) > fc.itemMaxSize)
|
||||||
|
OR (t4.id IS NOT NULL AND CONVERT(s4Value, UNSIGNED) > fc.itemMaxSize)
|
||||||
|
OR (t5.id IS NOT NULL AND CONVERT(s5Value, UNSIGNED) > fc.itemMaxSize)
|
||||||
|
OR (t6.id IS NOT NULL AND CONVERT(s6Value, UNSIGNED) > fc.itemMaxSize);
|
||||||
|
|
||||||
|
START TRANSACTION;
|
||||||
|
|
||||||
|
-- Actualizamos el campo supplyResponseFk para aquellos articulos que ya estan creados y reutilizamos
|
||||||
|
UPDATE IGNORE edi.offer o
|
||||||
|
JOIN vn.item i
|
||||||
|
ON i.name = o.product_name
|
||||||
|
AND i.subname <=> o.company_name
|
||||||
|
AND i.value5 <=> o.s1Value
|
||||||
|
AND i.value6 <=> o.s2Value
|
||||||
|
AND i.value7 <=> o.s3Value
|
||||||
|
AND i.value8 <=> o.s4Value
|
||||||
|
AND i.value9 <=> o.s5Value
|
||||||
|
AND i.value10 <=> o.s6Value
|
||||||
|
AND i.NumberOfItemsPerCask <=> o.NumberOfItemsPerCask
|
||||||
|
AND i.EmbalageCode <=> o.EmbalageCode
|
||||||
|
AND i.quality <=> o.Quality
|
||||||
|
JOIN vn.itemType it ON it.id = i.typeFk
|
||||||
|
LEFT JOIN vn.sale s ON s.itemFk = i.id
|
||||||
|
LEFT JOIN vn.ticket t ON t.id = s.ticketFk
|
||||||
|
AND t.shipped > (util.VN_CURDATE() - INTERVAL 1 WEEK)
|
||||||
|
LEFT JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk
|
||||||
|
LEFT JOIN edi.deliveryInformation di ON di.supplyResponseID = sr.ID
|
||||||
|
LEFT JOIN edi.putOrder po ON po.supplyResponseID = i.supplyResponseFk
|
||||||
|
AND po.OrderTradeLineDateTime > (util.VN_CURDATE() - INTERVAL 1 WEEK)
|
||||||
|
SET i.supplyResponseFk = o.srID
|
||||||
|
WHERE (sr.ID IS NULL
|
||||||
|
OR sr.NumberOfUnits = 0
|
||||||
|
OR di.LatestOrderDateTime < util.VN_NOW()
|
||||||
|
OR di.ID IS NULL)
|
||||||
|
AND it.isInventory
|
||||||
|
AND t.id IS NULL
|
||||||
|
AND po.id IS NULL;
|
||||||
|
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE itemToInsert
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT o.*, CAST(NULL AS DECIMAL(6,0)) itemFk
|
||||||
|
FROM edi.offer o
|
||||||
|
LEFT JOIN vn.item i ON i.supplyResponseFk = o.srId
|
||||||
|
WHERE i.id IS NULL
|
||||||
|
LIMIT vMaxNewItems;
|
||||||
|
|
||||||
|
-- Reciclado de nº de item
|
||||||
|
OPEN cur1;
|
||||||
|
OPEN cur2;
|
||||||
|
|
||||||
|
read_loop: LOOP
|
||||||
|
|
||||||
|
FETCH cur2 INTO vSupplyResponseFk;
|
||||||
|
FETCH cur1 INTO vFreeId;
|
||||||
|
|
||||||
|
IF vDone THEN
|
||||||
|
LEAVE read_loop;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
UPDATE itemToInsert
|
||||||
|
SET itemFk = vFreeId
|
||||||
|
WHERE srId = vSupplyResponseFk;
|
||||||
|
|
||||||
|
END LOOP;
|
||||||
|
|
||||||
|
CLOSE cur1;
|
||||||
|
CLOSE cur2;
|
||||||
|
|
||||||
|
-- Insertamos todos los items en Articles de la oferta
|
||||||
|
INSERT INTO vn.item(id,
|
||||||
|
`name`,
|
||||||
|
longName,
|
||||||
|
subName,
|
||||||
|
expenseFk,
|
||||||
|
typeFk,
|
||||||
|
intrastatFk,
|
||||||
|
originFk,
|
||||||
|
supplyResponseFk,
|
||||||
|
numberOfItemsPerCask,
|
||||||
|
embalageCode,
|
||||||
|
quality,
|
||||||
|
isFloramondo)
|
||||||
|
SELECT iti.itemFk,
|
||||||
|
iti.product_name,
|
||||||
|
iti.product_name,
|
||||||
|
iti.company_name,
|
||||||
|
iti.expenseFk,
|
||||||
|
iti.itemTypeFk,
|
||||||
|
iti.intrastatFk,
|
||||||
|
iti.originFk,
|
||||||
|
iti.`srId`,
|
||||||
|
iti.NumberOfItemsPerCask,
|
||||||
|
iti.EmbalageCode,
|
||||||
|
iti.Quality,
|
||||||
|
TRUE
|
||||||
|
FROM itemToInsert iti;
|
||||||
|
|
||||||
|
-- Inserta la foto de los articulos nuevos (prioridad alta)
|
||||||
|
INSERT IGNORE INTO vn.itemImageQueue(itemFk, url)
|
||||||
|
SELECT i.id, PictureReference
|
||||||
|
FROM itemToInsert ii
|
||||||
|
JOIN vn.item i ON i.supplyResponseFk = ii.srId
|
||||||
|
WHERE PictureReference IS NOT NULL
|
||||||
|
AND i.image IS NULL;
|
||||||
|
|
||||||
|
INSERT INTO edi.`log`(tableName, fieldName,fieldValue)
|
||||||
|
SELECT 'itemImageQueue','NumImagenesPtes', COUNT(*)
|
||||||
|
FROM vn.itemImageQueue
|
||||||
|
WHERE attempts = 0;
|
||||||
|
|
||||||
|
-- Inserta si se añadiesen tags nuevos
|
||||||
|
INSERT IGNORE INTO vn.tag (name, ediTypeFk)
|
||||||
|
SELECT description, type_id FROM edi.type;
|
||||||
|
|
||||||
|
-- Desabilita el trigger para recalcular los tags al final
|
||||||
|
SET @isTriggerDisabled = TRUE;
|
||||||
|
|
||||||
|
-- Inserta los tags sólo en los articulos nuevos
|
||||||
|
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
|
||||||
|
SELECT i.id, t.id , ii.product_name, 1
|
||||||
|
FROM itemToInsert ii
|
||||||
|
JOIN vn.tag t ON t.`name` = 'Producto'
|
||||||
|
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
|
||||||
|
WHERE NOT ii.product_name IS NULL;
|
||||||
|
|
||||||
|
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
|
||||||
|
SELECT i.id, t.id , ii.Quality, 3
|
||||||
|
FROM itemToInsert ii
|
||||||
|
JOIN vn.tag t ON t.`name` = 'Calidad'
|
||||||
|
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
|
||||||
|
WHERE NOT ii.Quality IS NULL;
|
||||||
|
|
||||||
|
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
|
||||||
|
SELECT i.id, t.id , ii.company_name, 4
|
||||||
|
FROM itemToInsert ii
|
||||||
|
JOIN vn.tag t ON t.`name` = 'Productor'
|
||||||
|
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
|
||||||
|
WHERE NOT ii.company_name IS NULL;
|
||||||
|
|
||||||
|
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
|
||||||
|
SELECT i.id, t.id , s1Value, 5
|
||||||
|
FROM itemToInsert ii
|
||||||
|
JOIN vn.tag t ON t.ediTypeFk = ii.ef1
|
||||||
|
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
|
||||||
|
WHERE NOT s1Value IS NULL;
|
||||||
|
|
||||||
|
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
|
||||||
|
SELECT i.id, t.id , s2Value, 6
|
||||||
|
FROM itemToInsert ii
|
||||||
|
JOIN vn.tag t ON t.ediTypeFk = ii.ef2
|
||||||
|
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
|
||||||
|
WHERE NOT s2Value IS NULL;
|
||||||
|
|
||||||
|
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
|
||||||
|
SELECT i.id, t.id , s3Value, 7
|
||||||
|
FROM itemToInsert ii
|
||||||
|
JOIN vn.tag t ON t.ediTypeFk = ii.ef3
|
||||||
|
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
|
||||||
|
WHERE NOT s3Value IS NULL;
|
||||||
|
|
||||||
|
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
|
||||||
|
SELECT i.id, t.id , s4Value, 8
|
||||||
|
FROM itemToInsert ii
|
||||||
|
JOIN vn.tag t ON t.ediTypeFk = ii.ef4
|
||||||
|
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
|
||||||
|
WHERE NOT s4Value IS NULL;
|
||||||
|
|
||||||
|
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
|
||||||
|
SELECT i.id, t.id , s5Value, 9
|
||||||
|
FROM itemToInsert ii
|
||||||
|
JOIN vn.tag t ON t.ediTypeFk = ii.ef5
|
||||||
|
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
|
||||||
|
WHERE NOT s5Value IS NULL;
|
||||||
|
|
||||||
|
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
|
||||||
|
SELECT i.id, t.id , s6Value, 10
|
||||||
|
FROM itemToInsert ii
|
||||||
|
JOIN vn.tag t ON t.ediTypeFk = ii.ef6
|
||||||
|
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
|
||||||
|
WHERE NOT s6Value IS NULL;
|
||||||
|
|
||||||
|
INSERT IGNORE INTO vn.itemTag(itemFk, tagFk, value, priority)
|
||||||
|
SELECT i.id, t.id, IFNULL(ink.name, ik.color), 11
|
||||||
|
FROM itemToInsert ii
|
||||||
|
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
|
||||||
|
JOIN vn.tag t ON t.`name` = 'Color'
|
||||||
|
LEFT JOIN edi.feature f ON f.item_id = ii.Item_ArticleCode
|
||||||
|
LEFT JOIN edi.`type` tp ON tp.type_id = f.feature_type_id
|
||||||
|
AND tp.`description` = 'Hoofdkleur 1'
|
||||||
|
LEFT JOIN vn.ink ON ink.dutchCode = f.feature_value
|
||||||
|
LEFT JOIN vn.itemInk ik ON ik.longName = i.longName
|
||||||
|
WHERE ink.name IS NOT NULL
|
||||||
|
OR ik.color IS NOT NULL;
|
||||||
|
|
||||||
|
CREATE OR REPLACE TABLE tmp.item
|
||||||
|
(PRIMARY KEY (id))
|
||||||
|
SELECT i.id FROM vn.item i
|
||||||
|
JOIN itemToInsert ii ON i.supplyResponseFk = ii.`srId`;
|
||||||
|
|
||||||
|
CALL vn.item_refreshTags();
|
||||||
|
|
||||||
|
DROP TABLE tmp.item;
|
||||||
|
|
||||||
|
SELECT MIN(LatestDeliveryDateTime) INTO vLanded
|
||||||
|
FROM edi.supplyResponse sr
|
||||||
|
JOIN edi.deliveryInformation di ON di.supplyResponseID = sr.ID
|
||||||
|
JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID
|
||||||
|
JOIN vn.floramondoConfig fc
|
||||||
|
WHERE mp.isLatestOrderDateTimeRelevant
|
||||||
|
AND di.LatestOrderDateTime > IF(
|
||||||
|
fc.MaxLatestOrderHour > HOUR(util.VN_NOW()),
|
||||||
|
util.VN_CURDATE(),
|
||||||
|
util.VN_CURDATE() + INTERVAL 1 DAY);
|
||||||
|
|
||||||
|
UPDATE vn.floramondoConfig
|
||||||
|
SET nextLanded = vLanded
|
||||||
|
WHERE vLanded IS NOT NULL;
|
||||||
|
|
||||||
|
-- Elimina la oferta obsoleta
|
||||||
|
UPDATE vn.buy b
|
||||||
|
JOIN vn.entry e ON e.id = b.entryFk
|
||||||
|
JOIN vn.travel tr ON tr.id = e.travelFk
|
||||||
|
JOIN vn.agencyMode am ON am.id = tr.agencyModeFk
|
||||||
|
JOIN vn.item i ON i.id = b.itemFk
|
||||||
|
LEFT JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID
|
||||||
|
LEFT JOIN edi.deliveryInformation di ON di.ID = b.deliveryFk
|
||||||
|
SET b.quantity = 0
|
||||||
|
WHERE (IFNULL(di.LatestOrderDateTime,util.VN_NOW()) <= util.VN_NOW()
|
||||||
|
OR i.supplyResponseFk IS NULL
|
||||||
|
OR sr.NumberOfUnits = 0)
|
||||||
|
AND am.name = 'LOGIFLORA'
|
||||||
|
AND e.isRaid;
|
||||||
|
|
||||||
|
-- Localiza las entradas de cada almacen
|
||||||
|
UPDATE edi.warehouseFloramondo
|
||||||
|
SET entryFk = vn.entry_getForLogiflora(vLanded + INTERVAL travellingDays DAY, warehouseFk);
|
||||||
|
|
||||||
|
IF vLanded IS NOT NULL THEN
|
||||||
|
-- Actualiza la oferta existente
|
||||||
|
UPDATE vn.buy b
|
||||||
|
JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk
|
||||||
|
JOIN vn.item i ON i.id = b.itemFk
|
||||||
|
JOIN edi.offer o ON i.supplyResponseFk = o.`srId`
|
||||||
|
SET b.quantity = o.NumberOfUnits * o.NumberOfItemsPerCask,
|
||||||
|
b.buyingValue = o.price
|
||||||
|
WHERE (b.quantity <> o.NumberOfUnits * o.NumberOfItemsPerCask
|
||||||
|
OR b.buyingValue <> o.price);
|
||||||
|
|
||||||
|
-- Inserta el resto
|
||||||
|
SET vLastInserted := util.VN_NOW();
|
||||||
|
|
||||||
|
-- Inserta la oferta
|
||||||
|
INSERT INTO vn.buy (
|
||||||
|
entryFk,
|
||||||
|
itemFk,
|
||||||
|
quantity,
|
||||||
|
buyingValue,
|
||||||
|
stickers,
|
||||||
|
packing,
|
||||||
|
`grouping`,
|
||||||
|
groupingMode,
|
||||||
|
packagingFk,
|
||||||
|
deliveryFk)
|
||||||
|
SELECT wf.entryFk,
|
||||||
|
i.id,
|
||||||
|
o.NumberOfUnits * o.NumberOfItemsPerCask quantity,
|
||||||
|
o.Price,
|
||||||
|
o.NumberOfUnits etiquetas,
|
||||||
|
o.NumberOfItemsPerCask packing,
|
||||||
|
GREATEST(1, IFNULL(o.MinimumQuantity,0)) * o.NumberOfItemsPerCask `grouping`,
|
||||||
|
'packing',
|
||||||
|
o.embalageCode,
|
||||||
|
o.diId
|
||||||
|
FROM edi.offer o
|
||||||
|
JOIN vn.item i ON i.supplyResponseFk = o.srId
|
||||||
|
JOIN edi.warehouseFloramondo wf
|
||||||
|
JOIN vn.packaging p ON p.id
|
||||||
|
LIKE o.embalageCode
|
||||||
|
LEFT JOIN vn.buy b ON b.itemFk = i.id
|
||||||
|
AND b.entryFk = wf.entryFk
|
||||||
|
WHERE b.id IS NULL; -- Quitar esta linea y mirar de crear los packages a tiempo REAL
|
||||||
|
|
||||||
|
INSERT INTO vn.itemCost(
|
||||||
|
itemFk,
|
||||||
|
warehouseFk,
|
||||||
|
cm3,
|
||||||
|
cm3delivery)
|
||||||
|
SELECT b.itemFk,
|
||||||
|
wf.warehouseFk,
|
||||||
|
@cm3 := vn.buy_getUnitVolume(b.id),
|
||||||
|
IFNULL((vc.standardFlowerBox * 1000) / i.packingOut, @cm3)
|
||||||
|
FROM warehouseFloramondo wf
|
||||||
|
JOIN vn.volumeConfig vc
|
||||||
|
JOIN vn.buy b ON b.entryFk = wf.entryFk
|
||||||
|
JOIN vn.item i ON i.id = b.itemFk
|
||||||
|
LEFT JOIN vn.itemCost ic ON ic.itemFk = b.itemFk
|
||||||
|
AND ic.warehouseFk = wf.warehouseFk
|
||||||
|
WHERE (ic.cm3 IS NULL OR ic.cm3 = 0)
|
||||||
|
ON DUPLICATE KEY UPDATE cm3 = @cm3, cm3delivery = IFNULL((vc.standardFlowerBox * 1000) / i.packingOut, @cm3);
|
||||||
|
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tmp.buyRecalc
|
||||||
|
SELECT b.id
|
||||||
|
FROM vn.buy b
|
||||||
|
JOIN warehouseFloramondo wf ON wf.entryFk = b.entryFk
|
||||||
|
WHERE b.created >= vLastInserted;
|
||||||
|
|
||||||
|
CALL vn.buy_recalcPrices();
|
||||||
|
|
||||||
|
UPDATE edi.offerList o
|
||||||
|
JOIN (SELECT v.name, COUNT(DISTINCT b.itemFk) total
|
||||||
|
FROM vn.buy b
|
||||||
|
JOIN vn.item i ON i.id = b.itemFk
|
||||||
|
JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk
|
||||||
|
JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID
|
||||||
|
JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk
|
||||||
|
JOIN vn.warehouse w ON w.id = wf.warehouseFk
|
||||||
|
WHERE w.name = 'VNH'
|
||||||
|
AND b.quantity > 0
|
||||||
|
GROUP BY sr.vmpID) sub ON o.supplier = sub.name
|
||||||
|
SET o.vnh = sub.total;
|
||||||
|
|
||||||
|
UPDATE edi.offerList o
|
||||||
|
JOIN (SELECT v.name, COUNT(DISTINCT b.itemFk) total
|
||||||
|
FROM vn.buy b
|
||||||
|
JOIN vn.item i ON i.id = b.itemFk
|
||||||
|
JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk
|
||||||
|
JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID
|
||||||
|
JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk
|
||||||
|
JOIN vn.warehouse w ON w.id = wf.warehouseFk
|
||||||
|
WHERE w.name = 'ALGEMESI'
|
||||||
|
AND b.quantity > 0
|
||||||
|
GROUP BY sr.vmpID) sub ON o.supplier = sub.name
|
||||||
|
SET o.algemesi = sub.total;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE
|
||||||
|
edi.offer,
|
||||||
|
itemToInsert;
|
||||||
|
|
||||||
|
SET @isTriggerDisabled = FALSE;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
-- Esto habria que pasarlo a procesos programados o trabajar con tags y dejar las familias
|
||||||
|
UPDATE vn.item i
|
||||||
|
SET typeFk = 121
|
||||||
|
WHERE i.longName LIKE 'Rosa Garden %'
|
||||||
|
AND typeFk = 17;
|
||||||
|
|
||||||
|
UPDATE vn.item i
|
||||||
|
SET typeFk = 156
|
||||||
|
WHERE i.longName LIKE 'Rosa ec %'
|
||||||
|
AND typeFk = 17;
|
||||||
|
|
||||||
|
-- Refresca las fotos de los items existentes que mostramos (prioridad baja)
|
||||||
|
INSERT IGNORE INTO vn.itemImageQueue(itemFk, url, priority)
|
||||||
|
SELECT i.id, sr.PictureReference, 100
|
||||||
|
FROM edi.supplyResponse sr
|
||||||
|
JOIN vn.item i ON i.supplyResponseFk = sr.ID
|
||||||
|
JOIN edi.supplyOffer so ON so.srId = sr.ID
|
||||||
|
JOIN hedera.image i2 ON i2.name = i.image
|
||||||
|
AND i2.collectionFk = 'catalog'
|
||||||
|
WHERE i2.updated <= (UNIX_TIMESTAMP(util.VN_NOW()) - vDayRange)
|
||||||
|
AND sr.NumberOfUnits;
|
||||||
|
|
||||||
|
INSERT INTO edi.`log`
|
||||||
|
SET tableName = 'floramondo_offerRefresh',
|
||||||
|
fieldName = 'Tiempo de proceso',
|
||||||
|
fieldValue = TIMEDIFF(util.VN_NOW(), vStartingTime);
|
||||||
|
|
||||||
|
DO RELEASE_LOCK('edi.floramondo_offerRefresh');
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -6,16 +6,16 @@ BEGIN
|
||||||
|
|
||||||
UPDATE vn.buy b
|
UPDATE vn.buy b
|
||||||
JOIN vn.entry e ON e.id = b.entryFk
|
JOIN vn.entry e ON e.id = b.entryFk
|
||||||
JOIN vn.travel tr ON tr.id = e.travelFk
|
JOIN vn.travel tr ON tr.id = e.travelFk
|
||||||
JOIN vn.agencyMode am ON am.id = tr.agencyModeFk
|
JOIN vn.agencyMode am ON am.id = tr.agencyModeFk
|
||||||
JOIN vn.item i ON i.id = b.itemFk
|
JOIN vn.item i ON i.id = b.itemFk
|
||||||
JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID
|
JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID
|
||||||
SET b.quantity = NEW.NumberOfItemsPerCask * NEW.NumberOfUnits,
|
SET b.quantity = NEW.NumberOfItemsPerCask * NEW.NumberOfUnits,
|
||||||
b.stickers = NEW.NumberOfUnits
|
b.stickers = NEW.NumberOfUnits
|
||||||
WHERE i.supplyResponseFk = NEW.ID
|
WHERE i.supplyResponseFk = NEW.ID
|
||||||
AND am.name = 'LOGIFLORA'
|
AND am.name = 'LOGIFLORA'
|
||||||
AND tr.isRaid
|
AND e.isRaid
|
||||||
AND tr.landed >= util.VN_CURDATE();
|
AND tr.landed >= util.VN_CURDATE();
|
||||||
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -59,7 +59,7 @@ BEGIN
|
||||||
JOIN vn.travel t ON t.id = e.travelFk
|
JOIN vn.travel t ON t.id = e.travelFk
|
||||||
WHERE t.landed BETWEEN vDateInv AND vDate
|
WHERE t.landed BETWEEN vDateInv AND vDate
|
||||||
AND t.warehouseInFk = vWarehouse
|
AND t.warehouseInFk = vWarehouse
|
||||||
AND NOT t.isRaid
|
AND NOT e.isRaid
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT b.itemFk, -b.quantity
|
SELECT b.itemFk, -b.quantity
|
||||||
FROM vn.buy b
|
FROM vn.buy b
|
||||||
|
@ -67,7 +67,7 @@ BEGIN
|
||||||
JOIN vn.travel t ON t.id = e.travelFk
|
JOIN vn.travel t ON t.id = e.travelFk
|
||||||
WHERE t.shipped BETWEEN vDateInv AND util.VN_CURDATE()
|
WHERE t.shipped BETWEEN vDateInv AND util.VN_CURDATE()
|
||||||
AND t.warehouseOutFk = vWarehouse
|
AND t.warehouseOutFk = vWarehouse
|
||||||
AND NOT t.isRaid
|
AND NOT e.isRaid
|
||||||
AND t.isDelivered
|
AND t.isDelivered
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT m.itemFk, -m.quantity
|
SELECT m.itemFk, -m.quantity
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost`
|
|
||||||
PROCEDURE `hedera`.`orderRow_updateOverstocking`(vOrderFk INT)
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Set amount = 0 to avoid overbooking sales
|
|
||||||
*
|
|
||||||
* @param vOrderFk hedera.order.id
|
|
||||||
*/
|
|
||||||
DECLARE vCalcFk INT;
|
|
||||||
DECLARE vDone BOOL;
|
|
||||||
DECLARE vWarehouseFk INT;
|
|
||||||
|
|
||||||
DECLARE cWarehouses CURSOR FOR
|
|
||||||
SELECT DISTINCT warehouseFk
|
|
||||||
FROM orderRow
|
|
||||||
WHERE orderFk = vOrderFk
|
|
||||||
AND shipment = util.VN_CURDATE();
|
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
|
||||||
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
|
||||||
BEGIN
|
|
||||||
ROLLBACK;
|
|
||||||
RESIGNAL;
|
|
||||||
END;
|
|
||||||
|
|
||||||
OPEN cWarehouses;
|
|
||||||
checking: LOOP
|
|
||||||
SET vDone = FALSE;
|
|
||||||
|
|
||||||
FETCH cWarehouses INTO vWarehouseFk;
|
|
||||||
|
|
||||||
IF vDone THEN
|
|
||||||
LEAVE checking;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, util.VN_CURDATE());
|
|
||||||
|
|
||||||
UPDATE orderRow r
|
|
||||||
JOIN `order` o ON o.id = r.orderFk
|
|
||||||
JOIN orderConfig oc
|
|
||||||
JOIN cache.available a ON a.calc_id = vCalcFk AND a.item_id = r.itemFk
|
|
||||||
SET r.amount = 0
|
|
||||||
WHERE ADDTIME(o.rowUpdated, oc.reserveTime) < util.VN_NOW()
|
|
||||||
AND a.available <= 0
|
|
||||||
AND r.warehouseFk = vWarehouseFk
|
|
||||||
AND r.orderFk = vOrderFk;
|
|
||||||
END LOOP;
|
|
||||||
CLOSE cWarehouses;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,8 +1,8 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`order_addItem`(
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`order_addItem`(
|
||||||
vSelf INT,
|
vSelf INT,
|
||||||
vWarehouse INT,
|
vWarehouse INT,
|
||||||
vItem INT,
|
vItem INT,
|
||||||
vAmount INT)
|
vAmount INT)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
|
@ -37,7 +37,7 @@ BEGIN
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
RESIGNAL;
|
RESIGNAL;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
CALL order_calcCatalogFromItem(vSelf, vItem);
|
CALL order_calcCatalogFromItem(vSelf, vItem);
|
||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
|
|
||||||
|
@ -47,15 +47,11 @@ BEGIN
|
||||||
FROM tmp.zoneGetShipped
|
FROM tmp.zoneGetShipped
|
||||||
WHERE warehouseFk = vWarehouse;
|
WHERE warehouseFk = vWarehouse;
|
||||||
|
|
||||||
SELECT available INTO vAvailable
|
SELECT IFNULL(available, 0) INTO vAvailable
|
||||||
FROM tmp.ticketLot
|
FROM tmp.ticketLot
|
||||||
WHERE warehouseFk = vWarehouse
|
WHERE warehouseFk = vWarehouse
|
||||||
AND itemFk = vItem;
|
AND itemFk = vItem;
|
||||||
|
|
||||||
IF vAvailable IS NULL THEN
|
|
||||||
SET vAvailable = 0;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF vAmount > vAvailable THEN
|
IF vAmount > vAvailable THEN
|
||||||
CALL util.throw ('ORDER_ROW_UNAVAILABLE');
|
CALL util.throw ('ORDER_ROW_UNAVAILABLE');
|
||||||
END IF;
|
END IF;
|
||||||
|
@ -106,8 +102,6 @@ BEGIN
|
||||||
amount = vAdd,
|
amount = vAdd,
|
||||||
price = vPrice;
|
price = vPrice;
|
||||||
|
|
||||||
CALL cache.available_updateItem(vItem, vWarehouse, vShipment, vAdd);
|
|
||||||
|
|
||||||
SET vRow = LAST_INSERT_ID();
|
SET vRow = LAST_INSERT_ID();
|
||||||
|
|
||||||
INSERT INTO orderRowComponent (rowFk, componentFk, price)
|
INSERT INTO orderRowComponent (rowFk, componentFk, price)
|
||||||
|
@ -127,6 +121,6 @@ BEGIN
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
CALL vn.ticketCalculatePurge;
|
CALL vn.ticketCalculatePurge;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -1,61 +1,59 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`order_confirmWithUser`(
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`order_confirmWithUser`(vSelf INT, vUserId INT)
|
||||||
vSelf INT,
|
|
||||||
vUserFk INT
|
|
||||||
)
|
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Confirms an order, creating each of its tickets
|
* Confirms an order, creating each of its tickets on the corresponding
|
||||||
* on the corresponding date, store and user.
|
* date, store and user.
|
||||||
*
|
*
|
||||||
* @param vSelf The order identifier
|
* @param vSelf The order identifier
|
||||||
* @param vUser The user identifier
|
* @param vUser The user identifier
|
||||||
*/
|
*/
|
||||||
DECLARE vHasRows BOOL;
|
DECLARE vOk BOOL;
|
||||||
DECLARE vHas0Amount BOOL;
|
DECLARE vDone BOOL DEFAULT FALSE;
|
||||||
DECLARE vDone BOOL;
|
DECLARE vWarehouse INT;
|
||||||
DECLARE vWarehouseFk INT;
|
|
||||||
DECLARE vShipment DATE;
|
DECLARE vShipment DATE;
|
||||||
DECLARE vShipmentDayEnd DATETIME;
|
DECLARE vTicket INT;
|
||||||
DECLARE vTicketFk INT;
|
|
||||||
DECLARE vNotes VARCHAR(255);
|
DECLARE vNotes VARCHAR(255);
|
||||||
DECLARE vItemFk INT;
|
DECLARE vItem INT;
|
||||||
DECLARE vConcept VARCHAR(30);
|
DECLARE vConcept VARCHAR(30);
|
||||||
DECLARE vAmount INT;
|
DECLARE vAmount INT;
|
||||||
DECLARE vPrice DECIMAL(10,2);
|
DECLARE vPrice DECIMAL(10,2);
|
||||||
DECLARE vSaleFk INT;
|
DECLARE vSale INT;
|
||||||
DECLARE vRowFk INT;
|
DECLARE vRate INT;
|
||||||
|
DECLARE vRowId INT;
|
||||||
DECLARE vPriceFixed DECIMAL(10,2);
|
DECLARE vPriceFixed DECIMAL(10,2);
|
||||||
DECLARE vLanded DATE;
|
DECLARE vDelivery DATE;
|
||||||
DECLARE vAddressFk INT;
|
DECLARE vAddress INT;
|
||||||
DECLARE vClientFk INT;
|
DECLARE vIsConfirmed BOOL;
|
||||||
DECLARE vCompanyFk INT;
|
DECLARE vClientId INT;
|
||||||
DECLARE vAgencyModeFk INT;
|
DECLARE vCompanyId INT;
|
||||||
|
DECLARE vAgencyModeId INT;
|
||||||
|
DECLARE TICKET_FREE INT DEFAULT 2;
|
||||||
|
DECLARE vCalc INT;
|
||||||
|
DECLARE vIsLogifloraItem BOOL;
|
||||||
|
DECLARE vOldQuantity INT;
|
||||||
|
DECLARE vNewQuantity INT;
|
||||||
DECLARE vIsTaxDataChecked BOOL;
|
DECLARE vIsTaxDataChecked BOOL;
|
||||||
|
|
||||||
DECLARE vDates CURSOR FOR
|
DECLARE cDates CURSOR FOR
|
||||||
SELECT zgs.shipped, r.warehouseFk
|
SELECT zgs.shipped, r.warehouse_id
|
||||||
FROM `order` o
|
FROM `order` o
|
||||||
JOIN orderRow r ON r.orderFk = o.id
|
JOIN order_row r ON r.order_id = o.id
|
||||||
LEFT JOIN tmp.zoneGetShipped zgs ON zgs.warehouseFk = r.warehouseFk
|
LEFT JOIN tmp.zoneGetShipped zgs ON zgs.warehouseFk = r.warehouse_id
|
||||||
WHERE o.id = vSelf
|
WHERE o.id = vSelf AND r.amount != 0
|
||||||
AND r.amount
|
GROUP BY r.warehouse_id;
|
||||||
GROUP BY r.warehouseFk;
|
|
||||||
|
|
||||||
DECLARE vRows CURSOR FOR
|
DECLARE cRows CURSOR FOR
|
||||||
SELECT r.id,
|
SELECT r.id, r.item_id, i.name, r.amount, r.price, r.rate, i.isFloramondo
|
||||||
r.itemFk,
|
FROM order_row r
|
||||||
i.name,
|
JOIN vn.item i ON i.id = r.item_id
|
||||||
r.amount,
|
WHERE r.amount != 0
|
||||||
r.price
|
AND r.warehouse_id = vWarehouse
|
||||||
FROM orderRow r
|
AND r.order_id = vSelf
|
||||||
JOIN vn.item i ON i.id = r.itemFk
|
|
||||||
WHERE r.amount
|
|
||||||
AND r.warehouseFk = vWarehouseFk
|
|
||||||
AND r.orderFk = vSelf
|
|
||||||
ORDER BY r.rate DESC;
|
ORDER BY r.rate DESC;
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
||||||
|
SET vDone = TRUE;
|
||||||
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -64,50 +62,26 @@ BEGIN
|
||||||
END;
|
END;
|
||||||
|
|
||||||
-- Carga los datos del pedido
|
-- Carga los datos del pedido
|
||||||
SELECT o.date_send,
|
SELECT o.date_send, o.address_id, o.note, a.clientFk,
|
||||||
o.address_id,
|
o.company_id, o.agency_id, c.isTaxDataChecked
|
||||||
o.note,
|
INTO vDelivery, vAddress, vNotes, vClientId,
|
||||||
a.clientFk,
|
vCompanyId, vAgencyModeId, vIsTaxDataChecked
|
||||||
o.company_id,
|
FROM hedera.`order` o
|
||||||
o.agency_id,
|
|
||||||
c.isTaxDataChecked
|
|
||||||
INTO vLanded,
|
|
||||||
vAddressFk,
|
|
||||||
vNotes,
|
|
||||||
vClientFk,
|
|
||||||
vCompanyFk,
|
|
||||||
vAgencyModeFk,
|
|
||||||
vIsTaxDataChecked
|
|
||||||
FROM `order` o
|
|
||||||
JOIN vn.address a ON a.id = o.address_id
|
JOIN vn.address a ON a.id = o.address_id
|
||||||
JOIN vn.client c ON c.id = a.clientFk
|
JOIN vn.client c ON c.id = a.clientFk
|
||||||
WHERE o.id = vSelf;
|
WHERE o.id = vSelf;
|
||||||
|
|
||||||
-- Verifica si el cliente tiene los datos comprobados
|
-- Verifica si el cliente tiene los datos comprobados
|
||||||
IF NOT vIsTaxDataChecked THEN
|
IF NOT vIsTaxDataChecked THEN
|
||||||
CALL util.throw('clientNotVerified');
|
CALL util.throw ('clientNotVerified');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- Carga las fechas de salida de cada almacen
|
-- Carga las fechas de salida de cada almacen
|
||||||
CALL vn.zone_getShipped(vLanded, vAddressFk, vAgencyModeFk, FALSE);
|
CALL vn.zone_getShipped (vDelivery, vAddress, vAgencyModeId, FALSE);
|
||||||
|
|
||||||
-- Trabajador que realiza la accion
|
-- Trabajador que realiza la accion
|
||||||
IF vUserFk IS NULL THEN
|
IF vUserId IS NULL THEN
|
||||||
SELECT employeeFk INTO vUserFk FROM orderConfig;
|
SELECT employeeFk INTO vUserId FROM orderConfig;
|
||||||
END IF;
|
|
||||||
|
|
||||||
CALL orderRow_updateOverstocking(vSelf);
|
|
||||||
|
|
||||||
-- Check if any product has a quantity of 0
|
|
||||||
SELECT EXISTS (
|
|
||||||
SELECT id
|
|
||||||
FROM orderRow
|
|
||||||
WHERE orderFk = vSelf
|
|
||||||
AND amount = 0
|
|
||||||
) INTO vHas0Amount;
|
|
||||||
|
|
||||||
IF vHas0Amount THEN
|
|
||||||
CALL util.throw('Hay líneas vacías. Por favor, elimínelas');
|
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
|
@ -115,188 +89,207 @@ BEGIN
|
||||||
CALL order_checkEditable(vSelf);
|
CALL order_checkEditable(vSelf);
|
||||||
|
|
||||||
-- Check order is not empty
|
-- Check order is not empty
|
||||||
SELECT COUNT(*) > 0 INTO vHasRows
|
|
||||||
FROM orderRow
|
|
||||||
WHERE orderFk = vSelf
|
|
||||||
AND amount > 0;
|
|
||||||
|
|
||||||
IF NOT vHasRows THEN
|
SELECT COUNT(*) > 0 INTO vOk
|
||||||
CALL util.throw('ORDER_EMPTY');
|
FROM order_row WHERE order_id = vSelf AND amount > 0;
|
||||||
|
|
||||||
|
IF NOT vOk THEN
|
||||||
|
CALL util.throw ('ORDER_EMPTY');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- Crea los tickets del pedido
|
-- Crea los tickets del pedido
|
||||||
OPEN vDates;
|
|
||||||
lDates: LOOP
|
OPEN cDates;
|
||||||
SET vTicketFk = NULL;
|
|
||||||
|
lDates:
|
||||||
|
LOOP
|
||||||
|
SET vTicket = NULL;
|
||||||
SET vDone = FALSE;
|
SET vDone = FALSE;
|
||||||
FETCH vDates INTO vShipment, vWarehouseFk;
|
FETCH cDates INTO vShipment, vWarehouse;
|
||||||
|
|
||||||
IF vDone THEN
|
IF vDone THEN
|
||||||
LEAVE lDates;
|
LEAVE lDates;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SET vShipmentDayEnd = util.dayEnd(vShipment);
|
-- Busca un ticket existente que coincida con los parametros
|
||||||
|
WITH tPrevia AS
|
||||||
-- Busca un ticket libre disponible
|
(SELECT DISTINCT s.ticketFk
|
||||||
WITH tPrevia AS (
|
|
||||||
SELECT DISTINCT s.ticketFk
|
|
||||||
FROM vn.sale s
|
FROM vn.sale s
|
||||||
JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id
|
JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id
|
||||||
JOIN vn.ticket t ON t.id = s.ticketFk
|
JOIN vn.ticket t ON t.id = s.ticketFk
|
||||||
WHERE t.shipped BETWEEN vShipment AND vShipmentDayEnd
|
WHERE t.shipped BETWEEN vShipment AND util.dayend(vShipment)
|
||||||
)
|
)
|
||||||
SELECT t.id INTO vTicketFk
|
SELECT t.id INTO vTicket
|
||||||
FROM vn.ticket t
|
FROM vn.ticket t
|
||||||
JOIN vn.alertLevel al ON al.code = 'FREE'
|
JOIN vn.alertLevel al ON al.code = 'FREE'
|
||||||
LEFT JOIN tPrevia tp ON tp.ticketFk = t.id
|
LEFT JOIN tPrevia tp ON tp.ticketFk = t.id
|
||||||
LEFT JOIN vn.ticketState tls ON tls.ticketFk = t.id
|
LEFT JOIN vn.ticketState tls on tls.ticketFk = t.id
|
||||||
JOIN hedera.`order` o ON o.address_id = t.addressFk
|
JOIN hedera.`order` o
|
||||||
AND t.shipped BETWEEN vShipment AND vShipmentDayEnd
|
ON o.address_id = t.addressFk
|
||||||
AND t.warehouseFk = vWarehouseFk
|
AND vWarehouse = t.warehouseFk
|
||||||
AND o.date_send = t.landed
|
AND o.date_send = t.landed
|
||||||
|
AND DATE(t.shipped) = vShipment
|
||||||
WHERE o.id = vSelf
|
WHERE o.id = vSelf
|
||||||
AND t.refFk IS NULL
|
AND t.refFk IS NULL
|
||||||
AND tp.ticketFk IS NULL
|
AND tp.ticketFk IS NULL
|
||||||
AND (tls.alertLevel IS NULL OR tls.alertLevel = al.id)
|
AND (tls.alertLevel IS NULL OR tls.alertLevel = al.id)
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
|
|
||||||
-- Comprobamos si hay un ticket de previa disponible
|
|
||||||
IF vTicketFk IS NULL THEN
|
|
||||||
WITH tItemPackingTypeOrder AS (
|
|
||||||
SELECT GROUP_CONCAT(
|
|
||||||
DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk
|
|
||||||
) distinctItemPackingTypes,
|
|
||||||
o.address_id
|
|
||||||
FROM vn.item i
|
|
||||||
JOIN hedera.orderRow oro ON oro.itemFk = i.id
|
|
||||||
JOIN hedera.`order` o ON o.id = oro.orderFk
|
|
||||||
WHERE oro.orderFk = vSelf
|
|
||||||
),
|
|
||||||
tItemPackingTypeTicket AS (
|
|
||||||
SELECT t.id,
|
|
||||||
GROUP_CONCAT(
|
|
||||||
DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk
|
|
||||||
) distinctItemPackingTypes
|
|
||||||
FROM vn.ticket t
|
|
||||||
JOIN vn.ticketState tls ON tls.ticketFk = t.id
|
|
||||||
JOIN vn.alertLevel al ON al.id = tls.alertLevel
|
|
||||||
JOIN vn.sale s ON s.ticketFk = t.id
|
|
||||||
JOIN vn.item i ON i.id = s.itemFk
|
|
||||||
JOIN tItemPackingTypeOrder ipto
|
|
||||||
WHERE t.shipped BETWEEN vShipment AND vShipmentDayEnd
|
|
||||||
AND t.refFk IS NULL
|
|
||||||
AND t.warehouseFk = vWarehouseFk
|
|
||||||
AND t.addressFk = ipto.address_id
|
|
||||||
AND al.code = 'ON_PREVIOUS'
|
|
||||||
GROUP BY t.id
|
|
||||||
)
|
|
||||||
SELECT iptt.id INTO vTicketFk
|
|
||||||
FROM tItemPackingTypeTicket iptt
|
|
||||||
JOIN tItemPackingTypeOrder ipto
|
|
||||||
WHERE INSTR(iptt.distinctItemPackingTypes, ipto.distinctItemPackingTypes)
|
|
||||||
LIMIT 1;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Crea el ticket en el caso de no existir uno adecuado
|
-- Crea el ticket en el caso de no existir uno adecuado
|
||||||
IF vTicketFk IS NULL THEN
|
IF vTicket IS NULL
|
||||||
|
THEN
|
||||||
|
|
||||||
SET vShipment = IFNULL(vShipment, util.VN_CURDATE());
|
SET vShipment = IFNULL(vShipment, util.VN_CURDATE());
|
||||||
|
|
||||||
CALL vn.ticket_add(
|
CALL vn.ticket_add(
|
||||||
vClientFk,
|
vClientId,
|
||||||
vShipment,
|
vShipment,
|
||||||
vWarehouseFk,
|
vWarehouse,
|
||||||
vCompanyFk,
|
vCompanyId,
|
||||||
vAddressFk,
|
vAddress,
|
||||||
vAgencyModeFk,
|
vAgencyModeId,
|
||||||
NULL,
|
NULL,
|
||||||
vLanded,
|
vDelivery,
|
||||||
vUserFk,
|
vUserId,
|
||||||
TRUE,
|
TRUE,
|
||||||
vTicketFk
|
vTicket
|
||||||
);
|
);
|
||||||
ELSE
|
ELSE
|
||||||
INSERT INTO vn.ticketTracking
|
INSERT INTO vn.ticketTracking
|
||||||
SET ticketFk = vTicketFk,
|
SET ticketFk = vTicket,
|
||||||
userFk = vUserFk,
|
userFk = vUserId,
|
||||||
stateFk = (SELECT id FROM vn.state WHERE code = 'FREE');
|
stateFk = TICKET_FREE;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.orderTicket
|
INSERT IGNORE INTO vn.orderTicket
|
||||||
SET orderFk = vSelf,
|
SET orderFk = vSelf,
|
||||||
ticketFk = vTicketFk;
|
ticketFk = vTicket;
|
||||||
|
|
||||||
-- Añade las notas
|
-- Añade las notas
|
||||||
IF vNotes IS NOT NULL AND vNotes <> '' THEN
|
|
||||||
INSERT INTO vn.ticketObservation
|
IF vNotes IS NOT NULL AND vNotes != ''
|
||||||
SET ticketFk = vTicketFk,
|
THEN
|
||||||
observationTypeFk = (SELECT id FROM vn.observationType WHERE code = 'salesPerson'),
|
INSERT INTO vn.ticketObservation SET
|
||||||
|
ticketFk = vTicket,
|
||||||
|
observationTypeFk = 4 /* salesperson */ ,
|
||||||
`description` = vNotes
|
`description` = vNotes
|
||||||
ON DUPLICATE KEY UPDATE
|
ON DUPLICATE KEY UPDATE
|
||||||
`description` = CONCAT(VALUES(`description`),'. ', `description`);
|
`description` = CONCAT(VALUES(`description`),'. ', `description`);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- Añade los movimientos y sus componentes
|
-- Añade los movimientos y sus componentes
|
||||||
OPEN vRows;
|
|
||||||
|
OPEN cRows;
|
||||||
|
|
||||||
lRows: LOOP
|
lRows: LOOP
|
||||||
SET vSaleFk = NULL;
|
|
||||||
SET vDone = FALSE;
|
SET vDone = FALSE;
|
||||||
FETCH vRows INTO vRowFk, vItemFk, vConcept, vAmount, vPrice;
|
FETCH cRows INTO vRowId, vItem, vConcept, vAmount, vPrice, vRate, vIsLogifloraItem;
|
||||||
|
|
||||||
IF vDone THEN
|
IF vDone THEN
|
||||||
LEAVE lRows;
|
LEAVE lRows;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SELECT s.id INTO vSaleFk
|
SET vSale = NULL;
|
||||||
|
|
||||||
|
SELECT s.id, s.quantity INTO vSale, vOldQuantity
|
||||||
FROM vn.sale s
|
FROM vn.sale s
|
||||||
WHERE ticketFk = vTicketFk
|
WHERE ticketFk = vTicket
|
||||||
AND price = vPrice
|
AND price = vPrice
|
||||||
AND itemFk = vItemFk
|
AND itemFk = vItem
|
||||||
AND discount = 0
|
AND discount = 0
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
|
|
||||||
IF vSaleFk THEN
|
IF vSale THEN
|
||||||
UPDATE vn.sale
|
UPDATE vn.sale
|
||||||
SET quantity = quantity + vAmount,
|
SET quantity = quantity + vAmount,
|
||||||
originalQuantity = quantity
|
originalQuantity = quantity
|
||||||
WHERE id = vSaleFk;
|
WHERE id = vSale;
|
||||||
|
|
||||||
|
SELECT s.quantity INTO vNewQuantity
|
||||||
|
FROM vn.sale s
|
||||||
|
WHERE id = vSale;
|
||||||
ELSE
|
ELSE
|
||||||
-- Obtiene el coste
|
-- Obtiene el coste
|
||||||
SELECT SUM(rc.`price`) valueSum INTO vPriceFixed
|
SELECT SUM(rc.`price`) valueSum INTO vPriceFixed
|
||||||
FROM orderRowComponent rc
|
FROM orderRowComponent rc
|
||||||
JOIN vn.component c ON c.id = rc.componentFk
|
JOIN vn.component c ON c.id = rc.componentFk
|
||||||
JOIN vn.componentType ct ON ct.id = c.typeFk
|
JOIN vn.componentType ct ON ct.id = c.typeFk AND ct.isBase
|
||||||
AND ct.isBase
|
WHERE rc.rowFk = vRowId;
|
||||||
WHERE rc.rowFk = vRowFk;
|
|
||||||
|
|
||||||
INSERT INTO vn.sale
|
INSERT INTO vn.sale
|
||||||
SET itemFk = vItemFk,
|
SET itemFk = vItem,
|
||||||
ticketFk = vTicketFk,
|
ticketFk = vTicket,
|
||||||
concept = vConcept,
|
concept = vConcept,
|
||||||
quantity = vAmount,
|
quantity = vAmount,
|
||||||
price = vPrice,
|
price = vPrice,
|
||||||
priceFixed = vPriceFixed,
|
priceFixed = vPriceFixed,
|
||||||
isPriceFixed = TRUE;
|
isPriceFixed = TRUE;
|
||||||
|
|
||||||
SET vSaleFk = LAST_INSERT_ID();
|
SET vSale = LAST_INSERT_ID();
|
||||||
|
|
||||||
INSERT INTO vn.saleComponent (saleFk, componentFk, `value`)
|
INSERT INTO vn.saleComponent
|
||||||
SELECT vSaleFk, rc.componentFk, rc.price
|
(saleFk, componentFk, `value`)
|
||||||
|
SELECT vSale, rc.componentFk, rc.price
|
||||||
FROM orderRowComponent rc
|
FROM orderRowComponent rc
|
||||||
JOIN vn.component c ON c.id = rc.componentFk
|
JOIN vn.component c ON c.id = rc.componentFk
|
||||||
WHERE rc.rowFk = vRowFk
|
WHERE rc.rowFk = vRowId
|
||||||
GROUP BY vSaleFk, rc.componentFk;
|
GROUP BY vSale, rc.componentFk;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
UPDATE orderRow
|
UPDATE order_row SET Id_Movimiento = vSale
|
||||||
SET saleFk = vSaleFk
|
WHERE id = vRowId;
|
||||||
WHERE id = vRowFk;
|
|
||||||
END LOOP;
|
|
||||||
CLOSE vRows;
|
|
||||||
END LOOP;
|
|
||||||
CLOSE vDates;
|
|
||||||
|
|
||||||
UPDATE `order`
|
-- Inserta en putOrder si la compra es de Floramondo
|
||||||
SET confirmed = TRUE,
|
IF vIsLogifloraItem THEN
|
||||||
confirm_date = util.VN_NOW()
|
CALL cache.availableNoRaids_refresh(vCalc,FALSE,vWarehouse,vShipment);
|
||||||
|
|
||||||
|
SET @available := 0;
|
||||||
|
|
||||||
|
SELECT GREATEST(0,available) INTO @available
|
||||||
|
FROM cache.availableNoRaids
|
||||||
|
WHERE calc_id = vCalc
|
||||||
|
AND item_id = vItem;
|
||||||
|
|
||||||
|
UPDATE cache.availableNoRaids
|
||||||
|
SET available = GREATEST(0,available - vAmount)
|
||||||
|
WHERE item_id = vItem
|
||||||
|
AND calc_id = vCalc;
|
||||||
|
|
||||||
|
INSERT INTO edi.putOrder (
|
||||||
|
deliveryInformationID,
|
||||||
|
supplyResponseId,
|
||||||
|
quantity ,
|
||||||
|
EndUserPartyId,
|
||||||
|
EndUserPartyGLN,
|
||||||
|
FHAdminNumber,
|
||||||
|
saleFk
|
||||||
|
)
|
||||||
|
SELECT di.ID,
|
||||||
|
i.supplyResponseFk,
|
||||||
|
CEIL((vAmount - @available)/ sr.NumberOfItemsPerCask),
|
||||||
|
o.address_id ,
|
||||||
|
vClientId,
|
||||||
|
IFNULL(ca.fhAdminNumber, fhc.defaultAdminNumber),
|
||||||
|
vSale
|
||||||
|
FROM edi.deliveryInformation di
|
||||||
|
JOIN vn.item i ON i.supplyResponseFk = di.supplyResponseID
|
||||||
|
JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk
|
||||||
|
LEFT JOIN edi.clientFHAdminNumber ca ON ca.clientFk = vClientId
|
||||||
|
JOIN edi.floraHollandConfig fhc
|
||||||
|
JOIN hedera.`order` o ON o.id = vSelf
|
||||||
|
WHERE i.id = vItem
|
||||||
|
AND di.LatestOrderDateTime > util.VN_NOW()
|
||||||
|
AND vAmount > @available
|
||||||
|
LIMIT 1;
|
||||||
|
END IF;
|
||||||
|
END LOOP;
|
||||||
|
|
||||||
|
CLOSE cRows;
|
||||||
|
END LOOP;
|
||||||
|
|
||||||
|
CLOSE cDates;
|
||||||
|
|
||||||
|
UPDATE `order` SET confirmed = TRUE, confirm_date = util.VN_NOW()
|
||||||
WHERE id = vSelf;
|
WHERE id = vSelf;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
|
@ -9,54 +9,45 @@ BEGIN
|
||||||
* @param vOrder El identificador del pedido
|
* @param vOrder El identificador del pedido
|
||||||
* @return tmp.orderTax Bases imponibles, IVA y recargo de equivalencia
|
* @return tmp.orderTax Bases imponibles, IVA y recargo de equivalencia
|
||||||
*/
|
*/
|
||||||
-- No poner create or replace, ya que da problemas
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany;
|
DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany;
|
||||||
CREATE TEMPORARY TABLE tmp.addressCompany
|
CREATE TEMPORARY TABLE tmp.addressCompany
|
||||||
(INDEX (addressFk, companyFk))
|
(INDEX (addressFk, companyFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT DISTINCT o.address_id addressFk, o.company_id companyFk
|
SELECT DISTINCT o.address_id addressFk, o.company_id companyFk
|
||||||
FROM tmp.`order` tmpOrder
|
FROM tmp.`order` tmpOrder
|
||||||
JOIN `order` o ON o.id = tmpOrder.orderFk;
|
JOIN hedera.`order` o ON o.id = tmpOrder.orderFk;
|
||||||
|
|
||||||
CALL vn.addressTaxArea();
|
CALL vn.addressTaxArea;
|
||||||
|
|
||||||
-- Calcula el IVA y el recargo desglosado.
|
-- Calcula el IVA y el recargo desglosado.
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.orderTax
|
|
||||||
(PRIMARY KEY (orderFk, code, rate))
|
DROP TEMPORARY TABLE IF EXISTS tmp.orderTax;
|
||||||
|
CREATE TEMPORARY TABLE tmp.orderTax
|
||||||
|
(INDEX (orderFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
WITH orders AS (
|
SELECT o.id orderFk,
|
||||||
SELECT tor.orderFk,
|
|
||||||
oro.amount * oro.price total,
|
|
||||||
s.countryFk,
|
|
||||||
ata.areaFk,
|
|
||||||
itc.taxClassFk
|
|
||||||
FROM hedera.orderRow oro
|
|
||||||
JOIN tmp.order tor ON tor.orderFk = oro.orderFk
|
|
||||||
JOIN hedera.`order` o ON o.id = tor.orderFk
|
|
||||||
JOIN vn.item i ON i.id = oro.itemFk
|
|
||||||
JOIN vn.`client` c ON c.id = o.customer_id
|
|
||||||
JOIN vn.supplier s ON s.id = o.company_id
|
|
||||||
JOIN tmp.addressTaxArea ata ON ata.addressFk = o.address_id
|
|
||||||
AND ata.companyFk = o.company_id
|
|
||||||
JOIN vn.itemTaxCountry itc ON itc.itemFk = i.id
|
|
||||||
AND itc.countryFk = s.countryFk
|
|
||||||
HAVING total
|
|
||||||
)
|
|
||||||
SELECT o.orderFk,
|
|
||||||
tc.code,
|
tc.code,
|
||||||
SUM(o.total) taxableBase,
|
SUM(m.amount * m.price) taxableBase,
|
||||||
pgc.rate
|
pgc.rate
|
||||||
FROM orders o
|
FROM tmp.`order` tmpOrder
|
||||||
JOIN vn.bookingPlanner bp ON bp.countryFk = o.countryFk
|
JOIN `order` o ON o.id = tmpOrder.orderFk
|
||||||
AND bp.taxAreaFk = o.areaFk
|
JOIN orderRow m ON m.orderFk = o.id
|
||||||
AND bp.taxClassFk = o.taxClassFk
|
JOIN vn.item i ON i.id = m.itemFk
|
||||||
JOIN vn.pgc ON pgc.code = bp.pgcFk
|
JOIN vn.`client` c ON c.id = o.customer_id
|
||||||
|
JOIN vn.supplier s ON s.id = o.company_id
|
||||||
|
JOIN tmp.addressTaxArea ata
|
||||||
|
ON ata.addressFk = o.address_id AND ata.companyFk = o.company_id
|
||||||
|
JOIN vn.itemTaxCountry itc
|
||||||
|
ON itc.itemFk = i.id AND itc.countryFk = s.countryFk
|
||||||
|
JOIN vn.bookingPlanner bp
|
||||||
|
ON bp.countryFk = s.countryFk
|
||||||
|
AND bp.taxAreaFk = ata.areaFk
|
||||||
|
AND bp.taxClassFk = itc.taxClassFk
|
||||||
|
JOIN vn.pgc ON pgc.`code` = bp.pgcFk
|
||||||
JOIN vn.taxClass tc ON tc.id = bp.taxClassFk
|
JOIN vn.taxClass tc ON tc.id = bp.taxClassFk
|
||||||
GROUP BY o.orderFk, pgc.code, pgc.rate
|
GROUP BY tmpOrder.orderFk, pgc.`code`, pgc.rate
|
||||||
HAVING taxableBase
|
HAVING taxableBase != 0;
|
||||||
ORDER BY bp.priority;
|
|
||||||
|
|
||||||
-- No poner create or replace, ya que da problemas
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.orderAmount;
|
DROP TEMPORARY TABLE IF EXISTS tmp.orderAmount;
|
||||||
CREATE TEMPORARY TABLE tmp.orderAmount
|
CREATE TEMPORARY TABLE tmp.orderAmount
|
||||||
(INDEX (orderFk))
|
(INDEX (orderFk))
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `hedera`.`orderRow_afterInsert`
|
|
||||||
AFTER INSERT ON `orderRow`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
UPDATE `order`
|
|
||||||
SET rowUpdated = util.VN_NOW()
|
|
||||||
WHERE id = NEW.orderFk;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -26,7 +26,7 @@ BEGIN
|
||||||
|
|
||||||
DECLARE vCursor CURSOR FOR
|
DECLARE vCursor CURSOR FOR
|
||||||
SELECT it.taxableBase,
|
SELECT it.taxableBase,
|
||||||
CAST(SUM((( it.taxableBase / 100) * t.PorcentajeIva)) AS DECIMAL (10,2)),
|
CAST((( it.taxableBase / 100) * t.PorcentajeIva) AS DECIMAL (10,2)),
|
||||||
t.PorcentajeIva,
|
t.PorcentajeIva,
|
||||||
it.transactionTypeSageFk,
|
it.transactionTypeSageFk,
|
||||||
it.taxTypeSageFk,
|
it.taxTypeSageFk,
|
||||||
|
@ -39,8 +39,7 @@ BEGIN
|
||||||
JOIN TiposTransacciones tt ON tt.CodigoTransaccion = it.transactionTypeSageFk
|
JOIN TiposTransacciones tt ON tt.CodigoTransaccion = it.transactionTypeSageFk
|
||||||
LEFT JOIN vn.dua d ON d.id = vInvoiceInFk
|
LEFT JOIN vn.dua d ON d.id = vInvoiceInFk
|
||||||
WHERE i.id = vInvoiceInFk
|
WHERE i.id = vInvoiceInFk
|
||||||
AND d.id IS NULL
|
AND d.id IS NULL;
|
||||||
GROUP BY it.taxTypeSageFk;
|
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `salix`.`ACL_afterDelete`
|
|
||||||
AFTER DELETE ON `ACL`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO ACLLog
|
|
||||||
SET `action` = 'delete',
|
|
||||||
`changedModel` = 'Acl',
|
|
||||||
`changedModelId` = OLD.id,
|
|
||||||
`userFk` = account.myUser_getId();
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,11 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `salix`.`ACL_beforeInsert`
|
|
||||||
BEFORE INSERT ON `ACL`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
|
||||||
IF NEW.`property` = '*' THEN
|
|
||||||
CALL util.throw('The property field cannot be *');
|
|
||||||
END IF;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,8 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `salix`.`ACL_beforeUpdate`
|
|
||||||
BEFORE UPDATE ON `ACL`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,9 +1,13 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `srt`.`moving_clean`
|
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `srt`.`moving_clean`
|
||||||
ON SCHEDULE EVERY 15 MINUTE
|
ON SCHEDULE EVERY 5 MINUTE
|
||||||
STARTS '2022-01-21 00:00:00.000'
|
STARTS '2022-01-21 00:00:00.000'
|
||||||
ON COMPLETION PRESERVE
|
ON COMPLETION PRESERVE
|
||||||
ENABLE
|
ENABLE
|
||||||
COMMENT 'Llama a srt.moving_clean para que elimine y notifique de registr'
|
COMMENT 'Llama a srt.moving_clean para que elimine y notifique de registr'
|
||||||
DO CALL srt.moving_clean()$$
|
DO BEGIN
|
||||||
|
|
||||||
|
CALL srt.moving_clean();
|
||||||
|
|
||||||
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -3,69 +3,61 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `srt`.`moving_clean`()
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Elimina movimientos por inactividad
|
* Elimina movimientos por inactividad
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
DECLARE vExpeditionFk INT;
|
DECLARE vExpeditionFk INT;
|
||||||
|
DECLARE vBufferToFk INT;
|
||||||
DECLARE vBufferFromFk INT;
|
DECLARE vBufferFromFk INT;
|
||||||
DECLARE vStateOutFk INT
|
DECLARE done BOOL DEFAULT FALSE;
|
||||||
DEFAULT (SELECT id FROM expeditionState WHERE `description` = 'OUT');
|
|
||||||
DECLARE vDone BOOL;
|
DECLARE cur CURSOR FOR
|
||||||
DECLARE vSorter CURSOR FOR
|
SELECT m.expeditionFk, m.bufferToFk, m.bufferFromFk
|
||||||
SELECT m.expeditionFk, m.bufferFromFk
|
FROM srt.moving m
|
||||||
FROM moving m
|
JOIN srt.config c
|
||||||
JOIN (
|
JOIN (SELECT bufferFk, SUM(isActive) hasBox
|
||||||
SELECT bufferFk, SUM(isActive) hasBox
|
FROM srt.photocell
|
||||||
FROM photocell
|
GROUP BY bufferFk) sub ON sub.bufferFk = m.bufferFromFk
|
||||||
GROUP BY bufferFk
|
WHERE m.created < TIMESTAMPADD(MINUTE, - c.movingMaxLife , util.VN_NOW())
|
||||||
) sub ON sub.bufferFk = m.bufferFromFk
|
|
||||||
WHERE m.created < (util.VN_NOW() - INTERVAL (SELECT movingMaxLife FROM config) MINUTE)
|
|
||||||
AND NOT sub.hasBox;
|
AND NOT sub.hasBox;
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
|
||||||
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
OPEN cur;
|
||||||
BEGIN
|
|
||||||
ROLLBACK;
|
|
||||||
RESIGNAL;
|
|
||||||
END;
|
|
||||||
|
|
||||||
OPEN vSorter;
|
bucle: LOOP
|
||||||
l: LOOP
|
|
||||||
SET vDone = FALSE;
|
|
||||||
FETCH vSorter INTO vExpeditionFk, vBufferFromFk;
|
|
||||||
|
|
||||||
IF vDone THEN
|
FETCH cur INTO vExpeditionFk, vBufferToFk, vBufferFromFk;
|
||||||
LEAVE l;
|
|
||||||
|
IF done THEN
|
||||||
|
LEAVE bucle;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
START TRANSACTION;
|
DELETE FROM srt.moving
|
||||||
|
|
||||||
SELECT id
|
|
||||||
FROM moving
|
|
||||||
WHERE expeditionFk = vExpeditionFk
|
|
||||||
FOR UPDATE;
|
|
||||||
|
|
||||||
DELETE FROM moving
|
|
||||||
WHERE expeditionFk = vExpeditionFk;
|
WHERE expeditionFk = vExpeditionFk;
|
||||||
|
|
||||||
SELECT id
|
UPDATE srt.expedition e
|
||||||
FROM expedition
|
JOIN srt.expeditionState es ON es.description = 'OUT'
|
||||||
WHERE id = vExpeditionFk
|
SET
|
||||||
OR (bufferFk = vBufferFromFk AND `position` > 0)
|
bufferFk = NULL,
|
||||||
FOR UPDATE;
|
|
||||||
|
|
||||||
UPDATE expedition
|
|
||||||
SET bufferFk = NULL,
|
|
||||||
`position` = NULL,
|
`position` = NULL,
|
||||||
stateFk = vStateOutFk
|
stateFk = es.id
|
||||||
WHERE id = vExpeditionFk;
|
WHERE e.id = vExpeditionFk;
|
||||||
|
|
||||||
UPDATE expedition
|
UPDATE srt.expedition e
|
||||||
SET `position` = `position` - 1
|
SET e.`position` = e.`position` - 1
|
||||||
WHERE bufferFk = vBufferFromFk
|
WHERE e.bufferFk = vBufferFromFk
|
||||||
AND `position` > 0;
|
AND e.`position` > 0;
|
||||||
|
|
||||||
|
CALL vn.mail_insert(
|
||||||
|
'pako@verdnatura.es, carles@verdnatura.es',
|
||||||
|
NULL,
|
||||||
|
CONCAT('Moving_clean. Expedition: ', vExpeditionFk, ' estaba parada'),
|
||||||
|
CONCAT('Expedition: ', vExpeditionFk,' vBufferToFk: ', vBufferToFk)
|
||||||
|
);
|
||||||
|
|
||||||
|
END LOOP bucle;
|
||||||
|
|
||||||
|
CLOSE cur;
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
END LOOP l;
|
|
||||||
CLOSE vSorter;
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `srt`.`buffer_afterDelete`
|
|
||||||
AFTER DELETE ON `buffer`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO buffer
|
|
||||||
SET `action` = 'delete',
|
|
||||||
`changedModel` = 'Buffer',
|
|
||||||
`changedModelId` = OLD.id,
|
|
||||||
`userFk` = account.myUser_getId();
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,8 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `srt`.`buffer_beforeInsert`
|
|
||||||
BEFORE INSERT ON `buffer`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,8 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `srt`.`buffer_beforeUpdate`
|
|
||||||
BEFORE UPDATE ON `buffer`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,12 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `srt`.`config_afterDelete`
|
|
||||||
AFTER DELETE ON `config`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO config
|
|
||||||
SET `action` = 'delete',
|
|
||||||
`changedModel` = 'Config',
|
|
||||||
`changedModelId` = OLD.id,
|
|
||||||
`userFk` = account.myUser_getId();
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,8 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `srt`.`config_beforeInsert`
|
|
||||||
BEFORE INSERT ON `config`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,8 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `srt`.`config_beforeUpdate`
|
|
||||||
BEFORE UPDATE ON `config`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -6,11 +6,12 @@ BEGIN
|
||||||
DROP TEMPORARY TABLE IF EXISTS tValues;
|
DROP TEMPORARY TABLE IF EXISTS tValues;
|
||||||
CREATE TEMPORARY TABLE tValues
|
CREATE TEMPORARY TABLE tValues
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT b.id buyFk,
|
SELECT
|
||||||
|
b.id buyFk,
|
||||||
e.id entryFk,
|
e.id entryFk,
|
||||||
t.id travelFk,
|
t.id travelFk,
|
||||||
b.itemFk,
|
b.itemFk,
|
||||||
t.isRaid,
|
e.isRaid,
|
||||||
ADDTIME(t.shipped,
|
ADDTIME(t.shipped,
|
||||||
IFNULL(t.shipmentHour, '00:00:00')) shipped,
|
IFNULL(t.shipmentHour, '00:00:00')) shipped,
|
||||||
t.warehouseOutFk,
|
t.warehouseOutFk,
|
||||||
|
@ -49,7 +50,7 @@ BEGIN
|
||||||
itemFk,
|
itemFk,
|
||||||
TIMESTAMPADD(DAY, life, @dated),
|
TIMESTAMPADD(DAY, life, @dated),
|
||||||
quantity,
|
quantity,
|
||||||
IF(isIn, isReceived, isDelivered) AND NOT isRaid
|
IF(isIn, isReceived, isDelivered) AND !isRaid
|
||||||
FROM tValues
|
FROM tValues
|
||||||
WHERE isIn OR !lessThanInventory;
|
WHERE isIn OR !lessThanInventory;
|
||||||
|
|
||||||
|
@ -64,7 +65,7 @@ BEGIN
|
||||||
itemFk,
|
itemFk,
|
||||||
created,
|
created,
|
||||||
quantity,
|
quantity,
|
||||||
IF(isIn, isDelivered, isReceived) AND NOT isRaid
|
IF(isIn, isDelivered, isReceived) AND !isRaid
|
||||||
FROM tValues
|
FROM tValues
|
||||||
WHERE !isIn OR !lessThanInventory;
|
WHERE !isIn OR !lessThanInventory;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `util`.`log_clean`
|
|
||||||
ON SCHEDULE EVERY 1 DAY
|
|
||||||
STARTS '2024-07-09 00:30:00.000'
|
|
||||||
ON COMPLETION PRESERVE
|
|
||||||
ENABLE
|
|
||||||
DO CALL util.log_clean$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,54 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`log_clean`()
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Hace limpieza de los datos de las tablas log,
|
|
||||||
* dejando únicamente los días de retención configurados.
|
|
||||||
*/
|
|
||||||
DECLARE vSchemaName VARCHAR(65);
|
|
||||||
DECLARE vSchemaNameQuoted VARCHAR(65);
|
|
||||||
DECLARE vTableName VARCHAR(65);
|
|
||||||
DECLARE vTableNameQuoted VARCHAR(65);
|
|
||||||
DECLARE vRetentionDays INT;
|
|
||||||
DECLARE vStarted DATETIME;
|
|
||||||
DECLARE vDated DATE;
|
|
||||||
DECLARE vDone BOOL;
|
|
||||||
|
|
||||||
DECLARE vQueue CURSOR FOR
|
|
||||||
SELECT schemaName, tableName, retentionDays
|
|
||||||
FROM logCleanMultiConfig
|
|
||||||
ORDER BY `order`;
|
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
|
||||||
|
|
||||||
OPEN vQueue;
|
|
||||||
l: LOOP
|
|
||||||
SET vDone = FALSE;
|
|
||||||
FETCH vQueue INTO vSchemaName, vTableName, vRetentionDays;
|
|
||||||
|
|
||||||
IF vDone THEN
|
|
||||||
LEAVE l;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF vRetentionDays THEN
|
|
||||||
SET vStarted = VN_NOW();
|
|
||||||
SET vSchemaNameQuoted = quoteIdentifier(vSchemaName);
|
|
||||||
SET vTableNameQuoted = quoteIdentifier(vTableName);
|
|
||||||
SET vDated = VN_CURDATE() - INTERVAL vRetentionDays DAY;
|
|
||||||
|
|
||||||
EXECUTE IMMEDIATE CONCAT(
|
|
||||||
'DELETE FROM ', vSchemaNameQuoted,
|
|
||||||
'.', vTableNameQuoted,
|
|
||||||
" WHERE creationDate < '", vDated, "'"
|
|
||||||
);
|
|
||||||
|
|
||||||
UPDATE logCleanMultiConfig
|
|
||||||
SET `started` = vStarted,
|
|
||||||
`finished` = VN_NOW()
|
|
||||||
WHERE schemaName = vSchemaName
|
|
||||||
AND tableName = vTableName;
|
|
||||||
END IF;
|
|
||||||
END LOOP;
|
|
||||||
CLOSE vQueue;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`claim_changeState`
|
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`claim_changeState`
|
||||||
ON SCHEDULE EVERY 1 DAY
|
ON SCHEDULE EVERY 1 DAY
|
||||||
STARTS '2024-06-06 07:52:46.000'
|
STARTS '2024-06-06 07:52:46.000'
|
||||||
ON COMPLETION PRESERVE
|
ON COMPLETION PRESERVE
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`client_unassignSalesPerson`
|
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`client_unassignSalesPerson`
|
||||||
ON SCHEDULE EVERY 1 DAY
|
ON SCHEDULE EVERY 1 DAY
|
||||||
STARTS '2023-06-01 03:30:00.000'
|
STARTS '2023-06-01 03:30:00.000'
|
||||||
ON COMPLETION PRESERVE
|
ON COMPLETION PRESERVE
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue