add:增加仓储服务,增加需求单至出库单流程
This commit is contained in:
@@ -20,7 +20,10 @@
|
||||
<rrOperation :crud="crud" />
|
||||
</el-form>
|
||||
</div>
|
||||
<crudOperation :permission="permission" />
|
||||
<div style="margin-bottom: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;">
|
||||
<crudOperation :permission="permission" />
|
||||
<el-button size="mini" type="success" :disabled="!multipleSelection.length" @click="handleBatchPush">下推</el-button>
|
||||
</div>
|
||||
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="900px">
|
||||
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="110px" label-suffix=":" style="border: 1px solid #cfe0df;margin-top: 10px;padding: 10px;">
|
||||
<el-row>
|
||||
@@ -66,7 +69,7 @@
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small">
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="id" label="ID" width="220" show-overflow-tooltip />
|
||||
<el-table-column prop="creator" label="操作人" min-width="100" show-overflow-tooltip />
|
||||
@@ -86,11 +89,10 @@
|
||||
<el-table-column prop="productionLine" label="产线" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="sn" label="车辆序列号" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="createAt" label="创建时间" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="240px" align="center" fixed="right">
|
||||
<el-table-column label="操作" width="180px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<udOperation style="display: inline" :data="scope.row" :permission="permission" />
|
||||
<el-button size="mini" type="warning" plain style="margin-left:4px;" @click="openAllocateDialog(scope.row)">分配</el-button>
|
||||
<el-button size="mini" type="success" plain style="margin-left:4px;" :disabled="scope.row.status !== '01'" @click="handlePush(scope.row)">下发</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -120,7 +122,7 @@ export default {
|
||||
return {
|
||||
permission: {},
|
||||
statusOptions: [
|
||||
{ value: 0, label: '生成' },
|
||||
{ value: '0', label: '生成' },
|
||||
{ value: '01', label: '分配' },
|
||||
{ value: '10', label: '下发' },
|
||||
{ value: '20', label: '执行' },
|
||||
@@ -133,6 +135,7 @@ export default {
|
||||
currentDemand: {},
|
||||
inventoryList: [],
|
||||
selectedInventory: [],
|
||||
multipleSelection: [],
|
||||
rules: {
|
||||
creator: [{ required: true, message: '请输入操作人', trigger: 'blur' }],
|
||||
createTime: [{ required: true, message: '请选择需求日期', trigger: 'change' }],
|
||||
@@ -165,6 +168,9 @@ export default {
|
||||
const map = { 0: '', '01': 'warning', '10': 'primary', '20': 'primary', '80': 'success', '90': 'danger' }
|
||||
return map[String(status)] || ''
|
||||
},
|
||||
handleSelectionChange(selection) {
|
||||
this.multipleSelection = selection
|
||||
},
|
||||
openAllocateDialog(row) {
|
||||
this.currentDemand = { ...row }
|
||||
this.inventoryList = []
|
||||
@@ -181,11 +187,12 @@ export default {
|
||||
if (row.inventoryDis) {
|
||||
try {
|
||||
const saved = JSON.parse(row.inventoryDis)
|
||||
const savedList = Array.isArray(saved) ? saved : [saved]
|
||||
this.inventoryList.forEach(item => {
|
||||
const match = saved.find(s => s.houseCode === item.houseCode)
|
||||
const match = savedList.find(s => (s.horseCode || s.houseCode) === item.houseCode)
|
||||
if (match) {
|
||||
item._selected = true
|
||||
item.allocQty = match.allocQty
|
||||
item.allocQty = Number(match.qty || match.allocQty || 0)
|
||||
this.$nextTick(() => {
|
||||
this.$refs.allocateTable && this.$refs.allocateTable.toggleRowSelection(item, true)
|
||||
})
|
||||
@@ -219,16 +226,11 @@ export default {
|
||||
this.$message.warning(`仓库 ${invalidRow.houseCode} 的分配数量必须大于0`)
|
||||
return
|
||||
}
|
||||
const inventoryDis = JSON.stringify(
|
||||
this.selectedInventory.map(item => ({
|
||||
houseCode: item.houseCode,
|
||||
houseName: item.houseName,
|
||||
skuCode: item.skuCode,
|
||||
skuName: item.skuName,
|
||||
qty: item.qty,
|
||||
allocQty: item.allocQty
|
||||
}))
|
||||
)
|
||||
const inventoryDisList = this.selectedInventory.map(item => ({
|
||||
horseCode: item.houseCode,
|
||||
qty: item.allocQty
|
||||
}))
|
||||
const inventoryDis = inventoryDisList.length === 1 ? JSON.stringify(inventoryDisList[0]) : JSON.stringify(inventoryDisList)
|
||||
this.allocateSaving = true
|
||||
allocate({ id: this.currentDemand.id, inventoryDis }).then(() => {
|
||||
this.$message.success('库存分配成功')
|
||||
@@ -240,17 +242,26 @@ export default {
|
||||
this.allocateSaving = false
|
||||
})
|
||||
},
|
||||
handlePush(row) {
|
||||
this.$confirm(`确认下发需求单 "${row.workOrder}" 吗?`, '提示', {
|
||||
handleBatchPush() {
|
||||
if (!this.multipleSelection.length) {
|
||||
this.$message.warning('请先勾选要下推的需求单')
|
||||
return
|
||||
}
|
||||
const invalidRows = this.multipleSelection.filter(item => String(item.status) !== '01')
|
||||
if (invalidRows.length) {
|
||||
this.$message.warning('仅支持批量下推状态为“分配”的需求单')
|
||||
return
|
||||
}
|
||||
this.$confirm(`确认批量下推已勾选的 ${this.multipleSelection.length} 条需求单吗?`, '提示', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
push({ id: row.id, workOrder: row.workOrder }).then(() => {
|
||||
this.$message.success('下发成功')
|
||||
push(this.multipleSelection).then(() => {
|
||||
this.$message.success('下推成功')
|
||||
this.crud.toQuery()
|
||||
}).catch(() => {
|
||||
this.$message.error('下发失败')
|
||||
this.$message.error('下推失败')
|
||||
})
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user