From e04cda0f35d1d57a4a6b13f5c9703554f0d592a6 Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Tue, 31 Oct 2017 09:26:11 +0100 Subject: [PATCH] service Production: bugs --- client/client/src/descriptor/descriptor.js | 1 - client/client/src/descriptor/style.css | 3 -- client/production/src/index/index.js | 13 ++--- client/route/src/index/googleMaps.svg | 12 +++++ client/route/src/index/routeIn.svg | 18 +++++++ client/route/src/index/routeOut.svg | 18 +++++++ client/salix/src/styles/display.css | 3 ++ .../common/methods/fake-production/list.js | 51 +++++++++++-------- .../common/methods/fake-production/route.js | 10 ++-- .../production/common/methods/state/list.js | 9 ++-- .../production/common/methods/ticket/list.js | 2 +- 11 files changed, 97 insertions(+), 43 deletions(-) delete mode 100644 client/client/src/descriptor/style.css create mode 100644 client/route/src/index/googleMaps.svg create mode 100644 client/route/src/index/routeIn.svg create mode 100644 client/route/src/index/routeOut.svg diff --git a/client/client/src/descriptor/descriptor.js b/client/client/src/descriptor/descriptor.js index ae19d96c4..1311e5858 100644 --- a/client/client/src/descriptor/descriptor.js +++ b/client/client/src/descriptor/descriptor.js @@ -1,5 +1,4 @@ import ngModule from '../module'; -import './style.css'; export default class Controller { constructor($scope, $http) { diff --git a/client/client/src/descriptor/style.css b/client/client/src/descriptor/style.css deleted file mode 100644 index d5f633d8c..000000000 --- a/client/client/src/descriptor/style.css +++ /dev/null @@ -1,3 +0,0 @@ -.descriptor-icon{ - font-size:60px; -} \ No newline at end of file diff --git a/client/production/src/index/index.js b/client/production/src/index/index.js index 9adb6a739..1c8072eb5 100644 --- a/client/production/src/index/index.js +++ b/client/production/src/index/index.js @@ -93,7 +93,6 @@ export default class ProductionIndex { } searchTickets(filter) { this.filter = Object.assign({}, this.filter, filter || {}); - let filters = Object.assign({}, { where: this.filter }, { @@ -115,10 +114,10 @@ export default class ProductionIndex { this.filter.warehouseFk = this.userProfile.warehouseId; this.search = null; } - onChangeWareHouse(item) { - if (item && item.id && item.id != this.filter.warehouseFk) { - this.filter.warehouseFk = item.id; - this.searchTickets(); + onChangeWareHouse(warehouse) { + if (warehouse && warehouse != this.filter.warehouseFk) { + this.filter.warehouseFk = warehouse; + this.searchTickets(this.filter); } } $onInit() { @@ -130,9 +129,11 @@ export default class ProductionIndex { hour += ':00'; this.hourItems.push({id: i, name: hour}); } - this.searchTickets(); + this.filter.warehouseFk = this.$.displayValue = this.userProfile.warehouseId; + this.searchTickets(this.filter); } } + ProductionIndex.$inject = ['$element', '$scope', '$http', 'vnPopover', 'aclConstant']; ngModule.component('vnProductionIndex', { diff --git a/client/route/src/index/googleMaps.svg b/client/route/src/index/googleMaps.svg new file mode 100644 index 000000000..9a7fc59d7 --- /dev/null +++ b/client/route/src/index/googleMaps.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/client/route/src/index/routeIn.svg b/client/route/src/index/routeIn.svg new file mode 100644 index 000000000..dec26dfbf --- /dev/null +++ b/client/route/src/index/routeIn.svg @@ -0,0 +1,18 @@ + + + + + + + + + + diff --git a/client/route/src/index/routeOut.svg b/client/route/src/index/routeOut.svg new file mode 100644 index 000000000..7a69b7786 --- /dev/null +++ b/client/route/src/index/routeOut.svg @@ -0,0 +1,18 @@ + + + + + + + + + + diff --git a/client/salix/src/styles/display.css b/client/salix/src/styles/display.css index 9ead8140d..0a512c090 100644 --- a/client/salix/src/styles/display.css +++ b/client/salix/src/styles/display.css @@ -37,4 +37,7 @@ input:disabled, button:disabled { } input[type="submit"]:disabled, button:disabled { opacity: 0.7; +} +.descriptor-icon{ + font-size:60px; } \ No newline at end of file diff --git a/services/production/common/methods/fake-production/list.js b/services/production/common/methods/fake-production/list.js index 16f139d76..88f777e18 100644 --- a/services/production/common/methods/fake-production/list.js +++ b/services/production/common/methods/fake-production/list.js @@ -1,18 +1,27 @@ -module.exports = function(FakeProduction) { - +module.exports = function(FakeProduction) { FakeProduction.defineScope(); - FakeProduction.list = function(ctx, filter, cb){ - + FakeProduction.list = function(ctx, filter, cb) { var page = filter.page - 1; var limit = filter.limit * page; var offset = (page + 1) * filter.limit; - + let daysTickets = 0; delete filter.limit; delete filter.page; - if(filter.where && filter.where.q){ - var newFilter = { + let query = `call salix.production_control_source( ? , ?)`; + var params = [filter.where.warehouseFk, daysTickets]; + FakeProduction.rawSql(query, params) + .then(function(response) { + getValue(); + }) + .catch(function(response) { + cb(response, null); + }); + let getValue = () => { + + if (filter.where && filter.where.q) { + var newFilter = { and: [ { or: [ @@ -25,23 +34,23 @@ module.exports = function(FakeProduction) { delete filter.where.q; - if(Object.keys(filter.where).length){ + if (Object.keys(filter.where).length) { Object.keys(filter.where).forEach( - key => { - let field = new Object(); + key => { + let field = {}; field[key] = filter.where[key]; newFilter.and.push(field); } ); } - filter.where = newFilter; - } - - FakeProduction.connectToService(ctx, "client"); - this.find(filter, function(err, tickets) { - FakeProduction.disconnectFromService("client"); - (err) ? cb(err, null) : cb(null, (sum(tickets))); - }); + filter.where = newFilter; + } + FakeProduction.connectToService(ctx, "client"); + this.find(filter, function(err, tickets) { + FakeProduction.disconnectFromService("client"); + (err) ? cb(err, null) : cb(null, (sum(tickets))); + }); + }; function sum(tickets){ var obj = {lines: 0, m3: 0}; @@ -54,7 +63,5 @@ module.exports = function(FakeProduction) { obj.tickets = tickets.slice(limit, offset); return obj; } - - } - -} \ No newline at end of file + }; +}; diff --git a/services/production/common/methods/fake-production/route.js b/services/production/common/methods/fake-production/route.js index cd89819d5..e1814e918 100644 --- a/services/production/common/methods/fake-production/route.js +++ b/services/production/common/methods/fake-production/route.js @@ -1,4 +1,5 @@ module.exports = function(FakeProduction) { + FakeProduction.remoteMethodCtx('routeList', { description: 'Route list', returns: { @@ -16,11 +17,12 @@ module.exports = function(FakeProduction) { let query = `call salix.production_control_source(1,1)`; var params = []; FakeProduction.rawSql(query, params, cb) - .then(function(response){ + .then(function(response) { cb(null, response); }) - .catch(function(response){ + .catch(function(response) { cb(response, null); }); - } -} \ No newline at end of file + }; + +}; diff --git a/services/production/common/methods/state/list.js b/services/production/common/methods/state/list.js index 2d999a069..da2c0c9e5 100644 --- a/services/production/common/methods/state/list.js +++ b/services/production/common/methods/state/list.js @@ -1,7 +1,4 @@ -module.exports = function(State) { - - var serverFilter = {where: { "order": {gt: 0 }}, order: "order, name"}; - +module.exports = State => { + var serverFilter = {where: {order: {gt: 0}}, order: "order, name"}; State.defineScope(serverFilter); - -} \ No newline at end of file +}; diff --git a/services/production/common/methods/ticket/list.js b/services/production/common/methods/ticket/list.js index 34178c8c0..0268c6186 100644 --- a/services/production/common/methods/ticket/list.js +++ b/services/production/common/methods/ticket/list.js @@ -25,7 +25,7 @@ module.exports = function(Ticket) { var list = function(){ var params = [1, 0]; - var query = "CALL production_control_source(?, ?)" + var query = 'CALL production_control_source(?, ?)'; var cb = function(error, res) { if (error) console.log(error);