|
|
|
@ -126,6 +126,11 @@
|
|
|
|
|
<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="isInspection">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<dict-tag :options="wsm_is_inspection" :value="scope.row.isInspection"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="已分包数量" align="center" prop="printedNum" />
|
|
|
|
|
<el-table-column label="物料规格" align="center" prop="materialSpe"/>
|
|
|
|
|
<el-table-column label="计量单位名称" align="center" prop="unitName"/>
|
|
|
|
@ -178,9 +183,22 @@
|
|
|
|
|
></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="orderNo">
|
|
|
|
|
<el-input v-model="dialogForm.orderNo" placeholder="请输入订单编号" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="采购订单" v-if="state.showPurchaseOrderSelect">
|
|
|
|
|
<el-select v-model="state.selectedPurchaseOrder" placeholder="请选择采购订单" value-key="poId" style="width: 200px">
|
|
|
|
|
<el-option v-for="item in state.purchaseOrders" :key="item.poId" :label="item.poNo" :value="item" />
|
|
|
|
|
</el-select>
|
|
|
|
|
<el-button type="primary" @click="handleAssociatePurchaseOrder" style="margin-left: 10px" :disabled="!state.selectedPurchaseOrder">
|
|
|
|
|
关联
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="生产订单" v-if="state.showProductionOrderSelect">
|
|
|
|
|
<el-select v-model="state.selectedProductionOrder" placeholder="请选择生产订单" @change="handleProductionOrderSelect" value-key="productOrderId">
|
|
|
|
|
<el-option v-for="item in state.productionOrders" :key="item.productOrderId" :label="item.orderCode" :value="item" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<!-- <el-form-item label="审核人" prop="auditBy">
|
|
|
|
|
<el-select v-model="dialogForm.auditBy" placeholder="请选择审核人">
|
|
|
|
|
<el-option
|
|
|
|
@ -310,7 +328,18 @@
|
|
|
|
|
|
|
|
|
|
<el-table-column label="入库数量" prop="instockQty">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-input v-model="scope.row.instockQty" placeholder="请输入入库数量" />
|
|
|
|
|
<el-input-number
|
|
|
|
|
v-if="scope.row._showQtyInput"
|
|
|
|
|
v-model.number="scope.row.instockQty"
|
|
|
|
|
:min="0"
|
|
|
|
|
:max="scope.row.deliveryQty"
|
|
|
|
|
:precision="0"
|
|
|
|
|
:controls="false"
|
|
|
|
|
placeholder="请输入入库数量"
|
|
|
|
|
@change="(val) => validateQty(scope.row, val)"
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
/>
|
|
|
|
|
<span v-else>{{ scope.row.instockQty }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="有无条码" prop="codeYesNo">
|
|
|
|
@ -542,8 +571,8 @@
|
|
|
|
|
|
|
|
|
|
<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 {onMounted, reactive} from 'vue'
|
|
|
|
|
import type { InstockOrderForm } from '@/api/wms/instockOrder/types';
|
|
|
|
|
import {onMounted, reactive, watch} from 'vue'
|
|
|
|
|
import {ElMessage, ElMessageBox} from 'element-plus'
|
|
|
|
|
import {getBaseWarehouseList} from "@/api/wms/baseWarehouse";
|
|
|
|
|
import {UserVO} from "@/api/system/user/types";
|
|
|
|
@ -558,6 +587,9 @@ import MaterialSelectInWMS from "@/views/mes/baseMaterialInfo/addMaterialInWMS.v
|
|
|
|
|
|
|
|
|
|
import { getBaseMaterialCategoryListInWMS } from '@/api/wms/baseMaterialCategory';
|
|
|
|
|
|
|
|
|
|
import { getWmsPurchaseOrderDetailList } from '@/api/wms/wmsPurchaseOrderDetail';
|
|
|
|
|
import { getProdOrderInfoList, listOrderInfo } from '@/api/wms/orderInfo';
|
|
|
|
|
|
|
|
|
|
const {proxy} = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
const {audit_behave,
|
|
|
|
|
wms_barcode_if,
|
|
|
|
@ -569,8 +601,9 @@ const {audit_behave,
|
|
|
|
|
wms_allocate_status,
|
|
|
|
|
wms_allocate_create,
|
|
|
|
|
wms_allocate_way,
|
|
|
|
|
instock_methond
|
|
|
|
|
} = toRefs<any>(proxy?.useDict('audit_behave', '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', 'instock_methond'));
|
|
|
|
|
instock_methond,
|
|
|
|
|
wsm_is_inspection
|
|
|
|
|
} = toRefs<any>(proxy?.useDict('audit_behave', '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', 'instock_methond', 'wsm_is_inspection'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface User {
|
|
|
|
@ -587,7 +620,7 @@ const childrenTableInfoVisible = ref(false)
|
|
|
|
|
// const childrenTableInfoSubmit = ref(false)
|
|
|
|
|
const updateDialog = ref(false)
|
|
|
|
|
const dialogTitle = ref('添加')
|
|
|
|
|
const dialogForm = ref({})
|
|
|
|
|
const dialogForm = ref<InstockOrderForm>({ instockType: '', orderNo: '', materialCategoryId: '', warehouseId: '' });
|
|
|
|
|
const parentTableInfoForm = ref({})
|
|
|
|
|
const parentTableApproveForm = ref({})
|
|
|
|
|
const childrenTableInfoForm = ref({})
|
|
|
|
@ -614,6 +647,16 @@ const childrenTableLoad = ref(false)
|
|
|
|
|
const isView = ref(false)
|
|
|
|
|
const partntTableSelectCell = ref({})
|
|
|
|
|
|
|
|
|
|
const state = reactive({
|
|
|
|
|
showPurchaseOrderSelect: false,
|
|
|
|
|
showProductionOrderSelect: false,
|
|
|
|
|
purchaseOrders: [],
|
|
|
|
|
productionOrders: [],
|
|
|
|
|
selectedPurchaseOrder: null,
|
|
|
|
|
selectedProductionOrder: null,
|
|
|
|
|
isPurchaseOrderAssociated: false
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 获取仓库
|
|
|
|
|
getBaseWarehouseList().then(e => {
|
|
|
|
|
baseStoreList.value = e.data
|
|
|
|
@ -719,10 +762,10 @@ const viewDetails = (e) => {
|
|
|
|
|
|
|
|
|
|
// 父表格新增
|
|
|
|
|
const parentTableAdd = () => {
|
|
|
|
|
dialogVisible.value = true
|
|
|
|
|
dialogForm.value = {}
|
|
|
|
|
dialogtable.value = []
|
|
|
|
|
}
|
|
|
|
|
dialogVisible.value = true;
|
|
|
|
|
dialogForm.value = { instockType: '', orderNo: '', materialCategoryId: '', warehouseId: '' }; // Add more if needed
|
|
|
|
|
dialogtable.value = [];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 父表格审批
|
|
|
|
|
const parentTableApprove = async (e) => {
|
|
|
|
@ -939,6 +982,87 @@ const handleMaterialAdd = (type, index) => {
|
|
|
|
|
materialOpen.value = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const loadPurchaseOrders = async () => {
|
|
|
|
|
// const res = await listWmsPurchaseOrder({ auditStatus: '1', pageNum: 1, pageSize: 99999 });
|
|
|
|
|
const res = await getWmsPurchaseOrderDetailList(null)
|
|
|
|
|
state.purchaseOrders = res.data;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const loadProductionOrders = async () => {
|
|
|
|
|
// const res = await listOrderInfo({ orderStatus: '1', pageNum: 1, pageSize: 99999 });
|
|
|
|
|
const res = await getProdOrderInfoList(null)
|
|
|
|
|
state.productionOrders = res.data;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
watch(() => dialogForm.value.instockType, async (newVal) => {
|
|
|
|
|
state.showPurchaseOrderSelect = (newVal === '1');
|
|
|
|
|
state.showProductionOrderSelect = (newVal === '2');
|
|
|
|
|
|
|
|
|
|
// Clear previous selections
|
|
|
|
|
state.selectedPurchaseOrder = null;
|
|
|
|
|
state.selectedProductionOrder = null;
|
|
|
|
|
dialogtable.value = [];
|
|
|
|
|
|
|
|
|
|
if (newVal === '1') {
|
|
|
|
|
await loadPurchaseOrders();
|
|
|
|
|
} else if (newVal === '2') {
|
|
|
|
|
await loadProductionOrders();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const handleAssociatePurchaseOrder = async () => {
|
|
|
|
|
if (!state.selectedPurchaseOrder) return;
|
|
|
|
|
|
|
|
|
|
const order = state.selectedPurchaseOrder;
|
|
|
|
|
dialogForm.value.orderNo = order.poNo;
|
|
|
|
|
|
|
|
|
|
const res = await getWmsPurchaseOrderDetailList({ poNo: order.poNo });
|
|
|
|
|
dialogtable.value = res.data.map(item => ({
|
|
|
|
|
materialId: item.materialId,
|
|
|
|
|
materialCode: item.materialCode,
|
|
|
|
|
materialName: item.materialName,
|
|
|
|
|
materialSpec: item.materialSpe,
|
|
|
|
|
materialUnit: item.unitName || '',
|
|
|
|
|
instockQty: 0, // 初始化为0,让用户手动输入
|
|
|
|
|
deliveryQty: item.deliveryQty, // 保存交付数量用于验证
|
|
|
|
|
_showQtyInput: true // 标记显示数字输入框
|
|
|
|
|
}));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handlePurchaseOrderSelect = (order) => {
|
|
|
|
|
state.selectedPurchaseOrder = order;
|
|
|
|
|
// 清空之前的物料列表
|
|
|
|
|
dialogtable.value = [];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleProductionOrderSelect = (order) => {
|
|
|
|
|
state.selectedProductionOrder = order;
|
|
|
|
|
dialogForm.value.orderNo = order.orderCode;
|
|
|
|
|
// For production, do not auto-populate materials; user adds manually
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 验证入库数量
|
|
|
|
|
const validateQty = (row, val) => {
|
|
|
|
|
if (val === null || val === undefined || val === '') {
|
|
|
|
|
row.instockQty = 0;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 确保是整数
|
|
|
|
|
const intVal = parseInt(val);
|
|
|
|
|
if (isNaN(intVal)) {
|
|
|
|
|
row.instockQty = 0;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 确保不超过交付数量
|
|
|
|
|
if (row.deliveryQty !== undefined && intVal > row.deliveryQty) {
|
|
|
|
|
row.instockQty = row.deliveryQty;
|
|
|
|
|
ElMessage.warning(`入库数量不能大于交付数量 ${row.deliveryQty}`);
|
|
|
|
|
} else {
|
|
|
|
|
row.instockQty = Math.max(0, intVal);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|