|
|
|
|
@ -166,17 +166,29 @@
|
|
|
|
|
<!-- 添加或修改退库工单对话框 -->
|
|
|
|
|
<el-dialog :title='dialog.title' v-model='dialog.visible' width='500px' append-to-body>
|
|
|
|
|
<el-form ref='returnOrderFormRef' :model='form' :rules='rules' label-width='130px'>
|
|
|
|
|
<el-form-item label='物料大类' prop='materialCategoryId'>
|
|
|
|
|
<el-select v-model='form.materialCategoryId' placeholder='请选择物料大类'>
|
|
|
|
|
<el-option v-for='item in mategoryOptions'
|
|
|
|
|
:key='item.materialCategoryId'
|
|
|
|
|
:label='item.materialCategoryName'
|
|
|
|
|
:value='item.materialCategoryId'
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label='物料名称' prop='materialId'>
|
|
|
|
|
<el-input v-model='form.materialName' placeholder='请点击检索物料' @click='handleMaterialAdd' readonly>
|
|
|
|
|
<!-- <el-form-item label='物料大类' prop='materialCategoryId'>-->
|
|
|
|
|
<!-- <el-select v-model='form.materialCategoryId' placeholder='请选择物料大类'>-->
|
|
|
|
|
<!-- <el-option v-for='item in mategoryOptions'-->
|
|
|
|
|
<!-- :key='item.materialCategoryId'-->
|
|
|
|
|
<!-- :label='item.materialCategoryName'-->
|
|
|
|
|
<!-- :value='item.materialCategoryId'-->
|
|
|
|
|
<!-- />-->
|
|
|
|
|
<!-- </el-select>-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
<!-- <el-form-item label='物料名称' prop='materialId'>-->
|
|
|
|
|
<!-- <el-input v-model='form.materialName' placeholder='请点击检索物料' @click='handleMaterialAdd' readonly>-->
|
|
|
|
|
<!-- <template #append>-->
|
|
|
|
|
<!-- <el-icon class='el-input__icon'>-->
|
|
|
|
|
<!-- <search />-->
|
|
|
|
|
<!-- </el-icon>-->
|
|
|
|
|
<!-- </template>-->
|
|
|
|
|
<!-- </el-input>-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
<!-- <el-form-item label='批次条码' prop='batchCode'>-->
|
|
|
|
|
<!-- <el-input v-model='form.batchCode' placeholder='请输入批次条码' />-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
<el-form-item label='出库单号' prop='batchCode'>
|
|
|
|
|
<el-input v-model='form.batchCode' placeholder='请点击检索出库单号' @click='handleOutstockDetailAdd' readonly>
|
|
|
|
|
<template #append>
|
|
|
|
|
<el-icon class='el-input__icon'>
|
|
|
|
|
<search />
|
|
|
|
|
@ -184,8 +196,17 @@
|
|
|
|
|
</template>
|
|
|
|
|
</el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label='批次条码' prop='batchCode'>
|
|
|
|
|
<el-input v-model='form.batchCode' placeholder='请输入批次条码' />
|
|
|
|
|
<el-form-item label='物料编码' prop='materialCode'>
|
|
|
|
|
<el-input v-model='form.materialCode' disabled/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label='物料名称' prop='materialName'>
|
|
|
|
|
<el-input v-model='form.materialName' disabled/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label='出库数量' prop='outstockQty'>
|
|
|
|
|
<el-input-number v-model='form.outstockQty' style="width: 220px;" disabled/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label='可退数量' prop='returnAmount'>
|
|
|
|
|
<el-input-number v-model='form.returnAmount' style="width: 220px;" disabled/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label='计划数量' prop='planAmount'>
|
|
|
|
|
<el-input-number v-model='form.planAmount' placeholder='请输入计划数量' style="width: 220px;"/>
|
|
|
|
|
@ -286,6 +307,19 @@
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
<!-- 添加物料信息对话框 -->
|
|
|
|
|
<el-dialog title="选择出库单号" v-model="outstockDetailOpen" width='1200px' append-to-body>
|
|
|
|
|
<SelectOutstockDetail
|
|
|
|
|
@selection="handleOutstockDetailSelection"
|
|
|
|
|
ref="outstockDetailSelectRef"
|
|
|
|
|
v-if="outstockDetailOpen"
|
|
|
|
|
></SelectOutstockDetail>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button type="primary" @click="submitOutstockDetailForm">确 定</el-button>
|
|
|
|
|
<el-button @click="outstockDetailOpen = false">取 消</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
@ -302,8 +336,11 @@ import { getBaseWarehouseList } from '@/api/wms/baseWarehouse';
|
|
|
|
|
|
|
|
|
|
import { getBaseMaterialCategoryListInWMS } from '@/api/wms/baseMaterialCategory';
|
|
|
|
|
import MaterialSelectInWMS from '@/views/mes/baseMaterialInfo/addMaterialInWMS.vue';
|
|
|
|
|
import SelectOutstockDetail from '@/views/wms/outstockDetail/selectOutstockDetail.vue';
|
|
|
|
|
import { getBaseDeviceTypeList } from '@/api/mes/baseDeviceType';
|
|
|
|
|
import { getWmsBaseLocationVoList } from '@/api/wms/baseLocation';
|
|
|
|
|
import { getOutstockDetailList } from '@/api/wms/outstockDetail';
|
|
|
|
|
import { OutstockDetailQuery } from '@/api/wms/outstockDetail/types';
|
|
|
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
const {
|
|
|
|
|
@ -330,14 +367,23 @@ const dialog = reactive<DialogOption>({
|
|
|
|
|
|
|
|
|
|
const materialOpen = ref(false);//物料选择对话框显示
|
|
|
|
|
|
|
|
|
|
const outstockDetailOpen = ref(false);
|
|
|
|
|
|
|
|
|
|
const selectedMaterial = ref(null); // 存储选中的物料完整信息
|
|
|
|
|
const selectedOutstockDetail = ref(null); // 存储选中的物料完整信息
|
|
|
|
|
|
|
|
|
|
/** 处理从MaterialSelect组件接收到的选择 */
|
|
|
|
|
const handleSelection = (row) => {
|
|
|
|
|
selectedMaterial.value = row;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 处理从MaterialSelect组件接收到的选择 */
|
|
|
|
|
const handleOutstockDetailSelection = (row) => {
|
|
|
|
|
selectedOutstockDetail.value = row;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const materialSelectRef = ref();//物料选择对话框绑定
|
|
|
|
|
const outstockDetailSelectRef = ref();
|
|
|
|
|
|
|
|
|
|
// 获取仓库
|
|
|
|
|
const getSelectBaseWarehouseList = async () => {
|
|
|
|
|
@ -527,6 +573,10 @@ const handleUpdate = async (row?: ReturnOrderVO) => {
|
|
|
|
|
|
|
|
|
|
/** 提交按钮 */
|
|
|
|
|
const submitForm = () => {
|
|
|
|
|
if (form.value.returnAmount < form.value.planAmount){
|
|
|
|
|
proxy?.$modal.msgWarning('计划数量不可大于可退数量!');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
returnOrderFormRef.value?.validate(async (valid: boolean) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
buttonLoading.value = true;
|
|
|
|
|
@ -570,6 +620,11 @@ const handleMaterialAdd = (type, index) => {
|
|
|
|
|
materialOpen.value = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 新增按钮操作 */
|
|
|
|
|
const handleOutstockDetailAdd = (type, index) => {
|
|
|
|
|
outstockDetailOpen.value = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 提交物料BOM信息按钮 */
|
|
|
|
|
const submitMaterialForm = () => {
|
|
|
|
|
selectedMaterial.value = materialSelectRef.value.tableRef.store.states.currentRow.value;
|
|
|
|
|
@ -580,6 +635,34 @@ const submitMaterialForm = () => {
|
|
|
|
|
materialOpen.value = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const submitOutstockDetailForm = async () => {
|
|
|
|
|
selectedMaterial.value = outstockDetailSelectRef.value.tableRef.store.states.currentRow.value;
|
|
|
|
|
form.value.batchCode = selectedMaterial.value.outstockCode;
|
|
|
|
|
form.value.materialId = selectedMaterial.value.materialId;
|
|
|
|
|
form.value.materialCode = selectedMaterial.value.materialCode;
|
|
|
|
|
form.value.materialName = selectedMaterial.value.materialName;
|
|
|
|
|
form.value.materialCtegories = selectedMaterial.value.materialCategories;
|
|
|
|
|
form.value.outstockQty = selectedMaterial.value.outstockQty;
|
|
|
|
|
|
|
|
|
|
const selectData: ReturnOrderQuery = {
|
|
|
|
|
batchCode: form.value.batchCode,
|
|
|
|
|
materialId: form.value.materialId,
|
|
|
|
|
pageNum: 1, // 必需属性
|
|
|
|
|
pageSize: 10 // 必需属性
|
|
|
|
|
};
|
|
|
|
|
const res = await listReturnOrder(selectData);
|
|
|
|
|
let returnAmount = 0;
|
|
|
|
|
res.rows.forEach(item => {
|
|
|
|
|
returnAmount += Number(item.planAmount);
|
|
|
|
|
})
|
|
|
|
|
console.log(returnAmount);
|
|
|
|
|
form.value.returnAmount = Number(form.value.outstockQty) - returnAmount;
|
|
|
|
|
|
|
|
|
|
// 重置选中的物料信息和关闭对话框
|
|
|
|
|
selectedOutstockDetail.value = null;
|
|
|
|
|
outstockDetailOpen.value = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
getSelectBaseWarehouseList();
|
|
|
|
|
getMaterialCategorySelect();
|
|
|
|
|
|