diff --git a/klp-ui/src/views/wms/report/js/calc.js b/klp-ui/src/views/wms/report/js/calc.js
new file mode 100644
index 00000000..cd6b0939
--- /dev/null
+++ b/klp-ui/src/views/wms/report/js/calc.js
@@ -0,0 +1,99 @@
+const calcSummary = (list) => {
+ // 总钢卷数量、总重、均重
+ const outCount = list.length
+ const outTotalWeight = list.reduce((acc, cur) => acc + (parseFloat(cur.netWeight) || 0), 0) // 增加容错
+ const outAvgWeight = outCount > 0 ? (outTotalWeight / outCount)?.toFixed(2) : 0
+
+ // 损失钢卷数量、总重、均重
+ const lossCount = list.length
+ const lossTotalWeight = list.reduce((acc, cur) => acc + (parseFloat(cur.netWeight) || 0), 0) // 增加容错
+ const lossAvgWeight = lossCount > 0 ? (lossTotalWeight / lossCount)?.toFixed(2) : 0
+ // 合计数量、总重、均重
+ const totalCount = outCount + lossCount
+ const totalWeight = parseFloat((outTotalWeight + lossTotalWeight).toFixed(2))
+ const totalAvgWeight = totalCount > 0 ? (totalWeight / totalCount)?.toFixed(2) : 0
+
+ // 成品比率
+ const passRate = outCount > 0 ? (outCount / lossCount) : 0
+ // 损失比率
+ const lossRate = totalCount > 0 ? (1 - passRate) : 0
+ // 异常率,成品在warehouseId在'2019583656787259393',
+ // '2019583325311414274',
+ // '2019583429955104769',
+ // '2019583137616310273',这四个库中的占比
+ const abRate = totalCount != 0 ? list.filter(item => {
+ return item.warehouseId == '2019583656787259393' || item.warehouseId == '2019583325311414274' || item.warehouseId == '2019583429955104769' || item.warehouseId == '2019583137616310273'
+ }).length / totalCount : 0
+
+ return {
+ outCount,
+ outTotalWeight: outTotalWeight.toFixed(2),
+ outAvgWeight,
+ lossCount,
+ lossTotalWeight: lossTotalWeight.toFixed(2),
+ lossAvgWeight,
+ totalCount,
+ totalWeight: totalWeight.toFixed(2),
+ totalAvgWeight,
+ passRate: (passRate * 100)?.toFixed(2) + '%',
+ lossRate: (lossRate * 100)?.toFixed(2) + '%',
+ abRate: (abRate * 100)?.toFixed(2) || 0,
+ }
+}
+
+const calcAbSummary = (list) => {
+ // 异常统计,统计四个异常库中的各自的数量和总重
+ let o = {
+ jishuCount: 0,
+ jishuWeight: 0,
+ miniCount: 0,
+ miniWeight: 0,
+ rubbishCount: 0,
+ rubbishWeight: 0,
+ returnCount: 0,
+ returnWeight: 0,
+ }
+ for (let i = 0; i < list.length; i++) {
+ // { label: '技术部', value: '2019583656787259393' },
+ // { label: '小钢卷库', value: '2019583325311414274' },
+ // { label: '废品库', value: '2019583429955104769' },
+ // { label: '退货库', value: '2019583137616310273' },
+ // 技术部
+ const coil = list[i];
+ // 技术部
+ if (coil.warehouseId == '2019583656787259393') {
+ o['jishuCount'] = o['jishuCount'] + 1
+ o['jishuWeight'] = o['jishuWeight'] + parseFloat(coil.netWeight) || 0
+ }
+ // 小刚卷库
+ if (coil.warehouseId == '2019583325311414274') {
+ o['miniCount'] = o['miniCount'] + 1
+ o['miniWeight'] = o['miniWeight'] + parseFloat(coil.netWeight) || 0
+ }
+ // 废品库
+ if (coil.warehouseId == '2019583429955104769') {
+ o['rubbishCount'] = o['rubbishCount'] + 1
+ o['rubbishWeight'] = o['rubbishWeight'] + parseFloat(coil.netWeight) || 0
+ }
+ // 退货库
+ if (coil.warehouseId == '2019583137616310273') {
+ o['returnCount'] = o['returnCount'] + 1
+ o['returnWeight'] = o['returnWeight'] + parseFloat(coil.netWeight) || 0
+ }
+ }
+ return [
+ { label: '技术部钢卷数', value: o['jishuCount'] },
+ { label: '技术部钢卷重量', value: o['jishuWeight'] },
+ { label: '小钢卷库钢卷数', value: o['miniCount'] },
+ { label: '小钢卷库钢卷重量', value: o['miniWeight'] },
+ { label: '废品库钢卷数', value: o['rubbishCount'] },
+ { label: '废品库钢卷重量', value: o['rubbishWeight'] },
+ { label: '退货库钢卷数', value: o['returnCount'] },
+ { label: '退货库钢卷重量', value: o['returnWeight'] },
+ ]
+}
+
+export {
+ calcSummary,
+ calcAbSummary,
+}
\ No newline at end of file
diff --git a/klp-ui/src/views/wms/report/zha/day.vue b/klp-ui/src/views/wms/report/zha/day.vue
index 6c37e5e8..57ca4ad6 100644
--- a/klp-ui/src/views/wms/report/zha/day.vue
+++ b/klp-ui/src/views/wms/report/zha/day.vue
@@ -63,6 +63,11 @@
{{ summary.abRate }}
+
+
+ {{ item.value }}
+
+
@@ -144,6 +149,7 @@ import CoilNo from "@/components/KLPService/Renderer/CoilNo.vue";
import MemoInput from "@/components/MemoInput";
import MutiSelect from "@/components/MutiSelect";
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
+import { calcSummary, calcAbSummary } from "@/views/wms/report/js/calc";
export default {
components: {
@@ -260,47 +266,10 @@ export default {
},
computed: {
summary() {
- // 总钢卷数量、总重、均重
- const outCount = this.list.length
- const outTotalWeight = this.list.reduce((acc, cur) => acc + (parseFloat(cur.netWeight) || 0), 0) // 增加容错
- const outAvgWeight = outCount > 0 ? (outTotalWeight / outCount)?.toFixed(2) : 0
-
- // 损失钢卷数量、总重、均重
- const lossCount = this.lossList.length
- const lossTotalWeight = this.lossList.reduce((acc, cur) => acc + (parseFloat(cur.netWeight) || 0), 0) // 增加容错
- const lossAvgWeight = lossCount > 0 ? (lossTotalWeight / lossCount)?.toFixed(2) : 0
- // 合计数量、总重、均重
- const totalCount = outCount + lossCount
- const totalWeight = parseFloat((outTotalWeight + lossTotalWeight).toFixed(2))
- const totalAvgWeight = totalCount > 0 ? (totalWeight / totalCount)?.toFixed(2) : 0
-
- // 成品比率
- const passRate = outCount > 0 ? (outCount / lossCount) : 0
- // 损失比率
- const lossRate = 1 - passRate
- // 异常率,成品在warehouseId在'2019583656787259393',
- // '2019583325311414274',
- // '2019583429955104769',
- // '2019583137616310273',这四个库中的占比
- const abRate = this.list.filter(item => {
- return item.warehouseId == '2019583656787259393' || item.warehouseId == '2019583325311414274' || item.warehouseId == '2019583429955104769' || item.warehouseId == '2019583137616310273'
- }).length / totalCount
-
-
- return {
- outCount,
- outTotalWeight: outTotalWeight.toFixed(2),
- outAvgWeight,
- lossCount,
- lossTotalWeight: lossTotalWeight.toFixed(2),
- lossAvgWeight,
- totalCount,
- totalWeight: totalWeight.toFixed(2),
- totalAvgWeight,
- passRate: passRate?.toFixed(2) * 100 + '%',
- lossRate: lossRate?.toFixed(2) * 100 + '%',
- abRate: (abRate?.toFixed(2) * 100) || 0 + '%',
- }
+ return calcSummary(this.list)
+ },
+ abSummary() {
+ return calcAbSummary(this.list)
}
},
methods: {
@@ -360,7 +329,7 @@ export default {
message: '暂无数据',
type: 'warning',
})
- this.list = []
+ this.lossList = []
this.loading = false
return
}
diff --git a/klp-ui/src/views/wms/report/zha/month.vue b/klp-ui/src/views/wms/report/zha/month.vue
index 0b78591e..09ebf3b0 100644
--- a/klp-ui/src/views/wms/report/zha/month.vue
+++ b/klp-ui/src/views/wms/report/zha/month.vue
@@ -144,6 +144,7 @@ import CoilNo from "@/components/KLPService/Renderer/CoilNo.vue";
import MemoInput from "@/components/MemoInput";
import MutiSelect from "@/components/MutiSelect";
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
+import { calcSummary, calcAbSummary } from "@/views/wms/report/js/calc";
export default {
components: {
@@ -161,7 +162,7 @@ export default {
// 获取当前日期(默认选中当天)
const now = new Date()
- const currentDate = `${now.getFullYear()}-${addZero(now.getMonth() + 1)}}`
+ const currentDate = `${now.getFullYear()}-${addZero(now.getMonth() + 1)}`
/**
* 生成指定日期/月份的时间范围字符串
@@ -290,47 +291,7 @@ export default {
},
computed: {
summary() {
- // 总钢卷数量、总重、均重
- const outCount = this.list.length
- const outTotalWeight = this.list.reduce((acc, cur) => acc + (parseFloat(cur.netWeight) || 0), 0) // 增加容错
- const outAvgWeight = outCount > 0 ? (outTotalWeight / outCount)?.toFixed(2) : 0
-
- // 损失钢卷数量、总重、均重
- const lossCount = this.lossList.length
- const lossTotalWeight = this.lossList.reduce((acc, cur) => acc + (parseFloat(cur.netWeight) || 0), 0) // 增加容错
- const lossAvgWeight = lossCount > 0 ? (lossTotalWeight / lossCount)?.toFixed(2) : 0
- // 合计数量、总重、均重
- const totalCount = outCount + lossCount
- const totalWeight = parseFloat((outTotalWeight + lossTotalWeight).toFixed(2))
- const totalAvgWeight = totalCount > 0 ? (totalWeight / totalCount)?.toFixed(2) : 0
-
- // 成品比率
- const passRate = outCount > 0 ? (outCount / lossCount) : 0
- // 损失比率
- const lossRate = 1 - passRate
- // 异常率,成品在warehouseId在'2019583656787259393',
- // '2019583325311414274',
- // '2019583429955104769',
- // '2019583137616310273',这四个库中的占比
- const abRate = this.list.filter(item => {
- return item.warehouseId == '2019583656787259393' || item.warehouseId == '2019583325311414274' || item.warehouseId == '2019583429955104769' || item.warehouseId == '2019583137616310273'
- }).length / totalCount
-
-
- return {
- outCount,
- outTotalWeight: outTotalWeight.toFixed(2),
- outAvgWeight,
- lossCount,
- lossTotalWeight: lossTotalWeight.toFixed(2),
- lossAvgWeight,
- totalCount,
- totalWeight: totalWeight.toFixed(2),
- totalAvgWeight,
- passRate: passRate?.toFixed(2) * 100 + '%',
- lossRate: lossRate?.toFixed(2) * 100 + '%',
- abRate: (abRate?.toFixed(2) * 100) || 0 + '%',
- }
+ return calcSummary(this.list)
}
},
methods: {
@@ -390,7 +351,7 @@ export default {
message: '暂无数据',
type: 'warning',
})
- this.list = []
+ this.lossList = []
this.loading = false
return
}
diff --git a/klp-ui/src/views/wms/report/zha/year.vue b/klp-ui/src/views/wms/report/zha/year.vue
index 63125723..72b36c89 100644
--- a/klp-ui/src/views/wms/report/zha/year.vue
+++ b/klp-ui/src/views/wms/report/zha/year.vue
@@ -144,6 +144,7 @@ import CoilNo from "@/components/KLPService/Renderer/CoilNo.vue";
import MemoInput from "@/components/MemoInput";
import MutiSelect from "@/components/MutiSelect";
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
+import { calcSummary, calcAbSummary } from "@/views/wms/report/js/calc";
export default {
components: {
@@ -274,47 +275,7 @@ export default {
},
computed: {
summary() {
- // 总钢卷数量、总重、均重
- const outCount = this.list.length
- const outTotalWeight = this.list.reduce((acc, cur) => acc + (parseFloat(cur.netWeight) || 0), 0) // 增加容错
- const outAvgWeight = outCount > 0 ? (outTotalWeight / outCount)?.toFixed(2) : 0
-
- // 损失钢卷数量、总重、均重
- const lossCount = this.lossList.length
- const lossTotalWeight = this.lossList.reduce((acc, cur) => acc + (parseFloat(cur.netWeight) || 0), 0) // 增加容错
- const lossAvgWeight = lossCount > 0 ? (lossTotalWeight / lossCount)?.toFixed(2) : 0
- // 合计数量、总重、均重
- const totalCount = outCount + lossCount
- const totalWeight = parseFloat((outTotalWeight + lossTotalWeight).toFixed(2))
- const totalAvgWeight = totalCount > 0 ? (totalWeight / totalCount)?.toFixed(2) : 0
-
- // 成品比率
- const passRate = outCount > 0 ? (outCount / lossCount) : 0
- // 损失比率
- const lossRate = 1 - passRate
- // 异常率,成品在warehouseId在'2019583656787259393',
- // '2019583325311414274',
- // '2019583429955104769',
- // '2019583137616310273',这四个库中的占比
- const abRate = this.list.filter(item => {
- return item.warehouseId == '2019583656787259393' || item.warehouseId == '2019583325311414274' || item.warehouseId == '2019583429955104769' || item.warehouseId == '2019583137616310273'
- }).length / totalCount
-
-
- return {
- outCount,
- outTotalWeight: outTotalWeight.toFixed(2),
- outAvgWeight,
- lossCount,
- lossTotalWeight: lossTotalWeight.toFixed(2),
- lossAvgWeight,
- totalCount,
- totalWeight: totalWeight.toFixed(2),
- totalAvgWeight,
- passRate: passRate?.toFixed(2) * 100 + '%',
- lossRate: lossRate?.toFixed(2) * 100 + '%',
- abRate: (abRate?.toFixed(2) * 100) || 0 + '%',
- }
+ return calcSummary(this.list)
}
},
methods: {
@@ -361,7 +322,7 @@ export default {
this.loading = true
listPendingAction({
actionType: 11, // 酸轧工序
- pageSize: 999,
+ pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
@@ -374,7 +335,7 @@ export default {
message: '暂无数据',
type: 'warning',
})
- this.list = []
+ this.lossList = []
this.loading = false
return
}
diff --git a/klp-ui/src/views/wms/report/zinc/day.vue b/klp-ui/src/views/wms/report/zinc/day.vue
index b672562f..f3d62365 100644
--- a/klp-ui/src/views/wms/report/zinc/day.vue
+++ b/klp-ui/src/views/wms/report/zinc/day.vue
@@ -63,6 +63,11 @@
{{ summary.abRate }}
+
+
+ {{ item.value }}
+
+
@@ -144,6 +149,7 @@ import CoilNo from "@/components/KLPService/Renderer/CoilNo.vue";
import MemoInput from "@/components/MemoInput";
import MutiSelect from "@/components/MutiSelect";
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
+import { calcSummary, calcAbSummary } from "@/views/wms/report/js/calc";
export default {
components: {
@@ -246,47 +252,10 @@ export default {
},
computed: {
summary() {
- // 总钢卷数量、总重、均重
- const outCount = this.list.length
- const outTotalWeight = this.list.reduce((acc, cur) => acc + (parseFloat(cur.netWeight) || 0), 0) // 增加容错
- const outAvgWeight = outCount > 0 ? (outTotalWeight / outCount)?.toFixed(2) : 0
-
- // 损失钢卷数量、总重、均重
- const lossCount = this.lossList.length
- const lossTotalWeight = this.lossList.reduce((acc, cur) => acc + (parseFloat(cur.netWeight) || 0), 0) // 增加容错
- const lossAvgWeight = lossCount > 0 ? (lossTotalWeight / lossCount)?.toFixed(2) : 0
- // 合计数量、总重、均重
- const totalCount = outCount + lossCount
- const totalWeight = parseFloat((outTotalWeight + lossTotalWeight).toFixed(2))
- const totalAvgWeight = totalCount > 0 ? (totalWeight / totalCount)?.toFixed(2) : 0
-
- // 成品比率
- const passRate = outCount > 0 ? (outCount / lossCount) : 0
- // 损失比率
- const lossRate = 1 - passRate
- // 异常率,成品在warehouseId在'2019583656787259393',
- // '2019583325311414274',
- // '2019583429955104769',
- // '2019583137616310273',这四个库中的占比
- const abRate = this.list.filter(item => {
- return item.warehouseId == '2019583656787259393' || item.warehouseId == '2019583325311414274' || item.warehouseId == '2019583429955104769' || item.warehouseId == '2019583137616310273'
- }).length / totalCount
-
-
- return {
- outCount,
- outTotalWeight: outTotalWeight.toFixed(2),
- outAvgWeight,
- lossCount,
- lossTotalWeight: lossTotalWeight.toFixed(2),
- lossAvgWeight,
- totalCount,
- totalWeight: totalWeight.toFixed(2),
- totalAvgWeight,
- passRate: passRate?.toFixed(2) * 100 + '%',
- lossRate: lossRate?.toFixed(2) * 100 + '%',
- abRate: (abRate?.toFixed(2) * 100) || 0 + '%',
- }
+ return calcSummary(this.list)
+ },
+ abSummary() {
+ return calcAbSummary(this.list)
}
},
methods: {
diff --git a/klp-ui/src/views/wms/report/zinc/month.vue b/klp-ui/src/views/wms/report/zinc/month.vue
index 9905629b..066b16c1 100644
--- a/klp-ui/src/views/wms/report/zinc/month.vue
+++ b/klp-ui/src/views/wms/report/zinc/month.vue
@@ -144,6 +144,7 @@ import CoilNo from "@/components/KLPService/Renderer/CoilNo.vue";
import MemoInput from "@/components/MemoInput";
import MutiSelect from "@/components/MutiSelect";
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
+import { calcSummary, calcAbSummary } from "@/views/wms/report/js/calc";
export default {
components: {
@@ -161,7 +162,7 @@ export default {
// 获取当前日期(默认选中当天)
const now = new Date()
- const currentDate = `${now.getFullYear()}-${addZero(now.getMonth() + 1)}}`
+ const currentDate = `${now.getFullYear()}-${addZero(now.getMonth() + 1)}`
/**
* 生成指定日期/月份的时间范围字符串
@@ -276,47 +277,7 @@ export default {
},
computed: {
summary() {
- // 总钢卷数量、总重、均重
- const outCount = this.list.length
- const outTotalWeight = this.list.reduce((acc, cur) => acc + (parseFloat(cur.netWeight) || 0), 0) // 增加容错
- const outAvgWeight = outCount > 0 ? (outTotalWeight / outCount)?.toFixed(2) : 0
-
- // 损失钢卷数量、总重、均重
- const lossCount = this.lossList.length
- const lossTotalWeight = this.lossList.reduce((acc, cur) => acc + (parseFloat(cur.netWeight) || 0), 0) // 增加容错
- const lossAvgWeight = lossCount > 0 ? (lossTotalWeight / lossCount)?.toFixed(2) : 0
- // 合计数量、总重、均重
- const totalCount = outCount + lossCount
- const totalWeight = parseFloat((outTotalWeight + lossTotalWeight).toFixed(2))
- const totalAvgWeight = totalCount > 0 ? (totalWeight / totalCount)?.toFixed(2) : 0
-
- // 成品比率
- const passRate = outCount > 0 ? (outCount / lossCount) : 0
- // 损失比率
- const lossRate = 1 - passRate
- // 异常率,成品在warehouseId在'2019583656787259393',
- // '2019583325311414274',
- // '2019583429955104769',
- // '2019583137616310273',这四个库中的占比
- const abRate = this.list.filter(item => {
- return item.warehouseId == '2019583656787259393' || item.warehouseId == '2019583325311414274' || item.warehouseId == '2019583429955104769' || item.warehouseId == '2019583137616310273'
- }).length / totalCount
-
-
- return {
- outCount,
- outTotalWeight: outTotalWeight.toFixed(2),
- outAvgWeight,
- lossCount,
- lossTotalWeight: lossTotalWeight.toFixed(2),
- lossAvgWeight,
- totalCount,
- totalWeight: totalWeight.toFixed(2),
- totalAvgWeight,
- passRate: passRate?.toFixed(2) * 100 + '%',
- lossRate: lossRate?.toFixed(2) * 100 + '%',
- abRate: (abRate?.toFixed(2) * 100) || 0 + '%',
- }
+ return calcSummary(this.list)
}
},
methods: {
@@ -376,7 +337,7 @@ export default {
message: '暂无数据',
type: 'warning',
})
- this.list = []
+ this.lossList = []
this.loading = false
return
}
diff --git a/klp-ui/src/views/wms/report/zinc/year.vue b/klp-ui/src/views/wms/report/zinc/year.vue
index 96ef2837..60e90241 100644
--- a/klp-ui/src/views/wms/report/zinc/year.vue
+++ b/klp-ui/src/views/wms/report/zinc/year.vue
@@ -144,6 +144,7 @@ import CoilNo from "@/components/KLPService/Renderer/CoilNo.vue";
import MemoInput from "@/components/MemoInput";
import MutiSelect from "@/components/MutiSelect";
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
+import { calcSummary, calcAbSummary } from "@/views/wms/report/js/calc";
export default {
components: {
@@ -258,47 +259,7 @@ export default {
},
computed: {
summary() {
- // 总钢卷数量、总重、均重
- const outCount = this.list.length
- const outTotalWeight = this.list.reduce((acc, cur) => acc + (parseFloat(cur.netWeight) || 0), 0) // 增加容错
- const outAvgWeight = outCount > 0 ? (outTotalWeight / outCount)?.toFixed(2) : 0
-
- // 损失钢卷数量、总重、均重
- const lossCount = this.lossList.length
- const lossTotalWeight = this.lossList.reduce((acc, cur) => acc + (parseFloat(cur.netWeight) || 0), 0) // 增加容错
- const lossAvgWeight = lossCount > 0 ? (lossTotalWeight / lossCount)?.toFixed(2) : 0
- // 合计数量、总重、均重
- const totalCount = outCount + lossCount
- const totalWeight = parseFloat((outTotalWeight + lossTotalWeight).toFixed(2))
- const totalAvgWeight = totalCount > 0 ? (totalWeight / totalCount)?.toFixed(2) : 0
-
- // 成品比率
- const passRate = outCount > 0 ? (outCount / lossCount) : 0
- // 损失比率
- const lossRate = 1 - passRate
- // 异常率,成品在warehouseId在'2019583656787259393',
- // '2019583325311414274',
- // '2019583429955104769',
- // '2019583137616310273',这四个库中的占比
- const abRate = this.list.filter(item => {
- return item.warehouseId == '2019583656787259393' || item.warehouseId == '2019583325311414274' || item.warehouseId == '2019583429955104769' || item.warehouseId == '2019583137616310273'
- }).length / totalCount
-
-
- return {
- outCount,
- outTotalWeight: outTotalWeight.toFixed(2),
- outAvgWeight,
- lossCount,
- lossTotalWeight: lossTotalWeight.toFixed(2),
- lossAvgWeight,
- totalCount,
- totalWeight: totalWeight.toFixed(2),
- totalAvgWeight,
- passRate: passRate?.toFixed(2) * 100 + '%',
- lossRate: lossRate?.toFixed(2) * 100 + '%',
- abRate: (abRate?.toFixed(2) * 100) || 0 + '%',
- }
+ return calcSummary(this.list)
}
},
methods: {
@@ -345,7 +306,7 @@ export default {
this.loading = true
listPendingAction({
actionType: 501, // 镀锌工序
- pageSize: 999,
+ pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
@@ -358,7 +319,7 @@ export default {
message: '暂无数据',
type: 'warning',
})
- this.list = []
+ this.lossList = []
this.loading = false
return
}