出入库优化
This commit is contained in:
@@ -23,6 +23,9 @@
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="RefreshLeft" size="mini" :disabled="single" @click="handleRevoke()">撤回</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" size="mini" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
||||
</el-row>
|
||||
|
||||
@@ -44,10 +47,16 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="业务类型" align="center" prop="bizType" min-width="120" />
|
||||
<el-table-column label="责任人" align="center" prop="responsibleName" min-width="120" />
|
||||
<el-table-column label="状态" align="center" width="90">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.revokeFlag === '1'" type="danger">已撤回</el-tag>
|
||||
<el-tag v-else type="info">正常</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="220">
|
||||
<template #default="scope">
|
||||
<el-button size="mini" type="text" icon="Document" @click="showDetail(scope.row)">明细</el-button>
|
||||
<el-button size="mini" type="text" icon="RefreshLeft" @click="handleRevoke(scope.row)">撤回</el-button>
|
||||
<el-button size="mini" type="text" icon="RefreshLeft" :disabled="scope.row.revokeFlag === '1'" @click="handleRevoke(scope.row)">撤回</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -78,11 +87,6 @@
|
||||
<el-input v-model="editForm.responsibleName" placeholder="请输入责任人" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="来源单号" prop="sourceNo">
|
||||
<el-input v-model="editForm.sourceNo" placeholder="请输入来源单号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="editForm.remark" placeholder="请输入备注" />
|
||||
@@ -127,7 +131,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" min-width="120" align="center">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.quantity" placeholder="请输入数量" @input="recalcAmount(scope.row)" />
|
||||
<el-input v-model="scope.row.quantity" placeholder="请输入数量" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" width="90" align="center">
|
||||
@@ -140,16 +144,6 @@
|
||||
<el-input v-model="scope.row.batchNo" placeholder="批次号" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单价" min-width="110" align="center">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.unitPrice" placeholder="单价" @input="recalcAmount(scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="金额" min-width="110" align="center">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.amount" placeholder="金额" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" min-width="140" align="center">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.remark" placeholder="备注" />
|
||||
@@ -170,9 +164,10 @@
|
||||
<el-descriptions-item label="类型">出库</el-descriptions-item>
|
||||
<el-descriptions-item label="业务类型">{{ detailData.order.bizType }}</el-descriptions-item>
|
||||
<el-descriptions-item label="责任人">{{ detailData.order.responsibleName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="撤回人">{{ detailData.order.revokeBy || '-' }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<div style="margin: 12px 0; text-align: right;">
|
||||
<el-button type="danger" size="small" @click="handleRevoke(detailData.order)">撤回</el-button>
|
||||
<el-button type="danger" size="small" :disabled="detailData.order.revokeFlag === '1'" @click="handleRevoke(detailData.order)">撤回</el-button>
|
||||
</div>
|
||||
<el-table :data="detailData.details || []" border style="width: 100%">
|
||||
<el-table-column label="行号" prop="lineNo" width="70" align="center" />
|
||||
@@ -200,7 +195,7 @@ import {
|
||||
listStockIoOrder,
|
||||
getStockIoOrderWithDetail,
|
||||
addStockIoOrderWithDetail,
|
||||
reverseStockIoOrder
|
||||
revokeStockIoOrder
|
||||
} from '@/api/wms/stockIoOrder'
|
||||
|
||||
export default {
|
||||
@@ -276,11 +271,19 @@ export default {
|
||||
this.ids = selection.map((r) => r.orderId)
|
||||
this.single = selection.length !== 1
|
||||
},
|
||||
handleExport() {
|
||||
this.download(
|
||||
'/gear/stockIoOrder/export',
|
||||
{
|
||||
...this.queryParams
|
||||
},
|
||||
`stockIoOrder_out_${new Date().getTime()}.xlsx`
|
||||
)
|
||||
},
|
||||
resetEdit() {
|
||||
this.editForm = {
|
||||
ioType: 'O',
|
||||
bizType: undefined,
|
||||
sourceNo: undefined,
|
||||
responsibleName: undefined,
|
||||
remark: undefined
|
||||
}
|
||||
@@ -305,15 +308,17 @@ export default {
|
||||
const target = row || (this.rows && this.rows[0])
|
||||
if (!target || !target.orderId) return
|
||||
this.$modal
|
||||
.confirm('确认撤回该出库?系统将创建一张反向单据并自动执行。')
|
||||
.confirm('确认撤回该出库单据?撤回后将标记为已撤回。')
|
||||
.then(() => {
|
||||
this.buttonLoading = true
|
||||
return reverseStockIoOrder(target.orderId, '')
|
||||
return revokeStockIoOrder(target.orderId, '')
|
||||
})
|
||||
.then((res) => {
|
||||
const newId = res.data
|
||||
this.$modal.msgSuccess('撤回成功,撤回单ID:' + newId)
|
||||
.then(() => {
|
||||
this.$modal.msgSuccess('撤回成功')
|
||||
this.getList()
|
||||
if (this.detailOpen) {
|
||||
this.detailOpen = false
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
this.buttonLoading = false
|
||||
@@ -358,7 +363,6 @@ export default {
|
||||
const hasAny =
|
||||
(d.itemId != null && String(d.itemId) !== '') ||
|
||||
(d.quantity != null && String(d.quantity) !== '') ||
|
||||
(d.unitPrice != null && String(d.unitPrice) !== '') ||
|
||||
(d.batchNo != null && String(d.batchNo) !== '') ||
|
||||
(d.remark != null && String(d.remark) !== '') ||
|
||||
(d.itemName != null && String(d.itemName) !== '')
|
||||
@@ -381,20 +385,17 @@ export default {
|
||||
.filter((d) => d && d.itemId != null && String(d.itemId) !== '' && this.toNumber(d.quantity) > 0)
|
||||
.map((d, idx) => {
|
||||
const lineNo = d.lineNo != null ? d.lineNo : idx + 1
|
||||
const unitPrice = this.toNumber(d.unitPrice)
|
||||
const quantity = this.toNumber(d.quantity)
|
||||
const amount = d.amount != null && String(d.amount) !== '' ? this.toNumber(d.amount) : unitPrice * quantity
|
||||
return {
|
||||
detailId: d.detailId,
|
||||
lineNo,
|
||||
itemType: 'material',
|
||||
itemId: d.itemId,
|
||||
materialTypeSnapshot: d._materialType,
|
||||
itemName: d.itemName,
|
||||
quantity: quantity,
|
||||
unit: d.unit,
|
||||
batchNo: d.batchNo,
|
||||
unitPrice: unitPrice,
|
||||
amount: amount,
|
||||
remark: d.remark
|
||||
}
|
||||
})
|
||||
@@ -413,8 +414,6 @@ export default {
|
||||
quantity: undefined,
|
||||
unit: undefined,
|
||||
batchNo: undefined,
|
||||
unitPrice: undefined,
|
||||
amount: undefined,
|
||||
remark: undefined
|
||||
})
|
||||
this.rebuildLineNo()
|
||||
@@ -446,8 +445,7 @@ export default {
|
||||
const r = this.editDetails[0]
|
||||
const empty =
|
||||
(r.itemId == null || String(r.itemId) === '') &&
|
||||
(r.quantity == null || String(r.quantity) === '') &&
|
||||
(r.unitPrice == null || String(r.unitPrice) === '')
|
||||
(r.quantity == null || String(r.quantity) === '')
|
||||
if (empty) {
|
||||
r.itemId = rows[0].materialId
|
||||
this.onMaterialPicked(r, rows[0])
|
||||
@@ -465,22 +463,14 @@ export default {
|
||||
onMaterialPicked(row, material) {
|
||||
if (material && material.materialName) {
|
||||
row.itemName = material.materialName
|
||||
if (material.materialType != null) {
|
||||
row._materialType = material.materialType
|
||||
}
|
||||
if (!row.unit && material.unit) {
|
||||
row.unit = material.unit
|
||||
}
|
||||
if (material.unitPrice != null && row.unitPrice == null) {
|
||||
row.unitPrice = material.unitPrice
|
||||
}
|
||||
this.recalcAmount(row)
|
||||
}
|
||||
},
|
||||
recalcAmount(row) {
|
||||
const qty = this.toNumber(row.quantity)
|
||||
const unitPrice = this.toNumber(row.unitPrice)
|
||||
if (qty > 0 || unitPrice > 0) {
|
||||
row.amount = String(unitPrice * qty)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user