feat(wmsShippingBill): 优化发货单物料来源处理逻辑

- 移除发货类型选项的硬编码注释,改用字典动态渲染
- 激活ERP物料单选按钮并修复物料来源切换功能
- 更新物料来源类型注释说明,默认值适用于新建空白单据
- 新增syncMaterialSourceTypeByDetails函数实现物料来源类型自动同步
- 修复saleMaterialSelectRef调用方法名从openDialog改为open
- 添加materielId字段确保ERP物料数据完整性
- 在物料添加和详情加载完成后调用同步函数确保状态一致
dev
zangch@mesnac.com 1 week ago
parent 0cf3b7df2a
commit 6a5a92eb2c

@ -60,9 +60,6 @@
<el-col :span="12">
<el-form-item label="发货类型" prop="shippingType">
<el-select v-model="form.shippingType" placeholder="请选择发货类型" style="width: 100%">
<!-- <el-option label="普通发货" value="1" />
<el-option label="备件发货" value="2" />
<el-option label="物流发货" value="3" /> -->
<el-option v-for="dict in shipping_type" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
@ -255,7 +252,7 @@
<el-col :span="3">
<!-- 物料来源切换 -->
<el-radio-group v-model="materialSourceType" size="small" @change="handleMaterialSourceChange" :disabled="detailFormDisabled">
<!-- <el-radio-button value="1">ERP物料</el-radio-button>-->
<el-radio-button value="1">ERP物料</el-radio-button>
<el-radio-button value="2">WMS物料</el-radio-button>
</el-radio-group>
</el-col>
@ -580,7 +577,7 @@ const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>();
//
const taskVariables = ref<Record<string, any>>({});
// 1-ERP2-WMS使WMS
// 1-ERP2-WMS使WMS
const materialSourceType = ref('2');
//
@ -692,6 +689,23 @@ const data = reactive<{ form: WmsShippingBillForm; rules: any }>({
const { form, rules } = toRefs(data);
const syncMaterialSourceTypeByDetails = () => {
if (!detailsList.value.length) {
return;
}
const hasErpMaterial = detailsList.value.some((item) => item.materialSourceType === '1');
const hasWmsMaterial = detailsList.value.some((item) => item.materialSourceType === '2');
// Why稿 ERP ERP
// 沿稿 WMS
if (hasErpMaterial && !hasWmsMaterial) {
materialSourceType.value = '1';
return;
}
if (!hasErpMaterial && hasWmsMaterial) {
materialSourceType.value = '2';
}
};
const normalizeWorkflowUserIds = (value: unknown): string | undefined => {
if (Array.isArray(value)) {
const ids = value.map((item) => String(item ?? '').trim()).filter((item) => item.length > 0);
@ -930,7 +944,7 @@ const handleAddDetail = () => {
}
if (materialSourceType.value === '1') {
// ERP
saleMaterialSelectRef.value?.openDialog();
saleMaterialSelectRef.value?.open();
} else {
// WMS
wmsMaterialDialog.visible = true;
@ -950,6 +964,9 @@ const erpMaterialSelectCallBack = (materials: any[]) => {
shippingBillId: form.value.shippingBillId,
materialSourceType: '1', // ERP
erpMaterialId: material.materialId,
// Why ERP 稿 erpMaterialId materielId
// ERP
materielId: material.materialId,
wmsMaterialId: undefined,
materialCode: material.materialCode,
materialName: material.materialName,
@ -964,6 +981,7 @@ const erpMaterialSelectCallBack = (materials: any[]) => {
});
}
});
syncMaterialSourceTypeByDetails();
}
};
@ -1140,6 +1158,7 @@ const loadFormData = async (id: string | number) => {
totalPrice: item.totalPrice,
remark: item.remark
}));
syncMaterialSourceTypeByDetails();
}
// ID

Loading…
Cancel
Save