|
|
|
|
@ -324,6 +324,22 @@
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
|
|
<!-- 采购订单相关列,只在工单类型为采购订单时显示 -->
|
|
|
|
|
<el-table-column label="采购数量" prop="purchaseQty" v-if="dialogForm.instockType === '1'">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<span>{{ scope.row.purchaseQty || '-' }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="已入库数量" prop="instockedQty" v-if="dialogForm.instockType === '1'">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<span>{{ scope.row.instockedQty || 0 }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="剩余可入库" prop="remainingQty" v-if="dialogForm.instockType === '1'">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<span style="color: #409EFF; font-weight: bold;">{{ scope.row.remainingQty || (scope.row.purchaseQty - (scope.row.instockedQty || 0)) }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
|
|
<el-table-column label="入库数量" prop="instockQty">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
@ -331,7 +347,7 @@
|
|
|
|
|
v-if="scope.row._showQtyInput"
|
|
|
|
|
v-model.number="scope.row.instockQty"
|
|
|
|
|
:min="0"
|
|
|
|
|
:max="scope.row.deliveryQty"
|
|
|
|
|
:max="dialogForm.instockType === '1' ? scope.row.remainingQty : scope.row.deliveryQty"
|
|
|
|
|
:precision="0"
|
|
|
|
|
:controls="false"
|
|
|
|
|
placeholder="请输入入库数量"
|
|
|
|
|
@ -532,11 +548,11 @@
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<!--
|
|
|
|
|
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button @click="batchConfigVisible = true">配置条码</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
-->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label="已包数量" prop="printedNum">
|
|
|
|
|
<el-input v-model="childrenTableInfoForm.printedNum" placeholder="" :disabled="true"/>
|
|
|
|
|
@ -559,7 +575,7 @@
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- <el-dialog v-model="batchConfigVisible" title="条码配置" width="40%">
|
|
|
|
|
<el-dialog v-model="batchConfigVisible" title="条码配置" width="40%">
|
|
|
|
|
<el-select v-model="selectedComponents" multiple placeholder="选择并排序组成部分">
|
|
|
|
|
<el-option v-for="comp in batchComponents" :key="comp" :label="comp" :value="comp" />
|
|
|
|
|
</el-select>
|
|
|
|
|
@ -567,7 +583,7 @@
|
|
|
|
|
<el-button @click="batchConfigVisible = false">取消</el-button>
|
|
|
|
|
<el-button type="primary" @click="saveBatchConfig">保存</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>-->
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
<!-- 添加物料信息对话框 -->
|
|
|
|
|
<el-dialog title="选择物料信息" v-model="materialOpen" width='1200px' append-to-body>
|
|
|
|
|
@ -604,7 +620,7 @@ import MaterialSelectInWMS from "@/views/wms/baseMaterialInfo/addMaterialInWMS.v
|
|
|
|
|
|
|
|
|
|
import { getBaseMaterialCategoryListInWMS } from '@/api/wms/baseMaterialCategory';
|
|
|
|
|
|
|
|
|
|
import { getWmsPurchaseOrderDetailList } from '@/api/wms/wmsPurchaseOrderDetail';
|
|
|
|
|
import { getWmsPurchaseOrderDetailList, getWmsPurchaseOrderDetailWithStatistics } from '@/api/wms/wmsPurchaseOrderDetail';
|
|
|
|
|
import { getProdOrderInfoList, listOrderInfo } from '@/api/wms/orderInfo';
|
|
|
|
|
import { getWmsPurchaseOrderList } from '@/api/wms/wmsPurchaseOrder';
|
|
|
|
|
import { useRoute } from 'vue-router';
|
|
|
|
|
@ -739,7 +755,7 @@ const submitForm = async() => {
|
|
|
|
|
childrenTableInfoVisible.value = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
// 新增配置相关代码
|
|
|
|
|
const batchConfigVisible = ref(false)
|
|
|
|
|
const batchComponents = ref(['当前时间', '入库单号', '物料编码']) // 可选组成部分
|
|
|
|
|
@ -761,7 +777,7 @@ const generateBatchCode = (form) => {
|
|
|
|
|
return ''
|
|
|
|
|
}).join('-') // 假设用-连接,可配置
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let mategoryOptions = ref([]);
|
|
|
|
|
@ -1122,13 +1138,11 @@ const handleMaterialAdd = (type, index) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const loadPurchaseOrders = async () => {
|
|
|
|
|
// const res = await listWmsPurchaseOrder({ auditStatus: '1', pageNum: 1, pageSize: 99999 });
|
|
|
|
|
const res = await getWmsPurchaseOrderList(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;
|
|
|
|
|
};
|
|
|
|
|
@ -1137,7 +1151,6 @@ 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 = [];
|
|
|
|
|
@ -1155,17 +1168,29 @@ const handleAssociatePurchaseOrder = async () => {
|
|
|
|
|
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 // 标记显示数字输入框
|
|
|
|
|
}));
|
|
|
|
|
try {
|
|
|
|
|
// 使用新的API获取带统计数据的采购订单物料列表
|
|
|
|
|
const res = await getWmsPurchaseOrderDetailWithStatistics({ poNo: order.poNo });
|
|
|
|
|
dialogtable.value = res.data.map(item => ({
|
|
|
|
|
poDId: item.poDId, // 添加采购订单物料主键
|
|
|
|
|
materialId: item.materialId,
|
|
|
|
|
materialCode: item.materialCode,
|
|
|
|
|
materialName: item.materialName,
|
|
|
|
|
materialSpe: item.materialSpe,
|
|
|
|
|
unitName: item.unitName || '',
|
|
|
|
|
purchaseQty: item.purchaseQty, // 采购数量
|
|
|
|
|
instockedQty: item.instockedQty || 0, // 已入库数量
|
|
|
|
|
remainingQty: item.remainingQty || item.purchaseQty, // 剩余可入库数量
|
|
|
|
|
instockQty: 0, // 初始化为0,让用户手动输入
|
|
|
|
|
deliveryQty: item.deliveryQty, // 保存交付数量用于验证
|
|
|
|
|
_showQtyInput: true // 标记显示数字输入框
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
ElMessage.success('关联采购订单成功,已加载物料列表及库存信息');
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('获取采购订单物料列表失败:', error);
|
|
|
|
|
ElMessage.error('获取采购订单物料列表失败,请重试');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handlePurchaseOrderSelect = (order) => {
|
|
|
|
|
@ -1193,7 +1218,16 @@ const validateQty = (row, val) => {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 确保不超过交付数量
|
|
|
|
|
// 对于采购订单类型,验证不超过剩余可入库数量
|
|
|
|
|
if (dialogForm.value.instockType === '1' && row.remainingQty !== undefined) {
|
|
|
|
|
if (intVal > row.remainingQty) {
|
|
|
|
|
row.instockQty = row.remainingQty;
|
|
|
|
|
ElMessage.warning(`入库数量不能大于剩余可入库数量 ${row.remainingQty}`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 对于其他类型,验证不超过交付数量(如果有)
|
|
|
|
|
if (row.deliveryQty !== undefined && intVal > row.deliveryQty) {
|
|
|
|
|
row.instockQty = row.deliveryQty;
|
|
|
|
|
ElMessage.warning(`入库数量不能大于交付数量 ${row.deliveryQty}`);
|
|
|
|
|
|