新增出入库主子表页面新增

master
maxw@mesnac.com 6 days ago
parent b71b68a527
commit dfd946de82

@ -8,7 +8,7 @@ import { InstockDetailVO, InstockDetailForm, InstockDetailQuery } from '@/api/wm
* @returns {*}
*/
export const listInstockDetail = (query?: InstockDetailQuery): AxiosPromise<InstockDetailVO[]> => {
export const listInstockDetail = (query) => {
return request({
url: '/wms/instockDetail/list',
method: 'get',
@ -47,7 +47,7 @@ export const getInstockDetail = (instockDetailId: string | number): AxiosPromise
* -
* @param data
*/
export const addInstockDetail = (data: InstockDetailForm) => {
export const addInstockDetail = (data) => {
return request({
url: '/wms/instockDetail',
method: 'post',
@ -73,7 +73,7 @@ export const updateInstockDetail = (data: InstockDetailForm) => {
*/
export const delInstockDetail = (instockDetailId: string | number | Array<string | number>) => {
return request({
url: '/wms/instockDetail/' + instockDetailId,
url: '/wms/instockDetail/removeInstockDetail/' + instockDetailId,
method: 'delete'
});
};

@ -57,7 +57,7 @@ export const updateOutstockDetail = (data: OutstockDetailForm) => {
*/
export const delOutstockDetail = (outstockDetailId: string | number | Array<string | number>) => {
return request({
url: '/wms/outstockDetail/' + outstockDetailId,
url: '/wms/outstockDetail/detailRemove/' + outstockDetailId,
method: 'delete'
});
};

@ -0,0 +1,686 @@
<template>
<div class="p-2">
<el-card shadow="never">
<el-form label-width="120px" label-position="right" :inline="true" :model="queryForm" class="demo-form-inline">
<el-form-item label="入库单号">
<el-input v-model="queryForm.instockCode" placeholder="输入调拨单号" clearable/>
</el-form-item>
<el-form-item label="工单类型" prop="instockType">
<el-select v-model="queryForm.instockType" placeholder="请选择工单类型(1采购订单,2生产订单,3手工,4系统生成)" clearable >
<el-option v-for="dict in wms_instock_type" :key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item label="仓库ID" prop="warehouseId">
<el-select v-model="queryForm.warehouseId" placeholder="请选择所属仓库">
<el-option
v-for="item in baseStoreList"
:key="item.warehouseId"
:label="item.warehouseName"
:value="item.warehouseId"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button :loading="parentTableLoad" type="primary" @click="query"></el-button>
<el-button @click="reset"></el-button>
</el-form-item>
</el-form>
</el-card>
<el-card style="margin-top: 8px" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="parentTableAdd"></el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="Edit" :disabled="ids.length !== 1" @click="parentTableUpdate()">
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="ids.length < 1" @click="parentTableDelete()">
</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button type="warning" plain icon="Download" @click="handleExport"></el-button>-->
<!-- </el-col>-->
<right-toolbar v-model:showSearch="showSearch" :columns="columns" :search="true"
@queryTable="getParentTable"></right-toolbar>
</el-row>
</template>
<el-table v-loading="parentTableLoad" :data="parentTableData" style="width: 100%" highlight-current-row
@current-change="parentTableCellClick"
@selection-change="selectionChange" ref="parentTableRef">
<el-table-column type="selection" width="55"/>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="入库单 主键" align="center" prop="instockId"/>
<el-table-column label="入库单号" align="center" prop="instockCode"/>
<el-table-column label="物料大类" align="center" prop="materialCategories">
<template #default="scope">
<dict-tag :options="material_mategories" :value="scope.row.materialCategories"/>
</template>
</el-table-column>
<el-table-column label="工单类型" align="center" prop="instockType">
<template #default="scope">
<dict-tag :options="wms_instock_type" :value="scope.row.instockType"/>
</template>
</el-table-column>
<el-table-column label="订单编号" align="center" prop="orderNo"/>
<el-table-column label="审核人" align="center" prop="auditBy"/>
<el-table-column label="审核时间" align="center" prop="auditTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.auditTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="审核状态" align="center" prop="auditStatus">
<template #default="scope">
<dict-tag :options="approve_status" :value="scope.row.auditStatus"/>
</template>
</el-table-column>
<el-table-column label="审核意见" align="center" prop="auditComments"/>
<el-table-column label="仓库ID" align="center" prop="warehouseCode"/>
<!-- <el-table-column label="入库方式" align="center" prop="inMethod">
<template #default="scope">
<dict-tag :options="wms_allocate_way" :value="scope.row.inMethod"/>
</template>
</el-table-column> -->
<el-table-column label="操作" fixed="right" width="200">
<template #default="scope">
<!-- <el-button size="small" @click.stop="viewDetails(scope.row)">-->
<!-- 查看-->
<!-- </el-button>-->
<el-button size="small" @click.stop="parentTableUpdate(scope.row)">
修改
</el-button>
<el-button
size="small"
type="danger"
@click.stop="parentTableDelete(scope.row)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="parentTableTotal > 0" :total="parentTableTotal" v-model:page="queryForm.pageNum"
v-model:limit="queryForm.pageSize" @pagination="getParentTable"/>
</el-card>
<el-card style="margin-top: 8px" shadow="never">
<el-table :data="childrenTableData" style="width: 100%" v-loading="childrenTableLoad">
<el-table-column label="物料编码" align="center" prop="materialCode"/>
<el-table-column label="物料名称" align="center" prop="materialName"/>
<el-table-column label="入库数量" align="center" prop="instockQty"/>
<el-table-column label="已分包数量" align="center" prop="printedNum" />
<el-table-column label="物料规格" align="center" prop="materialSpe"/>
<el-table-column label="计量单位名称" align="center" prop="unitName"/>
<el-table-column label="是否有条码" align="center" prop="codeYesNo">
<template #default="scope">
<dict-tag :options="wms_barcode_if" :value="scope.row.codeYesNo"/>
</template>
</el-table-column>
<el-table-column label="物料大类" align="center" prop="materialCategories">
<template #default="scope">
<dict-tag :options="material_mategories" :value="scope.row.materialCategories"/>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="200">
<template #default="scope">
<el-button size="small" @click="childrenTableUpdate( scope.row)">
打印
</el-button>
<el-button
size="small"
type="danger"
@click="childrenTableUDelete(scope.row)"
>
删除
</el-button>
<!-- <el-tooltip content="打印" placement="top">
<el-button type="primary" @click="handlePrint(scope.row)"></el-button>
</el-tooltip> -->
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="100%" fullscreen>
<el-card shadow="never">
<el-form :model="dialogForm" :inline="true" label-width="120px" :disabled="isView">
<el-form-item label="物料大类" prop="materialCategories">
<el-select v-model="dialogForm.materialCategories" placeholder="请选择物料大类" @change="setMaterialList">
<el-option
v-for="dict in material_mategories"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="工单类型" prop="instockType">
<el-select v-model="dialogForm.instockType" placeholder="请选择工单类型(1采购订单,2生产订单,3手工,4系统生成)">
<el-option
v-for="dict in wms_instock_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="订单编号" prop="orderNo">
<el-input v-model="form.orderNo" placeholder="请输入订单编号" />
</el-form-item> -->
<el-form-item label="审核人" prop="auditBy">
<el-select v-model="dialogForm.auditBy" placeholder="请选择审核人">
<el-option
v-for="item in userList"
:key="item.userId"
:label="item.userName"
:value="item.userName"
/>
</el-select>
</el-form-item>
<el-form-item label="仓库ID" prop="warehouseId">
<el-select v-model="dialogForm.warehouseId" placeholder="请选择所属仓库">
<el-option
v-for="item in baseStoreList"
:key="item.warehouseId"
:label="item.warehouseName"
:value="item.warehouseId"
></el-option>
</el-select>
</el-form-item>
</el-form>
</el-card>
<el-card style="margin-top: 8px" shadow="never">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="addDialogTableCell"></el-button>
</el-col>
</el-row>
<el-table :data="dialogtable" style="width: 100%">
<el-table-column label="字段1" prop="date" v-if="false">
<template #default="scope">
<el-select
v-model="scope.row.date"
placeholder="Select"
>
<el-option
v-for="i in material_mategories"
:label="i.materialName"
:value="i.materialId"
:key="i.materialId"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="物料名称" prop="materialId">
<template #default="scope">
<el-select
v-model="scope.row.materialId"
placeholder="选择物料"
style="width: 240px"
>
<el-option
v-for="i in materialList"
:label="i.materialCode"
:value="i.materialId"
:key="i.materialId"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="入库数量" prop="instockQty">
<template #default="scope">
<el-input v-model="scope.row.instockQty" placeholder="请输入入库数量" />
</template>
</el-table-column>
<el-table-column label="有无条码" prop="codeYesNo">
<template #default="scope">
<el-select
v-model="scope.row.codeYesNo"
placeholder="选择有无条码"
style="width: 240px"
>
<el-option
v-for="i in wms_barcode_if"
:label="i.label"
:value="i.value"
:key="i.value"
/>
</el-select>
</template>
</el-table-column>
<!-- <el-table-column label="已包数量" prop="printedNum">
<template #default="scope">
<el-input v-model="scope.row.printedNum" placeholder="请输入已包数量" />
</template>
</el-table-column> -->
<!-- <el-table-column label="分包数量" prop="printNum">
<template #default="scope">
<el-input v-model="scope.row.printNum" placeholder="请输入分包数量" />
</template>
</el-table-column>
<el-table-column label="打印数量" prop="barcodeNum">
<template #default="scope">
<el-input v-model="scope.row.barcodeNum" placeholder="请输入打印数量" />
</template> -->
<!-- </el-table-column> -->
<!-- <el-table-column label="erp同步状态" prop="erpSynchronousStatus">-->
<!-- <template #default="scope">-->
<!-- <el-select-->
<!-- v-model="scope.row.erpSynchronousStatus"-->
<!-- placeholder="选择erp同步状态"-->
<!-- >-->
<!-- <el-option-->
<!-- label="1"-->
<!-- value="1"-->
<!-- />-->
<!-- <el-option-->
<!-- label="2"-->
<!-- value="2"-->
<!-- />-->
<!-- </el-select>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
</el-card>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">关闭</el-button>
<el-button type="primary" @click="dialogSubmit">
确定
</el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="parentTableInfoVisible" title="修改父表格" width="40%">
<el-form :model="parentTableInfoForm" label-width="120px">
<el-form-item label="物料大类" prop="materialCategories">
<el-select v-model="parentTableInfoForm.materialCategories" placeholder="请选择物料大类">
<el-option
v-for="dict in material_mategories"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="工单类型" prop="instockType">
<el-select v-model="parentTableInfoForm.instockType" placeholder="请选择工单类型(1采购订单,2生产订单,3手工,4系统生成)">
<el-option
v-for="dict in wms_instock_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="订单编号" prop="orderNo">
<el-input v-model="form.orderNo" placeholder="请输入订单编号" />
</el-form-item> -->
<el-form-item label="审核人" prop="auditBy">
<el-select v-model="parentTableInfoForm.auditBy" placeholder="请选择审核人">
<el-option
v-for="item in userList"
:key="item.userId"
:label="item.userName"
:value="item.userName"
/>
</el-select>
</el-form-item>
<el-form-item label="仓库ID" prop="warehouseId">
<el-select v-model="parentTableInfoForm.warehouseCode" placeholder="请选择所属仓库">
<el-option
v-for="item in baseStoreList"
:key="item.warehouseId"
:label="item.warehouseName"
:value="item.warehouseId"
></el-option>
</el-select>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="parentTableInfoVisible = false">关闭</el-button>
<el-button type="primary" @click="parentTableInfoSubmit">
确定
</el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="childrenTableInfoVisible" title="条码生成" width="40%">
<el-form :model="childrenTableInfoForm" label-width="120px">
<el-form-item label="物料" prop="materialId">
<el-select v-model="childrenTableInfoForm.materialId" placeholder="请选择物料">
<el-option
v-for="item in materialList"
:key="item.materialId"
:label="item.materialCode"
:value="item.materialId"
/>
</el-select>
</el-form-item>
<el-form-item label="入库数量" prop="instockQty">
<el-input v-model="childrenTableInfoForm.instockQty" placeholder="请输入入库数量" />
</el-form-item>
<el-form-item label="有无条码" prop="codeYesNo">
<el-radio-group v-model="childrenTableInfoForm.codeYesNo">
<el-radio
v-for="dict in wms_barcode_if"
:key="dict.value"
:value="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="已包数量" prop="printedNum">
<el-input v-model="childrenTableInfoForm.printedNum" placeholder="" />
</el-form-item>
<el-form-item label="分包数量" prop="printNum">
<el-input v-model="childrenTableInfoForm.printNum" placeholder="请输入分包数量" />
</el-form-item>
<el-form-item label="打印数量" prop="barcodeNum">
<el-input v-model="childrenTableInfoForm.barcodeNum" placeholder="请输入打印条码数量" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="childrenTableInfoVisible = false">关闭</el-button>
<el-button type="primary" @click="submitForm">
确定
</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="Linkage" lang="ts">
import { listInstockOrder, getInstockOrder, delInstockOrder, addInstockOrder, updateInstockOrder } from '@/api/wms/instockOrder';
import { InstockOrderVO, InstockOrderQuery, InstockOrderForm } from '@/api/wms/instockOrder/types';
import {reactive} from 'vue'
import {ElMessage, ElMessageBox} from 'element-plus'
import {getBaseWarehouseList} from "@/api/wms/baseWarehouse";
import {UserVO} from "@/api/system/user/types";
import {listUser} from "@/api/system/user";
import { listInstockDetail, getInstockDetail, delInstockDetail, addInstockDetail, updateInstockDetail, getMaterialListVo } from '@/api/wms/instockDetail';
import { InstockDetailVO, InstockDetailQuery, InstockDetailForm } from '@/api/wms/instockDetail/types';
import {
getMaterialList
} from '@/api/wms/linkage'
const {proxy} = getCurrentInstance() as ComponentInternalInstance;
const {
wms_barcode_if,
wms_instock_type,
approve_status,
erp_synchronous_status,
material_mategories,
mes_material_categories,
wms_allocate_status,
wms_allocate_create,
wms_allocate_way
} = toRefs<any>(proxy?.useDict('wms_barcode_if', 'wms_instock_type', 'approve_status', 'erp_synchronous_status', 'material_mategories', 'mes_material_categories', 'wms_allocate_status', 'wms_allocate_create', 'wms_allocate_way'));
interface User {
date: string
name: string
address: string
}
const parentTableTotal = ref(0)
const dialogVisible = ref(false)
const parentTableInfoVisible = ref(false)
const childrenTableInfoVisible = ref(false)
// const childrenTableInfoSubmit = ref(false)
const updateDialog = ref(false)
const dialogTitle = ref('添加')
const dialogForm = ref({})
const parentTableInfoForm = ref({})
const childrenTableInfoForm = ref({})
const queryForm = ref({
instockCode: '',
materialCategories: '',
warehouseId: '',
instockType: '',
pageNum: 1,
pageSize: 10
})
const parentTableRef = ref()
const parentTableData = ref([])
const ids = ref([])
const childrenTableData = ref([])
const dialogtable = ref([])
const baseStoreList = ref([]);
const userList = ref([]);
const materialList = ref([]);
const parentTableLoad = ref(false)
const childrenTableLoad = ref(false)
const isView = ref(false)
const partntTableSelectCell = ref({})
//
getBaseWarehouseList().then(e => {
baseStoreList.value = e.data
})
listUser().then(e => {
userList.value = e.rows;
})
/** 提交按钮 */
const submitForm = () => {
updateInstockDetail(childrenTableInfoForm.value).finally(() => childrenTableInfoVisible.value = false);
}
//
const getParentTable = async () => {
parentTableLoad.value = true
await listInstockOrder(queryForm.value).then(async (e) => {
parentTableLoad.value = false
parentTableData.value = e.rows
parentTableTotal.value = e.total
if (e.rows.length > 0) {
parentTableRef.value.setCurrentRow(e.rows[0])
console.log(e.rows[0].instockId)
await getChildrenTable({instockId: e.rows[0].instockId})
} else {
childrenTableData.value = []
}
})
}
//
const getChildrenTable = async (form) => {
childrenTableLoad.value = true
console.log(form)
await listInstockDetail(form).then(e => {
childrenTableLoad.value = false
childrenTableData.value = e.rows
parentTableTotal.value = e.total
})
}
getParentTable()
/** 打印按钮操作 */
const handlePrint = async (row?: InstockDetailVO) => {
reset();
const _instockDetailId = row?.instockDetailId || ids.value[0]
const res = await getInstockDetail(_instockDetailId);
Object.assign(childrenTableInfoForm.value, res.data);
}
//
const query = async () => {
ids.value = []
parentTableRef.value?.clearSelection()
await getParentTable()
}
const reset = () => {
queryForm.value = {
instockId: ''
}
}
//
const parentTableCellClick = async (e) => {
partntTableSelectCell.value = e
await getChildrenTable({instockId: e.instockId})
}
//
const selectionChange = (e) => {
ids.value = e.map(v => v.instockId)
}
//
const viewDetails = (e) => {
isView.value = true
dialogVisible.value = true
viewAllocateOrder(e.aoId).then(v => {
dialogForm.value = v.data
})
}
//
const parentTableAdd = () => {
dialogVisible.value = true
dialogForm.value = {}
dialogtable.value = []
}
//
const parentTableUpdate = async (e) => {
let id = ref(null)
if (e) {
id.value = e.instockId
} else {
id.value = ids.value?.[0]
}
if (!id.value) return
parentTableInfoForm.value = (await getInstockOrder(id.value)).data
parentTableInfoVisible.value = true
updateDialog.value = true
}
//
const parentTableDelete = async (e) => {
const delList = ref([])
if (e) {
delList.value = [e.instockId]
} else {
delList.value = ids.value
}
ElMessageBox.confirm(
'确定要删除这些数据吗?',
'Warning',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(async () => {
await delInstockOrder(delList.value.toString()).then(e => {
ElMessage({
type: 'success',
message: '删除完成',
})
getParentTable()
})
})
.catch(() => {
ElMessage({
type: 'info',
message: '取消',
})
})
}
//
const setMaterialList = (materialCategories) => {
getMaterialList({materialCategories}).then(e => {
materialList.value = e.data
})
}
//
const addDialogTableCell = () => {
dialogtable.value.push({})
}
//
const dialogSubmit = () => {
addInstockOrder(dialogForm.value).then(e => {
addInstockDetail(dialogtable.value.map(item => {
return {...item, instockCode: e.data.instockCode,instockId: e.data.instockId}
}
)
).then(v => {
dialogVisible.value = false
getParentTable()
})
})
}
const parentTableInfoSubmit = () =>{
updateInstockOrder(parentTableInfoForm.value).then(e=>{
ElMessage({
type: 'success',
message: '修改完成',
})
parentTableInfoVisible.value = false
getParentTable()
})
}
//
const childrenTableUpdate = async (e) => {
childrenTableInfoForm.value = (await getInstockDetail(e.instockDetailId)).data
childrenTableInfoVisible.value = true
}
//
const childrenTableUDelete = (e) => {
ElMessageBox.confirm(
'确定要删除这些数据吗?',
'Warning',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(async () => {
await delInstockDetail(e.instockDetailId).then(async (e) => {
ElMessage({
type: 'success',
message: '删除完成',
})
await getChildrenTable({instockId: partntTableSelectCell.value.instockId})
})
})
.catch(() => {
ElMessage({
type: 'info',
message: '取消',
})
})
}
</script>
<style>
.demo-form-inline .el-input {
--el-input-width: 220px;
}
.demo-form-inline .el-select {
--el-select-width: 220px;
}
</style>

@ -63,7 +63,7 @@
</template>
</el-table-column>
<el-table-column label="审核意见" align="center" prop="auditComments"/>
<el-table-column label="是否创建出库单" align="center" prop="createOut">
<!-- <el-table-column label="是否创建出库单" align="center" prop="createOut">
<template #default="scope">
<dict-tag :options="wms_allocate_create" :value="scope.row.createOut"/>
</template>
@ -74,7 +74,7 @@
<dict-tag :options="wms_allocate_create" :value="scope.row.createIn"/>
</template>
</el-table-column>
<el-table-column label="入库单号" align="center" prop="inCode"/>
<el-table-column label="入库单号" align="center" prop="inCode"/> -->
<el-table-column label="入库方式" align="center" prop="inMethod">
<template #default="scope">
<dict-tag :options="wms_allocate_way" :value="scope.row.inMethod"/>
@ -106,9 +106,13 @@
<el-table :data="childrenTableData" style="width: 100%" v-loading="childrenTableLoad">
<el-table-column label="调拨子表主键" align="center" prop="aoDId" v-if="false"/>
<el-table-column label="调拨单号" align="center" prop="allocateCode"/>
<el-table-column label="物料id" align="center" prop="materialId"/>
<el-table-column label="物料" align="center" prop="materialCode"/>
<el-table-column label="调拨数量" align="center" prop="allocateOrderQty"/>
<el-table-column label="erp同步状态" align="center" prop="erpSynchronousStatus"/>
<el-table-column label="erp同步状态" align="center" prop="erpSynchronousStatus">
<template #default="scope">
<dict-tag :options="erp_synchronous_status" :value="scope.row.erpSynchronousStatus"/>
</template>
</el-table-column>
<el-table-column label="erp同步数量" align="center" prop="erpSynchronousQty"/>
<el-table-column label="操作" fixed="right" width="200">
<template #default="scope">
@ -138,7 +142,7 @@
@change="setMaterialList"
>
<el-option
v-for="i in mes_material_categories"
v-for="i in material_mategories"
:label="i.label"
:value="i.value"
:key="i.value"
@ -175,6 +179,16 @@
/>
</el-select>
</el-form-item>
<el-form-item label="入库方式" prop="inMethod">
<el-select v-model="dialogForm.inMethod" placeholder="请选择入库方式">
<el-option
v-for="item in wms_allocate_way"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form>
</el-card>
<el-card style="margin-top: 8px" shadow="never">
@ -191,7 +205,7 @@
placeholder="Select"
>
<el-option
v-for="i in mes_material_categories"
v-for="i in material_mategories"
:label="i.materialName"
:value="i.materialId"
:key="i.materialId"
@ -208,7 +222,7 @@
>
<el-option
v-for="i in materialList"
:label="i.materialName"
:label="i.materialCode"
:value="i.materialId"
:key="i.materialId"
/>
@ -258,10 +272,11 @@
<el-select
v-model="parentTableInfoForm.materialCategories"
placeholder="选择物料大类"
:disabled="updateDialog"
@change="setMaterialList"
>
<el-option
v-for="i in mes_material_categories"
v-for="i in material_mategories"
:label="i.label"
:value="i.value"
:key="i.value"
@ -269,7 +284,7 @@
</el-select>
</el-form-item>
<el-form-item label="出库仓库" prop="planWarehouseId">
<el-select v-model="parentTableInfoForm.planWarehouseId" placeholder="请选择所属仓库">
<el-select v-model="parentTableInfoForm.planWarehouseId" placeholder="请选择所属仓库" :disabled="updateDialog">
<el-option
v-for="item in baseStoreList"
:key="item.warehouseId"
@ -278,8 +293,8 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item label="入库仓库" prop="targetWarehouseId">
<el-select v-model="parentTableInfoForm.targetWarehouseId" placeholder="请选择所属仓库">
<el-form-item label="入库仓库" prop="targetWarehouseId" >
<el-select v-model="parentTableInfoForm.targetWarehouseId" placeholder="请选择所属仓库" :disabled="updateDialog">
<el-option
v-for="item in baseStoreList"
:key="item.warehouseId"
@ -318,7 +333,7 @@
@change="setMaterialList"
>
<el-option
v-for="i in mes_material_categories"
v-for="i in material_mategories"
:label="i.label"
:value="i.value"
:key="i.value"
@ -388,12 +403,13 @@ import {listUser} from "@/api/system/user";
const {proxy} = getCurrentInstance() as ComponentInternalInstance;
const {
approve_status,
erp_synchronous_status,
material_mategories,
mes_material_categories,
wms_allocate_status,
wms_allocate_create,
wms_allocate_way
} = toRefs<any>(proxy?.useDict('approve_status', 'material_mategories', 'mes_material_categories', 'wms_allocate_status', 'wms_allocate_create', 'wms_allocate_way'));
} = toRefs<any>(proxy?.useDict('approve_status', 'erp_synchronous_status', 'material_mategories', 'mes_material_categories', 'wms_allocate_status', 'wms_allocate_create', 'wms_allocate_way'));
interface User {
@ -406,6 +422,7 @@ const parentTableTotal = ref(0)
const dialogVisible = ref(false)
const parentTableInfoVisible = ref(false)
const childrenTableInfoSubmit = ref(false)
const updateDialog = ref(false)
const dialogTitle = ref('添加')
const dialogForm = ref({})
const parentTableInfoForm = ref({})
@ -513,6 +530,7 @@ const parentTableUpdate = async (e) => {
if (!id.value) return
parentTableInfoForm.value = (await viewAllocateOrder(id.value)).data
parentTableInfoVisible.value = true
updateDialog.value = true
}
//
const parentTableDelete = async (e) => {

@ -0,0 +1,680 @@
<template>
<div class="p-2">
<el-card shadow="never">
<el-form label-width="120px" label-position="right" :inline="true" :model="queryForm" class="demo-form-inline">
<el-form-item label="仓库ID" prop="warehouseId">
<el-select v-model="queryForm.warehouseId" placeholder="请选择所属仓库">
<el-option
v-for="item in baseStoreList"
:key="item.warehouseId"
:label="item.warehouseName"
:value="item.warehouseId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="出库单号" prop="outstockCode">
<el-input v-model="queryForm.outstockCode" placeholder="请输入出库单号" clearable/>
</el-form-item>
</el-form>
</el-card>
<el-card style="margin-top: 8px" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="parentTableAdd"></el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="Edit" :disabled="ids.length !== 1" @click="parentTableUpdate()">
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="ids.length < 1" @click="parentTableDelete()">
</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button type="warning" plain icon="Download" @click="handleExport"></el-button>-->
<!-- </el-col>-->
<right-toolbar v-model:showSearch="showSearch" :columns="columns" :search="true"
@queryTable="getParentTable"></right-toolbar>
</el-row>
</template>
<el-table v-loading="parentTableLoad" :data="parentTableData" style="width: 100%" highlight-current-row
@current-change="parentTableCellClick"
@selection-change="selectionChange" ref="parentTableRef">
<el-table-column type="selection" width="55"/>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="仓库ID" align="center" prop="warehouseCode"/>
<el-table-column label="出库单号" align="center" prop="outstockCode"/>
<el-table-column label="出库类型" align="center" prop="outstockType">
<template #default="scope">
<dict-tag :options="wms_out_type" :value="scope.row.outstockType"/>
</template>
</el-table-column>
<el-table-column label="物料大类" align="center" prop="materialCategories">
<template #default="scope">
<dict-tag :options="material_mategories" :value="scope.row.materialCategories"/>
</template>
</el-table-column>
<el-table-column label="工单类型" align="center" prop="orderType">
<template #default="scope">
<dict-tag :options="wms_instock_type" :value="scope.row.orderType"/>
</template>
</el-table-column>
<el-table-column label="订单编号" align="center" prop="orderNo"/>
<el-table-column label="审核人" align="center" prop="auditBy"/>
<el-table-column label="审核时间" align="center" prop="auditTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.auditTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="审核状态" align="center" prop="auditStatus">
<template #default="scope">
<dict-tag :options="approve_status" :value="scope.row.auditStatus"/>
</template>
</el-table-column>
<el-table-column label="审核意见" align="center" prop="auditComments"/>
<!-- <el-table-column label="入库方式" align="center" prop="inMethod">
<template #default="scope">
<dict-tag :options="wms_allocate_way" :value="scope.row.inMethod"/>
</template>
</el-table-column> -->
<el-table-column label="操作" fixed="right" width="200">
<template #default="scope">
<!-- <el-button size="small" @click.stop="viewDetails(scope.row)">-->
<!-- 查看-->
<!-- </el-button>-->
<el-button size="small" @click.stop="parentTableUpdate(scope.row)">
修改
</el-button>
<el-button
size="small"
type="danger"
@click.stop="parentTableDelete(scope.row)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="parentTableTotal > 0" :total="parentTableTotal" v-model:page="queryForm.pageNum"
v-model:limit="queryForm.pageSize" @pagination="getParentTable"/>
</el-card>
<el-card style="margin-top: 8px" shadow="never">
<el-table :data="childrenTableData" style="width: 100%" v-loading="childrenTableLoad">
<el-table-column label="出库单号" align="center" prop="outstockCode"/>
<!-- <el-table-column label="出库单 主键" align="center" prop="outstockId" v-if="columns[2].visible"/> -->
<el-table-column label="物料" align="center" prop="materialCode"/>
<el-table-column label="出库数量" align="center" prop="outstockQty"/>
<el-table-column label="物料大类" align="center" prop="materialCategories">
<template #default="scope">
<dict-tag :options="material_mategories" :value="scope.row.materialCategories"/>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="200">
<template #default="scope">
<!-- <el-button size="small" @click="childrenTableUpdate( scope.row)">
打印
</el-button> -->
<el-button
size="small"
type="danger"
@click="childrenTableUDelete(scope.row)"
>
删除
</el-button>
<!-- <el-tooltip content="打印" placement="top">
<el-button type="primary" @click="handlePrint(scope.row)"></el-button>
</el-tooltip> -->
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="100%" fullscreen>
<el-card shadow="never">
<el-form :model="dialogForm" :inline="true" label-width="120px" :disabled="isView">
<el-form-item label="仓库ID" prop="warehouseId">
<el-select v-model="dialogForm.warehouseId" placeholder="请选择所属仓库">
<el-option
v-for="item in baseStoreList"
:key="item.warehouseId"
:label="item.warehouseName"
:value="item.warehouseId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="出库类型" prop="outstockType">
<el-select v-model="dialogForm.outstockType" placeholder="请选择出库类型">
<el-option
v-for="dict in wms_out_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="物料大类" prop="materialCategories">
<el-select v-model="dialogForm.materialCategories" placeholder="请选择物料大类" @change="setMaterialList">
<el-option
v-for="dict in material_mategories"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="工单类型" prop="orderType">
<el-select v-model="dialogForm.orderType" placeholder="请选择工单类型(字典1销售订单,2生产订单,3手工,4系统生成)">
<el-option
v-for="dict in wms_instock_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="审核人" prop="auditBy">
<el-select v-model="dialogForm.auditBy" placeholder="请选择审核人">
<el-option
v-for="item in userList"
:key="item.userId"
:label="item.userName"
:value="item.userName"
/>
</el-select>
</el-form-item>
</el-form>
</el-card>
<el-card style="margin-top: 8px" shadow="never">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="addDialogTableCell"></el-button>
</el-col>
</el-row>
<el-table :data="dialogtable" style="width: 100%">
<el-table-column label="字段1" prop="date" v-if="false">
<template #default="scope">
<el-select
v-model="scope.row.date"
placeholder="Select"
>
<el-option
v-for="i in material_mategories"
:label="i.materialName"
:value="i.materialId"
:key="i.materialId"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="物料名称" prop="materialId">
<template #default="scope">
<el-select
v-model="scope.row.materialId"
placeholder="选择物料"
style="width: 240px"
>
<el-option
v-for="i in materialList"
:label="i.materialCode"
:value="i.materialId"
:key="i.materialId"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="出库数量" prop="outstockQty">
<template #default="scope">
<el-input v-model="scope.row.outstockQty" placeholder="请输入出库数量" />
</template>
</el-table-column>
<!-- <el-table-column label="已包数量" prop="printedNum">
<template #default="scope">
<el-input v-model="scope.row.printedNum" placeholder="请输入已包数量" />
</template>
</el-table-column> -->
<!-- <el-table-column label="分包数量" prop="printNum">
<template #default="scope">
<el-input v-model="scope.row.printNum" placeholder="请输入分包数量" />
</template>
</el-table-column>
<el-table-column label="打印数量" prop="barcodeNum">
<template #default="scope">
<el-input v-model="scope.row.barcodeNum" placeholder="请输入打印数量" />
</template> -->
<!-- </el-table-column> -->
<!-- <el-table-column label="erp同步状态" prop="erpSynchronousStatus">-->
<!-- <template #default="scope">-->
<!-- <el-select-->
<!-- v-model="scope.row.erpSynchronousStatus"-->
<!-- placeholder="选择erp同步状态"-->
<!-- >-->
<!-- <el-option-->
<!-- label="1"-->
<!-- value="1"-->
<!-- />-->
<!-- <el-option-->
<!-- label="2"-->
<!-- value="2"-->
<!-- />-->
<!-- </el-select>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
</el-card>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">关闭</el-button>
<el-button type="primary" @click="dialogSubmit">
确定
</el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="parentTableInfoVisible" title="修改父表格" width="40%">
<el-form :model="parentTableInfoForm" label-width="120px">
<el-form-item label="仓库ID" prop="warehouseId">
<el-select v-model="parentTableInfoForm.warehouseId" placeholder="请选择所属仓库">
<el-option
v-for="item in baseStoreList"
:key="item.warehouseId"
:label="item.warehouseName"
:value="item.warehouseId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="出库类型" prop="outstockType">
<el-select v-model="parentTableInfoForm.outstockType" placeholder="请选择出库类型">
<el-option
v-for="dict in wms_out_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="物料大类" prop="materialCategories">
<el-select v-model="parentTableInfoForm.materialCategories" placeholder="请选择物料大类">
<el-option
v-for="dict in material_mategories"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="工单类型" prop="orderType">
<el-select v-model="parentTableInfoForm.orderType" placeholder="请选择工单类型(字典1销售订单,2生产订单,3手工,4系统生成)">
<el-option
v-for="dict in wms_instock_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="审核人" prop="auditBy">
<el-select v-model="parentTableInfoForm.auditBy" placeholder="请选择审核人">
<el-option
v-for="item in userList"
:key="item.userId"
:label="item.userName"
:value="item.userName"
/>
</el-select>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="parentTableInfoVisible = false">关闭</el-button>
<el-button type="primary" @click="parentTableInfoSubmit">
确定
</el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="childrenTableInfoVisible" title="条码生成" width="40%">
<el-form :model="childrenTableInfoForm" label-width="120px">
<el-form-item label="物料" prop="materialId">
<el-select v-model="childrenTableInfoForm.materialId" placeholder="请选择物料">
<el-option
v-for="item in materialList"
:key="item.materialId"
:label="item.materialCode"
:value="item.materialId"
/>
</el-select>
</el-form-item>
<el-form-item label="入库数量" prop="instockQty">
<el-input v-model="childrenTableInfoForm.instockQty" placeholder="请输入入库数量" />
</el-form-item>
<el-form-item label="有无条码" prop="codeYesNo">
<el-radio-group v-model="childrenTableInfoForm.codeYesNo">
<el-radio
v-for="dict in wms_barcode_if"
:key="dict.value"
:value="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="已包数量" prop="printedNum">
<el-input v-model="childrenTableInfoForm.printedNum" placeholder="" />
</el-form-item>
<el-form-item label="分包数量" prop="printNum">
<el-input v-model="childrenTableInfoForm.printNum" placeholder="请输入分包数量" />
</el-form-item>
<el-form-item label="打印数量" prop="barcodeNum">
<el-input v-model="childrenTableInfoForm.barcodeNum" placeholder="请输入打印条码数量" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="childrenTableInfoVisible = false">关闭</el-button>
<el-button type="primary" @click="submitForm">
确定
</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="Linkage" lang="ts">
import { listOutstockOrder, getOutstockOrder, delOutstockOrder, addOutstockOrder, updateOutstockOrder } from '@/api/wms/outstockOrder';
import { OutstockOrderVO, OutstockOrderQuery, OutstockOrderForm } from '@/api/wms/outstockOrder/types';
import {reactive} from 'vue'
import {ElMessage, ElMessageBox} from 'element-plus'
import {getBaseWarehouseList} from "@/api/wms/baseWarehouse";
import {UserVO} from "@/api/system/user/types";
import {listUser} from "@/api/system/user";
import { listOutstockDetail, getOutstockDetail, delOutstockDetail, addOutstockDetail, updateOutstockDetail } from '@/api/wms/outstockDetail';
import { OutstockDetailVO, OutstockDetailQuery, OutstockDetailForm } from '@/api/wms/outstockDetail/types';
import { getMaterialListVo, getMaterailCount } from '@/api/wms/instockDetail';
import {
getMaterialList
} from '@/api/wms/linkage'
const {proxy} = getCurrentInstance() as ComponentInternalInstance;
const {
wms_out_type,
wms_barcode_if,
wms_instock_type,
approve_status,
erp_synchronous_status,
material_mategories,
mes_material_categories,
wms_allocate_status,
wms_allocate_create,
wms_allocate_way
} = toRefs<any>(proxy?.useDict('wms_out_type', 'wms_barcode_if', 'wms_instock_type', 'approve_status', 'erp_synchronous_status', 'material_mategories', 'mes_material_categories', 'wms_allocate_status', 'wms_allocate_create', 'wms_allocate_way'));
interface User {
date: string
name: string
address: string
}
const parentTableTotal = ref(0)
const dialogVisible = ref(false)
const parentTableInfoVisible = ref(false)
const childrenTableInfoVisible = ref(false)
// const childrenTableInfoSubmit = ref(false)
const updateDialog = ref(false)
const dialogTitle = ref('添加')
const dialogForm = ref({})
const parentTableInfoForm = ref({})
const childrenTableInfoForm = ref({})
const queryForm = ref({
outstockCode: '',
materialCategories: '',
warehouseId: '',
pageNum: 1,
pageSize: 10
})
const parentTableRef = ref()
const parentTableData = ref([])
const ids = ref([])
const childrenTableData = ref([])
const dialogtable = ref([])
const baseStoreList = ref([]);
const userList = ref([]);
const materialList = ref([]);
const parentTableLoad = ref(false)
const childrenTableLoad = ref(false)
const isView = ref(false)
const partntTableSelectCell = ref({})
/** 查询出库单大类下物料数量接口 */
const getMaterialCount = async () => {
const materialId = form.value.materialId
console.log(materialId)
const res = await getMaterailCount({'materialId':materialId});
console.log(res.data);
form.value.stockQty = res.data;
console.log(form.stockQty)
}
//
getBaseWarehouseList().then(e => {
baseStoreList.value = e.data
})
listUser().then(e => {
userList.value = e.rows;
})
/** 提交按钮 */
const submitForm = () => {
updateInstockDetail(childrenTableInfoForm.value).finally(() => childrenTableInfoVisible.value = false);
}
//
const getParentTable = async () => {
parentTableLoad.value = true
await listOutstockOrder(queryForm.value).then(async (e) => {
parentTableLoad.value = false
parentTableData.value = e.rows
parentTableTotal.value = e.total
if (e.rows.length > 0) {
parentTableRef.value.setCurrentRow(e.rows[0])
await getChildrenTable({outstockId: e.rows[0].outstockId})
} else {
childrenTableData.value = []
}
})
}
//
const getChildrenTable = async (form) => {
childrenTableLoad.value = true
console.log(form)
await listOutstockDetail(form).then(e => {
childrenTableLoad.value = false
childrenTableData.value = e.rows
parentTableTotal.value = e.total
})
}
getParentTable()
/** 打印按钮操作 */
const handlePrint = async (row?: InstockDetailVO) => {
reset();
const _instockDetailId = row?.instockDetailId || ids.value[0]
const res = await getInstockDetail(_instockDetailId);
Object.assign(childrenTableInfoForm.value, res.data);
}
//
const query = async () => {
ids.value = []
parentTableRef.value?.clearSelection()
await getParentTable()
}
const reset = () => {
queryForm.value = {
instockId: ''
}
}
//
const parentTableCellClick = async (e) => {
partntTableSelectCell.value = e
await getChildrenTable({outstockId: e.outstockId})
}
//
const selectionChange = (e) => {
ids.value = e.map(v => v.outstockId)
}
//
const viewDetails = (e) => {
isView.value = true
dialogVisible.value = true
viewAllocateOrder(e.aoId).then(v => {
dialogForm.value = v.data
})
}
//
const parentTableAdd = () => {
dialogVisible.value = true
dialogForm.value = {}
dialogtable.value = []
}
//
const parentTableUpdate = async (e) => {
let id = ref(null)
if (e) {
id.value = e.outstockId
} else {
id.value = ids.value?.[0]
}
if (!id.value) return
parentTableInfoForm.value = (await getOutstockOrder(id.value)).data
parentTableInfoVisible.value = true
updateDialog.value = true
}
//
const parentTableDelete = async (e) => {
const delList = ref([])
if (e) {
delList.value = [e.outstockId]
} else {
delList.value = ids.value
}
ElMessageBox.confirm(
'确定要删除这些数据吗?',
'Warning',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(async () => {
await delOutstockOrder(delList.value.toString()).then(e => {
ElMessage({
type: 'success',
message: '删除完成',
})
getParentTable()
})
})
.catch(() => {
ElMessage({
type: 'info',
message: '取消',
})
})
}
//
const setMaterialList = (materialCategories) => {
getMaterialList({materialCategories}).then(e => {
materialList.value = e.data
})
}
//
const addDialogTableCell = () => {
dialogtable.value.push({})
}
//
const dialogSubmit = () => {
addOutstockOrder(dialogForm.value).then(e => {
addOutstockDetail(dialogtable.value.map(item => {
return {...item, outstockCode: e.data.outstockCode,outstockId: e.data.outstockId}
}
)
).then(v => {
dialogVisible.value = false
getParentTable()
})
})
}
const parentTableInfoSubmit = () =>{
updateOutstockOrder(parentTableInfoForm.value).then(e=>{
ElMessage({
type: 'success',
message: '修改完成',
})
parentTableInfoVisible.value = false
getParentTable()
})
}
//
const childrenTableUpdate = async (e) => {
childrenTableInfoForm.value = (await getInstockDetail(e.instockDetailId)).data
childrenTableInfoVisible.value = true
}
//
const childrenTableUDelete = (e) => {
ElMessageBox.confirm(
'确定要删除这些数据吗?',
'Warning',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(async () => {
await delOutstockDetail(e.outstockDetailId).then(async (e) => {
ElMessage({
type: 'success',
message: '删除完成',
})
await getChildrenTable({outstockId: partntTableSelectCell.value.outstockId})
})
})
.catch(() => {
ElMessage({
type: 'info',
message: '取消',
})
})
}
</script>
<style>
.demo-form-inline .el-input {
--el-input-width: 220px;
}
.demo-form-inline .el-select {
--el-select-width: 220px;
}
</style>
Loading…
Cancel
Save