commit
This commit is contained in:
3
src/.vscode/settings.json
vendored
Normal file
3
src/.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"js/ts.implicitProjectConfig.experimentalDecorators": true
|
||||
}
|
||||
48
src/Auth/access-control/access-control.controller.ts
Normal file
48
src/Auth/access-control/access-control.controller.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
https://docs.nestjs.com/controllers#controllers
|
||||
*/
|
||||
|
||||
import { Body, Controller, Get, Param, Post } from '@nestjs/common';
|
||||
import { AccessControlService } from './access-control.service';
|
||||
import { ApiExcludeEndpoint } from '@nestjs/swagger';
|
||||
|
||||
@Controller('api/v1/access-control')
|
||||
export class AccessControlController {
|
||||
|
||||
constructor(
|
||||
private readonly accessControlService: AccessControlService
|
||||
){}
|
||||
|
||||
@Get('modules/:id')
|
||||
@ApiExcludeEndpoint()
|
||||
async getModules(@Param('id') id: number) {
|
||||
return this.accessControlService.getAccessModule(id);
|
||||
}
|
||||
|
||||
@Get('permissionUser/:id')
|
||||
@ApiExcludeEndpoint()
|
||||
async getPermissionsUser(@Param('id') id: number) {
|
||||
return this.accessControlService.getPermissionsUser(id);
|
||||
}
|
||||
|
||||
@Get('pages/:userId/:moduleId')
|
||||
@ApiExcludeEndpoint()
|
||||
async getPagesUser(@Param('userId') userId: number, @Param('moduleId') moduleId: number) {
|
||||
return this.accessControlService.getPagesUser(moduleId, userId);
|
||||
}
|
||||
|
||||
@Get('actions/:userId/:moduleId')
|
||||
@ApiExcludeEndpoint()
|
||||
async getActionUser(@Param('userId') userId: number, @Param('moduleId') moduleId: number
|
||||
) {
|
||||
return this.accessControlService.getActionsUser(moduleId, userId);
|
||||
}
|
||||
|
||||
@Post('permissionUser/:id')
|
||||
@ApiExcludeEndpoint()
|
||||
async updatePermission(@Param('id') userId: number, @Body() data
|
||||
) {
|
||||
return this.accessControlService.updatePermissionUser(userId, data);
|
||||
}
|
||||
|
||||
}
|
||||
16
src/Auth/access-control/access-control.module.ts
Normal file
16
src/Auth/access-control/access-control.module.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { AccessControlService } from './access-control.service';
|
||||
import { AccessControlController } from './access-control.controller';
|
||||
/*
|
||||
https://docs.nestjs.com/modules
|
||||
*/
|
||||
|
||||
import { Module } from '@nestjs/common';
|
||||
|
||||
@Module({
|
||||
imports: [],
|
||||
controllers: [
|
||||
AccessControlController,],
|
||||
providers: [
|
||||
AccessControlService,],
|
||||
})
|
||||
export class AccessControlModule { }
|
||||
261
src/Auth/access-control/access-control.service.ts
Normal file
261
src/Auth/access-control/access-control.service.ts
Normal file
@@ -0,0 +1,261 @@
|
||||
/*
|
||||
https://docs.nestjs.com/providers#services
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { connectionOptions } from 'src/configs/typeorm.config';
|
||||
import { Connection } from 'typeorm';
|
||||
import { IndexActions } from '../../domain/models/index-action.model';
|
||||
|
||||
@Injectable()
|
||||
export class AccessControlService {
|
||||
|
||||
async getAccessModule(id: number) {
|
||||
const connection = new Connection(connectionOptions);
|
||||
await connection.connect();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
|
||||
const sql = 'SELECT ESTACESSOMODULO.CODMODULO as "moduleId" ' +
|
||||
' ,ESTACESSOMODULO.CODUSUARIO as "userId" ' +
|
||||
` ,NVL(ESTACESSOMODULO.ACESSO, 'S') as "access" ` +
|
||||
' FROM ESTACESSOMODULO ' +
|
||||
' WHERE ESTACESSOMODULO.CODUSUARIO = :1';
|
||||
|
||||
const modules = await queryRunner
|
||||
.query(sql, [id]);
|
||||
|
||||
return modules;
|
||||
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
await connection.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async getPagesUser(moduleId: number, userId: number) {
|
||||
const connection = new Connection(connectionOptions);
|
||||
await connection.connect();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
|
||||
const sql = 'SELECT ESTACESSOATIVIDADE.CODMODULO as "moduleId" ' +
|
||||
' ,ESTACESSOATIVIDADE.CODPROCESSO as "processId" ' +
|
||||
' ,ESTACESSOATIVIDADE.CODATIVIDADE as "pageId" ' +
|
||||
' ,ESTACESSOATIVIDADE.codusuario as "userId" ' +
|
||||
' ,ESTACESSOATIVIDADE.ACESSO as "access" ' +
|
||||
' FROM ESTACESSOATIVIDADE ' +
|
||||
' WHERE ESTACESSOATIVIDADE.CODMODULO = :CODMODULO ' +
|
||||
' AND ESTACESSOATIVIDADE.CODUSUARIO = :CODUSUARIO ';
|
||||
|
||||
const pages = await queryRunner
|
||||
.query(sql, [moduleId, userId]);
|
||||
|
||||
return pages;
|
||||
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
await connection.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
async getActionsUser(moduleId: number, userId: number) {
|
||||
const connection = new Connection(connectionOptions);
|
||||
await connection.connect();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
|
||||
const sql = `SELECT ESTACESSOATIVIDADEACAO.CODMODULO as "moduleId"
|
||||
,ESTACESSOATIVIDADEACAO.CODPROCESSO as "processId"
|
||||
,ESTACESSOATIVIDADEACAO.CODATIVIDADE as "pageId"
|
||||
,ESTACESSOATIVIDADEACAO.CODACAO as "actionId"
|
||||
,ESTACESSOATIVIDADEACAO.codusuario as "userId"
|
||||
,ESTACESSOATIVIDADEACAO.ACESSO as "access"
|
||||
FROM ESTACESSOATIVIDADEACAO
|
||||
WHERE ESTACESSOATIVIDADEACAO.CODMODULO = :CODMODULO
|
||||
AND ESTACESSOATIVIDADEACAO.CODUSUARIO = :CODUSUARIO`;
|
||||
|
||||
const actions = await queryRunner
|
||||
.query(sql, [moduleId, userId]);
|
||||
|
||||
return actions;
|
||||
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
await connection.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async getPermissionsUser(userId: number) {
|
||||
const sqlModules = `SELECT ESTMODULO.codmodulo as "id"
|
||||
,ESTMODULO.descricao as "text"
|
||||
,${userId} as "userId"
|
||||
,NVL(( SELECT ESTACESSOMODULO.ACESSO
|
||||
FROM ESTACESSOMODULO
|
||||
WHERE ESTACESSOMODULO.CODMODULO = ESTMODULO.CODMODULO
|
||||
AND ESTACESSOMODULO.CODUSUARIO = ${userId} AND ROWNUM = 1),'N') as "allow"
|
||||
FROM ESTMODULO`;
|
||||
|
||||
const sqlAtividade = `SELECT ESTATIVIDADE.codmodulo as "moduloId"
|
||||
,ESTATIVIDADE.CODPROCESSO as "processId"
|
||||
,ESTATIVIDADE.CODATIVIDADE as "id"
|
||||
,ESTATIVIDADE.descricao as "text"
|
||||
,NVL(( SELECT ESTACESSOATIVIDADE.ACESSO
|
||||
FROM ESTACESSOATIVIDADE
|
||||
WHERE ESTACESSOATIVIDADE.CODMODULO = ESTATIVIDADE.CODMODULO
|
||||
AND ESTACESSOATIVIDADE.CODPROCESSO = ESTATIVIDADE.codprocesso
|
||||
AND ESTACESSOATIVIDADE.CODATIVIDADE = ESTATIVIDADE.CODATIVIDADE
|
||||
AND ESTACESSOATIVIDADE.CODUSUARIO = ${userId} AND ROWNUM = 1),'N') as "allow"
|
||||
FROM ESTATIVIDADE`;
|
||||
|
||||
const sqlAction = `SELECT estatividadeacao.codmodulo as "moduloId"
|
||||
,estatividadeacao.CODPROCESSO as "processId"
|
||||
,estatividadeacao.CODATIVIDADE as "atividadeId"
|
||||
,estatividadeacao.CODACAO as "Id"
|
||||
,estatividadeacao.descricao as "text"
|
||||
,NVL(( SELECT ESTACESSOATIVIDADEACAO.ACESSO
|
||||
FROM ESTACESSOATIVIDADEACAO
|
||||
WHERE ESTACESSOATIVIDADEACAO.CODMODULO = estatividadeacao.CODMODULO
|
||||
AND ESTACESSOATIVIDADEACAO.CODPROCESSO = estatividadeacao.codprocesso
|
||||
AND ESTACESSOATIVIDADEACAO.CODATIVIDADE = estatividadeacao.CODATIVIDADE
|
||||
AND ESTACESSOATIVIDADEACAO.CODACAO = estatividadeacao.CODACAO
|
||||
AND ESTACESSOATIVIDADEACAO.CODUSUARIO = ${userId} AND ROWNUM = 1),'N') as "allow"
|
||||
FROM estatividadeacao`;
|
||||
|
||||
const connection = new Connection(connectionOptions);
|
||||
await connection.connect();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
|
||||
const modules = await queryRunner.query(sqlModules);
|
||||
const atividades = await queryRunner.query(sqlAtividade);
|
||||
const actions = await queryRunner.query(sqlAction);
|
||||
|
||||
console.log("acoes:" + JSON.stringify(actions));
|
||||
console.log("atividaes:" + JSON.stringify(atividades));
|
||||
|
||||
const arrayAtividade = [];
|
||||
atividades.map((atividade) => {
|
||||
const data = {
|
||||
...atividade, items: [...actions.filter((a) => a.moduloId == atividade.moduloId
|
||||
&& a.processId == atividade.processId &&
|
||||
a.atividadeId == atividade.id)]
|
||||
}
|
||||
arrayAtividade.push(data);
|
||||
});
|
||||
|
||||
console.log("atividade acao: " + JSON.stringify(arrayAtividade));
|
||||
|
||||
const arrayModules = [];
|
||||
modules.map((module) => {
|
||||
const data = {
|
||||
...module, items: [...arrayAtividade.filter((a) => a.moduloId == module.id)]
|
||||
}
|
||||
arrayModules.push(data);
|
||||
});
|
||||
|
||||
return arrayModules;
|
||||
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
await connection.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async updatePermissionUser(userId: number, data: any) {
|
||||
console.log(JSON.stringify(data));
|
||||
const connection = new Connection(connectionOptions);
|
||||
await connection.connect();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
await queryRunner.startTransaction();
|
||||
try {
|
||||
const sqlDeletePermissionUser = `BEGIN
|
||||
DELETE FROM ESTACESSOMODULO WHERE CODUSUARIO = ${userId};
|
||||
DELETE FROM ESTACESSOATIVIDADE WHERE CODUSUARIO = ${userId};
|
||||
DELETE FROM ESTACESSOATIVIDADEACAO WHERE CODUSUARIO = ${userId};
|
||||
END;
|
||||
`;
|
||||
await queryRunner.query(sqlDeletePermissionUser);
|
||||
|
||||
for (const action of data.actions) {
|
||||
const sqlCreatePermissionAction = `BEGIN
|
||||
UPDATE ESTACESSOATIVIDADEACAO SET
|
||||
ACESSO = 'S'
|
||||
WHERE CODMODULO = ${action.moduloId} AND CODPROCESSO = ${action.processId}
|
||||
AND CODATIVIDADE = ${action.atividadeId} AND CODACAO = ${action.Id} AND CODUSUARIO = ${userId};
|
||||
|
||||
IF SQL%ROWCOUNT = 0 THEN
|
||||
INSERT INTO ESTACESSOATIVIDADEACAO ( CODMODULO, CODPROCESSO, CODATIVIDADE, CODACAO, CODUSUARIO, ACESSO )
|
||||
VALUES ( ${action.moduloId}, ${action.processId}, ${action.atividadeId}, ${action.Id}, ${userId},'S');
|
||||
END IF;
|
||||
|
||||
UPDATE ESTACESSOATIVIDADE SET
|
||||
ACESSO = 'S'
|
||||
WHERE CODMODULO = ${action.moduloId} AND CODPROCESSO = ${action.processId}
|
||||
AND CODATIVIDADE = ${action.atividadeId} AND CODUSUARIO = ${userId};
|
||||
|
||||
IF SQL%ROWCOUNT = 0 THEN
|
||||
INSERT INTO ESTACESSOATIVIDADE ( CODMODULO, CODPROCESSO, CODATIVIDADE, CODUSUARIO, ACESSO )
|
||||
VALUES ( ${action.moduloId}, ${action.processId}, ${action.atividadeId}, ${userId},'S');
|
||||
END IF;
|
||||
|
||||
UPDATE ESTACESSOMODULO SET
|
||||
ACESSO = 'S'
|
||||
WHERE CODMODULO = ${action.moduloId} AND CODUSUARIO = ${userId};
|
||||
|
||||
IF SQL%ROWCOUNT = 0 THEN
|
||||
INSERT INTO ESTACESSOMODULO ( CODMODULO, CODUSUARIO, ACESSO )
|
||||
VALUES ( ${action.moduloId}, ${userId}, 'S');
|
||||
END IF;
|
||||
END; `
|
||||
await queryRunner.query(sqlCreatePermissionAction);
|
||||
}
|
||||
|
||||
for (const atividade of data.atividades) {
|
||||
const sqlCreatePermissionAtividade = `BEGIN
|
||||
UPDATE ESTACESSOATIVIDADE SET
|
||||
ACESSO = 'S'
|
||||
WHERE CODMODULO = ${atividade.moduloId} AND CODPROCESSO = ${atividade.processId}
|
||||
AND CODATIVIDADE = ${atividade.id} AND CODUSUARIO = ${userId};
|
||||
|
||||
IF SQL%ROWCOUNT = 0 THEN
|
||||
INSERT INTO ESTACESSOATIVIDADE ( CODMODULO, CODPROCESSO, CODATIVIDADE, CODUSUARIO, ACESSO )
|
||||
VALUES ( ${atividade.moduloId}, ${atividade.processId}, ${atividade.id}, ${userId},'S');
|
||||
END IF;
|
||||
|
||||
UPDATE ESTACESSOMODULO SET
|
||||
ACESSO = 'S'
|
||||
WHERE CODMODULO = ${atividade.moduloId} AND CODUSUARIO = ${userId};
|
||||
|
||||
IF SQL%ROWCOUNT = 0 THEN
|
||||
INSERT INTO ESTACESSOMODULO ( CODMODULO, CODUSUARIO, ACESSO )
|
||||
VALUES ( ${atividade.moduloId}, ${userId},'S');
|
||||
END IF;
|
||||
END; `;
|
||||
await queryRunner.query(sqlCreatePermissionAtividade);
|
||||
}
|
||||
|
||||
await queryRunner.commitTransaction();
|
||||
} catch (err) {
|
||||
await queryRunner.rollbackTransaction();
|
||||
console.log(err);
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
await connection.close();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
10
src/Auth/auth.module.ts
Normal file
10
src/Auth/auth.module.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
|
||||
|
||||
@Module({
|
||||
imports: [],
|
||||
controllers: [],
|
||||
providers: [],
|
||||
|
||||
})
|
||||
export class AuthModule { }
|
||||
132
src/Auth/controllers/user.controller.ts
Normal file
132
src/Auth/controllers/user.controller.ts
Normal file
@@ -0,0 +1,132 @@
|
||||
import { ResultModel } from '../../domain/models/result.model';
|
||||
import { UserModel } from '../../domain/models/user.model';
|
||||
import { RoleInterceptor } from '../interceptors/role.interceptor';
|
||||
import { JwtAuthGuard } from '../guards/auth.guard';
|
||||
|
||||
import { AuthService } from '../services/auth.service';
|
||||
import { UserService } from '../services/user.service';
|
||||
import { Body, Controller, Get, HttpException, HttpStatus, Param, Post, Req, UseGuards, UseInterceptors } from "@nestjs/common";
|
||||
import { Guid } from 'guid-typescript';
|
||||
import { ResetPasswordModel } from 'src/domain/models/reset-password.model';
|
||||
import { ChangePasswordModel } from 'src/domain/models/change-password.model';
|
||||
import { CreateUserModel } from 'src/domain/models/create-user.model';
|
||||
import { ApiExcludeEndpoint, ApiTags } from '@nestjs/swagger';
|
||||
|
||||
@ApiTags('Autenticação')
|
||||
@Controller('api/v1/auth')
|
||||
export class UserController {
|
||||
constructor(private authService: AuthService,
|
||||
private userService: UserService) { }
|
||||
|
||||
/**
|
||||
* Realiza a autenticação do usuário para acesso a vendaweb.
|
||||
* @@example { email: "exemplo@exemplo.com", password: "123456"}
|
||||
*/
|
||||
|
||||
|
||||
@Get('users')
|
||||
async getUsers() {
|
||||
return this.userService.findAll();
|
||||
}
|
||||
|
||||
@Post('login')
|
||||
async login(@Body() model: UserModel): Promise<any> {
|
||||
const userDb = await this.userService.authenticate(model);
|
||||
if (!userDb)
|
||||
throw new HttpException(new ResultModel(false, 'Usuário ou senha inválidos.', null, null), HttpStatus.UNAUTHORIZED);
|
||||
if (userDb.blocked == "S")
|
||||
throw new HttpException(new ResultModel(false, 'Usuário inativo.', null, null), HttpStatus.UNAUTHORIZED);
|
||||
if (model.application == "SALE" && userDb.seller == 0)
|
||||
throw new HttpException(new ResultModel(false, 'Usuário sem vendedor informado .', null, null), HttpStatus.UNAUTHORIZED);
|
||||
if (model.application == "SALE" && (userDb.codigoFilial == null || userDb.codigoFilial == ''))
|
||||
throw new HttpException(new ResultModel(false, 'Usuário sem filial informada.', null, null), HttpStatus.UNAUTHORIZED);
|
||||
|
||||
const token = await this.authService.createToken(userDb.username, userDb.email, '', [userDb.sectorId, userDb.sectorManagerId]);
|
||||
|
||||
return new ResultModel(true, null, {
|
||||
"id": userDb.id, "username": userDb.userName, "email": userDb.email,
|
||||
"store": userDb.codigoFilial, "name": userDb.nomeFilial, "seller": userDb.seller,
|
||||
"deliveryTime": userDb.deliveryTime, "supervisorId": userDb.supervisorId, "token": token
|
||||
}, null);
|
||||
}
|
||||
|
||||
@Post('create')
|
||||
async createUser(@Body() model: CreateUserModel): Promise<any> {
|
||||
const result = await this.userService.create(model);
|
||||
console.log(result);
|
||||
return result;
|
||||
/*if (!userDb)
|
||||
throw new HttpException(new ResultModel(false, 'Usuário ou senha inválidos.', null, null), HttpStatus.UNAUTHORIZED);
|
||||
if (userDb.blocked == "S")
|
||||
throw new HttpException(new ResultModel(false, 'Usuário inativo.', null, null), HttpStatus.UNAUTHORIZED);
|
||||
const token = await this.authService.createToken(userDb.username, userDb.email, '', [userDb.role, model.application]);
|
||||
|
||||
return new ResultModel(true, null, {"username": userDb.username, "email": userDb.email, "token": token}, null);*/
|
||||
}
|
||||
|
||||
@Post('reset-password')
|
||||
async resetPassword(@Body() model: ResetPasswordModel): Promise<any> {
|
||||
try {
|
||||
//TODO: Enviar email com a senha
|
||||
const password = Guid.create.toString().substring(0, 8).replace('-', '');
|
||||
await this.userService.update(model.email, password);
|
||||
return new ResultModel(true, 'Uma nova senha foi enviada para seu e-mail.', null, null);
|
||||
|
||||
} catch (error) {
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível restaurar sua senha', null, null), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@Post('change-password')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
async changePassword(@Req() request, @Body() model: ChangePasswordModel): Promise<any> {
|
||||
try {
|
||||
//TODO: Encriptar senha
|
||||
//TODO: Validar usuario
|
||||
await this.userService.update(request.user.email, model.newPassword);
|
||||
return new ResultModel(true, 'Sua senha foi alterada com sucesso', null, null);
|
||||
} catch (error) {
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível alterar sua senha', null, null), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@Get('discount-user/:id')
|
||||
async discountAuthorization(@Param('id') id: number): Promise<any> {
|
||||
const user = await this.userService.discountUser(id);
|
||||
console.log(user);
|
||||
return new ResultModel(true, null, user, null);
|
||||
}
|
||||
|
||||
@Post('refresh')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
async refreshToken(@Req() request): Promise<any> {
|
||||
const token = await this.authService.createToken(request.user.username, request.user.email, request.user.image, request.user.roles);
|
||||
return new ResultModel(true, null, token, null);
|
||||
}
|
||||
|
||||
@Post('authenticate')
|
||||
@ApiExcludeEndpoint()
|
||||
async authenticate(@Body() model: UserModel): Promise<any> {
|
||||
const userDb = await this.userService.authenticate(model);
|
||||
console.log(userDb);
|
||||
if (!userDb)
|
||||
throw new HttpException(new ResultModel(false, 'Usuário ou senha inválidos.', null, null), HttpStatus.UNAUTHORIZED);
|
||||
if (userDb.blocked == "S")
|
||||
throw new HttpException(new ResultModel(false, 'Usuário inativo.', null, null), HttpStatus.UNAUTHORIZED);
|
||||
|
||||
return new ResultModel(true, null, {
|
||||
"id": userDb.id, "username": userDb.userName, "email": userDb.email,
|
||||
"store": userDb.codigoFilial, "seller": userDb.seller, "discountPercent": userDb.discountPercent,
|
||||
"sectorId": userDb.sectorId, "sectorManagerId": userDb.sectorManagerId
|
||||
}, null);
|
||||
}
|
||||
|
||||
|
||||
@Get('')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@UseInterceptors(new RoleInterceptor(['admin']))
|
||||
findAll() {
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
||||
17
src/Auth/guards/auth.guard.ts
Normal file
17
src/Auth/guards/auth.guard.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { ExecutionContext, Injectable, UnauthorizedException } from "@nestjs/common";
|
||||
|
||||
@Injectable()
|
||||
export class JwtAuthGuard extends AuthGuard() {
|
||||
canActivate(context: ExecutionContext) {
|
||||
return super.canActivate(context);
|
||||
}
|
||||
|
||||
handleRequest(err: any, user: any, info: any) {
|
||||
if (err || !user) {
|
||||
throw err || new UnauthorizedException();
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
}
|
||||
32
src/Auth/interceptors/role.interceptor.ts
Normal file
32
src/Auth/interceptors/role.interceptor.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { HttpStatus } from '@nestjs/common';
|
||||
import { ResultModel } from './../../domain/models/result.model';
|
||||
import { HttpException } from '@nestjs/common';
|
||||
import { JwtPayload } from './../interfaces/jwt-payload.interface';
|
||||
import { Injectable, NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class RoleInterceptor implements NestInterceptor {
|
||||
|
||||
constructor(private roles: string[]){}
|
||||
|
||||
intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
|
||||
const payload: JwtPayload = context.switchToHttp().getRequest().user;
|
||||
console.log(payload);
|
||||
|
||||
let hasRole = false;
|
||||
payload.roles.forEach((role) => {
|
||||
if (this.roles.includes(role))
|
||||
hasRole = true;
|
||||
});
|
||||
|
||||
if (!hasRole) {
|
||||
throw new HttpException(
|
||||
new ResultModel(false, 'Acesso não autorizado', null, null),
|
||||
HttpStatus.FORBIDDEN
|
||||
)
|
||||
}
|
||||
return next
|
||||
.handle();
|
||||
}
|
||||
}
|
||||
8
src/Auth/interfaces/jwt-payload.interface.ts
Normal file
8
src/Auth/interfaces/jwt-payload.interface.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export interface JwtPayload {
|
||||
username: string;
|
||||
email: string;
|
||||
image: string;
|
||||
sectorId: string;
|
||||
sectorManagerId: string;
|
||||
roles: string[];
|
||||
}
|
||||
24
src/Auth/services/auth.service.ts
Normal file
24
src/Auth/services/auth.service.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { JwtPayload } from './../interfaces/jwt-payload.interface';
|
||||
import { JwtService, JwtSignOptions } from "@nestjs/jwt";
|
||||
import { UserService } from './user.service';
|
||||
|
||||
@Injectable()
|
||||
export class AuthService {
|
||||
constructor(
|
||||
private readonly accountService: UserService,
|
||||
private readonly jwtService: JwtService,
|
||||
){}
|
||||
|
||||
async createToken(username: string, email: string, image: string, roles: string[]) {
|
||||
const user: JwtPayload = { username: username, email: email, image: image, sectorId: roles[0], sectorManagerId: roles[1], roles: [], }
|
||||
const options: JwtSignOptions = {expiresIn: "1h"};
|
||||
return this.jwtService.sign(user, options);
|
||||
}
|
||||
|
||||
async validateUser(payload: JwtPayload): Promise<any> {
|
||||
//return await this.accountService.findOneByUsername(payload.username);
|
||||
return payload;
|
||||
}
|
||||
|
||||
}
|
||||
197
src/Auth/services/user.service.ts
Normal file
197
src/Auth/services/user.service.ts
Normal file
@@ -0,0 +1,197 @@
|
||||
import { UserModel } from '../../domain/models/user.model';
|
||||
import { HttpException, HttpStatus, Injectable } from "@nestjs/common";
|
||||
import { User } from 'src/domain/entity/tables/estusuario.enity';
|
||||
import { Connection, getConnection } from 'typeorm';
|
||||
import md5 = require('md5');
|
||||
import { CreateUserModel } from 'src/domain/models/create-user.model';
|
||||
import { Pcempr } from '../../domain/entity/tables/pcempr.entity';
|
||||
import { connectionOptions } from 'src/configs/typeorm.config';
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class UserService {
|
||||
|
||||
async create(data: CreateUserModel): Promise<User> {
|
||||
const connection = getConnection();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
|
||||
try {
|
||||
const user = await queryRunner.manager
|
||||
.getRepository(User)
|
||||
.createQueryBuilder('estusuario')
|
||||
.where("\"estusuario\".email = :email", { email: data.email })
|
||||
.getOne();
|
||||
if (user != null) {
|
||||
throw new HttpException("Já existe um usuário cadastrado no sistema com este email", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
} catch (err) {
|
||||
throw err;
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
}
|
||||
|
||||
const newUser = new User();
|
||||
newUser.username = data.userName;
|
||||
newUser.password = md5(data.password).toUpperCase();
|
||||
newUser.email = data.email;
|
||||
newUser.role = data.application;
|
||||
newUser.blocked = "N";
|
||||
newUser.registration = data.registration;
|
||||
|
||||
await getConnection()
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(User)
|
||||
.values(newUser)
|
||||
.execute();
|
||||
|
||||
return newUser;
|
||||
|
||||
}
|
||||
|
||||
async findAll() {
|
||||
const sqlUsers = `SELECT PCEMPR.MATRICULA as "userId"
|
||||
,PCEMPR.NOME||' ('||PCEMPR.MATRICULA||')' as "name"
|
||||
,PCEMPR.USUARIOBD as "userBD"
|
||||
,PCEMPR.CODFILIAL as "storeId"
|
||||
,PCEMPR.FUNCAO as "function"
|
||||
,PCSETOR.DESCRICAO as "sector"
|
||||
FROM PCEMPR, PCSETOR
|
||||
WHERE PCEMPR.CODSETOR = PCSETOR.CODSETOR
|
||||
AND PCEMPR.DTDEMISSAO IS NULL
|
||||
ORDER BY PCEMPR.NOME`;
|
||||
const connection = getConnection();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
return await queryRunner.query(sqlUsers);
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
}
|
||||
}
|
||||
|
||||
async authenticate(user: UserModel): Promise<any> {
|
||||
const connection = new Connection(connectionOptions);
|
||||
await connection.connect();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
|
||||
const sql = 'SELECT PCEMPR.matricula as \"id\" ' +
|
||||
' ,PCEMPR.usuariobd as \"userName\" ' +
|
||||
' ,PCEMPR.codfilial as \"codigoFilial\" ' +
|
||||
' ,PCFILIAL.fantasia as \"nomeFilial\" ' +
|
||||
' ,PCEMPR.codusur as \"seller\" ' +
|
||||
' ,NVL(PCEMPR.percdesc,0) as \"discountPercent\" ' +
|
||||
' ,NVL(PCEMPR.codsetor,0) as \"sectorId\" ' +
|
||||
' ,NVL(PCPARAMFILIAL.valor,0) as \"sectorManagerId\" ' +
|
||||
' ,( SELECT PCUSUARI.CODSUPERVISOR FROM PCUSUARI WHERE PCUSUARI.CODUSUR = PCEMPR.CODUSUR ) as \"supervisorId\" ' +
|
||||
' ,( SELECT NVL(P.valor,0) FROM PCPARAMFILIAL P WHERE P.CODFILIAL = \'99\' AND ' +
|
||||
' P.NOME = \'CON_PRAZOENTREGA\' ) as \"deliveryTime\" ' +
|
||||
' FROM PCEMPR, PCFILIAL, PCPARAMFILIAL ' +
|
||||
' WHERE PCEMPR.CODFILIAL = PCFILIAL.CODIGO (+)' +
|
||||
' AND PCPARAMFILIAL.CODFILIAL = \'99\' ' +
|
||||
' AND PCPARAMFILIAL.NOME = \'CON_CODSETORGERENTELOJA\' ' +
|
||||
' AND PCEMPR.EMAIL = :username AND PCEMPR.SENHABD = CRYPT(:password, USUARIOBD)';
|
||||
|
||||
const users = await queryRunner.manager
|
||||
.query(sql, [user.email, user.password]);
|
||||
|
||||
if (users.length == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// const sqlDiasUteis = 'SELECT ( mv_prox_diautil( (TRUNC(SYSDATE) + :1) + COUNT(1), :2 ) - TRUNC(SYSDATE) ) as "days" ' +
|
||||
// ' FROM MVDIASUTEIS ' +
|
||||
// ' WHERE MVDIASUTEIS.CODFILIAL = :3 ' +
|
||||
// ` AND MVDIASUTEIS.diaentrega = 'N' ` +
|
||||
// ` AND MVDIASUTEIS.data BETWEEN TRUNC(SYSDATE) AND TRUNC(SYSDATE) + :4 `;
|
||||
|
||||
// const sqlDiasUteis = `SELECT CASE WHEN mv_prox_diautil(TRUNC(SYSDATE), :1) > TRUNC(SYSDATE) THEN
|
||||
// ( ( mv_prox_diautil((mv_prox_diautil(TRUNC(SYSDATE), :2) + :3) + COUNT(1), :4 ) - (mv_prox_diautil(TRUNC(SYSDATE), :5)) ) - 1 )
|
||||
// ELSE ( mv_prox_diautil((mv_prox_diautil(TRUNC(SYSDATE), :6) + :7) + COUNT(1), :8 ) - (mv_prox_diautil(TRUNC(SYSDATE), :9)) ) END as "days"
|
||||
// FROM MVDIASUTEIS
|
||||
// WHERE MVDIASUTEIS.CODFILIAL = :10
|
||||
// AND MVDIASUTEIS.diaentrega = 'N'
|
||||
// AND MVDIASUTEIS.data BETWEEN mv_prox_diautil(TRUNC(SYSDATE), :11) AND mv_prox_diautil(TRUNC(SYSDATE), :12) + :13`;
|
||||
|
||||
// const deliveryDays = await queryRunner.manager
|
||||
// .query(sqlDiasUteis, ['6',
|
||||
// '6', Number.parseInt(users[0].deliveryTime), '6', '6',
|
||||
// '6', Number.parseInt(users[0].deliveryTime), '6', '6',
|
||||
// '6',
|
||||
// '6', '6', Number.parseInt(users[0].deliveryTime)
|
||||
// ]);
|
||||
|
||||
const sqlDiasEntrega = `SELECT ( MAX(MVDIASUTEIS.DATA) - TRUNC(SYSDATE) ) as "days"
|
||||
FROM MVDIASUTEIS
|
||||
WHERE MVDIASUTEIS.data BETWEEN TRUNC(SYSDATE)
|
||||
AND TRUNC(SYSDATE) + :dias`;
|
||||
|
||||
const sqlDiasSemEntrega = `SELECT GREATEST(COUNT(1) - 1,0) as "daysNoDelivery"
|
||||
FROM MVDIASUTEIS
|
||||
WHERE MVDIASUTEIS.data BETWEEN TRUNC(SYSDATE)
|
||||
AND TRUNC(SYSDATE) + :dias
|
||||
AND MVDIASUTEIS.DIAENTREGA = 'N'`;
|
||||
|
||||
const deliveryDays2 = await queryRunner.manager
|
||||
.query(sqlDiasEntrega, [Number.parseInt(users[0].deliveryTime)]);
|
||||
|
||||
const noDeliveryDays = await queryRunner.manager
|
||||
.query(sqlDiasSemEntrega, [Number.parseInt(users[0].deliveryTime)]);
|
||||
|
||||
const days = Number.parseInt(deliveryDays2[0].days) +
|
||||
( noDeliveryDays.length > 0 ? Number.parseInt(noDeliveryDays[0].daysNoDelivery) : 0 );
|
||||
|
||||
const userDb = users[0];
|
||||
console.log(userDb);
|
||||
if (!isNaN(days)) {
|
||||
userDb.deliveryTime = days; // deliveryDays[0].days;
|
||||
}
|
||||
console.log(days);
|
||||
console.log(userDb);
|
||||
return userDb;
|
||||
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
await connection.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
async discountUser(userId: number): Promise<any> {
|
||||
const connection = getConnection();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
return await queryRunner.manager
|
||||
.getRepository(Pcempr)
|
||||
.createQueryBuilder('pcempr')
|
||||
.select("NVL(\"pcempr\".percdesc,0) as \"discountUser\"")
|
||||
.where("MATRICULA = :userId", { userId })
|
||||
.getRawOne(); //...authUser,
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
}
|
||||
}
|
||||
|
||||
async update(email: string, newPassword: string) {
|
||||
const connection = getConnection();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
return await queryRunner.manager
|
||||
.createQueryBuilder()
|
||||
.update(User)
|
||||
.set({ password: newPassword })
|
||||
.where("EMAIL = :email", { email })
|
||||
.execute();
|
||||
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
24
src/Auth/strategies/jwt-strategy.ts
Normal file
24
src/Auth/strategies/jwt-strategy.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { JwtPayload } from './../interfaces/jwt-payload.interface';
|
||||
import { Injectable, UnauthorizedException } from "@nestjs/common";
|
||||
import { PassportStrategy } from "@nestjs/passport";
|
||||
import { AuthService } from "../services/auth.service";
|
||||
import { ExtractJwt, Strategy } from 'passport-jwt';
|
||||
|
||||
@Injectable()
|
||||
export class JwtStrategy extends PassportStrategy(Strategy) {
|
||||
constructor(private readonly authService: AuthService){
|
||||
super({
|
||||
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
||||
secretOrKeyProvider: '4557C0D7-DFB0-40DA-BF83-91A75103F7A9', //secretOrKey
|
||||
})
|
||||
}
|
||||
|
||||
async validate(payload: JwtPayload) {
|
||||
const user = await this.authService.validateUser(payload);
|
||||
if (!user) {
|
||||
throw new UnauthorizedException();
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
}
|
||||
22
src/Interceptors/validador.interceptor.ts
Normal file
22
src/Interceptors/validador.interceptor.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { ResultModel } from './../domain/models/result.model';
|
||||
import { Contract } from './../contracts/contract';
|
||||
import { CallHandler, ExecutionContext, HttpException, HttpStatus, NestInterceptor } from "@nestjs/common";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
export class ValidadorInterceptor implements NestInterceptor {
|
||||
constructor(public contract: Contract){}
|
||||
|
||||
intercept(context: ExecutionContext, next: CallHandler<any>): Observable<any> {
|
||||
const body = context.switchToHttp().getRequest().body;
|
||||
const valid = this.contract.validade(body);
|
||||
|
||||
if (!valid) {
|
||||
throw new HttpException(new ResultModel(false, 'Ops, algo saiu errado!', null, this.contract.errors), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
return next.handle();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
22
src/app.controller.spec.ts
Normal file
22
src/app.controller.spec.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { AppController } from './app.controller';
|
||||
import { AppService } from './app.service';
|
||||
|
||||
describe('AppController', () => {
|
||||
let appController: AppController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const app: TestingModule = await Test.createTestingModule({
|
||||
controllers: [AppController],
|
||||
providers: [AppService],
|
||||
}).compile();
|
||||
|
||||
appController = app.get<AppController>(AppController);
|
||||
});
|
||||
|
||||
describe('root', () => {
|
||||
it('should return "Hello World!"', () => {
|
||||
expect(appController.getHello()).toBe('Hello World!');
|
||||
});
|
||||
});
|
||||
});
|
||||
14
src/app.controller.ts
Normal file
14
src/app.controller.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Controller, Get } from '@nestjs/common';
|
||||
import { AppService } from './app.service';
|
||||
import { ApiExcludeEndpoint } from '@nestjs/swagger';
|
||||
|
||||
@Controller()
|
||||
export class AppController {
|
||||
constructor(private readonly appService: AppService) {}
|
||||
|
||||
@Get()
|
||||
@ApiExcludeEndpoint()
|
||||
getHello(): string {
|
||||
return this.appService.getHello();
|
||||
}
|
||||
}
|
||||
101
src/app.module.ts
Normal file
101
src/app.module.ts
Normal file
@@ -0,0 +1,101 @@
|
||||
import { DashboardModule } from './sales/dashboard/dashboard.module';
|
||||
import { MindeeModule } from './payment/mindee.module';
|
||||
import { GoogleModule } from './google/google.module';
|
||||
import { CepModule } from './sales/cep/cep.module';
|
||||
import { AccessControlModule } from './Auth/access-control/access-control.module';
|
||||
import { TintometricoModule } from './sales/tintometrico/tintometrico.module';
|
||||
import { PartnerRangeModule } from './partner-range/partner-range.module';
|
||||
import { SellerModule } from './seller/seller.module';
|
||||
import { PartnerCategoryModule } from './partner-category/partner-category.module';
|
||||
import { PartnerModule } from './partner/partner.module';
|
||||
import { PreOrderModule } from './sales/pre-order/pre-order.module';
|
||||
import { OrderModule } from './sales/order/order.module';
|
||||
import { MessagesModule } from './backoffice/messages/messages.module';
|
||||
import { CustomerModule } from './sales/customer/customer.module';
|
||||
import { AddressCustomerModule } from './sales/address-customer/address-customer.module';
|
||||
import { ProductService } from './backoffice/product/product.service';
|
||||
import { ProductController } from './backoffice/product/product.controller';
|
||||
import { BackofficeModule } from './backoffice/backoffice.module';
|
||||
import { ShoppingModule } from './sales/shopping/shopping.module';
|
||||
import { ListsModule } from './backoffice/lists/lists.module';
|
||||
import { SalesModule } from './sales/sales/sales.module';
|
||||
import { DeliveryModule } from './delivery/delivery.module';
|
||||
import { ReportsController } from './schedules/report/report.controller';
|
||||
import { ReportService } from './schedules/report/report.service';
|
||||
import { ProductTypeModule } from './backoffice/product-type/product-type.module';
|
||||
import { CestModule } from './backoffice/cest/cest.module';
|
||||
import { NcmModule } from './backoffice/ncm/ncm.module';
|
||||
import { CategoryModule } from './backoffice/category/category.module';
|
||||
import { SectionModule } from './backoffice/section/section.module';
|
||||
import { DepartmentModule } from './backoffice/department/department.module';
|
||||
import { AuthModule } from './Auth/auth.module';
|
||||
import { MeasureProductModule } from './backoffice/measureproduct/measureproduct.module';
|
||||
import { HttpModule, MiddlewareConsumer, Module, NestModule } from '@nestjs/common';
|
||||
import { AppController } from './app.controller';
|
||||
import { AppService } from './app.service';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { typeOrmConfig } from './configs/typeorm.config';
|
||||
import { Connection } from 'typeorm';
|
||||
import { DictionaryModule } from './backoffice/dictionary/dictionary.module';
|
||||
import { ConfigModule } from '@nestjs/config/dist/config.module';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
DashboardModule,
|
||||
MindeeModule,
|
||||
GoogleModule,
|
||||
CepModule,
|
||||
AccessControlModule,
|
||||
TintometricoModule,
|
||||
PartnerRangeModule,
|
||||
SellerModule,
|
||||
PartnerCategoryModule,
|
||||
PartnerModule,
|
||||
PreOrderModule,
|
||||
OrderModule,
|
||||
MessagesModule,
|
||||
CustomerModule,
|
||||
TypeOrmModule.forRoot(typeOrmConfig),
|
||||
ConfigModule.forRoot({ envFilePath: ['.env', '.env.development.local', '.env.development'], isGlobal: true }),
|
||||
AuthModule,
|
||||
DictionaryModule,
|
||||
MeasureProductModule,
|
||||
DepartmentModule,
|
||||
SectionModule,
|
||||
CategoryModule,
|
||||
NcmModule,
|
||||
CestModule,
|
||||
ProductTypeModule,
|
||||
SalesModule,
|
||||
ListsModule,
|
||||
AddressCustomerModule,
|
||||
BackofficeModule,
|
||||
ShoppingModule,
|
||||
ListsModule,
|
||||
SalesModule,
|
||||
DeliveryModule,
|
||||
ProductTypeModule,
|
||||
CestModule,
|
||||
NcmModule,
|
||||
CategoryModule,
|
||||
DepartmentModule,
|
||||
HttpModule,
|
||||
PartnerCategoryModule,
|
||||
SellerModule
|
||||
],
|
||||
controllers: [
|
||||
ProductController,
|
||||
ReportsController,
|
||||
AppController],
|
||||
providers: [
|
||||
ProductService,
|
||||
ReportService, AppService],
|
||||
})
|
||||
export class AppModule implements NestModule {
|
||||
|
||||
constructor(private connection: Connection) { }
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars
|
||||
configure(consumer: MiddlewareConsumer) { }
|
||||
|
||||
}
|
||||
8
src/app.service.ts
Normal file
8
src/app.service.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class AppService {
|
||||
getHello(): string {
|
||||
return 'Hello World!';
|
||||
}
|
||||
}
|
||||
10
src/backoffice/backoffice.module.ts
Normal file
10
src/backoffice/backoffice.module.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { ProductController } from './product/product.controller';
|
||||
import { ProductService } from './product/product.service';
|
||||
|
||||
@Module({
|
||||
imports: [],
|
||||
controllers: [ProductController],
|
||||
providers: [ProductService],
|
||||
})
|
||||
export class BackofficeModule {}
|
||||
24
src/backoffice/category/category.controller.ts
Normal file
24
src/backoffice/category/category.controller.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { CategoryService } from './category.service';
|
||||
import { Controller, Get, HttpException, HttpStatus, Param } from '@nestjs/common';
|
||||
import { ApiExcludeEndpoint, ApiTags } from '@nestjs/swagger';
|
||||
import { ResultModel } from 'src/domain/models/result.model';
|
||||
|
||||
@ApiTags('BackOffice')
|
||||
@Controller('v1/category')
|
||||
export class CategoryController {
|
||||
|
||||
constructor(private readonly categoryService: CategoryService){}
|
||||
|
||||
@Get(':idSecion')
|
||||
@ApiExcludeEndpoint()
|
||||
async getSection(@Param('idSecion') idSection: number) {
|
||||
try {
|
||||
const result = await this.categoryService.find(idSection);
|
||||
return new ResultModel(true, null, result, []);
|
||||
} catch (error) {
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível consultar lista de departamentos', {}, error), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
15
src/backoffice/category/category.module.ts
Normal file
15
src/backoffice/category/category.module.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Pccategoria } from '../../domain/entity/tables/pccategoria.entity';
|
||||
import { CategoryService } from './category.service';
|
||||
import { CategoryController } from './category.controller';
|
||||
import { CacheModule, Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
|
||||
@Module({
|
||||
imports: [CacheModule.register(),
|
||||
TypeOrmModule.forFeature([Pccategoria])],
|
||||
controllers: [
|
||||
CategoryController,],
|
||||
providers: [
|
||||
CategoryService,],
|
||||
})
|
||||
export class CategoryModule { }
|
||||
22
src/backoffice/category/category.service.ts
Normal file
22
src/backoffice/category/category.service.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Pccategoria } from '../../domain/entity/tables/pccategoria.entity';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
@Injectable()
|
||||
export class CategoryService {
|
||||
constructor(@InjectRepository(Pccategoria)
|
||||
private categoryRespository: Repository<Pccategoria>) { }
|
||||
|
||||
async find(idSecion: number): Promise<Pccategoria[]> {
|
||||
return await this.categoryRespository
|
||||
.createQueryBuilder('pccategoria')
|
||||
.select('"pccategoria".codcategoria', 'codigoCategoria')
|
||||
.addSelect('concat(concat("pccategoria".codcategoria, \'-\'),"pccategoria".categoria)', 'descricaoCategoria')
|
||||
//.addSelect('concat(concat("pccategoria".codcategoria, \'-\'),"pccategoria".categoria)', 'descricaoCategoria')
|
||||
.where("codsec = :codsec", { codsec: idSecion })
|
||||
.getRawMany();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
38
src/backoffice/cest/cest.controller.ts
Normal file
38
src/backoffice/cest/cest.controller.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { ApiExcludeEndpoint, ApiTags } from '@nestjs/swagger';
|
||||
import { ResultModel } from './../../domain/models/result.model';
|
||||
import { CestService } from './cest.service';
|
||||
import { Controller, Get, HttpException, HttpStatus, Param, Req } from '@nestjs/common';
|
||||
|
||||
@ApiTags('BackOffice')
|
||||
@Controller('v1/cest')
|
||||
export class CestController {
|
||||
constructor(private readonly cestService: CestService){}
|
||||
|
||||
@Get()
|
||||
@ApiExcludeEndpoint()
|
||||
async getAll(@Req() req) {
|
||||
try {
|
||||
if (req.query['query'])
|
||||
{
|
||||
const result = await this.cestService.findByDescription(req.query['query']);
|
||||
return new ResultModel(true, null, result, []);
|
||||
}
|
||||
return new ResultModel(false, 'Para pesquisar os Cest é necessário informar pelo menos 3 caracteres.', null, []);
|
||||
} catch (error) {
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível consultar lista de dicionários', {}, error), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@Get(':ncm')
|
||||
@ApiExcludeEndpoint()
|
||||
async GetbyNcm(@Param('ncm') ncm: string) {
|
||||
try {
|
||||
const result = await this.cestService.findByNcm(ncm);
|
||||
return new ResultModel(true, null, result, null);
|
||||
} catch (error) {
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível consultar lista de CESTs', {}, error), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
15
src/backoffice/cest/cest.module.ts
Normal file
15
src/backoffice/cest/cest.module.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Pccest } from '../../domain/entity/tables/pccest.entity';
|
||||
import { CestController } from './cest.controller';
|
||||
import { CestService } from './cest.service';
|
||||
import { CacheModule, Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
|
||||
@Module({
|
||||
imports: [CacheModule.register(),
|
||||
TypeOrmModule.forFeature([Pccest])],
|
||||
controllers: [
|
||||
CestController,],
|
||||
providers: [
|
||||
CestService,],
|
||||
})
|
||||
export class CestModule { }
|
||||
35
src/backoffice/cest/cest.service.ts
Normal file
35
src/backoffice/cest/cest.service.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { Pccest } from '../../domain/entity/tables/pccest.entity';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
@Injectable()
|
||||
export class CestService {
|
||||
constructor(@InjectRepository(Pccest)
|
||||
private cestRepository: Repository<Pccest>) { }
|
||||
|
||||
async find(): Promise<Pccest[]> {
|
||||
return await this.cestRepository
|
||||
.createQueryBuilder('pccest')
|
||||
.getMany()
|
||||
}
|
||||
|
||||
|
||||
async findByDescription(descricaoCest: string): Promise<Pccest[]> {
|
||||
|
||||
return await this.cestRepository
|
||||
.createQueryBuilder('pccest')
|
||||
.select('"pccest".codigo', 'codigo')
|
||||
.addSelect('concat(concat(\"pccest\".codcest, \'-\'), substr(\"pccest\".descricaocest,1,80))', 'descricaoCest')
|
||||
.andWhere("concat(concat(\"pccest\".codcest, \'-\'), substr(\"pccest\".descricaocest,1,80)) like '%'||UPPER(:descricaoCest)||'%'", {descricaoCest})
|
||||
.getRawMany();
|
||||
}
|
||||
|
||||
async findByNcm(codigoNcm: string): Promise<Pccest[]> {
|
||||
return await this.cestRepository
|
||||
.createQueryBuilder('pccest')
|
||||
.where('ncm = :codigoncm', { codigoncm: codigoNcm })
|
||||
.getMany()
|
||||
}
|
||||
|
||||
}
|
||||
35
src/backoffice/department/department.controller.ts
Normal file
35
src/backoffice/department/department.controller.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { DepartmentService } from './department.service';
|
||||
import { CacheInterceptor, Controller, Get, HttpException, HttpStatus, UseInterceptors } from '@nestjs/common';
|
||||
import { ApiExcludeEndpoint, ApiTags } from '@nestjs/swagger';
|
||||
import { ResultModel } from 'src/domain/models/result.model';
|
||||
|
||||
@ApiTags('BackOffice')
|
||||
@Controller('api/v1/department')
|
||||
export class DepartmentController {
|
||||
|
||||
constructor(private readonly departmentService: DepartmentService){}
|
||||
|
||||
@Get()
|
||||
@UseInterceptors(CacheInterceptor)
|
||||
@ApiExcludeEndpoint()
|
||||
async getAll() {
|
||||
try {
|
||||
const departments = await this.departmentService.findAll();
|
||||
return new ResultModel(true, null, departments, []);
|
||||
} catch (error) {
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível consultar lista de departamentos', {}, error), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@Get('all')
|
||||
@UseInterceptors(CacheInterceptor)
|
||||
async get() {
|
||||
try {
|
||||
const departments = await this.departmentService.findDepartments();
|
||||
return new ResultModel(true, null, departments, []);
|
||||
} catch (error) {
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível consultar lista de departamentos', {}, error), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
14
src/backoffice/department/department.module.ts
Normal file
14
src/backoffice/department/department.module.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Pcdepto } from '../../domain/entity/tables/pcdepto.entity';
|
||||
import { DepartmentService } from './department.service';
|
||||
import { DepartmentController } from './department.controller';
|
||||
import { CacheModule, Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
|
||||
@Module({
|
||||
imports: [ CacheModule.register(),
|
||||
TypeOrmModule.forFeature([Pcdepto])],
|
||||
controllers: [DepartmentController,],
|
||||
providers: [DepartmentService,],
|
||||
|
||||
})
|
||||
export class DepartmentModule { }
|
||||
47
src/backoffice/department/department.service.ts
Normal file
47
src/backoffice/department/department.service.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import { Pcdepto } from 'src/domain/entity/tables/pcdepto.entity';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { getConnection, Repository } from 'typeorm';
|
||||
import { Esvdepartamento } from 'src/domain/entity/views/esvdepartamento.entity';
|
||||
|
||||
@Injectable()
|
||||
export class DepartmentService {
|
||||
constructor( @InjectRepository(Pcdepto)
|
||||
private departmentRepository: Repository<Pcdepto>){}
|
||||
|
||||
async findAll(): Promise<Pcdepto[]> {
|
||||
return await this.departmentRepository
|
||||
.createQueryBuilder('pcdepto')
|
||||
.leftJoinAndSelect("pcdepto.secoes", "secoes")
|
||||
.leftJoinAndSelect("pcsecao.categoria", "categoria")
|
||||
.select('"pcdepto".codepto', 'codigoDepartamento')
|
||||
.addSelect('concat(concat("pcdepto".codepto, \' - \'),"pcdepto".descricao)', 'descricaoDepartamento')
|
||||
// .addSelect('concat(concat(concat("pcdepto".descricao, \' (\'),"pcdepto".codepto),\')\')', 'descricaoDepartamento')
|
||||
.where('codepto <> 9999')
|
||||
.getRawMany();
|
||||
}
|
||||
|
||||
async findDepartments() {
|
||||
|
||||
const connection = getConnection();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
const departments = await queryRunner.manager
|
||||
.getRepository(Esvdepartamento)
|
||||
.createQueryBuilder('esvdepartamento')
|
||||
.innerJoinAndSelect('esvdepartamento.secoes', 'secoes')
|
||||
.innerJoinAndSelect('secoes.categorias', 'itens')
|
||||
.where('\"esvdepartamento\".codepto <> 9999')
|
||||
.orderBy("\"esvdepartamento\".DESCRICAO")
|
||||
.getMany();
|
||||
return departments;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
throw error;
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
64
src/backoffice/dictionary/dictionary.controller.ts
Normal file
64
src/backoffice/dictionary/dictionary.controller.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
import { ResultModel } from '../../domain/models/result.model';
|
||||
import { CreateDictionaryContract } from '../../contracts/dictionary.contract';
|
||||
import { ValidadorInterceptor } from '../../Interceptors/validador.interceptor';
|
||||
import { DictionaryModel } from '../../domain/models/dictionary.model';
|
||||
import { DictionaryService } from './dictionary.service';
|
||||
import { Controller, Get, Param, Put, Body, Post, Delete, UseInterceptors, HttpException, HttpStatus, CacheInterceptor, Req } from "@nestjs/common";
|
||||
import { ApiExcludeEndpoint, ApiTags } from '@nestjs/swagger';
|
||||
|
||||
@ApiTags('BackOffice')
|
||||
@Controller('v1/dictionary')
|
||||
export class DictionaryController {
|
||||
|
||||
constructor(
|
||||
private readonly dictionaryService: DictionaryService
|
||||
){}
|
||||
|
||||
@Get()
|
||||
@UseInterceptors(CacheInterceptor)
|
||||
@ApiExcludeEndpoint()
|
||||
async getAll(@Req() req) {
|
||||
try {
|
||||
if (req.query['query'])
|
||||
{
|
||||
const result = await this.dictionaryService.findByDescription(req.query['query']);
|
||||
return new ResultModel(true, null, result, []);
|
||||
}
|
||||
const dictionaries = await this.dictionaryService.findAll();
|
||||
return new ResultModel(true, null, dictionaries, []);
|
||||
} catch (error) {
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível consultar lista de dicionários', {}, error), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
async get(@Param('id') id: number) {
|
||||
try {
|
||||
const dictionary = await this.dictionaryService.find(id);
|
||||
return new ResultModel(true, null, dictionary, []);
|
||||
} catch (error) {
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível consultar dicionário.', {}, error), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@Put(':id')
|
||||
async put(@Param('id') id: number, @Body() dados: DictionaryModel) {
|
||||
try {
|
||||
await this.dictionaryService.update(id, dados);
|
||||
return new ResultModel(true, null, dados, []);
|
||||
} catch (error) {
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível atualizar dicionário.', {}, error), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@Post()
|
||||
@UseInterceptors(new ValidadorInterceptor(new CreateDictionaryContract()))
|
||||
async post(@Body() dados: DictionaryModel) {
|
||||
return await this.dictionaryService.create(dados);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
async delete(@Param('id') id: number) {
|
||||
return await this.dictionaryService.delete(id);
|
||||
}
|
||||
}
|
||||
30
src/backoffice/dictionary/dictionary.module.ts
Normal file
30
src/backoffice/dictionary/dictionary.module.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { User } from '../../domain/entity/tables/estusuario.enity';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { DictionaryController } from './dictionary.controller';
|
||||
import { CacheModule, Module } from "@nestjs/common";
|
||||
import { DictionaryService } from './dictionary.service';
|
||||
import { EstAbreviatura } from 'src/domain/entity/tables/estabreviatura.entity';
|
||||
import { PassportModule } from '@nestjs/passport';
|
||||
import { JwtModule } from '@nestjs/jwt';
|
||||
|
||||
import { JwtStrategy } from '../../Auth/strategies/jwt-strategy';
|
||||
import { AuthService } from '../../Auth/services/auth.service';
|
||||
import { UserController } from 'src/Auth/controllers/user.controller';
|
||||
import { UserService } from 'src/Auth/services/user.service';
|
||||
|
||||
@Module({
|
||||
imports: [CacheModule.register(),
|
||||
PassportModule.register({
|
||||
defaultStrategy: 'jwt'
|
||||
}),
|
||||
JwtModule.register({
|
||||
secretOrPrivateKey: '4557C0D7-DFB0-40DA-BF83-91A75103F7A9',
|
||||
signOptions: {
|
||||
expiresIn: 3600,
|
||||
}
|
||||
}),TypeOrmModule.forFeature([EstAbreviatura, User])],
|
||||
controllers: [UserController, DictionaryController],
|
||||
providers: [DictionaryService, UserService, AuthService, JwtStrategy],
|
||||
})
|
||||
|
||||
export class DictionaryModule {}
|
||||
84
src/backoffice/dictionary/dictionary.service.ts
Normal file
84
src/backoffice/dictionary/dictionary.service.ts
Normal file
@@ -0,0 +1,84 @@
|
||||
import { ResultModel } from '../../domain/models/result.model';
|
||||
import { DictionaryModel } from '../../domain/models/dictionary.model';
|
||||
import { EstAbreviatura } from 'src/domain/entity/tables/estabreviatura.entity';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Repository, getConnection } from 'typeorm';
|
||||
import { NumberUtils } from 'src/utils/number.utils';
|
||||
|
||||
@Injectable()
|
||||
export class DictionaryService {
|
||||
|
||||
constructor(
|
||||
@InjectRepository(EstAbreviatura)
|
||||
private dictionaryRepository: Repository<EstAbreviatura>
|
||||
) { }
|
||||
|
||||
async findAll(): Promise<EstAbreviatura[]> {
|
||||
return await this.dictionaryRepository.find();
|
||||
}
|
||||
|
||||
async findByDescription(description: string): Promise<EstAbreviatura[]> {
|
||||
return await this.dictionaryRepository
|
||||
.createQueryBuilder("estabreviatura")
|
||||
.where("PALAVRA LIKE UPPER(:description)||'%'", { description }
|
||||
).getMany();
|
||||
}
|
||||
|
||||
async find(id: number): Promise<EstAbreviatura> {
|
||||
return await this.dictionaryRepository.createQueryBuilder("estabreviatura").where(
|
||||
"ID = :id", { id: id }
|
||||
).getOne();
|
||||
}
|
||||
|
||||
async update(id: number, dados: DictionaryModel) {
|
||||
|
||||
return await this.dictionaryRepository
|
||||
.createQueryBuilder()
|
||||
.update(EstAbreviatura)
|
||||
.set({ abreviatura: dados.nick, palavra: dados.word })
|
||||
.where("ID = :id", { id })
|
||||
.execute();
|
||||
}
|
||||
|
||||
|
||||
async delete(id: number) {
|
||||
|
||||
return await getConnection()
|
||||
.createQueryBuilder()
|
||||
.delete()
|
||||
.from(EstAbreviatura)
|
||||
.where("ID = :id", { id })
|
||||
.execute();
|
||||
}
|
||||
|
||||
|
||||
async create(dados: DictionaryModel) {
|
||||
|
||||
try
|
||||
{
|
||||
const id = NumberUtils.getNewId(9999, 1);
|
||||
const newDictionary = new EstAbreviatura();
|
||||
|
||||
newDictionary.id = id;
|
||||
newDictionary.abreviatura = dados.nick;
|
||||
newDictionary.palavra = dados.word;
|
||||
|
||||
await getConnection()
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(EstAbreviatura)
|
||||
.values(newDictionary)
|
||||
.execute();
|
||||
|
||||
return newDictionary;
|
||||
|
||||
} catch ( erro ) {
|
||||
return new ResultModel(true, "Ops! Houve um erro ao criar o Dicionário.", null, erro);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
97
src/backoffice/lists/lists.controller.ts
Normal file
97
src/backoffice/lists/lists.controller.ts
Normal file
@@ -0,0 +1,97 @@
|
||||
import { Controller, Get, Param } from '@nestjs/common';
|
||||
import { ListsService } from './lists.service';
|
||||
import { ApiParam, ApiTags } from '@nestjs/swagger';
|
||||
|
||||
@ApiTags('BackOffice')
|
||||
@Controller('api/v1/lists')
|
||||
export class ListsController {
|
||||
|
||||
constructor(private readonly listsServices: ListsService) { }
|
||||
|
||||
/**
|
||||
* Consulta todas filiais cadastradas
|
||||
*/
|
||||
@Get('store')
|
||||
async getAll() {
|
||||
return this.listsServices.GetStoreAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Consulta filiais autorizadas para o usuário
|
||||
*/
|
||||
@Get('store/user/:id')
|
||||
async getByUser(@Param('id') id: number) {
|
||||
return this.listsServices.GetStoreByUser(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Consulta tabela de checkouts da filial informada
|
||||
*/
|
||||
@Get('checkout/:store')
|
||||
@ApiParam({name: 'Código da filial',})
|
||||
async getCheckout(@Param('store') idStore: string) {
|
||||
return this.listsServices.GetCheckout(idStore);
|
||||
}
|
||||
|
||||
/**
|
||||
* Consulta lista de funcionários para a filial informada nos parâmetros
|
||||
*/
|
||||
@Get('user/:store')
|
||||
async getUser(@Param('store') idStore: string) {
|
||||
return this.listsServices.GetUser(idStore);
|
||||
}
|
||||
|
||||
/**
|
||||
* Consulta tabela de plano de pagamento para pedido de venda
|
||||
*/
|
||||
@Get('paymentplan/:billindid')
|
||||
async getPaymentPlan(@Param('billindid') billingId: string) {
|
||||
return this.listsServices.GetPaymentPlan(billingId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Consulta tabela de cobrança para pedido de venda
|
||||
*/
|
||||
@Get('billing/:customerid')
|
||||
async getBillingByCustomer(@Param('customerid') customerId: number) {
|
||||
return this.listsServices.GetBilling(customerId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Consulta cadastro de parceiros
|
||||
*/
|
||||
@Get('partners')
|
||||
async getPartners() {
|
||||
return this.listsServices.GetPartners();
|
||||
}
|
||||
|
||||
/**
|
||||
* Consulta praças para o cadastro de cliente / endereços
|
||||
*/
|
||||
@Get('places')
|
||||
async getPlaces() {
|
||||
return this.listsServices.GetPlaces();
|
||||
}
|
||||
|
||||
/**
|
||||
* Consulta praças para o cadastro de cliente / endereços para retira em loja (CODPRINCIPAL = 1004)
|
||||
*/
|
||||
@Get('store-places')
|
||||
async getStorePlaces() {
|
||||
return this.listsServices.GetStorePlaces();
|
||||
}
|
||||
|
||||
/**
|
||||
* Consulta ramos de atividade do cliente
|
||||
*/
|
||||
@Get('ramo')
|
||||
async getRamo() {
|
||||
return this.listsServices.GetRamo();
|
||||
}
|
||||
|
||||
@Get('supervisores')
|
||||
async getSupervisores() {
|
||||
return this.listsServices.getSupervisores();
|
||||
}
|
||||
|
||||
}
|
||||
12
src/backoffice/lists/lists.module.ts
Normal file
12
src/backoffice/lists/lists.module.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { ListsService } from './lists.service';
|
||||
import { ListsController } from './lists.controller';
|
||||
import { Module } from '@nestjs/common';
|
||||
|
||||
@Module({
|
||||
imports: [],
|
||||
controllers: [
|
||||
ListsController,],
|
||||
providers: [
|
||||
ListsService,],
|
||||
})
|
||||
export class ListsModule { }
|
||||
302
src/backoffice/lists/lists.service.ts
Normal file
302
src/backoffice/lists/lists.service.ts
Normal file
@@ -0,0 +1,302 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Checkout } from 'src/domain/entity/tables/pccaixa.entity';
|
||||
import { Connection } from 'typeorm';
|
||||
import { Store } from '../../domain/entity/tables/pcfilial.entity';
|
||||
import { Pcempr } from '../../domain/entity/tables/pcempr.entity';
|
||||
import { connectionOptions } from 'src/configs/typeorm.config';
|
||||
|
||||
@Injectable()
|
||||
export class ListsService {
|
||||
|
||||
async GetStoreAll(): Promise<Store[]> {
|
||||
const connection = new Connection(connectionOptions);
|
||||
await connection.connect();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
const sql = `SELECT PCFILIAL.CODIGO as "id", ` +
|
||||
` PCFILIAL.RAZAOSOCIAL as "name", ` +
|
||||
` PCFILIAL.CODIGO|| ' - '|| PCFILIAL.FANTASIA as "shortName" ` +
|
||||
` FROM PCFILIAL ` +
|
||||
` WHERE PCFILIAL.CODIGO <> '99' ` +
|
||||
` ORDER BY PCFILIAL.CODIGO `;
|
||||
const stores = await queryRunner.query(sql);
|
||||
return stores as Store[];
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
throw error;
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
await connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
async GetStoreByUser(idUser: number): Promise<Store[]> {
|
||||
const connection = new Connection(connectionOptions);
|
||||
await connection.connect();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
const sql = `SELECT PCFILIAL.CODIGO as "id", ` +
|
||||
` PCFILIAL.RAZAOSOCIAL as "name", ` +
|
||||
` PCFILIAL.CODIGO|| ' - '|| PCFILIAL.FANTASIA as "shortName" ` +
|
||||
` FROM PCFILIAL `;
|
||||
const whereByUser = " WHERE PCFILIAL.CODIGO <> '99' AND " +
|
||||
" ((PCFILIAL.CODIGO IN ( SELECT PCLIB.CODIGOA FROM PCLIB WHERE PCLIB.CODTABELA = 1 AND PCLIB.CODFUNC = :iduser )) OR " +
|
||||
" (EXISTS(SELECT PCLIB.CODIGOA FROM PCLIB WHERE PCLIB.CODTABELA = 1 AND PCLIB.CODFUNC = :iduser AND PCLIB.CODIGOA = '99')) ) ";
|
||||
|
||||
const orderBy = ` ORDER BY PCFILIAL.CODIGO`
|
||||
try {
|
||||
const stores = await queryRunner.query(sql + whereByUser + orderBy, [idUser]);
|
||||
return stores as Store[];
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
throw error;
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
await connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
async GetCheckout(idStore: string): Promise<Checkout[]> {
|
||||
const connection = new Connection(connectionOptions);
|
||||
await connection.connect();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
const checkouts = await queryRunner.manager
|
||||
.getRepository(Checkout)
|
||||
.createQueryBuilder('pccaixa')
|
||||
.where("\"pccaixa\".CODFILIAL = :idStore", {idStore: idStore})
|
||||
.orderBy("\"pccaixa\".NUMCAIXA")
|
||||
.getMany();
|
||||
return checkouts;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
throw error;
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
await connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
async GetUser(idStore: string): Promise<Pcempr[]> {
|
||||
const connection = new Connection(connectionOptions);
|
||||
await connection.connect();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
const checkouts = await queryRunner.manager
|
||||
.getRepository(Pcempr)
|
||||
.createQueryBuilder('pcempr')
|
||||
.select("\"pcempr\".matricula as \"id\", \"pcempr\".nome as \"name\", \"pcempr\".email as \"email\", \"pcempr\".usuariobd as \"smallName\"")
|
||||
.where("\"pcempr\".CODFILIAL = :idStore", {idStore: idStore})
|
||||
.orderBy("\"pcempr\".NOME")
|
||||
.getRawMany();
|
||||
return checkouts;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
throw error;
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
await connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
async GetPaymentPlan(billingId: string){
|
||||
const connection = new Connection(connectionOptions);
|
||||
await connection.connect();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
const sql = ' SELECT PCPLPAG.CODPLPAG as "codplpag", PCPLPAG.DESCRICAO as "descricao", ' +
|
||||
' NVL(PCPLPAG.NUMDIAS,0) as "numdias" ' +
|
||||
' FROM PCPLPAG ' +
|
||||
' WHERE EXISTS(SELECT PCCOBPLPAG.CODCOB FROM PCCOBPLPAG ' +
|
||||
' WHERE PCCOBPLPAG.CODPLPAG = PCPLPAG.CODPLPAG ' +
|
||||
' AND PCCOBPLPAG.CODCOB = :CODCOB ) '
|
||||
' ORDER BY PCPAG.DESCRICAO ';
|
||||
const paymentPlans = await queryRunner.query(sql, [billingId]);
|
||||
return paymentPlans;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
await connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
async GetBilling(clienteId: number){
|
||||
const connection = new Connection(connectionOptions);
|
||||
await connection.connect();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
const sql = ' SELECT PCCOB.CODCOB as "codcob", PCCOB.CODCOB ||\' - \'||PCCOB.COBRANCA as "cobranca" ' +
|
||||
' FROM PCCOB ' +
|
||||
' WHERE NVL(PCCOB.enviacobrancafv, \'N\') = \'S\' ' +
|
||||
' AND ( ( NOT EXISTS(SELECT PCCOBCLI.CODCOB FROM PCCOBCLI WHERE PCCOBCLI.CODCLI = :CODCLI ) AND ' +
|
||||
' ( PCCOB.NIVELVENDA <= ( SELECT C.NIVELVENDA FROM PCCLIENT, PCCOB C ' +
|
||||
' WHERE PCCLIENT.CODCLI = :CODCLI AND PCCLIENT.CODCOB = C.CODCOB ) ) ) OR ' +
|
||||
' EXISTS(SELECT PCCOBCLI.CODCOB FROM PCCOBCLI WHERE PCCOBCLI.CODCLI = :CODCLI AND PCCOBCLI.CODCOB = PCCOB.CODCOB ) ) ' +
|
||||
' ORDER BY PCCOB.CODCOB';
|
||||
const billings = await queryRunner.query(sql, [clienteId]);
|
||||
return billings;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
await connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
async GetPartners(){
|
||||
const connection = new Connection(connectionOptions);
|
||||
await connection.connect();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
const sql = ' SELECT ESTPARCEIRO.ID as "id" ' +
|
||||
' ,REGEXP_REPLACE(ESTPARCEIRO.CPF, \'[^0-9]\',\'\') || \' - \' ||ESTPARCEIRO.NOME as "name" ' +
|
||||
' FROM ESTPARCEIRO ' +
|
||||
' WHERE 1 = 1 ';
|
||||
const partners = await queryRunner.manager
|
||||
.query(sql);
|
||||
return partners;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
await connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
async GetPreCustomer(idCart: string){
|
||||
const connection = new Connection(connectionOptions);
|
||||
await connection.connect();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
const sql = ' select CPF as "document" '+
|
||||
' ,NOME as "name" ' +
|
||||
' ,TELEFONE as "phone" ' +
|
||||
' ,IDCART as "idCart" ' +
|
||||
' from estvendaprecliente ' +
|
||||
' where IDCART = :idcart ';
|
||||
console.log(idCart);
|
||||
const preCustomer = await queryRunner
|
||||
.query(sql, [idCart]);
|
||||
console.log(JSON.stringify(preCustomer));
|
||||
return preCustomer[0];
|
||||
} catch (error) {
|
||||
throw error;
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
await connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
async GetPlaces(){
|
||||
const connection = new Connection(connectionOptions);
|
||||
await connection.connect();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
const sql = ' SELECT PCPRACA.CODPRACA as "id" ' +
|
||||
' ,PCPRACA.PRACA as "name" ' +
|
||||
' FROM PCPRACA ' +
|
||||
' WHERE 1 = 1';
|
||||
const places = await queryRunner.manager
|
||||
.query(sql);
|
||||
return places;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
await connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
async GetStorePlaces(){
|
||||
const connection = new Connection(connectionOptions);
|
||||
await connection.connect();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
const sql = ' SELECT PCPRACA.CODPRACA as "id" ' +
|
||||
' ,PCPRACA.PRACA as "name" ' +
|
||||
' FROM PCPRACA ' +
|
||||
' WHERE PCPRACA.CODPRACAPRINCIPAL = 1004';
|
||||
const places = await queryRunner.manager
|
||||
.query(sql);
|
||||
return places;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
await connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
async GetRamo(){
|
||||
const connection = new Connection(connectionOptions);
|
||||
await connection.connect();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
const sql = ' SELECT PCATIVI.CODATIV as "id" ' +
|
||||
' ,PCATIVI.RAMO as "name" ' +
|
||||
' FROM PCATIVI ' +
|
||||
' WHERE 1 = 1 ' +
|
||||
' ORDER BY PCATIVI.RAMO';
|
||||
const ramos = await queryRunner.manager
|
||||
.query(sql);
|
||||
return ramos;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
await connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
async GetStates(state: string){
|
||||
const connection = new Connection(connectionOptions);
|
||||
await connection.connect();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
const sql = ' SELECT PCESTADO.ESTADO as "name" FROM PCESTADO' +
|
||||
' WHERE PCESTADO.UF = :1';
|
||||
const states = await queryRunner.manager
|
||||
.query(sql, [state]);
|
||||
return states[0].name;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
await connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
async getSupervisores(){
|
||||
const connection = new Connection(connectionOptions);
|
||||
await connection.connect();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
const sql = `SELECT PCSUPERV.CODSUPERVISOR as "supervisorId"
|
||||
,PCSUPERV.NOME as "name"
|
||||
FROM PCSUPERV
|
||||
WHERE PCSUPERV.dtdemissao IS NULL`;
|
||||
const supervisores = await queryRunner.manager
|
||||
.query(sql);
|
||||
return supervisores;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
await connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
61
src/backoffice/measureproduct/measureproduct.controller.ts
Normal file
61
src/backoffice/measureproduct/measureproduct.controller.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import { MeasureProductModel } from '../../domain/models/measureproduct.model';
|
||||
import { Controller, Get, Param, Put, Body, Post, Delete, HttpException, HttpStatus, Req } from "@nestjs/common";
|
||||
import { MeasureProductService } from './measureproduct.service';
|
||||
import { ResultModel } from 'src/domain/models/result.model';
|
||||
import { ApiExcludeEndpoint, ApiTags } from '@nestjs/swagger';
|
||||
|
||||
@ApiTags('BackOffice')
|
||||
@Controller('v1/measure')
|
||||
export class MeasureProductController {
|
||||
|
||||
constructor(
|
||||
private measureProductService: MeasureProductService
|
||||
){}
|
||||
|
||||
@Get()
|
||||
@ApiExcludeEndpoint()
|
||||
async getAll(@Req() req) {
|
||||
try {
|
||||
if (req.query['query'] || req.query['query'] !== '')
|
||||
{
|
||||
const result = await this.measureProductService.findByDescription(req.query['query']);
|
||||
return new ResultModel(true, null, result, []);
|
||||
}
|
||||
const result = await this.measureProductService.findAll();
|
||||
return new ResultModel(true, null, result, []);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível consultar lista de medidas de produto.', {}, error), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
@ApiExcludeEndpoint()
|
||||
async get(@Param('id') id) {
|
||||
try {
|
||||
const result =await this.measureProductService.find(id);
|
||||
return new ResultModel(true, null, result, []);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível consultar lista de medidas de produto.', {}, error), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@Put(':id')
|
||||
@ApiExcludeEndpoint()
|
||||
async put(@Param('id') id: number, @Body() body: MeasureProductModel) {
|
||||
return await this.measureProductService.update(id, body);
|
||||
}
|
||||
|
||||
@Post()
|
||||
@ApiExcludeEndpoint()
|
||||
async post(@Body() body: MeasureProductModel) {
|
||||
return await this.measureProductService.create(body);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
@ApiExcludeEndpoint()
|
||||
async delete(@Param('id') id: number) {
|
||||
return await this.measureProductService.delete(id);
|
||||
}
|
||||
}
|
||||
30
src/backoffice/measureproduct/measureproduct.module.ts
Normal file
30
src/backoffice/measureproduct/measureproduct.module.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { Module } from "@nestjs/common";
|
||||
|
||||
import { PassportModule } from '@nestjs/passport';
|
||||
import { JwtModule } from '@nestjs/jwt';
|
||||
|
||||
import { MeasureProductController } from './measureproduct.controller';
|
||||
import { MeasureProductService } from './measureproduct.service';
|
||||
import { Estmedidaproduto } from 'src/domain/entity/tables/estmedidaproduto.entity';
|
||||
import { AuthService } from 'src/Auth/services/auth.service';
|
||||
import { JwtStrategy } from 'src/Auth/strategies/jwt-strategy';
|
||||
import { UserService } from 'src/Auth/services/user.service';
|
||||
import { User } from 'src/domain/entity/tables/estusuario.enity';
|
||||
|
||||
@Module({
|
||||
imports: [PassportModule.register({
|
||||
defaultStrategy: 'jwt'
|
||||
}),
|
||||
JwtModule.register({
|
||||
secretOrPrivateKey: '4557C0D7-DFB0-40DA-BF83-91A75103F7A9',
|
||||
signOptions: {
|
||||
expiresIn: 3600,
|
||||
}
|
||||
}),
|
||||
TypeOrmModule.forFeature([Estmedidaproduto, User])],
|
||||
controllers: [MeasureProductController],
|
||||
providers: [MeasureProductService, UserService, AuthService, JwtStrategy],
|
||||
})
|
||||
|
||||
export class MeasureProductModule {}
|
||||
85
src/backoffice/measureproduct/measureproduct.service.ts
Normal file
85
src/backoffice/measureproduct/measureproduct.service.ts
Normal file
@@ -0,0 +1,85 @@
|
||||
import { NumberUtils } from '../../utils/number.utils';
|
||||
import { MeasureProductModel } from '../../domain/models/measureproduct.model';
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Estmedidaproduto } from 'src/domain/entity/tables/estmedidaproduto.entity';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
@Injectable()
|
||||
export class MeasureProductService {
|
||||
|
||||
constructor(
|
||||
@InjectRepository(Estmedidaproduto)
|
||||
private measureProductRepository: Repository<Estmedidaproduto>
|
||||
) { }
|
||||
|
||||
async findAll(): Promise<Estmedidaproduto[]> {
|
||||
return await this.measureProductRepository.find();
|
||||
}
|
||||
|
||||
async findByDescription(description: string): Promise<Estmedidaproduto[]> {
|
||||
return await this.measureProductRepository.createQueryBuilder("ESTMEDIDAPRODUTO").where(
|
||||
"DESCRICAO LIKE :description||'%'", { description }
|
||||
).getMany();
|
||||
}
|
||||
|
||||
async find(id: number): Promise<Estmedidaproduto> {
|
||||
return await this.measureProductRepository.createQueryBuilder("ESTMEDIDAPRODUTO").where(
|
||||
"IDMEDIDAPRODUTO = :IDMEDIDAPRODUTO", { IDMEDIDAPRODUTO: id }
|
||||
).getOne();
|
||||
}
|
||||
|
||||
async update(id: number, dados: MeasureProductModel): Promise<boolean> {
|
||||
await this.measureProductRepository
|
||||
.createQueryBuilder()
|
||||
.update('Estmedidaproduto')
|
||||
.set({ descricao: dados.descricao, abreviatura: dados.abreviatura, quantidade: dados.quantidade, nivel: dados.nivel })
|
||||
.where("IDMEDIDAPRODUTO = :IDMEDIDAPRODUTO", { IDMEDIDAPRODUTO: id })
|
||||
.execute();
|
||||
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
|
||||
|
||||
async delete(id: number): Promise<boolean> {
|
||||
|
||||
await this.measureProductRepository
|
||||
.createQueryBuilder()
|
||||
.delete()
|
||||
.from('Estmedidaproduto')
|
||||
.where("IDMEDIDAPRODUTO = :IDMEDIDAPRODUTO", { IDMEDIDAPRODUTO: id })
|
||||
.execute();
|
||||
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
|
||||
|
||||
async create(dados: MeasureProductModel) {
|
||||
|
||||
try
|
||||
{
|
||||
const id = NumberUtils.getNewId(999999, 1);
|
||||
const newEstmedidaproduto = new Estmedidaproduto();
|
||||
newEstmedidaproduto.idmedidaproduto = id;
|
||||
newEstmedidaproduto.abreviatura = dados.abreviatura;
|
||||
newEstmedidaproduto.descricao = dados.descricao;
|
||||
newEstmedidaproduto.nivel = dados.nivel;
|
||||
newEstmedidaproduto.quantidade = dados.quantidade;
|
||||
await this.measureProductRepository
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into('Estmedidaproduto')
|
||||
.values(newEstmedidaproduto)
|
||||
.execute();
|
||||
return Promise.resolve(true);
|
||||
} catch( error ) {
|
||||
console.log(error);
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
15
src/backoffice/messages/messages.module.ts
Normal file
15
src/backoffice/messages/messages.module.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
https://docs.nestjs.com/modules
|
||||
*/
|
||||
|
||||
import { HttpModule, Module } from '@nestjs/common';
|
||||
import { WhatsappController } from './whatsapp/whatsapp.controller';
|
||||
import { WhatsappService } from './whatsapp/whatsapp.service';
|
||||
|
||||
@Module({
|
||||
imports: [HttpModule],
|
||||
controllers: [WhatsappController],
|
||||
providers: [WhatsappService,
|
||||
],
|
||||
})
|
||||
export class MessagesModule {}
|
||||
42
src/backoffice/messages/whatsapp/whatsapp.controller.ts
Normal file
42
src/backoffice/messages/whatsapp/whatsapp.controller.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
https://docs.nestjs.com/controllers#controllers
|
||||
*/
|
||||
|
||||
import { Body, Controller, HttpException, HttpStatus, Post } from '@nestjs/common';
|
||||
import { IndexActions } from 'src/domain/models/index-action.model';
|
||||
import { ResultModel } from 'src/domain/models/result.model';
|
||||
import { MessageWhatsApp } from '../../../domain/models/message-whatsapp.model';
|
||||
import { WhatsappService } from './whatsapp.service';
|
||||
import { ApiExcludeEndpoint } from '@nestjs/swagger';
|
||||
|
||||
@Controller('api/v1/message/whatsapp')
|
||||
export class WhatsappController {
|
||||
|
||||
constructor(private readonly whatsappService: WhatsappService){}
|
||||
|
||||
@Post('send')
|
||||
@ApiExcludeEndpoint()
|
||||
async sendMessage(@Body() message: MessageWhatsApp){
|
||||
try{
|
||||
const result = await this.whatsappService.sendMessage(message);
|
||||
console.log(result);
|
||||
return result;
|
||||
} catch(err){
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível enviar mensagem para o clientes.', {}, err),
|
||||
HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@Post('action')
|
||||
@ApiExcludeEndpoint()
|
||||
async createActionIndex(@Body() action: IndexActions){
|
||||
try{
|
||||
const result = await this.whatsappService.createActionIndex(action);
|
||||
console.log(result);
|
||||
return result;
|
||||
} catch(err){
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível criar pesquisa no INDEX para este cliente.', {}, err),
|
||||
HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
58
src/backoffice/messages/whatsapp/whatsapp.service.ts
Normal file
58
src/backoffice/messages/whatsapp/whatsapp.service.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import { HttpException, HttpService, HttpStatus, Injectable } from '@nestjs/common';
|
||||
import { IndexActions, } from 'src/domain/models/index-action.model';
|
||||
import { MessageWhatsApp } from '../../../domain/models/message-whatsapp.model';
|
||||
|
||||
@Injectable()
|
||||
export class WhatsappService {
|
||||
|
||||
constructor(private readonly httpService: HttpService) {}
|
||||
|
||||
async sendMessage(message: MessageWhatsApp ) {
|
||||
|
||||
// var fs = require('fs');
|
||||
//'Key ' + 'emFwanVydTppY0NtdXlFc3NvYmpqTkVLSFEwbw=='
|
||||
|
||||
const url = `https://takebroadcast.cs.blip.ai/api/v1/Notification`;
|
||||
try {
|
||||
const response = await this.httpService
|
||||
.post(url,
|
||||
JSON.stringify(message),
|
||||
{
|
||||
headers: {
|
||||
'accept': 'application/json',
|
||||
'content-type': 'application/json',
|
||||
'accesskey': 'aWNDbXV5RXNzb2Jqak5FS0hRMG8=',
|
||||
'identifier': 'zapjuru'
|
||||
}
|
||||
})
|
||||
.toPromise();
|
||||
return response.data;
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
throw new HttpException(e.message, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async createActionIndex(action: IndexActions) {
|
||||
const url = `https://indecx.com/v2/actions/185E2H/invites`;
|
||||
try {
|
||||
const response = await this.httpService
|
||||
.post(url,
|
||||
JSON.stringify(action),
|
||||
{
|
||||
headers: {
|
||||
'accept': 'application/json',
|
||||
'content-type': 'application/json',
|
||||
'company-key': '$2b$10$rlMclOiWPwGgKavwPDFvCOYlDWujMi.h7BGizTxHPVjkn62VCgreO',
|
||||
}
|
||||
})
|
||||
.toPromise();
|
||||
return response.data;
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
throw new HttpException(e.message, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
52
src/backoffice/ncm/ncm.controller.ts
Normal file
52
src/backoffice/ncm/ncm.controller.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import { NcmService } from './ncm.service';
|
||||
import { Controller, Get, HttpException, HttpStatus, Param, Req } from '@nestjs/common';
|
||||
import { ApiExcludeEndpoint, ApiTags } from '@nestjs/swagger';
|
||||
import { ResultModel } from 'src/domain/models/result.model';
|
||||
|
||||
@ApiTags('BackOffice')
|
||||
@Controller('v1/ncm')
|
||||
export class NcmController {
|
||||
|
||||
constructor(private readonly ncmService: NcmService ){}
|
||||
|
||||
@Get()
|
||||
@ApiExcludeEndpoint()
|
||||
async getAll(@Req() req) {
|
||||
try {
|
||||
if (req.query['query'])
|
||||
{
|
||||
const result = await this.ncmService.findByDescription(req.query['query']);
|
||||
return new ResultModel(true, null, result, []);
|
||||
}
|
||||
return new ResultModel(false, 'Para pesquisar os NCMs é necessário informar pelo menos 3 caracteres.', null, []);
|
||||
} catch (error) {
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível consultar lista de dicionários', {}, error), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@Get()
|
||||
async findAll() {
|
||||
try {
|
||||
const ncms = await this.ncmService.findAll();
|
||||
return new ResultModel(true, null, ncms, []);
|
||||
} catch (error) {
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível consultar lista de NCMs', {}, error), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
@Get(":ncm")
|
||||
@ApiExcludeEndpoint()
|
||||
async findByNcm(@Param("ncm") ncm: string, @Req() req) {
|
||||
console.log(req.query);
|
||||
try {
|
||||
const result = await this.ncmService.find(ncm);
|
||||
return new ResultModel(true, null, result, []);
|
||||
} catch (error) {
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível consultar lista de NCMs', {}, error), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
15
src/backoffice/ncm/ncm.module.ts
Normal file
15
src/backoffice/ncm/ncm.module.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Pcncm } from '../../domain/entity/tables/pcncm.entity';
|
||||
import { NcmController } from './ncm.controller';
|
||||
import { NcmService } from './ncm.service';
|
||||
import { CacheModule, Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
|
||||
@Module({
|
||||
imports: [CacheModule.register(),
|
||||
TypeOrmModule.forFeature([Pcncm])],
|
||||
controllers: [
|
||||
NcmController,],
|
||||
providers: [
|
||||
NcmService,],
|
||||
})
|
||||
export class NcmModule { }
|
||||
39
src/backoffice/ncm/ncm.service.ts
Normal file
39
src/backoffice/ncm/ncm.service.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { Pcncm } from '../../domain/entity/tables/pcncm.entity';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
@Injectable()
|
||||
export class NcmService {
|
||||
constructor(@InjectRepository(Pcncm)
|
||||
private ncmRepository: Repository<Pcncm>){}
|
||||
|
||||
async findAll(): Promise<Pcncm[]> {
|
||||
return await this.ncmRepository
|
||||
.createQueryBuilder('pcncm')
|
||||
.select('"pcncm".codncmex', 'codigoNcmEx')
|
||||
.addSelect('concat(concat("pcncm".codncmex, \' - \'),SUBSTR("pcncm".descricao,1,100))', 'descricaoNcm')
|
||||
.where('dtexclusao is null')
|
||||
.getRawMany();
|
||||
}
|
||||
|
||||
async findByDescription(description: string): Promise<Pcncm[]> {
|
||||
|
||||
return await this.ncmRepository
|
||||
.createQueryBuilder('pcncm')
|
||||
.select('"pcncm".codncmex', 'codigoNcmEx')
|
||||
.addSelect('concat(concat("pcncm".codncmex, \' - \'),SUBSTR("pcncm".descricao,1,100))', 'descricaoNcm')
|
||||
.where('dtexclusao is null')
|
||||
.andWhere("descricao like UPPER(:description)||'%'", {description})
|
||||
.getRawMany();
|
||||
}
|
||||
|
||||
async find(ncm: string): Promise<Pcncm[]> {
|
||||
return await this.ncmRepository
|
||||
.createQueryBuilder('pcncm')
|
||||
.where("dtexclusao is null and codncm like :ncm||'%'", { ncm })
|
||||
.getRawMany();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
81
src/backoffice/product-type/product-type.controller.ts
Normal file
81
src/backoffice/product-type/product-type.controller.ts
Normal file
@@ -0,0 +1,81 @@
|
||||
import { ProductTypeModel } from './../../domain/models/product-type.model';
|
||||
import { Body, Delete, Param, Post } from '@nestjs/common';
|
||||
import { ResultModel } from './../../domain/models/result.model';
|
||||
import { ProductTypeService } from './product-type.service';
|
||||
import { CacheInterceptor, Controller, Get, HttpException, HttpStatus, Put, Req, UseInterceptors } from '@nestjs/common';
|
||||
import { ApiExcludeEndpoint, ApiTags } from '@nestjs/swagger';
|
||||
|
||||
@ApiTags('BackOffice')
|
||||
@Controller('v1/product-type')
|
||||
export class ProductTypeController {
|
||||
|
||||
constructor( private readonly productTypeService: ProductTypeService){}
|
||||
|
||||
@Get()
|
||||
@UseInterceptors(CacheInterceptor)
|
||||
@ApiExcludeEndpoint()
|
||||
async getAll(@Req() req) {
|
||||
try {
|
||||
if (req.query['query'])
|
||||
{
|
||||
const result = await this.productTypeService.findByType(req.query['query']);
|
||||
return new ResultModel(true, null, result, []);
|
||||
}
|
||||
const typeProducts = await this.productTypeService.findAll();
|
||||
return new ResultModel(true, null, typeProducts, []);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível consultar lista de tipos de produto.', {}, error), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
@UseInterceptors(CacheInterceptor)
|
||||
@ApiExcludeEndpoint()
|
||||
async getOne(@Param('id') id: number ) {
|
||||
try {
|
||||
const data = await this.productTypeService.findById(id);
|
||||
console.log(data);
|
||||
return new ResultModel(true, null, data, []);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível consultar tipo de produto.', {}, error), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@Put(':id')
|
||||
async update(@Param('id') id: number, @Body() dados: ProductTypeModel) {
|
||||
try {
|
||||
await this.productTypeService.update(id, dados);
|
||||
return new ResultModel(true, null, dados, []);
|
||||
} catch (error) {
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível atualizar tipo do produto.', {}, error), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@Post()
|
||||
@ApiExcludeEndpoint()
|
||||
//TODO: @UseInterceptors(new ValidadorInterceptor(new CreateDictionaryContract()))
|
||||
async post(@Body() dados: ProductTypeModel) {
|
||||
try {
|
||||
const newProductType = await await this.productTypeService.create(dados);
|
||||
return new ResultModel(true, null, newProductType, []);
|
||||
} catch (error) {
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível incluir tipo do produto.', {}, error), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
@ApiExcludeEndpoint()
|
||||
async delete(@Param('id') id: number) {
|
||||
try {
|
||||
const result = await this.productTypeService.delete(id);
|
||||
return new ResultModel(true, 'Tipo do produto excluído com sucesso!', null, []);
|
||||
} catch (error) {
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível excluir tipo do produto.', {}, error), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
15
src/backoffice/product-type/product-type.module.ts
Normal file
15
src/backoffice/product-type/product-type.module.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Esttipoproduto } from '../../domain/entity/tables/esttipoproduto.entity';
|
||||
import { ProductTypeController } from './product-type.controller';
|
||||
import { ProductTypeService } from './product-type.service';
|
||||
import { CacheModule, Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
|
||||
@Module({
|
||||
imports: [CacheModule.register(),
|
||||
TypeOrmModule.forFeature([Esttipoproduto])],
|
||||
controllers: [
|
||||
ProductTypeController,],
|
||||
providers: [
|
||||
ProductTypeService,],
|
||||
})
|
||||
export class ProductTypeModule { }
|
||||
165
src/backoffice/product-type/product-type.service.ts
Normal file
165
src/backoffice/product-type/product-type.service.ts
Normal file
@@ -0,0 +1,165 @@
|
||||
import { ProductTypeModel } from './../../domain/models/product-type.model';
|
||||
import { Esttipoproduto } from '../../domain/entity/tables/esttipoproduto.entity';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { getConnection, Repository } from 'typeorm';
|
||||
import { NumberUtils } from 'src/utils/number.utils';
|
||||
import { ResultModel } from 'src/domain/models/result.model';
|
||||
|
||||
@Injectable()
|
||||
export class ProductTypeService {
|
||||
constructor(
|
||||
@InjectRepository(Esttipoproduto)
|
||||
private productTypeRepository: Repository<Esttipoproduto>
|
||||
) { }
|
||||
|
||||
async findAll(): Promise<Esttipoproduto[]> {
|
||||
|
||||
const connection = getConnection();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
|
||||
return await queryRunner.manager
|
||||
.getRepository(Esttipoproduto)
|
||||
.createQueryBuilder('esttipoproduto')
|
||||
.select(['"esttipoproduto".idtipoproduto as "id"'
|
||||
, '"esttipoproduto".tipoproduto as "tipoProduto"'
|
||||
, '"esttipoproduto".siglaproduto as "siglaProduto"'
|
||||
, '"esttipoproduto".ncm as "ncm"'
|
||||
, '"esttipoproduto".codepto as "codigoDepartamento"'
|
||||
, '"esttipoproduto".codsec as "codigoSecao"'
|
||||
, '"esttipoproduto".codcategoria as "codigoCategoria"'
|
||||
, '"esttipoproduto".cest as "codigoCest"'
|
||||
, 'concat(concat("departamento".codepto, \'-\'),"departamento".descricao) as "departamentoDescricao"'
|
||||
, 'concat(concat("secao".codsec, \'-\'),"secao".descricao) as "secaoDescricao"'
|
||||
, 'concat(concat("categoria".codcategoria, \'-\'),"categoria".categoria) as "categoriaDescricao"'
|
||||
, '"registrocest".descricaocest as "cestDescricao"'])
|
||||
.innerJoin("esttipoproduto.departamento", "departamento")
|
||||
.innerJoin("esttipoproduto.secao", "secao")
|
||||
.innerJoin("esttipoproduto.categoria", "categoria", '"esttipoproduto".codsec = "categoria".codsec')
|
||||
.innerJoin("esttipoproduto.registrocest", "registrocest")
|
||||
.getRawMany();
|
||||
|
||||
}
|
||||
|
||||
async findByType(description: string): Promise<Esttipoproduto[]> {
|
||||
|
||||
const connection = getConnection();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
|
||||
const descriptionType = description + '%';
|
||||
|
||||
return await queryRunner.manager
|
||||
.getRepository(Esttipoproduto)
|
||||
.createQueryBuilder('esttipoproduto')
|
||||
.select(['"esttipoproduto".idtipoproduto as "id"'
|
||||
, '"esttipoproduto".tipoproduto as "tipoProduto"'
|
||||
, '"esttipoproduto".siglaproduto as "siglaProduto"'
|
||||
, '"esttipoproduto".ncm as "ncm"'
|
||||
, '"esttipoproduto".codepto as "codigoDepartamento"'
|
||||
, '"esttipoproduto".codsec as "codigoSecao"'
|
||||
, '"esttipoproduto".codcategoria as "codigoCategoria"'
|
||||
, '"esttipoproduto".cest as "codigoCest"'
|
||||
, 'concat(concat("departamento".codepto, \'-\'),"departamento".descricao) as "departamentoDescricao"'
|
||||
, 'concat(concat("secao".codsec, \'-\'),"secao".descricao) as "secaoDescricao"'
|
||||
, 'concat(concat("categoria".codcategoria, \'-\'),"categoria".categoria) as "categoriaDescricao"'
|
||||
, '"registrocest".descricaocest as "cestDescricao"'])
|
||||
.innerJoin("esttipoproduto.departamento", "departamento")
|
||||
.innerJoin("esttipoproduto.secao", "secao")
|
||||
.innerJoin("esttipoproduto.categoria", "categoria", '"esttipoproduto".codsec = "categoria".codsec')
|
||||
.innerJoin("esttipoproduto.registrocest", "registrocest")
|
||||
.where('"esttipoproduto".tipoproduto like :type', { type: descriptionType })
|
||||
.getRawMany();
|
||||
|
||||
}
|
||||
|
||||
async findById(id: number): Promise<Esttipoproduto> {
|
||||
|
||||
const connection = getConnection();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
try{
|
||||
return await queryRunner.manager
|
||||
.getRepository(Esttipoproduto)
|
||||
.createQueryBuilder('esttipoproduto')
|
||||
.select(['"esttipoproduto".idtipoproduto as "id"'
|
||||
, '"esttipoproduto".tipoproduto as "tipoProduto"'
|
||||
, '"esttipoproduto".siglaproduto as "siglaProduto"'
|
||||
, '"esttipoproduto".ncm as "ncm"'
|
||||
, '"esttipoproduto".codepto as "codigoDepartamento"'
|
||||
, '"esttipoproduto".codsec as "codigoSecao"'
|
||||
, '"esttipoproduto".codcategoria as "codigoCategoria"'
|
||||
, '"esttipoproduto".cest as "codigoCest"'
|
||||
, 'concat(concat("departamento".codepto, \'-\'),"departamento".descricao) as "departamentoDescricao"'
|
||||
, 'concat(concat("secao".codsec, \'-\'),"secao".descricao) as "secaoDescricao"'
|
||||
, 'concat(concat("categoria".codcategoria, \'-\'),"categoria".categoria) as "categoriaDescricao"'
|
||||
, 'concat(concat(\"registrocest\".codcest, \'-\'), substr(\"registrocest\".descricaocest,1,80)) as "cestDescricao"'
|
||||
, 'concat(concat("registroNcm".codncmex, \' - \'),SUBSTR("registroNcm".descricao,1,100)) as "ncmDescricao"'])
|
||||
.innerJoin("esttipoproduto.departamento", "departamento")
|
||||
.innerJoin("esttipoproduto.secao", "secao")
|
||||
.innerJoin("esttipoproduto.categoria", "categoria", '"esttipoproduto".codsec = "categoria".codsec')
|
||||
.innerJoin("esttipoproduto.registrocest", "registrocest")
|
||||
.innerJoin("esttipoproduto.registroNcm", "registroNcm")
|
||||
.where('"esttipoproduto".idtipoproduto = :id', { id })
|
||||
.getRawOne();
|
||||
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async update(id: number, dados: ProductTypeModel) {
|
||||
|
||||
return await this.productTypeRepository
|
||||
.createQueryBuilder()
|
||||
.update(Esttipoproduto)
|
||||
.set({ tipoProduto: dados.type, ncm: dados.ncm, codigoDepartamento: dados.idDepartment, codigoSecao: dados.idSection,
|
||||
codigoCategoria: dados.idCategory, sigla: dados.sigla, cest: dados.idCest })
|
||||
.where("ID = :id", { id })
|
||||
.execute();
|
||||
}
|
||||
|
||||
|
||||
async delete(id: number) {
|
||||
|
||||
return await getConnection()
|
||||
.createQueryBuilder()
|
||||
.delete()
|
||||
.from(Esttipoproduto)
|
||||
.where("ID = :id", { id })
|
||||
.execute();
|
||||
}
|
||||
|
||||
|
||||
async create(dados: ProductTypeModel) {
|
||||
|
||||
try
|
||||
{
|
||||
const id = NumberUtils.getNewId(9999, 1);
|
||||
const newProductType = new Esttipoproduto();
|
||||
|
||||
newProductType.idTipoProduto = id;
|
||||
newProductType.tipoProduto = dados.type;
|
||||
newProductType.ncm = dados.ncm;
|
||||
newProductType.sigla = dados.sigla;
|
||||
newProductType.codigoDepartamento = dados.idDepartment;
|
||||
newProductType.codigoSecao = dados.idSection;
|
||||
newProductType.codigoCategoria = dados.idCategory;
|
||||
newProductType.cest = dados.idCest;
|
||||
|
||||
await getConnection()
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(Esttipoproduto)
|
||||
.values(newProductType)
|
||||
.execute();
|
||||
|
||||
return newProductType;
|
||||
|
||||
} catch ( erro ) {
|
||||
console.log(erro);
|
||||
return new ResultModel(true, "Ops! Houve um erro ao criar o Dicionário.", null, erro);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
34
src/backoffice/product/product.controller.ts
Normal file
34
src/backoffice/product/product.controller.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Body, Controller, Get, HttpException, HttpStatus, Param, Post } from '@nestjs/common';
|
||||
import { ProductService } from './product.service';
|
||||
import { ApiExcludeEndpoint, ApiTags } from '@nestjs/swagger';
|
||||
|
||||
@ApiTags('BackOffice')
|
||||
@Controller('api/v1/product')
|
||||
export class ProductController {
|
||||
|
||||
constructor (private readonly productService: ProductService){}
|
||||
|
||||
@Get(':id')
|
||||
@ApiExcludeEndpoint()
|
||||
getProduct(@Param('id') id: number){
|
||||
try {
|
||||
return this.productService.getProduct(id);
|
||||
}
|
||||
catch(error){
|
||||
throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@Post('exposeded')
|
||||
@ApiExcludeEndpoint()
|
||||
createExposedProduct(@Body() data: any){
|
||||
try {
|
||||
return this.productService.createExposededProduct(data);
|
||||
}
|
||||
catch(error){
|
||||
throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
48
src/backoffice/product/product.service.ts
Normal file
48
src/backoffice/product/product.service.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { connectionOptions } from 'src/configs/typeorm.config';
|
||||
import { Product } from 'src/domain/entity/tables/pcprodut.entity';
|
||||
import { Connection, getConnection } from 'typeorm';
|
||||
|
||||
@Injectable()
|
||||
export class ProductService {
|
||||
|
||||
async getProduct(id: number) {
|
||||
const connection = getConnection();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
const product = await queryRunner.manager
|
||||
.getRepository(Product)
|
||||
.createQueryBuilder('pcprodut')
|
||||
.innerJoinAndSelect('pcprodut.brand', 'brand')
|
||||
.where("\"pcprodut\".codprod = :id", { id: id })
|
||||
.getOne();
|
||||
return product;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
throw error;
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
}
|
||||
}
|
||||
|
||||
async createExposededProduct(data: any) {
|
||||
const connection = new Connection(connectionOptions);
|
||||
await connection.connect();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
await queryRunner.startTransaction();
|
||||
try {
|
||||
const sqlInsert = `INSERT INTO ESTPRODUTOEXPOSICAO ( CODFILIAL, DATA, CODAUXILIAR )
|
||||
VALUES ( '4', TRUNC(SYSDATE), ${data.codigoean})`;
|
||||
await queryRunner.query(sqlInsert);
|
||||
await queryRunner.commitTransaction();
|
||||
} catch (err) {
|
||||
await queryRunner.commitTransaction();
|
||||
console.log(err);
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
await connection.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
24
src/backoffice/section/section.controller.ts
Normal file
24
src/backoffice/section/section.controller.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { SectionService } from './section.service';
|
||||
import { CacheInterceptor, Controller, Get, HttpException, HttpStatus, Param, UseInterceptors } from '@nestjs/common';
|
||||
import { ApiExcludeEndpoint, ApiTags } from '@nestjs/swagger';
|
||||
import { ResultModel } from 'src/domain/models/result.model';
|
||||
|
||||
@ApiTags('BackOffice')
|
||||
@Controller('v1/section')
|
||||
export class SectionController {
|
||||
|
||||
constructor(private readonly sectionService: SectionService){}
|
||||
|
||||
@Get(':idDepartment')
|
||||
@UseInterceptors(CacheInterceptor)
|
||||
@ApiExcludeEndpoint()
|
||||
async getAll(@Param('idDepartment') idDepartment: number) {
|
||||
try {
|
||||
const sections = await this.sectionService.find(idDepartment);
|
||||
return new ResultModel(true, null, sections, []);
|
||||
} catch (error) {
|
||||
throw new HttpException(new ResultModel(false, 'Não foi possível consultar lista de seções', {}, error), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
14
src/backoffice/section/section.module.ts
Normal file
14
src/backoffice/section/section.module.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { CacheModule, Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { Pcsecao } from 'src/domain/entity/tables/pcsecao.entity';
|
||||
import { SectionController } from './section.controller';
|
||||
import { SectionService } from './section.service';
|
||||
|
||||
@Module({
|
||||
imports: [ CacheModule.register(),
|
||||
TypeOrmModule.forFeature([Pcsecao])],
|
||||
controllers: [SectionController,],
|
||||
providers: [SectionService,],
|
||||
|
||||
})
|
||||
export class SectionModule { }
|
||||
22
src/backoffice/section/section.service.ts
Normal file
22
src/backoffice/section/section.service.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Pcsecao } from 'src/domain/entity/tables/pcsecao.entity';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
@Injectable()
|
||||
export class SectionService {
|
||||
constructor( @InjectRepository(Pcsecao)
|
||||
private sectionRepository: Repository<Pcsecao>){}
|
||||
|
||||
async find(idDepartment: number): Promise<Pcsecao[]> {
|
||||
return await this.sectionRepository
|
||||
.createQueryBuilder('pcsecao')
|
||||
.select('"pcsecao".codsec', 'codigoSecao')
|
||||
.addSelect('concat(concat("pcsecao".codsec, \'-\'),"pcsecao".descricao)', 'descricaoSecao')
|
||||
//.addSelect('concat(concat(concat("pcsecao".descricao, \' (\'),"pcsecao".codsec),\')\')', 'descricaoSecao')
|
||||
.where("codepto = :codepto", {codepto: idDepartment})
|
||||
.getRawMany();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
32
src/configs/typeorm.config.ts
Normal file
32
src/configs/typeorm.config.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { TypeOrmModuleOptions } from '@nestjs/typeorm';
|
||||
import { ConnectionOptions } from 'typeorm';
|
||||
|
||||
export const typeOrmConfig: TypeOrmModuleOptions = {
|
||||
type: "oracle",
|
||||
// host: "192.168.100.40",
|
||||
// username: "LIVIA",
|
||||
// password: "LIVIA",
|
||||
host: "10.1.1.241",
|
||||
username: "SEVEN",
|
||||
password: "USR54SEV",
|
||||
// username: "API",
|
||||
// password: "E05H5KIEQV3YKDJR",
|
||||
port: 1521,
|
||||
sid: "WINT",
|
||||
synchronize: false,
|
||||
logging: false,
|
||||
entities: [__dirname + '/../**/*.entity.{js,ts}'],
|
||||
autoLoadEntities: true,
|
||||
};
|
||||
|
||||
export const connectionOptions: ConnectionOptions = {
|
||||
type: "oracle",
|
||||
host: "10.1.1.241",
|
||||
username: "SEVEN",
|
||||
password: "USR54SEV",
|
||||
port: 1521,
|
||||
sid: "WINT",
|
||||
synchronize: false,
|
||||
logging: false,
|
||||
entities: [__dirname + '/../**/*.entity.{js,ts}'],
|
||||
}
|
||||
4
src/contracts/contract.ts
Normal file
4
src/contracts/contract.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export interface Contract {
|
||||
errors: any[],
|
||||
validade(model: any): boolean,
|
||||
}
|
||||
19
src/contracts/dictionary.contract.ts
Normal file
19
src/contracts/dictionary.contract.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Flunt } from 'src/utils/flunt';
|
||||
import { DictionaryModel } from './../domain/models/dictionary.model';
|
||||
import { Contract } from './contract';
|
||||
|
||||
@Injectable()
|
||||
export class CreateDictionaryContract implements Contract {
|
||||
|
||||
errors: any[];
|
||||
|
||||
validade(model: DictionaryModel): boolean {
|
||||
const flunt = new Flunt();
|
||||
flunt.isRequired(model.nick, "Informe a abreviatura do dicionário.");
|
||||
flunt.hasMinLen(model.word, 5, "Nome do dicionário deve conter no mínimo 5 caracteres.");
|
||||
this.errors = flunt.errors;
|
||||
return flunt.errors.length == 0;
|
||||
}
|
||||
|
||||
}
|
||||
15
src/delivery/delivery.module.ts
Normal file
15
src/delivery/delivery.module.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { ShippingController } from './services/shipping.controller';
|
||||
import { ShippingService } from './services/shipping.service';
|
||||
import { OrdersController } from './orders/orders.controller';
|
||||
import { OrdersService } from './orders/orders.service';
|
||||
import { DeliveryOrderController } from './order/delivery-order.controller';
|
||||
import { DeliveryOrderService } from './order/delivery-order.service';
|
||||
|
||||
@Module({
|
||||
imports: [],
|
||||
controllers: [ShippingController, OrdersController,
|
||||
DeliveryOrderController],
|
||||
providers: [ShippingService, OrdersService, DeliveryOrderService],
|
||||
})
|
||||
export class DeliveryModule {}
|
||||
47
src/delivery/order/delivery-order.controller.ts
Normal file
47
src/delivery/order/delivery-order.controller.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
https://docs.nestjs.com/controllers#controllers
|
||||
*/
|
||||
|
||||
import { Body, Controller, Get, Param, Post } from '@nestjs/common';
|
||||
import { DeliveryOrderModel } from 'src/domain/models/delivery-order.model';
|
||||
import { ImageOrderModel } from 'src/domain/models/image-order.model';
|
||||
import { PaymentModel } from 'src/domain/models/payment.model';
|
||||
import { DeliveryOrderService } from './delivery-order.service';
|
||||
import { ApiExcludeEndpoint } from '@nestjs/swagger';
|
||||
|
||||
@Controller('api/v1/deliveryorder')
|
||||
export class DeliveryOrderController {
|
||||
|
||||
constructor(private readonly deliveryOrderSevive: DeliveryOrderService){}
|
||||
|
||||
@Get('protocolo/:shipmentId/:customerId')
|
||||
@ApiExcludeEndpoint()
|
||||
async getdeliveryByCustomer(@Param("shipmentId") shipmentId: number, @Param("customerId") customerId: number) {
|
||||
return await this.deliveryOrderSevive.getDataDelivery(shipmentId, customerId);
|
||||
}
|
||||
|
||||
@Post('protocolo')
|
||||
@ApiExcludeEndpoint()
|
||||
async createOrReplaceDeliveryByCustomer(@Body() data: DeliveryOrderModel) {
|
||||
return await this.deliveryOrderSevive.createOrReplaceDeliveryOrder(data);
|
||||
}
|
||||
|
||||
@Get('images/:shipmentId/:orderId')
|
||||
@ApiExcludeEndpoint()
|
||||
async getImagesOrder(@Param("shipmentId") shipmentId: number, @Param("orderId") orderId: number) {
|
||||
return await this.deliveryOrderSevive.getImageOrder(shipmentId, orderId);
|
||||
}
|
||||
|
||||
@Post('image')
|
||||
@ApiExcludeEndpoint()
|
||||
async crateImageOrder(@Body() data: ImageOrderModel) {
|
||||
return await this.deliveryOrderSevive.createImageOrder(data);
|
||||
}
|
||||
|
||||
@ApiExcludeEndpoint()
|
||||
@Post('payment')
|
||||
async createPayment(@Body() data: PaymentModel) {
|
||||
return await this.deliveryOrderSevive.createPayment(data);
|
||||
}
|
||||
|
||||
}
|
||||
227
src/delivery/order/delivery-order.service.ts
Normal file
227
src/delivery/order/delivery-order.service.ts
Normal file
@@ -0,0 +1,227 @@
|
||||
/*
|
||||
https://docs.nestjs.com/providers#services
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Estprotocoloentrega } from 'src/domain/entity/tables/estprotocolo.entity';
|
||||
import { DeliveryOrderModel } from 'src/domain/models/delivery-order.model';
|
||||
import { ImageOrderModel } from 'src/domain/models/image-order.model';
|
||||
import { PaymentModel } from 'src/domain/models/payment.model';
|
||||
import { ResultModel } from 'src/domain/models/result.model';
|
||||
import { getConnection } from 'typeorm';
|
||||
import { Estimagemnota } from '../../domain/entity/tables/estimagemnota.entity';
|
||||
import { Estpagamento } from '../../domain/entity/tables/estpagamento.entity';
|
||||
|
||||
@Injectable()
|
||||
export class DeliveryOrderService {
|
||||
|
||||
async getDataDelivery(shipmentId: number, customerId: number): Promise<any> {
|
||||
const connection = getConnection();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
const result = await queryRunner.manager
|
||||
.getRepository(Estprotocoloentrega)
|
||||
.createQueryBuilder('estprotocoloentrega')
|
||||
.where('numcar = :numcar and codcli = :codcli', { numcar: shipmentId, codcli: customerId})
|
||||
.getOne();
|
||||
|
||||
return result; //new ResultModel(true, 'Registro localizado com sucesso!', result, {});
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return new ResultModel(false,
|
||||
'Erro ao atualizar dados de entrega.',
|
||||
null,
|
||||
error);
|
||||
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
async createOrReplaceDeliveryOrder(data: DeliveryOrderModel): Promise<any> {
|
||||
const connection = getConnection();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
await queryRunner.startTransaction();
|
||||
console.log(data);
|
||||
try {
|
||||
const updateDelivery = await queryRunner.manager
|
||||
.getRepository(Estprotocoloentrega)
|
||||
.createQueryBuilder('estprotocoloentrega')
|
||||
.where('numcar = :numcar and codcli = :codcli',
|
||||
{ numcar: data.numeroCarregamento, codcli: data.codigoCliente})
|
||||
.getOne();
|
||||
if ( updateDelivery ) {
|
||||
await queryRunner.manager
|
||||
.createQueryBuilder()
|
||||
.update(Estprotocoloentrega)
|
||||
.set({
|
||||
dataEntrega: data.dataEntrega,
|
||||
cpfRecebedor: data.cpfRecebedor,
|
||||
nomeRecebedor: data.nomeRecebedor,
|
||||
urlImagemProtocolo: data.urlImagemProtocolo,
|
||||
latitude: data.latitude,
|
||||
longitude: data.longitude,
|
||||
})
|
||||
.where('numcar = :numcar and codcli = :codcli', { numcar: data.numeroCarregamento, codcli: data.codigoCliente})
|
||||
.execute()
|
||||
} else {
|
||||
await queryRunner.manager
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(Estprotocoloentrega)
|
||||
.values(data)
|
||||
.execute()
|
||||
}
|
||||
|
||||
await queryRunner.commitTransaction();
|
||||
return new ResultModel(true, 'Registro atualizado com sucesso!', data, {});
|
||||
|
||||
} catch (error) {
|
||||
await queryRunner.rollbackTransaction();
|
||||
console.log(error);
|
||||
return new ResultModel(false,
|
||||
'Erro ao atualizar dados de entrega.',
|
||||
null,
|
||||
error);
|
||||
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
async getImageOrder(shipmentId: number, orderId: number): Promise<any> {
|
||||
const connection = getConnection();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
const result = await queryRunner.manager
|
||||
.getRepository(Estimagemnota)
|
||||
.createQueryBuilder('estimagemnota')
|
||||
.select(["numnota as \"numeroNota\"", "numped as \"numeroPedido\", numcar as \"numeroCarregamento\""])
|
||||
.addSelect(["tipo as \"tipo\", data as \"data\", url as \"url\", latitude as \"latitude\", longitude as \"longitude\" "])
|
||||
.where('numcar = :numcar and numped = :numped ', { numcar: shipmentId, numped: orderId})
|
||||
.getRawMany();
|
||||
|
||||
return result;
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return new ResultModel(false,
|
||||
'Erro ao atualizar imagens da nota fiscal.',
|
||||
null,
|
||||
error);
|
||||
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
}
|
||||
}
|
||||
|
||||
async createImageOrder(dataImage: ImageOrderModel): Promise<any> {
|
||||
console.log(dataImage);
|
||||
const connection = getConnection();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
await queryRunner.startTransaction();
|
||||
try {
|
||||
//const dateDelivery = '2022-04-14T17:52:00';
|
||||
//dataImage.data = dateDelivery;
|
||||
//console.log(dataImage);
|
||||
await queryRunner.manager
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(Estimagemnota)
|
||||
.values(dataImage)
|
||||
.execute()
|
||||
|
||||
await queryRunner.commitTransaction();
|
||||
return new ResultModel(true, 'Imagens incluídas com sucesso!', dataImage, {});
|
||||
|
||||
} catch (error) {
|
||||
await queryRunner.rollbackTransaction();
|
||||
console.log(error);
|
||||
return new ResultModel(false,
|
||||
'Erro ao incluir imagens da nota fiscal.',
|
||||
null,
|
||||
error);
|
||||
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
async createPayment(payment: PaymentModel): Promise<any> {
|
||||
console.log(payment);
|
||||
const connection = getConnection();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
await queryRunner.startTransaction();
|
||||
try {
|
||||
let cobranca = 'PAGV';
|
||||
switch (payment.formaPagto){
|
||||
case 'credit_card_parcelado':
|
||||
cobranca = 'PAGP';
|
||||
break;
|
||||
case 'debit_card':
|
||||
cobranca = 'PAGD';
|
||||
break;
|
||||
case 'credit_card':
|
||||
cobranca = 'PAGV';
|
||||
break;
|
||||
default:
|
||||
cobranca = 'DH';
|
||||
break;
|
||||
};
|
||||
|
||||
await queryRunner.manager
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(Estpagamento)
|
||||
.values({
|
||||
orderId: payment.orderId,
|
||||
dataPagamento: payment.dataPagamento,
|
||||
codigoAutorizacao: payment.idTransacao,
|
||||
codigoResposta: '00',
|
||||
dataRequisicao: payment.dataPagamento,
|
||||
dataServidor: payment.dataPagamento,
|
||||
estAcquirer: 'pagseguro',
|
||||
idTransacao: payment.codigoAutorizacao,
|
||||
nsu: payment.nsu,
|
||||
parcelas: payment.parcelas,
|
||||
valor: payment.valor / 100,
|
||||
nomeBandeira: 'pagseguro',
|
||||
formaPagto: payment.formaPagto,
|
||||
codigoFuncionario: null,
|
||||
cobranca: cobranca
|
||||
})
|
||||
.execute()
|
||||
|
||||
await queryRunner.commitTransaction();
|
||||
return new ResultModel(true, 'Pagamento incluído com sucesso!', {}, {});
|
||||
|
||||
} catch (error) {
|
||||
await queryRunner.rollbackTransaction();
|
||||
console.log(error);
|
||||
return new ResultModel(false,
|
||||
'Erro ao pagamento para carrgamento / cliente.',
|
||||
null,
|
||||
error);
|
||||
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
22
src/delivery/orders/orders.controller.ts
Normal file
22
src/delivery/orders/orders.controller.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Controller, Get, Param } from '@nestjs/common';
|
||||
import { OrdersService } from './orders.service';
|
||||
import { ApiExcludeEndpoint } from '@nestjs/swagger';
|
||||
|
||||
@Controller('api/v1/orders')
|
||||
export class OrdersController {
|
||||
|
||||
constructor(private ordersService: OrdersService){}
|
||||
|
||||
@Get('customer/:id')
|
||||
@ApiExcludeEndpoint()
|
||||
async getdeliveryByCustomer(@Param("id") id: number) {
|
||||
return await this.ordersService.GetOrdersByCustomer(id);
|
||||
}
|
||||
|
||||
@Get('payments/:id')
|
||||
@ApiExcludeEndpoint()
|
||||
async getPayments(@Param("id") id: number) {
|
||||
return await this.ordersService.GetPayments(id);
|
||||
}
|
||||
|
||||
}
|
||||
127
src/delivery/orders/orders.service.ts
Normal file
127
src/delivery/orders/orders.service.ts
Normal file
@@ -0,0 +1,127 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Pcpedc } from 'src/domain/entity/tables/pcpedc.entity';
|
||||
import { Pcpedi } from 'src/domain/entity/tables/pcpedi.entity';
|
||||
import { ResultModel } from 'src/domain/models/result.model';
|
||||
import { getConnection } from 'typeorm';
|
||||
import { Estpagamento } from '../../domain/entity/tables/estpagamento.entity';
|
||||
|
||||
@Injectable()
|
||||
export class OrdersService {
|
||||
|
||||
async GetOrdersByCustomer(id: number): Promise<any> {
|
||||
|
||||
const connection = getConnection();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
|
||||
await queryRunner.connect();
|
||||
|
||||
try {
|
||||
|
||||
const user = { matricula: 154969 }; //await this.GetUser(queryRunner); 2854
|
||||
|
||||
if (user == null) {
|
||||
return new ResultModel(false, 'Não foi possível localizar notas para este usuário',
|
||||
null,
|
||||
'Não foi localizado motorista para este usuário.');
|
||||
}
|
||||
|
||||
const orders = await queryRunner.manager
|
||||
.getRepository(Pcpedc)
|
||||
.createQueryBuilder('pcpedc')
|
||||
.innerJoinAndSelect('pcpedc.pcclient', 'pcclient')
|
||||
.innerJoinAndSelect('pcpedc.pccarreg', 'pccarreg',
|
||||
'pccarreg.codmotorista = :matricula ', //AND pccarreg.dtfecha is null',
|
||||
{ matricula: user.matricula })
|
||||
.leftJoinAndSelect('pcpedc.pcclientendent', 'pcclientendent')
|
||||
.innerJoinAndSelect("pcpedc.pcplpag", "pcplpag")
|
||||
.select(['pcpedc.numcar as "numeroCarga"',
|
||||
'NVL(pcpedc.numnota, pcpedc.numcupom) as "numeroNota"',
|
||||
'pcpedc.dtfat as "dataEmissao"',
|
||||
'pcpedc.numped as "numeroPedido"',
|
||||
'TRUNC(pcpedc.vlatend * 100) as "valorNota"',
|
||||
'pcpedc.codcli as "codigoCliente"',
|
||||
'pcclient.cliente as "nomeCliente"',
|
||||
'NVL(pcclientendent.enderent, pcclient.enderent) as "endereco"',
|
||||
'NVL(pcclientendent.numeroent, pcclient.numeroent) as "numero"',
|
||||
'NVL(pcclientendent.bairroent, pcclient.bairroent) as "bairro"',
|
||||
'NVL(pcclientendent.complementoent, pcclient.complementoent) as "complemento"',
|
||||
'NVL(pcclientendent.municent, pcclient.municent) as "cidade"',
|
||||
'NVL(pcclientendent.estent, pcclient.estent) as "estado"',
|
||||
'NVL(pcclientendent.cepent, pcclient.cepent) as "cep"',
|
||||
'pcclient.pontorefer as "pontoReferencia"',
|
||||
'pcpedc.codendentcli as "codigoEnderecoEntrega"',
|
||||
'pcclientendent.telent as "telefoneEntrega"',
|
||||
'pcclient.telent as "telefoneCliente"',
|
||||
'pcclient.telcelent as "celularCliente"',
|
||||
'pcplpag.descricao as "planoPagamento"',
|
||||
'NVL(\"pcplpag\".NUMPARCELAS,0) as "numeroParcelas"',
|
||||
'NVL((select sum(trunc(pccrecli.valor*100)) from pccrecli where pccrecli.numtransvendadesc = \"pcpedc\".numtransvenda),0) as "valorCreditos"',
|
||||
'NVL((select sum(trunc(pcestcom.vldevolucao*100)) from pcestcom where pcestcom.numtransvenda = \"pcpedc\".numtransvenda),0) as "valorDevolucoes"',
|
||||
'NVL((select sum(trunc(estpagamento.valor*100)) from estpagamento where estpagamento.numorca = \"pcpedc\".numped),0) as "valorRecebimentos"',
|
||||
'NVL((select count(1) from estimagemnota where estimagemnota.numped = \"pcpedc\".numped and estimagemnota.tipo = \'P\'),0) as "notaComImagens"',
|
||||
'NVL((select count(1) from estimagemnota where estimagemnota.numped = \"pcpedc\".numped and estimagemnota.tipo = \'C\'),0) as "notaComProtocolo"',
|
||||
'NVL((select count(1) from estprotocoloentrega where estprotocoloentrega.numcar = \"pcpedc\".numcar and estprotocoloentrega.codcli = pcpedc.codcli),0) as "notaComDadosRecebedor"',
|
||||
])
|
||||
.addSelect(subQuery => {
|
||||
return subQuery
|
||||
.select('count(distinct item.codfilialretira)', 'lojas')
|
||||
.from(Pcpedi, 'item')
|
||||
.where('item.numped = pcpedc.numped and item.codfilialretira <> pcpedc.codfilial')
|
||||
}, 'lojas')
|
||||
.where("pcpedc.posicao = 'F'")
|
||||
.andWhere("pcpedc.codcli = :codcli", { codcli: id })
|
||||
.getRawMany();
|
||||
return orders;
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return new ResultModel(false,
|
||||
'Erro ao consultar notas fiscais.',
|
||||
null,
|
||||
error);
|
||||
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
async GetPayments(id: number) {
|
||||
// const user = await this.GetUser(queryRunner);
|
||||
const connection = getConnection();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
const payments = await queryRunner.manager
|
||||
.getRepository(Estpagamento)
|
||||
.createQueryBuilder('estpagamento')
|
||||
.select(['\"estpagamento\".numorca as "orderId"',
|
||||
'TRUNC(\"estpagamento\".valor * 100) as "valor"',
|
||||
'\"estpagamento\".nsu as "nsu"',
|
||||
'\"estpagamento\".dtpagamento as "dataPagamento"',
|
||||
'\"estpagamento\".codautorizacao as "codigoAutorizacao"',
|
||||
'\"estpagamento\".idtransacao as "idTransacao"',
|
||||
'\"estpagamento\".parcelas as "parcelas"',
|
||||
'\"estpagamento\".formapagto as "formaPagto"',
|
||||
])
|
||||
.innerJoin('estpagamento.pedido', 'pcpedc')
|
||||
.innerJoin('pcpedc.pcclient', 'pcclient')
|
||||
//.innerJoin('pcpedc.pccarreg', 'pccarreg',
|
||||
// 'pccarreg.codmotorista1 = :matricula ', //AND pccarreg.dtfecha is null',
|
||||
// { matricula: user.matricula })
|
||||
.where('\"pcpedc\".codcli = :id', { id })
|
||||
.getRawMany()
|
||||
return payments;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return new ResultModel(false,
|
||||
'Erro ao consultar pagamentos.',
|
||||
null,
|
||||
error);
|
||||
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
}
|
||||
}
|
||||
}
|
||||
29
src/delivery/services/shipping.controller.ts
Normal file
29
src/delivery/services/shipping.controller.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { Controller, Get, Param } from '@nestjs/common';
|
||||
import { ShippingService } from './shipping.service';
|
||||
import { ApiExcludeEndpoint } from '@nestjs/swagger';
|
||||
|
||||
@Controller('api/v1/shipping')
|
||||
export class ShippingController {
|
||||
|
||||
constructor(private shippingService: ShippingService){}
|
||||
|
||||
@Get('customer')
|
||||
@ApiExcludeEndpoint()
|
||||
async getdeliveryByCustomer() {
|
||||
return await this.shippingService.GetShippingsByCustomer();
|
||||
}
|
||||
|
||||
@Get('collect/shop')
|
||||
@ApiExcludeEndpoint()
|
||||
async getCollectbyShop() {
|
||||
return await this.shippingService.GetCollectByShop();
|
||||
}
|
||||
|
||||
@Get('collect/customer/:id')
|
||||
@ApiExcludeEndpoint()
|
||||
async getCollectbyCustomer(@Param('id') id: string) {
|
||||
return await this.shippingService.GetCollectByCustomer(id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
161
src/delivery/services/shipping.service.ts
Normal file
161
src/delivery/services/shipping.service.ts
Normal file
@@ -0,0 +1,161 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Esventregasporcliente } from 'src/domain/entity/views/esventregasporcliente.entity';
|
||||
import { Connection, getConnection } from 'typeorm';
|
||||
import { ResultModel } from '../../domain/models/result.model';
|
||||
import { Esvretiralojascliente } from '../../domain/entity/views/esventregaslojascliente.entity';
|
||||
import { EsvRetiraLojas } from '../../domain/entity/views/esvretiralojas.entity';
|
||||
|
||||
@Injectable()
|
||||
export class ShippingService {
|
||||
constructor(private connection: Connection) { }
|
||||
|
||||
async GetShippingsByCustomer(): Promise<any> {
|
||||
|
||||
const connection = getConnection();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
|
||||
await queryRunner.connect();
|
||||
|
||||
try {
|
||||
|
||||
/*const user = await this.GetUser(queryRunner);
|
||||
|
||||
if (user == null) {
|
||||
return new ResultModel(false, 'Não foi possível localizar entregas para este usuário',
|
||||
null,
|
||||
'Não foi localizado motorista para este usuário.');
|
||||
}*/
|
||||
|
||||
const deliveries = await queryRunner.manager
|
||||
.getRepository(Esventregasporcliente)
|
||||
.createQueryBuilder('ESVENTREGASPORCLIENTE')
|
||||
.select(['cliente as "nomeCliente"'
|
||||
, 'cgcent as "cnpj_cpf"'
|
||||
, 'email as "email"'
|
||||
, 'endereco as "endereco"'
|
||||
, 'numero as "numero"'
|
||||
, 'bairro as "bairro"'
|
||||
, 'complemento as "complemento"'
|
||||
, 'cidade as "cidade"'
|
||||
, 'estado as "uf"'
|
||||
, 'cep as "cep"'
|
||||
, 'qtpedidos as "quantidadePedidos"'
|
||||
, 'qtlojas as "quantidaeLojas"'
|
||||
, 'entrega_concluida as "entregaConcluida"'
|
||||
, 'telefone as "telefoneCliente"'
|
||||
, 'celular as "celularCliente"'
|
||||
, 'codcli as "codigoCliente"'])
|
||||
.where("email = 'eduardoestevao.gyn@gmail.com'")
|
||||
.getRawMany();
|
||||
|
||||
return deliveries;
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return new ResultModel(false, 'Não foi possível consultar as entregas por cliente.',
|
||||
null,
|
||||
error);
|
||||
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
async GetCollectByShop(): Promise<any> {
|
||||
|
||||
const connection = getConnection();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
|
||||
await queryRunner.connect();
|
||||
|
||||
try {
|
||||
|
||||
/*const user = await this.GetUser(queryRunner);
|
||||
|
||||
if (user == null) {
|
||||
return new ResultModel(false, 'Não foi possível localizar entregas para este usuário',
|
||||
null,
|
||||
'Não foi localizado motorista para este usuário.');
|
||||
}*/
|
||||
|
||||
const deliveries = await queryRunner.manager
|
||||
.getRepository(EsvRetiraLojas)
|
||||
.createQueryBuilder('ESVRETIRALOJAS')
|
||||
.select(['codigo as "codigoLoja"'
|
||||
, 'razaosocial as "razaoSocial"'
|
||||
, 'quantidadepedidos as "quantidadePedidos"'
|
||||
])
|
||||
.where("email = 'eduardoestevao.gyn@gmail.com'")
|
||||
.getRawMany();
|
||||
|
||||
return deliveries;
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return new ResultModel(false, 'Não foi possível consultar as coletas por loja.',
|
||||
null,
|
||||
error);
|
||||
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
async GetCollectByCustomer(id: string): Promise<any> {
|
||||
|
||||
const connection = getConnection();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
|
||||
await queryRunner.connect();
|
||||
|
||||
try {
|
||||
|
||||
/*const user = await this.GetUser(queryRunner);
|
||||
|
||||
if (user == null) {
|
||||
return new ResultModel(false, 'Não foi possível localizar entregas para este usuário',
|
||||
null,
|
||||
'Não foi localizado motorista para este usuário.');
|
||||
}*/
|
||||
|
||||
const deliveries = await queryRunner.manager
|
||||
.getRepository(Esvretiralojascliente)
|
||||
.createQueryBuilder('ESVRETIRALOJASCLIENTE')
|
||||
.select([
|
||||
'codfilial as "codigoFilial"'
|
||||
,'numped as "numeroPedido"'
|
||||
,'numnota as "numeroNota"'
|
||||
,'dtfat as "dataFaturamento"'
|
||||
,'datapedido as "dataPedido"'
|
||||
,'codcli as "codigoCliente"'
|
||||
,'cliente as "nomeCliente"'
|
||||
,'codfilialretira as "codigoLoja"'
|
||||
,'razaosocial as "nomeLoja"'
|
||||
,'qtitens as "quantidadeItens"'
|
||||
,'quantidade as "quantidade"'
|
||||
])
|
||||
.where("email = 'eduardoestevao.gyn@gmail.com'")
|
||||
.andWhere("codfilial = :codfilial", {codfilial: id})
|
||||
.getRawMany();
|
||||
|
||||
return deliveries;
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return new ResultModel(false, 'Não foi possível consultar as coletas por cliente.',
|
||||
null,
|
||||
error);
|
||||
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
50
src/domain/entity/Scripts/Criacao_Views_Sales.sql
Normal file
50
src/domain/entity/Scripts/Criacao_Views_Sales.sql
Normal file
@@ -0,0 +1,50 @@
|
||||
CREATE OR REPLACE VIEW ESVPRODUTOSVENDA
|
||||
AS
|
||||
SELECT ROWNUM SEQ, PCPRODUT.CODPROD, PCPRODUT.DESCRICAO, PCPRODUT.NOMEECOMMERCE, PCPRODUT.CODFAB,
|
||||
PCPRODUT.CODAUXILIAR, CASE WHEN PCPRODUT.TIPOPRODUTO = 'S' THEN 'SHOWROOM'
|
||||
WHEN PCPRODUT.TIPOPRODUTO = 'A' THEN 'AUTOSSERVICO'
|
||||
ELSE 'NÃO DEFINIDO' END TIPOPRODUTO,
|
||||
PCPRODUT.DADOSTECNICOS, PCPRODUT.INFORMACOESTECNICAS, PCPRODUT.URLIMAGEM,
|
||||
PCPRODUT.ENVIAECOMMERCE, PCPRODUT.CODMARCA CODIGOMARCA, PCMARCA.MARCA NOMEMARCA,
|
||||
PCPRODUT.CODEPTO CODIGODEPARTAMENTO, PCDEPTO.DESCRICAO NOMEDEPARTAMENTO,
|
||||
PCPRODUT.CODSEC CODIGOSECAO, PCSECAO.DESCRICAO NOMESECAO,
|
||||
PCPRODUT.CODCATEGORIA CODIGOCATEGORIA, PCCATEGORIA.CATEGORIA NOMECATEGORIA,
|
||||
PCPRODUT.CODFORNEC, PCFORNEC.FORNECEDOR NOMEFORNECEDOR, PCPRODFILIAL.CLASSEESTOQUE,
|
||||
PCPRODFILIAL.CLASSEVENDA, PCPRODFILIAL.CODFILIAL CODIGOFILIAL
|
||||
FROM PCPRODUT, PCDEPTO, PCSECAO, PCCATEGORIA, PCMARCA, PCFORNEC, PCPRODFILIAL
|
||||
WHERE PCPRODUT.DTEXCLUSAO IS NULL
|
||||
AND NVL(PCPRODUT.OBS,'X') <> 'PV'
|
||||
AND PCPRODUT.CODEPTO = PCDEPTO.CODEPTO
|
||||
AND PCPRODUT.CODSEC = PCSECAO.CODSEC
|
||||
AND PCPRODUT.CODPROD = PCPRODFILIAL.CODPROD
|
||||
AND PCPRODUT.CODSEC = PCCATEGORIA.CODSEC (+)
|
||||
AND PCPRODUT.CODCATEGORIA = PCCATEGORIA.CODCATEGORIA (+)
|
||||
AND PCPRODUT.CODFORNEC = PCFORNEC.CODFORNEC (+)
|
||||
AND PCPRODUT.CODMARCA = PCMARCA.CODMARCA (+) ;
|
||||
|
||||
|
||||
CREATE OR REPLACE VIEW ESVPRECOVENDA
|
||||
AS
|
||||
SELECT PCTABPR.NUMREGIAO NUMEROREGIAO
|
||||
,PCTABPR.CODPROD
|
||||
,PCTABPR.PVENDA1 PRECOVENDA
|
||||
,( SELECT PCPRECOPROM.PRECOFIXO
|
||||
FROM PCPRECOPROM
|
||||
WHERE PCPRECOPROM.NUMREGIAO = PCTABPR.NUMREGIAO
|
||||
AND PCPRECOPROM.CODPROD = PCTABPR.CODPROD
|
||||
AND TRUNC(SYSDATE) BETWEEN PCPRECOPROM.DTINICIOVIGENCIA AND PCPRECOPROM.DTFIMVIGENCIA ) PRECOOFERTA
|
||||
FROM PCTABPR
|
||||
WHERE PCTABPR.PVENDA > 0
|
||||
AND NVL(PCTABPR.EXCLUIDO, 'N') = 'N';
|
||||
|
||||
|
||||
CREATE OR REPLACE VIEW ESVESTOQUEVENDA
|
||||
AS
|
||||
SELECT PCEST.CODFILIAL, PCEST.CODPROD,
|
||||
( NVL(PCEST.QTESTGER,0) - NVL(PCEST.QTRESERV,0) - NVL(PCEST.QTBLOQUEADA,0) - NVL(PCEST.QTPENDENTE,0) ) QUANTIDADEESTOQUEDISPONIVEL,
|
||||
( SELECT MIN(PCPEDIDO.dtprevent) FROM PCITEM, PCPEDIDO
|
||||
WHERE PCITEM.NUMPED = PCPEDIDO.NUMPED
|
||||
AND ( PCITEM.QTPEDIDA - NVL(PCITEM.QTENTREGUE,0) ) > 0
|
||||
AND PCITEM.CODPROD = PCEST.CODPROD ) DATAPREVISAOENTREGA
|
||||
FROM PCEST
|
||||
WHERE PCEST.CODFILIAL <> '99';
|
||||
15
src/domain/entity/tables/estabreviatura.entity.ts
Normal file
15
src/domain/entity/tables/estabreviatura.entity.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity("ESTABREVIATURA")
|
||||
export class EstAbreviatura {
|
||||
|
||||
@PrimaryColumn({ name: 'ID' })
|
||||
id: number;
|
||||
|
||||
@Column({ name: 'ABREVIATURA' })
|
||||
abreviatura: string;
|
||||
|
||||
@Column({ name: 'PALAVRA' })
|
||||
palavra: string;
|
||||
|
||||
}
|
||||
33
src/domain/entity/tables/estavisoestoque.entity.ts
Normal file
33
src/domain/entity/tables/estavisoestoque.entity.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity('ESTAVISOESTOQUE')
|
||||
export class Estavisoestoque {
|
||||
|
||||
@PrimaryColumn({name: 'ID'})
|
||||
id: number;
|
||||
|
||||
@Column({name: 'DTINCLUSAO'})
|
||||
createDate: Date;
|
||||
|
||||
@Column({name: 'CODUSUR'})
|
||||
codusur: number;
|
||||
|
||||
@Column({name: 'CPFCNPJ'})
|
||||
cpf: string;
|
||||
|
||||
@Column({name: 'NOME'})
|
||||
name: string;
|
||||
|
||||
@Column({name: 'CELULAR'})
|
||||
cellPhone: string;
|
||||
|
||||
@Column({name: 'EMAIL'})
|
||||
email: string;
|
||||
|
||||
@Column({name: 'CODPROD'})
|
||||
codprod: number;
|
||||
|
||||
@Column({name: 'OBSERVACAO'})
|
||||
obs: string;
|
||||
|
||||
}
|
||||
10
src/domain/entity/tables/estcategoriacliente.entity.ts
Normal file
10
src/domain/entity/tables/estcategoriacliente.entity.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity('ESTCATEGORIACLIENTE')
|
||||
export class Estcategoriacliente {
|
||||
@PrimaryColumn({name: 'ID'})
|
||||
id: number;
|
||||
|
||||
@Column({name: 'DESCRICAO'})
|
||||
name: string;
|
||||
}
|
||||
18
src/domain/entity/tables/estcategoriaparceiro.entity.ts
Normal file
18
src/domain/entity/tables/estcategoriaparceiro.entity.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity('ESTCATEGORIAPARCEIRO')
|
||||
export class Estcategoriaparceiro {
|
||||
|
||||
@PrimaryColumn({name: 'ID'})
|
||||
id: number;
|
||||
|
||||
@Column({name: 'TIPO'})
|
||||
tipo: string;
|
||||
|
||||
@Column({name: 'DESCRICAO'})
|
||||
descricao: string;
|
||||
|
||||
@Column({name: 'TIPOPAGTO'})
|
||||
tipopagto: string;
|
||||
|
||||
}
|
||||
33
src/domain/entity/tables/estfaixaparceiro.entity.ts
Normal file
33
src/domain/entity/tables/estfaixaparceiro.entity.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity('ESTFAIXAPARCEIRO')
|
||||
export class Estfaixaparceiro {
|
||||
|
||||
@PrimaryColumn({name: 'ID'})
|
||||
id: number;
|
||||
|
||||
@Column({name: 'TIPO'})
|
||||
tipo: string;
|
||||
|
||||
@Column({name: 'FAIXAINI'})
|
||||
faixaIni: number;
|
||||
|
||||
@Column({name: 'FAIXAFIM'})
|
||||
faixaFim: number;
|
||||
|
||||
@Column({name: 'PERCCOMISSAO'})
|
||||
percComissao: number;
|
||||
|
||||
@Column({name: 'DTCADASTRO'})
|
||||
dtCadastro: Date;
|
||||
|
||||
@Column({name: 'CODFUNCCAD'})
|
||||
codfunccad: number;
|
||||
|
||||
@Column({name: 'DTALTERACAO'})
|
||||
dtAlteracao: Date;
|
||||
|
||||
@Column({name: 'CODFUNCALT'})
|
||||
codfuncalt: number;
|
||||
|
||||
}
|
||||
30
src/domain/entity/tables/estimagemnota.entity.ts
Normal file
30
src/domain/entity/tables/estimagemnota.entity.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { Column, Entity, PrimaryColumn } from 'typeorm';
|
||||
|
||||
@Entity('ESTIMAGEMNOTA')
|
||||
export class Estimagemnota {
|
||||
|
||||
@PrimaryColumn({name: 'NUMPED'})
|
||||
numeroPedido: number;
|
||||
|
||||
@Column({name: 'NUMNOTA'})
|
||||
numeroNota: number;
|
||||
|
||||
@Column({name: 'NUMCAR'})
|
||||
numeroCarregamento: number;
|
||||
|
||||
@Column({name: 'DATA'})
|
||||
data: Date;
|
||||
|
||||
@Column({name: 'TIPO'})
|
||||
tipo: string;
|
||||
|
||||
@Column({name: 'URL'})
|
||||
url: string;
|
||||
|
||||
@Column({name: 'LATITUDE'})
|
||||
latitude: number;
|
||||
|
||||
@Column({name: 'LONGITUDE'})
|
||||
longitude: number;
|
||||
|
||||
}
|
||||
21
src/domain/entity/tables/estmedidaproduto.entity.ts
Normal file
21
src/domain/entity/tables/estmedidaproduto.entity.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { PrimaryColumn, Column, Entity } from "typeorm";
|
||||
|
||||
@Entity("ESTMEDIDAPRODUTO")
|
||||
export class Estmedidaproduto {
|
||||
|
||||
@PrimaryColumn({name: 'IDMEDIDAPRODUTO'})
|
||||
idmedidaproduto: number;
|
||||
|
||||
@Column({name: 'DESCRICAO'})
|
||||
descricao: string;
|
||||
|
||||
@Column({name: 'ABREVIATURA'})
|
||||
abreviatura: string;
|
||||
|
||||
@Column({name: 'QUANTIDADE'})
|
||||
quantidade: number;
|
||||
|
||||
@Column({name: 'NIVEL'})
|
||||
nivel: number;
|
||||
|
||||
}
|
||||
56
src/domain/entity/tables/estpagamento.entity.ts
Normal file
56
src/domain/entity/tables/estpagamento.entity.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm";
|
||||
import { Pcpedc } from "./pcpedc.entity";
|
||||
|
||||
@Entity('ESTPAGAMENTO')
|
||||
export class Estpagamento {
|
||||
@PrimaryColumn({ name: 'NUMORCA' })
|
||||
orderId: number;
|
||||
|
||||
@PrimaryColumn({ name: 'DTPAGAMENTO' })
|
||||
dataPagamento: Date;
|
||||
|
||||
@Column({ name: 'CODAUTORIZACAO' })
|
||||
codigoAutorizacao: string;
|
||||
|
||||
@Column({ name: 'CODRESPOSTA' })
|
||||
codigoResposta: string;
|
||||
|
||||
@Column({ name: 'DTREQUISICAO' })
|
||||
dataRequisicao: Date;
|
||||
|
||||
@Column({ name: 'DTSERVIDOR' })
|
||||
dataServidor: Date;
|
||||
|
||||
@Column({ name: 'ESTACQUIRER' })
|
||||
estAcquirer: string;
|
||||
|
||||
@Column({ name: 'IDTRANSACAO' })
|
||||
idTransacao: string;
|
||||
|
||||
@Column({ name: 'NSU' })
|
||||
nsu: string;
|
||||
|
||||
@Column({ name: 'PARCELAS' })
|
||||
parcelas: number;
|
||||
|
||||
@Column({ name: 'VALOR' })
|
||||
valor: number;
|
||||
|
||||
@Column({ name: 'NOMEBANDEIRA' })
|
||||
nomeBandeira: string;
|
||||
|
||||
@Column({ name: 'FORMAPAGTO' })
|
||||
formaPagto: string;
|
||||
|
||||
@Column({ name: 'CODFUNC' })
|
||||
codigoFuncionario: number;
|
||||
|
||||
@Column({ name: 'CODCOB' })
|
||||
cobranca: string;
|
||||
|
||||
@ManyToOne(() => Pcpedc, pcpedc => pcpedc.pagamentos)
|
||||
@JoinColumn({ name: 'NUMORCA' })
|
||||
pedido: Pcpedc;
|
||||
|
||||
}
|
||||
|
||||
108
src/domain/entity/tables/estparceiro.entity.ts
Normal file
108
src/domain/entity/tables/estparceiro.entity.ts
Normal file
@@ -0,0 +1,108 @@
|
||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity('ESTPARCEIRO')
|
||||
export class Estparceiro {
|
||||
@PrimaryColumn({ name: 'ID'})
|
||||
public id: number;
|
||||
|
||||
@Column({name: 'TIPO'})
|
||||
public tipo: string;
|
||||
|
||||
@Column({name: 'CPF'})
|
||||
public cpf: string;
|
||||
|
||||
@Column({name: 'NOME'})
|
||||
public nome: string;
|
||||
|
||||
@Column({name: 'RG'})
|
||||
public rg: string;
|
||||
|
||||
@Column({name: 'ORGAOEXP'})
|
||||
public orgaoexp: string;
|
||||
|
||||
@Column({name: 'REGPROFISSIONAL'})
|
||||
public regprofissional: string;
|
||||
|
||||
@Column({name: 'CEP'})
|
||||
public cep: string;
|
||||
|
||||
@Column({name: 'CODIBGE'})
|
||||
public codibge: string;
|
||||
|
||||
|
||||
@Column({name: 'ENDERECO'})
|
||||
public endereco: string;
|
||||
|
||||
@Column({name: 'NUMERO'})
|
||||
public numero: string;
|
||||
|
||||
@Column({name: 'COMPLEMENTO'})
|
||||
public complemento: string;
|
||||
|
||||
@Column({name: 'BAIRRO'})
|
||||
public bairro: string;
|
||||
|
||||
@Column({name: 'CIDADE'})
|
||||
public cidade: string;
|
||||
|
||||
@Column({name: 'ESTADO'})
|
||||
public estado: string;
|
||||
|
||||
@Column({name: 'TELEFONE'})
|
||||
public telefone: string;
|
||||
|
||||
@Column({name: 'EMAIL'})
|
||||
public email: string;
|
||||
|
||||
@Column({name: 'CHAVEPIX'})
|
||||
public chavepix: string;
|
||||
|
||||
@Column({name: 'BANCO'})
|
||||
public banco: string;
|
||||
|
||||
@Column({name: 'AGENCIA'})
|
||||
public agencia: string;
|
||||
|
||||
@Column({name: 'CONTA'})
|
||||
public conta: string;
|
||||
|
||||
@Column({name: 'CODUSUR'})
|
||||
public codusur: number;
|
||||
|
||||
@Column({name: 'CODUSURPARCEIRO'})
|
||||
public codusurparceiro: number;
|
||||
|
||||
@Column({name: 'COMPRADORPJ'})
|
||||
public compradorPj: string;
|
||||
|
||||
@Column({name: 'CODCLI'})
|
||||
public codcli: number;
|
||||
|
||||
@Column({name: 'CODCATEGORIA'})
|
||||
public codcategoria: number;
|
||||
|
||||
@Column({name: 'CODPRACA'})
|
||||
public codpraca: number;
|
||||
|
||||
@Column({name: 'OBSERVACAO'})
|
||||
public observacao: string;
|
||||
|
||||
@Column({name: 'OBSERVACAO2'})
|
||||
public observacao2: string;
|
||||
|
||||
@Column({name: 'PERCCOMISSAO'})
|
||||
public perccomissao: number;
|
||||
|
||||
@Column({name: 'CODFUNCCADASTRO'})
|
||||
public codfunccadastro: number;
|
||||
|
||||
@Column({name: 'DTCADASTRO'})
|
||||
public dtcadastro: Date;
|
||||
|
||||
@Column({name: 'CODFUNCALTERACAO'})
|
||||
public codfuncalteracao: number;
|
||||
|
||||
@Column({name: 'DTALTERACAO'})
|
||||
public dtalteracao: Date;
|
||||
|
||||
}
|
||||
63
src/domain/entity/tables/estprevendac.entity.ts
Normal file
63
src/domain/entity/tables/estprevendac.entity.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity('ESTPREVENDAC')
|
||||
export class Shopping {
|
||||
|
||||
@PrimaryColumn({ name: 'ID' })
|
||||
id: string;
|
||||
|
||||
@Column({ name: 'CODFILIAL' })
|
||||
store: string;
|
||||
|
||||
@Column({ name: 'DATA' })
|
||||
data: Date;
|
||||
|
||||
@Column({ name: 'CODUSUR' })
|
||||
codusur: number;
|
||||
|
||||
@Column({ name: 'CODCLI' })
|
||||
codcli: number;
|
||||
|
||||
@Column({ name: 'CODENDENTCLI' })
|
||||
codendentcli: number;
|
||||
|
||||
@Column({ name: 'CODPLPAG' })
|
||||
codplpag: number;
|
||||
|
||||
@Column({ name: 'CODCOB' })
|
||||
codcob: string;
|
||||
|
||||
@Column({ name: 'VLPEDIDO' })
|
||||
vlpedido: number;
|
||||
|
||||
@Column({ name: 'VLTABELA' })
|
||||
vltabela: number;
|
||||
|
||||
@Column({ name: 'VLDESCONTO' })
|
||||
vldesconto: number;
|
||||
|
||||
@Column({name: 'VLCUSTOFIN'})
|
||||
vlcustofin: number;
|
||||
|
||||
@Column({ name: 'CODFUNCAUTOR' })
|
||||
codfuncautor: number;
|
||||
|
||||
@Column({ name: 'VLTAXAENTREGA', type: "decimal", precision: 10, scale: 2, default: 0 })
|
||||
vltaxaentrega: number;
|
||||
|
||||
@Column({ name: 'NUMORCA' })
|
||||
numorca: number;
|
||||
|
||||
@Column({ name: 'NUMPED' })
|
||||
numped: number;
|
||||
|
||||
@Column({ name: 'TOTPESO' })
|
||||
totpeso: number;
|
||||
|
||||
@Column({ name: 'CODFORNECFRETE' })
|
||||
codfornecfrete: number;
|
||||
|
||||
@Column({ name: 'CODTABELAFRETE' })
|
||||
codtabelafrete: number;
|
||||
|
||||
}
|
||||
117
src/domain/entity/tables/estprevendai.entity.ts
Normal file
117
src/domain/entity/tables/estprevendai.entity.ts
Normal file
@@ -0,0 +1,117 @@
|
||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity("ESTPREVENDAI")
|
||||
export class ShoppingItens {
|
||||
|
||||
@PrimaryColumn({name: 'ID'})
|
||||
id: string;
|
||||
|
||||
@Column({name: 'IDCART'})
|
||||
idCart: string;
|
||||
|
||||
@Column({name: 'NUMSEQ'})
|
||||
numSeq: number;
|
||||
|
||||
@Column({name: 'CODPROD'})
|
||||
idProduct: number;
|
||||
|
||||
@Column({name: 'CODAUXILIAR'})
|
||||
ean: number;
|
||||
|
||||
@Column({name: 'QT'})
|
||||
quantity: number;
|
||||
|
||||
@Column({name: 'PTABELA'})
|
||||
listPrice: number;
|
||||
|
||||
@Column({name: 'PERCDESC'})
|
||||
discount: number;
|
||||
|
||||
@Column({name: 'VLDESCONTO'})
|
||||
discountValue: number;
|
||||
|
||||
@Column({name: 'PVENDA'})
|
||||
price: number;
|
||||
|
||||
@Column({name: 'VLCUSTOFIN'})
|
||||
cost: number;
|
||||
|
||||
@Column({name: 'DTINCLUSAO', select: false})
|
||||
createDate: Date;
|
||||
|
||||
@Column({name: 'CODFUNC', select: false})
|
||||
idUser: Date;
|
||||
|
||||
@Column({name: 'DTCANCEL', select: false})
|
||||
cancelDate: Date;
|
||||
|
||||
@Column({name: 'DATAVENDA', select: false})
|
||||
orderDate: Date;
|
||||
|
||||
@Column({name: 'NUMPED', select: false})
|
||||
orderId: number;
|
||||
|
||||
@Column({name: 'NOMEECOMMERCE'})
|
||||
description: string;
|
||||
|
||||
@Column({name: 'URLIMAGEM'})
|
||||
image: string;
|
||||
|
||||
@Column({name: 'TIPOPRODUTO'})
|
||||
productType: string;
|
||||
|
||||
@Column({name: 'TIPOENTREGA'})
|
||||
deliveryType: string;
|
||||
|
||||
@Column({name: 'CODFILIALRETIRA'})
|
||||
stockStore: string;
|
||||
|
||||
@Column({name: 'CODUSUR'})
|
||||
seller: number;
|
||||
|
||||
@Column({name: 'PRECOPROMOCAO'})
|
||||
promotion: number;
|
||||
|
||||
@Column({name: 'CODFUNCDESC'})
|
||||
userDiscount: number;
|
||||
|
||||
@Column({name: 'MULTIPLO'})
|
||||
mutiple: number;
|
||||
|
||||
@Column({name: 'DESCRICAOAUXILIAR'})
|
||||
auxDescription: string;
|
||||
|
||||
@Column({name: 'DESCRICAO'})
|
||||
smallDescription: string;
|
||||
|
||||
@Column({name: 'MARCA'})
|
||||
brand: string;
|
||||
|
||||
@Column({name: 'PERCACRESCIMO'})
|
||||
percentUpQuantity: number;
|
||||
|
||||
@Column({name: 'QTACRESCIMO'})
|
||||
upQuantity: number;
|
||||
|
||||
@Column({name: 'BASETINTOMETRICO'})
|
||||
base: string;
|
||||
|
||||
@Column({name: 'LETRATINTOMETRICO'})
|
||||
letter: string;
|
||||
|
||||
@Column({name: 'LINHATINTOMETRICO'})
|
||||
line: string;
|
||||
|
||||
@Column({name: 'CORTINTOMETRICO'})
|
||||
color: string;
|
||||
|
||||
@Column({name: 'LITRAGEM'})
|
||||
can: number;
|
||||
|
||||
@Column({name: 'AMBIENTE'})
|
||||
environment: string;
|
||||
|
||||
@Column({name: 'PRODUTOCOMPREJUNTO'})
|
||||
productTogether: string;
|
||||
|
||||
}
|
||||
30
src/domain/entity/tables/estprotocolo.entity.ts
Normal file
30
src/domain/entity/tables/estprotocolo.entity.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { Column, Entity, PrimaryColumn } from 'typeorm';
|
||||
|
||||
@Entity("ESTPROTOCOLOENTREGA")
|
||||
export class Estprotocoloentrega {
|
||||
|
||||
@PrimaryColumn({name: 'NUMCAR'})
|
||||
numeroCarregamento: number;
|
||||
|
||||
@Column({name: 'CODCLI'})
|
||||
codigoCliente: number;
|
||||
|
||||
@Column({name: 'DTENTREGA'})
|
||||
dataEntrega: Date;
|
||||
|
||||
@Column({name: 'CPFRECEBEDOR'})
|
||||
cpfRecebedor: string;
|
||||
|
||||
@Column({name: 'NOMERECEBEDOR'})
|
||||
nomeRecebedor: string;
|
||||
|
||||
@Column({name: 'URL_IMAGEMPROTOCOLO'})
|
||||
urlImagemProtocolo: string;
|
||||
|
||||
@Column({name: 'LATITUDE'})
|
||||
latitude: number;
|
||||
|
||||
@Column({name: 'LONGITUDE'})
|
||||
longitude: number;
|
||||
|
||||
}
|
||||
58
src/domain/entity/tables/estruptura.entity.ts
Normal file
58
src/domain/entity/tables/estruptura.entity.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity('ESTRUPTURA')
|
||||
export class Estruptura {
|
||||
|
||||
@PrimaryColumn({name: 'ID'})
|
||||
id: number;
|
||||
|
||||
@Column({name: 'DATA'})
|
||||
date: Date;
|
||||
|
||||
@Column({name: 'CODFILIAL'})
|
||||
store: string;
|
||||
|
||||
@Column({name: 'CODCLI'})
|
||||
customerId: number;
|
||||
|
||||
@Column({name: 'CPF_CNPJ'})
|
||||
document: string;
|
||||
|
||||
@Column({name: 'NOME'})
|
||||
name: string;
|
||||
|
||||
@Column({name: 'CELULAR'})
|
||||
cellPhone: string;
|
||||
|
||||
@Column({name: 'EMAIL'})
|
||||
email: string;
|
||||
|
||||
@Column({name: 'CODUSUR'})
|
||||
sellerId: number;
|
||||
|
||||
@Column({name: 'CODPROD'})
|
||||
productId: number;
|
||||
|
||||
@Column({name: 'QT'})
|
||||
quantity: number;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* --Script criação tabela
|
||||
CREATE TABLE ESTRUPTURA (
|
||||
ID NUMBER(10),
|
||||
DATA DATE,
|
||||
CODFILIAL VARCHAR2(2),
|
||||
CODCLI NUMBER(6),
|
||||
CPF_CNPJ VARCHAR2(20),
|
||||
NOME VARCHAR2(100),
|
||||
CELULAR VARCHAR2(20),
|
||||
EMAIL VARCHAR2(100),
|
||||
CODUSUR NUMBER(6),
|
||||
CODPROD NUMBER(6),
|
||||
QT NUMBER(22,6) );
|
||||
|
||||
|
||||
CREATE SEQUENCE ESSRUPTURA;
|
||||
*/
|
||||
14
src/domain/entity/tables/estsubcategoriacliente.entity.ts
Normal file
14
src/domain/entity/tables/estsubcategoriacliente.entity.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity('ESTSUBCATEGORIACLIENTE')
|
||||
export class Estsubcategoriacliente {
|
||||
@PrimaryColumn({name: 'ID'})
|
||||
id: number;
|
||||
|
||||
@Column({name: 'CATEGORIAID'})
|
||||
categoryId: number;
|
||||
|
||||
@Column({name: 'DESCRICAO'})
|
||||
name: string;
|
||||
|
||||
}
|
||||
56
src/domain/entity/tables/esttipoproduto.entity.ts
Normal file
56
src/domain/entity/tables/esttipoproduto.entity.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import { Pccest } from './pccest.entity';
|
||||
import { Pccategoria } from './pccategoria.entity';
|
||||
import { Pcdepto } from 'src/domain/entity/tables/pcdepto.entity';
|
||||
import { PrimaryColumn, Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { Pcncm } from './pcncm.entity';
|
||||
import { Pcsecao } from './pcsecao.entity';
|
||||
|
||||
@Entity("ESTTIPOPRODUTO")
|
||||
export class Esttipoproduto {
|
||||
|
||||
@PrimaryColumn({name: 'IDTIPOPRODUTO'})
|
||||
idTipoProduto: number;
|
||||
|
||||
@Column({name: 'NCM'})
|
||||
ncm: string;
|
||||
|
||||
@ManyToOne(() => Pcncm, itemNcm => itemNcm.tiposProduto)
|
||||
@JoinColumn({ name: 'NCM' })
|
||||
registroNcm: Pcncm;
|
||||
|
||||
@Column({name: 'TIPOPRODUTO'})
|
||||
tipoProduto: string;
|
||||
|
||||
@Column({name: 'SIGLAPRODUTO'})
|
||||
sigla: string;
|
||||
|
||||
@Column({name: 'CODEPTO'})
|
||||
codigoDepartamento: number;
|
||||
|
||||
@Column({name: 'CODSEC'})
|
||||
codigoSecao: number;
|
||||
|
||||
@Column({name: 'CODCATEGORIA'})
|
||||
codigoCategoria: number;
|
||||
|
||||
@Column({name: 'CEST'})
|
||||
cest: number;
|
||||
|
||||
@ManyToOne(() => Pcdepto, departamento => departamento.tiposProduto)
|
||||
@JoinColumn({ name: 'CODEPTO' })
|
||||
departamento: Pcdepto;
|
||||
|
||||
@ManyToOne(() => Pcsecao, secao => secao.tiposProduto)
|
||||
@JoinColumn({ name: 'CODSEC' })
|
||||
secao: Pcsecao;
|
||||
|
||||
@ManyToOne(() => Pccategoria, categoria => categoria.tiposProduto)
|
||||
@JoinColumn({ name: 'CODCATEGORIA' })
|
||||
categoria: Pccategoria;
|
||||
|
||||
@ManyToOne(() => Pccest, itemCest => itemCest.tiposProduto)
|
||||
@JoinColumn({ name: 'CEST' })
|
||||
registrocest: Pccest;
|
||||
|
||||
|
||||
}
|
||||
27
src/domain/entity/tables/estusuario.enity.ts
Normal file
27
src/domain/entity/tables/estusuario.enity.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity('ESTUSUARIO')
|
||||
export class User {
|
||||
|
||||
@PrimaryColumn({name: 'IDUSUARIO'})
|
||||
id: number;
|
||||
|
||||
@Column({name: 'NOME'})
|
||||
username: string;
|
||||
|
||||
@Column({name: 'EMAIL'})
|
||||
email: string;
|
||||
|
||||
@Column({name: 'SENHA', select: false})
|
||||
password: string;
|
||||
|
||||
@Column({name: 'TIPO'})
|
||||
role: string;
|
||||
|
||||
@Column({name: 'BLOQUEADO'})
|
||||
blocked: string;
|
||||
|
||||
@Column({name: 'MATRICULA'})
|
||||
registration: string;
|
||||
|
||||
}
|
||||
44
src/domain/entity/tables/estvenda.entity.ts
Normal file
44
src/domain/entity/tables/estvenda.entity.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity('ESTVENDA')
|
||||
export class Sale {
|
||||
@PrimaryColumn({ name: 'ID' })
|
||||
id: string;
|
||||
|
||||
@Column({ name: 'CODCLI' })
|
||||
codcli: number;
|
||||
|
||||
@Column({ name: 'CODUSUR' })
|
||||
codusur: number;
|
||||
|
||||
@Column({ name: 'CODENDCLI' })
|
||||
codendcli: number;
|
||||
|
||||
@Column({ name: 'CODPLPAG' })
|
||||
codplpag: number;
|
||||
|
||||
@Column({ name: 'CODCOB' })
|
||||
codcob: string;
|
||||
|
||||
@Column({ name: 'OBSERVACAO1' })
|
||||
observacao1: string;
|
||||
|
||||
@Column({ name: 'OBSERVACAO2' })
|
||||
observacao2: string;
|
||||
|
||||
@Column({ name: 'OBSERVACAO3' })
|
||||
observacao3: string;
|
||||
|
||||
@Column({ name: 'OBSERVACAOENTREGA1' })
|
||||
observacaoentrega1: string;
|
||||
|
||||
@Column({ name: 'OBSERVACAOENTREGA2' })
|
||||
observacaoentrega2: string;
|
||||
|
||||
@Column({ name: 'OBSERVACAOENTREGA3' })
|
||||
observacaoentrega3: string;
|
||||
|
||||
@Column({ name: 'VLFRETE' })
|
||||
vlfrete: number;
|
||||
|
||||
}
|
||||
27
src/domain/entity/tables/estvendaprecliente.entity.ts
Normal file
27
src/domain/entity/tables/estvendaprecliente.entity.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity('ESTVENDAPRECLIENTE')
|
||||
export class Estvendaprecliente {
|
||||
|
||||
@PrimaryColumn({ name: 'ID'})
|
||||
id: number;
|
||||
|
||||
@Column({ name: 'IDCART'})
|
||||
idcart: string;
|
||||
|
||||
@Column({ name: 'CPF'})
|
||||
cpf: string;
|
||||
|
||||
@Column({ name: 'NOME'})
|
||||
nome: string;
|
||||
|
||||
@Column({ name: 'TELEFONE'})
|
||||
telefone: string;
|
||||
|
||||
@Column({ name: 'CODUSUR'})
|
||||
codusur: number;
|
||||
|
||||
@Column({ name: 'DTCADASTRO'})
|
||||
dtcadastro: Date;
|
||||
|
||||
}
|
||||
15
src/domain/entity/tables/pccaixa.entity.ts
Normal file
15
src/domain/entity/tables/pccaixa.entity.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity("PCCAIXA")
|
||||
export class Checkout {
|
||||
|
||||
@PrimaryColumn({name: "NUMCAIXA"})
|
||||
id: number;
|
||||
|
||||
@Column({name: "DESCRICAO"})
|
||||
description: string;
|
||||
|
||||
@Column({name: "NUMSERIEEQUIP"})
|
||||
serialNumber: string;
|
||||
|
||||
}
|
||||
421
src/domain/entity/tables/pccarreg.entity.ts
Normal file
421
src/domain/entity/tables/pccarreg.entity.ts
Normal file
@@ -0,0 +1,421 @@
|
||||
import { Pcpedc } from './pcpedc.entity';
|
||||
import { Pcempr } from './pcempr.entity';
|
||||
import { Entity, Column, PrimaryColumn, OneToMany, OneToOne, JoinColumn } from "typeorm";
|
||||
import { Pcnfsaid } from "./pcnfsaid.entity";
|
||||
|
||||
@Entity('PCCARREG')
|
||||
export class Pccarreg {
|
||||
|
||||
@PrimaryColumn({ name: 'NUMCAR' })
|
||||
numcar: number;
|
||||
|
||||
@Column({ name: 'DTSAIDA' })
|
||||
dtsaida: Date;
|
||||
|
||||
@Column({ name: 'CODMOTORISTA' })
|
||||
codmotorista: number;
|
||||
|
||||
@Column({ name: 'CODVEICULO' })
|
||||
codveiculo: number;
|
||||
|
||||
@Column({ name: 'TOTPESO' })
|
||||
totpeso: number;
|
||||
|
||||
@Column({ name: 'TOTVOLUME' })
|
||||
totvolume: number;
|
||||
|
||||
@Column({ name: 'VLTOTAL' })
|
||||
vltotal: number;
|
||||
|
||||
@Column({ name: 'DTFECHA' })
|
||||
dtfecha: Date;
|
||||
|
||||
@Column({ name: 'DESTINO' })
|
||||
destino: string;
|
||||
|
||||
@Column({ name: 'NUMNOTAS' })
|
||||
numnotas: number;
|
||||
|
||||
@Column({ name: 'CODCAIXA' })
|
||||
codcaixa: number;
|
||||
|
||||
@Column({ name: 'PERCOM' })
|
||||
percom: number;
|
||||
|
||||
@Column({ name: 'NUMENT' })
|
||||
nument: number;
|
||||
|
||||
@Column({ name: 'NUMCID' })
|
||||
numcid: number;
|
||||
|
||||
@Column({ name: 'PREVCHEG' })
|
||||
prevcheg: Date;
|
||||
|
||||
@Column({ name: 'DTRETORNO' })
|
||||
dtretorno: Date;
|
||||
|
||||
@Column({ name: 'CODCONF' })
|
||||
codconf: number;
|
||||
|
||||
@Column({ name: 'DT_CANCEL' })
|
||||
dt_cancel: Date;
|
||||
|
||||
@Column({ name: 'DATAMON' })
|
||||
datamon: Date;
|
||||
|
||||
@Column({ name: 'CODFUNCMON' })
|
||||
codfuncmon: number;
|
||||
|
||||
@Column({ name: 'DATAMAPA' })
|
||||
datamapa: Date;
|
||||
|
||||
@Column({ name: 'CODFUNCMAPA' })
|
||||
codfuncmapa: number;
|
||||
|
||||
@Column({ name: 'NUMVIASMAPA' })
|
||||
numviasmapa: number;
|
||||
|
||||
@Column({ name: 'DTCAIXA' })
|
||||
dtcaixa: Date;
|
||||
|
||||
@Column({ name: 'DTFAT' })
|
||||
dtfat: Date;
|
||||
|
||||
@Column({ name: 'CODFUNCFAT' })
|
||||
codfuncfat: number;
|
||||
|
||||
@Column({ name: 'CODFUNCCANCEL' })
|
||||
codfunccancel: number;
|
||||
|
||||
@Column({ name: 'DATACONF' })
|
||||
dataconf: Date;
|
||||
|
||||
@Column({ name: 'QTITENS' })
|
||||
qtitens: number;
|
||||
|
||||
@Column({ name: 'OBSFATUR' })
|
||||
obsfatur: string;
|
||||
|
||||
@Column({ name: 'TIPOCARGA' })
|
||||
tipocarga: string;
|
||||
|
||||
@Column({ name: 'KMINICIAL' })
|
||||
kminicial: number;
|
||||
|
||||
@Column({ name: 'KMFINAL' })
|
||||
kmfinal: number;
|
||||
|
||||
@Column({ name: 'DTSAIDAVEICULO' })
|
||||
dtsaidaveiculo: Date;
|
||||
|
||||
@Column({ name: 'CODROTAPRINC' })
|
||||
codrotaprinc: number;
|
||||
|
||||
@Column({ name: 'NUMDIARIAS' })
|
||||
numdiarias: number;
|
||||
|
||||
@Column({ name: 'CODFUNCAJUD' })
|
||||
codfuncajud: number;
|
||||
|
||||
@Column({ name: 'PAGCOMMOTMIN' })
|
||||
pagcommotmin: string;
|
||||
|
||||
@Column({ name: 'VLVALERETENCAO' })
|
||||
vlvaleretencao: number;
|
||||
|
||||
@Column({ name: 'HORAFECHA' })
|
||||
horafecha: number;
|
||||
|
||||
@Column({ name: 'MINUTOFECHA' })
|
||||
minutofecha: number;
|
||||
|
||||
@Column({ name: 'NUMCAROL' })
|
||||
numcarol: number;
|
||||
|
||||
@Column({ name: 'CONHECFRETE' })
|
||||
conhecfrete: string;
|
||||
|
||||
@Column({ name: 'NUMCAROPERLOG' })
|
||||
numcaroperlog: number;
|
||||
|
||||
@Column({ name: 'DTFECHACOMISSMOT' })
|
||||
dtfechacomissmot: Date;
|
||||
|
||||
@Column({ name: 'QTCOMBUSTIVEL' })
|
||||
qtcombustivel: number;
|
||||
|
||||
@Column({ name: 'BALCAOBAIXADO' })
|
||||
balcaobaixado: string;
|
||||
|
||||
@Column({ name: 'OBSDESTINO' })
|
||||
obsdestino: string;
|
||||
|
||||
@Column({ name: 'VLFRETE' })
|
||||
vlfrete: number;
|
||||
|
||||
@Column({ name: 'ABASTECIDO' })
|
||||
abastecido: string;
|
||||
|
||||
@Column({ name: 'MAPAGERADOWMS' })
|
||||
mapageradowms: string;
|
||||
|
||||
@Column({ name: 'CONHECGERADO' })
|
||||
conhecgerado: string;
|
||||
|
||||
@Column({ name: 'MAPAGERADOWMSPAL' })
|
||||
mapageradowmspal: string;
|
||||
|
||||
@Column({ name: 'VLCOMBUSTIVEL' })
|
||||
vlcombustivel: number;
|
||||
|
||||
@Column({ name: 'NUMCARWMS' })
|
||||
numcarwms: number;
|
||||
|
||||
@Column({ name: 'QTCAIXAS' })
|
||||
qtcaixas: number;
|
||||
|
||||
@Column({ name: 'HORAMON' })
|
||||
horamon: number;
|
||||
|
||||
@Column({ name: 'MINUTOMON' })
|
||||
minutomon: number;
|
||||
|
||||
@Column({ name: 'DTINICIOCHECKOUT' })
|
||||
dtiniciocheckout: Date;
|
||||
|
||||
@Column({ name: 'DTFIMCHECKOUT' })
|
||||
dtfimcheckout: Date;
|
||||
|
||||
@Column({ name: 'DATAHORAMAPA' })
|
||||
datahoramapa: Date;
|
||||
|
||||
@Column({ name: 'NUMCARBROKER' })
|
||||
numcarbroker: number;
|
||||
|
||||
@Column({ name: 'PERCOMTERC' })
|
||||
percomterc: number;
|
||||
|
||||
@Column({ name: 'PERCOMAJUD' })
|
||||
percomajud: number;
|
||||
|
||||
@Column({ name: 'TIPOCOMISSAO' })
|
||||
tipocomissao: string;
|
||||
|
||||
@Column({ name: 'NUMLANCDIARIA' })
|
||||
numlancdiaria: number;
|
||||
|
||||
@Column({ name: 'CARGASECUNDARIA' })
|
||||
cargasecundaria: string;
|
||||
|
||||
@Column({ name: 'LACRE' })
|
||||
lacre: string;
|
||||
|
||||
@Column({ name: 'VLDIARIA' })
|
||||
vldiaria: number;
|
||||
|
||||
@Column({ name: 'VLDESPAJUDANTE' })
|
||||
vldespajudante: number;
|
||||
|
||||
@Column({ name: 'DATACONFFIM' })
|
||||
dataconffim: Date;
|
||||
|
||||
@Column({ name: 'DTINICIALPEND' })
|
||||
dtinicialpend: Date;
|
||||
|
||||
@Column({ name: 'DTFINALPEND' })
|
||||
dtfinalpend: Date;
|
||||
|
||||
@Column({ name: 'FROTA_PESO' })
|
||||
frota_peso: number;
|
||||
|
||||
@Column({ name: 'CODMOTTRANSBORDO' })
|
||||
codmottransbordo: number;
|
||||
|
||||
@Column({ name: 'CODAJUDTRANSBORDO' })
|
||||
codajudtransbordo: number;
|
||||
|
||||
@Column({ name: 'LANCTOCPAGARFECHCOMISS414' })
|
||||
lanctocpagarfechcomiss414: string;
|
||||
|
||||
@Column({ name: 'DTFECHACOMMOTTRANSB' })
|
||||
dtfechacommottransb: Date;
|
||||
|
||||
@Column({ name: 'DTFECHACOMAJUDTRANSB' })
|
||||
dtfechacomajudtransb: Date;
|
||||
|
||||
@Column({ name: 'DTFECHACOMAJUD' })
|
||||
dtfechacomajud: Date;
|
||||
|
||||
@Column({ name: 'CODFUNCMAPACARAGRUPADO' })
|
||||
codfuncmapacaragrupado: number;
|
||||
|
||||
@Column({ name: 'DATAHORAMAPACARAGRUPADO' })
|
||||
datahoramapacaragrupado: Date;
|
||||
|
||||
@Column({ name: 'NUMCARAGRUPADO' })
|
||||
numcaragrupado: number;
|
||||
|
||||
@Column({ name: 'NUMVIASCARAGRUPADO' })
|
||||
numviascaragrupado: number;
|
||||
|
||||
@Column({ name: 'CODMOTORISTACARAGRUPADO' })
|
||||
codmotoristacaragrupado: number;
|
||||
|
||||
@Column({ name: 'CODVEICULCARAGRUPADO' })
|
||||
codveiculcaragrupado: number;
|
||||
|
||||
@Column({ name: 'DATACARAGRUPADO' })
|
||||
datacaragrupado: Date;
|
||||
|
||||
@Column({ name: 'TRANSFERENCIA' })
|
||||
transferencia: string;
|
||||
|
||||
@Column({ name: 'SEGURADA' })
|
||||
segurada: string;
|
||||
|
||||
@Column({ name: 'CODFILIALSAIDA' })
|
||||
codfilialsaida: string;
|
||||
|
||||
@Column({ name: 'OBSDESTINOAGRUP' })
|
||||
obsdestinoagrup: string;
|
||||
|
||||
@Column({ name: 'DESTINOAGRUP' })
|
||||
destinoagrup: string;
|
||||
|
||||
@Column({ name: 'OBSACERTO' })
|
||||
obsacerto: string;
|
||||
|
||||
@Column({ name: 'VLFIXO' })
|
||||
vlfixo: number;
|
||||
|
||||
@Column({ name: 'VLPED' })
|
||||
vlped: number;
|
||||
|
||||
@Column({ name: 'PERGRIS' })
|
||||
pergris: number;
|
||||
|
||||
@Column({ name: 'VALORKG' })
|
||||
valorkg: number;
|
||||
|
||||
@Column({ name: 'LANCARDESPDESCFINAUTOMATIC' })
|
||||
lancardespdescfinautomatic: string;
|
||||
|
||||
@Column({ name: 'CODFUNCCONF' })
|
||||
codfuncconf: number;
|
||||
|
||||
@Column({ name: 'CODFUNCSAIDACAR' })
|
||||
codfuncsaidacar: number;
|
||||
|
||||
@Column({ name: 'CODFUNCRETORNOCAR' })
|
||||
codfuncretornocar: number;
|
||||
|
||||
@Column({ name: 'SEGUNDOMON' })
|
||||
segundomon: number;
|
||||
|
||||
@Column({ name: 'SEGUNDOSFECHA' })
|
||||
segundosfecha: number;
|
||||
|
||||
@Column({ name: 'NUMONUCARGA' })
|
||||
numonucarga: string;
|
||||
|
||||
@Column({ name: 'NOMEAPROPRIADOCARGA' })
|
||||
nomeapropriadocarga: string;
|
||||
|
||||
@Column({ name: 'DIVISAOCARGA' })
|
||||
divisaocarga: string;
|
||||
|
||||
@Column({ name: 'GRUPOEMBCARGA' })
|
||||
grupoembcarga: string;
|
||||
|
||||
@Column({ name: 'QTDTOTALPRODCARGA' })
|
||||
qtdtotalprodcarga: string;
|
||||
|
||||
@Column({ name: 'PONTOFUGORCARGA' })
|
||||
pontofugorcarga: string;
|
||||
|
||||
@Column({ name: 'CODVEICULO1' })
|
||||
codveiculo1: number;
|
||||
|
||||
@Column({ name: 'CODVEICULO2' })
|
||||
codveiculo2: number;
|
||||
|
||||
@Column({ name: 'CODFUNCAJUD2' })
|
||||
codfuncajud2: number;
|
||||
|
||||
@Column({ name: 'CODFUNCAJUD3' })
|
||||
codfuncajud3: number;
|
||||
|
||||
@Column({ name: 'GEOVOLUMETOTAL' })
|
||||
geovolumetotal: number;
|
||||
|
||||
@Column({ name: 'DTEXPORTACAO' })
|
||||
dtexportacao: Date;
|
||||
|
||||
@Column({ name: 'OBSEXPORTACAO' })
|
||||
obsexportacao: string;
|
||||
|
||||
@Column({ name: 'IDINTEGRACAOMYFROTA' })
|
||||
idintegracaomyfrota: string;
|
||||
|
||||
@Column({ name: 'CODTIPOVEICULO' })
|
||||
codtipoveiculo: number;
|
||||
|
||||
@Column({ name: 'CODPERFILVEICULO' })
|
||||
codperfilveiculo: number;
|
||||
|
||||
@Column({ name: 'TIPOCALCULOCOMISSAOFRETISTA' })
|
||||
tipocalculocomissaofretista: string;
|
||||
|
||||
@Column({ name: 'CODFUNTIPOCALCCOMISSAOFRETISTA' })
|
||||
codfuntipocalccomissaofretista: number;
|
||||
|
||||
@Column({ name: 'LIBERA_RETAGUARDA' })
|
||||
libera_retaguarda: string;
|
||||
|
||||
@Column({ name: 'CODFUNCLIBEROURET' })
|
||||
codfuncliberouret: number;
|
||||
|
||||
@Column({ name: 'DATALIBEROURET' })
|
||||
dataliberouret: Date;
|
||||
|
||||
@Column({ name: 'NUMCARMANIFCONCLUIDOFV' })
|
||||
numcarmanifconcluidofv: string;
|
||||
|
||||
@Column({ name: 'CODFUNCFECHA' })
|
||||
codfuncfecha: number;
|
||||
|
||||
@Column({ name: 'OBSFRETE' })
|
||||
obsfrete: string;
|
||||
|
||||
@Column({ name: 'LANCIMPPRIMPARC' })
|
||||
lancimpprimparc: string;
|
||||
|
||||
@Column({ name: 'NUMONDA' })
|
||||
numonda: number;
|
||||
|
||||
@Column({ name: 'ORDEMSEP' })
|
||||
ordemsep: number;
|
||||
|
||||
@Column({ name: 'ORDEMCONF' })
|
||||
ordemconf: number;
|
||||
|
||||
@Column({ name: 'IDSOFITVIEW' })
|
||||
idsofitview: string;
|
||||
|
||||
@Column({ name: 'ULTIMASITUACAOCFAT' })
|
||||
ultimasituacaocfat: string;
|
||||
|
||||
@Column({ name: 'DATAULTIMASITUACAOCFAT' })
|
||||
dataultimasituacaocfat: Date;
|
||||
|
||||
@OneToMany(type => Pcnfsaid, notas => notas.pccarreg)
|
||||
notas: Pcnfsaid[];
|
||||
|
||||
@OneToMany(type => Pcpedc, pedidos => pedidos.pccarreg)
|
||||
pedidos: Pcnfsaid[];
|
||||
|
||||
@OneToOne(type => Pcempr)
|
||||
@JoinColumn({ name: 'CODMOTORISTA' })
|
||||
motorista: Pcempr;
|
||||
|
||||
}
|
||||
25
src/domain/entity/tables/pccategoria.entity.ts
Normal file
25
src/domain/entity/tables/pccategoria.entity.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryColumn } from "typeorm";
|
||||
import { Esttipoproduto } from './esttipoproduto.entity';
|
||||
import { Pcsecao } from './pcsecao.entity';
|
||||
|
||||
@Entity("PCCATEGORIA")
|
||||
export class Pccategoria {
|
||||
|
||||
@PrimaryColumn({name: "CODSEC"})
|
||||
codigoSecao: number;
|
||||
|
||||
@PrimaryColumn({name: "CODCATEGORIA"})
|
||||
codigoCategoria: number;
|
||||
|
||||
@Column({name: "CATEGORIA"})
|
||||
descricao: string;
|
||||
|
||||
@ManyToOne(() => Pcsecao, secao => secao.categorias)
|
||||
@JoinColumn({name: 'CODSEC'})
|
||||
secao: Pcsecao;
|
||||
|
||||
@OneToMany(() => Esttipoproduto, tipoProduto => tipoProduto.categoria)
|
||||
tiposProduto: Esttipoproduto[];
|
||||
|
||||
|
||||
}
|
||||
22
src/domain/entity/tables/pccest.entity.ts
Normal file
22
src/domain/entity/tables/pccest.entity.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm";
|
||||
import { Esttipoproduto } from "./esttipoproduto.entity";
|
||||
|
||||
@Entity("PCCEST")
|
||||
export class Pccest {
|
||||
|
||||
@PrimaryColumn({name: "CODIGO"})
|
||||
codigo: number;
|
||||
|
||||
@Column({name: "CODCEST"})
|
||||
codigoCest: string;
|
||||
|
||||
@Column({name: "DESCRICAOCEST"})
|
||||
descricao: string;
|
||||
|
||||
@Column({name: "NCM"})
|
||||
codigoNcm: string;
|
||||
|
||||
@OneToMany(() => Esttipoproduto, tipoProduto => tipoProduto.registrocest)
|
||||
tiposProduto: Esttipoproduto[];
|
||||
|
||||
}
|
||||
38
src/domain/entity/tables/pccidade.entity.ts
Normal file
38
src/domain/entity/tables/pccidade.entity.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity('PCCIDADE')
|
||||
export class Pccidade {
|
||||
@PrimaryColumn({ name: 'CODCIDADE' })
|
||||
codcidade: number;
|
||||
|
||||
@Column({ name: 'NOMECIDADE' })
|
||||
nomecidade: string;
|
||||
|
||||
@Column({ name: 'CODIBGE' })
|
||||
codibge: number;
|
||||
|
||||
@Column({ name: 'UF' })
|
||||
uf: string;
|
||||
|
||||
@Column({ name: 'POPULACAO' })
|
||||
populacao: number;
|
||||
|
||||
@Column({ name: 'CODMUNESTADUAL' })
|
||||
codmunestadual: number;
|
||||
|
||||
@Column({ name: 'UTILIZAFRETETRANSP' })
|
||||
utilizafretetransp: string;
|
||||
|
||||
@Column({ name: 'CODMUNSIAFI' })
|
||||
codmunsiafi: number;
|
||||
|
||||
@Column({ name: 'DTMXSALTER' })
|
||||
dtmxsalter: Date;
|
||||
|
||||
@Column({ name: 'LATITUDE' })
|
||||
latitude: string;
|
||||
|
||||
@Column({ name: 'LONGITUDE' })
|
||||
longitude: string;
|
||||
|
||||
}
|
||||
1646
src/domain/entity/tables/pcclient.entity.ts
Normal file
1646
src/domain/entity/tables/pcclient.entity.ts
Normal file
File diff suppressed because it is too large
Load Diff
82
src/domain/entity/tables/pcclientendent.entity.ts
Normal file
82
src/domain/entity/tables/pcclientendent.entity.ts
Normal file
@@ -0,0 +1,82 @@
|
||||
import { Pcpedc } from './pcpedc.entity';
|
||||
import { Entity, Column, PrimaryColumn, OneToMany } from "typeorm";
|
||||
|
||||
@Entity('PCCLIENTENDENT')
|
||||
export class Pcclientendent {
|
||||
|
||||
@PrimaryColumn({name: 'CODCLI'})
|
||||
codcli: number;
|
||||
|
||||
@PrimaryColumn({name: 'CODENDENTCLI'})
|
||||
codendentcli: number;
|
||||
|
||||
@Column({name: 'BAIRROENT'})
|
||||
bairroent: string;
|
||||
|
||||
@Column({name: 'MUNICENT'})
|
||||
municent: string;
|
||||
|
||||
@Column({name: 'ESTENT'})
|
||||
estent: string;
|
||||
|
||||
@Column({name: 'CEPENT'})
|
||||
cepent: string;
|
||||
|
||||
@Column({name: 'ENDERENT'})
|
||||
enderent: string;
|
||||
|
||||
@Column({name: 'COMPLEMENTOENT'})
|
||||
complementoent: string;
|
||||
|
||||
@Column({name: 'NUMEROENT'})
|
||||
numeroent: string;
|
||||
|
||||
@Column({name: 'CODMUNICIPIO'})
|
||||
codmunicipio: number;
|
||||
|
||||
@Column({name: 'CODCIDADE'})
|
||||
codcidade: number;
|
||||
|
||||
@Column({name: 'PONTOREFER'})
|
||||
pontorefer: string;
|
||||
|
||||
@Column({name: 'LONGITUDE'})
|
||||
longitude: string;
|
||||
|
||||
@Column({name: 'LATITUDE'})
|
||||
latitude: string;
|
||||
|
||||
@Column({name: 'OBSERVACAO'})
|
||||
observacao: string;
|
||||
|
||||
@Column({name: 'FONERECEBEDOR'})
|
||||
fonerecebedor: number;
|
||||
|
||||
@Column({name: 'TELENT'})
|
||||
telent: string;
|
||||
|
||||
@Column({name: 'CODPRACAENT'})
|
||||
codpracaent: number;
|
||||
|
||||
@Column({name: 'EMAILRECEBEDOR'})
|
||||
emailRecebedor: string;
|
||||
|
||||
@Column({name: 'RAZAORECEBEDOR'})
|
||||
razaorecebedor: string;
|
||||
|
||||
@Column({name: 'NUMREGIAO'})
|
||||
numregiao: number;
|
||||
|
||||
@Column({name: 'FANTASIA'})
|
||||
fantasia: string;
|
||||
|
||||
@Column({name: 'CEPRECEBEDOR'})
|
||||
ceprecebedor: string;
|
||||
|
||||
@Column({name: 'CODPAISRECEBEDOR'})
|
||||
codpaisrecebedor: number;
|
||||
|
||||
@OneToMany(() => Pcpedc, pedidos => pedidos.pcclientendent)
|
||||
pedidos: Pcpedc[];
|
||||
|
||||
}
|
||||
269
src/domain/entity/tables/pccob.entity.ts
Normal file
269
src/domain/entity/tables/pccob.entity.ts
Normal file
@@ -0,0 +1,269 @@
|
||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity('PCCOB')
|
||||
export class Pccob {
|
||||
@PrimaryColumn({ name: 'CODCOB' })
|
||||
codcob: string;
|
||||
|
||||
@Column({ name: 'COBRANCA' })
|
||||
cobranca: string;
|
||||
|
||||
@Column({ name: 'PAGCOMISSAO' })
|
||||
pagcomissao: string;
|
||||
|
||||
@Column({ name: 'TXJUROS' })
|
||||
txjuros: number;
|
||||
|
||||
@Column({ name: 'CODMOEDA' })
|
||||
codmoeda: string;
|
||||
|
||||
@Column({ name: 'BAIXACXBANCO' })
|
||||
baixacxbanco: string;
|
||||
|
||||
@Column({ name: 'NIVELVENDA' })
|
||||
nivelvenda: number;
|
||||
|
||||
@Column({ name: 'FLUXOCX' })
|
||||
fluxocx: string;
|
||||
|
||||
@Column({ name: 'COLUNAFLUXOCX' })
|
||||
colunafluxocx: number;
|
||||
|
||||
@Column({ name: 'NUMDIASVENCFLUXOCX' })
|
||||
numdiasvencfluxocx: number;
|
||||
|
||||
@Column({ name: 'BLOQAUTOMATICO' })
|
||||
bloqautomatico: string;
|
||||
|
||||
@Column({ name: 'NUMDIASBLOQAUTOMATIC' })
|
||||
numdiasbloqautomatic: number;
|
||||
|
||||
@Column({ name: 'EXIBIRCXMOT' })
|
||||
exibircxmot: string;
|
||||
|
||||
@Column({ name: 'EXIBIRBK' })
|
||||
exibirbk: string;
|
||||
|
||||
@Column({ name: 'PERCACRESVENDA' })
|
||||
percacresvenda: number;
|
||||
|
||||
@Column({ name: 'PRAZOMAXIMOVENDA' })
|
||||
prazomaximovenda: number;
|
||||
|
||||
@Column({ name: 'LETRACOB' })
|
||||
letracob: string;
|
||||
|
||||
@Column({ name: 'BOLETO' })
|
||||
boleto: string;
|
||||
|
||||
@Column({ name: 'CUSTODIA' })
|
||||
custodia: string;
|
||||
|
||||
@Column({ name: 'PERMITEALTCOBDESD' })
|
||||
permitealtcobdesd: string;
|
||||
|
||||
@Column({ name: 'PERCOM' })
|
||||
percom: number;
|
||||
|
||||
@Column({ name: 'VLTARIFA' })
|
||||
vltarifa: number;
|
||||
|
||||
@Column({ name: 'CODECF' })
|
||||
codecf: string;
|
||||
|
||||
@Column({ name: 'CARTAO' })
|
||||
cartao: string;
|
||||
|
||||
@Column({ name: 'OBSNF' })
|
||||
obsnf: string;
|
||||
|
||||
@Column({ name: 'NUMDIASLIBERACAOCREDITO' })
|
||||
numdiasliberacaocredito: number;
|
||||
|
||||
@Column({ name: 'CODCLICC' })
|
||||
codclicc: number;
|
||||
|
||||
@Column({ name: 'PRAZOCC' })
|
||||
prazocc: number;
|
||||
|
||||
@Column({ name: 'PERCTXADMINCC' })
|
||||
perctxadmincc: number;
|
||||
|
||||
@Column({ name: 'CODCONTACC' })
|
||||
codcontacc: number;
|
||||
|
||||
@Column({ name: 'CODCOBCC' })
|
||||
codcobcc: string;
|
||||
|
||||
@Column({ name: 'ENVIACOBRANCAFV' })
|
||||
enviacobrancafv: string;
|
||||
|
||||
@Column({ name: 'VALIDALIMCREDECF' })
|
||||
validalimcredecf: string;
|
||||
|
||||
@Column({ name: 'DIASCARENCIA' })
|
||||
diascarencia: number;
|
||||
|
||||
@Column({ name: 'ACERTOAUTOCXMOT' })
|
||||
acertoautocxmot: string;
|
||||
|
||||
@Column({ name: 'CODPARAPROTESTO' })
|
||||
codparaprotesto: string;
|
||||
|
||||
@Column({ name: 'ENVIOPARAPROTESTO' })
|
||||
envioparaprotesto: string;
|
||||
|
||||
@Column({ name: 'NUMDIASPROTESTO' })
|
||||
numdiasprotesto: string;
|
||||
|
||||
@Column({ name: 'NUMBANCO' })
|
||||
numbanco: number;
|
||||
|
||||
@Column({ name: 'PERMITEDESCDEVCLI' })
|
||||
permitedescdevcli: string;
|
||||
|
||||
@Column({ name: 'PERCOMMOT' })
|
||||
percommot: number;
|
||||
|
||||
@Column({ name: 'COBRANCABROKER' })
|
||||
cobrancabroker: string;
|
||||
|
||||
@Column({ name: 'VLMINPEDIDO' })
|
||||
vlminpedido: number;
|
||||
|
||||
@Column({ name: 'DEPOSITOBANCARIO' })
|
||||
depositobancario: string;
|
||||
|
||||
@Column({ name: 'TIPOCOMISSAO' })
|
||||
tipocomissao: string;
|
||||
|
||||
@Column({ name: 'CODBANCOTARIFA' })
|
||||
codbancotarifa: number;
|
||||
|
||||
@Column({ name: 'CODFILIAL' })
|
||||
codfilial: string;
|
||||
|
||||
@Column({ name: 'EXPORTARECF' })
|
||||
exportarecf: string;
|
||||
|
||||
@Column({ name: 'CODBANCO' })
|
||||
codbanco: number;
|
||||
|
||||
@Column({ name: 'SOMATARIFABANCDUPLIC' })
|
||||
somatarifabancduplic: string;
|
||||
|
||||
@Column({ name: 'SOMATARIFABANCNF' })
|
||||
somatarifabancnf: string;
|
||||
|
||||
@Column({ name: 'CODOPERADORACARTAO' })
|
||||
codoperadoracartao: string;
|
||||
|
||||
@Column({ name: 'TIPOOPERACAOTEF' })
|
||||
tipooperacaotef: string;
|
||||
|
||||
@Column({ name: 'TIPOPAGTOECF' })
|
||||
tipopagtoecf: string;
|
||||
|
||||
@Column({ name: 'NUMMAXPARCELAS' })
|
||||
nummaxparcelas: number;
|
||||
|
||||
@Column({ name: 'CODPARANAOPROTESTO' })
|
||||
codparanaoprotesto: string;
|
||||
|
||||
@Column({ name: 'PERMITEBAIXAMANUAL' })
|
||||
permitebaixamanual: string;
|
||||
|
||||
@Column({ name: 'NUMVIASCPADICIONAL' })
|
||||
numviascpadicional: string;
|
||||
|
||||
@Column({ name: 'CODBANDEIRA' })
|
||||
codbandeira: number;
|
||||
|
||||
@Column({ name: 'SELECIONACLIENTEECF' })
|
||||
selecionaclienteecf: string;
|
||||
|
||||
@Column({ name: 'AUTENTICARACERTOCX402' })
|
||||
autenticaracertocx402: string;
|
||||
|
||||
@Column({ name: 'UTILIZACHDESC' })
|
||||
utilizachdesc: string;
|
||||
|
||||
@Column({ name: 'CODCOBCHDESC' })
|
||||
codcobchdesc: string;
|
||||
|
||||
@Column({ name: 'CODCOBDEVCHDESC' })
|
||||
codcobdevchdesc: string;
|
||||
|
||||
@Column({ name: 'PERMITECONTRAVALE' })
|
||||
permitecontravale: string;
|
||||
|
||||
@Column({ name: 'COBRANCAEMTRANSITO' })
|
||||
cobrancaemtransito: string;
|
||||
|
||||
@Column({ name: 'CALCJUROSCOBRANCA' })
|
||||
calcjuroscobranca: string;
|
||||
|
||||
@Column({ name: 'CODIGOBANDEIRA' })
|
||||
codigobandeira: string;
|
||||
|
||||
@Column({ name: 'CONVENIO' })
|
||||
convenio: string;
|
||||
|
||||
@Column({ name: 'RECARGACELULAR' })
|
||||
recargacelular: string;
|
||||
|
||||
@Column({ name: 'CODREDE' })
|
||||
codrede: number;
|
||||
|
||||
@Column({ name: 'TXPRIMEIRAPARCELA' })
|
||||
txprimeiraparcela: string;
|
||||
|
||||
@Column({ name: 'NAOVALIDAPRAZOMEDIO' })
|
||||
naovalidaprazomedio: string;
|
||||
|
||||
@Column({ name: 'CHEQUE' })
|
||||
cheque: string;
|
||||
|
||||
@Column({ name: 'FLEXIVEL' })
|
||||
flexivel: string;
|
||||
|
||||
@Column({ name: 'CODCOBSEFAZ' })
|
||||
codcobsefaz: string;
|
||||
|
||||
@Column({ name: 'CODBANDEIRAOPERADORACARTAO' })
|
||||
codbandeiraoperadoracartao: string;
|
||||
|
||||
@Column({ name: 'BANDEIRACARTAO' })
|
||||
bandeiracartao: number;
|
||||
|
||||
@Column({ name: 'PERCMULTA' })
|
||||
percmulta: number;
|
||||
|
||||
@Column({ name: 'COBSUPPLIERCARD' })
|
||||
cobsuppliercard: string;
|
||||
|
||||
@Column({ name: 'INDPAG' })
|
||||
indpag: number;
|
||||
|
||||
@Column({ name: 'DTMXSALTER' })
|
||||
dtmxsalter: Date;
|
||||
|
||||
@Column({ name: 'MXDIASINAD' })
|
||||
mxdiasinad: number;
|
||||
|
||||
@Column({ name: 'MXINAD' })
|
||||
mxinad: string;
|
||||
|
||||
@Column({ name: 'CODOUTRO' })
|
||||
codoutro: string;
|
||||
|
||||
@Column({ name: 'CARTEIRADIGITAL' })
|
||||
carteiradigital: string;
|
||||
|
||||
@Column({ name: 'NOMECARTEIRADIGITAL' })
|
||||
nomecarteiradigital: string;
|
||||
|
||||
@Column({ name: 'DESCRICAOFORMAPAGTO' })
|
||||
descricaoformapagto: string;
|
||||
|
||||
}
|
||||
9
src/domain/entity/tables/pcconsum.entity.ts
Normal file
9
src/domain/entity/tables/pcconsum.entity.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity('PCCONSUM')
|
||||
export class Pcconsum {
|
||||
@PrimaryColumn({name: 'CODCLIPC'})
|
||||
codclipc: number;
|
||||
@Column({name: 'PROXNUMCLI'})
|
||||
proxnumcli: number;
|
||||
}
|
||||
24
src/domain/entity/tables/pcdepto.entity.ts
Normal file
24
src/domain/entity/tables/pcdepto.entity.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm";
|
||||
import { Esttipoproduto } from './esttipoproduto.entity';
|
||||
import { Pcsecao } from './pcsecao.entity';
|
||||
|
||||
|
||||
@Entity("PCDEPTO")
|
||||
export class Pcdepto {
|
||||
|
||||
@PrimaryColumn({name: "CODEPTO"})
|
||||
codigoDepartamento: number;
|
||||
|
||||
@Column({name: "DESCRICAO"})
|
||||
descricaoDepartamento: string;
|
||||
|
||||
@Column({name: "TITULOECOMMERCE"})
|
||||
tituloEcommerce: string;
|
||||
|
||||
@OneToMany(() => Pcsecao, secao => secao.departamento)
|
||||
secao: Pcsecao[];
|
||||
|
||||
@OneToMany(() => Esttipoproduto, tipoProduto => tipoProduto.departamento)
|
||||
tiposProduto: Esttipoproduto[];
|
||||
|
||||
}
|
||||
559
src/domain/entity/tables/pcempr.entity.ts
Normal file
559
src/domain/entity/tables/pcempr.entity.ts
Normal file
@@ -0,0 +1,559 @@
|
||||
import { Entity, Column, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity('PCEMPR')
|
||||
export class Pcempr {
|
||||
|
||||
@PrimaryColumn({name: 'MATRICULA'})
|
||||
matricula: number;
|
||||
|
||||
@Column({name: 'NOME'})
|
||||
nome: string;
|
||||
|
||||
@Column({name: 'DT_EXCLUSAO'})
|
||||
dt_exclusao: Date;
|
||||
|
||||
@Column({name: 'NOME_GUERRA'})
|
||||
nome_guerra: string;
|
||||
|
||||
@Column({name: 'ADMISSAO'})
|
||||
admissao: Date;
|
||||
|
||||
@Column({name: 'ENDERECO'})
|
||||
endereco: string;
|
||||
|
||||
@Column({name: 'BAIRRO'})
|
||||
bairro: string;
|
||||
|
||||
@Column({name: 'CIDADE'})
|
||||
cidade: string;
|
||||
|
||||
@Column({name: 'ESTADO'})
|
||||
estado: string;
|
||||
|
||||
@Column({name: 'FONE'})
|
||||
fone: string;
|
||||
|
||||
@Column({name: 'CODSETOR'})
|
||||
codsetor: number;
|
||||
|
||||
@Column({name: 'USUARIOBD'})
|
||||
usuariobd: string;
|
||||
|
||||
@Column({name: 'SENHABD'})
|
||||
senhabd: string;
|
||||
|
||||
@Column({name: 'SITUACAO'})
|
||||
situacao: string;
|
||||
|
||||
@Column({name: 'CPF'})
|
||||
cpf: string;
|
||||
|
||||
@Column({name: 'TIPOVENDA'})
|
||||
tipovenda: string;
|
||||
|
||||
@Column({name: 'CODFILIAL'})
|
||||
codfilial: string;
|
||||
|
||||
@Column({name: 'CODUSUR'})
|
||||
codusur: number;
|
||||
|
||||
@Column({name: 'CELULAR'})
|
||||
celular: string;
|
||||
|
||||
@Column({name: 'NUMBANCO'})
|
||||
numbanco: number;
|
||||
|
||||
@Column({name: 'NUMAGENCIA'})
|
||||
numagencia: number;
|
||||
|
||||
@Column({name: 'NUMCCORRENTE'})
|
||||
numccorrente: string;
|
||||
|
||||
@Column({name: 'NUMCENTRALPA'})
|
||||
numcentralpa: number;
|
||||
|
||||
@Column({name: 'NUMCENTRALTEL'})
|
||||
numcentraltel: string;
|
||||
|
||||
@Column({name: 'PERMITEALTJUROSBX'})
|
||||
permitealtjurosbx: string;
|
||||
|
||||
@Column({name: 'VLAUMENTOLIMCRED'})
|
||||
vlaumentolimcred: number;
|
||||
|
||||
@Column({name: 'TIPO'})
|
||||
tipo: string;
|
||||
|
||||
@Column({name: 'RG'})
|
||||
rg: string;
|
||||
|
||||
@Column({name: 'CTPS'})
|
||||
ctps: string;
|
||||
|
||||
@Column({name: 'PIS'})
|
||||
pis: string;
|
||||
|
||||
@Column({name: 'FUNCAO'})
|
||||
funcao: string;
|
||||
|
||||
@Column({name: 'EMAIL'})
|
||||
email: string;
|
||||
|
||||
@Column({name: 'FATORCOMISSAO'})
|
||||
fatorcomissao: number;
|
||||
|
||||
@Column({name: 'DTEXPIRASENHA'})
|
||||
dtexpirasenha: Date;
|
||||
|
||||
@Column({name: 'VLCOMISSTON'})
|
||||
vlcomisston: number;
|
||||
|
||||
@Column({name: 'VLCOMISSENT'})
|
||||
vlcomissent: number;
|
||||
|
||||
@Column({name: 'VLLIMCREDCOMPRA'})
|
||||
vllimcredcompra: number;
|
||||
|
||||
@Column({name: 'DTINICIOLIMCREDCOMPRA'})
|
||||
dtiniciolimcredcompra: Date;
|
||||
|
||||
@Column({name: 'DTFIMLIMCREDCOMPRA'})
|
||||
dtfimlimcredcompra: Date;
|
||||
|
||||
@Column({name: 'CODCONFERENTE'})
|
||||
codconferente: number;
|
||||
|
||||
@Column({name: 'CODFUNCAO'})
|
||||
codfuncao: number;
|
||||
|
||||
@Column({name: 'SERIECTPS'})
|
||||
seriectps: string;
|
||||
|
||||
@Column({name: 'GERACCCARD'})
|
||||
geracccard: string;
|
||||
|
||||
@Column({name: 'MATRICULACCCARD'})
|
||||
matriculacccard: number;
|
||||
|
||||
@Column({name: 'VLSALCARTEIRA'})
|
||||
vlsalcarteira: number;
|
||||
|
||||
@Column({name: 'VLSALARIO'})
|
||||
vlsalario: number;
|
||||
|
||||
@Column({name: 'RESCISAO'})
|
||||
rescisao: Date;
|
||||
|
||||
@Column({name: 'NUMFILHOS'})
|
||||
numfilhos: number;
|
||||
|
||||
@Column({name: 'COMPLEMENTO'})
|
||||
complemento: string;
|
||||
|
||||
@Column({name: 'OBSERVACAO'})
|
||||
observacao: string;
|
||||
|
||||
@Column({name: 'PERCVT'})
|
||||
percvt: number;
|
||||
|
||||
@Column({name: 'VLPLANOSAUDE'})
|
||||
vlplanosaude: number;
|
||||
|
||||
@Column({name: 'VLSALFAMILIA'})
|
||||
vlsalfamilia: number;
|
||||
|
||||
@Column({name: 'PERCINSS'})
|
||||
percinss: number;
|
||||
|
||||
@Column({name: 'VLPENSAOALIMENTICIA'})
|
||||
vlpensaoalimenticia: number;
|
||||
|
||||
@Column({name: 'VLADICIONAL'})
|
||||
vladicional: number;
|
||||
|
||||
@Column({name: 'VLVALES'})
|
||||
vlvales: number;
|
||||
|
||||
@Column({name: 'VLMAXLIBPEDIDO'})
|
||||
vlmaxlibpedido: number;
|
||||
|
||||
@Column({name: 'CNH'})
|
||||
cnh: string;
|
||||
|
||||
@Column({name: 'UFCNH'})
|
||||
ufcnh: string;
|
||||
|
||||
@Column({name: 'TIPOENVIO'})
|
||||
tipoenvio: string;
|
||||
|
||||
@Column({name: 'CODFORNEC'})
|
||||
codfornec: number;
|
||||
|
||||
@Column({name: 'PERCOMMOT'})
|
||||
percommot: number;
|
||||
|
||||
@Column({name: 'VLFRETEENTREGA'})
|
||||
vlfreteentrega: number;
|
||||
|
||||
@Column({name: 'CODVEICULO'})
|
||||
codveiculo: number;
|
||||
|
||||
@Column({name: 'PERMITEALTDESCBX'})
|
||||
permitealtdescbx: string;
|
||||
|
||||
@Column({name: 'REFERENCIAPESSOAL'})
|
||||
referenciapessoal: string;
|
||||
|
||||
@Column({name: 'DDDTEL'})
|
||||
dddtel: number;
|
||||
|
||||
@Column({name: 'NOMEPAI'})
|
||||
nomepai: string;
|
||||
|
||||
@Column({name: 'NOMEMAE'})
|
||||
nomemae: string;
|
||||
|
||||
@Column({name: 'CATEGORIACNH'})
|
||||
categoriacnh: string;
|
||||
|
||||
@Column({name: 'TIPOMOTORISTA'})
|
||||
tipomotorista: string;
|
||||
|
||||
@Column({name: 'SEXO'})
|
||||
sexo: string;
|
||||
|
||||
@Column({name: 'DTNASC'})
|
||||
dtnasc: Date;
|
||||
|
||||
@Column({name: 'DTVALIDADECNH'})
|
||||
dtvalidadecnh: Date;
|
||||
|
||||
@Column({name: 'ORGAOEMISSORRG'})
|
||||
orgaoemissorrg: string;
|
||||
|
||||
@Column({name: 'NACIONALIDADE'})
|
||||
nacionalidade: string;
|
||||
|
||||
@Column({name: 'ESTADOCIVIL'})
|
||||
estadocivil: string;
|
||||
|
||||
@Column({name: 'PROFISSAO'})
|
||||
profissao: string;
|
||||
|
||||
@Column({name: 'USUARIOLOGADO'})
|
||||
usuariologado: string;
|
||||
|
||||
@Column({name: 'NUMDVAGENCIA'})
|
||||
numdvagencia: string;
|
||||
|
||||
@Column({name: 'NUMCONEXOES'})
|
||||
numconexoes: number;
|
||||
|
||||
@Column({name: 'NUMCONEXOESATUAL'})
|
||||
numconexoesatual: number;
|
||||
|
||||
@Column({name: 'GRUPOEMAIL'})
|
||||
grupoemail: string;
|
||||
|
||||
@Column({name: 'NOMEEMAIL'})
|
||||
nomeemail: string;
|
||||
|
||||
@Column({name: 'PERCMINJUROSMORA'})
|
||||
percminjurosmora: number;
|
||||
|
||||
@Column({name: 'PERCMAXJUROSMORA'})
|
||||
percmaxjurosmora: number;
|
||||
|
||||
@Column({name: 'CODIDIOMA'})
|
||||
codidioma: string;
|
||||
|
||||
@Column({name: 'RECMENSFORCAVENDA'})
|
||||
recmensforcavenda: string;
|
||||
|
||||
@Column({name: 'PERCEXCLIMCRED'})
|
||||
percexclimcred: number;
|
||||
|
||||
@Column({name: 'ENVIAFV'})
|
||||
enviafv: string;
|
||||
|
||||
@Column({name: 'PERCREDUZCOMISRCA'})
|
||||
percreduzcomisrca: number;
|
||||
|
||||
@Column({name: 'VLSALDOLIMALTCREDITO'})
|
||||
vlsaldolimaltcredito: number;
|
||||
|
||||
@Column({name: 'DTINICIO'})
|
||||
dtinicio: Date;
|
||||
|
||||
@Column({name: 'TIPOATENDE'})
|
||||
tipoatende: string;
|
||||
|
||||
@Column({name: 'GRUPOOS'})
|
||||
grupoos: number;
|
||||
|
||||
@Column({name: 'OBSINATIVO'})
|
||||
obsinativo: string;
|
||||
|
||||
@Column({name: 'IPRF'})
|
||||
iprf: string;
|
||||
|
||||
@Column({name: 'CODBARRA'})
|
||||
codbarra: string;
|
||||
|
||||
@Column({name: 'MAXTEMPOSECAOOCIOSA'})
|
||||
maxtemposecaoociosa: number;
|
||||
|
||||
@Column({name: 'USARATEIOCOMISSAOOPERADOR'})
|
||||
usarateiocomissaooperador: string;
|
||||
|
||||
@Column({name: 'CODIGOPERFIL'})
|
||||
codigoperfil: number;
|
||||
|
||||
@Column({name: 'NUMCAIXABALCAO'})
|
||||
numcaixabalcao: number;
|
||||
|
||||
@Column({name: 'VENDAASSISTIDA'})
|
||||
vendaassistida: string;
|
||||
|
||||
@Column({name: 'NUMDIASPAGTORETROATIVO'})
|
||||
numdiaspagtoretroativo: number;
|
||||
|
||||
@Column({name: 'PERMITEPERSONCAD'})
|
||||
permitepersoncad: string;
|
||||
|
||||
@Column({name: 'NUMIDENTIFICADORECF'})
|
||||
numidentificadorecf: string;
|
||||
|
||||
@Column({name: 'OBS'})
|
||||
obs: string;
|
||||
|
||||
@Column({name: 'NUMDIASMAXPRORROG'})
|
||||
numdiasmaxprorrog: number;
|
||||
|
||||
@Column({name: 'AREAATUACAO'})
|
||||
areaatuacao: string;
|
||||
|
||||
@Column({name: 'NUMINSS'})
|
||||
numinss: string;
|
||||
|
||||
@Column({name: 'USABIOMETRIAMENU'})
|
||||
usabiometriamenu: string;
|
||||
|
||||
@Column({name: 'PERCDESC'})
|
||||
percdesc: number;
|
||||
|
||||
@Column({name: 'NUMDVCONTA'})
|
||||
numdvconta: string;
|
||||
|
||||
@Column({name: 'TIPOCOMISSAO'})
|
||||
tipocomissao: string;
|
||||
|
||||
@Column({name: 'COMISSAOFIXA'})
|
||||
comissaofixa: number;
|
||||
|
||||
@Column({name: 'TIPOAGENTECOB'})
|
||||
tipoagentecob: string;
|
||||
|
||||
@Column({name: 'DIASCOB'})
|
||||
diascob: number;
|
||||
|
||||
@Column({name: 'LIMITEDESCONTO561'})
|
||||
limitedesconto561: number;
|
||||
|
||||
@Column({name: 'USAAVISOAUTOMENU'})
|
||||
usaavisoautomenu: string;
|
||||
|
||||
@Column({name: 'PERCMAXDESCTITULO'})
|
||||
percmaxdesctitulo: number;
|
||||
|
||||
@Column({name: 'RESPLIBCADASTRO'})
|
||||
resplibcadastro: string;
|
||||
|
||||
@Column({name: 'USATABELACLIENTE'})
|
||||
usatabelacliente: string;
|
||||
|
||||
@Column({name: 'VLMAXLIMCREDCLI'})
|
||||
vlmaxlimcredcli: number;
|
||||
|
||||
@Column({name: 'CODPERFIL'})
|
||||
codperfil: number;
|
||||
|
||||
@Column({name: 'USUARIOLOGADORF'})
|
||||
usuariologadorf: string;
|
||||
|
||||
@Column({name: 'CONCEDERABATIMENTO'})
|
||||
concederabatimento: string;
|
||||
|
||||
@Column({name: 'CODIGOCENTROCUSTO'})
|
||||
codigocentrocusto: string;
|
||||
|
||||
@Column({name: 'ORGAOEMISSORCNH'})
|
||||
orgaoemissorcnh: string;
|
||||
|
||||
@Column({name: 'QTDEPENDENTES'})
|
||||
qtdependentes: number;
|
||||
|
||||
@Column({name: 'IDINTEGRACAOMYFROTA'})
|
||||
idintegracaomyfrota: string;
|
||||
|
||||
@Column({name: 'CODCIDADE'})
|
||||
codcidade: number;
|
||||
|
||||
@Column({name: 'VLLIMMAXPEDCOMPRA'})
|
||||
vllimmaxpedcompra: number;
|
||||
|
||||
@Column({name: 'DTDEMISSAO'})
|
||||
dtdemissao: Date;
|
||||
|
||||
@Column({name: 'CHAPA_RM'})
|
||||
chapa_rm: string;
|
||||
|
||||
@Column({name: 'RAMAL'})
|
||||
ramal: number;
|
||||
|
||||
@Column({name: 'AUTOCHEQUEBLOQVENDA'})
|
||||
autochequebloqvenda: string;
|
||||
|
||||
@Column({name: 'SENHAHASH'})
|
||||
senhahash: string;
|
||||
|
||||
@Column({name: 'MOTIVOINATIVACAO'})
|
||||
motivoinativacao: string;
|
||||
|
||||
@Column({name: 'VLRLIMAPROVARSOLICITACAO'})
|
||||
vlrlimaprovarsolicitacao: number;
|
||||
|
||||
@Column({name: 'DTINTEGRACAOMLOG'})
|
||||
dtintegracaomlog: Date;
|
||||
|
||||
@Column({name: 'FIID'})
|
||||
fiid: string;
|
||||
|
||||
@Column({name: 'AREAATUACAO_COMPRA'})
|
||||
areaatuacao_compra: string;
|
||||
|
||||
@Column({name: 'AREAATUACAO_VENDAS'})
|
||||
areaatuacao_vendas: string;
|
||||
|
||||
@Column({name: 'AREAATUACAO_FINANCEIRO'})
|
||||
areaatuacao_financeiro: string;
|
||||
|
||||
@Column({name: 'AREAATUACAO_LOGISTICA'})
|
||||
areaatuacao_logistica: string;
|
||||
|
||||
@Column({name: 'AREAATUACAO_EXPEDICAO'})
|
||||
areaatuacao_expedicao: string;
|
||||
|
||||
@Column({name: 'AREAATUACAO_RH'})
|
||||
areaatuacao_rh: string;
|
||||
|
||||
@Column({name: 'AREAATUACAO_FISCAL'})
|
||||
areaatuacao_fiscal: string;
|
||||
|
||||
@Column({name: 'AREAATUACAO_CONTABIL'})
|
||||
areaatuacao_contabil: string;
|
||||
|
||||
@Column({name: 'AREAATUACAO_OUTROS'})
|
||||
areaatuacao_outros: string;
|
||||
|
||||
@Column({name: 'TIPOCARGO'})
|
||||
tipocargo: string;
|
||||
|
||||
@Column({name: 'CEP'})
|
||||
cep: string;
|
||||
|
||||
@Column({name: 'PERDESCMAXITEM'})
|
||||
perdescmaxitem: number;
|
||||
|
||||
@Column({name: 'PERDESCMAXRODAPE'})
|
||||
perdescmaxrodape: number;
|
||||
|
||||
@Column({name: 'LIM_REDUCAOCREDITO'})
|
||||
lim_reducaocredito: number;
|
||||
|
||||
@Column({name: 'LIM_AUMENTOCREDITO'})
|
||||
lim_aumentocredito: number;
|
||||
|
||||
@Column({name: 'PERIODO_ALTERACAOCREDITO'})
|
||||
periodo_alteracaocredito: number;
|
||||
|
||||
@Column({name: 'DIGITALPOLEGAR'})
|
||||
digitalpolegar: string;
|
||||
|
||||
@Column({name: 'DIGITALINDICADOR'})
|
||||
digitalindicador: string;
|
||||
|
||||
@Column({name: 'DIGITALMEDIO'})
|
||||
digitalmedio: string;
|
||||
|
||||
@Column({name: 'DIGITALANELAR'})
|
||||
digitalanelar: string;
|
||||
|
||||
@Column({name: 'DIGITALMINIMO'})
|
||||
digitalminimo: string;
|
||||
|
||||
@Column({name: 'DEDOPRIORITARIO'})
|
||||
dedoprioritario: string;
|
||||
|
||||
@Column({name: 'SITUACAO_CCW'})
|
||||
situacao_ccw: string;
|
||||
|
||||
@Column({name: 'USERMYAUDIT'})
|
||||
usermyaudit: string;
|
||||
|
||||
@Column({name: 'SENHAMYAUDIT'})
|
||||
senhamyaudit: string;
|
||||
|
||||
@Column({name: 'USERMYBI'})
|
||||
usermybi: string;
|
||||
|
||||
@Column({name: 'SENHAMYBI'})
|
||||
senhamybi: string;
|
||||
|
||||
@Column({name: 'USERGOGEO'})
|
||||
usergogeo: string;
|
||||
|
||||
@Column({name: 'SENHAGOGEO'})
|
||||
senhagogeo: string;
|
||||
|
||||
@Column({name: 'IDFORNECENTREGA'})
|
||||
idfornecentrega: number;
|
||||
|
||||
@Column({name: 'EMITIRPEDIDO'})
|
||||
emitirpedido: string;
|
||||
|
||||
@Column({name: 'EMITIRORCAMENTO'})
|
||||
emitirorcamento: string;
|
||||
|
||||
@Column({name: 'PERSONALEMBRETE'})
|
||||
personalembrete: Date;
|
||||
|
||||
@Column({name: 'CODFORNEC2'})
|
||||
codfornec2: number;
|
||||
|
||||
@Column({name: 'IDSOFITVIEW'})
|
||||
idsofitview: string;
|
||||
|
||||
@Column({name: 'DTULTALTERSOFITVIEW'})
|
||||
dtultaltersofitview: string;
|
||||
|
||||
@Column({name: 'DTEXCLUSAOSOFITVIEW'})
|
||||
dtexclusaosofitview: string;
|
||||
|
||||
@Column({name: 'VOIPMUNDOIPTOKEN'})
|
||||
voipmundoiptoken: string;
|
||||
|
||||
@Column({name: 'VOIPMUNDOIPKEY'})
|
||||
voipmundoipkey: string;
|
||||
|
||||
@Column({name: 'TELEFONERAMAL'})
|
||||
telefoneramal: string;
|
||||
|
||||
@Column({name: 'VOIPMUNDOIDCHAMADA'})
|
||||
voipmundoidchamada: string;
|
||||
|
||||
@Column({name: 'HASHSENHAWINTHOR'})
|
||||
hashsenhawinthor: string;
|
||||
|
||||
|
||||
}
|
||||
15
src/domain/entity/tables/pcfilial.entity.ts
Normal file
15
src/domain/entity/tables/pcfilial.entity.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity("PCFILIAL")
|
||||
export class Store {
|
||||
|
||||
@PrimaryColumn({name: "CODIGO"})
|
||||
id: string;
|
||||
|
||||
@Column({name: "RAZAOSOCIAL"})
|
||||
name: string;
|
||||
|
||||
@Column({name: "FANTASIA"})
|
||||
shortName: string;
|
||||
|
||||
}
|
||||
15
src/domain/entity/tables/pcmarca.entity.ts
Normal file
15
src/domain/entity/tables/pcmarca.entity.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm";
|
||||
import { Product } from "./pcprodut.entity";
|
||||
|
||||
@Entity('PCMARCA')
|
||||
export class Brand {
|
||||
@PrimaryColumn({name: 'CODMARCA'})
|
||||
id: number;
|
||||
|
||||
@Column({name: "MARCA"})
|
||||
description: string;
|
||||
|
||||
@OneToMany(() => Product, product => product.brand)
|
||||
products: Product[];
|
||||
|
||||
}
|
||||
22
src/domain/entity/tables/pcncm.entity.ts
Normal file
22
src/domain/entity/tables/pcncm.entity.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm";
|
||||
import { Esttipoproduto } from "./esttipoproduto.entity";
|
||||
|
||||
@Entity("PCNCM")
|
||||
export class Pcncm {
|
||||
|
||||
@PrimaryColumn({name: "CODNCMEX"})
|
||||
codigoNcmEX: string;
|
||||
|
||||
@Column({name: "CODNCM"})
|
||||
codigoNcm: string;
|
||||
|
||||
@Column({name: "DESCRICAO"})
|
||||
descricaoNcm: string;
|
||||
|
||||
@Column({name: "DTEXCLUSAO"})
|
||||
DataExclusao: Date;
|
||||
|
||||
@OneToMany(() => Esttipoproduto, tipoProduto => tipoProduto.registroNcm)
|
||||
tiposProduto: Esttipoproduto[];
|
||||
|
||||
}
|
||||
1910
src/domain/entity/tables/pcnfsaid.entity.ts
Normal file
1910
src/domain/entity/tables/pcnfsaid.entity.ts
Normal file
File diff suppressed because it is too large
Load Diff
232
src/domain/entity/tables/pcorcavendac.entity.ts
Normal file
232
src/domain/entity/tables/pcorcavendac.entity.ts
Normal file
@@ -0,0 +1,232 @@
|
||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity('PCORCAVENDAC')
|
||||
export class Pcorcavendac {
|
||||
|
||||
@PrimaryColumn({ name: 'NUMORCA' })
|
||||
numorca: number;
|
||||
|
||||
@Column({ name: 'DATA' })
|
||||
data: Date;
|
||||
|
||||
@Column({ name: 'VLTOTAL' })
|
||||
vltotal: number;
|
||||
|
||||
@Column({ name: 'CODCLI' })
|
||||
codcli: number;
|
||||
|
||||
@Column({ name: 'CODUSUR' })
|
||||
codusur: number;
|
||||
|
||||
@Column({ name: 'CODUSUR3' })
|
||||
codusur3: number;
|
||||
|
||||
@Column({ name: 'DTENTREGA' })
|
||||
dtentrega: Date;
|
||||
|
||||
@Column({ name: 'VLTABELA' })
|
||||
vltabela: number;
|
||||
|
||||
@Column({ name: 'CODFILIAL' })
|
||||
codfilial: string;
|
||||
|
||||
@Column({ name: 'VLDESCONTO' })
|
||||
vldesconto: number;
|
||||
|
||||
@Column({ name: 'TIPOVENDA' })
|
||||
tipovenda: string;
|
||||
|
||||
@Column({ name: 'VLCUSTOREAL' })
|
||||
vlcustoreal: number;
|
||||
|
||||
@Column({ name: 'VLCUSTOFIN' })
|
||||
vlcustofin: number;
|
||||
|
||||
@Column({ name: 'VLFRETE' })
|
||||
vlfrete: number;
|
||||
|
||||
@Column({ name: 'VLOUTRASDESP' })
|
||||
vloutrasdesp: number;
|
||||
|
||||
@Column({ name: 'TOTPESO' })
|
||||
totpeso: number;
|
||||
|
||||
@Column({ name: 'TOTVOLUME' })
|
||||
totvolume: number;
|
||||
|
||||
@Column({ name: 'CODPRACA' })
|
||||
codpraca: number;
|
||||
|
||||
@Column({ name: 'NUMITENS' })
|
||||
numitens: number;
|
||||
|
||||
@Column({ name: 'CODEMITENTE' })
|
||||
codemitente: number;
|
||||
|
||||
@Column({ name: 'CODENDENT' })
|
||||
codendent: number;
|
||||
|
||||
@Column({ name: 'POSICAO' })
|
||||
posicao: string;
|
||||
|
||||
@Column({ name: 'VLATEND' })
|
||||
vlatend: number;
|
||||
|
||||
@Column({ name: 'OPERACAO' })
|
||||
operacao: string;
|
||||
|
||||
@Column({ name: 'NUMCAR' })
|
||||
numcar: number;
|
||||
|
||||
@Column({ name: 'CODCOB' })
|
||||
codcob: string;
|
||||
|
||||
@Column({ name: 'HORA' })
|
||||
hora: number;
|
||||
|
||||
@Column({ name: 'MINUTO' })
|
||||
minuto: number;
|
||||
|
||||
@Column({ name: 'CODSUPERVISOR' })
|
||||
codsupervisor: number;
|
||||
|
||||
@Column({ name: 'CONDVENDA' })
|
||||
condvenda: number;
|
||||
|
||||
@Column({ name: 'PERCVENDA' })
|
||||
percvenda: number;
|
||||
|
||||
@Column({ name: 'TIPOPRIORIDADEENTREGA' })
|
||||
tipoprioridadeentrega: string;
|
||||
|
||||
@Column({ name: 'OBS1' })
|
||||
obs1: string;
|
||||
|
||||
@Column({ name: 'OBS2' })
|
||||
obs2: string;
|
||||
|
||||
@Column({ name: 'PERDESC' })
|
||||
perdesc: number;
|
||||
|
||||
@Column({ name: 'CODPLPAG' })
|
||||
codplpag: number;
|
||||
|
||||
@Column({ name: 'NUMPEDRCA' })
|
||||
numpedrca: number;
|
||||
|
||||
@Column({ name: 'FRETEDESPACHO' })
|
||||
fretedespacho: string;
|
||||
|
||||
@Column({ name: 'TIPOCARGA' })
|
||||
tipocarga: string;
|
||||
|
||||
@Column({ name: 'PRAZO1' })
|
||||
prazo1: number;
|
||||
|
||||
@Column({ name: 'PRAZO2' })
|
||||
prazo2: number;
|
||||
|
||||
@Column({ name: 'PRAZO3' })
|
||||
prazo3: number;
|
||||
|
||||
@Column({ name: 'PRAZO4' })
|
||||
prazo4: number;
|
||||
|
||||
@Column({ name: 'PRAZO5' })
|
||||
prazo5: number;
|
||||
|
||||
@Column({ name: 'PRAZO6' })
|
||||
prazo6: number;
|
||||
|
||||
@Column({ name: 'PRAZO7' })
|
||||
prazo7: number;
|
||||
|
||||
@Column({ name: 'PRAZO8' })
|
||||
prazo8: number;
|
||||
|
||||
@Column({ name: 'PRAZO9' })
|
||||
prazo9: number;
|
||||
|
||||
@Column({ name: 'PRAZO10' })
|
||||
prazo10: number;
|
||||
|
||||
@Column({ name: 'PRAZO11' })
|
||||
prazo11: number;
|
||||
|
||||
@Column({ name: 'PRAZO12' })
|
||||
prazo12: number;
|
||||
|
||||
@Column({ name: 'PRAZOMEDIO' })
|
||||
prazomedio: number;
|
||||
|
||||
@Column({ name: 'OBSENTREGA1' })
|
||||
obsentrega1: string;
|
||||
|
||||
@Column({ name: 'OBSENTREGA2' })
|
||||
obsentrega2: string;
|
||||
|
||||
@Column({ name: 'OBSENTREGA3' })
|
||||
obsentrega3: string;
|
||||
|
||||
@Column({ name: 'TIPOEMBALAGEM' })
|
||||
tipoembalagem: string;
|
||||
|
||||
@Column({ name: 'CLIENTE' })
|
||||
cliente: string;
|
||||
|
||||
@Column({ name: 'CNPJ' })
|
||||
cnpj: string;
|
||||
|
||||
@Column({ name: 'ENDERECO' })
|
||||
endereco: string;
|
||||
|
||||
@Column({ name: 'BAIRRO' })
|
||||
bairro: string;
|
||||
|
||||
@Column({ name: 'UF' })
|
||||
uf: string;
|
||||
|
||||
@Column({ name: 'TELEFONE' })
|
||||
telefone: string;
|
||||
|
||||
@Column({ name: 'IE' })
|
||||
ie: string;
|
||||
|
||||
@Column({ name: 'CODATV1' })
|
||||
codatv1: number;
|
||||
|
||||
@Column({ name: 'CIDADE' })
|
||||
cidade: string;
|
||||
|
||||
@Column({ name: 'ORCAMENTOUTILIZADO' })
|
||||
orcamentoUtilizado: string;
|
||||
|
||||
@Column({ name: 'CODFILIALNF' })
|
||||
codfilialUf: string;
|
||||
|
||||
@Column({ name: 'DTVALIDADE' })
|
||||
dtvalidade: Date;
|
||||
|
||||
@Column({ name: 'VLCUSTOCONT' })
|
||||
vlcustocont: number;
|
||||
|
||||
@Column({ name: 'VLCUSTOREP' })
|
||||
vlcustorep: number;
|
||||
|
||||
@Column({ name: 'ORIGEMPED' })
|
||||
origemPed: string;
|
||||
|
||||
@Column({ name: 'NUMNOTA' })
|
||||
numnota: number;
|
||||
|
||||
@Column({ name: 'PERDESCFIN' })
|
||||
perdescfin: number;
|
||||
|
||||
@Column({ name: 'NUMREGIAO' })
|
||||
numregiao: number;
|
||||
|
||||
@Column({ name: 'CODCLIRECEBEDOR' })
|
||||
codclirecebedor: number;
|
||||
|
||||
|
||||
}
|
||||
95
src/domain/entity/tables/pcorcavendai.entity.ts
Normal file
95
src/domain/entity/tables/pcorcavendai.entity.ts
Normal file
@@ -0,0 +1,95 @@
|
||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity("PCORCAVENDAI")
|
||||
export class Pcorcavendai {
|
||||
@PrimaryColumn({name: 'NUMORCA'})
|
||||
numorca: number;
|
||||
|
||||
@PrimaryColumn({name: 'CODPROD'})
|
||||
codprod: number;
|
||||
|
||||
@PrimaryColumn({name: 'NUMSEQ'})
|
||||
numseq: number;
|
||||
|
||||
@Column({name: 'DATA'})
|
||||
data: Date;
|
||||
|
||||
@Column({name: 'CODCLI'})
|
||||
codcli: number;
|
||||
|
||||
@Column({name: 'CODUSUR'})
|
||||
codusur: number;
|
||||
|
||||
@Column({name: 'QT'})
|
||||
qt: number;
|
||||
|
||||
@Column({name: 'PVENDA'})
|
||||
pvenda: number;
|
||||
|
||||
@Column({name: 'PTABELA'})
|
||||
ptabela: number;
|
||||
|
||||
@Column({name: 'NUMCAR'})
|
||||
numcar: number;
|
||||
|
||||
@Column({name: 'POSICAO'})
|
||||
posicao: string;
|
||||
|
||||
@Column({name: 'ST'})
|
||||
st: number;
|
||||
|
||||
@Column({name: 'VLCUSTOFIN'})
|
||||
vlcustofin: number;
|
||||
|
||||
@Column({name: 'VLCUSTOREAL'})
|
||||
vlcustoreal: number;
|
||||
|
||||
@Column({name: 'PERCOM'})
|
||||
percom: number;
|
||||
|
||||
@Column({name: 'PERDESC'})
|
||||
perdesc: number;
|
||||
|
||||
@Column({name: 'PVENDABASE'})
|
||||
pvendabase: number;
|
||||
|
||||
@Column({name: 'CODST'})
|
||||
codst: number;
|
||||
|
||||
@Column({name: 'CUSTOFINEST'})
|
||||
custofinest: number;
|
||||
|
||||
@Column({name: 'CODAUXILIAR'})
|
||||
codauxiliar: number;
|
||||
|
||||
@Column({name: 'CODFILIALRETIRA'})
|
||||
codfilialretira: string;
|
||||
|
||||
@Column({name: 'PORIGINAL'})
|
||||
poriginal: number;
|
||||
|
||||
@Column({name: 'VLCUSTOCONT'})
|
||||
vlcustocont: number;
|
||||
|
||||
@Column({name: 'VLCUSTOREP'})
|
||||
vlcustorep: number;
|
||||
|
||||
@Column({name: 'PBASERCA'})
|
||||
pbaserca: number;
|
||||
|
||||
@Column({name: 'PVENDA1'})
|
||||
pvenda1: number;
|
||||
|
||||
@Column({name: 'TIPOENTREGA'})
|
||||
tipoentrega: string;
|
||||
|
||||
@Column({name: 'COMPLEMENTO'})
|
||||
complemento: string;
|
||||
|
||||
@Column({name: 'AMBIENTE'})
|
||||
ambiente: string;
|
||||
|
||||
@Column({name: 'RETIRAPOSTERIOR_IMEDIATA'})
|
||||
rp_imediata: string;
|
||||
|
||||
}
|
||||
1538
src/domain/entity/tables/pcpedc.entity.ts
Normal file
1538
src/domain/entity/tables/pcpedc.entity.ts
Normal file
File diff suppressed because it is too large
Load Diff
473
src/domain/entity/tables/pcpedctemp.entity.ts
Normal file
473
src/domain/entity/tables/pcpedctemp.entity.ts
Normal file
@@ -0,0 +1,473 @@
|
||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity('PCPEDCTEMP')
|
||||
export class Pcpedctemp {
|
||||
@Column({ name: 'TIPOINTEGRACAO' })
|
||||
tipointegracao: string;
|
||||
|
||||
@Column({ name: 'IMPORTADO' })
|
||||
importado: string;
|
||||
|
||||
@Column({ name: 'OBSERVACAO_PC' })
|
||||
observacao_pc: string;
|
||||
|
||||
@Column({ name: 'NUMPEDCLI' })
|
||||
numpedcli: string;
|
||||
|
||||
@PrimaryColumn({ name: 'NUMPEDRCA' })
|
||||
numpedrca: number;
|
||||
|
||||
@Column({ name: 'NUMPED' })
|
||||
numped: number;
|
||||
|
||||
@Column({ name: 'CODCLI' })
|
||||
codcli: number;
|
||||
|
||||
@Column({ name: 'CODUSUR' })
|
||||
codusur: number;
|
||||
|
||||
@Column({ name: 'DATA' })
|
||||
data: Date;
|
||||
|
||||
@Column({ name: 'DTENTREGA' })
|
||||
dtentrega: Date;
|
||||
|
||||
@Column({ name: 'CODFILIAL' })
|
||||
codfilial: string;
|
||||
|
||||
@Column({ name: 'CODFILIALNF' })
|
||||
codfilialnf: string;
|
||||
|
||||
@Column({ name: 'VLFRETE' })
|
||||
vlfrete: number;
|
||||
|
||||
@Column({ name: 'VLOUTRASDESP' })
|
||||
vloutrasdesp: number;
|
||||
|
||||
@Column({ name: 'CODPRACA' })
|
||||
codpraca: number;
|
||||
|
||||
@Column({ name: 'NUMITENS' })
|
||||
numitens: number;
|
||||
|
||||
@Column({ name: 'CODEMITENTE' })
|
||||
codemitente: number;
|
||||
|
||||
@Column({ name: 'CODCOB' })
|
||||
codcob: string;
|
||||
|
||||
@Column({ name: 'HORA' })
|
||||
hora: number;
|
||||
|
||||
@Column({ name: 'MINUTO' })
|
||||
minuto: number;
|
||||
|
||||
@Column({ name: 'CODSUPERVISOR' })
|
||||
codsupervisor: number;
|
||||
|
||||
@Column({ name: 'CONDVENDA' })
|
||||
condvenda: number;
|
||||
|
||||
@Column({ name: 'PERCVENDA' })
|
||||
percvenda: number;
|
||||
|
||||
@Column({ name: 'OBS1' })
|
||||
obs1: string;
|
||||
|
||||
@Column({ name: 'OBS2' })
|
||||
obs2: string;
|
||||
|
||||
@Column({ name: 'CODPLPAG' })
|
||||
codplpag: number;
|
||||
|
||||
@Column({ name: 'FRETEDESPACHO' })
|
||||
fretedespacho: string;
|
||||
|
||||
@Column({ name: 'FRETEREDESPACHO' })
|
||||
freteredespacho: string;
|
||||
|
||||
@Column({ name: 'CODFORNECFRETE' })
|
||||
codfornecfrete: number;
|
||||
|
||||
@Column({ name: 'PRAZO1' })
|
||||
prazo1: number;
|
||||
|
||||
@Column({ name: 'PRAZO2' })
|
||||
prazo2: number;
|
||||
|
||||
@Column({ name: 'PRAZO3' })
|
||||
prazo3: number;
|
||||
|
||||
@Column({ name: 'PRAZO4' })
|
||||
prazo4: number;
|
||||
|
||||
@Column({ name: 'PRAZO5' })
|
||||
prazo5: number;
|
||||
|
||||
@Column({ name: 'PRAZO6' })
|
||||
prazo6: number;
|
||||
|
||||
@Column({ name: 'PRAZO7' })
|
||||
prazo7: number;
|
||||
|
||||
@Column({ name: 'PRAZO8' })
|
||||
prazo8: number;
|
||||
|
||||
@Column({ name: 'PRAZO9' })
|
||||
prazo9: number;
|
||||
|
||||
@Column({ name: 'PRAZO10' })
|
||||
prazo10: number;
|
||||
|
||||
@Column({ name: 'PRAZO11' })
|
||||
prazo11: number;
|
||||
|
||||
@Column({ name: 'PRAZO12' })
|
||||
prazo12: number;
|
||||
|
||||
@Column({ name: 'PRAZOMEDIO' })
|
||||
prazomedio: number;
|
||||
|
||||
@Column({ name: 'OBSENTREGA1' })
|
||||
obsentrega1: string;
|
||||
|
||||
@Column({ name: 'OBSENTREGA2' })
|
||||
obsentrega2: string;
|
||||
|
||||
@Column({ name: 'OBSENTREGA3' })
|
||||
obsentrega3: string;
|
||||
|
||||
@Column({ name: 'NUMCUPOM' })
|
||||
numcupom: number;
|
||||
|
||||
@Column({ name: 'SERIEECF' })
|
||||
serieecf: string;
|
||||
|
||||
@Column({ name: 'CODDISTRIB' })
|
||||
coddistrib: string;
|
||||
|
||||
@Column({ name: 'NUMVIASMAPASEP' })
|
||||
numviasmapasep: number;
|
||||
|
||||
@Column({ name: 'CODFUNCCX' })
|
||||
codfunccx: number;
|
||||
|
||||
@Column({ name: 'NUMCAIXA' })
|
||||
numcaixa: number;
|
||||
|
||||
@Column({ name: 'NUMNOTAMANIF' })
|
||||
numnotamanif: number;
|
||||
|
||||
@Column({ name: 'SERIEMANIF' })
|
||||
seriemanif: string;
|
||||
|
||||
@Column({ name: 'ORIGEMPED' })
|
||||
origemped: string;
|
||||
|
||||
@Column({ name: 'ESPECIEMANIF' })
|
||||
especiemanif: string;
|
||||
|
||||
@Column({ name: 'EANENTREGA' })
|
||||
eanentrega: number;
|
||||
|
||||
@Column({ name: 'EANCOBRANCA' })
|
||||
eancobranca: number;
|
||||
|
||||
@Column({ name: 'CODCLINF' })
|
||||
codclinf: number;
|
||||
|
||||
@Column({ name: 'CODUSUR2' })
|
||||
codusur2: number;
|
||||
|
||||
@Column({ name: 'NUMPEDORIGEM' })
|
||||
numpedorigem: number;
|
||||
|
||||
@Column({ name: 'NUMPEDENTFUT' })
|
||||
numpedentfut: number;
|
||||
|
||||
@Column({ name: 'NUMNOTACONSIG' })
|
||||
numnotaconsig: number;
|
||||
|
||||
@Column({ name: 'NUMSERIEEQUIP' })
|
||||
numserieequip: string;
|
||||
|
||||
@Column({ name: 'NUMCARMANIF' })
|
||||
numcarmanif: number;
|
||||
|
||||
@Column({ name: 'NUMORCA' })
|
||||
numorca: number;
|
||||
|
||||
@Column({ name: 'CODUSUR3' })
|
||||
codusur3: number;
|
||||
|
||||
@Column({ name: 'CODSUPERVISOR2' })
|
||||
codsupervisor2: number;
|
||||
|
||||
@Column({ name: 'CODSUPERVISOR3' })
|
||||
codsupervisor3: number;
|
||||
|
||||
@Column({ name: 'BAIXAESTCLI' })
|
||||
baixaestcli: string;
|
||||
|
||||
@Column({ name: 'CODCLICONSIGNACAO' })
|
||||
codcliconsignacao: number;
|
||||
|
||||
@Column({ name: 'OBSENTREGA4' })
|
||||
obsentrega4: string;
|
||||
|
||||
@Column({ name: 'PRAZOADICIONAL' })
|
||||
prazoadicional: number;
|
||||
|
||||
@Column({ name: 'VLFRETENF' })
|
||||
vlfretenf: number;
|
||||
|
||||
@Column({ name: 'NUMEMPENHO' })
|
||||
numempenho: string;
|
||||
|
||||
@Column({ name: 'NUMPROCESSO' })
|
||||
numprocesso: string;
|
||||
|
||||
@Column({ name: 'NUMFONTERECURSO' })
|
||||
numfonterecurso: string;
|
||||
|
||||
@Column({ name: 'BAIXAESTLOJA' })
|
||||
baixaestloja: string;
|
||||
|
||||
@Column({ name: 'DTVENC1' })
|
||||
dtvenc1: Date;
|
||||
|
||||
@Column({ name: 'DTVENC2' })
|
||||
dtvenc2: Date;
|
||||
|
||||
@Column({ name: 'DTVENC3' })
|
||||
dtvenc3: Date;
|
||||
|
||||
@Column({ name: 'PRAZOPONDERADO' })
|
||||
prazoponderado: string;
|
||||
|
||||
@Column({ name: 'DTABERTURAPEDPALM' })
|
||||
dtaberturapedpalm: Date;
|
||||
|
||||
@Column({ name: 'DTFECHAMENTOPEDPALM' })
|
||||
dtfechamentopedpalm: Date;
|
||||
|
||||
@Column({ name: 'CODCONDICAOVENDA' })
|
||||
codcondicaovenda: number;
|
||||
|
||||
@Column({ name: 'EANCOMPRADOR' })
|
||||
eancomprador: number;
|
||||
|
||||
@Column({ name: 'EANLOCALENTREGA' })
|
||||
eanlocalentrega: number;
|
||||
|
||||
@Column({ name: 'NUMPEDBNF' })
|
||||
numpedbnf: number;
|
||||
|
||||
@Column({ name: 'DTAGENDAENTREGA' })
|
||||
dtagendaentrega: Date;
|
||||
|
||||
@Column({ name: 'NUMPEDECF' })
|
||||
numpedecf: number;
|
||||
|
||||
@Column({ name: 'CODATENDIMENTO' })
|
||||
codatendimento: number;
|
||||
|
||||
@Column({ name: 'ARQUIVO' })
|
||||
arquivo: string;
|
||||
|
||||
@Column({ name: 'LAYOUTXML' })
|
||||
layoutxml: string;
|
||||
|
||||
@Column({ name: 'DTIMPORTACAO' })
|
||||
dtimportacao: Date;
|
||||
|
||||
@Column({ name: 'CODNAOATENDIMENTO' })
|
||||
codnaoatendimento: number;
|
||||
|
||||
@Column({ name: 'OBSINTEGRACAO1' })
|
||||
obsintegracao1: string;
|
||||
|
||||
@Column({ name: 'OBSINTEGRACAO2' })
|
||||
obsintegracao2: string;
|
||||
|
||||
@Column({ name: 'EXPORTADO' })
|
||||
exportado: string;
|
||||
|
||||
@Column({ name: 'NUMPEDWEB' })
|
||||
numpedweb: number;
|
||||
|
||||
@Column({ name: 'COBRANCATENDENCIA' })
|
||||
cobrancatendencia: number;
|
||||
|
||||
@Column({ name: 'CODAUTORIZACAOTEF' })
|
||||
codautorizacaotef: number;
|
||||
|
||||
@Column({ name: 'NSUTEF' })
|
||||
nsutef: string;
|
||||
|
||||
@Column({ name: 'CODADMCARTAO' })
|
||||
codadmcartao: string;
|
||||
|
||||
@Column({ name: 'TRANSACAO' })
|
||||
transacao: number;
|
||||
|
||||
@Column({ name: 'VLDESCONTOFINANCEIRO' })
|
||||
vldescontofinanceiro: number;
|
||||
|
||||
@Column({ name: 'INTEGRADORA' })
|
||||
integradora: number;
|
||||
|
||||
@Column({ name: 'IDCOB' })
|
||||
idcob: number;
|
||||
|
||||
@Column({ name: 'POSICAO' })
|
||||
posicao: string;
|
||||
|
||||
@Column({ name: 'VALIDARNIVELVENDA' })
|
||||
validarnivelvenda: string;
|
||||
|
||||
@Column({ name: 'VLTROCO' })
|
||||
vltroco: number;
|
||||
|
||||
@Column({ name: 'CODTRANSP' })
|
||||
codtransp: number;
|
||||
|
||||
@Column({ name: 'CODAUTORIZACAOTEFWEB' })
|
||||
codautorizacaotefweb: string;
|
||||
|
||||
@Column({ name: 'VLDESCONTOCUPOM' })
|
||||
vldescontocupom: number;
|
||||
|
||||
@Column({ name: 'NUMPEDTV1' })
|
||||
numpedtv1: number;
|
||||
|
||||
@Column({ name: 'CODRETORNO' })
|
||||
codretorno: number;
|
||||
|
||||
@Column({ name: 'AGRUPAMENTO' })
|
||||
agrupamento: string;
|
||||
|
||||
@Column({ name: 'TURNOENTREGA' })
|
||||
turnoentrega: string;
|
||||
|
||||
@Column({ name: 'VLENTRADA' })
|
||||
vlentrada: number;
|
||||
|
||||
@Column({ name: 'CODENDENTCLI' })
|
||||
codendentcli: number;
|
||||
|
||||
@Column({ name: 'CODCLIRECEBEDOR' })
|
||||
codclirecebedor: number;
|
||||
|
||||
@Column({ name: 'NUMREGIAOBROKER' })
|
||||
numregiaobroker: number;
|
||||
|
||||
@Column({ name: 'CODCLITV8' })
|
||||
codclitv8: number;
|
||||
|
||||
@Column({ name: 'CODENDENT' })
|
||||
codendent: number;
|
||||
|
||||
@Column({ name: 'PEDIDOPAGOECOMMERCE' })
|
||||
pedidopagoecommerce: string;
|
||||
|
||||
@Column({ name: 'CODRETORNOS' })
|
||||
codretornos: string;
|
||||
|
||||
@Column({ name: 'CUPOMDESCONTO' })
|
||||
cupomdesconto: string;
|
||||
|
||||
@Column({ name: 'UIDREGISTRO' })
|
||||
uidregistro: number;
|
||||
|
||||
@Column({ name: 'IDPARCEIRO' })
|
||||
idparceiro: string;
|
||||
|
||||
@Column({ name: 'ASSINATURA' })
|
||||
assinatura: string;
|
||||
|
||||
@Column({ name: 'DTHORA_NOTIFICA_SITE' })
|
||||
dthora_notifica_site: Date;
|
||||
|
||||
@Column({ name: 'DTINCLUSAO' })
|
||||
dtinclusao: Date;
|
||||
|
||||
@Column({ name: 'CODPLPAG2' })
|
||||
codplpag2: number;
|
||||
|
||||
@Column({ name: 'CODCOB2' })
|
||||
codcob2: string;
|
||||
|
||||
@Column({ name: 'NOME_CLIENTE' })
|
||||
nome_cliente: string;
|
||||
|
||||
@Column({ name: 'OBSFRETE' })
|
||||
obsfrete: string;
|
||||
|
||||
@Column({ name: 'CODFILIALPRINC' })
|
||||
codfilialprinc: string;
|
||||
|
||||
@Column({ name: 'VLTOTAL' })
|
||||
vltotal: number;
|
||||
|
||||
@Column({ name: 'SERVICOENTREGACODIGO' })
|
||||
servicoentregacodigo: number;
|
||||
|
||||
@Column({ name: 'TRANSPORTADORAFRETE' })
|
||||
transportadorafrete: number;
|
||||
|
||||
@Column({ name: 'PAGAMENTOAPROVADOCIASHOP' })
|
||||
pagamentoaprovadociashop: string;
|
||||
|
||||
@Column({ name: 'ESC_VLOUTRASDESPWEB' })
|
||||
esc_vloutrasdespweb: number;
|
||||
|
||||
@Column({ name: 'ESC_AJUSTARFINANCEIRO' })
|
||||
esc_ajustarfinanceiro: string;
|
||||
|
||||
@Column({ name: 'ESC_OBTERNSU' })
|
||||
esc_obternsu: string;
|
||||
|
||||
@Column({ name: 'ESCPRAZOENTREGA' })
|
||||
escprazoentrega: number;
|
||||
|
||||
@Column({ name: 'NUMPEDMKTPLACE' })
|
||||
numpedmktplace: string;
|
||||
|
||||
@Column({ name: 'ESC_CODTRANSPINTELIPOST' })
|
||||
esc_codtranspintelipost: number;
|
||||
|
||||
@Column({ name: 'USACORTECIASHOP' })
|
||||
usacorteciashop: string;
|
||||
|
||||
@Column({ name: 'ESC_VENDADELIVERY' })
|
||||
esc_vendadelivery: string;
|
||||
|
||||
@Column({ name: 'ESC_VERSAOVENDADELIVERY' })
|
||||
esc_versaovendadelivery: string;
|
||||
|
||||
@Column({ name: 'ESC_CODCOBORIG' })
|
||||
esc_codcoborig: string;
|
||||
|
||||
@Column({ name: 'ESC_PEDIDOENCOMENDA' })
|
||||
esc_pedidoencomenda: string;
|
||||
|
||||
@Column({ name: 'IDREMESSAWEB' })
|
||||
idremessaweb: number;
|
||||
|
||||
@Column({ name: 'ESC_VENDASERVICO' })
|
||||
esc_vendaservico: string;
|
||||
|
||||
@Column({ name: 'ESC_TIPODOCUMENTO' })
|
||||
esc_tipodocumento: string;
|
||||
|
||||
@Column({ name: 'ESC_TIPOENTREGA' })
|
||||
esc_tipoentrega: string;
|
||||
|
||||
@Column({ name: 'ESC_DESTINOCREDITO' })
|
||||
esc_destinocredito: string;
|
||||
|
||||
@Column({ name: 'ESC_TIPOVENDA' })
|
||||
esc_tipovenda: string;
|
||||
|
||||
}
|
||||
62
src/domain/entity/tables/pcpedi.entity.ts
Normal file
62
src/domain/entity/tables/pcpedi.entity.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import { Entity, Column, PrimaryColumn, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { Pcpedc } from "./pcpedc.entity";
|
||||
|
||||
@Entity('PCPEDI')
|
||||
export class Pcpedi {
|
||||
|
||||
@PrimaryColumn({ name: 'NUMPED' })
|
||||
numped: number;
|
||||
|
||||
@PrimaryColumn({ name: 'CODPROD' })
|
||||
codprod: number;
|
||||
|
||||
@PrimaryColumn({ name: 'NUMSEQ' })
|
||||
numseq: number;
|
||||
|
||||
@Column({ name: 'DATA' })
|
||||
data: Date;
|
||||
|
||||
@Column({ name: 'CODCLI' })
|
||||
codcli: number;
|
||||
|
||||
@Column({ name: 'CODUSUR' })
|
||||
codusur: number;
|
||||
|
||||
@Column({ name: 'QT' })
|
||||
qt: number;
|
||||
|
||||
@Column({ name: 'PVENDA' })
|
||||
pvenda: number;
|
||||
|
||||
@Column({ name: 'PTABELA' })
|
||||
ptabela: number;
|
||||
|
||||
@Column({ name: 'NUMCAR' })
|
||||
numcar: number;
|
||||
|
||||
@Column({ name: 'POSICAO' })
|
||||
posicao: string;
|
||||
|
||||
@Column({ name: 'ST' })
|
||||
st: number;
|
||||
|
||||
@Column({ name: 'PERDESC' })
|
||||
perdesc: number;
|
||||
|
||||
@Column({ name: 'TIPOPESO' })
|
||||
tipopeso: string;
|
||||
|
||||
@Column({ name: 'CODFILIALRETIRA' })
|
||||
codfilialretira: string;
|
||||
|
||||
@Column({ name: 'QTEMBALAGEM' })
|
||||
qtembalagem: number;
|
||||
|
||||
@Column({ name: 'CODAUXILIAR' })
|
||||
codauxiliar: number;
|
||||
|
||||
@ManyToOne(type => Pcpedc, pcpedc => pcpedc.itens)
|
||||
@JoinColumn({ name: 'NUMPED' })
|
||||
pcpedc: Pcpedc;
|
||||
|
||||
}
|
||||
170
src/domain/entity/tables/pcpeditemp.entity.ts
Normal file
170
src/domain/entity/tables/pcpeditemp.entity.ts
Normal file
@@ -0,0 +1,170 @@
|
||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity('PCPEDITEMP')
|
||||
export class Pcpeditemp {
|
||||
|
||||
@Column({ name: 'TIPOINTEGRACAO' })
|
||||
tipointegracao: string;
|
||||
|
||||
@Column({ name: 'OBSERVACAO_PC' })
|
||||
observacao_pc: string;
|
||||
|
||||
@Column({ name: 'NUMPEDCLI' })
|
||||
numpedcli: string;
|
||||
|
||||
@PrimaryColumn({ name: 'NUMPEDRCA' })
|
||||
numpedrca: number;
|
||||
|
||||
@Column({ name: 'CODCLI' })
|
||||
codcli: number;
|
||||
|
||||
@Column({ name: 'CODUSUR' })
|
||||
codusur: number;
|
||||
|
||||
@Column({ name: 'DATA' })
|
||||
data: Date;
|
||||
|
||||
@PrimaryColumn({ name: 'CODPROD' })
|
||||
codprod: number;
|
||||
|
||||
@Column({ name: 'QT' })
|
||||
qt: number;
|
||||
|
||||
@Column({ name: 'QT_FATURADA' })
|
||||
qt_faturada: number;
|
||||
|
||||
@Column({ name: 'PVENDA' })
|
||||
pvenda: number;
|
||||
|
||||
@Column({ name: 'PTABELA' })
|
||||
ptabela: number;
|
||||
|
||||
@Column({ name: 'PERDESC' })
|
||||
perdesc: number;
|
||||
|
||||
@PrimaryColumn({ name: 'NUMSEQ' })
|
||||
numseq: number;
|
||||
|
||||
@Column({ name: 'CODAUXILIAR' })
|
||||
codauxiliar: number;
|
||||
|
||||
@Column({ name: 'CODCERTIFIC' })
|
||||
codcertific: number;
|
||||
|
||||
@Column({ name: 'CODFILIALRETIRA' })
|
||||
codfilialretira: string;
|
||||
|
||||
@Column({ name: 'NUMLOTE' })
|
||||
numlote: string;
|
||||
|
||||
@Column({ name: 'COMPLEMENTO' })
|
||||
complemento: string;
|
||||
|
||||
@Column({ name: 'CODPLPAG' })
|
||||
codplpag: number;
|
||||
|
||||
@Column({ name: 'CODPROMOCAO' })
|
||||
codpromocao: string;
|
||||
|
||||
@Column({ name: 'PRAZOMEDIO' })
|
||||
prazomedio: number;
|
||||
|
||||
@Column({ name: 'LOCALIZACAO' })
|
||||
localizacao: string;
|
||||
|
||||
@Column({ name: 'PBONIFIC' })
|
||||
pbonific: number;
|
||||
|
||||
@Column({ name: 'CODDEGUSTACAO' })
|
||||
coddegustacao: number;
|
||||
|
||||
@Column({ name: 'PESOBRUTO' })
|
||||
pesobruto: number;
|
||||
|
||||
@Column({ name: 'EANCODPROD' })
|
||||
eancodprod: number;
|
||||
|
||||
@Column({ name: 'CODNAOATENDIMENTO' })
|
||||
codnaoatendimento: number;
|
||||
|
||||
@Column({ name: 'OBSINTEGRACAO1' })
|
||||
obsintegracao1: string;
|
||||
|
||||
@Column({ name: 'OBSINTEGRACAO2' })
|
||||
obsintegracao2: string;
|
||||
|
||||
@Column({ name: 'NUMPEDWEB' })
|
||||
numpedweb: number;
|
||||
|
||||
@Column({ name: 'TRANSACAO' })
|
||||
transacao: number;
|
||||
|
||||
@Column({ name: 'IDVENDA' })
|
||||
idvenda: number;
|
||||
|
||||
@Column({ name: 'INTEGRADORA' })
|
||||
integradora: number;
|
||||
|
||||
@Column({ name: 'CODRETORNO' })
|
||||
codretorno: number;
|
||||
|
||||
@Column({ name: 'COMISSAOATIM' })
|
||||
comissaoatim: number;
|
||||
|
||||
@Column({ name: 'TIPOENTREGA' })
|
||||
tipoentrega: string;
|
||||
|
||||
@Column({ name: 'CODRETORNOS' })
|
||||
codretornos: string;
|
||||
|
||||
@Column({ name: 'DTINCLUSAO' })
|
||||
dtinclusao: Date;
|
||||
|
||||
@Column({ name: 'CODPRODCESTA' })
|
||||
codprodcesta: number;
|
||||
|
||||
@Column({ name: 'BONIFIC' })
|
||||
bonific: string;
|
||||
|
||||
@Column({ name: 'DTIMP' })
|
||||
dtimp: Date;
|
||||
|
||||
@Column({ name: 'PBASERCA' })
|
||||
pbaserca: number;
|
||||
|
||||
@Column({ name: 'VLFRETE' })
|
||||
vlfrete: number;
|
||||
|
||||
@Column({ name: 'FATORCONVERSAO' })
|
||||
fatorconversao: number;
|
||||
|
||||
@Column({ name: 'IDKITPRODUTO' })
|
||||
idkitproduto: string;
|
||||
|
||||
@Column({ name: 'MOVIMENTACONTACORRENTERCA' })
|
||||
movimentacontacorrenterca: string;
|
||||
|
||||
@Column({ name: 'PORIGINAL' })
|
||||
poriginal: number;
|
||||
|
||||
@Column({ name: 'ESC_EMBALAGEMPRESENTE' })
|
||||
esc_embalagempresente: string;
|
||||
|
||||
@Column({ name: 'QTUNITEMB' })
|
||||
qtunitemb: number;
|
||||
|
||||
@Column({ name: 'IDREMESSAWEB' })
|
||||
idremessaweb: number;
|
||||
|
||||
@Column({ name: 'CODFILIAL' })
|
||||
codfilial: string;
|
||||
|
||||
@Column({ name: 'CODCLIPARTILHA' })
|
||||
codclipartilha: number;
|
||||
|
||||
@Column({name: 'RETIRAPOSTERIOR_IMEDIATA'})
|
||||
rp_imediata: string;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user