Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -67,5 +67,31 @@ export function getOutStockoutDetail(query) {
|
||||
})
|
||||
}
|
||||
|
||||
// 查询手动分配库存列表
|
||||
export function listOut(query) {
|
||||
return request({
|
||||
url: '/out/handAllotStock/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
export function manualAllot(params)
|
||||
{
|
||||
const searchParams = new URLSearchParams();
|
||||
if (Array.isArray(params.stockList)) {
|
||||
params.stockList.forEach(stock => searchParams.append('stockList', stock.stockId));
|
||||
}
|
||||
if (params.stockoutDetailId) {
|
||||
searchParams.append('stockoutDetailId', params.stockoutDetailId);
|
||||
}
|
||||
|
||||
return request({
|
||||
url: '/out/outStockout/manualAllot?' + searchParams.toString(),
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -21,25 +21,25 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="托盘条码" prop="trayCode"> <!-- 托盘条码 -->
|
||||
<el-input
|
||||
v-model="queryParams.trayCode"
|
||||
placeholder="请输入托盘条码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="托盘条码" prop="trayCode"> <!– 托盘条码 –>-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="queryParams.trayCode"-->
|
||||
<!-- placeholder="请输入托盘条码"-->
|
||||
<!-- clearable-->
|
||||
<!-- @keyup.enter.native="handleQuery"-->
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
|
||||
<el-form-item label="作业类型" prop="inOrOut"> <!-- 作业类型 -->
|
||||
<el-select v-model="queryParams.inOrOut" placeholder="请选择作业类型" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.out_job_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="作业类型" prop="inOrOut"> <!– 作业类型 –>-->
|
||||
<!-- <el-select v-model="queryParams.inOrOut" placeholder="请选择作业类型" clearable>-->
|
||||
<!-- <el-option-->
|
||||
<!-- v-for="dict in dict.type.out_job_type"-->
|
||||
<!-- :key="dict.value"-->
|
||||
<!-- :label="dict.label"-->
|
||||
<!-- :value="dict.value"-->
|
||||
<!-- />-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
|
||||
<el-form-item label="开始时间" prop="startTime"> <!-- 开始时间 -->
|
||||
<el-date-picker clearable
|
||||
@@ -59,20 +59,20 @@
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="仓库" prop="warehouseId"> <!-- 仓库 -->
|
||||
<el-select
|
||||
v-model="queryParams.warehouseId"
|
||||
placeholder="请选择仓库"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in warehouseOptions"
|
||||
:key="dict.warehouseId"
|
||||
:label="dict.warehouseName"
|
||||
:value="dict.warehouseId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="仓库" prop="warehouseId"> <!– 仓库 –>-->
|
||||
<!-- <el-select-->
|
||||
<!-- v-model="queryParams.warehouseId"-->
|
||||
<!-- placeholder="请选择仓库"-->
|
||||
<!-- clearable-->
|
||||
<!-- >-->
|
||||
<!-- <el-option-->
|
||||
<!-- v-for="dict in warehouseOptions"-->
|
||||
<!-- :key="dict.warehouseId"-->
|
||||
<!-- :label="dict.warehouseName"-->
|
||||
<!-- :value="dict.warehouseId"-->
|
||||
<!-- />-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <!-- 搜索 -->
|
||||
@@ -124,19 +124,22 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="任务号" align="left" prop="taskNo" /> <!-- 任务号 -->
|
||||
<!-- <el-table-column :label="$t('outJobManagement.customerId')" align="left" prop="customerId" /> <!– 客户ID –>-->
|
||||
<el-table-column label="托盘码" align="left" prop="trayCode" /> <!-- 托盘码 -->
|
||||
<!-- <el-table-column label="托盘码" align="left" prop="trayCode" /> <!– 托盘码 –>-->
|
||||
<!-- <el-table-column :label="$t('outJobManagement.roadwayId')" align="left" prop="roadwayId" /> <!– 巷道ID –>-->
|
||||
<el-table-column label="货位ID" align="left" prop="cargoSpaceName" /> <!-- 货位ID -->
|
||||
<el-table-column label="优先级" align="right" prop="priority" /> <!-- 优先级 -->
|
||||
<el-table-column label="执行阶段" align="left" prop="executionPhase"> <!-- 执行阶段 -->
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.execution_phase_type" :value="scope.row.executionPhase"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="货位" align="left" prop="cargoSpaceName" /> <!-- 货位ID -->
|
||||
<el-table-column label="订单号" align="left" prop="lineId" /> <!-- 结束时间 -->
|
||||
<!-- <el-table-column label="优先级" align="left" prop="priority" /> <!– 优先级 –>-->
|
||||
<!-- <el-table-column label="执行阶段" align="left" prop="executionPhase"> <!– 执行阶段 –>-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <dict-tag :options="dict.type.execution_phase_type" :value="scope.row.executionPhase"/>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
|
||||
|
||||
<el-table-column label="出口ID" align="left" prop="exitId"/> <!-- 出口ID -->
|
||||
<el-table-column label="创建时间" align="left" prop="createTime" width="180"/> <!-- 创建时间 -->
|
||||
<el-table-column label="开始时间" align="left" prop="startTime" width="180"/> <!-- 开始时间 -->
|
||||
<el-table-column label="结束时间" align="left" prop="finishTime" width="180"/> <!-- 结束时间 -->
|
||||
<el-table-column label="出口ID" align="left" prop="exitId" /> <!-- 出口ID -->
|
||||
<!-- <el-table-column :label="$t('outJobManagement.warehouseId')" align="left" prop="warehouseId" /> <!– 仓库ID –>-->
|
||||
<el-table-column label="仓库ID" align="left" prop="warehouseName" /> <!-- 仓库ID -->
|
||||
</el-table>
|
||||
@@ -154,9 +157,21 @@
|
||||
<el-table-column label="子任务ID" align="left" prop="jobDetailId" /> <!-- 子任务ID -->
|
||||
<el-table-column label="库存ID" align="left" prop="stockId" /> <!-- 库存ID -->
|
||||
<el-table-column label="子单据ID" align="left" prop="inOrOutDId" /> <!-- 子单据ID -->
|
||||
<el-table-column label="物料编码" align="left" prop="productId" /> <!-- 物料编码 -->
|
||||
<el-table-column label="物料编码" align="left" prop="extraField.materialDesc" /> <!-- 物料编码 -->
|
||||
<el-table-column label="物料编码" align="left" prop="productId" />
|
||||
<el-table-column label="物料名称" align="left" prop="productName" />
|
||||
<el-table-column label="出库数量" align="right" prop="outQuantity" /> <!-- 出库数量 -->
|
||||
<el-table-column label="批次号" align="left" prop="lotNo" />
|
||||
<el-table-column label="机型" align="left" prop="unit"/><!--机型-->
|
||||
<el-table-column label="分销" align="left" prop="spare9"/><!--分销-->
|
||||
<el-table-column label="规格" align="left" prop="spec"/><!--规格-->
|
||||
<el-table-column label="型号" align="left" prop="spare1"/><!--型号-->
|
||||
<el-table-column label="净重" align="left" prop="spare2"/><!--净重-->
|
||||
<el-table-column label="颜色" align="left" prop="spare3"/><!--颜色-->
|
||||
<el-table-column label="序列号" align="left" prop="spare4"/><!--序列号-->
|
||||
<el-table-column label="电压" align="left" prop="spare5"/><!--电压-->
|
||||
<el-table-column label="功率" align="left" prop="spare6"/><!--功率-->
|
||||
<el-table-column label="相位" align="left" prop="spare7"/><!--相位-->
|
||||
<el-table-column label="毛重" align="left" prop="spare8"/><!--毛重-->
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
|
||||
@@ -165,7 +165,8 @@
|
||||
/>
|
||||
|
||||
<!-- 子表数据 -->
|
||||
<el-table v-loading="detailLoading" :data="outStockDetailList.slice((detailQueryParams.pageNum-1)*detailQueryParams.pageSize, detailQueryParams.pageNum*detailQueryParams.pageSize)" style="margin-top: 20px;">
|
||||
<el-table v-loading="detailLoading" :data="outStockDetailList" style="margin-top: 20px;" @selection-change="handleDetailSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column :label="'出库子单编号'" align="center" prop="stockoutDetailId" /> <!-- 出库子单编号 -->
|
||||
<el-table-column :label="'品号'" align="center" prop="productId" /> <!-- 物资编码 -->
|
||||
<el-table-column :label="'品名'" align="center" prop="productName" />
|
||||
@@ -173,8 +174,8 @@
|
||||
<el-table-column :label="'序列号'" align="center" prop="printDate" /> <!--序列号-->
|
||||
<el-table-column label="订单号" align="center" prop="orderId" />
|
||||
<el-table-column :label="'计划数量'" align="center" prop="quantity" /> <!-- 计划数量 -->
|
||||
<el-table-column :label="'实际数量'" align="center" prop="assignNum" /> <!-- 实际数量 -->
|
||||
<el-table-column :label="'分配数量'" align="center" prop="allotQuantity" /> <!-- 分配数量 -->
|
||||
<el-table-column :label="'实际数量'" align="center" prop="assignNum" /> <!-- 实际数量 -->
|
||||
<el-table-column :label="'颜色'" align="center" prop="price"/><!--箱号-->
|
||||
<el-table-column :label="'单位'" align="center" prop="unit"/><!--单位-->
|
||||
<el-table-column :label="'规格'" align="center" prop="spec" /> <!--规格-->
|
||||
@@ -186,17 +187,16 @@
|
||||
<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="remark" /> <!-- 备注 -->
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="detailTotal>0"
|
||||
:total="detailTotal"
|
||||
:page.sync="detailQueryParams.pageNum"
|
||||
:limit.sync="detailQueryParams.pageSize"
|
||||
@pagination="getDetailList"
|
||||
/>
|
||||
<!-- <pagination-->
|
||||
<!-- v-show="detailTotal>0"-->
|
||||
<!-- :total="detailTotal"-->
|
||||
<!-- :page.sync="detailQueryParams.pageNum"-->
|
||||
<!-- :limit.sync="detailQueryParams.pageSize"-->
|
||||
<!-- @pagination="getDetailList"-->
|
||||
<!-- />-->
|
||||
|
||||
<!-- 审核弹窗 -->
|
||||
<el-dialog :title="'审核'" :visible.sync="auditDialogVisible" width="400px" append-to-body>
|
||||
@@ -213,15 +213,105 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitAudit">{{'确认'}}</el-button>
|
||||
<el-button @click="cancelAudit">{{'取消'}}</el-button>
|
||||
<el-button type="primary" @click="submitAudit">{{"确认"}}</el-button>
|
||||
<el-button @click="cancelAudit">{{"取消"}}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 手动分配库存明细弹窗 -->
|
||||
<el-dialog title="库存明细" :visible.sync="stockDialogVisible" width="90%" append-to-body>
|
||||
<!-- 数量统计信息 -->
|
||||
<el-row style="margin-bottom: 15px; padding: 10px; background-color: #f5f7fa; border-radius: 4px;">
|
||||
<el-col :span="8">
|
||||
<span style="font-weight: bold;">计划数量: </span>
|
||||
<span style="color: #409EFF; font-size: 16px;">{{ selectedDetailRows.length > 0 ? selectedDetailRows[0].quantity : 0 }}</span>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<span style="font-weight: bold;">已选库存数量: </span>
|
||||
<span style="color: #67C23A; font-size: 16px;">{{ selectedStockQuantity }}</span>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<span style="font-weight: bold;">剩余可分配: </span>
|
||||
<span :style="{ color: remainingQuantity >= 0 ? '#67C23A' : '#F56C6C', fontSize: '16px' }">{{ remainingQuantity }}</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 查询表单 -->
|
||||
<el-form :model="stockQueryParams" ref="stockQueryForm" size="small" :inline="true" label-width="80px">
|
||||
<el-form-item label="库存编码" prop="stockId">
|
||||
<el-input
|
||||
v-model="stockQueryParams.stockId"
|
||||
placeholder="请输入库存编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleStockQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="货位编码" prop="cargoSpaceName">
|
||||
<el-input
|
||||
v-model="stockQueryParams.cargoSpaceName"
|
||||
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>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetStockQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 库存明细表格 -->
|
||||
<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 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>
|
||||
|
||||
<pagination
|
||||
v-show="stockTotal>0"
|
||||
:total="stockTotal"
|
||||
:page.sync="stockQueryParams.pageNum"
|
||||
:limit.sync="stockQueryParams.pageSize"
|
||||
@pagination="getStockList"
|
||||
/>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="confirmStockAllot">确认分配</el-button>
|
||||
<el-button @click="cancelStockAllot">取消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listOutStockout,autoAllot } from "@/api/out/outStockout"
|
||||
import { listOutStockout,autoAllot,listOut,manualAllot} from "@/api/out/outStockout"
|
||||
import { getOutStockoutDetail,updateOutStockStatus } from "@/api/out/outStockout"
|
||||
import {listWarehouse} from "@/api/bas/warehouse";
|
||||
|
||||
@@ -244,12 +334,24 @@ export default {
|
||||
outStockDetailList: [],
|
||||
// 选中数据
|
||||
selectedRows: [],
|
||||
// 选中的子表数据
|
||||
selectedDetailRows: [],
|
||||
// 审核弹窗显示状态
|
||||
auditDialogVisible: false,
|
||||
// 审核表单数据
|
||||
auditForm: {
|
||||
exitId: null
|
||||
},
|
||||
// 库存明细弹窗显示状态
|
||||
stockDialogVisible: false,
|
||||
// 库存明细数据
|
||||
stockList: [],
|
||||
// 库存明细加载状态
|
||||
stockLoading: false,
|
||||
// 库存明细总条数
|
||||
stockTotal: 0,
|
||||
// 选中的库存数据
|
||||
selectedStockRows: [],
|
||||
// 审核表单验证规则
|
||||
auditRules: {
|
||||
exitId: [
|
||||
@@ -258,8 +360,8 @@ export default {
|
||||
},
|
||||
// 出口选项
|
||||
exitOptions: [
|
||||
{ exitId: 'G1001', exitName: 'G1001'},
|
||||
{ exitId: 'G1002', exitName: 'G1002'},
|
||||
{ exitId: '1', exitName: '一楼'},
|
||||
{ exitId: '2', exitName: '二楼'},
|
||||
|
||||
],
|
||||
|
||||
@@ -283,7 +385,7 @@ export default {
|
||||
// 子表分页参数
|
||||
detailQueryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 99,
|
||||
status:null,
|
||||
stockoutGuid:null
|
||||
|
||||
@@ -294,7 +396,31 @@ export default {
|
||||
|
||||
},
|
||||
// 子表总条数
|
||||
detailTotal: 0
|
||||
detailTotal: 0,
|
||||
// 库存查询参数
|
||||
stockQueryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
stockId: null,
|
||||
cargoSpaceId: null,
|
||||
lotNo: null,
|
||||
productId: null,
|
||||
productName: null
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 计算选中库存的总数量
|
||||
selectedStockQuantity() {
|
||||
return this.selectedStockRows.reduce((total, stock) => {
|
||||
console.log(total+ + (parseFloat(stock.quantity)))
|
||||
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
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -371,6 +497,10 @@ export default {
|
||||
handleSelectionChange(selection) {
|
||||
this.selectedRows = selection
|
||||
},
|
||||
/** 子表多选框选中数据 */
|
||||
handleDetailSelectionChange(selection) {
|
||||
this.selectedDetailRows = selection
|
||||
},
|
||||
/** 单据状态修改按钮操作 */
|
||||
handleAudit(status) {
|
||||
if (this.selectedRows.length === 0) {
|
||||
@@ -449,16 +579,41 @@ export default {
|
||||
},
|
||||
/** 手动分配按钮操作 */
|
||||
handleManualAllot() {
|
||||
if (this.selectedDetailRows.length === 0) {
|
||||
this.$modal.msgError('请选择子表数据')
|
||||
return
|
||||
}
|
||||
if (this.selectedDetailRows.length > 1) {
|
||||
this.$modal.msgError('只能选择一条子表数据进行手动分配')
|
||||
return
|
||||
}
|
||||
// 检查主表状态
|
||||
if(this.selectedRows.length >1){
|
||||
this.$modal.msgError('只能选择一条主表数据进行手动分配')
|
||||
return
|
||||
}
|
||||
if (this.selectedRows.length === 0) {
|
||||
this.$modal.msgError(this.$t('outStockoutManage.pleaseSelectData'))
|
||||
this.$modal.msgError('请先选择主表数据')
|
||||
return
|
||||
}
|
||||
const stockoutIds = this.selectedRows.map(row => row.stockoutId)
|
||||
let outstock = this.selectedRows[0]
|
||||
if (outstock.status !== "1") {
|
||||
this.$modal.msgError('单据已审核,无法手动分配')
|
||||
if (outstock.status == "1") {
|
||||
this.$modal.msgError('单据未审核,无法手动分配!')
|
||||
return
|
||||
}
|
||||
if (outstock.status != "2" && outstock.status != "3") {
|
||||
this.$modal.msgError('单据已结束,无法手动分配!')
|
||||
return
|
||||
}
|
||||
if(this.selectedDetailRows[0].allotQuantity==this.selectedDetailRows[0].quantity){
|
||||
this.$modal.msgError('该单据已分配完成,无法手动分配')
|
||||
return
|
||||
}
|
||||
|
||||
// 显示库存明细弹窗
|
||||
this.stockDialogVisible = true
|
||||
this.resetStockQuery()
|
||||
this.getStockList()
|
||||
},
|
||||
|
||||
/** 提交审核 */
|
||||
@@ -490,6 +645,121 @@ export default {
|
||||
this.currentAuditStatus = null
|
||||
},
|
||||
|
||||
/** 获取库存明细列表 */
|
||||
getStockList() {
|
||||
this.stockLoading = true
|
||||
this.stockQueryParams.productId = this.selectedDetailRows[0].productId
|
||||
listOut(this.stockQueryParams).then(response => {
|
||||
this.stockList = response.rows
|
||||
this.stockTotal = response.total
|
||||
this.stockLoading = false
|
||||
}).catch(() => {
|
||||
this.stockLoading = false
|
||||
})
|
||||
},
|
||||
|
||||
/** 库存查询按钮操作 */
|
||||
handleStockQuery() {
|
||||
this.stockQueryParams.pageNum = 1
|
||||
this.getStockList()
|
||||
},
|
||||
|
||||
/** 库存重置按钮操作 */
|
||||
resetStockQuery() {
|
||||
this.stockQueryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
stockId: null,
|
||||
cargoSpaceName: null,
|
||||
lotNo: null,
|
||||
productId: null,
|
||||
productName: null
|
||||
}
|
||||
this.$refs.stockQueryForm && this.$refs.stockQueryForm.resetFields()
|
||||
},
|
||||
|
||||
/** 库存多选框选中数据 */
|
||||
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
|
||||
}
|
||||
|
||||
this.selectedStockRows = selection
|
||||
},
|
||||
|
||||
/** 确认分配 */
|
||||
confirmStockAllot() {
|
||||
if (this.selectedStockRows.length === 0) {
|
||||
this.$modal.msgError('请选择要分配的库存')
|
||||
return
|
||||
}
|
||||
if (this.selectedDetailRows.length === 0) {
|
||||
this.$modal.msgError('请选择要分配的子表数据')
|
||||
return
|
||||
}
|
||||
|
||||
// 最终数量校验
|
||||
const planQuantity = parseFloat(this.selectedDetailRows[0].quantity) || 0
|
||||
if (this.selectedStockQuantity > planQuantity) {
|
||||
this.$modal.msgError(`选中库存数量(${this.selectedStockQuantity})不能大于计划数量(${planQuantity})`)
|
||||
return
|
||||
}
|
||||
|
||||
// 构建分配参数
|
||||
const allotParams = {
|
||||
|
||||
stockoutDetailId: this.selectedDetailRows[0].stockoutDetailId,
|
||||
stockList: this.selectedStockRows.map(stock => ({
|
||||
stockId: stock.stockId
|
||||
}))
|
||||
}
|
||||
console.log('手动分配参数:', allotParams)
|
||||
// 这里添加实际的分配API调用
|
||||
manualAllot(allotParams).then(response => {
|
||||
if(response.code=="200"){
|
||||
this.$modal.msgSuccess('分配成功')
|
||||
this.stockDialogVisible = false
|
||||
this.getList()
|
||||
this.getDetailList(this.selectedRows[0].stockoutGuid, this.selectedRows[0].status)
|
||||
}else{
|
||||
this.$modal.msgError(response.msg)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
/** 取消分配 */
|
||||
cancelStockAllot() {
|
||||
this.stockDialogVisible = false
|
||||
this.selectedStockRows = []
|
||||
// this.selectedDetailRows = []
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user