This commit is contained in:
Guillermo Bonet 2023-06-14 14:02:15 +02:00
parent 5a4ccb76fe
commit 5aa27e45bd
1 changed files with 55 additions and 3 deletions

View File

@ -495,7 +495,20 @@ export async function insertWarehouses(warehouses) {
}));
await models.warehouse.bulkCreate(warehousesWithDefaults, {
updateOnDuplicate: ['location_gln', 'location_address_addressLine', 'location_address_city', 'location_address_countryCode', 'location_address_postalCode', 'location_address_stateOrProvince', 'lastSync'],
updateOnDuplicate: [
'warehouseId',
'name',
'location_gln',
'location_address_addressLine',
'location_address_city',
'location_address_countryCode',
'location_address_postalCode',
'location_address_stateOrProvince',
'isDeleted',
'sequenceNumber',
'organizationId',
'lastSync',
],
transaction: tx,
});
@ -521,7 +534,23 @@ export async function insertOrganizations(organizations) {
}));
await models.organization.bulkCreate(organizationsWithDefaults, {
updateOnDuplicate: ['isConnected', 'lastSync'],
updateOnDuplicate: [
'organizationId',
'sequenceNumber',
'companyGln',
'name',
'commercialName',
'email',
'phone',
'website',
'rfhRelationId',
'paymentProviders',
'endDate',
'mailingAddress',
'physicalAddress',
'isConnected',
'lastSync',
],
transaction: tx,
});
@ -584,7 +613,30 @@ export async function insertSupplyLines(supplyLines) {
lastSync: moment().format('YYYY-MM-DD HH:mm:ss'),
}));
await models.supplyLine.bulkCreate(supplyLinesData, { transaction: tx });
await models.supplyLine.bulkCreate(supplyLinesData, {
updateOnDuplicate: [
'supplyLineId',
'status',
'numberOfPieces',
'deliveryPeriodStartDateTime',
'deliveryPeriodEndDateTime',
'orderPeriodStartDateTime',
'orderPeriodEndDateTime',
'warehouseId',
'sequenceNumber',
'type',
'isDeleted',
'salesUnit',
'agreementReferenceCode',
'agreementReferenceDescription',
'isLimited',
'isCustomerSpecific',
'tradeItemId',
'organizationId',
'lastSync',
],
transaction: tx,
});
const packingConfigurations = [];
const volumePrices = [];