产量和效率
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
import axios from "@/utils/request";
|
||||
import { deepClone } from "../../utils";
|
||||
|
||||
@@ -25,10 +24,12 @@ const state = {
|
||||
chipOee: {
|
||||
current: [],
|
||||
previous: [],
|
||||
target:[]
|
||||
},
|
||||
transformRate: {
|
||||
current: [],
|
||||
previous: [],
|
||||
target:[]
|
||||
},
|
||||
chipRate: {
|
||||
target: [],
|
||||
@@ -39,6 +40,7 @@ const state = {
|
||||
stdRate: {
|
||||
target: [],
|
||||
current: [],
|
||||
previous: [],
|
||||
outputNumber:[]
|
||||
},
|
||||
},
|
||||
@@ -77,7 +79,7 @@ const mutations = {
|
||||
state.copilot.energy.elecList = payload.elecList;
|
||||
break;
|
||||
case "efficiency":
|
||||
state.copilot.efficiency.chipOee = payload.chipOee;
|
||||
state.copilot.efficiency.chipOeeRate = payload.chipOeeRate;
|
||||
state.copilot.efficiency.transformRate = payload.transformRate;
|
||||
state.copilot.efficiency.chipRate = payload.chipRate;
|
||||
state.copilot.efficiency.stdRate = payload.stdRate;
|
||||
@@ -97,7 +99,7 @@ const actions = {
|
||||
commit("SET_HOME_INFO", payload);
|
||||
},
|
||||
/** 初始化驾驶舱数据 */
|
||||
async initCopilot({ commit }, { period, source }) {
|
||||
async initCopilot({ commit }, { period,source,than}) {
|
||||
// if (source == "energy") return;
|
||||
|
||||
const fetcher = {
|
||||
@@ -111,25 +113,27 @@ const actions = {
|
||||
efficiency: splitCurrentAndPreviousA,
|
||||
}[source]
|
||||
// 获取产量数据
|
||||
let { data: factoryList, type } = await fetcher(period)
|
||||
let targetList = null;
|
||||
if (source === "yield" || source === "efficiency") {
|
||||
// 获取目标数据
|
||||
let { data } = await fetcher(period, true)
|
||||
targetList = data
|
||||
}
|
||||
if (source == "energy") {
|
||||
let factoryData = factoryList
|
||||
const payload = handler(factoryData)
|
||||
commit("SET_COPILOT_INFO", { type, payload });
|
||||
} else {
|
||||
let { data: factoryList, type } = await fetcher(period,than)
|
||||
// let targetList = null;
|
||||
// if (source === "yield" || source === "efficiency") {
|
||||
// // 获取目标数据
|
||||
// let { data } = await fetcher(period,than, true)
|
||||
// targetList = data
|
||||
// }
|
||||
// if (source == "energy") {
|
||||
// let factoryData = factoryList
|
||||
// const payload = handler(factoryData)
|
||||
// commit("SET_COPILOT_INFO", { type, payload });
|
||||
// } else {
|
||||
let factoryData = factoryList.prodOutputOutDO ? factoryList.prodOutputOutDO : factoryList.prodOutputRateDO
|
||||
let preData = factoryList.previousProdOutputOutDO ? factoryList.previousProdOutputOutDO : factoryList.previousProdOutputRateDO
|
||||
let preFtoData = factoryList.previousProdOutputFtoDO ? factoryList.previousProdOutputFtoDO : []
|
||||
let prodOutputFtoDO = factoryList.prodOutputFtoDO ? factoryList.prodOutputFtoDO : []
|
||||
let targetData = targetList.prodTargetDO ? targetList.prodTargetDO : targetList.prodTargetDO
|
||||
const payload = handler(factoryData, targetData,prodOutputFtoDO)
|
||||
let targetData = factoryList.prodTargetOutputDO ? factoryList.prodTargetOutputDO : factoryList.prodTargetRateDO
|
||||
const payload = handler(factoryData,targetData,prodOutputFtoDO,preData,preFtoData)
|
||||
commit("SET_COPILOT_INFO", { type, payload });
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
},
|
||||
};
|
||||
@@ -281,11 +285,11 @@ function splitCurrentAndPreviousB(factoryListResponse) {
|
||||
}
|
||||
}
|
||||
|
||||
function splitCurrentAndPreviousA(factoryListResponse, targetListResponse) {
|
||||
// console.log('工厂',factoryListResponse);
|
||||
function splitCurrentAndPreviousA(factoryListResponse, targetListResponse, prodOutputFtoListRes,preData,preFtoData) {
|
||||
console.log('工厂',targetListResponse);
|
||||
|
||||
// 初始数据
|
||||
const { chipOee, transformRate, chipRate, stdRate } = initA();
|
||||
const { chipOeeRate, transformRate, chipRate, stdRate } = initA();
|
||||
// factoryListResponse = [
|
||||
// {
|
||||
// factory: 0,
|
||||
@@ -336,6 +340,23 @@ function splitCurrentAndPreviousA(factoryListResponse, targetListResponse) {
|
||||
// componentYieldRate: 0.73,
|
||||
// },
|
||||
// ];
|
||||
if (preData && preData[0] != null) {
|
||||
for (const factory of preData) {
|
||||
const fId = getPreFactoryId(factory);
|
||||
chipInvest.previous[fId] = factory.previousYearInputNumber;
|
||||
// chipOeeRate.current[fId] = factory.oee;
|
||||
chipOeeRate.previous[fId] = factory.previousYearOee;
|
||||
// 转化效率
|
||||
transformRate.previous[fId] =factory.previousYearComponentConversionEfficiency ;
|
||||
// 芯片良率 与 标准组件良率
|
||||
if (![0, 1].includes(factory.glassType)) continue;
|
||||
const _t = [chipRate, stdRate][factory.glassType]
|
||||
// _t.current[fId] = factory.yieldRate ;
|
||||
_t.previous[fId] = factory.previousYearYieldRate ;
|
||||
// }
|
||||
// debugger;
|
||||
}
|
||||
}
|
||||
if (factoryListResponse) {
|
||||
for (const factory of factoryListResponse) {
|
||||
const fId = getFactoryId(factory);
|
||||
@@ -347,27 +368,27 @@ function splitCurrentAndPreviousA(factoryListResponse, targetListResponse) {
|
||||
chipOee,
|
||||
componentConversionEfficiency,
|
||||
componentYield
|
||||
} = getFactoryTargetValueA(targetListResponse, fId);
|
||||
} = getFactoryTargetValueA(targetListResponse, fId)
|
||||
stdRate.target[fId] = componentYieldRate
|
||||
chipRate.target[fId] = chipYieldRate
|
||||
chipOeeRate.target[fId] = chipOee
|
||||
transformRate.target[fId] = componentConversionEfficiency
|
||||
}
|
||||
// 芯片OEE
|
||||
chipOee.current[fId] = factory.oee * 100 ;
|
||||
chipOee.previous[fId] = factory.previousYearOee * 100 ;
|
||||
chipOeeRate.current[fId] = factory.oee;
|
||||
// chipOeeRate.previous[fId] = factory.previousYearOee;
|
||||
// 转化效率
|
||||
transformRate.current[fId] =
|
||||
factory.componentConversionEfficiency * 100 ;
|
||||
transformRate.previous[fId] =
|
||||
factory.previousYearComponentConversionEfficiency * 100 ;
|
||||
transformRate.current[fId] = factory.componentConversionEfficiency;
|
||||
// transformRate.previous[fId] = factory.previousYearComponentConversionEfficiency ;
|
||||
// 芯片良率 与 标准组件良率
|
||||
if (![0, 1].includes(factory.glassType)) continue;
|
||||
const _t = [chipRate, stdRate][factory.glassType]
|
||||
_t.current[fId] = factory.yieldRate ;
|
||||
_t.previous[fId] = factory.previousYearYieldRate ;
|
||||
// _t.previous[fId] = factory.previousYearYieldRate ;
|
||||
}
|
||||
|
||||
// console.log('chipOeeRate',chipOeeRate);
|
||||
return {
|
||||
chipOee,
|
||||
chipOeeRate,
|
||||
transformRate,
|
||||
chipRate,
|
||||
stdRate,
|
||||
@@ -375,21 +396,57 @@ function splitCurrentAndPreviousA(factoryListResponse, targetListResponse) {
|
||||
}
|
||||
}
|
||||
|
||||
function splitCurrentAndPrevious(factoryListResponse, targetListResponse, prodOutputFtoListRes) {
|
||||
console.log('prodOutputFtoListRes',prodOutputFtoListRes);
|
||||
function splitCurrentAndPrevious(factoryListResponse, targetListResponse, prodOutputFtoListRes,preData,preFtoData) {
|
||||
console.log('prodOutputFtoListRes',preData);
|
||||
// 初始数据
|
||||
const { chipInvest, ftoInvest, chipOutput, stdOutput, bipvOutput } = init()
|
||||
if (prodOutputFtoListRes) {
|
||||
for (const factory of prodOutputFtoListRes) {
|
||||
console.log(factory);
|
||||
const fId = getFactoryId(factory);
|
||||
// const preFId = getPreFactoryId(factory);
|
||||
// if (fId) {
|
||||
ftoInvest.current[fId] = factory.chipInput;
|
||||
// }
|
||||
// if (preFId) {
|
||||
// ftoInvest.previous[fId] = factory.previousYearChipInput;
|
||||
// }
|
||||
}
|
||||
}
|
||||
if (preFtoData) {
|
||||
for (const factory of preFtoData) {
|
||||
console.log(factory);
|
||||
const fId = getPreFactoryId(factory);
|
||||
// const preFId = getPreFactoryId(factory);
|
||||
// if (fId) {
|
||||
ftoInvest.previous[fId] = factory.previousYearChipInput;
|
||||
// }
|
||||
// if (preFId) {
|
||||
// ftoInvest.previous[fId] = factory.previousYearChipInput;
|
||||
// }
|
||||
}
|
||||
}
|
||||
if (preData && preData[0] != null) {
|
||||
for (const factory of preData) {
|
||||
const fId = getPreFactoryId(factory);
|
||||
chipInvest.previous[fId] = factory.previousYearInputNumber;
|
||||
if (![0, 1, 2].includes(factory.previousGlassType)) continue;
|
||||
const _t = [chipOutput, stdOutput, bipvOutput][factory.previousGlassType];
|
||||
// if (fId) {
|
||||
// _t.current[fId] = factory.outputNumber;
|
||||
// }
|
||||
// if (preFId) {
|
||||
_t.previous[fId] = factory.previousYearOutputNumber
|
||||
// }
|
||||
// debugger;
|
||||
}
|
||||
}
|
||||
if (factoryListResponse) {
|
||||
// console.log('ftoInvest',ftoInvest)
|
||||
if (factoryListResponse && factoryListResponse[0] != null) {
|
||||
for (const factory of factoryListResponse) {
|
||||
const fId = getFactoryId(factory);
|
||||
// const preFId = getPreFactoryId(factory);
|
||||
|
||||
// 获取目标值
|
||||
if (targetListResponse) {
|
||||
const { chipYield, componentYield, bipvProductOutput } =
|
||||
@@ -399,23 +456,14 @@ function splitCurrentAndPrevious(factoryListResponse, targetListResponse, prodOu
|
||||
bipvOutput.target[fId] = bipvProductOutput;
|
||||
}
|
||||
// 芯片投入
|
||||
chipInvest.current[fId] = factory.inputNumber;
|
||||
chipInvest.previous[fId] = factory.previousYearInputNumber;
|
||||
// FTO投入
|
||||
// if (factory.chipInput || factory.previousYearChipInput) {
|
||||
// ftoInvest.current[fId] = factory.chipInput;
|
||||
// ftoInvest.previous[fId] = factory.previousYearChipInput;
|
||||
// }
|
||||
chipInvest.current[fId] = factory.inputNumber;
|
||||
|
||||
// 产出数据, 0 - (玻璃)芯片产出, 1 - 标准组件产出, 2 - BIPV产出
|
||||
// 因为后端写的垃圾数据,所以这里要做一下判断
|
||||
if (![0, 1, 2].includes(factory.glassType)) continue;
|
||||
const _t = [chipOutput, stdOutput, bipvOutput][factory.glassType];
|
||||
_t.current[fId] = factory.outputNumber;
|
||||
_t.previous[fId] = factory.previousYearOutputNumber;
|
||||
// debugger;
|
||||
_t.current[fId] = factory.outputNumber;
|
||||
}
|
||||
|
||||
return {
|
||||
chipInvest,
|
||||
// ftoInvest,
|
||||
@@ -424,27 +472,39 @@ function splitCurrentAndPrevious(factoryListResponse, targetListResponse, prodOu
|
||||
stdOutput,
|
||||
bipvOutput,
|
||||
};
|
||||
}else{
|
||||
return {
|
||||
chipInvest,
|
||||
// ftoInvest,
|
||||
ftoInvest,
|
||||
chipOutput,
|
||||
stdOutput,
|
||||
bipvOutput,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getFactoryId(factory) {
|
||||
return factory.factory;
|
||||
}
|
||||
function getPreFactoryId(factory) {
|
||||
return factory.previousFactory;
|
||||
}
|
||||
|
||||
function getFactoryTargetValue(targetList, factoryId) {
|
||||
const target = targetList.find((item) => item.factory === factoryId);
|
||||
if (target) {
|
||||
return {
|
||||
// 自带模拟数据了.... random_default
|
||||
chipYield: target.chipYield ?? random_default(),
|
||||
componentYield: target.componentYield ?? random_default(),
|
||||
bipvProductOutput: target.bipvProductOutput ?? random_default(),
|
||||
chipYield: target.chipYield ?? 0,
|
||||
componentYield: target.componentYield ?? 0,
|
||||
bipvProductOutput: target.bipvProductOutput ?? 0,
|
||||
};
|
||||
}
|
||||
return {
|
||||
chipYield: random_default(),
|
||||
componentYield: random_default(),
|
||||
bipvProductOutput: random_default(),
|
||||
chipYield: 0,
|
||||
componentYield: 0,
|
||||
bipvProductOutput: 0,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -458,15 +518,18 @@ function getFactoryTargetValueA(targetList, factoryId) {
|
||||
const target = targetList.find((item) => item.factory === factoryId)
|
||||
if (target) {
|
||||
return {
|
||||
chipYieldRate: target.chipYieldRate ?? random_default(),
|
||||
componentYieldRate: target.componentYieldRate ?? random_default(),
|
||||
componentYield: target.componentYield ?? random_default(),
|
||||
chipYieldRate: target.chipYieldRate ?? 0,
|
||||
componentYieldRate: target.componentYieldRate ?? 0,
|
||||
componentYield: target.componentYield ?? 0,
|
||||
// componentYield: target.componentYield ?? 0,
|
||||
chipOee: target.chipOee ?? 0,
|
||||
};
|
||||
}
|
||||
return {
|
||||
chipYieldRate:0,
|
||||
componentYieldRate:0,
|
||||
componentYield:0 ,
|
||||
componentYield: 0,
|
||||
chipOee:0,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -480,18 +543,18 @@ function initA() {
|
||||
previous: Array(7).fill(0),
|
||||
};
|
||||
// 芯片OEE
|
||||
const chipOee = deepClone(t_);
|
||||
// 转化效率
|
||||
const transformRate = deepClone(t_);
|
||||
// 标准组件良率
|
||||
const stdRate = {
|
||||
...deepClone(t_),
|
||||
target: Array(7).fill(0),
|
||||
};
|
||||
// 芯片良率
|
||||
const transformRate = deepClone(stdRate);
|
||||
const chipRate = deepClone(stdRate);
|
||||
const chipOeeRate = deepClone(stdRate);
|
||||
return {
|
||||
chipOee,
|
||||
chipOeeRate,
|
||||
transformRate,
|
||||
chipRate,
|
||||
stdRate,
|
||||
@@ -544,6 +607,7 @@ async function getHomeInfo() {
|
||||
const { code, data } = await axios.post("ip/prod-output/cockpitData", {
|
||||
factorys: [],
|
||||
date: 4,
|
||||
mode:0
|
||||
});
|
||||
if (code == 0) {
|
||||
return data;
|
||||
@@ -609,16 +673,16 @@ async function doFetch(copilot_module = "yield", fetch_target, params) {
|
||||
* @param {*} target 是否获取目标数据
|
||||
* @returns
|
||||
*/
|
||||
function getCopilotYield(period, target = false) {
|
||||
return getCopilotData("yield", period, target);
|
||||
function getCopilotYield(period,than,target = false) {
|
||||
return getCopilotData("yield", period,than, target);
|
||||
}
|
||||
|
||||
function getCopilotEnergy(period, target = false) {
|
||||
return getCopilotData("energy", period, target);
|
||||
return getCopilotData("energy", period,than, target);
|
||||
}
|
||||
|
||||
function getCopilotEfficiency(period, target = false) {
|
||||
return getCopilotData("efficiency", period, target);
|
||||
function getCopilotEfficiency(period,than, target = false) {
|
||||
return getCopilotData("efficiency", period,than, target);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -627,12 +691,13 @@ function getCopilotEfficiency(period, target = false) {
|
||||
* @param {*} target 是否获取目标数据:默认 否
|
||||
* @returns
|
||||
*/
|
||||
async function getCopilotData(copilot_module, period, target = false) {
|
||||
async function getCopilotData(copilot_module, period,than, target = false) {
|
||||
if (!copilot_module) copilot_module = "yield";
|
||||
// 请求参数,直接一次性获取所有工厂
|
||||
let queryParams = {
|
||||
factorys: [],
|
||||
date: 4,
|
||||
mode:0
|
||||
};
|
||||
|
||||
switch (period) {
|
||||
@@ -652,7 +717,14 @@ async function getCopilotData(copilot_module, period, target = false) {
|
||||
queryParams.date = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (than) {
|
||||
case "同比":
|
||||
queryParams.mode = 0;
|
||||
break;
|
||||
case "环比":
|
||||
queryParams.mode = 1;
|
||||
break;
|
||||
}
|
||||
return {
|
||||
data: await doFetch(copilot_module, target ? true : false, queryParams),
|
||||
type: copilot_module,
|
||||
|
||||
Reference in New Issue
Block a user