Merge pull request #16 from JurunenseDesenvolvimento/release-gravar-estoque-atual
Incluida coluna tipo de endereço (NORMAL/PORTO/CONDOMINIO) no endereç…
This commit is contained in:
commit
eb572913eb
|
|
@ -1637,6 +1637,9 @@ export class Pcclient {
|
||||||
@Column({ name: 'CODSUBCATEGORIA' })
|
@Column({ name: 'CODSUBCATEGORIA' })
|
||||||
codsubcategoria: number;
|
codsubcategoria: number;
|
||||||
|
|
||||||
|
@Column({ name: 'TIPOENDERECO' })
|
||||||
|
tipoendereco: string;
|
||||||
|
|
||||||
@OneToMany(() => Pcnfsaid, notas => notas.pcclient)
|
@OneToMany(() => Pcnfsaid, notas => notas.pcclient)
|
||||||
notas: Pcnfsaid[];
|
notas: Pcnfsaid[];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,9 @@ export class Pcclientendent {
|
||||||
@Column({name: 'CODPAISRECEBEDOR'})
|
@Column({name: 'CODPAISRECEBEDOR'})
|
||||||
codpaisrecebedor: number;
|
codpaisrecebedor: number;
|
||||||
|
|
||||||
|
@Column({name: 'TIPOENDERECO'})
|
||||||
|
tipoendereco: string;
|
||||||
|
|
||||||
@OneToMany(() => Pcpedc, pedidos => pedidos.pcclientendent)
|
@OneToMany(() => Pcpedc, pedidos => pedidos.pcclientendent)
|
||||||
pedidos: Pcpedc[];
|
pedidos: Pcpedc[];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,5 +23,6 @@ export class Address {
|
||||||
emailRecebedor: string;
|
emailRecebedor: string;
|
||||||
latitude: number;
|
latitude: number;
|
||||||
longitude: number;
|
longitude: number;
|
||||||
|
addressType?: string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -19,14 +19,16 @@ export class Customer {
|
||||||
public category: Category,
|
public category: Category,
|
||||||
public subCategory: SubCategory,
|
public subCategory: SubCategory,
|
||||||
public place: Place,
|
public place: Place,
|
||||||
|
public placeId: number,
|
||||||
public sellerId: number,
|
public sellerId: number,
|
||||||
public ibgeCode: string,
|
public ibgeCode: string,
|
||||||
public birthdate: Date,
|
public birthdate?: Date,
|
||||||
public ramo: Ramo,
|
public ramo?: Ramo,
|
||||||
public communicate?: string,
|
public communicate?: string,
|
||||||
public idUser?: number,
|
public idUser?: number,
|
||||||
public latitude?: number,
|
public latitude?: number,
|
||||||
public longitude?: number,
|
public longitude?: number,
|
||||||
|
public addressType?: string,
|
||||||
){}
|
){}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -234,6 +234,7 @@ export class PartnerService {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
data.place,
|
data.place,
|
||||||
|
data.place.id,
|
||||||
data.sellerId,
|
data.sellerId,
|
||||||
data.ibgeCode,
|
data.ibgeCode,
|
||||||
null,
|
null,
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ export class AddressCustomerService {
|
||||||
.addSelect('\"pcclientendent\".codpracaent', 'placeId')
|
.addSelect('\"pcclientendent\".codpracaent', 'placeId')
|
||||||
.addSelect('\"pcclientendent\".latitude', 'latitude')
|
.addSelect('\"pcclientendent\".latitude', 'latitude')
|
||||||
.addSelect('\"pcclientendent\".longitude', 'longitude')
|
.addSelect('\"pcclientendent\".longitude', 'longitude')
|
||||||
|
.addSelect('\"pcclientendent\".tipoendereco', 'addressType')
|
||||||
.where("\"pcclientendent\".codcli = :idCustomer", { idCustomer })
|
.where("\"pcclientendent\".codcli = :idCustomer", { idCustomer })
|
||||||
.getRawMany();
|
.getRawMany();
|
||||||
return new ResultModel(true, null, addresses, null);
|
return new ResultModel(true, null, addresses, null);
|
||||||
|
|
@ -79,6 +80,7 @@ export class AddressCustomerService {
|
||||||
' ,pcclientendent.codpracaent as "placeId" ' +
|
' ,pcclientendent.codpracaent as "placeId" ' +
|
||||||
' ,pcclientendent.latitude as "latitude" ' +
|
' ,pcclientendent.latitude as "latitude" ' +
|
||||||
' ,pcclientendent.longitude as "longitude" ' +
|
' ,pcclientendent.longitude as "longitude" ' +
|
||||||
|
' ,pcclientendent.tipoendereco as "addressType" ' +
|
||||||
' FROM pcclientendent ' +
|
' FROM pcclientendent ' +
|
||||||
' WHERE pcclientendent.codcli = :idCustomer ' +
|
' WHERE pcclientendent.codcli = :idCustomer ' +
|
||||||
' AND pcclientendent.codendentcli = :idAddress ';
|
' AND pcclientendent.codendentcli = :idAddress ';
|
||||||
|
|
@ -122,6 +124,7 @@ export class AddressCustomerService {
|
||||||
' ,pcclientendent.codpracaent as "placeId" ' +
|
' ,pcclientendent.codpracaent as "placeId" ' +
|
||||||
' ,pcclientendent.latitude as "latitude" ' +
|
' ,pcclientendent.latitude as "latitude" ' +
|
||||||
' ,pcclientendent.longitude as "longitude" ' +
|
' ,pcclientendent.longitude as "longitude" ' +
|
||||||
|
' ,pcclientendent.tipoendereco as "addressType" ' +
|
||||||
' FROM pcclientendent ' +
|
' FROM pcclientendent ' +
|
||||||
' WHERE pcclientendent.codcli = :idCustomer ' +
|
' WHERE pcclientendent.codcli = :idCustomer ' +
|
||||||
" AND REGEXP_REPLACE(pcclientendent.cepent, '[^0-9]', '') = REGEXP_REPLACE(:cepent, '[^0-9]', '')";
|
" AND REGEXP_REPLACE(pcclientendent.cepent, '[^0-9]', '') = REGEXP_REPLACE(:cepent, '[^0-9]', '')";
|
||||||
|
|
@ -183,6 +186,7 @@ export class AddressCustomerService {
|
||||||
emailRecebedor: customer[0].email,
|
emailRecebedor: customer[0].email,
|
||||||
latitude: ( data.latitude ) ? data.latitude.toString() : '0',
|
latitude: ( data.latitude ) ? data.latitude.toString() : '0',
|
||||||
longitude:( data.longitude ) ? data.longitude.toString() : '0',
|
longitude:( data.longitude ) ? data.longitude.toString() : '0',
|
||||||
|
tipoendereco: data.addressType
|
||||||
})
|
})
|
||||||
.where("\"PCCLIENTENDENT\".codcli = :codcli and \"PCCLIENTENDENT\".codendentcli = :codendentcli",
|
.where("\"PCCLIENTENDENT\".codcli = :codcli and \"PCCLIENTENDENT\".codendentcli = :codendentcli",
|
||||||
{ codcli: data.idCustomer, codendentcli: data.idAddress })
|
{ codcli: data.idCustomer, codendentcli: data.idAddress })
|
||||||
|
|
@ -250,6 +254,7 @@ export class AddressCustomerService {
|
||||||
newPcclientendent.emailRecebedor = customer.email;
|
newPcclientendent.emailRecebedor = customer.email;
|
||||||
newPcclientendent.latitude = ( data.latitude ) ? data.latitude.toString() : '0';
|
newPcclientendent.latitude = ( data.latitude ) ? data.latitude.toString() : '0';
|
||||||
newPcclientendent.longitude = ( data.longitude ) ? data.longitude.toString() : '0';
|
newPcclientendent.longitude = ( data.longitude ) ? data.longitude.toString() : '0';
|
||||||
|
newPcclientendent.tipoendereco = data.addressType;
|
||||||
|
|
||||||
await queryRunner.manager
|
await queryRunner.manager
|
||||||
.createQueryBuilder()
|
.createQueryBuilder()
|
||||||
|
|
@ -257,6 +262,7 @@ export class AddressCustomerService {
|
||||||
.into(Pcclientendent)
|
.into(Pcclientendent)
|
||||||
.values(newPcclientendent)
|
.values(newPcclientendent)
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
const newAddress: Address = {
|
const newAddress: Address = {
|
||||||
idCustomer: data.idCustomer,
|
idCustomer: data.idCustomer,
|
||||||
idAddress: id,
|
idAddress: id,
|
||||||
|
|
@ -282,6 +288,7 @@ export class AddressCustomerService {
|
||||||
emailRecebedor: customer.email,
|
emailRecebedor: customer.email,
|
||||||
latitude: data.latitude,
|
latitude: data.latitude,
|
||||||
longitude: data.longitude,
|
longitude: data.longitude,
|
||||||
|
addressType: data.addressType,
|
||||||
}
|
}
|
||||||
|
|
||||||
return newAddress;
|
return newAddress;
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ export class CustomerService {
|
||||||
' ,pcclient.longitude as "longitude" ' +
|
' ,pcclient.longitude as "longitude" ' +
|
||||||
' ,pcclient.codmunicipio as "ibgeCode" ' +
|
' ,pcclient.codmunicipio as "ibgeCode" ' +
|
||||||
' ,pcclient.codcidade as "cityId" ' +
|
' ,pcclient.codcidade as "cityId" ' +
|
||||||
|
' ,pcclient.tipoendereco as "addressType" ' +
|
||||||
' FROM pcclient, pccidade ' +
|
' FROM pcclient, pccidade ' +
|
||||||
' WHERE pcclient.codcidade = pccidade.codcidade (+)';
|
' WHERE pcclient.codcidade = pccidade.codcidade (+)';
|
||||||
let where = ` AND ( pcclient.cliente like '%'||'${auxName.replace('@', '%')}'||'%' OR ` +
|
let where = ` AND ( pcclient.cliente like '%'||'${auxName.replace('@', '%')}'||'%' OR ` +
|
||||||
|
|
@ -59,7 +60,18 @@ export class CustomerService {
|
||||||
const pagination = ` OFFSET 0 ROWS FETCH NEXT 100 ROWS ONLY`;
|
const pagination = ` OFFSET 0 ROWS FETCH NEXT 100 ROWS ONLY`;
|
||||||
const customers = await queryRunner.manager
|
const customers = await queryRunner.manager
|
||||||
.query(sql + where + orderBy + pagination) as Customer[];
|
.query(sql + where + orderBy + pagination) as Customer[];
|
||||||
return customers;
|
let customerList: Customer[] = [];
|
||||||
|
for (let i = 0; i < customers.length; i++) {
|
||||||
|
let customer = customers[i];
|
||||||
|
const place = await queryRunner.query(`SELECT PCPRACA.CODPRACA as "placeId"
|
||||||
|
,PCPRACA.PRACA as "name"
|
||||||
|
FROM PCPRACA
|
||||||
|
WHERE PCPRACA.CODPRACA = ${customer.placeId}`);
|
||||||
|
|
||||||
|
customer.place = place[0];
|
||||||
|
customerList.push(customer);
|
||||||
|
}
|
||||||
|
return customerList;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
throw error;
|
throw error;
|
||||||
|
|
@ -102,6 +114,7 @@ export class CustomerService {
|
||||||
' ,pcclient.longitude as "longitude" ' +
|
' ,pcclient.longitude as "longitude" ' +
|
||||||
' ,pcclient.codmunicipio as "ibgeCode" ' +
|
' ,pcclient.codmunicipio as "ibgeCode" ' +
|
||||||
' ,pcclient.codcidade as "cityId" ' +
|
' ,pcclient.codcidade as "cityId" ' +
|
||||||
|
' ,pcclient.tipoendereco as "addressType" ' +
|
||||||
' FROM pcclient, pccidade ' +
|
' FROM pcclient, pccidade ' +
|
||||||
' WHERE pcclient.codcidade = pccidade.codcidade (+)';
|
' WHERE pcclient.codcidade = pccidade.codcidade (+)';
|
||||||
const where = ` AND REGEXP_REPLACE(pcclient.cgcent, '[^0-9]', '') =REGEXP_REPLACE('${cpf}', '[^0-9]', '')`;
|
const where = ` AND REGEXP_REPLACE(pcclient.cgcent, '[^0-9]', '') =REGEXP_REPLACE('${cpf}', '[^0-9]', '')`;
|
||||||
|
|
@ -150,11 +163,17 @@ export class CustomerService {
|
||||||
' ,pcclient.longitude as "longitude" ' +
|
' ,pcclient.longitude as "longitude" ' +
|
||||||
' ,pcclient.codmunicipio as "ibgeCode" ' +
|
' ,pcclient.codmunicipio as "ibgeCode" ' +
|
||||||
' ,pcclient.codcidade as "cityId" ' +
|
' ,pcclient.codcidade as "cityId" ' +
|
||||||
|
' ,pcclient.tipoendereco as "addressType" ' +
|
||||||
' FROM pcclient, pccidade ' +
|
' FROM pcclient, pccidade ' +
|
||||||
' WHERE pcclient.codcidade = pccidade.codcidade (+)';
|
' WHERE pcclient.codcidade = pccidade.codcidade (+)';
|
||||||
const where = ` AND pcclient.codcli = ${idCustomer}`;
|
const where = ` AND pcclient.codcli = ${idCustomer}`;
|
||||||
const customer = await queryRunner.query(sql + where);
|
const customer = await queryRunner.query(sql + where);
|
||||||
return customer[0];
|
const place = await queryRunner.query(`SELECT PCPRACA.CODPRACA as "placeId"
|
||||||
|
,PCPRACA.PRACA as "name"
|
||||||
|
FROM PCPRACA
|
||||||
|
WHERE PCPRACA.CODPRACA = ${customer[0].placeId}`);
|
||||||
|
|
||||||
|
return {...customer[0], place: place[0]};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
throw error;
|
throw error;
|
||||||
|
|
@ -216,6 +235,7 @@ export class CustomerService {
|
||||||
.addSelect("\"pcclient\".longitude as \"longitude\"")
|
.addSelect("\"pcclient\".longitude as \"longitude\"")
|
||||||
.addSelect("\"pcclient\".codmunicipio as \"ibgeCode\"")
|
.addSelect("\"pcclient\".codmunicipio as \"ibgeCode\"")
|
||||||
.addSelect("\"pcclient\".codcidade as \"cityId\"")
|
.addSelect("\"pcclient\".codcidade as \"cityId\"")
|
||||||
|
.addSelect("\"pcclient\".esc_tipoeclieente as \"addressType\"")
|
||||||
.where(where)
|
.where(where)
|
||||||
.andWhere("\"pcclient\".CODCLI NOT IN (2) AND \"pcclient\".DTEXCLUSAO IS NULL")
|
.andWhere("\"pcclient\".CODCLI NOT IN (2) AND \"pcclient\".DTEXCLUSAO IS NULL")
|
||||||
.getRawMany();
|
.getRawMany();
|
||||||
|
|
@ -304,6 +324,7 @@ export class CustomerService {
|
||||||
newCustomer.dtultalter = new Date();
|
newCustomer.dtultalter = new Date();
|
||||||
newCustomer.latitude = customer.latitude;
|
newCustomer.latitude = customer.latitude;
|
||||||
newCustomer.longitude = customer.longitude;
|
newCustomer.longitude = customer.longitude;
|
||||||
|
newCustomer.tipoendereco = customer.addressType;
|
||||||
|
|
||||||
const oldCustomer = await this.findCustomerByCpf(newCustomer.cgcent);
|
const oldCustomer = await this.findCustomerByCpf(newCustomer.cgcent);
|
||||||
if (oldCustomer) {
|
if (oldCustomer) {
|
||||||
|
|
@ -321,7 +342,8 @@ export class CustomerService {
|
||||||
allowMessage: customer.allowMessage, cellPhone: customer.cellPhone,
|
allowMessage: customer.allowMessage, cellPhone: customer.cellPhone,
|
||||||
category: customer.category, subCategory: customer.subCategory,
|
category: customer.category, subCategory: customer.subCategory,
|
||||||
place: customer.place, ramo: customer.ramo, meiocomunicacao: customer.communicate,
|
place: customer.place, ramo: customer.ramo, meiocomunicacao: customer.communicate,
|
||||||
latitude: customer.latitude, longitude: customer.longitude, ibgeCode: customer.ibgeCode
|
latitude: customer.latitude, longitude: customer.longitude, ibgeCode: customer.ibgeCode,
|
||||||
|
addressType: customer.addressType,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
const idCustomer = await this.generateIdCustomer();
|
const idCustomer = await this.generateIdCustomer();
|
||||||
|
|
@ -340,7 +362,8 @@ export class CustomerService {
|
||||||
allowMessage: customer.allowMessage, cellPhone: customer.cellPhone,
|
allowMessage: customer.allowMessage, cellPhone: customer.cellPhone,
|
||||||
category: customer.category, subCategory: customer.subCategory,
|
category: customer.category, subCategory: customer.subCategory,
|
||||||
place: customer.place, meiocomunicacao: customer.communicate,
|
place: customer.place, meiocomunicacao: customer.communicate,
|
||||||
ramo: customer.ramo, latitude: customer.latitude, longitude: customer.longitude, ibgeCode: customer.ibgeCode
|
ramo: customer.ramo, latitude: customer.latitude, longitude: customer.longitude,
|
||||||
|
ibgeCode: customer.ibgeCode, addressType: customer.addressType,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
@ -401,6 +424,7 @@ export class CustomerService {
|
||||||
dtultalter: client.dtultalter,
|
dtultalter: client.dtultalter,
|
||||||
latitude: client.latitude,
|
latitude: client.latitude,
|
||||||
longitude: client.longitude,
|
longitude: client.longitude,
|
||||||
|
tipoendereco: client.tipoendereco
|
||||||
})
|
})
|
||||||
.where({ codcli: client.codcli })
|
.where({ codcli: client.codcli })
|
||||||
.execute();
|
.execute();
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue