change(wms): 修改WMS多个页面的物料选择对话框功能

- 在 instockOrderCopy 和 linkage 组件中添加物料选择对话框
- 实现物料编码点击检索功能,替换原有的直接选择方式
- 新增 MaterialSelectInWMS 组件用于展示和选择物料信息
master
zch 4 months ago
parent fa8a4248a7
commit 6db8164116

@ -0,0 +1,501 @@
<template>
<div class="p-2">
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
<el-form-item label="物料编码" prop="materialCode">
<el-input v-model="queryParams.materialCode" placeholder="请输入物料编码" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="物料大类" prop="materialCategories">
<el-select v-model="queryParams.materialCategories" placeholder="请选择物料大类" clearable >
<el-option v-for="dict in mes_material_categories" :key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"></el-button>
<el-button icon="Refresh" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card shadow="never">
<el-table v-loading="loading"
:data="baseMaterialInfoList"
ref="tableRef"
@selection-change="handleSelectionChange"
@row-click="handleRowClick"
highlight-current-row
>
<!-- <el-table-column type="selection" width="55" align="center" />-->
<!-- <el-table-column label="主键标识" align="center" prop="materialId" v-if="columns[0].visible"/>-->
<!-- <el-table-column label="租户编号" align="center" prop="tenantId" v-if="columns[1].visible"/>-->
<el-table-column label="ERP信息" align="center" prop="erpId" v-if="columns[0].visible"/>
<el-table-column label="物料编码" align="center" prop="materialCode" v-if="columns[1].visible" width="100"/>
<el-table-column label="旧物料编码" align="center" prop="oldMaterialCode" v-if="columns[2].visible" width="100"/>
<el-table-column label="物料名称" align="center" prop="materialName" v-if="columns[3].visible" width="150"/>
<el-table-column label="物料类型ID" align="center" prop="materialTypeId" v-if="columns[4].visible"/>
<el-table-column label="物料大类" align="center" prop="materialCategories" v-if="columns[5].visible">
<template #default="scope">
<dict-tag :options="mes_material_categories" :value="scope.row.materialCategories"/>
</template>
</el-table-column>
<el-table-column label="物料小类" align="center" prop="materialSubclass" v-if="columns[6].visible"/>
<el-table-column label="批次标识" align="center" prop="batchFlag" v-if="columns[7].visible">
<template #default="scope">
<dict-tag :options="mes_batch_flag" :value="scope.row.batchFlag"/>
</template>
</el-table-column>
<el-table-column label="小批次数量" align="center" prop="batchAmount" v-if="columns[8].visible"/>
<el-table-column label="计量单位ID" align="center" prop="materialUnitId" v-if="columns[9].visible"/>
<el-table-column label="计量单位名称" align="center" prop="materialUnit" v-if="columns[10].visible" width="120"/>
<el-table-column label="物料组" align="center" prop="materialMatkl" v-if="columns[11].visible"/>
<el-table-column label="物料规格" align="center" prop="materialSpec" v-if="columns[12].visible"/>
<el-table-column label="净重" align="center" prop="netWeight" v-if="columns[13].visible"/>
<el-table-column label="毛重" align="center" prop="grossWeight" v-if="columns[14].visible"/>
<el-table-column label="绑定标识" align="center" prop="alwaysFlag" v-if="columns[15].visible">
<template #default="scope">
<dict-tag :options="always_flag" :value="scope.row.alwaysFlag"/>
</template>
</el-table-column>
<el-table-column label="所属工厂" align="center" prop="factoryName" v-if="columns[16].visible"/>
<el-table-column label="创建组织" align="center" prop="createOrgId" v-if="columns[17].visible"/>
<el-table-column label="使用组织" align="center" prop="useOrgId" v-if="columns[18].visible"/>
<el-table-column label="所属产线" align="center" prop="prodLineId" v-if="columns[19].visible"/>
<el-table-column label="激活标识" align="center" prop="activeFlag" v-if="columns[20].visible">
<template #default="scope">
<dict-tag :options="active_flag" :value="scope.row.activeFlag"/>
</template>
</el-table-column>
<el-table-column label="删除标识" align="center" prop="deletedFlag" v-if="columns[21].visible">
<template #default="scope">
<dict-tag :options="deleted_flag" :value="scope.row.deletedFlag"/>
</template>
</el-table-column>
<el-table-column label="采购计价单位" align="center" prop="purchasePriceUnitId" v-if="columns[22].visible"/>
<el-table-column label="审核日期" align="center" prop="approveDate" width="180" v-if="columns[23].visible">
<template #default="scope">
<span>{{ parseTime(scope.row.approveDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="erp最后更新日期" align="center" prop="erpModifyDate" width="180" v-if="columns[24].visible">
<template #default="scope">
<span>{{ parseTime(scope.row.erpModifyDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="最大库存数量" align="center" prop="maxStockAmount" v-if="columns[25].visible"/>
<el-table-column label="最小库存数量" align="center" prop="minStockAmount" v-if="columns[26].visible"/>
<el-table-column label="安全库存数量" align="center" prop="safeStockAmount" v-if="columns[27].visible"/>
<el-table-column label="申请标识" align="center" prop="applyFlag" v-if="columns[28].visible">
<template #default="scope">
<dict-tag :options="apply_flag" :value="scope.row.applyFlag"/>
</template>
</el-table-column>
<el-table-column label="物料分类" align="center" prop="materialClassfication" v-if="columns[29].visible">
<template #default="scope">
<dict-tag :options="material_classfication" :value="scope.row.materialClassfication"/>
</template>
</el-table-column>
<el-table-column label="自动出库标识" align="center" prop="autoOutstockFlag" v-if="columns[30].visible">
<template #default="scope">
<dict-tag :options="auto_outstock_flag" :value="scope.row.autoOutstockFlag"/>
</template>
</el-table-column>
<el-table-column label="辅料标识" align="center" prop="accessoriesFlag" v-if="columns[31].visible">
<template #default="scope">
<dict-tag :options="mes_accessories_flag" :value="scope.row.accessoriesFlag"/>
</template>
</el-table-column>
<el-table-column label="低值易耗品标识(1是 0否)" align="center" prop="lowValueConsumableFlag" v-if="columns[32].visible">
<template #default="scope">
<dict-tag :options="mes_low_value_consumable_flag" :value="scope.row.lowValueConsumableFlag"/>
</template>
</el-table-column>
<el-table-column label="品牌" align="center" prop="brand" v-if="columns[33].visible"/>
<el-table-column label="层级" align="center" prop="plyrating" v-if="columns[34].visible"/>
<el-table-column label="花纹" align="center" prop="pattern" v-if="columns[35].visible"/>
<el-table-column label="速度级别" align="center" prop="speedLevel" v-if="columns[36].visible"/>
<el-table-column label="负荷载重" align="center" prop="load" v-if="columns[37].visible"/>
<el-table-column label="轮胎标记" align="center" prop="tireMarkings" v-if="columns[38].visible">
<template #default="scope">
<dict-tag :options="tire_markings" :value="scope.row.tireMarkings"/>
</template>
</el-table-column>
<el-table-column label="最小停放时间" align="center" prop="minParkingTime" v-if="columns[39].visible"/>
<el-table-column label="最大停放时间" align="center" prop="maxParkingTime" v-if="columns[40].visible"/>
<el-table-column label="标准重量" align="center" prop="standardWeight" v-if="columns[41].visible"/>
<el-table-column label="标准重量上限" align="center" prop="weightUpperLimit" v-if="columns[42].visible"/>
<el-table-column label="标准重量下限" align="center" prop="weightLowerLimit" v-if="columns[43].visible"/>
<el-table-column label="内胎标记" align="center" prop="innerTubeFlag" v-if="columns[44].visible">
<template #default="scope">
<dict-tag :options="inner_tube_flag" :value="scope.row.innerTubeFlag"/>
</template>
</el-table-column>
<el-table-column label="销售类型" align="center" prop="saleType" v-if="columns[45].visible">
<template #default="scope">
<dict-tag :options="sale_type" :value="scope.row.saleType"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" v-if="columns[46].visible"/>
<!-- <el-table-column label="创建部门" align="center" prop="createDept" v-if="columns[49].visible"/>
<el-table-column label="创建人" align="center" prop="createBy" v-if="columns[50].visible"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180" v-if="columns[51].visible">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="更新人" align="center" prop="updateBy" v-if="columns[52].visible"/>
<el-table-column label="更新时间" align="center" prop="updateTime" width="180" v-if="columns[53].visible">
<template #default="scope">
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>-->
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card>
</div>
</template>
<script setup name="BaseMaterialInfo" lang="ts">
import { listBaseMaterialInfo, getBaseMaterialInfo, delBaseMaterialInfo, addBaseMaterialInfo, updateBaseMaterialInfo } from '@/api/mes/baseMaterialInfo';
import { BaseMaterialInfoVO, BaseMaterialInfoQuery, BaseMaterialInfoForm } from '@/api/mes/baseMaterialInfo/types';
import { getFactoryList } from "@/api/mes/baseFactoryInfo";
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { apply_flag, inner_tube_flag,
mes_material_categories, always_flag, mes_accessories_flag,
auto_outstock_flag, mes_batch_flag, active_flag, sale_type, deleted_flag, tire_markings,
material_classfication, mes_low_value_consumable_flag } = toRefs<any>(proxy?.useDict('apply_flag', 'inner_tube_flag', 'mes_material_categories', 'always_flag', 'mes_accessories_flag', 'auto_outstock_flag', 'mes_batch_flag', 'active_flag', 'sale_type', 'deleted_flag', 'tire_markings', 'material_classfication', 'mes_low_value_consumable_flag'));
const baseMaterialInfoList = ref<BaseMaterialInfoVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const dateRangeApproveDate = ref<[DateModelType, DateModelType]>(['', '']);
const queryFormRef = ref<ElFormInstance>();
const baseMaterialInfoFormRef = ref<ElFormInstance>();
const selectedRow = ref({});
const tableRef = ref()
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
//
const columns = ref<FieldOption[]>([
/* { key: 0, label: ``, visible: true },
{ key: 1, label: `租户编号`, visible: true },*/
{ key: 0, label: `ERP信息`, visible: false },
{ key: 1, label: `物料编码`, visible: true },
{ key: 2, label: `旧物料编码`, visible: true },
{ key: 3, label: `物料名称`, visible: true },
{ key: 4, label: `物料类型ID`, visible: false },
{ key: 5, label: `物料大类`, visible: true },
{ key: 6, label: `物料小类`, visible: true },
{ key: 7, label: `批次标识`, visible: false },
{ key: 8, label: `小批次数量`, visible: false },
{ key: 9, label: `计量单位ID`, visible: false },
{ key: 10, label: `计量单位名称`, visible: true },
{ key: 11, label: `物料组`, visible: false },
{ key: 12, label: `物料规格`, visible: true },
{ key: 13, label: `净重`, visible: false },
{ key: 14, label: `毛重`, visible: false },
{ key: 15, label: `绑定标识`, visible: false },
{ key: 16, label: `所属工厂`, visible: false },
{ key: 17, label: `创建组织`, visible: false },
{ key: 18, label: `使用组织`, visible: false },
{ key: 19, label: `所属产线`, visible: false },
{ key: 20, label: `激活标识`, visible: false },
{ key: 21, label: `删除标识`, visible: false },
{ key: 22, label: `采购计价单位`, visible: false },
{ key: 23, label: `审核日期`, visible: false },
{ key: 24, label: `erp最后更新日期`, visible: false },
{ key: 25, label: `最大库存数量`, visible: false },
{ key: 26, label: `最小库存数量`, visible: false },
{ key: 27, label: `安全库存数量`, visible: false },
{ key: 28, label: `申请标识`, visible: false },
{ key: 29, label: `物料分类`, visible: false },
{ key: 30, label: `自动出库标识`, visible: false },
{ key: 31, label: `辅料标识`, visible: false },
{ key: 32, label: `低值易耗品标识`, visible: false },
{ key: 33, label: `品牌`, visible: true },
{ key: 34, label: `层级`, visible: true },
{ key: 35, label: `花纹`, visible: true },
{ key: 36, label: `速度级别`, visible: true },
{ key: 37, label: `负荷载重`, visible: true },
{ key: 38, label: `轮胎标记`, visible: true },
{ key: 39, label: `最小停放时间`, visible: false },
{ key: 40, label: `最大停放时间`, visible: false },
{ key: 41, label: `标准重量`, visible: false },
{ key: 42, label: `标准重量上限`, visible: false },
{ key: 43, label: `标准重量下限`, visible: false },
{ key: 44, label: `内胎标记`, visible: false },
{ key: 45, label: `销售类型`, visible: false },
{ key: 46, label: `备注`, visible: false },
/* { key: 49, label: ``, visible: true },
{ key: 50, label: `创建人`, visible: true },
{ key: 51, label: `创建时间`, visible: true },
{ key: 52, label: `更新人`, visible: true },
{ key: 53, label: `更新时间`, visible: true },*/
]);
const initFormData: BaseMaterialInfoForm = {
materialId: undefined,
erpId: undefined,
materialCode: undefined,
oldMaterialCode: undefined,
materialName: undefined,
materialTypeId: undefined,
materialCategories: undefined,
materialSubclass: undefined,
batchFlag: undefined,
batchAmount: undefined,
materialUnitId: undefined,
materialUnit: undefined,
materialMatkl: undefined,
materialSpec: undefined,
netWeight: undefined,
grossWeight: undefined,
alwaysFlag: undefined,
factoryId: undefined,
createOrgId: undefined,
useOrgId: undefined,
prodLineId: undefined,
activeFlag: '1',
deletedFlag: undefined,
purchasePriceUnitId: undefined,
approveDate: undefined,
erpModifyDate: undefined,
maxStockAmount: undefined,
minStockAmount: undefined,
safeStockAmount: undefined,
applyFlag: undefined,
materialClassfication: undefined,
autoOutstockFlag: undefined,
accessoriesFlag: undefined,
lowValueConsumableFlag: undefined,
brand: undefined,
plyrating: undefined,
pattern: undefined,
speedLevel: undefined,
load: undefined,
tireMarkings: undefined,
minParkingTime: undefined,
maxParkingTime: undefined,
standardWeight: undefined,
weightUpperLimit: undefined,
weightLowerLimit: undefined,
innerTubeFlag: undefined,
saleType: undefined,
remark: undefined,
}
const data = reactive<PageData<BaseMaterialInfoForm, BaseMaterialInfoQuery>>({
form: {...initFormData},
queryParams: {
pageNum: 1,
pageSize: 10,
materialId: undefined,
erpId: undefined,
materialCode: undefined,
oldMaterialCode: undefined,
materialName: undefined,
materialTypeId: undefined,
materialCategories: undefined,
materialSubclass: undefined,
batchFlag: undefined,
batchAmount: undefined,
materialUnitId: undefined,
materialUnit: undefined,
materialMatkl: undefined,
materialSpec: undefined,
netWeight: undefined,
grossWeight: undefined,
alwaysFlag: undefined,
factoryId: undefined,
createOrgId: undefined,
useOrgId: undefined,
prodLineId: undefined,
activeFlag: undefined,
deletedFlag: undefined,
purchasePriceUnitId: undefined,
erpModifyDate: undefined,
maxStockAmount: undefined,
minStockAmount: undefined,
safeStockAmount: undefined,
applyFlag: undefined,
materialClassfication: undefined,
autoOutstockFlag: undefined,
accessoriesFlag: undefined,
lowValueConsumableFlag: undefined,
brand: undefined,
plyrating: undefined,
pattern: undefined,
speedLevel: undefined,
load: undefined,
tireMarkings: undefined,
minParkingTime: undefined,
maxParkingTime: undefined,
standardWeight: undefined,
weightUpperLimit: undefined,
weightLowerLimit: undefined,
innerTubeFlag: undefined,
saleType: undefined,
params: {
approveDate: undefined,
}
},
rules: {
erpId: [
{ required: true, message: "ERP信息不能为空", trigger: "blur" }
],
materialCode: [
{ required: true, message: "物料编码不能为空", trigger: "blur" }
],
materialName: [
{ required: true, message: "物料名称不能为空", trigger: "blur" }
],
}
});
const { queryParams, form, rules } = toRefs(data);
const props = defineProps({
materialTypeId: Object,
materialCategories: String,//
});
const { materialTypeId, materialCategories } = toRefs(props);
const emits = defineEmits(['selection']); //
/** 下拉框查询工厂信息列表 */
let factoryList = ref([])
const getFactorySelect = async () => {
let res = await getFactoryList(null);
factoryList.value = res.data;
}
/** 查询物料信息列表 */
const getList = async () => {
loading.value = true;
queryParams.value.params = {};
queryParams.value.materialTypeId = materialTypeId.value;
//
if (materialCategories.value) {
queryParams.value.materialCategories = materialCategories.value;
}
proxy?.addDateRange(queryParams.value, dateRangeApproveDate.value, 'ApproveDate');
const res = await listBaseMaterialInfo(queryParams.value);
baseMaterialInfoList.value = res.rows;
total.value = res.total;
loading.value = false;
}
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
}
/** 表单重置 */
const reset = () => {
form.value = {...initFormData};
baseMaterialInfoFormRef.value?.resetFields();
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
const resetQuery = () => {
dateRangeApproveDate.value = ['', ''];
queryFormRef.value?.resetFields();
handleQuery();
}
// /** */
// const handleSelectionChange = (selection: BaseMaterialInfoVO[]) => {
// ids.value = selection.map(item => item.materialId);
// single.value = selection.length != 1;
// multiple.value = !selection.length;
// }
/** 新增按钮操作 */
const handleAdd = () => {
reset();
dialog.visible = true;
dialog.title = "添加物料信息";
}
/** 修改按钮操作 */
const handleUpdate = async (row?: BaseMaterialInfoVO) => {
reset();
const _materialId = row?.materialId || ids.value[0]
const res = await getBaseMaterialInfo(_materialId);
Object.assign(form.value, res.data);
dialog.visible = true;
dialog.title = "修改物料信息";
}
/** 提交按钮 */
const submitForm = () => {
baseMaterialInfoFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
if (form.value.materialId) {
await updateBaseMaterialInfo(form.value).finally(() => buttonLoading.value = false);
} else {
await addBaseMaterialInfo(form.value).finally(() => buttonLoading.value = false);
}
proxy?.$modal.msgSuccess("操作成功");
dialog.visible = false;
await getList();
}
});
}
/** 删除按钮操作 */
const handleDelete = async (row?: BaseMaterialInfoVO) => {
const _materialIds = row?.materialId || ids.value;
await proxy?.$modal.confirm('是否确认删除物料信息编号为"' + _materialIds + '"的数据项?').finally(() => loading.value = false);
await delBaseMaterialInfo(_materialIds);
proxy?.$modal.msgSuccess("删除成功");
await getList();
}
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download('mes/baseMaterialInfo/export', {
...queryParams.value
}, `baseMaterialInfo_${new Date().getTime()}.xlsx`)
}
/** 选中列赋值 */
const handleRowClick = (row) => {
selectedRow.value = row;
//
emits('selection', row);
};
defineExpose({tableRef})
onMounted(() => {
getFactorySelect();
getList();
});
</script>

@ -23,7 +23,7 @@
:label="item.warehouseName"
:value="item.warehouseId"
></el-option>
</el-select>
</el-select>
</el-form-item>
<el-form-item>
<el-button :loading="parentTableLoad" type="primary" @click="query"></el-button>
@ -222,26 +222,38 @@
</el-select>
</template>
</el-table-column>
<el-table-column label="物料编码" prop="materialId">
<el-table-column label="物料编码" prop="materialCode">
<!-- <template #default="scope">
<el-select
v-model="scope.row.materialId"
placeholder="选择物料"
style="width: 240px"
>
<el-option
v-for="i in materialList"
:label="i.materialCode+'('+i.materialName+')'"
:value="i.materialId"
:key="i.materialId"
/>
</el-select>
</template>-->
<template #default="scope">
<el-select
v-model="scope.row.materialId"
placeholder="选择物料"
style="width: 240px"
>
<el-option
v-for="i in materialList"
:label="i.materialCode +'('+ i.materialName+')'"
:value="i.materialId"
:key="i.materialId"
/>
</el-select>
<el-input
v-model="scope.row.materialCode"
placeholder="请点击检索物料"
@click="handleMaterialAdd('material', scope.$index)" >
<template #append>
<el-icon class="el-input__icon"><search/></el-icon>
</template>
</el-input>
</template>
</el-table-column>
<el-table-column label="物料名称">
<el-table-column label="物料名称" prop="materialName">
<template #default="scope">
<el-select
v-model="scope.row.materialId"
v-model="scope.row.materialName"
placeholder="选择物料"
style="width: 240px"
:disabled="true"
@ -249,12 +261,50 @@
<el-option
v-for="i in materialList"
:label="i.materialName"
:value="i.materialId"
:value="i.materialName"
:key="i.materialId"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="物料单位" prop="materialUnit">
<template #default="scope">
<el-select
v-model="scope.row.materialUnit"
placeholder="选择物料"
style="width: 240px"
:disabled="true"
>
<el-option
v-for="i in materialList"
:label="i.materialUnit"
:value="i.materialUnit"
:key="i.materialId"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="物料规格" prop="materialSpec">
<template #default="scope">
<el-select
v-model="scope.row.materialSpec"
placeholder="选择物料"
style="width: 240px"
:disabled="true"
>
<el-option
v-for="i in materialList"
:label="i.materialSpec"
:value="i.materialSpec"
: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="请输入入库数量" />
@ -470,13 +520,28 @@
</div>
</template>
</el-dialog>
<!-- 添加物料信息对话框 -->
<el-dialog title="选择物料信息" v-model="materialOpen" width='1200px' append-to-body>
<MaterialSelectInWMS
@selection="handleSelection"
ref="materialSelectRef"
v-if="materialOpen"
:materialCategories="dialogForm.materialCategories"
></MaterialSelectInWMS>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitMaterialForm"> </el-button>
<el-button @click="materialOpen = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script setup name="Linkage" lang="ts">
import { listInstockOrder, getInstockOrder, delInstockOrder, addInstockOrder, updateInstockOrder, approveInstockOrder } from '@/api/wms/instockOrder';
import { InstockOrderVO, InstockOrderQuery, InstockOrderForm } from '@/api/wms/instockOrder/types';
import {reactive} from 'vue'
import {onMounted, reactive} from 'vue'
import {ElMessage, ElMessageBox} from 'element-plus'
import {getBaseWarehouseList} from "@/api/wms/baseWarehouse";
import {UserVO} from "@/api/system/user/types";
@ -486,6 +551,7 @@ import { InstockDetailVO, InstockDetailQuery, InstockDetailForm } from '@/api/wm
import {
getMaterialList, getInstockMaterialList
} from '@/api/wms/linkage'
import MaterialSelectInWMS from "@/views/mes/baseMaterialInfo/addMaterial.vue";
const {proxy} = getCurrentInstance() as ComponentInternalInstance;
const {audit_behave,
@ -549,10 +615,10 @@ listUser().then(e => {
userList.value = e.rows;
})
/** 提交按钮 */
const submitForm = async() => {
const submitForm = async() => {
await updateInstockDetail(childrenTableInfoForm.value);
getChildrenTable({instockId: partntTableSelectCell.value.instockId});
childrenTableInfoVisible.value = false;
childrenTableInfoVisible.value = false;
}
//
@ -598,9 +664,9 @@ const handlePrint = async (row?: InstockDetailVO) => {
const _instockDetailId = row?.instockDetailId || ids.value[0]
const res = await getInstockDetail(_instockDetailId);
Object.assign(childrenTableInfoForm.value, res.data);
}
//
const query = async () => {
@ -709,7 +775,7 @@ const addDialogTableCell = () => {
//
const dialogSubmit = () => {
addInstockOrder(dialogForm.value).then(e => {
addInstockDetail(dialogtable.value.map(item => {
return {...item, instockCode: e.data.instockCode,instockId: e.data.instockId, materialCategories: e.data.materialCategories}
@ -740,7 +806,7 @@ const parentTableApproveSubmit = () =>{
message: '审批完成',
})
}
parentTableApproveVisible.value = false
getParentTable()
})
@ -778,7 +844,7 @@ ElMessageBox.confirm(
console.log(index)
dialogtable.value.splice(index,1)
})
}
//
@ -809,6 +875,54 @@ const childrenTableUDelete = (e) => {
})
})
}
/* 以下为添加物料信息对话框相关方法 */
let materialSelectRef = ref();//
const materialOpen = ref(false);//
const selectType = ref(''); //
const selectedMaterial = ref(null); //
const currentRowIndex = ref(-1); //
/** 处理从MaterialSelect组件接收到的选择 */
const handleSelection = (row) => {
selectedMaterial.value = row;
};
/** 提交物料BOM信息按钮 */
const submitMaterialForm = () => {
if (!selectedMaterial.value) {
//
selectedMaterial.value = materialSelectRef.value.tableRef.store.states.currentRow.value;
}
if (selectedMaterial.value) {
if (selectType.value === 'material') {
//
if (currentRowIndex.value >= 0 && dialogtable.value[currentRowIndex.value]) {
dialogtable.value[currentRowIndex.value].materialId = selectedMaterial.value.materialId;
dialogtable.value[currentRowIndex.value].materialName = selectedMaterial.value.materialName;
dialogtable.value[currentRowIndex.value].materialCode = selectedMaterial.value.materialCode;
dialogtable.value[currentRowIndex.value].materialUnit = selectedMaterial.value.materialUnit;
dialogtable.value[currentRowIndex.value].materialSpec = selectedMaterial.value.materialSpec;
//
}
}
}
//
selectedMaterial.value = null;
materialOpen.value = false;
};
/** 新增按钮操作 */
const handleMaterialAdd = (type, index) => {
selectType.value = type;
currentRowIndex.value = index; //
materialOpen.value = true;
}
</script>
<style>
.demo-form-inline .el-input {

@ -214,7 +214,7 @@
</template>
</el-table-column>
<el-table-column label="物料编码" prop="materialId">
<template #default="scope">
<!-- <template #default="scope">
<el-select
v-model="scope.row.materialId"
placeholder="选择物料"
@ -227,6 +227,16 @@
:key="i.materialId"
/>
</el-select>
</template>-->
<template #default="scope">
<el-input
v-model="scope.row.materialCode"
placeholder="请点击检索物料"
@click="handleMaterialAdd('material', scope.$index)" >
<template #append>
<el-icon class="el-input__icon"><search/></el-icon>
</template>
</el-input>
</template>
</el-table-column>
<el-table-column label="物料名称">
@ -408,6 +418,21 @@
</div>
</template>
</el-dialog>
<!-- 添加物料信息对话框 -->
<el-dialog title="选择物料信息" v-model="materialOpen" width='1200px' append-to-body>
<MaterialSelectInWMS
@selection="handleSelection"
ref="materialSelectRef"
v-if="materialOpen"
:materialCategories="dialogForm.materialCategories"
></MaterialSelectInWMS>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitMaterialForm"> </el-button>
<el-button @click="materialOpen = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
@ -422,6 +447,8 @@ import {
getMaterialList, viewAllocateOrderDetail, delAllocateOrderDetail, allocateOrderUpdate
} from '@/api/wms/linkage'
import MaterialSelectInWMS from "@/views/mes/baseMaterialInfo/addMaterial.vue";
import {reactive} from 'vue'
import {ElMessage, ElMessageBox} from 'element-plus'
import {getBaseWarehouseList} from "@/api/wms/baseWarehouse";
@ -658,7 +685,7 @@ ElMessageBox.confirm(
console.log(index)
dialogtable.value.splice(index,1)
})
}
//
@ -689,6 +716,53 @@ const childrenTableUDelete = (e) => {
})
})
}
/* 以下为添加物料信息对话框相关方法 */
let materialSelectRef = ref();//
const materialOpen = ref(false);//
const selectType = ref(''); //
const selectedMaterial = ref(null); //
const currentRowIndex = ref(-1); //
/** 处理从MaterialSelect组件接收到的选择 */
const handleSelection = (row) => {
selectedMaterial.value = row;
};
/** 提交物料BOM信息按钮 */
const submitMaterialForm = () => {
if (!selectedMaterial.value) {
//
selectedMaterial.value = materialSelectRef.value.tableRef.store.states.currentRow.value;
}
if (selectedMaterial.value) {
if (selectType.value === 'material') {
//
if (currentRowIndex.value >= 0 && dialogtable.value[currentRowIndex.value]) {
dialogtable.value[currentRowIndex.value].materialId = Number(selectedMaterial.value.materialId);
dialogtable.value[currentRowIndex.value].materialName = selectedMaterial.value.materialName;
dialogtable.value[currentRowIndex.value].materialCode = selectedMaterial.value.materialCode;
dialogtable.value[currentRowIndex.value].materialUnit = selectedMaterial.value.materialUnit;
dialogtable.value[currentRowIndex.value].materialSpec = selectedMaterial.value.materialSpec;
//
}
}
}
//
selectedMaterial.value = null;
materialOpen.value = false;
};
/** 新增按钮操作 */
const handleMaterialAdd = (type, index) => {
selectType.value = type;
currentRowIndex.value = index; //
materialOpen.value = true;
}
</script>
<style>
.demo-form-inline .el-input {

@ -204,26 +204,39 @@
></el-option>
</el-select>
</el-table-column>
<el-table-column label="物料编码" prop="materialId">
<el-table-column label="物料编码" prop="materialCode">
<!-- <template #default="scope">
<el-select
v-model="scope.row.materialId"
placeholder="选择物料"
style="width: 240px"
>
<el-option
v-for="i in materialList"
:label="i.materialCode+'('+i.materialName+')'"
:value="i.materialId"
:key="i.materialId"
/>
</el-select>
</template>-->
<template #default="scope">
<el-select
v-model="scope.row.materialId"
placeholder="选择物料"
style="width: 240px"
>
<el-option
v-for="i in materialList"
:label="i.materialCode+'('+i.materialName+')'"
:value="i.materialId"
:key="i.materialId"
/>
</el-select>
<el-input
v-model="scope.row.materialCode"
placeholder="请点击检索物料"
@click="handleMaterialAdd('material', scope.$index)" >
<template #append>
<el-icon class="el-input__icon"><search/></el-icon>
</template>
</el-input>
</template>
</el-table-column>
<el-table-column label="物料名称">
<el-table-column label="物料名称" prop="materialName">
<template #default="scope">
<el-select
v-model="scope.row.materialId"
v-model="scope.row.materialName"
placeholder="选择物料"
style="width: 240px"
:disabled="true"
@ -231,12 +244,51 @@
<el-option
v-for="i in materialList"
:label="i.materialName"
:value="i.materialId"
:value="i.materialName"
:key="i.materialId"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="物料单位" prop="materialUnit">
<template #default="scope">
<el-select
v-model="scope.row.materialUnit"
placeholder="选择物料"
style="width: 240px"
:disabled="true"
>
<el-option
v-for="i in materialList"
:label="i.materialUnit"
:value="i.materialUnit"
:key="i.materialId"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="物料规格" prop="materialSpec">
<template #default="scope">
<el-select
v-model="scope.row.materialSpec"
placeholder="选择物料"
style="width: 240px"
:disabled="true"
>
<el-option
v-for="i in materialList"
:label="i.materialSpec"
:value="i.materialSpec"
: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="请输入出库数量" style="width: 200px;"/>
@ -404,6 +456,21 @@
</div>
</template>
</el-dialog>
<!-- 添加物料信息对话框 -->
<el-dialog title="选择物料信息" v-model="materialOpen" width='1200px' append-to-body>
<MaterialSelectInWMS
@selection="handleSelection"
ref="materialSelectRef"
v-if="materialOpen"
:materialCategories="dialogForm.materialCategories"
></MaterialSelectInWMS>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitMaterialForm"> </el-button>
<el-button @click="materialOpen = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
@ -422,6 +489,8 @@ import {
getMaterialList
} from '@/api/wms/linkage'
import MaterialSelectInWMS from "@/views/mes/baseMaterialInfo/addMaterial.vue";
const {proxy} = getCurrentInstance() as ComponentInternalInstance;
const {
wms_out_type,
@ -491,7 +560,7 @@ listUser().then(e => {
userList.value = e.rows;
})
/** 提交按钮 */
const submitForm = () => {
const submitForm = () => {
updateInstockDetail(childrenTableInfoForm.value).finally(() => childrenTableInfoVisible.value = false);
}
@ -529,9 +598,9 @@ const handlePrint = async (row?: InstockDetailVO) => {
const _instockDetailId = row?.instockDetailId || ids.value[0]
const res = await getInstockDetail(_instockDetailId);
Object.assign(childrenTableInfoForm.value, res.data);
}
//
const query = async () => {
@ -632,7 +701,7 @@ const addDialogTableCell = () => {
//
const dialogSubmit = () => {
addOutstockOrder(dialogForm.value).then(e => {
addOutstockDetail(dialogtable.value.map(item => {
return {...item, outstockCode: e.data.outstockCode,outstockId: e.data.outstockId, materialCategories: e.data.materialCategories}
@ -679,7 +748,7 @@ ElMessageBox.confirm(
console.log(index)
dialogtable.value.splice(index,1)
})
}
//
@ -710,6 +779,54 @@ const childrenTableUDelete = (e) => {
})
})
}
/* 以下为添加物料信息对话框相关方法 */
let materialSelectRef = ref();//
const materialOpen = ref(false);//
const selectType = ref(''); //
const selectedMaterial = ref(null); //
const currentRowIndex = ref(-1); //
/** 处理从MaterialSelect组件接收到的选择 */
const handleSelection = (row) => {
selectedMaterial.value = row;
};
/** 提交物料BOM信息按钮 */
const submitMaterialForm = () => {
if (!selectedMaterial.value) {
//
selectedMaterial.value = materialSelectRef.value.tableRef.store.states.currentRow.value;
}
if (selectedMaterial.value) {
if (selectType.value === 'material') {
//
if (currentRowIndex.value >= 0 && dialogtable.value[currentRowIndex.value]) {
dialogtable.value[currentRowIndex.value].materialId = selectedMaterial.value.materialId;
dialogtable.value[currentRowIndex.value].materialName = selectedMaterial.value.materialName;
dialogtable.value[currentRowIndex.value].materialCode = selectedMaterial.value.materialCode;
dialogtable.value[currentRowIndex.value].materialUnit = selectedMaterial.value.materialUnit;
dialogtable.value[currentRowIndex.value].materialSpec = selectedMaterial.value.materialSpec;
//
}
}
}
//
selectedMaterial.value = null;
materialOpen.value = false;
};
/** 新增按钮操作 */
const handleMaterialAdd = (type, index) => {
selectType.value = type;
currentRowIndex.value = index; //
materialOpen.value = true;
}
</script>
<style>
.demo-form-inline .el-input {

@ -248,9 +248,9 @@
<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="物料编码" prop="materialId">
<template #default="scope">
<el-table :data="dialogtable" border style="width: 100%">
<el-table-column label="物料编码" prop="materialCode">
<!-- <template #default="scope">
<el-select
v-model="scope.row.materialId"
placeholder="选择物料"
@ -263,12 +263,23 @@
:key="i.materialId"
/>
</el-select>
</template>-->
<template #default="scope">
<el-input
v-model="scope.row.materialCode"
placeholder="请点击检索物料"
@click="handleMaterialAdd('material', scope.$index)" >
<template #append>
<el-icon class="el-input__icon"><search/></el-icon>
</template>
</el-input>
</template>
</el-table-column>
<el-table-column label="物料">
<el-table-column label="物料名称" prop="materialName">
<template #default="scope">
<el-select
v-model="scope.row.materialId"
v-model="scope.row.materialName"
placeholder="选择物料"
style="width: 240px"
:disabled="true"
@ -276,12 +287,49 @@
<el-option
v-for="i in materialList"
:label="i.materialName"
:value="i.materialId"
:value="i.materialName"
:key="i.materialId"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="物料单位" prop="materialUnit">
<template #default="scope">
<el-select
v-model="scope.row.materialUnit"
placeholder="选择物料"
style="width: 240px"
:disabled="true"
>
<el-option
v-for="i in materialList"
:label="i.materialUnit"
:value="i.materialUnit"
:key="i.materialId"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="物料规格" prop="materialSpec">
<template #default="scope">
<el-select
v-model="scope.row.materialSpec"
placeholder="选择物料"
style="width: 240px"
:disabled="true"
>
<el-option
v-for="i in materialList"
:label="i.materialSpec"
:value="i.materialSpec"
:key="i.materialId"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="含税单价" prop="taxPrice" >
<template #default="scope">
<el-input v-model="scope.row.taxPrice" placeholder="请输入含税单价" style="width: 240px"/>
@ -416,13 +464,30 @@
</div>
</template>
</el-dialog>
<!-- 添加物料信息对话框 -->
<el-dialog title="选择物料信息" v-model="materialOpen" width='1200px' append-to-body>
<MaterialSelectInWMS
@selection="handleSelection"
ref="materialSelectRef"
v-if="materialOpen"
:materialCategories="dialogForm.materialCategories"
></MaterialSelectInWMS>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitMaterialForm"> </el-button>
<el-button @click="materialOpen = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script setup name="Linkage" lang="ts">
import { listWmsPurchaseOrder, getWmsPurchaseOrder, delWmsPurchaseOrder, addWmsPurchaseOrder, updateWmsPurchaseOrder } from '@/api/wms/wmsPurchaseOrder';
import { WmsPurchaseOrderVO, WmsPurchaseOrderQuery, WmsPurchaseOrderForm } from '@/api/wms/wmsPurchaseOrder/types';
import {reactive} from 'vue'
import {reactive, onMounted} from 'vue'
import {ElMessage, ElMessageBox} from 'element-plus'
import {getBaseWarehouseList} from "@/api/wms/baseWarehouse";
import {UserVO} from "@/api/system/user/types";
@ -433,6 +498,7 @@ import { WmsPurchaseOrderDetailVO, WmsPurchaseOrderDetailQuery, WmsPurchaseOrder
import {
getMaterialList, getInstockMaterialList
} from '@/api/wms/linkage'
import MaterialSelectInWMS from "@/views/mes/baseMaterialInfo/addMaterial.vue";
const {proxy} = getCurrentInstance() as ComponentInternalInstance;
const {
@ -441,7 +507,7 @@ const {
wms_po_type,
wms_audit_status,
material_mategories,
} = toRefs<any>(proxy?.useDict('wms_barcode_if', 'wms_po_status', 'wms_po_type', 'wms_audit_status', 'material_mategories'));
@ -493,13 +559,13 @@ getBaseWarehouseList().then(e => {
})
const getUserList = () => {
const getUserList = () => {
listUser().then(e => {
userList.value = e.rows;
})
}
/** 提交按钮 */
const submitForm = () => {
const submitForm = () => {
updateWmsPurchaseOrderDetail(childrenTableInfoForm.value).finally(() => childrenTableInfoVisible.value = false);
getChildrenTable({poNo: partntTableSelectCell.value.poNo})
}
@ -540,9 +606,9 @@ getParentTable()
// const _instockDetailId = row?.instockDetailId || ids.value[0]
// const res = await getInstockDetail(_instockDetailId);
// Object.assign(childrenTableInfoForm.value, res.data);
// }
//
const query = async () => {
@ -584,6 +650,7 @@ const parentTableAdd = () => {
dialogForm.value = {}
dialogtable.value = []
}
//
const parentTableUpdate = async (e) => {
let id = ref(null)
@ -598,6 +665,7 @@ const parentTableUpdate = async (e) => {
parentTableInfoVisible.value = true
updateDialog.value = true
}
//
const parentTableDelete = async (e) => {
const delList = ref([])
@ -647,7 +715,7 @@ const addDialogTableCell = () => {
//
const dialogSubmit = () => {
addWmsPurchaseOrder(dialogForm.value).then(e => {
addWmsPurchaseOrderDetail(dialogtable.value.map(item => {
return {...item, poNo: e.data.poNo}
@ -694,7 +762,7 @@ ElMessageBox.confirm(
console.log(index)
dialogtable.value.splice(index,1)
})
}
//
@ -725,6 +793,60 @@ const childrenTableUDelete = (e) => {
})
})
}
/* 以下为添加物料信息对话框相关方法 */
let materialSelectRef = ref();//
const materialOpen = ref(false);//
const selectType = ref(''); //
const selectedMaterial = ref(null); //
const currentRowIndex = ref(-1); //
/** 处理从MaterialSelect组件接收到的选择 */
const handleSelection = (row) => {
selectedMaterial.value = row;
};
/** 提交物料BOM信息按钮 */
const submitMaterialForm = () => {
if (!selectedMaterial.value) {
//
selectedMaterial.value = materialSelectRef.value.tableRef.store.states.currentRow.value;
}
if (selectedMaterial.value) {
if (selectType.value === 'material') {
//
if (currentRowIndex.value >= 0 && dialogtable.value[currentRowIndex.value]) {
dialogtable.value[currentRowIndex.value].materialId = selectedMaterial.value.materialId;
dialogtable.value[currentRowIndex.value].materialName = selectedMaterial.value.materialName;
dialogtable.value[currentRowIndex.value].materialCode = selectedMaterial.value.materialCode;
dialogtable.value[currentRowIndex.value].materialUnit = selectedMaterial.value.materialUnit;
dialogtable.value[currentRowIndex.value].materialSpec = selectedMaterial.value.materialSpec;
//
}
}
}
//
selectedMaterial.value = null;
materialOpen.value = false;
};
/** 新增按钮操作 */
const handleMaterialAdd = (type, index) => {
selectType.value = type;
currentRowIndex.value = index; //
materialOpen.value = true;
}
/*// 初始化dialogtable
onMounted(() => {
//
// dialogtable
dialogtable.value = [];
});*/
</script>
<style>
.demo-form-inline .el-input {

Loading…
Cancel
Save