|
|
|
|
@ -32,11 +32,11 @@
|
|
|
|
|
<el-option v-for="dict in wms_out_bill_status" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="仓库" prop="warehouseId">
|
|
|
|
|
<el-select v-model="queryParams.warehouseId" placeholder="请选择仓库" clearable filterable>
|
|
|
|
|
<el-option v-for="item in warehouseInfoList" :key="item.warehouseId" :label="item.warehouseName" :value="item.warehouseId" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<!--<el-form-item label="仓库" prop="warehouseId">-->
|
|
|
|
|
<!-- <el-select v-model="queryParams.warehouseId" placeholder="请选择仓库" clearable filterable>-->
|
|
|
|
|
<!-- <el-option v-for="item in warehouseInfoList" :key="item.warehouseId" :label="item.warehouseName" :value="item.warehouseId" />-->
|
|
|
|
|
<!-- </el-select>-->
|
|
|
|
|
<!--</el-form-item>-->
|
|
|
|
|
<el-form-item label="创建时间" style="width: 308px">
|
|
|
|
|
<!-- <el-date-picker clearable v-model="queryParams.createTime" type="date" value-format="YYYY-MM-DD" placeholder="请选择创建时间" />-->
|
|
|
|
|
<el-date-picker
|
|
|
|
|
@ -154,7 +154,7 @@
|
|
|
|
|
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
|
|
|
|
|
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width" width="141">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-tooltip content="修改" placement="top">
|
|
|
|
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['wms:outStockBill:edit']"></el-button>
|
|
|
|
|
@ -186,10 +186,7 @@
|
|
|
|
|
<el-dialog :title="dialog.title" v-model="dialog.visible" width="1200px" append-to-body>
|
|
|
|
|
<el-form ref="outStockBillFormRef" :model="form" :rules="rules" label-width="120px">
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<!-- <el-form-item label="出库单号" prop="outStockCode">-->
|
|
|
|
|
<!-- <el-input v-model="form.outStockCode" placeholder="请输入出库单号" />-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
<!--<el-col :span="12">
|
|
|
|
|
<el-form-item label="仓库" prop="warehouseId">
|
|
|
|
|
<el-select v-model="form.warehouseId" placeholder="请选择仓库" filterable :disabled="selectInventorys.length > 0">
|
|
|
|
|
<el-option
|
|
|
|
|
@ -200,7 +197,7 @@
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-col>-->
|
|
|
|
|
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="出库单类型" prop="outStockType">
|
|
|
|
|
@ -209,6 +206,11 @@
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="出库说明" prop="directions">
|
|
|
|
|
<el-input v-model="form.directions" type="textarea" :rows="1" placeholder="请输入出库说明" style="width: 100%" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
|
@ -248,10 +250,6 @@
|
|
|
|
|
<!-- <el-form-item label="关联单号" prop="inventoryAmount">-->
|
|
|
|
|
<!-- <el-input v-model="form.inventoryAmount" placeholder="请输入关联单号" />-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
|
|
|
|
|
<el-form-item label="出库说明" prop="directions">
|
|
|
|
|
<el-input v-model="form.directions" type="textarea" :rows="3" placeholder="请输入出库说明" style="width: 100%" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
@ -299,7 +297,7 @@
|
|
|
|
|
</el-table>
|
|
|
|
|
</div>
|
|
|
|
|
</el-card>
|
|
|
|
|
<wms-inventory-select ref="inventorySelectRef" :multiple="true" :warehouse-id="form.warehouseId" @confirmCallBack="handleInventorySelect" />
|
|
|
|
|
<wms-inventory-select ref="inventorySelectRef" :multiple="true" @confirmCallBack="handleInventorySelect" />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
@ -339,7 +337,15 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup name="OutStockBill" lang="ts">
|
|
|
|
|
import { addOutStockBill, deliverOutStockBill, delOutStockBill, getOutStockBill, listOutStockBill, updateOutStockBill } from '@/api/wms/outStockBill';
|
|
|
|
|
import {
|
|
|
|
|
addOutStockBill,
|
|
|
|
|
deliverOutStockBill,
|
|
|
|
|
delOutStockBill,
|
|
|
|
|
getOutStockBill,
|
|
|
|
|
listOutStockBill,
|
|
|
|
|
updateOutStockBill,
|
|
|
|
|
updateOutStockBillProject
|
|
|
|
|
} from '@/api/wms/outStockBill';
|
|
|
|
|
import { OutStockBillForm, OutStockBillQuery, OutStockBillVO } from '@/api/wms/outStockBill/types';
|
|
|
|
|
import { getErpProjectInfoList } from '@/api/oa/erp/projectInfo';
|
|
|
|
|
import { getCrmCustomerInfoList } from '@/api/oa/crm/customerInfo';
|
|
|
|
|
@ -405,7 +411,7 @@ const columns = ref<FieldOption[]>([
|
|
|
|
|
{ key: 16, label: `创建人`, visible: false },
|
|
|
|
|
{ key: 17, label: `创建时间`, visible: true },
|
|
|
|
|
{ key: 18, label: `更新人`, visible: false },
|
|
|
|
|
{ key: 19, label: `更新时间`, visible: false }
|
|
|
|
|
{ key: 19, label: `更新时间`, visible: true }
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
const initFormData: OutStockBillForm = {
|
|
|
|
|
@ -439,9 +445,9 @@ const data = reactive<PageData<OutStockBillForm, OutStockBillQuery>>({
|
|
|
|
|
},
|
|
|
|
|
rules: {
|
|
|
|
|
outStockBillId: [{ required: true, message: '出库单ID不能为空', trigger: 'blur' }],
|
|
|
|
|
warehouseId: [{ required: true, message: '请选择仓库', trigger: 'blur' }],
|
|
|
|
|
outStockType: [{ required: true, message: '请选择出库单类型', trigger: 'blur' }],
|
|
|
|
|
projectId: [{ required: true, message: '请选择项目', trigger: 'blur' }]
|
|
|
|
|
// warehouseId: [{ required: true, message: '请选择仓库', trigger: 'blur' }],
|
|
|
|
|
outStockType: [{ required: true, message: '请选择出库单类型', trigger: 'blur' }]
|
|
|
|
|
// projectId: [{ required: true, message: '请选择项目', trigger: 'blur' }]
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@ -498,17 +504,22 @@ const getWarehouseName = (warehouseId) => {
|
|
|
|
|
};
|
|
|
|
|
/** 打开库存选择器 */
|
|
|
|
|
const openInventorySelect = () => {
|
|
|
|
|
if (!form.value.warehouseId) {
|
|
|
|
|
ElMessage.warning('请先选择仓库');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
inventorySelectRef.value.warehouseId = form.value.warehouseId;
|
|
|
|
|
// if (!form.value.warehouseId) {
|
|
|
|
|
// ElMessage.warning('请先选择仓库');
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// inventorySelectRef.value.warehouseId = form.value.warehouseId;
|
|
|
|
|
inventorySelectRef.value.open();
|
|
|
|
|
};
|
|
|
|
|
/** 处理库存选择器确认选择 */
|
|
|
|
|
const handleInventorySelect = (selectedInventorys) => {
|
|
|
|
|
selectInventorys.value = selectedInventorys;
|
|
|
|
|
console.log(selectedInventorys);
|
|
|
|
|
selectedInventorys.forEach((newInventory) => {
|
|
|
|
|
// 检查是否已存在相同的库存(根据inventoryDetailsId判断)
|
|
|
|
|
const exists = selectInventorys.value.some((existingInventory) => existingInventory.inventoryDetailsId === newInventory.inventoryDetailsId);
|
|
|
|
|
if (!exists) {
|
|
|
|
|
selectInventorys.value.push(newInventory);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
/** 删除选中的出库明细 */
|
|
|
|
|
const removeOutDetail = (index) => {
|
|
|
|
|
@ -597,16 +608,18 @@ const handleUpdate = async (row?: OutStockBillVO) => {
|
|
|
|
|
const _outStockBillId = row?.outStockBillId || ids.value[0];
|
|
|
|
|
const res = await getOutStockBill(_outStockBillId);
|
|
|
|
|
Object.assign(form.value, res.data);
|
|
|
|
|
const chiildRes = await getWmsOutStockDetailsList({ outStockBillId: _outStockBillId });
|
|
|
|
|
selectInventorys.value = chiildRes.data || [];
|
|
|
|
|
dialog.visible = true;
|
|
|
|
|
dialog.title = '修改出库单';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 补录 */
|
|
|
|
|
const handleProjectAdd = async (row?: OutStockBillVO) => {
|
|
|
|
|
// if (row.projectId) {
|
|
|
|
|
// ElMessage.warning('出库项目已维护');
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
if (row.projectId) {
|
|
|
|
|
ElMessage.warning('出库项目已维护');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
reset();
|
|
|
|
|
const _outStockBillId = row?.outStockBillId || ids.value[0];
|
|
|
|
|
@ -618,8 +631,15 @@ const handleProjectAdd = async (row?: OutStockBillVO) => {
|
|
|
|
|
/** 提交添加项目表单 */
|
|
|
|
|
const submitAddProjectForm = () => {
|
|
|
|
|
outStockBillFormRef.value?.validate(async (valid: boolean) => {
|
|
|
|
|
if (valid && form.value.outStockBillId) {
|
|
|
|
|
await updateOutStockBill(form.value).finally(() => (buttonLoading.value = false));
|
|
|
|
|
buttonLoading.value = true;
|
|
|
|
|
if (valid) {
|
|
|
|
|
await updateOutStockBillProject({
|
|
|
|
|
outStockBillId: form.value.outStockBillId,
|
|
|
|
|
projectId: form.value.projectId
|
|
|
|
|
}).finally(() => (buttonLoading.value = false));
|
|
|
|
|
proxy?.$modal.msgSuccess('操作成功');
|
|
|
|
|
addProjectDialog.visible = false;
|
|
|
|
|
await getList();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
@ -638,26 +658,27 @@ const submitForm = () => {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
buttonLoading.value = true;
|
|
|
|
|
const submitFlowData = {
|
|
|
|
|
...form.value,
|
|
|
|
|
outStockDetailsList: selectInventorys.value.map((item) => ({
|
|
|
|
|
warehouseId: item.warehouseId,
|
|
|
|
|
materielId: item.materielId,
|
|
|
|
|
batchNumber: item.batchNumber,
|
|
|
|
|
// unitPrice: item.unitPrice,
|
|
|
|
|
outStockAmount: item.outStockAmount,
|
|
|
|
|
unitName: item.unitName,
|
|
|
|
|
// totalPrice: item.totalPrice,
|
|
|
|
|
inProjectId: item.projectId,
|
|
|
|
|
outProjectId: form.value.projectId,
|
|
|
|
|
inventoryDetailsId: item.inventoryDetailsId,
|
|
|
|
|
oldInventoryAmount: item.inventoryAmount
|
|
|
|
|
}))
|
|
|
|
|
};
|
|
|
|
|
console.log(submitFlowData.outStockDetailsList);
|
|
|
|
|
if (form.value.outStockBillId) {
|
|
|
|
|
ElMessage.error('暂不允许修改');
|
|
|
|
|
// await updateOutStockBill(form.value).finally(() => (buttonLoading.value = false));
|
|
|
|
|
// ElMessage.error('暂不允许修改');
|
|
|
|
|
await updateOutStockBill(submitFlowData).finally(() => (buttonLoading.value = false));
|
|
|
|
|
} else {
|
|
|
|
|
const submitFlowData = {
|
|
|
|
|
...form.value,
|
|
|
|
|
outStockDetailsList: selectInventorys.value.map((item) => ({
|
|
|
|
|
warehouseId: form.value.warehouseId,
|
|
|
|
|
materielId: item.materielId,
|
|
|
|
|
batchNumber: item.batchNumber,
|
|
|
|
|
// unitPrice: item.unitPrice,
|
|
|
|
|
outStockAmount: item.outStockAmount,
|
|
|
|
|
unitName: item.unitName,
|
|
|
|
|
// totalPrice: item.totalPrice,
|
|
|
|
|
inProjectId: item.projectId,
|
|
|
|
|
outProjectId: form.value.projectId,
|
|
|
|
|
inventoryDetailsId: item.inventoryDetailsId,
|
|
|
|
|
oldInventoryAmount: item.inventoryAmount
|
|
|
|
|
}))
|
|
|
|
|
};
|
|
|
|
|
await addOutStockBill(submitFlowData).finally(() => (buttonLoading.value = false));
|
|
|
|
|
}
|
|
|
|
|
proxy?.$modal.msgSuccess('操作成功');
|
|
|
|
|
|