Browse Source

总毛重调整

java8
han\hanst 3 months ago
parent
commit
a1db95f665
  1. 2
      src/api/ecss/ecss.js
  2. 206
      src/views/modules/ecss/components/PackingDetailTab.vue

2
src/api/ecss/ecss.js

@ -110,6 +110,8 @@ export const updateDetailInfo = data => createAPI(`/ecss/coDel/updateDetailInfo`
export const deleteDetailInfo = data => createAPI(`/ecss/coDel/deleteDetailInfo`,'post',data)
// 批量修改装箱明细
export const batchUpdatePackingInfo = data => createAPI(`/ecss/coDel/batchUpdatePackingInfo`,'post',data)
// 调整总毛重
export const adjustTotalGrossWeight = data => createAPI(`/ecss/coDel/adjustTotalGrossWeight`,'post',data)
export const searchTemplateList = data => createAPI(`/select/ecssMapper/searchTemplateList/list`,'post',data)

206
src/views/modules/ecss/components/PackingDetailTab.vue

@ -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>
Loading…
Cancel
Save