Compare commits

..

No commits in common. "757d547755b14ed108e6343ac73f0d45bbb27748" and "97d9a95208983c99a922d5d6a7af37bb8f2d05a3" have entirely different histories.

14 changed files with 53 additions and 212 deletions

2
.gitignore vendored
View File

@ -33,5 +33,3 @@ lerna-debug.log*
!.vscode/launch.json !.vscode/launch.json
!.vscode/extensions.json !.vscode/extensions.json
postgres-data/
.env

View File

@ -1,37 +1,32 @@
# Estágio 1: Build FROM node:16
FROM node:16-bullseye-slim AS builder
WORKDIR /app
COPY package*.json ./
RUN npm install --legacy-peer-deps
COPY . .
RUN npm run build
FROM node:16-bullseye-slim
# Instalar dependências do Oracle
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
apt-transport-https \
ca-certificates \
libaio1 \ libaio1 \
unzip \ unzip \
wget \ wget \
&& mkdir -p /opt/oracle libc6 \
libncurses5 && \
mkdir -p /opt/oracle && \
wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basic-linuxx64.zip -O /opt/oracle/instantclient-basic-linuxx64.zip && \
unzip /opt/oracle/instantclient-basic-linuxx64.zip -d /opt/oracle && \
rm /opt/oracle/instantclient-basic-linuxx64.zip && \
ln -s /opt/oracle/instantclient_* /opt/oracle/instantclient && \
echo "/opt/oracle/instantclient" > /etc/ld.so.conf.d/oracle-instantclient.conf && \
ldconfig
# Instalar Oracle Instant Client
RUN wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basic-linuxx64.zip -O /opt/oracle/client.zip && \
unzip /opt/oracle/client.zip -d /opt/oracle && \
rm /opt/oracle/client.zip && \
ln -s /opt/oracle/instantclient_* /opt/oracle/instantclient
# Configurar o sistema para encontrar as bibliotecas do Oracle
ENV LD_LIBRARY_PATH=/opt/oracle/instantclient
RUN echo "/opt/oracle/instantclient" > /etc/ld.so.conf.d/oracle-instantclient.conf && ldconfig
WORKDIR /app WORKDIR /app
# Copiar apenas o necessário do estágio anterior
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/node_modules ./node_modules
# Variáveis de ambiente padrão para o driver oracledb COPY package*.json ./
ENV OCI_LIB_DIR=/opt/oracle/instantclient
ENV OCI_INC_DIR=/opt/oracle/instantclient/sdk/include
RUN npm install --legacy-peer-deps
COPY . .
CMD ["npm", "run", "start:prod"]

View File

@ -1,18 +1,14 @@
version: '3.8' version: '3.8'
services: services:
vendaweb-api: vendaweb:
image: http://10.1.1.124:8082/library/vendaweb-api:latest image: link70/vendaweb
deploy:
replicas: 20
resources:
limits:
cpus: '0.5'
memory: 512M
ports: ports:
- "8065:8065" - "8065:8065"
networks: restart: always
- juru-network
deploy:
replicas: 4
update_config:
order: start-first
parallelism: 1
networks:
juru-network:
external: true

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -176,20 +176,6 @@ 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') @Get('stock/:storeid/:id')
@ApiOperation({ summary: 'Get product stock information' }) @ApiOperation({ summary: 'Get product stock information' })
@ApiParam({ name: 'storeid', description: 'Store ID' }) @ApiParam({ name: 'storeid', description: 'Store ID' })

View File

