|
|
|
@ -5,6 +5,9 @@ |
|
|
|
<el-button type="primary" size="small" icon="el-icon-edit" @click="openBatchEditDialog"> |
|
|
|
批量编辑 |
|
|
|
</el-button> |
|
|
|
<el-button type="warning" size="small" icon="el-icon-s-operation" @click="openAdjustWeightDialog"> |
|
|
|
调整总毛重 |
|
|
|
</el-button> |
|
|
|
</div> |
|
|
|
|
|
|
|
<el-table |
|
|
|
@ -350,11 +353,67 @@ |
|
|
|
</el-button> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<!-- 调整总毛重弹窗 --> |
|
|
|
<el-dialog |
|
|
|
title="调整实际总毛重" |
|
|
|
:visible.sync="adjustWeightDialogVisible" |
|
|
|
width="600px" |
|
|
|
:close-on-click-modal="false"> |
|
|
|
|
|
|
|
<el-form :model="adjustWeightForm" label-width="250px"> |
|
|
|
<!-- 当前重量信息 --> |
|
|
|
<el-form-item label="当前总毛重:"> |
|
|
|
<span class="weight-display">{{ currentTotalGrossWeight.toFixed(3) }} KG</span> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="托盘重量:"> |
|
|
|
<span class="weight-display-small">{{ palletWeight.toFixed(3) }} KG</span> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-divider></el-divider> |
|
|
|
|
|
|
|
<!-- 输入框 - 最突出 --> |
|
|
|
<el-form-item label="实际总毛重(不包含托盘重量):" required class="input-highlight"> |
|
|
|
<el-input |
|
|
|
ref="actualWeightInput" |
|
|
|
v-model="adjustWeightForm.actualGrossWeight" |
|
|
|
placeholder="请输入实际称重的总毛重" |
|
|
|
type="number" @keyup.enter.native="submitAdjustWeight()" |
|
|
|
size="medium" |
|
|
|
clearable |
|
|
|
autofocus> |
|
|
|
<template slot="append">KG</template> |
|
|
|
</el-input> |
|
|
|
<div style="font-size: 12px; color: #909399; margin-top: 5px; line-height: 1.5;"> |
|
|
|
注:输入的总毛重不含托盘重量 |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<!-- 说明 --> |
|
|
|
<el-alert |
|
|
|
title="系统将按原箱毛重比例重新分配各箱毛重,并自动重新计算净重" |
|
|
|
type="info" |
|
|
|
:closable="false" |
|
|
|
show-icon> |
|
|
|
</el-alert> |
|
|
|
</el-form> |
|
|
|
|
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
<el-button @click="adjustWeightDialogVisible = false">取消</el-button> |
|
|
|
<el-button |
|
|
|
type="primary" |
|
|
|
:loading="adjustWeightSaving" |
|
|
|
@click="submitAdjustWeight"> |
|
|
|
确定调整 |
|
|
|
</el-button> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { selectBoxList, searchCoDelPalletDataNew, updateBoxInfo, deleteBoxInfo, updateDetailInfo, deleteDetailInfo, batchUpdatePackingInfo, searchEcssCoDelPalletHeaderData } from "@/api/ecss/ecss.js" |
|
|
|
import { selectBoxList, searchCoDelPalletDataNew, updateBoxInfo, deleteBoxInfo, updateDetailInfo, deleteDetailInfo, batchUpdatePackingInfo, searchEcssCoDelPalletHeaderData, adjustTotalGrossWeight } from "@/api/ecss/ecss.js" |
|
|
|
|
|
|
|
export default { |
|
|
|
name: "PackingDetailTab", |
|
|
|
@ -417,6 +476,13 @@ export default { |
|
|
|
batchEditModifiedDetails: {}, // 修改过的明细记录 |
|
|
|
batchEditSpanInfo: [], // 行合并信息 |
|
|
|
|
|
|
|
// 调整总毛重弹窗相关 |
|
|
|
adjustWeightDialogVisible: false, |
|
|
|
adjustWeightSaving: false, |
|
|
|
adjustWeightForm: { |
|
|
|
actualGrossWeight: '' |
|
|
|
}, |
|
|
|
|
|
|
|
// 装箱明细列定义 |
|
|
|
columnList3: [ |
|
|
|
{ |
|
|
|
@ -610,6 +676,12 @@ export default { |
|
|
|
batchEditModifiedCount() { |
|
|
|
return Object.keys(this.batchEditModifiedBoxes).length + |
|
|
|
Object.keys(this.batchEditModifiedDetails).length; |
|
|
|
}, |
|
|
|
// 当前合计毛重(不含托盘) |
|
|
|
currentTotalGrossWeight() { |
|
|
|
return this.dataListBoxes.reduce((sum, item) => { |
|
|
|
return sum + (Number(item.grossWeight) || 0); |
|
|
|
}, 0); |
|
|
|
} |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
@ -1624,6 +1696,91 @@ export default { |
|
|
|
} finally { |
|
|
|
this.batchEditSaving = false; |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// ========== 调整总毛重相关方法 ========== |
|
|
|
|
|
|
|
/** |
|
|
|
* 打开调整总毛重弹窗 |
|
|
|
*/ |
|
|
|
openAdjustWeightDialog() { |
|
|
|
// 验证是否所有箱都已维护毛净重 |
|
|
|
if (this.dataListBoxes.length === 0) { |
|
|
|
this.$message.warning('当前没有箱明细数据'); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// 检查是否所有箱都有毛重和净重 |
|
|
|
const hasInvalidBox = this.dataListBoxes.some(box => { |
|
|
|
const grossWeight = parseFloat(box.grossWeight) || 0; |
|
|
|
const netWeight = parseFloat(box.netWeight) || 0; |
|
|
|
return grossWeight <= 0 || netWeight <= 0; |
|
|
|
}); |
|
|
|
|
|
|
|
if (hasInvalidBox) { |
|
|
|
this.$alert('请先为所有箱维护毛重和净重后再进行调整', '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
type: 'warning' |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// 初始化表单,默认值为当前合计毛重 |
|
|
|
this.adjustWeightForm.actualGrossWeight = ''; |
|
|
|
this.adjustWeightDialogVisible = true; |
|
|
|
|
|
|
|
// 打开弹窗后自动聚焦到输入框并选中内容 |
|
|
|
this.$nextTick(() => { |
|
|
|
if (this.$refs.actualWeightInput) { |
|
|
|
this.$refs.actualWeightInput.focus(); |
|
|
|
this.$refs.actualWeightInput.select(); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 提交调整总毛重 |
|
|
|
* 直接调用后端API,由后端重新计算所有箱的毛重和净重 |
|
|
|
*/ |
|
|
|
async submitAdjustWeight() { |
|
|
|
// 验证输入 |
|
|
|
const actualGrossWeight = parseFloat(this.adjustWeightForm.actualGrossWeight); |
|
|
|
|
|
|
|
if (isNaN(actualGrossWeight) || actualGrossWeight <= 0) { |
|
|
|
this.$message.warning('请输入有效的实际总毛重'); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
this.adjustWeightSaving = true; |
|
|
|
|
|
|
|
try { |
|
|
|
// 调用后端API进行调整 |
|
|
|
const adjustParams = { |
|
|
|
site: this.currentRow.site, |
|
|
|
buNo: this.currentRow.buNo, |
|
|
|
delNo: this.currentRow.delNo, |
|
|
|
actualGrossWeight: actualGrossWeight, |
|
|
|
updateBy: this.$store.state.user.name |
|
|
|
}; |
|
|
|
|
|
|
|
const response = await adjustTotalGrossWeight(adjustParams); |
|
|
|
|
|
|
|
if (response.data && response.data.code === 0) { |
|
|
|
this.$message.success('总毛重调整成功'); |
|
|
|
this.adjustWeightDialogVisible = false; |
|
|
|
this.loadBoxList(); // 刷新主表格 |
|
|
|
this.$emit('refresh'); // 刷新父页面列表 |
|
|
|
} else { |
|
|
|
this.$alert(response.data.msg || '调整失败', '错误', { |
|
|
|
confirmButtonText: '确定' |
|
|
|
}); |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.error('调整总毛重失败:', error); |
|
|
|
this.$message.error('调整失败'); |
|
|
|
} finally { |
|
|
|
this.adjustWeightSaving = false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1969,4 +2126,51 @@ export default { |
|
|
|
font-size: 13px; |
|
|
|
color: #606266; |
|
|
|
} |
|
|
|
|
|
|
|
/* ========== 调整总毛重弹窗样式 ========== */ |
|
|
|
|
|
|
|
/* 重量显示 */ |
|
|
|
.weight-display { |
|
|
|
font-size: 20px; |
|
|
|
font-weight: bold; |
|
|
|
color: #409eff; |
|
|
|
font-family: 'Courier New', monospace; |
|
|
|
} |
|
|
|
|
|
|
|
.weight-display-small { |
|
|
|
font-size: 16px; |
|
|
|
font-weight: 600; |
|
|
|
color: #606266; |
|
|
|
font-family: 'Courier New', monospace; |
|
|
|
} |
|
|
|
|
|
|
|
/* 输入框高亮 */ |
|
|
|
.input-highlight /deep/ .el-input__inner { |
|
|
|
height: 50px; |
|
|
|
font-size: 18px; |
|
|
|
font-weight: 600; |
|
|
|
border: 2px solid #409eff; |
|
|
|
font-family: 'Courier New', monospace; |
|
|
|
background-color: #f0f9ff; |
|
|
|
} |
|
|
|
|
|
|
|
.input-highlight /deep/ .el-input__inner:focus { |
|
|
|
border-color: #409eff; |
|
|
|
box-shadow: 0 0 8px rgba(64, 158, 255, 0.3); |
|
|
|
} |
|
|
|
|
|
|
|
.input-highlight /deep/ .el-input-group__append { |
|
|
|
background-color: #409eff; |
|
|
|
color: #fff; |
|
|
|
border: 2px solid #409eff; |
|
|
|
border-left: none; |
|
|
|
font-weight: 600; |
|
|
|
font-size: 16px; |
|
|
|
} |
|
|
|
|
|
|
|
.input-highlight /deep/ .el-form-item__label { |
|
|
|
font-size: 15px; |
|
|
|
font-weight: 600; |
|
|
|
color: #303133; |
|
|
|
} |
|
|
|
</style> |