Merge branch 'dev' into 3552-monitor_ticket_state
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
e9189509c2
|
@ -0,0 +1,3 @@
|
||||||
|
UPDATE salix.defaultViewConfig
|
||||||
|
SET `columns`='{"intrastat":false,"stemMultiplier":false,"landed":false,"producer":false}'
|
||||||
|
WHERE tableCode ='itemsIndex';
|
|
@ -94,7 +94,7 @@ describe('Ticket Edit basic data path', () => {
|
||||||
it(`should split ticket without negatives`, async() => {
|
it(`should split ticket without negatives`, async() => {
|
||||||
const newAgency = 'Silla247';
|
const newAgency = 'Silla247';
|
||||||
const newDate = new Date();
|
const newDate = new Date();
|
||||||
newDate.setDate(newDate.getDate() + 1);
|
newDate.setDate(newDate.getDate() - 1);
|
||||||
|
|
||||||
await page.accessToSearchResult('14');
|
await page.accessToSearchResult('14');
|
||||||
await page.accessToSection('ticket.card.basicData.stepOne');
|
await page.accessToSection('ticket.card.basicData.stepOne');
|
||||||
|
|
|
@ -82,6 +82,7 @@ module.exports = Self => {
|
||||||
Self.filter = async(ctx, filter, options) => {
|
Self.filter = async(ctx, filter, options) => {
|
||||||
const conn = Self.dataSource.connector;
|
const conn = Self.dataSource.connector;
|
||||||
const myOptions = {};
|
const myOptions = {};
|
||||||
|
let to;
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
@ -109,7 +110,11 @@ module.exports = Self => {
|
||||||
case 'attenderFk':
|
case 'attenderFk':
|
||||||
return {'cl.workerFk': value};
|
return {'cl.workerFk': value};
|
||||||
case 'created':
|
case 'created':
|
||||||
return {'cl.created': value};
|
value.setHours(0, 0, 0, 0);
|
||||||
|
to = new Date(value);
|
||||||
|
to.setHours(23, 59, 59, 999);
|
||||||
|
|
||||||
|
return {'cl.created': {between: [value, to]}};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -161,6 +161,7 @@ module.exports = Self => {
|
||||||
i.stemMultiplier,
|
i.stemMultiplier,
|
||||||
i.typeFk,
|
i.typeFk,
|
||||||
i.isFloramondo,
|
i.isFloramondo,
|
||||||
|
pr.name AS producer,
|
||||||
it.name AS typeName,
|
it.name AS typeName,
|
||||||
it.workerFk AS buyerFk,
|
it.workerFk AS buyerFk,
|
||||||
u.name AS userName,
|
u.name AS userName,
|
||||||
|
|
|
@ -54,6 +54,9 @@
|
||||||
<th field="active">
|
<th field="active">
|
||||||
<span translate>Active</span>
|
<span translate>Active</span>
|
||||||
</th>
|
</th>
|
||||||
|
<th field="producer">
|
||||||
|
<span translate>Producer</span>
|
||||||
|
</th>
|
||||||
<th field="landed">
|
<th field="landed">
|
||||||
<span translate>Landed</span>
|
<span translate>Landed</span>
|
||||||
</th>
|
</th>
|
||||||
|
@ -122,6 +125,7 @@
|
||||||
ng-model="::item.isActive">
|
ng-model="::item.isActive">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</td>
|
</td>
|
||||||
|
<td>{{::item.producer | dashIfEmpty}}</td>
|
||||||
<td shrink-date>{{::item.landed | date:'dd/MM/yyyy'}}</td>
|
<td shrink-date>{{::item.landed | date:'dd/MM/yyyy'}}</td>
|
||||||
<td>
|
<td>
|
||||||
<vn-horizontal class="buttons">
|
<vn-horizontal class="buttons">
|
||||||
|
|
|
@ -81,6 +81,8 @@ class Controller extends Section {
|
||||||
return {'intr.description': value};
|
return {'intr.description': value};
|
||||||
case 'name':
|
case 'name':
|
||||||
return {'i.name': {like: `%${value}%`}};
|
return {'i.name': {like: `%${value}%`}};
|
||||||
|
case 'producer':
|
||||||
|
return {'pr.name': {like: `%${value}%`}};
|
||||||
case 'id':
|
case 'id':
|
||||||
case 'size':
|
case 'size':
|
||||||
case 'subname':
|
case 'subname':
|
||||||
|
|
|
@ -133,6 +133,10 @@ module.exports = Self => {
|
||||||
|
|
||||||
const where = buildFilter(ctx.args, (param, value) => {
|
const where = buildFilter(ctx.args, (param, value) => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
|
case 'search':
|
||||||
|
return /^\d+$/.test(value)
|
||||||
|
? {'t.id': {inq: value}}
|
||||||
|
: {'t.nickname': {like: `%${value}%`}};
|
||||||
case 'from':
|
case 'from':
|
||||||
return {'t.shipped': {gte: value}};
|
return {'t.shipped': {gte: value}};
|
||||||
case 'to':
|
case 'to':
|
||||||
|
|
|
@ -138,7 +138,8 @@ module.exports = Self => {
|
||||||
const params = [args.id, args.shipped, args.warehouseFk];
|
const params = [args.id, args.shipped, args.warehouseFk];
|
||||||
const [salesMovable] = await Self.rawSql(query, params, myOptions);
|
const [salesMovable] = await Self.rawSql(query, params, myOptions);
|
||||||
|
|
||||||
const salesNewTicket = salesMovable.filter(sale => (sale.movable ?? 0) >= sale.quantity);
|
const salesNewTicket = salesMovable.filter(sale => (sale.movable ? sale.movable : 0) >= sale.quantity);
|
||||||
|
|
||||||
if (salesNewTicket.length) {
|
if (salesNewTicket.length) {
|
||||||
const newTicket = await models.Ticket.transferSales(ctx, args.id, null, salesNewTicket, myOptions);
|
const newTicket = await models.Ticket.transferSales(ctx, args.id, null, salesNewTicket, myOptions);
|
||||||
args.id = newTicket.id;
|
args.id = newTicket.id;
|
||||||
|
@ -250,7 +251,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
res.id = args.id;
|
res.id = args.id;
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (tx) await tx.rollback();
|
if (tx) await tx.rollback();
|
||||||
|
|
|
@ -112,9 +112,9 @@ module.exports = Self => {
|
||||||
|
|
||||||
// Get items movable
|
// Get items movable
|
||||||
const ticketOrigin = await models.Ticket.findById(args.id, null, myOptions);
|
const ticketOrigin = await models.Ticket.findById(args.id, null, myOptions);
|
||||||
const differenceShipped = ticketOrigin.shipped.getTime() != args.shipped.getTime();
|
const differenceShipped = ticketOrigin.shipped.getTime() > args.shipped.getTime();
|
||||||
const differenceWarehouse = ticketOrigin.warehouseFk != args.warehouseId;
|
const differenceWarehouse = ticketOrigin.warehouseFk != args.warehouseId;
|
||||||
|
|
||||||
salesObj.haveDifferences = differenceShipped || differenceWarehouse;
|
salesObj.haveDifferences = differenceShipped || differenceWarehouse;
|
||||||
|
|
||||||
let query = `CALL ticket_getMovable(?,?,?)`;
|
let query = `CALL ticket_getMovable(?,?,?)`;
|
||||||
|
@ -122,8 +122,10 @@ module.exports = Self => {
|
||||||
const [salesMovable] = await Self.rawSql(query, params, myOptions);
|
const [salesMovable] = await Self.rawSql(query, params, myOptions);
|
||||||
|
|
||||||
const itemMovable = new Map();
|
const itemMovable = new Map();
|
||||||
for (sale of salesMovable)
|
for (sale of salesMovable) {
|
||||||
itemMovable.set(sale.id, sale.movable ?? 0);
|
const saleMovable = sale.movable ? sale.movable : 0;
|
||||||
|
itemMovable.set(sale.id, saleMovable);
|
||||||
|
}
|
||||||
|
|
||||||
// Sale price component, one per sale
|
// Sale price component, one per sale
|
||||||
query = `CALL vn.ticket_priceDifference(?, ?, ?, ?, ?)`;
|
query = `CALL vn.ticket_priceDifference(?, ?, ?, ?, ?)`;
|
||||||
|
@ -152,7 +154,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
|
|
||||||
return salesObj;
|
return salesObj;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (tx) await tx.rollback();
|
if (tx) await tx.rollback();
|
||||||
|
|
Loading…
Reference in New Issue