Merge branch 'dev' of https://git.verdnatura.es/salix into dev

* 'dev' of https://git.verdnatura.es/salix:
  service Production: bugs
This commit is contained in:
Carlos 2017-11-06 14:56:39 +01:00
commit 736d4f804e
11 changed files with 97 additions and 43 deletions

View File

@ -1,5 +1,4 @@
import ngModule from '../module';
import './style.css';
export default class Controller {
constructor($scope, $http) {

View File

@ -1,3 +0,0 @@
.descriptor-icon{
font-size:60px;
}

View File

@ -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', {

View File

@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 48 48" version="1.1" width="528" height="528">
<g id="surface1">
<path style=" fill:#1C9957;" d="M 42 39 L 42 9 C 42 7.34375 40.65625 6 39 6 L 9 6 C 7.34375 6 6 7.34375 6 9 L 6 39 C 6 40.65625 7.34375 42 9 42 L 39 42 C 40.65625 42 42 40.65625 42 39 Z "/>
<path style=" fill:#3E7BF1;" d="M 9 42 L 39 42 C 40.65625 42 24 26 24 26 C 24 26 7.34375 42 9 42 Z "/>
<path style=" fill:#CBCCC9;" d="M 42 39 L 42 9 C 42 7.34375 26 24 26 24 C 26 24 42 40.65625 42 39 Z "/>
<path style=" fill:#EFEFEF;" d="M 39 42 C 40.65625 42 42 40.65625 42 39 L 42 38.753906 L 26.246094 23 L 23 26.246094 L 38.753906 42 Z "/>
<path style=" fill:#FFD73D;" d="M 42 9 C 42 7.34375 40.65625 6 39 6 L 38.753906 6 L 6 38.753906 L 6 39 C 6 40.65625 7.34375 42 9 42 L 9.246094 42 L 42 9.246094 Z "/>
<path style=" fill:#D73F35;" d="M 36 2 C 30.476563 2 26 6.476563 26 12 C 26 18.8125 33.664063 21.296875 35.332031 31.851563 C 35.441406 32.53125 35.449219 33 36 33 C 36.550781 33 36.558594 32.53125 36.667969 31.851563 C 38.335938 21.296875 46 18.8125 46 12 C 46 6.476563 41.523438 2 36 2 Z "/>
<path style=" fill:#752622;" d="M 39.5 12 C 39.5 13.933594 37.933594 15.5 36 15.5 C 34.066406 15.5 32.5 13.933594 32.5 12 C 32.5 10.066406 34.066406 8.5 36 8.5 C 37.933594 8.5 39.5 10.066406 39.5 12 Z "/>
<path style=" fill:#FFFFFF;" d="M 14.492188 12.53125 L 14.492188 14.632813 L 17.488281 14.632813 C 17.09375 15.90625 16.03125 16.816406 14.492188 16.816406 C 12.660156 16.816406 11.175781 15.332031 11.175781 13.5 C 11.175781 11.664063 12.660156 10.179688 14.492188 10.179688 C 15.316406 10.179688 16.070313 10.484375 16.648438 10.980469 L 18.195313 9.433594 C 17.21875 8.542969 15.921875 8 14.492188 8 C 11.453125 8 8.992188 10.464844 8.992188 13.5 C 8.992188 16.535156 11.453125 19 14.492188 19 C 19.304688 19 20.128906 14.683594 19.675781 12.539063 Z "/>
</g>
</svg>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30.3 26.6" style="enable-background:new 0 0 30.3 26.6;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
.st1{fill:#F7931E;}
</style>
<rect width="30.3" height="26.6"/>
<g>
<path class="st0" d="M24.9,9.7h-3.7v-5H4c-1.4,0-2.5,1.1-2.5,2.5v13.5H4c0,2,1.6,3.7,3.7,3.7s3.7-1.6,3.7-3.7h7.4
c0,2,1.6,3.7,3.7,3.7s3.7-1.6,3.7-3.7h2.5v-6.1L24.9,9.7z M7.7,22.5c-1,0-1.8-0.8-1.8-1.8s0.8-1.8,1.8-1.8s1.8,0.8,1.8,1.8
S8.7,22.5,7.7,22.5z M24.2,11.5l2.4,3.1h-5.5v-3.1H24.2z M22.4,22.5c-1,0-1.8-0.8-1.8-1.8s0.8-1.8,1.8-1.8s1.8,0.8,1.8,1.8
C24.2,21.7,23.4,22.5,22.4,22.5z"/>
<path class="st1" d="M12,7.2c-3,0-5.5,2.5-5.5,5.5S9,18.2,12,18.2s5.5-2.5,5.5-5.5S15,7.2,12,7.2z M14.8,13.3h-2.2v2.2h-1.1v-2.2
H9.3v-1.1h2.2V9.9h1.1v2.2h2.2V13.3z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30.3 26.6" style="enable-background:new 0 0 30.3 26.6;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
.st1{fill:#F7931E;}
</style>
<rect width="30.3" height="26.6"/>
<g>
<path class="st0" d="M24.9,9.7h-3.7V4.7H4c-1.4,0-2.5,1.1-2.5,2.5v13.5H4c0,2,1.6,3.7,3.7,3.7s3.7-1.6,3.7-3.7h7.4
c0,2,1.6,3.7,3.7,3.7s3.7-1.6,3.7-3.7h2.5v-6.1L24.9,9.7z M7.7,22.5c-1,0-1.8-0.8-1.8-1.8c0-1,0.8-1.8,1.8-1.8s1.8,0.8,1.8,1.8
C9.5,21.7,8.7,22.5,7.7,22.5z M24.2,11.5l2.4,3.1h-5.5v-3.1H24.2z M22.4,22.5c-1,0-1.8-0.8-1.8-1.8c0-1,0.8-1.8,1.8-1.8
c1,0,1.8,0.8,1.8,1.8C24.2,21.7,23.4,22.5,22.4,22.5z"/>
<path class="st1" d="M12,7.2c-3,0-5.5,2.5-5.5,5.5s2.5,5.5,5.5,5.5s5.5-2.5,5.5-5.5S15,7.2,12,7.2z M14.7,13.3H9.2v-1.1h5.5V13.3z"
/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -37,4 +37,7 @@ input:disabled, button:disabled {
}
input[type="submit"]:disabled, button:disabled {
opacity: 0.7;
}
.descriptor-icon{
font-size:60px;
}

View File

@ -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;
}
}
}
};
};

View File

@ -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);
});
}
}
};
};

View File

@ -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);
}
};

View File

@ -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);