Merge branch 'dev' into 3552-monitor_ticket_state
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2022-02-03 09:50:01 +00:00
commit e9189509c2
9 changed files with 31 additions and 9 deletions

View File

@ -0,0 +1,3 @@
UPDATE salix.defaultViewConfig
SET `columns`='{"intrastat":false,"stemMultiplier":false,"landed":false,"producer":false}'
WHERE tableCode ='itemsIndex';

View File

@ -94,7 +94,7 @@ describe('Ticket Edit basic data path', () => {
it(`should split ticket without negatives`, async() => {
const newAgency = 'Silla247';
const newDate = new Date();
newDate.setDate(newDate.getDate() + 1);
newDate.setDate(newDate.getDate() - 1);
await page.accessToSearchResult('14');
await page.accessToSection('ticket.card.basicData.stepOne');

View File

@ -82,6 +82,7 @@ module.exports = Self => {
Self.filter = async(ctx, filter, options) => {
const conn = Self.dataSource.connector;
const myOptions = {};
let to;
if (typeof options == 'object')
Object.assign(myOptions, options);
@ -109,7 +110,11 @@ module.exports = Self => {
case 'attenderFk':
return {'cl.workerFk': value};
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]}};
}
});

View File

@ -161,6 +161,7 @@ module.exports = Self => {
i.stemMultiplier,
i.typeFk,
i.isFloramondo,
pr.name AS producer,
it.name AS typeName,
it.workerFk AS buyerFk,
u.name AS userName,

View File

@ -54,6 +54,9 @@
<th field="active">
<span translate>Active</span>
</th>
<th field="producer">
<span translate>Producer</span>
</th>
<th field="landed">
<span translate>Landed</span>
</th>
@ -122,6 +125,7 @@
ng-model="::item.isActive">
</vn-check>
</td>
<td>{{::item.producer | dashIfEmpty}}</td>
<td shrink-date>{{::item.landed | date:'dd/MM/yyyy'}}</td>
<td>
<vn-horizontal class="buttons">

View File

@ -81,6 +81,8 @@ class Controller extends Section {
return {'intr.description': value};
case 'name':
return {'i.name': {like: `%${value}%`}};
case 'producer':
return {'pr.name': {like: `%${value}%`}};
case 'id':
case 'size':
case 'subname':

View File

@ -133,6 +133,10 @@ module.exports = Self => {
const where = buildFilter(ctx.args, (param, value) => {
switch (param) {
case 'search':
return /^\d+$/.test(value)
? {'t.id': {inq: value}}
: {'t.nickname': {like: `%${value}%`}};
case 'from':
return {'t.shipped': {gte: value}};
case 'to':

View File

@ -138,7 +138,8 @@ module.exports = Self => {
const params = [args.id, args.shipped, args.warehouseFk];
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) {
const newTicket = await models.Ticket.transferSales(ctx, args.id, null, salesNewTicket, myOptions);
args.id = newTicket.id;
@ -250,7 +251,7 @@ module.exports = Self => {
res.id = args.id;
if (tx) await tx.commit();
return res;
} catch (e) {
if (tx) await tx.rollback();

View File

@ -112,9 +112,9 @@ module.exports = Self => {
// Get items movable
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;
salesObj.haveDifferences = differenceShipped || differenceWarehouse;
let query = `CALL ticket_getMovable(?,?,?)`;
@ -122,8 +122,10 @@ module.exports = Self => {
const [salesMovable] = await Self.rawSql(query, params, myOptions);
const itemMovable = new Map();
for (sale of salesMovable)
itemMovable.set(sale.id, sale.movable ?? 0);
for (sale of salesMovable) {
const saleMovable = sale.movable ? sale.movable : 0;
itemMovable.set(sale.id, saleMovable);
}
// Sale price component, one per sale
query = `CALL vn.ticket_priceDifference(?, ?, ?, ?, ?)`;
@ -152,7 +154,7 @@ module.exports = Self => {
}
if (tx) await tx.commit();
return salesObj;
} catch (e) {
if (tx) await tx.rollback();