Browse Source

2025-10-13

销售发货装箱新增盒清单功能
master
fengyuan_yang 3 months ago
parent
commit
8e70b5bb37
  1. 6
      src/api/boxManage/boxManage.js
  2. 391
      src/views/modules/boxManage/saleBoxManage.vue

6
src/api/boxManage/boxManage.js

@ -10,3 +10,9 @@ export const updateBoxStatus= data => createAPI('/boxForNotification/updateBoxSt
export const scanBoxRoll= data => createAPI('/boxForNotification/scanBoxRoll','post',data) export const scanBoxRoll= data => createAPI('/boxForNotification/scanBoxRoll','post',data)
export const deleteBoxRoll= data => createAPI('/boxForNotification/deleteBoxRoll','post',data) export const deleteBoxRoll= data => createAPI('/boxForNotification/deleteBoxRoll','post',data)
export const searchRollForOrderNo= data => createAPI('/boxForNotification/searchRollForOrderNo','post',data) export const searchRollForOrderNo= data => createAPI('/boxForNotification/searchRollForOrderNo','post',data)
// 盒清单相关接口
export const searchSoReceiveCasesData = data => createAPI('/boxForNotification/searchSoReceiveCasesData','post',data)
export const deleteSoReceiveCasesData = data => createAPI('/boxForNotification/deleteSoReceiveCasesData','post',data)
export const validateAndScanCaseRoll = data => createAPI('/boxForNotification/validateAndScanCaseRoll','post',data)
export const saveCaseRollList = data => createAPI('/boxForNotification/saveCaseRollList','post',data)

391
src/views/modules/boxManage/saleBoxManage.vue

@ -81,7 +81,7 @@
<el-tab-pane label="出库单明细" name="outboundDetail"> <el-tab-pane label="出库单明细" name="outboundDetail">
<el-table <el-table
:data="detailList" :data="detailList"
:height="height - 20"
:height="height - 8"
border border
style="width: 100%;"> style="width: 100%;">
<el-table-column <el-table-column
@ -101,7 +101,77 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="装箱清单" name="boxing" style="">
<el-tab-pane label="盒清单" name="cases">
<el-form label-position="top" style="margin-left: 2px;">
<el-button type="primary" size="small" @click="openCaseDialog">新增</el-button>
<el-button type="danger" size="small" @click="deleteCaseRecord">删除</el-button>
</el-form>
<el-table
ref="caseTable"
:data="casesList"
:height="height - 30"
border
@selection-change="handleCaseSelectionChange"
style="width: 100%;">
<el-table-column
type="selection"
width="55"
align="center">
</el-table-column>
<el-table-column
prop="casesNo"
header-align="center"
align="center"
min-width="120"
label="盒标签">
</el-table-column>
<el-table-column
prop="rollNo"
header-align="center"
align="center"
min-width="120"
label="卷标签">
</el-table-column>
<el-table-column
prop="rollQty"
header-align="center"
align="right"
min-width="100"
label="卷数量">
</el-table-column>
<el-table-column
prop="partNo"
header-align="center"
align="left"
min-width="120"
label="物料编码">
</el-table-column>
<el-table-column
prop="partDesc"
header-align="center"
align="left"
min-width="200"
label="物料名称">
</el-table-column>
<el-table-column
prop="createDate"
header-align="center"
align="center"
min-width="160"
label="创建时间">
</el-table-column>
<el-table-column
prop="createBy"
header-align="center"
align="center"
min-width="100"
label="创建人">
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="箱清单" name="boxing">
<boxing ref="boxing"></boxing> <boxing ref="boxing"></boxing>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="已扫描卷" name="rollDetail"> <el-tab-pane label="已扫描卷" name="rollDetail">
@ -184,8 +254,87 @@
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<!-- 盒清单新增对话框 -->
<el-dialog title="装盒扫描" :visible.sync="caseDialogVisible" width="70%" :close-on-click-modal="false" @close="closeCaseDialog">
<el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
<el-form-item label="盒标签">
<el-input ref="caseNoInput" v-model="caseForm.casesNo" @keyup.enter.native="focusRollNoInput" placeholder="请扫描盒标签" style="width: 200px"></el-input>
</el-form-item>
<el-form-item label="卷标签">
<el-input ref="rollNoInput" v-model="caseForm.rollNo" @keyup.enter.native="scanCaseRoll" placeholder="请扫描卷标签" style="width: 200px"></el-input>
</el-form-item>
<el-form-item label="盒数量">
<el-input v-model="caseStatistics.casesCount" readonly style="width: 100px"></el-input>
</el-form-item>
<el-form-item label="卷数量">
<el-input v-model="caseStatistics.rollCount" readonly style="width: 100px"></el-input>
</el-form-item>
<el-form-item label="物料总数">
<el-input v-model="caseStatistics.totalQty" readonly style="width: 100px"></el-input>
</el-form-item>
</el-form>
<!-- 中部分扫描列表 -->
<el-table
:data="caseRollList"
border
height="300"
style="width: 100%; margin-top: 10px;">
<el-table-column
type="index"
label="序号"
width="50"
header-align="center"
align="right">
</el-table-column>
<el-table-column
prop="casesNo"
label="盒标签"
min-width="120"
header-align="center"
align="left">
</el-table-column>
<el-table-column
prop="rollNo"
label="卷标签"
min-width="120"
header-align="center"
align="left">
</el-table-column>
<el-table-column
prop="rollQty"
label="卷数量"
min-width="100"
header-align="center"
align="right">
</el-table-column>
<el-table-column
prop="partNo"
label="物料编码"
min-width="120"
header-align="center"
align="left">
</el-table-column>
<el-table-column
prop="partDesc"
label="物料名称"
min-width="200"
header-align="center"
align="left">
</el-table-column>
<el-table-column
prop="batchNo"
label="合约号"
min-width="120"
header-align="center"
align="left">
</el-table-column>
</el-table>
<el-footer style="height:35px;margin-top: 15px;text-align:center">
<el-button type="primary" @click="applyCaseScan">应用</el-button>
<el-button type="success" @click="saveCaseScan">保存</el-button>
<el-button @click="closeCaseDialog">关闭</el-button>
</el-footer>
</el-dialog>
</div> </div>
</template> </template>
@ -200,7 +349,13 @@ import {
getOutboundDetailWithRoll, getOutboundDetailWithRoll,
searchOutboundNotification searchOutboundNotification
} from '../../../api/qc/outbound_notification' } from '../../../api/qc/outbound_notification'
import {searchRollForOrderNo} from '../../../api/boxManage/boxManage'
import {
searchRollForOrderNo,
searchSoReceiveCasesData,
deleteSoReceiveCasesData,
validateAndScanCaseRoll,
saveCaseRollList
} from '../../../api/boxManage/boxManage'
export default { export default {
@ -231,6 +386,24 @@ export default {
detailList:[], detailList:[],
dataListLoading: false, dataListLoading: false,
activeName: 'outboundDetail', activeName: 'outboundDetail',
//
casesList: [],
caseDialogVisible: false,
caseForm: {
casesNo: '',
rollNo: '',
site: this.$store.state.user.site,
buNo: '',
notifyNo: '',
partNo: ''
},
caseRollList: [],
caseStatistics: {
casesCount: 0,
rollCount: 0,
totalQty: 0
},
selectedCaseRecords: [],
columnArray1: [ columnArray1: [
{ {
userId: this.$store.state.user.name, userId: this.$store.state.user.name,
@ -542,6 +715,9 @@ export default {
if(this.activeName==='rollDetail'){ if(this.activeName==='rollDetail'){
this.refreshRollsTable(); this.refreshRollsTable();
} }
if(this.activeName==='cases'){
this.refreshCasesTable();
}
}, },
async exportExcel() { async exportExcel() {
this.searchData.limit = -1 this.searchData.limit = -1
@ -587,6 +763,211 @@ export default {
this.rollList = data.rows this.rollList = data.rows
}) })
}, },
// ===== =====
refreshCasesTable(){
let templateData = {
site: this.currentRow.site,
buNo: this.currentRow.buNo,
notifyNo: this.currentRow.orderNo,
}
searchSoReceiveCasesData(templateData).then(({data}) => {
this.casesList = data.rows || []
})
},
openCaseDialog(){
if(!this.currentRow || !this.currentRow.orderNo){
this.$message.warning('请先选择一条出库单记录')
return
}
this.caseDialogVisible = true
this.resetCaseForm()
//
this.$nextTick(() => {
this.$refs.caseNoInput.focus()
})
},
resetCaseForm(){
this.caseForm = {
casesNo: '',
rollNo: '',
site: this.currentRow.site,
buNo: this.currentRow.buNo,
notifyNo: this.currentRow.orderNo,
partNo: ''
}
this.caseRollList = []
this.updateCaseStatistics()
},
focusRollNoInput(){
if(!this.caseForm.casesNo){
this.$message.warning('请先扫描盒标签')
return
}
this.$refs.rollNoInput.focus()
},
async scanCaseRoll(){
//
if(!this.caseForm.casesNo){
this.$message.warning('请先扫描盒标签')
this.$refs.caseNoInput.focus()
return
}
if(!this.caseForm.rollNo){
this.$message.warning('请扫描卷标签')
return
}
//
//
let partNo = ''
if(this.detailList && this.detailList.length > 0){
//
partNo = this.detailList[0].partNo
}
this.caseForm.partNo = partNo
try {
const {data} = await validateAndScanCaseRoll(this.caseForm)
if(data && data.code === 0 && data.rollInfo){
//
this.caseRollList.unshift({
casesNo: this.caseForm.casesNo,
rollNo: data.rollInfo.rollNo,
rollQty: data.rollInfo.rollQty,
partNo: data.rollInfo.partNo,
partDesc: data.rollInfo.partDesc,
batchNo: data.rollInfo.batchNo,
notifyNo: this.caseForm.notifyNo,
site: this.caseForm.site,
buNo: this.caseForm.buNo
})
//
this.updateCaseStatistics()
//
this.caseForm.casesNo = ''
this.caseForm.rollNo = ''
//
this.$nextTick(() => {
this.$refs.caseNoInput.focus()
})
this.$message.success('扫描成功')
} else {
this.$message.error(data.msg || '扫描失败')
}
} catch (error) {
this.$message.error(error.msg || '扫描失败,请检查')
//
this.caseForm.rollNo = ''
this.$refs.rollNoInput.focus()
}
},
updateCaseStatistics(){
// =
const uniqueCases = new Set(this.caseRollList.map(item => item.casesNo))
this.caseStatistics.casesCount = uniqueCases.size
// =
this.caseStatistics.rollCount = this.caseRollList.length
// =
this.caseStatistics.totalQty = this.caseRollList.reduce((sum, item) => {
return sum + (parseFloat(item.rollQty) || 0)
}, 0)
},
applyCaseScan(){
if(this.caseRollList.length === 0){
this.$message.warning('请先扫描卷标签')
return
}
//
this.saveCaseData(false)
},
saveCaseScan(){
if(this.caseRollList.length === 0){
this.$message.warning('请先扫描卷标签')
return
}
//
this.saveCaseData(true)
},
async saveCaseData(closeDialog){
try {
const {data} = await saveCaseRollList(this.caseRollList)
if(data && data.code === 0){
this.$message.success('保存成功')
if(closeDialog){
//
this.closeCaseDialog()
} else {
//
this.resetCaseForm()
this.$nextTick(() => {
this.$refs.caseNoInput.focus()
})
}
//
this.refreshCasesTable()
} else {
this.$message.error(data.msg || '保存失败')
}
} catch (error) {
this.$message.error(error.msg || '保存失败')
}
},
closeCaseDialog(){
this.caseDialogVisible = false
this.resetCaseForm()
},
handleCaseSelectionChange(selection){
this.selectedCaseRecords = selection
},
async deleteCaseRecord(){
if(this.selectedCaseRecords.length === 0){
this.$message.warning('请先选择要删除的记录')
return
}
this.$confirm('确定删除选中的记录吗?删除后将恢复库存卷的装盒状态', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
try {
for(let record of this.selectedCaseRecords){
await deleteSoReceiveCasesData({
id: record.id,
site: record.site,
buNo: record.buNo
})
}
this.$message.success('删除成功')
this.refreshCasesTable()
} catch (error) {
this.$message.error(error.msg || '删除失败')
}
}).catch(() => {})
},
}, },
created() { created() {
// //

Loading…
Cancel
Save