- Uscita PRIMA VERSIONE PiuCheBuono.app

This commit is contained in:
Surya Paolo
2023-12-30 21:33:59 +01:00
parent ade9c149c5
commit b6204c7612
15 changed files with 330 additions and 121 deletions

View File

@@ -71,26 +71,42 @@ const productSchema = new Schema({
default: 1,
required: true,
},
maxBookableQty: { // quantità massima Pre-ordinabile (singolarmente)
maxBookableSinglePersQty: { // quantità massima Pre-ordinabile (singolarmente)
type: Number,
default: 0,
},
stockQty: { // in magazzino
type: Number,
default: 0,
},
bookableQty: { // Quantità prenotabili
stockBloccatiQty: { // Prenotati Bloccati
type: Number,
default: 0,
},
stockBloccatiQty: { // Prenotati
bookedQtyConfirmed: { // Quantità Prenotate Confermate Totali
type: Number,
default: 0,
},
bookableBloccatiQty: { // Quantità Prenotati e prenotabili
// GAS:
qtyToReachForGas: { // Quantità minima da raggiungere per fare l'ordine GAS
type: Number,
default: 0,
},
maxbookableGASQty: { // Quantità massima (ancora disponibile) Ordine GAS prenotabile (Complessivamente tra tutti gli ordini)
type: Number,
default: 0,
},
bookedGASQtyOrdered: { // Quantità Ordine GAS Prenotate Confermate Totali
type: Number,
default: 0,
},
bookableGASBloccatiQty: { // Quantità Prenotate Bloccate GAS
type: Number,
default: 0,
},
quantityLow: { //Soglia disponibilità bassa
type: Number,
default: 0,
@@ -114,6 +130,9 @@ const productSchema = new Schema({
dateAvailableFrom: {
type: Date
},
note: {
type: String,
},
producer_name: {
type: String,
},
@@ -421,7 +440,7 @@ module.exports.findAllIdApp = async function (idapp, code, id) {
$subtract: ["$stockQty", "$QuantitaOrdinateInAttesa"],
},
bookableAvailableQty: {
$subtract: ["$bookableQty", "$QuantitaPrenotateInAttesa"],
$subtract: ["$maxbookableGASQty", "$QuantitaPrenotateInAttesa"],
}
}
},
@@ -503,16 +522,16 @@ module.exports.createIndexes((err) => {
if (err) throw err;
});
module.exports.convertAfterImport = async function (idapp, dataObjects) {
module.exports.convertAfterImportALLPROD = async function (idapp, dataObjects) {
const arrprod = await Product.find({ idapp }).lean();
for (const prod of arrprod) {
await this.singlerecconvert_AfterImport(prod);
await this.singlerecconvert_AfterImport_AndSave(prod);
}
};
module.exports.singlerecconvert_AfterImport = async function (idapp, prod, isnuovo) {
module.exports.singlerecconvert_AfterImport_AndSave = async function (idapp, prod, isnuovo) {
let setta = false;
@@ -524,9 +543,13 @@ module.exports.singlerecconvert_AfterImport = async function (idapp, prod, isnuo
if (isnuovo) {
objtoset = {
idapp,
minBuyQty: 1,
minStepQty: 1,
maxBookableQty: 0,
// minBuyQty: 1,
// minStepQty: 1,
maxBookableSinglePersQty: 0,
bookedGASQtyOrdered: 0,
bookableGASBloccatiQty: 0,
// qtyToReachForGas: 0,
// maxbookableGASQty: 0,
}
}
@@ -568,6 +591,7 @@ module.exports.singlerecconvert_AfterImport = async function (idapp, prod, isnuo
}
}
if (prod.provider_name) {
// Cerca il produttore
let recprovider = await Provider.findOne({ idapp, name: prod.provider_name }).lean();