#6321 - Negative tickets #1945

Open
jsegarra wants to merge 93 commits from 6321_negative_tickets into dev
4 changed files with 21 additions and 12 deletions
Showing only changes of commit c9c9d5973d - Show all commits

View File

@ -3953,3 +3953,12 @@ VALUES
(4, 'Referencia Transferencias'), (4, 'Referencia Transferencias'),
(5, 'Referencia Nominas'), (5, 'Referencia Nominas'),
(6, 'ABA'); (6, 'ABA');
INSERT INTO `vn`.`item` (id,name,`size`,stems,minPrice,isToPrint,family,box,originFk,doPhoto,image,inkFk,intrastatFk,hasMinPrice,created,typeFk,generic,density,relevancy,expenseFk,isActive,longName,subName,tag5,value5,tag6,value6,tag7,value7,minimum,upToDown,hasKgPrice,isFloramondo,isFragile,stemMultiplier,isLaid,lastUsed,editorFk,isBoxPickingMode)
VALUES
(88,'Lack negative',200,1,10.0,0,'VT',0,2,0,'','WHT',6021010,1,'2024-07-19 11:27:32.000',1,0,167,0,'4751000000',1,'Lack negative origin','Stark Industries','Color','White','Categoria','supply','Tallos','1',3,0,0,0,0,1.0,0,'2024-07-19 11:27:32.000',100,0);
INSERT INTO `vn`.`ticket` (id, clientFk,warehouseFk,shipped,nickname,refFk,addressFk,workerFk,observations,isSigned,isLabeled,isPrinted,packages,location,`hour`,created,isBlocked,solution,routeFk,priority,hasPriority,companyFk,agencyModeFk,landed,isBoxed,isDeleted,zoneFk,zonePrice,zoneBonus,totalWithVat,totalWithoutVat,weight,clonedFrom,cmrFk,editorFk,problem,risk) VALUES
(1000000, 1,1,'2001-01-01 00:00:00.000','employee',NULL,131,NULL,NULL,0,0,0,0,NULL,0,'2024-07-19 23:32:48.000',1,NULL,NULL,NULL,1,442,1,'2001-01-01',0,0,1,1.00,0.00,0.00,NULL,NULL,NULL,NULL,9,'',NULL);
INSERT INTO `vn`.`sale` (id, itemFk,ticketFk,concept,quantity,originalQuantity,price,discount,priceFixed,reserved,isPicked,isPriceFixed,created,isAdded,total,editorFk,problem) VALUES
(43, 88,1000000,'Chest medical box 2',155.00,155.0,0.00,0,0.00,0,0,0,'2024-07-19 23:33:08.000',0,0.00,100,'');

View File

@ -21,7 +21,7 @@ describe('route unlink()', () => {
zoneAgencyModes = await models.ZoneAgencyMode.find(null, options); zoneAgencyModes = await models.ZoneAgencyMode.find(null, options);
tickets = await models.Route.getSuggestedTickets(routeId, options); tickets = await models.Route.getSuggestedTickets(routeId, options);
expect(zoneAgencyModes.length).toEqual(3); expect(zoneAgencyModes.length).toEqual(4);
expect(tickets.length).toEqual(0); expect(tickets.length).toEqual(0);
await tx.rollback(); await tx.rollback();

View File

@ -15,7 +15,7 @@ module.exports = Self => {
http: {source: 'query'} http: {source: 'query'}
}, },
{ {
arg: 'id', arg: 'itemFk',
type: 'number', type: 'number',
description: 'The item id', description: 'The item id',
}, },
@ -45,7 +45,7 @@ module.exports = Self => {
description: 'origen id', description: 'origen id',
}, },
{ {
arg: 'warehouse', arg: 'warehouseFk',
type: 'number', type: 'number',
description: 'The warehouse id', description: 'The warehouse id',
}, },
@ -79,7 +79,7 @@ module.exports = Self => {
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
const filterKeyOrder = ['days', 'id', 'longname', 'supplier', 'colour', 'size', 'origen', 'lack', 'warehouse']; const filterKeyOrder = ['days', 'itemFk', 'longname', 'supplier', 'colour', 'size', 'origen', 'lack', 'warehouseFk'];
delete ctx?.args?.ctx; delete ctx?.args?.ctx;

View File

@ -1,6 +1,6 @@
const models = require('vn-loopback/server/server').models; const models = require('vn-loopback/server/server').models;
describe('Item Lack', () => { fdescribe('Item Lack', () => {
beforeEach(async() => { beforeEach(async() => {
ctx = { ctx = {
req: { req: {
@ -18,7 +18,7 @@ describe('Item Lack', () => {
try { try {
const result = await models.Ticket.itemLack(ctx, filter, options); const result = await models.Ticket.itemLack(ctx, filter, options);
expect(result.length).toEqual(4); expect(result.length).toEqual(2);
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {
await tx.rollback(); await tx.rollback();
@ -31,7 +31,7 @@ describe('Item Lack', () => {
const options = {transaction: tx}; const options = {transaction: tx};
const filter = { const filter = {
id: 1 id: 88
}; };
try { try {
const result = await models.Ticket.itemLack(ctx, filter, options); const result = await models.Ticket.itemLack(ctx, filter, options);
@ -49,7 +49,7 @@ describe('Item Lack', () => {
const options = {transaction: tx}; const options = {transaction: tx};
const filter = { const filter = {
longname: 'Ranged weapon longbow 200cm' longname: 'Lack negative'
}; };
try { try {
const result = await models.Ticket.itemLack(ctx, filter, options); const result = await models.Ticket.itemLack(ctx, filter, options);
@ -85,7 +85,7 @@ describe('Item Lack', () => {
const options = {transaction: tx}; const options = {transaction: tx};
const filter = { const filter = {
colour: 'BRW' colour: 'WHT'
}; };
try { try {
const result = await models.Ticket.itemLack(ctx, filter, options); const result = await models.Ticket.itemLack(ctx, filter, options);
@ -103,12 +103,12 @@ describe('Item Lack', () => {
const options = {transaction: tx}; const options = {transaction: tx};
const filter = { const filter = {
origen: 2 origen: 1
}; };
try { try {
const result = await models.Ticket.itemLack(ctx, filter, options); const result = await models.Ticket.itemLack(ctx, filter, options);
expect(result.length).toEqual(3); expect(result.length).toEqual(2);
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {
await tx.rollback(); await tx.rollback();
@ -139,7 +139,7 @@ describe('Item Lack', () => {
const options = {transaction: tx}; const options = {transaction: tx};
const filter = { const filter = {
lack: '-100' lack: '-155'
}; };
try { try {
const result = await models.Ticket.itemLack(ctx, filter, options); const result = await models.Ticket.itemLack(ctx, filter, options);