diff --git a/package.json b/package.json index ef08315..fcb051f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.0.8", + "version": "1.0.9", "description": "An Electron application with Vue", "main": "./out/main/index.js", "author": "lichong", diff --git a/src/renderer/src/views/shujuguanli.vue b/src/renderer/src/views/shujuguanli.vue index 3e01c50..8f07c54 100644 --- a/src/renderer/src/views/shujuguanli.vue +++ b/src/renderer/src/views/shujuguanli.vue @@ -616,22 +616,28 @@ export default { for (let i = 0; i < itemTemp.length; i++) { let firstItem = itemTemp[i]; let hasBarcodeIndex + let copyBarcodeIndex let noBarcodeIndex if (this.atype === "a1") { hasBarcodeIndex = _.findIndex(sheetData, o => o.Description.includes(`, ${firstItem.type}, `) && _.toUpper(o.Description.replaceAll(" ", "")).includes(`${_.toUpper(firstItem.ys.replaceAll(" ", ""))}`) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode) && _.trim(o.Barcode) === _.trim(firstItem[tmt])) + copyBarcodeIndex = _.findIndex(sheetData, o => o.Description.includes(`, ${firstItem.type}, `) && _.toUpper(o.Description.replaceAll(" ", "")).includes(`${_.toUpper(firstItem.ys.replaceAll(" ", ""))}`) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode)) noBarcodeIndex = _.findIndex(sheetData, o => o.Description.includes(`, ${firstItem.type}, `) && _.toUpper(o.Description.replaceAll(" ", "")).includes(`${_.toUpper(firstItem.ys.replaceAll(" ", ""))}`) && Number(o.Store) === Number(firstItem[sdmc]) && !_.trim(o.Barcode)) } else if (this.atype === "a2") { hasBarcodeIndex = _.findIndex(sheetData, o => o.Description.includes(`, ${firstItem.type} M`) && _.toUpper(o.Description.replaceAll(" ", "")).includes(`${_.toUpper(firstItem.ys.replaceAll(" ", ""))}`) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode) && _.trim(o.Barcode) === _.trim(firstItem[tmt])) + copyBarcodeIndex = _.findIndex(sheetData, o => o.Description.includes(`, ${firstItem.type} M`) && _.toUpper(o.Description.replaceAll(" ", "")).includes(`${_.toUpper(firstItem.ys.replaceAll(" ", ""))}`) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode)) noBarcodeIndex = _.findIndex(sheetData, o => o.Description.includes(`, ${firstItem.type} M`) && _.toUpper(o.Description.replaceAll(" ", "")).includes(`${_.toUpper(firstItem.ys.replaceAll(" ", ""))}`) && Number(o.Store) === Number(firstItem[sdmc]) && !_.trim(o.Barcode)) } else if (this.atype === "a3") { let typeTemp = firstItem.type.replace(/([0-9])([a-zA-Z])/g, '$1 $2').replace(/([a-zA-Z])([0-9])/g, '$1 $2') hasBarcodeIndex = _.findIndex(sheetData, o => _.toLower(o.Description).includes(`, ${_.toLower(typeTemp)}`) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode) && _.trim(o.Barcode) === _.trim(firstItem[tmt])) + copyBarcodeIndex = _.findIndex(sheetData, o => _.toLower(o.Description).includes(`, ${_.toLower(typeTemp)}`) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode)) noBarcodeIndex = _.findIndex(sheetData, o => _.toLower(o.Description).includes(`, ${_.toLower(typeTemp)}`) && Number(o.Store) === Number(firstItem[sdmc]) && !_.trim(o.Barcode)) } else if (this.atype === "a4") { hasBarcodeIndex = _.findIndex(sheetData, o => o.Description.includes(`, ${firstItem.type}`) && _.toUpper(o.Description.replaceAll(" ", "")).includes(`${_.toUpper(firstItem.ys.replaceAll(" ", ""))}`) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode) && _.trim(o.Barcode) === _.trim(firstItem[tmt])) + copyBarcodeIndex = _.findIndex(sheetData, o => o.Description.includes(`, ${firstItem.type}`) && _.toUpper(o.Description.replaceAll(" ", "")).includes(`${_.toUpper(firstItem.ys.replaceAll(" ", ""))}`) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode)) noBarcodeIndex = _.findIndex(sheetData, o => o.Description.includes(`, ${firstItem.type}`) && _.toUpper(o.Description.replaceAll(" ", "")).includes(`${_.toUpper(firstItem.ys.replaceAll(" ", ""))}`) && Number(o.Store) === Number(firstItem[sdmc]) && !_.trim(o.Barcode)) } else if (this.atype === "a5") { hasBarcodeIndex = _.findIndex(sheetData, o => o.Description.includes(`, ${firstItem.type}`) && _.toUpper(o.Description.replaceAll(" ", "")).includes(`${_.toUpper(firstItem.ys.replaceAll(" ", ""))}`) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode) && _.trim(o.Barcode) === _.trim(firstItem[tmt])) + copyBarcodeIndex = _.findIndex(sheetData, o => o.Description.includes(`, ${firstItem.type}`) && _.toUpper(o.Description.replaceAll(" ", "")).includes(`${_.toUpper(firstItem.ys.replaceAll(" ", ""))}`) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode)) noBarcodeIndex = _.findIndex(sheetData, o => o.Description.includes(`, ${firstItem.type}`) && _.toUpper(o.Description.replaceAll(" ", "")).includes(`${_.toUpper(firstItem.ys.replaceAll(" ", ""))}`) && Number(o.Store) === Number(firstItem[sdmc]) && !_.trim(o.Barcode)) } if (hasBarcodeIndex !== -1) { @@ -667,6 +673,18 @@ export default { "Quantity per container": firstItem[firstItem.typeKey] }) } + } else if (copyBarcodeIndex !== -1) { + let copyBarcode = sheetData[copyBarcodeIndex] + let copyBarcodetemp = sheetDataTemp[copyBarcodeIndex] + copyBarcodetemp["_ishas_"] = true + // 修改原有的值 + copyBarcode["Barcode"] = firstItem[tmt] + copyBarcode["Quantity of containers"] = Number(firstItem[xs]) + copyBarcode["Quantity per container"] = firstItem[firstItem.typeKey] + newData.push({ + ...copyBarcode, + "Quantity to deliver": "" + }) } else if (noBarcodeIndex !== -1) { let noBarcode = sheetData[noBarcodeIndex] let noBarcodetemp = sheetDataTemp[noBarcodeIndex] @@ -744,20 +762,9 @@ export default { "Barcode", "Quantity per container", "Total", "Cluster", "", "", "", "" ]; - // 处理数据,保留三位小数 - let lilstLocalTemp = [] - for (let i = 0; i < this.fileData2Local.length; i++) { - let item = this.fileData2Local[i]; - let oldList = _.filter(listCopy, o => o.Store === item.Store && o.Description === item.Description && o["Quantity to deliver"] === item["Quantity to deliver"]) - if (oldList.length) { - lilstLocalTemp.push(...oldList) - } else { - lilstLocalTemp.push({ ...item }) - } - } let lilstLocal = [] - for (let i = 0; i < lilstLocalTemp.length; i++) { - let item = lilstLocalTemp[i]; + for (let i = 0; i < listCopy.length; i++) { + let item = listCopy[i]; lilstLocal.push({ ...item, 'Quantity to deliver': item["Quantity to deliver"] ? item["Quantity to deliver"].toFixed(3) : ""