合并两个工位的 ERP 页面、存储过程及测试工具,分离 8010 与 9528 工位配置

This commit is contained in:
Developer
2026-12-05 11:30:18 +08:00
parent fffc3e9faf
commit ffb7417c24
554 changed files with 105022 additions and 156 deletions

View File

@@ -0,0 +1,9 @@
'use strict'
const origin = require('../config/9528.json').mainServiceOrigin
module.exports = function apply9528Service(source) {
const declaration = /^(\s*(?:var|let|const)\s+url\s*=\s*)([`"'])(https?:\/\/[^\s`"']+)\2/gm
const matches = source.match(declaration)
if (!matches || matches.length !== 1) throw new Error('请核对 static/config.js 中的主通讯地址声明')
return source.replace(declaration, (_, start, quote) => start + quote + origin + quote)
}

6
build/dev-9528.js Normal file
View File

@@ -0,0 +1,6 @@
'use strict'
process.env.HOST = '127.0.0.1'
process.env.PORT = '9528'
process.env.JY_AI_EMPLOYEE = '1'
process.argv.push('--inline', '--config', 'build/webpack.dev.conf.js', '--no-open')
require('webpack-dev-server/bin/webpack-dev-server')

View File

@@ -15,6 +15,34 @@ function resolve(dir) {
const HOST = process.env.HOST
const PORT = process.env.PORT && Number(process.env.PORT)
const local9528 = HOST === '127.0.0.1' && PORT === 9528 && process.env.JY_AI_EMPLOYEE === '1'
const employeePaths = [
'/submit/AIEmployeeLogin.ashx',
'/submit/AICurrentEmployee.ashx',
'/submit/AIPurchaseInvoiceFile.ashx',
'/submit/MESCommonBase.ashx',
'/submit/AIEmployeeLogout.ashx'
]
const proxy = Object.assign({}, config.dev.proxyTable)
if (process.env.JY_AI_EMPLOYEE === '1') {
employeePaths.forEach(function (route) {
proxy[route] = {
target: 'http://127.0.0.1:19529',
changeOrigin: true,
logLevel: 'silent',
bypass: function (req) {
if (req.url.split('?')[0] !== route) return req.url
},
onProxyReq: function (upstream, req) {
const ticket = (req.headers.cookie || '').split(';').map(value => value.trim())
.find(value => value.indexOf('JY_AI_EMPLOYEE=') === 0)
if (ticket) upstream.setHeader('cookie', ticket)
else upstream.removeHeader('cookie')
upstream.removeHeader('authorization')
}
}
})
}
const devWebpackConfig = merge(baseWebpackConfig, {
mode: 'development',
@@ -40,7 +68,7 @@ const devWebpackConfig = merge(baseWebpackConfig, {
? { warnings: false, errors: true }
: false,
publicPath: config.dev.assetsPublicPath,
proxy: config.dev.proxyTable,
proxy: proxy,
quiet: true, // necessary for FriendlyErrorsPlugin
watchOptions: {
poll: config.dev.poll
@@ -65,11 +93,20 @@ const devWebpackConfig = merge(baseWebpackConfig, {
]
})
if (local9528) {
const serviceConfig = resolve('static/config.js')
devWebpackConfig.module.rules.unshift({
enforce: 'pre',
test: file => file === serviceConfig,
use: [resolve('build/9528-service-loader.js')]
})
}
module.exports = new Promise((resolve, reject) => {
portfinder.basePort = process.env.PORT || config.dev.port
portfinder.getPort((err, port) => {
if (err) {
reject(err)
if (err || (local9528 && port !== 9528)) {
reject(err || new Error('本机 9528 端口已被占用'))
} else {
// publish the new Port, necessary for e2e tests
process.env.PORT = port

View File

@@ -98,7 +98,7 @@ const webpackConfig = merge(baseWebpackConfig, {
{
from: path.resolve(__dirname, '../static'),
to: config.build.assetsSubDirectory,
ignore: ['.*']
ignore: ['.*', { glob: 'config.js', matchBase: false }]
}
])
],