Browse Source

12.17

master
lichong 4 days ago
parent
commit
dc30e3f8ca
  1. 2
      package.json
  2. 5
      src/renderer/src/components/tablecomponent.vue
  3. 40
      src/renderer/src/views/shujuguanli.vue

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "electron", "name": "electron",
"version": "1.0.5", "version": "1.0.6",
"description": "An Electron application with Vue", "description": "An Electron application with Vue",
"main": "./out/main/index.js", "main": "./out/main/index.js",
"author": "lichong", "author": "lichong",

5
src/renderer/src/components/tablecomponent.vue

@ -10,11 +10,10 @@
v-for="(headerItem, headerIndex) in tableHeader" :key="headerIndex" :sortable="headerItem.isSort"> v-for="(headerItem, headerIndex) in tableHeader" :key="headerIndex" :sortable="headerItem.isSort">
<template #default="{ row }"> <template #default="{ row }">
<template v-if="headerItem.type === 'text'"> <template v-if="headerItem.type === 'text'">
<span>{{ headerItem.width }}</span> <span>{{ row[headerItem.prop] }}</span>
<span>!{{ row[headerItem.prop] }}</span>
</template> </template>
<template v-else> <template v-else>
<span> {{ headerItem.type }}!{{ row[headerItem.prop] }}</span> <span> {{ row[headerItem.prop] }}</span>
</template> </template>
</template> </template>
</vxe-column> </vxe-column>

40
src/renderer/src/views/shujuguanli.vue

