Aggiornamento cataloghi...
This commit is contained in:
@@ -2607,10 +2607,55 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
|
||||
return null
|
||||
},
|
||||
async updateLocalDbFromGM_T_Web_Articoli(sku: string) {
|
||||
|
||||
const options: IOptQueryGM = {
|
||||
nameTable: 'T_Web_Articoli',
|
||||
query: '',
|
||||
where: 'T.IdArticolo =' + sku,
|
||||
showQtaDisponibile: false,
|
||||
outhtml: false,
|
||||
cmd: shared_consts.CmdQueryMs.UPDATE,
|
||||
updatelocaldb: true,
|
||||
}
|
||||
|
||||
const valueris = await this.fetchTableContent(options);
|
||||
|
||||
return !!valueris
|
||||
},
|
||||
|
||||
async setGM_FieldOf_T_Web_Articoli(sku: string, data: Record<string, any>, cmd: number) {
|
||||
try {
|
||||
// Verifica se i campi specificati sono validi
|
||||
if (!data || Object.keys(data).length === 0) {
|
||||
throw new Error("I campi specificati non sono validi.");
|
||||
}
|
||||
|
||||
// Costruisce le opzioni per l'aggiornamento
|
||||
const options: IOptQueryGM = {
|
||||
nameTable: 'T_Web_Articoli',
|
||||
insertMode: false, // Impostiamo su false per eseguire un UPDATE (modifica)
|
||||
data, // Dati da aggiornare
|
||||
where: `IdArticolo = ${sku}`, // Condizione WHERE basata sullo SKU
|
||||
cmd,
|
||||
};
|
||||
|
||||
// Eseguiamo l'operazione di salvataggio
|
||||
const result = await this.saveTableContent(options);
|
||||
|
||||
// Restituiamo il risultato dell'operazione
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error("Errore durante l'aggiornamento dei campi:", error.message);
|
||||
throw new Error(`Errore durante l'aggiornamento dei campi per lo SKU ${sku}: ${error.message}`);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
async fetchTableContent(options: IOptQueryGM) {
|
||||
try {
|
||||
// aggiungi idapp ad options
|
||||
options.idapp = tools.getEnv('VITE_APP_ID')
|
||||
return Api.SendReq('/apisqlsrv/view-table', 'POST', { options })
|
||||
.then((res) => {
|
||||
return res.data.data
|
||||
@@ -2623,6 +2668,20 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
}
|
||||
},
|
||||
|
||||
async saveTableContent(options: IOptQueryGM) {
|
||||
try {
|
||||
return Api.SendReq('/apisqlsrv/save-table', 'POST', { options })
|
||||
.then((res) => {
|
||||
return res.data.data
|
||||
}).catch((error: any) => {
|
||||
console.error('Error saveTableContent: ', error)
|
||||
})
|
||||
} catch (error) {
|
||||
console.error("Errore nel salvataggio della tabella:", error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
||||
async getMailInABox(cmd: string, record: any = undefined) {
|
||||
|
||||
const mydata = {
|
||||
@@ -2651,10 +2710,6 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
|
||||
},
|
||||
|
||||
SchedeOpt() {
|
||||
return this.getSchedeOpt
|
||||
},
|
||||
|
||||
aggiornaRecordInLocaleDopoUpdateSulServer(datain: any, resdata: any) {
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user