Compare commits
1 Commits
master
...
use_getExp
Author | SHA1 | Date |
---|---|---|
Alex Moreno | 64e90b9d61 |
|
@ -1,2 +1,2 @@
|
||||||
node_modules
|
node_modules
|
||||||
config.*.yml
|
config.local.yml
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
// Carácter predeterminado de final de línea.
|
// Carácter predeterminado de final de línea.
|
||||||
"files.eol": "\n",
|
"files.eol": "\n",
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll.eslint": "explicit"
|
"source.fixAll.eslint": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,6 @@ COPY package.json ./
|
||||||
RUN npm install
|
RUN npm install
|
||||||
COPY db db
|
COPY db db
|
||||||
COPY src src
|
COPY src src
|
||||||
COPY util util
|
COPY config.yml ./
|
||||||
COPY \
|
COPY server.js ./
|
||||||
server.js \
|
|
||||||
config.yml \
|
|
||||||
npm-config.npmrc \
|
|
||||||
./
|
|
||||||
CMD ["node", "server.js"]
|
CMD ["node", "server.js"]
|
|
@ -2,54 +2,64 @@
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
|
options {
|
||||||
|
disableConcurrentBuilds()
|
||||||
|
}
|
||||||
environment {
|
environment {
|
||||||
PROJECT_NAME = 'vn-rfid'
|
PROJECT_NAME = 'vn-rfid'
|
||||||
|
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Setup') {
|
stage('Checkout') {
|
||||||
steps {
|
steps {
|
||||||
echo "NODE_NAME: ${env.NODE_NAME}"
|
script {
|
||||||
echo "WORKSPACE: ${env.WORKSPACE}"
|
switch (env.BRANCH_NAME) {
|
||||||
|
case 'master':
|
||||||
|
env.NODE_ENV = 'production'
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setEnv()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
when {
|
when { anyOf {
|
||||||
branch 'master'
|
branch 'master'
|
||||||
}
|
}}
|
||||||
environment {
|
environment {
|
||||||
CREDENTIALS = credentials('docker-registry')
|
CREDENTIALS = credentials('docker-registry')
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
|
||||||
def packageJson = readJSON file: 'package.json'
|
|
||||||
env.VERSION = packageJson.version
|
|
||||||
}
|
|
||||||
dockerBuild()
|
dockerBuild()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Deploy') {
|
stage('Deploy') {
|
||||||
when {
|
when { anyOf {
|
||||||
branch 'master'
|
branch 'master'
|
||||||
|
}}
|
||||||
|
environment {
|
||||||
|
DOCKER_HOST = "${env.SWARM_HOST}"
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}"
|
||||||
def packageJson = readJSON file: 'package.json'
|
|
||||||
env.VERSION = packageJson.version
|
|
||||||
}
|
|
||||||
withKubeConfig([
|
|
||||||
serverUrl: "$KUBERNETES_API",
|
|
||||||
credentialsId: 'kubernetes',
|
|
||||||
namespace: 'vn-rfid'
|
|
||||||
]) {
|
|
||||||
sh 'kubectl set image deployment/vn-rfid vn-rfid=$REGISTRY/vn-rfid:$VERSION'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
setEnv()
|
script {
|
||||||
sendEmail()
|
if (!env.COMMITTER_EMAIL || currentBuild.currentResult == 'SUCCESS') return;
|
||||||
|
try {
|
||||||
|
mail(
|
||||||
|
to: env.COMMITTER_EMAIL,
|
||||||
|
subject: "Pipeline: ${env.JOB_NAME} (${env.BUILD_NUMBER}): ${currentBuild.currentResult}",
|
||||||
|
body: "Check status at ${env.BUILD_URL}"
|
||||||
|
)
|
||||||
|
} catch (e) {
|
||||||
|
echo e.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,12 +11,9 @@ $ sudo npm install -g pino-pretty
|
||||||
Launch application in developer environment.
|
Launch application in developer environment.
|
||||||
```
|
```
|
||||||
$ npm run start
|
$ npm run start
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
$ npm run start | pino-pretty
|
|
||||||
```
|
```
|
||||||
|
|
||||||
For test.
|
For test.
|
||||||
```
|
```
|
||||||
DELETE expedition in vn.expeditionScan
|
DELETE expedition in vn.expeditionScan
|
||||||
|
```
|
|
@ -1,14 +1,13 @@
|
||||||
arcId: 1
|
|
||||||
port: 1234
|
port: 1234
|
||||||
ip: 1.2.3.4
|
ip: 1.2.3.4
|
||||||
env: dev
|
env: dev
|
||||||
interval: 3000
|
interval: 1000
|
||||||
reconnectInterval: 5000
|
reconnectInterval: 5000
|
||||||
counterInterval: 1000
|
|
||||||
db:
|
db:
|
||||||
host: host
|
host: host
|
||||||
port: 3307
|
port: 3307
|
||||||
|
database: srt
|
||||||
user: user
|
user: user
|
||||||
password: password
|
password: password
|
||||||
multipleStatements: false
|
multipleStatements: true
|
||||||
insecureAuth: true
|
insecureAuth: true
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
import mysql from 'mysql2/promise';
|
|
||||||
import getConfig from '../util/getConfig.js';
|
|
||||||
export default mysql.createPool(getConfig('production').db);
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
import con from '../connect.js';
|
|
||||||
|
|
||||||
export default async() => {
|
|
||||||
const [arcs] = await con.query(`SELECT id as arcId, printerFk, ip, minimum FROM vn.arcRead;`);
|
|
||||||
return arcs;
|
|
||||||
};
|
|
|
@ -1,7 +1,20 @@
|
||||||
version: '3.7'
|
version: '3.7'
|
||||||
services:
|
services:
|
||||||
main:
|
main:
|
||||||
image: registry.verdnatura.es/vn-rfid:${VERSION:?}
|
image: registry.verdnatura.es/vn-rfid:${BRANCH_NAME:?}
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- 8888
|
||||||
|
configs:
|
||||||
|
- source: config
|
||||||
|
target: /app/config.local.yml
|
||||||
|
deploy:
|
||||||
|
placement:
|
||||||
|
constraints:
|
||||||
|
- node.role == worker
|
||||||
|
configs:
|
||||||
|
config:
|
||||||
|
external: true
|
||||||
|
name: vn-rfid_config
|
|
@ -1 +0,0 @@
|
||||||
engine-strict=true
|
|
|
@ -598,11 +598,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
||||||
},
|
},
|
||||||
"node_modules/colorette": {
|
|
||||||
"version": "2.0.19",
|
|
||||||
"resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.19.tgz",
|
|
||||||
"integrity": "sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ=="
|
|
||||||
},
|
|
||||||
"node_modules/concat-map": {
|
"node_modules/concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||||
|
@ -658,14 +653,6 @@
|
||||||
"node": ">= 8"
|
"node": ">= 8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/dateformat": {
|
|
||||||
"version": "4.6.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.6.3.tgz",
|
|
||||||
"integrity": "sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==",
|
|
||||||
"engines": {
|
|
||||||
"node": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/debug": {
|
"node_modules/debug": {
|
||||||
"version": "4.3.4",
|
"version": "4.3.4",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||||
|
@ -1088,11 +1075,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||||
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
|
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
|
||||||
},
|
},
|
||||||
"node_modules/fast-copy": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/fast-copy/-/fast-copy-3.0.0.tgz",
|
|
||||||
"integrity": "sha512-4HzS+9pQ5Yxtv13Lhs1Z1unMXamBdn5nA4bEi1abYpDNSpSp7ODYQ1KPMF6nTatfEzgH6/zPvXKU1zvHiUjWlA=="
|
|
||||||
},
|
|
||||||
"node_modules/fast-deep-equal": {
|
"node_modules/fast-deep-equal": {
|
||||||
"version": "3.1.3",
|
"version": "3.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||||
|
@ -1116,11 +1098,6 @@
|
||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/fast-safe-stringify": {
|
|
||||||
"version": "2.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz",
|
|
||||||
"integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA=="
|
|
||||||
},
|
|
||||||
"node_modules/file-entry-cache": {
|
"node_modules/file-entry-cache": {
|
||||||
"version": "6.0.1",
|
"version": "6.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
|
||||||
|
@ -1385,73 +1362,6 @@
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/help-me": {
|
|
||||||
"version": "4.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/help-me/-/help-me-4.2.0.tgz",
|
|
||||||
"integrity": "sha512-TAOnTB8Tz5Dw8penUuzHVrKNKlCIbwwbHnXraNJxPwf8LRtE2HlM84RYuezMFcwOJmoYOCWVDyJ8TQGxn9PgxA==",
|
|
||||||
"dependencies": {
|
|
||||||
"glob": "^8.0.0",
|
|
||||||
"readable-stream": "^3.6.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/help-me/node_modules/brace-expansion": {
|
|
||||||
"version": "2.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
|
||||||
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
|
|
||||||
"dependencies": {
|
|
||||||
"balanced-match": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/help-me/node_modules/glob": {
|
|
||||||
"version": "8.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz",
|
|
||||||
"integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"fs.realpath": "^1.0.0",
|
|
||||||
"inflight": "^1.0.4",
|
|
||||||
"inherits": "2",
|
|
||||||
"minimatch": "^5.0.1",
|
|
||||||
"once": "^1.3.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/isaacs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/help-me/node_modules/minimatch": {
|
|
||||||
"version": "5.1.6",
|
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
|
|
||||||
"integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
|
|
||||||
"dependencies": {
|
|
||||||
"brace-expansion": "^2.0.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/help-me/node_modules/readable-stream": {
|
|
||||||
"version": "3.6.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
|
||||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
|
||||||
"dependencies": {
|
|
||||||
"inherits": "^2.0.3",
|
|
||||||
"string_decoder": "^1.1.1",
|
|
||||||
"util-deprecate": "^1.0.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/help-me/node_modules/string_decoder": {
|
|
||||||
"version": "1.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
|
||||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
|
||||||
"dependencies": {
|
|
||||||
"safe-buffer": "~5.2.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/http-cache-semantics": {
|
"node_modules/http-cache-semantics": {
|
||||||
"version": "4.1.0",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
|
||||||
|
@ -1638,14 +1548,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||||
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="
|
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="
|
||||||
},
|
},
|
||||||
"node_modules/joycon": {
|
|
||||||
"version": "3.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz",
|
|
||||||
"integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/js-tokens": {
|
"node_modules/js-tokens": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||||
|
@ -1813,14 +1715,6 @@
|
||||||
"node": "*"
|
"node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/minimist": {
|
|
||||||
"version": "1.2.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz",
|
|
||||||
"integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==",
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/ms": {
|
"node_modules/ms": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||||
|
@ -2179,44 +2073,6 @@
|
||||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/pino-pretty": {
|
|
||||||
"version": "9.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/pino-pretty/-/pino-pretty-9.1.1.tgz",
|
|
||||||
"integrity": "sha512-iJrnjgR4FWQIXZkUF48oNgoRI9BpyMhaEmihonHeCnZ6F50ZHAS4YGfGBT/ZVNsPmd+hzkIPGzjKdY08+/yAXw==",
|
|
||||||
"dependencies": {
|
|
||||||
"colorette": "^2.0.7",
|
|
||||||
"dateformat": "^4.6.3",
|
|
||||||
"fast-copy": "^3.0.0",
|
|
||||||
"fast-safe-stringify": "^2.1.1",
|
|
||||||
"help-me": "^4.0.1",
|
|
||||||
"joycon": "^3.1.1",
|
|
||||||
"minimist": "^1.2.6",
|
|
||||||
"on-exit-leak-free": "^2.1.0",
|
|
||||||
"pino-abstract-transport": "^1.0.0",
|
|
||||||
"pump": "^3.0.0",
|
|
||||||
"readable-stream": "^4.0.0",
|
|
||||||
"secure-json-parse": "^2.4.0",
|
|
||||||
"sonic-boom": "^3.0.0",
|
|
||||||
"strip-json-comments": "^3.1.1"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"pino-pretty": "bin.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/pino-pretty/node_modules/readable-stream": {
|
|
||||||
"version": "4.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.3.0.tgz",
|
|
||||||
"integrity": "sha512-MuEnA0lbSi7JS8XM+WNJlWZkHAAdm7gETHdFK//Q/mChGyj2akEFtdLZh32jSdkWGbRwCW9pn6g3LWDdDeZnBQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"abort-controller": "^3.0.0",
|
|
||||||
"buffer": "^6.0.3",
|
|
||||||
"events": "^3.3.0",
|
|
||||||
"process": "^0.11.10"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/pino-std-serializers": {
|
"node_modules/pino-std-serializers": {
|
||||||
"version": "6.1.0",
|
"version": "6.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-6.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-6.1.0.tgz",
|
||||||
|
@ -2510,11 +2366,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||||
},
|
},
|
||||||
"node_modules/secure-json-parse": {
|
|
||||||
"version": "2.7.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.7.0.tgz",
|
|
||||||
"integrity": "sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw=="
|
|
||||||
},
|
|
||||||
"node_modules/semver": {
|
"node_modules/semver": {
|
||||||
"version": "7.3.8",
|
"version": "7.3.8",
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
|
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
|
||||||
|
@ -2890,11 +2741,6 @@
|
||||||
"punycode": "^2.1.0"
|
"punycode": "^2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/util-deprecate": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
|
||||||
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
|
|
||||||
},
|
|
||||||
"node_modules/utils-merge": {
|
"node_modules/utils-merge": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
||||||
|
@ -3376,11 +3222,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
||||||
},
|
},
|
||||||
"colorette": {
|
|
||||||
"version": "2.0.19",
|
|
||||||
"resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.19.tgz",
|
|
||||||
"integrity": "sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ=="
|
|
||||||
},
|
|
||||||
"concat-map": {
|
"concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||||
|
@ -3424,11 +3265,6 @@
|
||||||
"which": "^2.0.1"
|
"which": "^2.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dateformat": {
|
|
||||||
"version": "4.6.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.6.3.tgz",
|
|
||||||
"integrity": "sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA=="
|
|
||||||
},
|
|
||||||
"debug": {
|
"debug": {
|
||||||
"version": "4.3.4",
|
"version": "4.3.4",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||||
|
@ -3743,11 +3579,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"fast-copy": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/fast-copy/-/fast-copy-3.0.0.tgz",
|
|
||||||
"integrity": "sha512-4HzS+9pQ5Yxtv13Lhs1Z1unMXamBdn5nA4bEi1abYpDNSpSp7ODYQ1KPMF6nTatfEzgH6/zPvXKU1zvHiUjWlA=="
|
|
||||||
},
|
|
||||||
"fast-deep-equal": {
|
"fast-deep-equal": {
|
||||||
"version": "3.1.3",
|
"version": "3.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||||
|
@ -3768,11 +3599,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.1.2.tgz",
|
||||||
"integrity": "sha512-+0em+Iya9fKGfEQGcd62Yv6onjBmmhV1uh86XVfOU8VwAe6kaFdQCWI9s0/Nnugx5Vd9tdbZ7e6gE2tR9dzXdw=="
|
"integrity": "sha512-+0em+Iya9fKGfEQGcd62Yv6onjBmmhV1uh86XVfOU8VwAe6kaFdQCWI9s0/Nnugx5Vd9tdbZ7e6gE2tR9dzXdw=="
|
||||||
},
|
},
|
||||||
"fast-safe-stringify": {
|
|
||||||
"version": "2.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz",
|
|
||||||
"integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA=="
|
|
||||||
},
|
|
||||||
"file-entry-cache": {
|
"file-entry-cache": {
|
||||||
"version": "6.0.1",
|
"version": "6.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
|
||||||
|
@ -3969,63 +3795,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
|
||||||
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="
|
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="
|
||||||
},
|
},
|
||||||
"help-me": {
|
|
||||||
"version": "4.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/help-me/-/help-me-4.2.0.tgz",
|
|
||||||
"integrity": "sha512-TAOnTB8Tz5Dw8penUuzHVrKNKlCIbwwbHnXraNJxPwf8LRtE2HlM84RYuezMFcwOJmoYOCWVDyJ8TQGxn9PgxA==",
|
|
||||||
"requires": {
|
|
||||||
"glob": "^8.0.0",
|
|
||||||
"readable-stream": "^3.6.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"brace-expansion": {
|
|
||||||
"version": "2.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
|
||||||
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
|
|
||||||
"requires": {
|
|
||||||
"balanced-match": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"glob": {
|
|
||||||
"version": "8.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz",
|
|
||||||
"integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==",
|
|
||||||
"requires": {
|
|
||||||
"fs.realpath": "^1.0.0",
|
|
||||||
"inflight": "^1.0.4",
|
|
||||||
"inherits": "2",
|
|
||||||
"minimatch": "^5.0.1",
|
|
||||||
"once": "^1.3.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"minimatch": {
|
|
||||||
"version": "5.1.6",
|
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
|
|
||||||
"integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
|
|
||||||
"requires": {
|
|
||||||
"brace-expansion": "^2.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"readable-stream": {
|
|
||||||
"version": "3.6.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
|
||||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
|
||||||
"requires": {
|
|
||||||
"inherits": "^2.0.3",
|
|
||||||
"string_decoder": "^1.1.1",
|
|
||||||
"util-deprecate": "^1.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"string_decoder": {
|
|
||||||
"version": "1.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
|
||||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
|
||||||
"requires": {
|
|
||||||
"safe-buffer": "~5.2.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"http-cache-semantics": {
|
"http-cache-semantics": {
|
||||||
"version": "4.1.0",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
|
||||||
|
@ -4159,11 +3928,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||||
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="
|
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="
|
||||||
},
|
},
|
||||||
"joycon": {
|
|
||||||
"version": "3.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz",
|
|
||||||
"integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw=="
|
|
||||||
},
|
|
||||||
"js-tokens": {
|
"js-tokens": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||||
|
@ -4293,11 +4057,6 @@
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"minimist": {
|
|
||||||
"version": "1.2.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz",
|
|
||||||
"integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g=="
|
|
||||||
},
|
|
||||||
"ms": {
|
"ms": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||||
|
@ -4578,40 +4337,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pino-pretty": {
|
|
||||||
"version": "9.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/pino-pretty/-/pino-pretty-9.1.1.tgz",
|
|
||||||
"integrity": "sha512-iJrnjgR4FWQIXZkUF48oNgoRI9BpyMhaEmihonHeCnZ6F50ZHAS4YGfGBT/ZVNsPmd+hzkIPGzjKdY08+/yAXw==",
|
|
||||||
"requires": {
|
|
||||||
"colorette": "^2.0.7",
|
|
||||||
"dateformat": "^4.6.3",
|
|
||||||
"fast-copy": "^3.0.0",
|
|
||||||
"fast-safe-stringify": "^2.1.1",
|
|
||||||
"help-me": "^4.0.1",
|
|
||||||
"joycon": "^3.1.1",
|
|
||||||
"minimist": "^1.2.6",
|
|
||||||
"on-exit-leak-free": "^2.1.0",
|
|
||||||
"pino-abstract-transport": "^1.0.0",
|
|
||||||
"pump": "^3.0.0",
|
|
||||||
"readable-stream": "^4.0.0",
|
|
||||||
"secure-json-parse": "^2.4.0",
|
|
||||||
"sonic-boom": "^3.0.0",
|
|
||||||
"strip-json-comments": "^3.1.1"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"readable-stream": {
|
|
||||||
"version": "4.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.3.0.tgz",
|
|
||||||
"integrity": "sha512-MuEnA0lbSi7JS8XM+WNJlWZkHAAdm7gETHdFK//Q/mChGyj2akEFtdLZh32jSdkWGbRwCW9pn6g3LWDdDeZnBQ==",
|
|
||||||
"requires": {
|
|
||||||
"abort-controller": "^3.0.0",
|
|
||||||
"buffer": "^6.0.3",
|
|
||||||
"events": "^3.3.0",
|
|
||||||
"process": "^0.11.10"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"pino-std-serializers": {
|
"pino-std-serializers": {
|
||||||
"version": "6.1.0",
|
"version": "6.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-6.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-6.1.0.tgz",
|
||||||
|
@ -4818,11 +4543,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||||
},
|
},
|
||||||
"secure-json-parse": {
|
|
||||||
"version": "2.7.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.7.0.tgz",
|
|
||||||
"integrity": "sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw=="
|
|
||||||
},
|
|
||||||
"semver": {
|
"semver": {
|
||||||
"version": "7.3.8",
|
"version": "7.3.8",
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
|
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
|
||||||
|
@ -5115,11 +4835,6 @@
|
||||||
"punycode": "^2.1.0"
|
"punycode": "^2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"util-deprecate": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
|
||||||
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
|
|
||||||
},
|
|
||||||
"utils-merge": {
|
"utils-merge": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
||||||
|
|
|
@ -3,14 +3,10 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"author": "Verdnatura Levante SL",
|
"author": "Verdnatura Levante SL",
|
||||||
"description": "rfid backend",
|
"description": "rfid backend",
|
||||||
"main": "server.js",
|
"main": "index.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "nodemon ./server.js | pino-pretty "
|
"start": "nodemon ./server.js"
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=18",
|
|
||||||
"npm": ">=8"
|
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
|
|
4906
pnpm-lock.yaml
4906
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
57
populate.sql
57
populate.sql
|
@ -1,57 +0,0 @@
|
||||||
INSERT INTO vn.arcRead (id, printerFk, ip, counter, error, minimum) VALUES(1, NULL, '10.1.16.1', 17, NULL, 5);
|
|
||||||
|
|
||||||
CREATE TABLE `rfidTest` (
|
|
||||||
`palletFk` int(11) DEFAULT NULL,
|
|
||||||
`expeditionFk` int(11) DEFAULT NULL,
|
|
||||||
`created` timestamp NULL DEFAULT current_timestamp(),
|
|
||||||
`peakRssi` int(11) DEFAULT NULL,
|
|
||||||
`antenna` int(11) DEFAULT NULL,
|
|
||||||
`attempt` int(11) DEFAULT NULL,
|
|
||||||
`power` int(11) DEFAULT NULL,
|
|
||||||
`sensitivity` int(11) DEFAULT NULL
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE `algorithm` (
|
|
||||||
`palletFk` int(11) DEFAULT NULL,
|
|
||||||
`expeditionArray` text DEFAULT NULL,
|
|
||||||
`created` timestamp NULL DEFAULT current_timestamp(),
|
|
||||||
`expeditionCount` int(11) DEFAULT NULL,
|
|
||||||
`model` text DEFAULT NULL,
|
|
||||||
`attempt` int(11) DEFAULT NULL,
|
|
||||||
`power` int(11) DEFAULT NULL
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- vn.trys definition
|
|
||||||
|
|
||||||
-- vn.trys definition
|
|
||||||
|
|
||||||
CREATE TABLE `vn`.`trys` (
|
|
||||||
`palletFk` int(11) NOT NULL,
|
|
||||||
`missing` text DEFAULT NULL,
|
|
||||||
`powerType` varchar(255) NOT NULL DEFAULT 'V17',
|
|
||||||
`extra` varchar(100) DEFAULT NULL,
|
|
||||||
`antennaReads` text DEFAULT NULL,
|
|
||||||
`observationExtra` text DEFAULT NULL,
|
|
||||||
`observationMissing` text DEFAULT NULL,
|
|
||||||
`timestamp` timestamp NULL DEFAULT current_timestamp(),
|
|
||||||
`antenna1` int(11) DEFAULT NULL,
|
|
||||||
`antenna2` int(11) DEFAULT NULL,
|
|
||||||
`antenna3` int(11) DEFAULT NULL,
|
|
||||||
`antenna4` int(11) DEFAULT NULL,
|
|
||||||
`total` varchar(100) DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`palletFk`,`powerType`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
|
||||||
|
|
||||||
|
|
||||||
CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`trys_beforeUpdate`
|
|
||||||
BEFORE UPDATE ON `trys`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
IF (NEW.missing > OLD.missing) THEN
|
|
||||||
CALL util.throw('New missing greater than old');
|
|
||||||
END IF;
|
|
||||||
END
|
|
||||||
-- powerTypes [PW13, PW15, V17, V19]
|
|
18
server.js
18
server.js
|
@ -1,21 +1,15 @@
|
||||||
import stream from './src/stream.js';
|
import stream from './src/stream.js';
|
||||||
import getConfig from './util/getConfig.js';
|
import getConfig from './util/getConfig.js';
|
||||||
import logger from 'pino';
|
import logger from 'pino';
|
||||||
import getArcs from './db/querys/getArcs.js';
|
|
||||||
|
|
||||||
console.logger = logger();
|
console.logger = logger();
|
||||||
|
|
||||||
async function main(arcId) {
|
function main() {
|
||||||
const conf = getConfig();
|
const conf = getConfig();
|
||||||
for (let arc of await getArcs()) {
|
|
||||||
const config = Object.assign({}, conf, arc);
|
stream(conf, e => {
|
||||||
if (arcId && arcId != arc.arcId) continue;
|
console.logger.error(e);
|
||||||
console.logger.info(`ARC_ID:${config.arcId} is running...`);
|
setTimeout(main, conf.reconnectInterval);
|
||||||
stream(config, e => {
|
});
|
||||||
console.logger.error(e);
|
|
||||||
setTimeout(main, config.reconnectInterval, config.arcId);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main();
|
main();
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
import con from '../db/connect.js';
|
|
||||||
let lastCounter;
|
|
||||||
|
|
||||||
export default async(size, arcId) => {
|
|
||||||
if (lastCounter == size) return;
|
|
||||||
console.logger.info(`COUNTER: SIZE:${size} ARC_ID:${arcId}`);
|
|
||||||
await con.query(`
|
|
||||||
UPDATE vn.arcRead
|
|
||||||
SET counter = ?,
|
|
||||||
error = NULL
|
|
||||||
WHERE id = ?;
|
|
||||||
`, [size, arcId]);
|
|
||||||
|
|
||||||
lastCounter = size;
|
|
||||||
};
|
|
|
@ -1,12 +1,13 @@
|
||||||
import con from '../db/connect.js';
|
import con from '../db/connect.js';
|
||||||
import t from '../util/translator.js';
|
|
||||||
|
|
||||||
export default async(rfids, arcId) => {
|
export default async rfids => {
|
||||||
try {
|
const codes = new Set();
|
||||||
console.log(Array.from(rfids));
|
for (let rfid of rfids)
|
||||||
await con.query(`CALL vn.expeditionPallet_build(JSON_ARRAY(?), ?, ?, @palletId);`, [Array.from(rfids), arcId, null]);
|
codes.add(rfid.code);
|
||||||
} catch (error) {
|
|
||||||
console.log(error);
|
console.logger.info('PRINTING...');
|
||||||
await con.query(`UPDATE vn.arcRead SET error = ?, counter = NULL WHERE id = ?;`, [t(error.sqlMessage), arcId]);
|
|
||||||
}
|
const palletId = await con.query(`SELECT vn.getExpeditionPallet_build(?,?,?);`, [Array.from(codes), 1, null]);
|
||||||
|
if (!palletId)
|
||||||
|
console.logger.info({error: 'ERROR_CREATING_PALLET', expeditions: rfids});
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,34 +2,28 @@ export default async data => {
|
||||||
data = data.toString();
|
data = data.toString();
|
||||||
const crudeRfids = data.split('\n');
|
const crudeRfids = data.split('\n');
|
||||||
|
|
||||||
const rfidsParsed = new Set();
|
const rfidsParsed = [];
|
||||||
const rfidsParsedExtended = [];
|
|
||||||
const RFID_PREFIX = 'AABB';
|
|
||||||
for (let crudeRfid of crudeRfids) {
|
for (let crudeRfid of crudeRfids) {
|
||||||
if (crudeRfid && /{.*:{.*:.*}}/.test(crudeRfid)) {
|
if (crudeRfid && /{.*:{.*:.*}}/.test(crudeRfid)) {
|
||||||
const jsonResult = JSON.parse(crudeRfid);
|
const jsonResult = JSON.parse(crudeRfid);
|
||||||
let epcHex = jsonResult?.tagInventoryEvent?.epcHex;
|
let epcHex = jsonResult?.tagInventoryEvent?.epcHex;
|
||||||
|
|
||||||
if (!epcHex) continue;
|
if (!epcHex) return;
|
||||||
if (epcHex.search(RFID_PREFIX) == -1) continue;
|
if (epcHex.search('AABB') == -1) continue;
|
||||||
|
|
||||||
epcHex = epcHex.replace(RFID_PREFIX, '');
|
epcHex = epcHex.replace('AABB', '');
|
||||||
epcHex = epcHex.substring(0, 1) == 0 ? epcHex.substring(1) : epcHex;
|
epcHex = epcHex.substring(0, 1) == 0 ? epcHex.substring(1) : epcHex;
|
||||||
|
|
||||||
const rfidParsed = {
|
const rfidParsed = {
|
||||||
code: parseInt(epcHex),
|
code: parseInt(epcHex),
|
||||||
created: jsonResult.timestamp,
|
created: jsonResult.timestamp,
|
||||||
peakRssi: jsonResult.tagInventoryEvent.peakRssiCdbm,
|
peakRssi: jsonResult.tagInventoryEvent.peakRssiCdbm,
|
||||||
count: 1,
|
count: 1,
|
||||||
antenna: jsonResult.tagInventoryEvent.antennaPort,
|
antenna: jsonResult.tagInventoryEvent.antennaPort
|
||||||
transmitPowerCdbm: jsonResult.tagInventoryEvent.transmitPowerCdbm
|
|
||||||
};
|
};
|
||||||
|
|
||||||
rfidsParsedExtended.push(rfidParsed);
|
rfidsParsed.push(rfidParsed);
|
||||||
rfidsParsed.add(rfidParsed.code);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {codes: rfidsParsed, extended: rfidsParsedExtended};
|
return rfidsParsed;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
import got from 'got';
|
import got from 'got';
|
||||||
import rfidParser from './rfidParser.js';
|
import rfidParser from './rfidParser.js';
|
||||||
import newPallet from './newPallet.js';
|
import newPallet from './newPallet.js';
|
||||||
import debug from '../util/debugStream.js';
|
import debug from '../util/streamDebug.js';
|
||||||
import counter from './counter.js';
|
|
||||||
|
|
||||||
let interval;
|
let interval;
|
||||||
let counterInterval;
|
|
||||||
|
|
||||||
export default async(conf, cb) => {
|
export default async(conf, cb) => {
|
||||||
let rfidbuffer = new Set();
|
let rfidbuffer = [];
|
||||||
let rfidbufferExtend = [];
|
let rfidbufferSet = [new Set(), new Set(), new Set(), new Set()];
|
||||||
|
|
||||||
const stream = got.stream(`http://${conf.ip}/api/v1/data/stream`);
|
const stream = got.stream(`http://${conf.ip}/api/v1/data/stream`);
|
||||||
|
|
||||||
|
@ -17,19 +15,15 @@ export default async(conf, cb) => {
|
||||||
.on('data', async value => {
|
.on('data', async value => {
|
||||||
const parsed = await rfidParser(value);
|
const parsed = await rfidParser(value);
|
||||||
|
|
||||||
if (!parsed.codes.size) return;
|
if (parsed)
|
||||||
rfidbuffer = new Set([...rfidbuffer, ...parsed.codes]);
|
rfidbuffer = rfidbuffer.concat(parsed);
|
||||||
rfidbufferExtend = rfidbufferExtend.concat(parsed.extended);
|
|
||||||
|
|
||||||
// debug({codes: rfidbuffer, extended: rfidbufferExtend}, conf);
|
debug(rfidbuffer, rfidbufferSet);
|
||||||
|
|
||||||
if (rfidbuffer.size) {
|
if (rfidbuffer.length && parsed.length) {
|
||||||
clearTimeout(interval);
|
clearInterval(interval);
|
||||||
interval = null;
|
interval = null;
|
||||||
interval = setTimeout(createPallet, conf.interval);
|
interval = setTimeout(createPallet, conf.interval);
|
||||||
|
|
||||||
if (!counterInterval)
|
|
||||||
counterInterval = setTimeout(counterIntervalManager, conf.counterInterval);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.on('error', e => {
|
.on('error', e => {
|
||||||
|
@ -37,17 +31,11 @@ export default async(conf, cb) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
function createPallet() {
|
function createPallet() {
|
||||||
clearTimeout(interval);
|
clearInterval(interval); // try remove
|
||||||
|
|
||||||
if (!conf.minimum || rfidbuffer.size > conf.minimum)
|
newPallet(rfidbuffer);
|
||||||
newPallet(rfidbuffer, conf.arcId);
|
|
||||||
rfidbuffer = new Set();
|
|
||||||
rfidbufferExtend = [];
|
|
||||||
counterIntervalManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
function counterIntervalManager() {
|
rfidbuffer = [];
|
||||||
counterInterval = null;
|
rfidbufferSet = [new Set(), new Set(), new Set(), new Set()];
|
||||||
counter(rfidbuffer.size, conf.arcId);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
import con from '../db/connect.js';
|
|
||||||
import conMaster from '../db/connectMaster.js';
|
|
||||||
import fs from 'node:fs';
|
|
||||||
|
|
||||||
export default async uniqueRead => {
|
|
||||||
const reads = new Set([
|
|
||||||
...uniqueRead[0],
|
|
||||||
...uniqueRead[1],
|
|
||||||
...uniqueRead[2],
|
|
||||||
...uniqueRead[3],
|
|
||||||
]);
|
|
||||||
|
|
||||||
console.log('reads: ', [...reads][0]);
|
|
||||||
let [[palletFk]] = await conMaster.query(
|
|
||||||
`SELECT palletFk FROM expeditionScan WHERE expeditionFk IN (?)`,
|
|
||||||
[[...reads].join(',')]
|
|
||||||
);
|
|
||||||
palletFk = palletFk?.palletFk;
|
|
||||||
console.log('palletFk: ', palletFk);
|
|
||||||
if (!palletFk) return console.log('LA EXPEDICION NO esta en el pallet');
|
|
||||||
let [realExpeditions] = await conMaster.query(
|
|
||||||
`SELECT ep.id, e.id, ps.printerRfidFk, ps.code, es.palletFk
|
|
||||||
FROM expeditionPallet ep
|
|
||||||
JOIN expeditionScan es ON es.palletFk = ep.id
|
|
||||||
JOIN expedition e ON e.id = es.expeditionFk
|
|
||||||
JOIN host h ON h.code = e.hostFk COLLATE utf8mb3_unicode_ci
|
|
||||||
JOIN packingSite ps ON ps.hostFk = h.id
|
|
||||||
WHERE ep.id = ?
|
|
||||||
AND ps.printerRfidFk`,
|
|
||||||
[palletFk]
|
|
||||||
);
|
|
||||||
realExpeditions = realExpeditions.map(r => r.id);
|
|
||||||
console.log('realExpeditions: ', realExpeditions.length);
|
|
||||||
|
|
||||||
if (realExpeditions.length != reads.size)
|
|
||||||
console.logger.warn('MISSING EXPEDITIONS');
|
|
||||||
const missing = realExpeditions.filter(x => ![...reads].includes(x));
|
|
||||||
const extra = [...reads].filter(x => !realExpeditions.includes(x));
|
|
||||||
if (missing.length) console.warn('MISSING:', missing.length, missing);
|
|
||||||
if (extra.length) console.warn('EXTRA:', extra.length, extra);
|
|
||||||
|
|
||||||
try {
|
|
||||||
const [[currentMissings]] = await con.query('SELECT missing FROM trys WHERE palletFk = ?', palletFk);
|
|
||||||
if (currentMissings?.missing < missing.length) return console.log('PREVENT REPLACE', currentMissings.missing, missing.length);
|
|
||||||
await con.query(
|
|
||||||
`
|
|
||||||
REPLACE trys
|
|
||||||
SET palletFk = ?,
|
|
||||||
missing = ?,
|
|
||||||
extra = ?,
|
|
||||||
total = ?,
|
|
||||||
powerType = ?,
|
|
||||||
observationExtra = ?,
|
|
||||||
observationMissing = ?,
|
|
||||||
antenna1 = ?,
|
|
||||||
antenna2 = ?,
|
|
||||||
antenna3 = ?,
|
|
||||||
antenna4 = ?
|
|
||||||
`,
|
|
||||||
[
|
|
||||||
palletFk,
|
|
||||||
missing.length,
|
|
||||||
extra.length,
|
|
||||||
realExpeditions.length,
|
|
||||||
'VDT3',
|
|
||||||
extra.join(','),
|
|
||||||
missing.join(','),
|
|
||||||
uniqueRead[0].size,
|
|
||||||
uniqueRead[1].size,
|
|
||||||
uniqueRead[2].size,
|
|
||||||
uniqueRead[3].size,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
await saveTable();
|
|
||||||
} catch (e) {
|
|
||||||
console.log('error debugging', palletFk, e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
async function saveTable() {
|
|
||||||
const [table] = await con.query(`SELECT * FROM trys WHERE DATE(timestamp) = CURDATE()`);
|
|
||||||
const date = new Date().toISOString().split('T')[0];
|
|
||||||
if (!table.length) return;
|
|
||||||
|
|
||||||
const file = fs.createWriteStream(`${date}.txt`);
|
|
||||||
file.on('error', function(err) {
|
|
||||||
console.error(err);
|
|
||||||
});
|
|
||||||
table.forEach(function(v) {
|
|
||||||
file.write(JSON.stringify(v) + '\n');
|
|
||||||
});
|
|
||||||
file.end();
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
|
|
||||||
import debugMissing from './debugMissing.js';
|
|
||||||
|
|
||||||
export default async(parsed, conf) => {
|
|
||||||
if (conf.env != 'dev') return;
|
|
||||||
|
|
||||||
// TOTAL READS BY ANTENNA
|
|
||||||
const totalRead = [0, 0, 0, 0];
|
|
||||||
for (let read of parsed.extended)
|
|
||||||
totalRead[read.antenna - 1]++;
|
|
||||||
console.log('TOTAL READ ANTENNA:', totalRead);
|
|
||||||
// UNIQUE READS BY ANTENNA
|
|
||||||
const uniqueRead = [new Set(), new Set(), new Set(), new Set()];
|
|
||||||
for (let read of parsed.extended)
|
|
||||||
uniqueRead[read.antenna - 1].add(read.code);
|
|
||||||
|
|
||||||
console.log('UNIQUE READ ANTENNA:', uniqueRead[0].size, uniqueRead[1].size, uniqueRead[2].size, uniqueRead[3].size);
|
|
||||||
|
|
||||||
debugMissing(uniqueRead);
|
|
||||||
console.log('----------------------------------------------------------------');
|
|
||||||
};
|
|
|
@ -2,10 +2,10 @@ import yml from 'require-yml';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
|
|
||||||
export default function getConfig(env = 'local') {
|
export default function getConfig() {
|
||||||
const {pathname: root} = new URL('../', import.meta.url);
|
const {pathname: root} = new URL('../', import.meta.url);
|
||||||
let conf = yml(path.join(root, 'config.yml'));
|
let conf = yml(path.join(root, 'config.yml'));
|
||||||
const localConfFile = path.join(root, `config.${env}.yml`);
|
const localConfFile = path.join(root, 'config.local.yml');
|
||||||
if (fs.existsSync(localConfFile))
|
if (fs.existsSync(localConfFile))
|
||||||
conf = Object.assign({}, conf, yml(localConfFile));
|
conf = Object.assign({}, conf, yml(localConfFile));
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
TRUCK_NOT_AVAILABLE: No hay un camión disponible
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
export default (rfidbuffer, rfidbufferSet) => {
|
||||||
|
if (conf.env != 'dev') return;
|
||||||
|
let totalBuffer = rfidbuffer.map(rfid => rfid.code);
|
||||||
|
let totalBufferSet = new Set(totalBuffer);
|
||||||
|
console.log('TOTAL BUFFER: ', totalBufferSet.size);
|
||||||
|
|
||||||
|
const totalRead = [0, 0, 0, 0];
|
||||||
|
for (let buffer of rfidbuffer)
|
||||||
|
totalRead[buffer.antenna - 1]++;
|
||||||
|
console.log('TOTAL READ ANTENNA:', totalRead);
|
||||||
|
|
||||||
|
for (let buffer of parsed)
|
||||||
|
rfidbufferSet[buffer.antenna - 1].add(buffer.code);
|
||||||
|
console.log('UNIQUE READ ANTENNA:', rfidbufferSet[0].size, rfidbufferSet[1].size, rfidbufferSet[2].size, rfidbufferSet[3].size);
|
||||||
|
for (const [index, set] of rfidbufferSet.entries()) {
|
||||||
|
if (((set.size * 100) / totalBufferSet.size) < 25)
|
||||||
|
console.log('[WARNING_ANTENNA]: ', index, ' ONLY ', set.size);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('----------------------------------------------------------------');
|
||||||
|
};
|
|
@ -1,8 +0,0 @@
|
||||||
import yml from 'require-yml';
|
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
export default function t(expression) {
|
|
||||||
const {pathname: root} = new URL('./locale', import.meta.url);
|
|
||||||
let es = yml(path.join(root, 'es.yml')) || {};
|
|
||||||
return es[expression] || expression;
|
|
||||||
}
|
|
Loading…
Reference in New Issue