物料
This commit is contained in:
@@ -46,6 +46,24 @@
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="'供应商名称'" prop="supplierName">
|
||||
<el-input
|
||||
v-model="queryParams.supplierName"
|
||||
:placeholder="'请输入供应商名称'"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="'仓库名称'" prop="warehouseId">
|
||||
<el-select v-model="queryParams.warehouseId" :placeholder="'请选择仓库'">
|
||||
<el-option
|
||||
v-for="dict in dict.type.warehouse"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="'创建时间'" prop="dateRange">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
@@ -296,14 +314,14 @@
|
||||
@keyup.enter.native="handleStockQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="批次号" prop="lotNo">
|
||||
<el-input
|
||||
v-model="stockQueryParams.lotNo"
|
||||
placeholder="请输入批次号"
|
||||
clearable
|
||||
@keyup.enter.native="handleStockQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="批次号" prop="lotNo">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="stockQueryParams.lotNo"-->
|
||||
<!-- placeholder="请输入批次号"-->
|
||||
<!-- clearable-->
|
||||
<!-- @keyup.enter.native="handleStockQuery"-->
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleStockQuery">搜索</el-button>
|
||||
@@ -313,26 +331,48 @@
|
||||
|
||||
<!-- 库存明细表格 -->
|
||||
<el-table ref="stockTable" v-loading="stockLoading" :data="stockList" @selection-change="handleStockSelectionChange" max-height="400">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column type="selection" width="55" align="center" :selectable="stockSelectable" />
|
||||
<el-table-column label="库存编码" align="center" prop="stockId" />
|
||||
<el-table-column label="货位名称" align="center" prop="cargoSpaceName" />
|
||||
<el-table-column label="批次号" align="center" prop="lotNo" />
|
||||
<el-table-column label="物料编码" align="center" prop="productId" />
|
||||
<el-table-column label="物料名称" align="center" prop="productName" />
|
||||
<el-table-column label="数量" align="center" prop="quantity" width="80" />
|
||||
<el-table-column label="规格" align="center" prop="spare1" />
|
||||
<el-table-column label="单位" align="center" prop="spare3" />
|
||||
<el-table-column label="型号" align="center" prop="spare4" />
|
||||
<el-table-column label="颜色" align="center" prop="spare5" />
|
||||
<el-table-column label="序列号" align="center" prop="spare6" />
|
||||
<el-table-column label="电压" align="center" prop="voltage" />
|
||||
<el-table-column label="功率" align="center" prop="power" />
|
||||
<el-table-column label="相位" align="center" prop="phase" />
|
||||
<el-table-column label="净重" align="center" prop="netWeight" />
|
||||
<el-table-column label="毛重" align="center" prop="grossWeight" />
|
||||
<el-table-column label="分销" align="center" prop="distribution" />
|
||||
<el-table-column label="机型" align="center" prop="model" />
|
||||
<el-table-column label="订单号" align="center" prop="orderId" />
|
||||
<el-table-column label="规格型号" align="center" prop="netWeight" />
|
||||
<el-table-column label="图号" align="center" prop="grossWeight" />
|
||||
<el-table-column label="库存数量" align="center" prop="quantity" width="80" />
|
||||
<el-table-column label="来源" align="center" prop="spare1" >
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.origin_type" :value="scope.row.spare1"/>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column label="套账" align="center" prop="spare3" >
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.account_type" :value="scope.row.spare3"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用途" align="center" prop="spare4" >
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.purpose_type" :value="scope.row.model"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="台次" align="center" prop="spare5" />
|
||||
<el-table-column label="入库单价" align="center" prop="spare6" />
|
||||
<el-table-column label="状态" align="center" prop="voltage" >
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.turnover_type" :value="scope.row.voltage"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="件次" align="center" prop="power" />
|
||||
<!-- <el-table-column label="供应商" align="center" prop="phase" />-->
|
||||
<el-table-column label="供应商" align="center" prop="inClassId" />
|
||||
<el-table-column label="管理号" align="center" prop="distribution" />
|
||||
<el-table-column label="产品质量" align="center" prop="spare8" >
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.quality_type" :value="scope.row.spare8"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="合同号" align="center" prop="orderId" />
|
||||
|
||||
</el-table>
|
||||
|
||||
@@ -419,6 +459,8 @@ export default {
|
||||
outType: null,
|
||||
customerNo: null,
|
||||
customerName: null,
|
||||
supplierName: null,
|
||||
warehouseId: null,
|
||||
productName: null,
|
||||
startDate: null,
|
||||
finishDate: null,
|
||||
@@ -459,10 +501,10 @@ export default {
|
||||
return total + (parseFloat(stock.quantity) || 0)
|
||||
}, 0)
|
||||
},
|
||||
// 计算剩余可分配数量
|
||||
// 计算剩余可分配数量(显示不为负)
|
||||
remainingQuantity() {
|
||||
const planQuantity = this.selectedDetailRows.length > 0 ? (parseFloat(this.selectedDetailRows[0].quantity) || 0) : 0
|
||||
return planQuantity - this.selectedStockQuantity
|
||||
return Math.max(planQuantity - this.selectedStockQuantity, 0)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -691,6 +733,19 @@ export default {
|
||||
getStockList() {
|
||||
this.stockLoading = true
|
||||
this.stockQueryParams.productId = this.selectedDetailRows[0].productId
|
||||
this.stockQueryParams.lotNo=this.selectedDetailRows[0].lotNo
|
||||
this.stockQueryParams.spare1 = this.selectedDetailRows[0].unit
|
||||
this.stockQueryParams.spare3 = this.selectedDetailRows[0].entryid
|
||||
this.stockQueryParams.spare4=this.selectedDetailRows[0].model
|
||||
this.stockQueryParams.spare5 = this.selectedDetailRows[0].power
|
||||
this.stockQueryParams.spare6 = this.selectedDetailRows[0].price
|
||||
this.stockQueryParams.voltage = this.selectedDetailRows[0].spec
|
||||
this.stockQueryParams.power = this.selectedDetailRows[0].phase
|
||||
this.stockQueryParams.phase = this.selectedDetailRows[0].supplierId
|
||||
this.stockQueryParams.distribution=this.selectedDetailRows[0].fid
|
||||
this.stockQueryParams.orderId = this.selectedDetailRows[0].cargoNo
|
||||
this.stockQueryParams.spare8=this.selectedDetailRows[0].voltage
|
||||
|
||||
listOut(this.stockQueryParams).then(response => {
|
||||
this.stockList = response.rows
|
||||
this.stockTotal = response.total
|
||||
@@ -723,31 +778,39 @@ export default {
|
||||
/** 库存多选框选中数据 */
|
||||
handleStockSelectionChange(selection) {
|
||||
// 计算新选中的总数量
|
||||
const newTotalQuantity = selection.reduce((total, stock) => {
|
||||
return total + (parseFloat(stock.quantity) || 0)
|
||||
}, 0)
|
||||
|
||||
// 获取计划数量
|
||||
const planQuantity = this.selectedDetailRows.length > 0 ? (parseFloat(this.selectedDetailRows[0].quantity) || 0) : 0
|
||||
|
||||
// 校验是否超过计划数量
|
||||
if (newTotalQuantity > planQuantity) {
|
||||
this.$modal.msgWarning(`选中库存数量(${newTotalQuantity})不能大于计划数量(${planQuantity})`)
|
||||
// // 恢复到之前的选择状态
|
||||
// this.$nextTick(() => {
|
||||
// // 通过表格引用来恢复选择状态
|
||||
// if (this.$refs.stockTable) {
|
||||
// this.$refs.stockTable.clearSelection()
|
||||
// this.selectedStockRows.forEach(row => {
|
||||
// this.$refs.stockTable.toggleRowSelection(row, true)
|
||||
// })
|
||||
// }
|
||||
// })
|
||||
// return
|
||||
}
|
||||
// const newTotalQuantity = selection.reduce((total, stock) => {
|
||||
// return total + (parseFloat(stock.quantity) || 0)
|
||||
// }, 0)
|
||||
//
|
||||
// // 获取计划数量
|
||||
// const planQuantity = this.selectedDetailRows.length > 0 ? (parseFloat(this.selectedDetailRows[0].quantity) || 0) : 0
|
||||
//
|
||||
// // 校验是否超过计划数量
|
||||
// if (newTotalQuantity > planQuantity) {
|
||||
// this.$modal.msgWarning(`选中库存数量(${newTotalQuantity})不能大于计划数量(${planQuantity})`)
|
||||
// // // 恢复到之前的选择状态
|
||||
// // this.$nextTick(() => {
|
||||
// // // 通过表格引用来恢复选择状态
|
||||
// // if (this.$refs.stockTable) {
|
||||
// // this.$refs.stockTable.clearSelection()
|
||||
// // this.selectedStockRows.forEach(row => {
|
||||
// // this.$refs.stockTable.toggleRowSelection(row, true)
|
||||
// // })
|
||||
// // }
|
||||
// // })
|
||||
// // return
|
||||
// }
|
||||
|
||||
this.selectedStockRows = selection
|
||||
},
|
||||
// 判断某库存行是否已选中
|
||||
isStockRowSelected(row) {
|
||||
return this.selectedStockRows && this.selectedStockRows.some(r => r.stockId === row.stockId);
|
||||
},
|
||||
// 选择列可选性:剩余可分配<=0时只允许操作已选中的行,禁用新增选择
|
||||
stockSelectable(row, index) {
|
||||
return this.isStockRowSelected(row) || this.remainingQuantity > 0;
|
||||
},
|
||||
|
||||
/** 确认分配 */
|
||||
confirmStockAllot() {
|
||||
|
||||
Reference in New Issue
Block a user