@ -321,6 +321,7 @@ export default {
} }
// //
if (rowIndex === 2) { if (rowIndex === 2) {
console.log(317, XLSX.utils.format_cell(cell));
that.otherChangeList.push({ that.otherChangeList.push({
key: String.fromCharCode("a".charCodeAt() + colIndex), key: String.fromCharCode("a".charCodeAt() + colIndex),
value: XLSX.utils.format_cell(cell) value: XLSX.utils.format_cell(cell)
@ -559,9 +560,9 @@ export default {
let element = this.otherChangeList[i]; let element = this.otherChangeList[i];
if (element.value === "商店名称") { if (element.value === "商店名称") {
sdmc = element.key sdmc = element.key
} else if (element.value === "箱数") { } else if (["店铺箱数", "箱数"].includes(element.value)) {
xs = element.key xs = element.key
} else if (element.value === "条码贴") { } else if (["条码贴", "条形码"].includes(element.value)) {
tmt = element.key tmt = element.key
} }
} }
@ -614,14 +615,14 @@ export default {
let hasBarcode = sheetData[hasBarcodeIndex] let hasBarcode = sheetData[hasBarcodeIndex]
// //
hasBarcode["Barcode"] = firstItem[tmt] hasBarcode["Barcode"] = firstItem[tmt]
hasBarcode["Quantity of containers"] += firstItem[xs] hasBarcode["Quantity of containers"] += Number(firstItem[xs])
hasBarcode["Quantity to deliver"] += firstItem[firstItem.typeKey] hasBarcode["Quantity to deliver"] += firstItem[firstItem.typeKey]
hasBarcode["Quantity per container"] = firstItem[firstItem.typeKey] hasBarcode["Quantity per container"] = firstItem[firstItem.typeKey]
let newItem = "" let newItem = ""
if (this.atype === "a1") { if (this.atype === "a1") {
newItem = _.find(newData, o => _.toLower(o.Description).includes(`, ${_.toLower(firstItem.type)}, `) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode)) newItem = _.find(newData, o => _.toLower(o.Description).includes(`, ${_.toLower(firstItem.type)}, `) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode))
} else if (this.atype === "a2") { } else if (this.atype === "a2") {
newItem = _.find(newData, o => _.toLower(o.Description).includes(`, ${_.toLower(firstItem.type)}`) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode)) newItem = _.find(newData, o => _.toLower(o.Description).includes(`, ${_.toLower(firstItem.type)} M`) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode))
} else if (this.atype === "a3") { } 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') let typeTemp = firstItem.type.replace(/([0-9])([a-zA-Z])/g, '$1 $2').replace(/([a-zA-Z])([0-9])/g, '$1 $2')
newItem = _.find(newData, o => _.toLower(o.Description).includes(`, ${_.toLower(typeTemp)}`) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode)) newItem = _.find(newData, o => _.toLower(o.Description).includes(`, ${_.toLower(typeTemp)}`) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode))
@ -630,23 +631,25 @@ export default {
} else if (this.atype === "a5") { } else if (this.atype === "a5") {
newItem = _.find(newData, o => _.toLower(o.Description).includes(`, ${_.toLower(firstItem.type)}`) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode)) newItem = _.find(newData, o => _.toLower(o.Description).includes(`, ${_.toLower(firstItem.type)}`) && Number(o.Store) === Number(firstItem[sdmc]) && _.trim(o.Barcode))
} }
if (newItem) {
// //
newItem["Quantity of containers"] += firstItem[xs] newItem["Quantity of containers"] += Number(firstItem[xs])
newItem["Quantity to deliver"] += firstItem[firstItem.typeKey] // newItem["Quantity to deliver"] += firstItem[firstItem.typeKey]
// //
newData.push({ newData.push({
...hasBarcode, ...hasBarcode,
"Barcode": firstItem[tmt], "Barcode": firstItem[tmt],
"Quantity of containers": "", "Quantity of containers": 0,
"Quantity to deliver": "", "Quantity to deliver": "",
"Quantity per container": firstItem[firstItem.typeKey] "Quantity per container": firstItem[firstItem.typeKey]
}) })
}
} else if (noBarcodeIndex !== -1) { } else if (noBarcodeIndex !== -1) {
let noBarcode = sheetData[noBarcodeIndex] let noBarcode = sheetData[noBarcodeIndex]
// //
noBarcode["Barcode"] = firstItem[tmt] noBarcode["Barcode"] = firstItem[tmt]
noBarcode["Quantity of containers"] = firstItem[xs] noBarcode["Quantity of containers"] = Number(firstItem[xs])
noBarcode["Quantity to deliver"] = firstItem[firstItem.typeKey] // noBarcode["Quantity to deliver"] = firstItem[firstItem.typeKey]
noBarcode["Quantity per container"] = firstItem[firstItem.typeKey] noBarcode["Quantity per container"] = firstItem[firstItem.typeKey]
newData.push({ newData.push({
...noBarcode, ...noBarcode,
@ -716,13 +719,19 @@ export default {
"Barcode", "Quantity per container", "Total", "Cluster", "Barcode", "Quantity per container", "Total", "Cluster",
"", "", "", "" "", "", "", ""
]; ];
// //
let lilstLocal = listCopy.map(item => ({ let eTotal = 0
let iTotal = 0
let lilstLocal = []
for (let i = 0; i < listCopy.length; i++) {
let item = listCopy[i];
lilstLocal.push({
...item, ...item,
'Quantity to deliver': item["Quantity to deliver"] ? item["Quantity to deliver"].toFixed(3) : "" 'Quantity to deliver': item["Quantity to deliver"] ? item["Quantity to deliver"].toFixed(3) : ""
})); })
eTotal += Number(item["Quantity to deliver"])
iTotal += Number(item["Quantity per container"])
}
// 簿 // 簿
let workbook = new ExcelJS.Workbook(); let workbook = new ExcelJS.Workbook();
let worksheet = workbook.addWorksheet('Sheet1'); let worksheet = workbook.addWorksheet('Sheet1');
@ -747,6 +756,11 @@ export default {
cell.font = { name: 'Arial', size: 10, color: { argb: '000000' } }; cell.font = { name: 'Arial', size: 10, color: { argb: '000000' } };
cell.alignment = { horizontal: 'center', vertical: 'center' }; cell.alignment = { horizontal: 'center', vertical: 'center' };
} }
if (Number(row["Quantity to deliver"]) < Number(row["Quantity per container"])) {
let qpcCol = _.findIndex(rowKeys, o => o === "Quantity per container")
let cell = worksheet.getCell(rowIndex + 2, qpcCol + 1);
cell.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FFFF00' }, };
}
}); });
// //

Loading…
Cancel
Save