@ -77,11 +77,9 @@ export class SalesService {
esvlistaprodutos.LETRABASETINTOMETRICO as "letter", esvlistaprodutos.LETRABASETINTOMETRICO as "letter",
esvlistaprodutos.LINHATINTOMETRICO as "line", esvlistaprodutos.LINHATINTOMETRICO as "line",
esvlistaprodutos.LITRAGEM as "can", 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 FROM ESVLISTAPRODUTOS
WHERE 1 = 1 `; WHERE 1 = 1`;
if (filter && filter.text.length > 0) { if (filter && filter.text.length > 0) {
const description = filter.text.toUpperCase(); const description = filter.text.toUpperCase();
@ -129,8 +127,6 @@ export class SalesService {
.addSelect("\"esvlistaprodutos\".LINHATINTOMETRICO", "line") .addSelect("\"esvlistaprodutos\".LINHATINTOMETRICO", "line")
.addSelect("\"esvlistaprodutos\".LITRAGEM", "can") .addSelect("\"esvlistaprodutos\".LITRAGEM", "can")
.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 }) .where("UPPER(\"esvlistaprodutos\".CODFAB) LIKE '%'||REPLACE(:description, '@', '%')||'%'", { description })
.andWhere("(\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99')", { codfilial: store }) .andWhere("(\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99')", { codfilial: store })
.andWhere("(\"esvlistaprodutos\".produto_com_reducao_preco = :produtoComReducaoPreco OR :produtoComReducaoPreco = 'N')", .andWhere("(\"esvlistaprodutos\".produto_com_reducao_preco = :produtoComReducaoPreco OR :produtoComReducaoPreco = 'N')",
@ -188,8 +184,6 @@ export class SalesService {
.addSelect("\"esvlistaprodutos\".LINHATINTOMETRICO", "line") .addSelect("\"esvlistaprodutos\".LINHATINTOMETRICO", "line")
.addSelect("\"esvlistaprodutos\".LITRAGEM", "can") .addSelect("\"esvlistaprodutos\".LITRAGEM", "can")
.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 }) .where("UPPER(\"esvlistaprodutos\".descricao) LIKE '%'||REPLACE(:description, '@', '%')||'%'", { description })
.andWhere("(\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99')", { codfilial: store }) .andWhere("(\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99')", { codfilial: store })
.andWhere("(\"esvlistaprodutos\".produto_com_reducao_preco = :produtoComReducaoPreco OR :produtoComReducaoPreco = 'N')", .andWhere("(\"esvlistaprodutos\".produto_com_reducao_preco = :produtoComReducaoPreco OR :produtoComReducaoPreco = 'N')",
@ -266,8 +260,6 @@ export class SalesService {
.addSelect("\"esvlistaprodutos\".LINHATINTOMETRICO", "line") .addSelect("\"esvlistaprodutos\".LINHATINTOMETRICO", "line")
.addSelect("\"esvlistaprodutos\".LITRAGEM", "can") .addSelect("\"esvlistaprodutos\".LITRAGEM", "can")
.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.brand in (" + xbrands + ")") .where("esvlistaprodutos.brand in (" + xbrands + ")")
.andWhere("\"esvlistaprodutos\".URLCATEGORIA LIKE :urlCategoria||'%'", { urlCategoria: filter.urlCategory }) .andWhere("\"esvlistaprodutos\".URLCATEGORIA LIKE :urlCategoria||'%'", { urlCategoria: filter.urlCategory })
.andWhere("(\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99')", { codfilial: store }) .andWhere("(\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99')", { codfilial: store })
@ -332,8 +324,6 @@ export class SalesService {
.addSelect("\"esvlistaprodutos\".LINHATINTOMETRICO", "line") .addSelect("\"esvlistaprodutos\".LINHATINTOMETRICO", "line")
.addSelect("\"esvlistaprodutos\".LITRAGEM", "can") .addSelect("\"esvlistaprodutos\".LITRAGEM", "can")
.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\".codfilial = :codfilial OR :codfilial = '99')", { codfilial: store }) .where("(\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99')", { codfilial: store })
.andWhere("(\"esvlistaprodutos\".produto_com_reducao_preco = :produtoComReducaoPreco OR :produtoComReducaoPreco = 'N')", .andWhere("(\"esvlistaprodutos\".produto_com_reducao_preco = :produtoComReducaoPreco OR :produtoComReducaoPreco = 'N')",
{ produtoComReducaoPreco: (filter.markdown.toString() == 'true') ? 'S' : 'N' }) { produtoComReducaoPreco: (filter.markdown.toString() == 'true') ? 'S' : 'N' })
@ -572,8 +562,6 @@ export class SalesService {
.addSelect("\"esvlistaprodutos\".PRODUTO_EM_CAMPANHA", "compaing") .addSelect("\"esvlistaprodutos\".PRODUTO_EM_CAMPANHA", "compaing")
.addSelect("\"esvlistaprodutos\".BASETINTOMETRICO", "base") .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: numbers }) .where("esvlistaprodutos.idProduct = :id", { id: numbers })
.andWhere("\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99'", { codfilial: store }) .andWhere("\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99'", { codfilial: store })
.limit(pageSize) .limit(pageSize)
@ -620,9 +608,7 @@ export class SalesService {
.addSelect("\"esvlistaprodutos\".PRODUTO_COM_REDUCAO_PRECO", "downPrice") .addSelect("\"esvlistaprodutos\".PRODUTO_COM_REDUCAO_PRECO", "downPrice")
.addSelect("\"esvlistaprodutos\".PRODUTO_EM_CAMPANHA", "compaing") .addSelect("\"esvlistaprodutos\".PRODUTO_EM_CAMPANHA", "compaing")
.addSelect("\"esvlistaprodutos\".BASETINTOMETRICO", "base") .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 }) .where("esvlistaprodutos.CODAUXILIAR = :id", { id: numbers })
.andWhere("(\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99')", { codfilial: store }) .andWhere("(\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99')", { codfilial: store })
.limit(pageSize) .limit(pageSize)
@ -671,9 +657,7 @@ export class SalesService {
.addSelect("\"esvlistaprodutos\".PRODUTO_COM_REDUCAO_PRECO", "downPrice") .addSelect("\"esvlistaprodutos\".PRODUTO_COM_REDUCAO_PRECO", "downPrice")
.addSelect("\"esvlistaprodutos\".PRODUTO_EM_CAMPANHA", "compaing") .addSelect("\"esvlistaprodutos\".PRODUTO_EM_CAMPANHA", "compaing")
.addSelect("\"esvlistaprodutos\".BASETINTOMETRICO", "base") .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 }) .where("UPPER(esvlistaprodutos.CODFAB) like REPLACE(:description, '@', '%')", { description })
.andWhere("\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99'", { codfilial: store }) .andWhere("\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99'", { codfilial: store })
.limit(pageSize) .limit(pageSize)
@ -719,9 +703,7 @@ export class SalesService {
.addSelect("\"esvlistaprodutos\".PRODUTO_COM_REDUCAO_PRECO", "downPrice") .addSelect("\"esvlistaprodutos\".PRODUTO_COM_REDUCAO_PRECO", "downPrice")
.addSelect("\"esvlistaprodutos\".PRODUTO_EM_CAMPANHA", "compaing") .addSelect("\"esvlistaprodutos\".PRODUTO_EM_CAMPANHA", "compaing")
.addSelect("\"esvlistaprodutos\".BASETINTOMETRICO", "base") .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 }) .where("UPPER(esvlistaprodutos.DESCRICAO) like REPLACE(:description, '@', '%')", { description })
.andWhere("\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99'", { codfilial: store }) .andWhere("\"esvlistaprodutos\".codfilial = :codfilial OR :codfilial = '99'", { codfilial: store })
.limit(pageSize) .limit(pageSize)
@ -790,9 +772,7 @@ export class SalesService {
.addSelect("\"esvlistaprodutos\".PRODUTO_COM_REDUCAO_PRECO", "downPrice") .addSelect("\"esvlistaprodutos\".PRODUTO_COM_REDUCAO_PRECO", "downPrice")
.addSelect("\"esvlistaprodutos\".PRODUTO_EM_CAMPANHA", "compaing") .addSelect("\"esvlistaprodutos\".PRODUTO_EM_CAMPANHA", "compaing")
.addSelect("\"esvlistaprodutos\".BASETINTOMETRICO", "base") .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 }) .where("esvlistaprodutos.idProduct = :id", { id: id })
.andWhere("\"esvlistaprodutos\".codfilial = :codfilial", { codfilial: store }) .andWhere("\"esvlistaprodutos\".codfilial = :codfilial", { codfilial: store })
.orderBy("REPLACE(\"esvlistaprodutos\".DESCRICAO,'#', '')", "ASC") .orderBy("REPLACE(\"esvlistaprodutos\".DESCRICAO,'#', '')", "ASC")
@ -854,8 +834,6 @@ export class SalesService {
,esvlistaprodutos.PRODUTO_EM_CAMPANHA as "compaing" ,esvlistaprodutos.PRODUTO_EM_CAMPANHA as "compaing"
,esvlistaprodutos.BASETINTOMETRICO as "base" ,esvlistaprodutos.BASETINTOMETRICO as "base"
,esvlistaprodutos.QUANTIDADE_ESTOQUE_GERAL as "full_stock" ,esvlistaprodutos.QUANTIDADE_ESTOQUE_GERAL as "full_stock"
,esvlistaprodutos.TEM_PRODUTO_SIMILAR as "similar"
,esvlistaprodutos.TIPO_CAMPANHA as "type_campaing"
FROM ESVLISTAPRODUTOS, ESTCOMPREJUNTO FROM ESVLISTAPRODUTOS, ESTCOMPREJUNTO
WHERE ESVLISTAPRODUTOS.CODPROD = ESTCOMPREJUNTO.CODPROD WHERE ESVLISTAPRODUTOS.CODPROD = ESTCOMPREJUNTO.CODPROD
AND ESTCOMPREJUNTO.CODPRODVENDA = ${id} AND ESTCOMPREJUNTO.CODPRODVENDA = ${id}
@ -873,68 +851,6 @@ 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) { async GetStocks(storeId: string, id: number) {
const connectionDb = new Connection(connectionOptions); const connectionDb = new Connection(connectionOptions);
await connectionDb.connect(); await connectionDb.connect();
@ -1349,10 +1265,8 @@ export class SalesService {
' ,esvlistaprodutos.LINHATINTOMETRICO "line" ' + ' ,esvlistaprodutos.LINHATINTOMETRICO "line" ' +
' ,esvlistaprodutos.LITRAGEM "can" ' + ' ,esvlistaprodutos.LITRAGEM "can" ' +
' ,esvlistaprodutos.QUANTIDADE_ESTOQUE_GERAL "full_stock" ' + ' ,esvlistaprodutos.QUANTIDADE_ESTOQUE_GERAL "full_stock" ' +
' ,esvlistaprodutos.TEM_PRODUTO_SIMILAR "similar" ' +
' ,esvlistaprodutos.TIPO_CAMPANHA "type_campaing" ' +
' FROM esvlistaprodutos ' + ' FROM esvlistaprodutos ' +
' WHERE 1 = 1 '; ' WHERE 1 = 1';
let where = ""; let where = "";
if (filter.text != null) { if (filter.text != null) {

View File

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