Compare commits

..

11 Commits

Author SHA1 Message Date
395c6de2c6 first commit 2026-01-02 18:13:58 -05:00
eduardoestevao-appsoluti
6a2e16e503 Merge pull request #23 from JurunenseDesenvolvimento/FEAT_SelecaoAutomaticaFilialRetira
Add 'type_campaing' selection to sales queries in SalesService
2025-09-20 11:41:39 -03:00
eduardoestevao-appsoluti
615c4353b8 Add 'type_campaing' selection to sales queries in SalesService 2025-09-20 11:40:40 -03:00
eduardoestevao-appsoluti
19e1317e3a Merge pull request #22 from JurunenseDesenvolvimento/FEAT_SelecaoAutomaticaFilialRetira
Feat selecao automatica filial retira
2025-09-17 09:58:47 -03:00
eduardoestevao-appsoluti
f32a3fd40f Add 'similar' product selection to sales queries in SalesService 2025-09-17 09:48:07 -03:00
eduardoestevao-appsoluti
b1aae3304b Add endpoint to retrieve similar products and implement corresponding service method 2025-09-10 16:56:11 -03:00
JuruSysadmin
6dba6fb1a9 taggeando as versões e subindo o dockerfile corrigido para os packages 2025-06-20 10:16:42 -03:00
Felipe Batista
f5f4d58321 Merge pull request #17 from JurunenseDesenvolvimento/dev-nova
Dev - Main
2025-05-23 18:58:34 -03:00
Felipe Batista
eb572913eb Merge pull request #16 from JurunenseDesenvolvimento/release-gravar-estoque-atual
Incluida coluna tipo de endereço (NORMAL/PORTO/CONDOMINIO) no endereç…
2025-05-23 18:57:49 -03:00
eduardoestevao-appsoluti
85012058e5 Incluida coluna tipo de endereço (NORMAL/PORTO/CONDOMINIO) no endereço do cliente 2025-05-23 11:26:47 -03:00
eduardoestevao-appsoluti
97d9a95208 Merge pull request #14 from JurunenseDesenvolvimento/release-gravar-estoque-atual
Release gravar estoque atual
2025-05-13 16:54:16 -03:00
12 changed files with 246 additions and 98 deletions

150
README.md
View File

