石墨消解仪后端用nodejs编写,与嵌入式端交互和前端交互均用ws
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

33 lines
829 B

const FeedConversion = require("../model/feedConversion.model");
const { updateRatioById } = require("./coop.service");
class FeedConversionService {
async createFeed(
batch_id,
coop_id,
fodder_total,
weight_increment,
log_user_id
) {
// 插入料肉比记录
const res = await FeedConversion.create({
batch_id,
coop_id,
fodder_total,
weight_increment,
log_user_id,
});
// 像对应的coop中插入料肉比
// 计算料肉比
if (weight_increment != 0 && fodder_total != 0) {
try {
const ratio = (fodder_total / weight_increment).toFixed(2);
const coopRes = await updateRatioById(coop_id, ratio);
} catch (err) {
console.log(err);
}
}
return res;
}
}
module.exports = new FeedConversionService();