feat: Add new sales and shopping cart management module.
All checks were successful
Build (develop) / Promote (main) / build-and-push-deploy (push) Successful in 1m45s
All checks were successful
Build (develop) / Promote (main) / build-and-push-deploy (push) Successful in 1m45s
This commit is contained in:
@@ -8,6 +8,7 @@ import { Shopping } from 'src/domain/entity/tables/estprevendac.entity';
|
||||
import { OrderTaxDelivery } from 'src/domain/models/order-taxdelivery.model';
|
||||
import { connectionOptions } from 'src/configs/typeorm.config';
|
||||
import { LogOrder } from 'src/domain/models/log-order.model';
|
||||
import { Cart } from 'src/domain/models/cart.model';
|
||||
|
||||
@Injectable()
|
||||
export class ShoppingService {
|
||||
@@ -165,11 +166,11 @@ export class ShoppingService {
|
||||
const dataStockItem = await queryRunner.query(`SELECT E.estoque_disp_loja as "quantityStock"
|
||||
FROM ESVLISTAPRODUTOS E WHERE E.CODPROD = ${itemShopping.idProduct}
|
||||
AND E.CODFILIAL = '${itemShopping.stockStore}'`);
|
||||
|
||||
|
||||
let quantityStock = 0;
|
||||
if ( dataStockItem.length > 0 ) {
|
||||
if (dataStockItem.length > 0) {
|
||||
quantityStock = dataStockItem[0].quantityStock;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const sqlInsertitem = 'INSERT INTO ESTPREVENDAI ( ID, IDCART, NUMSEQ, CODPROD, QT, PVENDA, DTINCLUSAO, NOMEECOMMERCE, URLIMAGEM, TIPOPRODUTO, CODFILIALRETIRA, TIPOENTREGA, ' +
|
||||
@@ -605,6 +606,39 @@ export class ShoppingService {
|
||||
}
|
||||
}
|
||||
|
||||
async updateShopping(shopping: any) {
|
||||
const connection = new Connection(connectionOptions);
|
||||
await connection.connect();
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
try {
|
||||
console.log(JSON.stringify(shopping));
|
||||
const sql = `UPDATE ESTPREVENDAC
|
||||
SET ESTPREVENDAC.CODCLI = :codcli
|
||||
,ESTPREVENDAC.codendentcli = :codendentcli
|
||||
,ESTPREVENDAC.codplpag = :codplpag
|
||||
,ESTPREVENDAC.codcob = :codcob
|
||||
,ESTPREVENDAC.codfilial = :codfilial
|
||||
WHERE ID = :id `;
|
||||
|
||||
await queryRunner.query(sql, [
|
||||
shopping.codcli,
|
||||
shopping.codendentcli,
|
||||
shopping.codplpag,
|
||||
shopping.codcob,
|
||||
shopping.saleStore,
|
||||
shopping.id
|
||||
]);
|
||||
|
||||
return shopping;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
await connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
async updatePriceShopping(idCart: string, idPaymentPlan: number) {
|
||||
const connection = new Connection(connectionOptions);
|
||||
await connection.connect();
|
||||
|
||||
Reference in New Issue
Block a user