@@ -1,75 +1,75 @@
<p align="center">
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
</p>
[travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master
[travis-url]: https://travis-ci.org/nestjs/nest
[linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux
[linux-url]: https://travis-ci.org/nestjs/nest
<p align="center">A progressive <a href="http://nodejs.org" target="blank">Node.js</a> framework for building efficient and scalable server-side applications, heavily inspired by <a href="https://angular.io" target="blank">Angular</a>.</p>
<p align="center">
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/dm/@nestjs/core.svg" alt="NPM Downloads" /></a>
<a href="https://travis-ci.org/nestjs/nest"><img src="https://api.travis-ci.org/nestjs/nest.svg?branch=master" alt="Travis" /></a>
<a href="https://travis-ci.org/nestjs/nest"><img src="https://img.shields.io/travis/nestjs/nest/master.svg?label=linux" alt="Linux" /></a>
<a href="https://coveralls.io/github/nestjs/nest?branch=master"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#5" alt="Coverage" /></a>
<a href="https://gitter.im/nestjs/nestjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge"><img src="https://badges.gitter.im/nestjs/nestjs.svg" alt="Gitter" /></a>
<a href="https://opencollective.com/nest#backer"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
<a href="https://opencollective.com/nest#sponsor"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
<a href="https://paypal.me/kamilmysliwiec"><img src="https://img.shields.io/badge/Donate-PayPal-dc3d53.svg"/></a>
<a href="https://twitter.com/nestframework"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
</p>
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
## Description
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
## Installation
```bash
$ npm install
```
## Running the app
```bash
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
```
## Test
```bash
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
```
## Support
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
## Stay in touch
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
- Website - [https://nestjs.com](https://nestjs.com/)
- Twitter - [@nestframework](https://twitter.com/nestframework)
## License
Nest is [MIT licensed](LICENSE).
<p align="center">
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
</p>
[travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master
[travis-url]: https://travis-ci.org/nestjs/nest
[linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux
[linux-url]: https://travis-ci.org/nestjs/nest
<p align="center">A progressive <a href="http://nodejs.org" target="blank">Node.js</a> framework for building efficient and scalable server-side applications, heavily inspired by <a href="https://angular.io" target="blank">Angular</a>.</p>
<p align="center">
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/dm/@nestjs/core.svg" alt="NPM Downloads" /></a>
<a href="https://travis-ci.org/nestjs/nest"><img src="https://api.travis-ci.org/nestjs/nest.svg?branch=master" alt="Travis" /></a>
<a href="https://travis-ci.org/nestjs/nest"><img src="https://img.shields.io/travis/nestjs/nest/master.svg?label=linux" alt="Linux" /></a>
<a href="https://coveralls.io/github/nestjs/nest?branch=master"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#5" alt="Coverage" /></a>
<a href="https://gitter.im/nestjs/nestjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge"><img src="https://badges.gitter.im/nestjs/nestjs.svg" alt="Gitter" /></a>
<a href="https://opencollective.com/nest#backer"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
<a href="https://opencollective.com/nest#sponsor"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
<a href="https://paypal.me/kamilmysliwiec"><img src="https://img.shields.io/badge/Donate-PayPal-dc3d53.svg"/></a>
<a href="https://twitter.com/nestframework"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
</p>
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
## Description
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
## Installation
```bash
$ npm install
```
## Running the app
```bash
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
```
## Test
```bash
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
```
## Support
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
## Stay in touch
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
- Website - [https://nestjs.com](https://nestjs.com/)
- Twitter - [@nestframework](https://twitter.com/nestframework)
## License
Nest is [MIT licensed](LICENSE).

View File

@@ -1,14 +1,20 @@
import { Controller, Get } from '@nestjs/common';
import { AppService } from './app.service';
import { ApiExcludeEndpoint } from '@nestjs/swagger';
import { ApiTags, ApiOperation } from '@nestjs/swagger';
import { APP_VERSION } from './version';
@Controller()
@ApiTags('Main')
@Controller('v1')
export class AppController {
constructor(private readonly appService: AppService) {}
@Get()
@ApiExcludeEndpoint()
getHello(): string {
return this.appService.getHello();
@Get('version')
@ApiOperation({ summary: 'Get App Version' })
getVersion() {
return { version: APP_VERSION };
}
@Get('health')
@ApiOperation({ summary: 'Health check' })
healthCheck() {
return { status: 'ok' };
}
}

View File

@@ -1637,6 +1637,9 @@ export class Pcclient {
@Column({ name: 'CODSUBCATEGORIA' })
codsubcategoria: number;
@Column({ name: 'TIPOENDERECO' })
tipoendereco: string;
@OneToMany(() => Pcnfsaid, notas => notas.pcclient)
notas: Pcnfsaid[];

View File

@@ -76,6 +76,9 @@ export class Pcclientendent {
@Column({name: 'CODPAISRECEBEDOR'})
codpaisrecebedor: number;
@Column({name: 'TIPOENDERECO'})
tipoendereco: string;
@OneToMany(() => Pcpedc, pedidos => pedidos.pcclientendent)
pedidos: Pcpedc[];

View File

@@ -23,5 +23,6 @@ export class Address {
emailRecebedor: string;
latitude: number;
longitude: number;
addressType?: string;
}

View File

@@ -19,14 +19,16 @@ export class Customer {
public category: Category,
public subCategory: SubCategory,
public place: Place,
public placeId: number,
public sellerId: number,
public ibgeCode: string,
public birthdate: Date,
public ramo: Ramo,
public birthdate?: Date,
public ramo?: Ramo,
public communicate?: string,
public idUser?: number,
public latitude?: number,
public longitude?: number,
public addressType?: string,
){}
}

View File

@@ -234,6 +234,7 @@ export class PartnerService {
null,
null,
data.place,
data.place.id,
data.sellerId,
data.ibgeCode,
null,

View File

@@ -37,6 +37,7 @@ export class AddressCustomerService {
.addSelect('\"pcclientendent\".codpracaent', 'placeId')
.addSelect('\"pcclientendent\".latitude', 'latitude')
.addSelect('\"pcclientendent\".longitude', 'longitude')
.addSelect('\"pcclientendent\".tipoendereco', 'addressType')
.where("\"pcclientendent\".codcli = :idCustomer", { idCustomer })
.getRawMany();
return new ResultModel(true, null, addresses, null);
@@ -79,6 +80,7 @@ export class AddressCustomerService {
' ,pcclientendent.codpracaent as "placeId" ' +
' ,pcclientendent.latitude as "latitude" ' +
' ,pcclientendent.longitude as "longitude" ' +
' ,pcclientendent.tipoendereco as "addressType" ' +
' FROM pcclientendent ' +
' WHERE pcclientendent.codcli = :idCustomer ' +
' AND pcclientendent.codendentcli = :idAddress ';
@@ -122,6 +124,7 @@ export class AddressCustomerService {
' ,pcclientendent.codpracaent as "placeId" ' +
' ,pcclientendent.latitude as "latitude" ' +
' ,pcclientendent.longitude as "longitude" ' +
' ,pcclientendent.tipoendereco as "addressType" ' +
' FROM pcclientendent ' +
' WHERE pcclientendent.codcli = :idCustomer ' +
" AND REGEXP_REPLACE(pcclientendent.cepent, '[^0-9]', '') = REGEXP_REPLACE(:cepent, '[^0-9]', '')";
@@ -183,6 +186,7 @@ export class AddressCustomerService {
emailRecebedor: customer[0].email,
latitude: ( data.latitude ) ? data.latitude.toString() : '0',
longitude:( data.longitude ) ? data.longitude.toString() : '0',
tipoendereco: data.addressType
})
.where("\"PCCLIENTENDENT\".codcli = :codcli and \"PCCLIENTENDENT\".codendentcli = :codendentcli",
{ codcli: data.idCustomer, codendentcli: data.idAddress })
@@ -250,6 +254,7 @@ export class AddressCustomerService {
newPcclientendent.emailRecebedor = customer.email;
newPcclientendent.latitude = ( data.latitude ) ? data.latitude.toString() : '0';
newPcclientendent.longitude = ( data.longitude ) ? data.longitude.toString() : '0';
newPcclientendent.tipoendereco = data.addressType;
await queryRunner.manager
.createQueryBuilder()
@@ -257,6 +262,7 @@ export class AddressCustomerService {
.into(Pcclientendent)
.values(newPcclientendent)
.execute();
const newAddress: Address = {
idCustomer: data.idCustomer,
idAddress: id,
@@ -282,6 +288,7 @@ export class AddressCustomerService {
emailRecebedor: customer.email,
latitude: data.latitude,
longitude: data.longitude,
addressType: data.addressType,
}
return newAddress;

View File

@@ -49,6 +49,7 @@ export class CustomerService {
' ,pcclient.longitude as "longitude" ' +
' ,pcclient.codmunicipio as "ibgeCode" ' +
' ,pcclient.codcidade as "cityId" ' +
' ,pcclient.tipoendereco as "addressType" ' +
' FROM pcclient, pccidade ' +
' WHERE pcclient.codcidade = pccidade.codcidade (+)';
let where = ` AND ( pcclient.cliente like '%'||'${auxName.replace('@', '%')}'||'%' OR ` +
@@ -59,7 +60,18 @@ export class CustomerService {
const pagination = ` OFFSET 0 ROWS FETCH NEXT 100 ROWS ONLY`;
const customers = await queryRunner.manager
.query(sql + where + orderBy + pagination) as Customer[];
return customers;
let customerList: Customer[] = [];
for (let i = 0; i < customers.length; i++) {
let customer = customers[i];
const place = await queryRunner.query(`SELECT PCPRACA.CODPRACA as "placeId"
,PCPRACA.PRACA as "name"
FROM PCPRACA
WHERE PCPRACA.CODPRACA = ${customer.placeId}`);
customer.place = place[0];
customerList.push(customer);
}
return customerList;
} catch (error) {
console.log(error);
throw error;
@@ -102,6 +114,7 @@ export class CustomerService {
' ,pcclient.longitude as "longitude" ' +
' ,pcclient.codmunicipio as "ibgeCode" ' +
' ,pcclient.codcidade as "cityId" ' +
' ,pcclient.tipoendereco as "addressType" ' +
' FROM pcclient, pccidade ' +
' WHERE pcclient.codcidade = pccidade.codcidade (+)';
const where = ` AND REGEXP_REPLACE(pcclient.cgcent, '[^0-9]', '') =REGEXP_REPLACE('${cpf}', '[^0-9]', '')`;
@@ -150,11 +163,17 @@ export class CustomerService {
' ,pcclient.longitude as "longitude" ' +
' ,pcclient.codmunicipio as "ibgeCode" ' +
' ,pcclient.codcidade as "cityId" ' +
' ,pcclient.tipoendereco as "addressType" ' +
' FROM pcclient, pccidade ' +
' WHERE pcclient.codcidade = pccidade.codcidade (+)';
const where = ` AND pcclient.codcli = ${idCustomer}`;
const customer = await queryRunner.query(sql + where);
return customer[0];
const place = await queryRunner.query(`SELECT PCPRACA.CODPRACA as "placeId"
,PCPRACA.PRACA as "name"
FROM PCPRACA
WHERE PCPRACA.CODPRACA = ${customer[0].placeId}`);
return {...customer[0], place: place[0]};
} catch (error) {
console.log(error);
throw error;
@@ -216,6 +235,7 @@ export class CustomerService {
.addSelect("\"pcclient\".longitude as \"longitude\"")
.addSelect("\"pcclient\".codmunicipio as \"ibgeCode\"")
.addSelect("\"pcclient\".codcidade as \"cityId\"")
.addSelect("\"pcclient\".esc_tipoeclieente as \"addressType\"")
.where(where)
.andWhere("\"pcclient\".CODCLI NOT IN (2) AND \"pcclient\".DTEXCLUSAO IS NULL")
.getRawMany();
@@ -304,6 +324,7 @@ export class CustomerService {
newCustomer.dtultalter = new Date();
newCustomer.latitude = customer.latitude;
newCustomer.longitude = customer.longitude;
newCustomer.tipoendereco = customer.addressType;
const oldCustomer = await this.findCustomerByCpf(newCustomer.cgcent);
if (oldCustomer) {
@@ -321,7 +342,8 @@ export class CustomerService {
allowMessage: customer.allowMessage, cellPhone: customer.cellPhone,
category: customer.category, subCategory: customer.subCategory,
place: customer.place, ramo: customer.ramo, meiocomunicacao: customer.communicate,
latitude: customer.latitude, longitude: customer.longitude, ibgeCode: customer.ibgeCode
latitude: customer.latitude, longitude: customer.longitude, ibgeCode: customer.ibgeCode,
addressType: customer.addressType,
};
} else {
const idCustomer = await this.generateIdCustomer();
@@ -340,7 +362,8 @@ export class CustomerService {
allowMessage: customer.allowMessage, cellPhone: customer.cellPhone,
category: customer.category, subCategory: customer.subCategory,
place: customer.place, meiocomunicacao: customer.communicate,
ramo: customer.ramo, latitude: customer.latitude, longitude: customer.longitude, ibgeCode: customer.ibgeCode
ramo: customer.ramo, latitude: customer.latitude, longitude: customer.longitude,
ibgeCode: customer.ibgeCode, addressType: customer.addressType,
};
}
} catch (error) {
@@ -400,7 +423,8 @@ export class CustomerService {
codfuncultalter: client.codfuncultalter,
dtultalter: client.dtultalter,
latitude: client.latitude,
longitude: client.longitude,
longitude: client.longitude,
tipoendereco: client.tipoendereco
})
.where({ codcli: client.codcli })
.execute();

View File

@@ -176,6 +176,20 @@ export class SalesController {
}
}
@Get('product/simil/:id')
@ApiOperation({ summary: 'Get products similar' })
@ApiParam({ name: 'id', description: 'Product ID' })
async getProductSimil(@Headers() headers, @Param('id') id: number) {
try {
const { store } = this.extractPaginationParams(headers);
return await this.salesService.GetProductsSimil(store, id);
} catch (e) {
throw new HttpException(e.message, HttpStatus.BAD_REQUEST);
}
}
@Get('stock/:storeid/:id')
@ApiOperation({ summary: 'Get product stock information' })
@ApiParam({ name: 'storeid', description: 'Store ID' })

View File

@@ -77,9 +77,11 @@ export class SalesService {
esvlistaprodutos.LETRABASETINTOMETRICO as "letter",
esvlistaprodutos.LINHATINTOMETRICO as "line",
esvlistaprodutos.LITRAGEM as "can",
esvlistaprodutos.QUANTIDADE_ESTOQUE_GERAL as "full_stock"
esvlistaprodutos.QUANTIDADE_ESTOQUE_GERAL as "full_stock",
esvlistaprodutos.TEM_PRODUTO_SIMILAR as "similar",
NVL(esvlistaprodutos.TIPO, 'SEM') as "type_campaing"
FROM ESVLISTAPRODUTOS
WHERE 1 = 1`;
WHERE 1 = 1 `;
if (filter && filter.text.length > 0) {
const description = filter.text.toUpperCase();
@@ -127,6 +129,8 @@ export class SalesService {
.addSelect("\"esvlistaprodutos\".LINHATINTOMETRICO", "line")
.addSelect("\"esvlistaprodutos\".LITRAGEM", "can")
.addSelect("\"esvlistaprodutos\".QUANTIDADE_ESTOQUE_GERAL", "full_stock")
.addSelect("\"esvlistaprodutos\".TEM_PRODUTO_SIMILAR", "similar")
.addSelect("\"esvlistaprodutos\".TIPO_CAMPANHA", "type_campaing")
.where("UPPER(\"esvlistaprodutos\".CODFAB) LIKE '%'||REPLACE(:description, '@', '%')||'%'", { description })
.andWhere("(\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99')", { codfilial: store })
.andWhere("(\"esvlistaprodutos\".produto_com_reducao_preco = :produtoComReducaoPreco OR :produtoComReducaoPreco = 'N')",
@@ -184,6 +188,8 @@ export class SalesService {
.addSelect("\"esvlistaprodutos\".LINHATINTOMETRICO", "line")
.addSelect("\"esvlistaprodutos\".LITRAGEM", "can")
.addSelect("\"esvlistaprodutos\".QUANTIDADE_ESTOQUE_GERAL", "full_stock")
.addSelect("\"esvlistaprodutos\".TEM_PRODUTO_SIMILAR", "similar")
.addSelect("\"esvlistaprodutos\".TIPO_CAMPANHA", "type_campaing")
.where("UPPER(\"esvlistaprodutos\".descricao) LIKE '%'||REPLACE(:description, '@', '%')||'%'", { description })
.andWhere("(\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99')", { codfilial: store })
.andWhere("(\"esvlistaprodutos\".produto_com_reducao_preco = :produtoComReducaoPreco OR :produtoComReducaoPreco = 'N')",
@@ -260,6 +266,8 @@ export class SalesService {
.addSelect("\"esvlistaprodutos\".LINHATINTOMETRICO", "line")
.addSelect("\"esvlistaprodutos\".LITRAGEM", "can")
.addSelect("\"esvlistaprodutos\".QUANTIDADE_ESTOQUE_GERAL", "full_stock")
.addSelect("\"esvlistaprodutos\".TEM_PRODUTO_SIMILAR", "similar")
.addSelect("\"esvlistaprodutos\".TIPO_CAMPANHA", "type_campaing")
.where("esvlistaprodutos.brand in (" + xbrands + ")")
.andWhere("\"esvlistaprodutos\".URLCATEGORIA LIKE :urlCategoria||'%'", { urlCategoria: filter.urlCategory })
.andWhere("(\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99')", { codfilial: store })
@@ -324,6 +332,8 @@ export class SalesService {
.addSelect("\"esvlistaprodutos\".LINHATINTOMETRICO", "line")
.addSelect("\"esvlistaprodutos\".LITRAGEM", "can")
.addSelect("\"esvlistaprodutos\".QUANTIDADE_ESTOQUE_GERAL", "full_stock")
.addSelect("\"esvlistaprodutos\".TEM_PRODUTO_SIMILAR", "similar")
.addSelect("\"esvlistaprodutos\".TIPO_CAMPANHA", "type_campaing")
.where("(\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99')", { codfilial: store })
.andWhere("(\"esvlistaprodutos\".produto_com_reducao_preco = :produtoComReducaoPreco OR :produtoComReducaoPreco = 'N')",
{ produtoComReducaoPreco: (filter.markdown.toString() == 'true') ? 'S' : 'N' })
@@ -562,6 +572,8 @@ export class SalesService {
.addSelect("\"esvlistaprodutos\".PRODUTO_EM_CAMPANHA", "compaing")
.addSelect("\"esvlistaprodutos\".BASETINTOMETRICO", "base")
.addSelect("\"esvlistaprodutos\".QUANTIDADE_ESTOQUE_GERAL", "full_stock")
.addSelect("\"esvlistaprodutos\".TEM_PRODUTO_SIMILAR", "similar")
.addSelect("\"esvlistaprodutos\".TIPO_CAMPANHA", "type_campaing")
.where("esvlistaprodutos.idProduct = :id", { id: numbers })
.andWhere("\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99'", { codfilial: store })
.limit(pageSize)
@@ -608,7 +620,9 @@ export class SalesService {
.addSelect("\"esvlistaprodutos\".PRODUTO_COM_REDUCAO_PRECO", "downPrice")
.addSelect("\"esvlistaprodutos\".PRODUTO_EM_CAMPANHA", "compaing")
.addSelect("\"esvlistaprodutos\".BASETINTOMETRICO", "base")
.addSelect("\"esvlistaprodutos\".QUANTIDADE_ESTOQUE_GERAL", "full_stock")
.addSelect("\"esvlistaprodutos\".QUANTIDADE_ESTOQUE_GERAL", "full_stock")
.addSelect("\"esvlistaprodutos\".TEM_PRODUTO_SIMILAR", "similar")
.addSelect("\"esvlistaprodutos\".TIPO_CAMPANHA", "type_campaing")
.where("esvlistaprodutos.CODAUXILIAR = :id", { id: numbers })
.andWhere("(\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99')", { codfilial: store })
.limit(pageSize)
@@ -657,7 +671,9 @@ export class SalesService {
.addSelect("\"esvlistaprodutos\".PRODUTO_COM_REDUCAO_PRECO", "downPrice")
.addSelect("\"esvlistaprodutos\".PRODUTO_EM_CAMPANHA", "compaing")
.addSelect("\"esvlistaprodutos\".BASETINTOMETRICO", "base")
.addSelect("\"esvlistaprodutos\".QUANTIDADE_ESTOQUE_GERAL", "full_stock")
.addSelect("\"esvlistaprodutos\".QUANTIDADE_ESTOQUE_GERAL", "full_stock")
.addSelect("\"esvlistaprodutos\".TEM_PRODUTO_SIMILAR", "similar")
.addSelect("\"esvlistaprodutos\".TIPO_CAMPANHA", "type_campaing")
.where("UPPER(esvlistaprodutos.CODFAB) like REPLACE(:description, '@', '%')", { description })
.andWhere("\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99'", { codfilial: store })
.limit(pageSize)
@@ -703,7 +719,9 @@ export class SalesService {
.addSelect("\"esvlistaprodutos\".PRODUTO_COM_REDUCAO_PRECO", "downPrice")
.addSelect("\"esvlistaprodutos\".PRODUTO_EM_CAMPANHA", "compaing")
.addSelect("\"esvlistaprodutos\".BASETINTOMETRICO", "base")
.addSelect("\"esvlistaprodutos\".QUANTIDADE_ESTOQUE_GERAL", "full_stock")
.addSelect("\"esvlistaprodutos\".QUANTIDADE_ESTOQUE_GERAL", "full_stock")
.addSelect("\"esvlistaprodutos\".TEM_PRODUTO_SIMILAR", "similar")
.addSelect("\"esvlistaprodutos\".TIPO_CAMPANHA", "type_campaing")
.where("UPPER(esvlistaprodutos.DESCRICAO) like REPLACE(:description, '@', '%')", { description })
.andWhere("\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99'", { codfilial: store })
.limit(pageSize)
@@ -772,7 +790,9 @@ export class SalesService {
.addSelect("\"esvlistaprodutos\".PRODUTO_COM_REDUCAO_PRECO", "downPrice")
.addSelect("\"esvlistaprodutos\".PRODUTO_EM_CAMPANHA", "compaing")
.addSelect("\"esvlistaprodutos\".BASETINTOMETRICO", "base")
.addSelect("\"esvlistaprodutos\".QUANTIDADE_ESTOQUE_GERAL", "full_stock")
.addSelect("\"esvlistaprodutos\".QUANTIDADE_ESTOQUE_GERAL", "full_stock")
.addSelect("\"esvlistaprodutos\".TEM_PRODUTO_SIMILAR", "similar")
.addSelect("\"esvlistaprodutos\".TIPO_CAMPANHA", "type_campaing")
.where("esvlistaprodutos.idProduct = :id", { id: id })
.andWhere("\"esvlistaprodutos\".codfilial = :codfilial", { codfilial: store })
.orderBy("REPLACE(\"esvlistaprodutos\".DESCRICAO,'#', '')", "ASC")
@@ -834,6 +854,8 @@ export class SalesService {
,esvlistaprodutos.PRODUTO_EM_CAMPANHA as "compaing"
,esvlistaprodutos.BASETINTOMETRICO as "base"
,esvlistaprodutos.QUANTIDADE_ESTOQUE_GERAL as "full_stock"
,esvlistaprodutos.TEM_PRODUTO_SIMILAR as "similar"
,esvlistaprodutos.TIPO_CAMPANHA as "type_campaing"
FROM ESVLISTAPRODUTOS, ESTCOMPREJUNTO
WHERE ESVLISTAPRODUTOS.CODPROD = ESTCOMPREJUNTO.CODPROD
AND ESTCOMPREJUNTO.CODPRODVENDA = ${id}
@@ -851,6 +873,68 @@ export class SalesService {
}
}
async GetProductsSimil(store: string, id: number) {
const connectionDb = new Connection(connectionOptions);
await connectionDb.connect();
const queryRunner = connectionDb.createQueryRunner();
await queryRunner.connect();
try {
const sql = `SELECT esvlistaprodutos.CODPROD as "idProduct"
,esvlistaprodutos.SEQ as "seq"
,esvlistaprodutos.DESCRICAO as "smallDescription"
,esvlistaprodutos.NOMEECOMMERCE as "title"
,esvlistaprodutos.CODFAB as "idProvider"
,esvlistaprodutos.CODAUXILIAR as "ean"
,esvlistaprodutos.TIPOPRODUTO as "productType"
,esvlistaprodutos.DADOSTECNICOS as "technicalData"
,esvlistaprodutos.INFORMACOESTECNICAS as "description"
,esvlistaprodutos.URLIMAGEM as "urlImage"
,esvlistaprodutos.NOMEMARCA as "brand"
,esvlistaprodutos.NOMEDEPARTAMENTO as "department"
,esvlistaprodutos.NOMESECAO as "section"
,esvlistaprodutos.NOMECATEGORIA as "category"
,esvlistaprodutos.NOMEFORNECEDOR as "supplier"
,esvlistaprodutos.CODIGOFILIAL as "store"
,esvlistaprodutos.CLASSEVENDA as "saleAbc"
,esvlistaprodutos.CLASSEESTOQUE as "stockAbc"
,esvlistaprodutos.FORALINHA as "outLine"
,esvlistaprodutos.PRECOVENDA as "listPrice"
,esvlistaprodutos.PRECOPROMOCIONAL as "salePrice"
,esvlistaprodutos.PRECOPROMOCIONAL as "salePromotion"
,esvlistaprodutos.PERCENTUALDESCONTO as"offPercent"
,esvlistaprodutos.QTESTOQUE_DISPONIVEL as "stock"
,esvlistaprodutos.QTCAIXAS as "boxStock"
,esvlistaprodutos.ESTOQUE_DISP_LOJA as "store_stock"
,esvlistaprodutos.ESTOQUE_DISP_CAIXA_LOJA as "store_boxStock"
,esvlistaprodutos.ESTOQUE_DISP_LOJA as "store_stock"
,esvlistaprodutos.ESTOQUE_DISP_CAIXA_LOJA as "store_boxStock"
,esvlistaprodutos.MULTIPLO as "mutiple"
,esvlistaprodutos.UNIDADE as "unity"
,esvlistaprodutos.URLDEPARTAMENTO as "urlDepartment"
,esvlistaprodutos.URLSECAO as "urlSection"
,esvlistaprodutos.PRODUTO_COM_REDUCAO_PRECO as "downPrice"
,esvlistaprodutos.PRODUTO_EM_CAMPANHA as "compaing"
,esvlistaprodutos.BASETINTOMETRICO as "base"
,esvlistaprodutos.QUANTIDADE_ESTOQUE_GERAL as "full_stock"
,esvlistaprodutos.TEM_PRODUTO_SIMILAR as "similar"
,esvlistaprodutos.TIPO_CAMPANHA as "type_campaing"
FROM ESVLISTAPRODUTOS, PCPRODSIMIL
WHERE ESVLISTAPRODUTOS.CODPROD = PCPRODSIMIL.CODSIMIL
AND PCPRODSIMIL.CODPROD = ${id}
AND ESVLISTAPRODUTOS.CODFILIAL = '${store}'
ORDER BY REPLACE(esvlistaprodutos.DESCRICAO,'#', '')`;
let products: SalesProduct[] = await queryRunner.query(sql);
products = this.createListImages(products);
return products;
} catch (error) {
throw error;
} finally {
await queryRunner.release();
await connectionDb.close();
}
}
async GetStocks(storeId: string, id: number) {
const connectionDb = new Connection(connectionOptions);
await connectionDb.connect();
@@ -1265,8 +1349,10 @@ export class SalesService {
' ,esvlistaprodutos.LINHATINTOMETRICO "line" ' +
' ,esvlistaprodutos.LITRAGEM "can" ' +
' ,esvlistaprodutos.QUANTIDADE_ESTOQUE_GERAL "full_stock" ' +
' ,esvlistaprodutos.TEM_PRODUTO_SIMILAR "similar" ' +
' ,esvlistaprodutos.TIPO_CAMPANHA "type_campaing" ' +
' FROM esvlistaprodutos ' +
' WHERE 1 = 1';
' WHERE 1 = 1 ';
let where = "";
if (filter.text != null) {

1
src/version.ts Normal file
View File

@@ -0,0 +1 @@
export const APP_VERSION = 'v1.1.0';