Commit a585a1cb by sunhaiwei

生产任务初始化的时候设置物料清单数量

parent 8f19fea9
......@@ -68,8 +68,24 @@ import { log } from 'node:console';
try {
const apiUrl = import.meta.env.VITE_GLOB_API_URL || '';
const response = await axios.get(apiUrl + '/magic-api/jcxx/wlxList', { params: { bomId: newBomId } });
state.formModel.mesWarehouseMaterialList = []
// Process API response data and assign to material list
state.formModel.mesWarehouseMaterialList = [];
//铸造量的值
let sl = state.formModel.sl;
if (sl && sl > 0) {
let data = response.data.data;
data.forEach((item) => {
//bom数量
let bomsl = item.bomsl;
if (bomsl && bomsl > 0) {
//用铸造量除以bom数量并保留2位小数
let result = Number((sl / bomsl).toFixed(2));
//物料数量等于原数量*倍数
if (item.wlsl && item.wlsl > 0) {
item.wlsl = Number((item.wlsl*result).toFixed(2));
}
}
})
}
state.formModel.mesWarehouseMaterialList = response.data.data.map(item => ({
wlbh: item.wlbh,
wlmc: item.wlmc,
......@@ -78,12 +94,9 @@ import { log } from 'node:console';
khbz: item.khbz,
nkbz: item.nkbz,
sftl: item.sftl,
bomsl: item.bomsl,
wlId: item.id
}
)
);
// state.formModel.mesWarehouseMaterialList = materialList;
}));
} catch (error) {
notification.error({ message: '获取物料清单失败' });
}
......@@ -275,4 +288,4 @@ import { log } from 'node:console';
getFieldsValue,
sendMessageForAllIframe
});
</script>
\ No newline at end of file
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment