Browse Source

控制修改

master
wenlele 1 year ago
parent
commit
fa06d705f8
  1. 82
      api/app/lib/schedule/workorder_statistics.js

82
api/app/lib/schedule/workorder_statistics.js

@ -23,7 +23,7 @@ module.exports = function (app, opts) {
let data = await getAnxinyunToken(app) let data = await getAnxinyunToken(app)
console.log(1111, data); // console.log(1111, data);
//获取所有泵站 //获取所有泵站
let structureList = await app.fs.anxinyun.get(`organizations/${data.orgId}/structures?token=${data.token}`) || [] let structureList = await app.fs.anxinyun.get(`organizations/${data.orgId}/structures?token=${data.token}`) || []
@ -217,47 +217,47 @@ module.exports = function (app, opts) {
currentSix['struc' + strucOne.id] = JSON.stringify(current.stations) currentSix['struc' + strucOne.id] = JSON.stringify(current.stations)
// let threedata = [] let threedata = []
// let timeSet = new Set() let timeSet = new Set()
// if (current.stations && current.stations.length) { if (current.stations && current.stations.length) {
// current.stations.map(p => { current.stations.map(p => {
// p.data.map(s => { p.data.map(s => {
// timeSet.add(moment(s.time).format('YYYY-MM-DD HH:mm:ss')) timeSet.add(moment(s.time).format('YYYY-MM-DD HH:mm:ss'))
// }) })
// }) })
// let time = [...timeSet].sort((a, b) => moment(a).isBefore(b) ? -1 : 1) let time = [...timeSet].sort((a, b) => moment(a).isBefore(b) ? -1 : 1)
// time.map(x => { time.map(x => {
// let A = [] let A = []
// let B = [] let B = []
// let C = [] let C = []
// current.stations.map((s, index) => { current.stations.map((s, index) => {
// let abcData = s.data.find(f => moment(f.time).format('YYYY-MM-DD HH:mm:ss') == x) || {} let abcData = s.data.find(f => moment(f.time).format('YYYY-MM-DD HH:mm:ss') == x) || {}
// let a = abcData.eMotor_A_A let a = abcData.eMotor_A_A
// let b = abcData.eMotor_B_A let b = abcData.eMotor_B_A
// let c = abcData.eMotor_C_A let c = abcData.eMotor_C_A
// if (a) A.push(a) if (a) A.push(a)
// if (b) B.push(b) if (b) B.push(b)
// if (c) C.push(c) if (c) C.push(c)
// }) })
// const sum = (arr) => { const sum = (arr) => {
// let sum = 0 let sum = 0
// arr.map(h => { arr.map(h => {
// sum += h sum += h
// }) })
// return sum return sum
// } }
// threedata.push({ threedata.push({
// A: A.length && (sum(A) / A.length) || null, A: A.length && (sum(A) / A.length) || null,
// B: B.length && (sum(B) / B.length) || null, B: B.length && (sum(B) / B.length) || null,
// C: C.length && (sum(C) / C.length) || null, C: C.length && (sum(C) / C.length) || null,
// time: x time: x
// }) })
// }) })
// } }
// threePhase['struc' + strucOne.id] = JSON.stringify(threedata) threePhase['struc' + strucOne.id] = JSON.stringify(threedata)
} }
@ -417,7 +417,7 @@ module.exports = function (app, opts) {
await app.redis.hmset("pumpStation_capacity", capacity) await app.redis.hmset("pumpStation_capacity", capacity)
await app.redis.hmset("pumpStation_currentSix", currentSix) await app.redis.hmset("pumpStation_currentSix", currentSix)
await app.redis.hmset("pumpStation_cabinet", cabinet) await app.redis.hmset("pumpStation_cabinet", cabinet)
// await app.redis.hmset("pumpStation_threePhase", threePhase) await app.redis.hmset("pumpStation_threePhase", threePhase)
} }

Loading…
Cancel
Save