fix(wms): 修正仓库ID格式和计算逻辑,优化团队报表功能
修复仓库ID格式错误,统一为正确格式 修改calcSummary计算逻辑,使用lossList计算损耗数据 重构团队报表页面,增加班组统计功能 优化日期选择器,支持月份范围选择 调整钢卷标签显示为"投入钢卷"
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
const calcSummary = (list) => {
|
||||
const calcSummary = (list, lossList) => {
|
||||
// 总钢卷数量、总重、均重
|
||||
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 lossCount = lossList.length
|
||||
const lossTotalWeight = lossList.reduce((acc, cur) => acc + (parseFloat(cur.netWeight) || 0), 0) // 增加容错
|
||||
const lossAvgWeight = lossCount > 0 ? (lossTotalWeight / lossCount)?.toFixed(2) : 0
|
||||
// 合计数量、总重、均重
|
||||
const totalCount = outCount + lossCount
|
||||
@@ -14,7 +14,7 @@ const calcSummary = (list) => {
|
||||
const totalAvgWeight = totalCount > 0 ? (totalWeight / totalCount)?.toFixed(2) : 0
|
||||
|
||||
// 成品比率
|
||||
const passRate = outCount > 0 ? (outCount / lossCount) : 0
|
||||
const passRate = outCount > 0 ? (outTotalWeight / lossTotalWeight) : 0
|
||||
// 损失比率
|
||||
const lossRate = totalCount > 0 ? (1 - passRate) : 0
|
||||
// 异常率,成品在warehouseId在'2019583656787259393',
|
||||
@@ -93,7 +93,25 @@ const calcAbSummary = (list) => {
|
||||
]
|
||||
}
|
||||
|
||||
const calcTeamSummary = (list) => {
|
||||
// 按照班组汇总信息
|
||||
const teamSummary = {}
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
const coil = list[i];
|
||||
if (!teamSummary[coil.team]) {
|
||||
teamSummary[coil.team] = {
|
||||
count: 0,
|
||||
weight: 0,
|
||||
}
|
||||
}
|
||||
teamSummary[coil.team].count = teamSummary[coil.team].count + 1
|
||||
teamSummary[coil.team].weight = teamSummary[coil.team].weight + parseFloat(coil.netWeight) || 0
|
||||
}
|
||||
return teamSummary
|
||||
}
|
||||
|
||||
export {
|
||||
calcSummary,
|
||||
calcAbSummary,
|
||||
calcTeamSummary,
|
||||
}
|
||||
Reference in New Issue
Block a user