aggiornamento ordini

This commit is contained in:
Surya Paolo
2023-12-14 15:20:27 +01:00
parent ba7fffdc23
commit 4ec5b12d64
11 changed files with 97 additions and 42 deletions

View File

@@ -25,10 +25,12 @@ export default defineComponent({
const arrSkill = ref(<any[]>[])
const arrGood = ref(<any[]>[])
const importasulserver = ref(false)
const skipfirstrow = ref(true)
const incaricamento = ref(false)
const cosafare = ref(shared_consts.Cmd.PROVINCE)
const cosafare = ref(shared_consts.Cmd.PRODUCTS)
const inputfile = ref('')
const risultato = ref('')
@@ -38,6 +40,10 @@ export default defineComponent({
const ListaCmd = ref(
[
{
label: 'Importa Prodotti',
value: shared_consts.Cmd.PRODUCTS
},
{
label: 'Importa Province',
value: shared_consts.Cmd.PROVINCE
@@ -144,7 +150,7 @@ export default defineComponent({
}
const myid = arr.length + 1
arr.push({_id: myid, descr: cat})
arr.push({ _id: myid, descr: cat })
return myid
}
@@ -185,7 +191,7 @@ export default defineComponent({
arr = arrSkill.value
}
const myid = arr.length + 1
arr.push({_id: myid, descr: cat})
arr.push({ _id: myid, descr: cat })
return myid
}
@@ -247,7 +253,7 @@ export default defineComponent({
strskills += ' _id:' + idSkill + ','
if (cmd === shared_consts.Cmd.CAT_GOODS_TXT) {
strskills += ' idSectorGood: [' + idSector + '],'
}else if (cmd === shared_consts.Cmd.CAT_SKILL_TXT) {
} else if (cmd === shared_consts.Cmd.CAT_SKILL_TXT) {
strskills += ' idSector: [' + idSector + '],'
}
@@ -303,7 +309,7 @@ export default defineComponent({
// debugger;
for (let i = 0; i < myarr.length; i = i + righe) {
sotto_cat = myarr[i].replace('\'', '\\\'')
sector = myarr[i+2]
sector = myarr[i + 2]
txt += sotto_cat + ',' + sector + '<br>'
}
@@ -334,9 +340,18 @@ export default defineComponent({
let strris = ''
let ind = 1
let primo = true
for (const rec of myarr) {
if (skipfirstrow.value) {
if (ind === 1) {
ind++;
continue;
}
}
let lab = tools.addslashes(rec[0])
let val = tools.addslashes(rec[1])
if (cmd === shared_consts.Cmd.PROVINCE) {
@@ -356,6 +371,22 @@ export default defineComponent({
strris += ' comune:\'' + tools.addslashes(rec[1]) + '\','
strris += ' prov:\'' + tools.addslashes(rec[2]) + '\''
} else if (cmd === shared_consts.Cmd.PRODUCTS) {
if (!primo){
strris += ', '
}
strris += '{ '
strris += ' "code":"' + tools.removeescape(tools.addslashes(rec[0])) + '",'
strris += ' "name":"' + tools.removeescape(tools.addslashes(rec[1])) + '",'
strris += ' "price":"' + tools.removeescape(tools.addslashes(tools.convertPriceEurToValue(rec[2]))) + '",'
strris += ' "stockQty":"' + tools.removeescape(tools.addslashes(rec[3])) + '",'
strris += ' "link":"' + tools.removeescape(tools.addslashes(rec[4])) + '",'
strris += ' "perc_iva":"' + tools.removeescape(tools.addslashes(rec[5])) + '",'
strris += ' "price_acquistato":"' + tools.removeescape(tools.addslashes(tools.convertPriceEurToValue(rec[6]))) + '",'
strris += ' "producer_name":"' + tools.removeescape(tools.addslashes(rec[7])) + '"'
strris += '} '
} else if (cmd === shared_consts.Cmd.CITIES_SERVER) {
strris += '{ \n'
strris += ' _id :' + ind + ',\n'
@@ -370,14 +401,19 @@ export default defineComponent({
strris += '}, \n'
}
ind += 1
primo = false
}
if (cmd === shared_consts.Cmd.CITIES_SERVER) {
userStore.importToServerCmd($q, t, cmd, null)
} else if (cmd === shared_consts.Cmd.PRODUCTS) {
if (importasulserver.value)
userStore.importToServerCmd($q, t, cmd, strris)
}
risultato = strris
return risultato
}
@@ -400,6 +436,9 @@ export default defineComponent({
risultato.value = ''
userStore.importToServerCmd($q, t, cosafare.value, null)
}
function eseguiCmdProduct() {
userStore.importToServerCmd($q, t, cosafare.value, risultato.value)
}
function createProvLink() {
let str = ''
@@ -441,6 +480,9 @@ export default defineComponent({
caricadati,
createProvLink,
risraw,
importasulserver,
skipfirstrow,
eseguiCmdProduct,
}
}
})