Commit a585a1cb by sunhaiwei

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

parent 8f19fea9
...@@ -68,8 +68,24 @@ import { log } from 'node:console'; ...@@ -68,8 +68,24 @@ import { log } from 'node:console';
try { try {
const apiUrl = import.meta.env.VITE_GLOB_API_URL || ''; const apiUrl = import.meta.env.VITE_GLOB_API_URL || '';
const response = await axios.get(apiUrl + '/magic-api/jcxx/wlxList', { params: { bomId: newBomId } }); const response = await axios.get(apiUrl + '/magic-api/jcxx/wlxList', { params: { bomId: newBomId } });
state.formModel.mesWarehouseMaterialList = [] state.formModel.mesWarehouseMaterialList = [];
// Process API response data and assign to material list //铸造量的值
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 => ({ state.formModel.mesWarehouseMaterialList = response.data.data.map(item => ({
wlbh: item.wlbh, wlbh: item.wlbh,
wlmc: item.wlmc, wlmc: item.wlmc,
...@@ -78,12 +94,9 @@ import { log } from 'node:console'; ...@@ -78,12 +94,9 @@ import { log } from 'node:console';
khbz: item.khbz, khbz: item.khbz,
nkbz: item.nkbz, nkbz: item.nkbz,
sftl: item.sftl, sftl: item.sftl,
bomsl: item.bomsl,
wlId: item.id wlId: item.id
} }));
)
);
// state.formModel.mesWarehouseMaterialList = materialList;
} catch (error) { } catch (error) {
notification.error({ message: '获取物料清单失败' }); notification.error({ message: '获取物料清单失败' });
} }
...@@ -275,4 +288,4 @@ import { log } from 'node:console'; ...@@ -275,4 +288,4 @@ import { log } from 'node:console';
getFieldsValue, getFieldsValue,
sendMessageForAllIframe sendMessageForAllIframe
}); });
</script> </script>
\ No newline at end of file
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