Spaces:
Running
Running
| /** | |
| * Copyright (c) 2017~2021, OBCon Inc. | |
| * All rights reserved. | |
| */ | |
| /** | |
| * @file | |
| * @copyright 2017~2021, OBCon Inc. | |
| * @author gye hyun james kim [pnuskgh@gmail.com] | |
| */ | |
| const Sequelize = require('sequelize'); //--- http://docs.sequelizejs.com/ | |
| const Model = utils.getClass('include', 'model.js'); | |
| class DevicedataAsModel extends Model { | |
| constructor() { | |
| super(); | |
| this._title = '두께측정장비'; | |
| if ((config.service.name == 'service_scada_caprotec') || (config.service.name == 'service_scada_ursc')) { | |
| this._title = '두께측정장치'; | |
| } | |
| this._database = db.db_scada; | |
| this._tableName = 'devicedataA'; | |
| this._define = config.databases.scada.define; | |
| this._timestamps = false; //--- createdAt, updatedAt 필드를 사용하지 않는다. | |
| } | |
| get fields() { | |
| return { | |
| siteKey: { //--- 사이트 아이디 | |
| type: Sequelize.STRING(8), | |
| allowNull: false, | |
| unique: false, | |
| validate: { | |
| }, | |
| title: '사이트', | |
| strType: 'string' | |
| }, | |
| type: { //--- 단말기 타입 | |
| type: Sequelize.STRING(2), | |
| allowNull: false, | |
| defaultValue: '8', | |
| validate: { | |
| }, | |
| title: '단말기 타입', | |
| strType: 'select', | |
| enum: this.getTypeEnum() | |
| }, | |
| deviceKey: { //--- 장비 아이디, RTU ID | |
| type: Sequelize.STRING(8), | |
| allowNull: false, | |
| unique: false, | |
| validate: { | |
| }, | |
| title: '아이디', | |
| strType: 'string' | |
| }, | |
| statusDatetime: { //--- 장비 상태 수집 일자 (YYYYMMDDHHmmss) | |
| type: Sequelize.STRING(14), | |
| allowNull: true, | |
| validate: { | |
| }, | |
| title: '발생일자', | |
| strType: 'string' | |
| }, | |
| dataMode: { | |
| type: Sequelize.STRING(1), | |
| allowNull: true, | |
| validate: { | |
| }, | |
| title: '데이터 모드', | |
| strType: 'string', | |
| enum: [ | |
| ['3', '3. 통신주기(분)/수집주기(분)'], | |
| ['5', '5. 통신주기(시)/수집주기(분)'], | |
| ['6', '6. 통신주기(시)/수집주기(시)'] | |
| ] | |
| }, | |
| dataCycle: { | |
| type: Sequelize.INTEGER(2), | |
| allowNull: true, | |
| defaultValue: 0.0, | |
| validate: { | |
| }, | |
| title: '수집 주기', | |
| strType: 'integer' | |
| }, | |
| networkCycle: { | |
| type: Sequelize.INTEGER(2), | |
| allowNull: true, | |
| defaultValue: 0.0, | |
| validate: { | |
| }, | |
| title: '통신 주기', | |
| strType: 'integer' | |
| }, | |
| ai1: { | |
| type: Sequelize.FLOAT, | |
| allowNull: true, | |
| defaultValue: 0.0, | |
| validate: { | |
| }, | |
| title: '센서 1 두께', | |
| strType: 'float' | |
| }, | |
| ai2: { | |
| type: Sequelize.FLOAT, | |
| allowNull: true, | |
| defaultValue: 0.0, | |
| validate: { | |
| }, | |
| title: '센서 2 두께', | |
| strType: 'float' | |
| }, | |
| ai3: { | |
| type: Sequelize.FLOAT, | |
| allowNull: true, | |
| defaultValue: 0.0, | |
| validate: { | |
| }, | |
| title: '센서 3 두께', | |
| strType: 'float' | |
| }, | |
| ai4: { | |
| type: Sequelize.FLOAT, | |
| allowNull: true, | |
| defaultValue: 0.0, | |
| validate: { | |
| }, | |
| title: '센서 4 두께', | |
| strType: 'float' | |
| }, | |
| ai5: { | |
| type: Sequelize.FLOAT, | |
| allowNull: true, | |
| defaultValue: 0.0, | |
| validate: { | |
| }, | |
| title: '센서 1 신호세기', | |
| strType: 'float' | |
| }, | |
| ai6: { | |
| type: Sequelize.FLOAT, | |
| allowNull: true, | |
| defaultValue: 0.0, | |
| validate: { | |
| }, | |
| title: '센서 2 신호세기', | |
| strType: 'float' | |
| }, | |
| ai7: { | |
| type: Sequelize.FLOAT, | |
| allowNull: true, | |
| defaultValue: 0.0, | |
| validate: { | |
| }, | |
| title: '센서 3 신호세기', | |
| strType: 'float' | |
| }, | |
| ai8: { | |
| type: Sequelize.FLOAT, | |
| allowNull: true, | |
| defaultValue: 0.0, | |
| validate: { | |
| }, | |
| title: '센서 4 신호세기', | |
| strType: 'float' | |
| }, | |
| ai9: { | |
| type: Sequelize.FLOAT, | |
| allowNull: true, | |
| defaultValue: 0.0, | |
| validate: { | |
| }, | |
| title: '센서 1 온도', | |
| strType: 'float' | |
| }, | |
| ai10: { | |
| type: Sequelize.FLOAT, | |
| allowNull: true, | |
| defaultValue: 0.0, | |
| validate: { | |
| }, | |
| title: '센서 2 온도', | |
| strType: 'float' | |
| }, | |
| ai11: { | |
| type: Sequelize.FLOAT, | |
| allowNull: true, | |
| defaultValue: 0.0, | |
| validate: { | |
| }, | |
| title: '센서 3 온도', | |
| strType: 'float' | |
| }, | |
| ai12: { | |
| type: Sequelize.FLOAT, | |
| allowNull: true, | |
| defaultValue: 0.0, | |
| validate: { | |
| }, | |
| title: '센서 4 온도', | |
| strType: 'float' | |
| }, | |
| ai13: { | |
| type: Sequelize.FLOAT, | |
| allowNull: true, | |
| defaultValue: 0.0, | |
| validate: { | |
| }, | |
| title: '에러 코드', | |
| strType: 'float' | |
| }, | |
| batteryVoltage: { | |
| type: Sequelize.FLOAT, | |
| allowNull: true, | |
| defaultValue: 0.0, | |
| validate: { | |
| }, | |
| title: '배터리 전압', | |
| strType: 'float' | |
| }, | |
| sensitivity: { | |
| type: Sequelize.FLOAT, | |
| allowNull: true, | |
| defaultValue: 0.0, | |
| validate: { | |
| }, | |
| title: '수신 감도', | |
| strType: 'float' | |
| } | |
| }; | |
| } | |
| } | |
| module.exports = DevicedataAsModel; | |