const Service = require('egg').Service; class Tgdp extends Service { async index(){ let task = await this.app.mysql.get('dblocal').query(`select * from ye4s_warehouse`); return task; } async getUserinfo(){ const {ctx} = this; let task = await ctx.app.wsdl('getPDAUser',['caige01', 'wu123456']); let data = JSON.parse(task.return); data.push(ctx.state.user); data.push(ctx.state.wmsuser); let rules = ctx.state.rules; return data; } async getAllinfo(wareHouseId){ const jhList = await this.ctx.service.query.jhList(wareHouseId); const fhList = await this.ctx.service.query.fhList(wareHouseId); const ddbList = await this.ctx.service.query.ddbList(wareHouseId); const dfhList = await this.ctx.service.query.dfhList(wareHouseId); const djhList = await this.ctx.service.query.djhList(wareHouseId); const dllList = await this.ctx.service.query.dllList(wareHouseId); const gztList = await this.ctx.service.query.getGzts(wareHouseId); const warehouseName = await this.ctx.service.query.getwarehouseName(wareHouseId); return { jhList: jhList, fhList:fhList, ddbList:ddbList, dfhList:dfhList, djhList:djhList, dllList:dllList, gztList:gztList, warehouseName:warehouseName } } async AllList(){ const {ctx} = this; const data = await this.getAllinfo(ctx.socket.userinfo.warehouseid); return data; } async dll(){ const {ctx} = this; const dllList = await this.ctx.service.query.dllList(ctx.socket.userinfo.warehouseid); return dllList; } async getUserInfo(){ const {ctx} = this; return [ctx.socket.userinfo,ctx.socket.istgdp]; } async init(token){ return token; } async checkOnline(){ const {ctx,app} = this; let list = await this.app.redis.get('cache').lrange("tgdp_user_5400", 0, -1); let socketIds = this.app.io.of('/').sockets; let list2 = []; for(let socketId in socketIds){ list2.push(socketId); } for(let i=0;i