From b1648bcb30b06da703ce50a7e13c77940d1e31ac Mon Sep 17 00:00:00 2001 From: HongxuanG <1359774872@qq.com> Date: Tue, 10 Nov 2026 18:43:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E8=BF=9B=E4=BB=93=E6=B5=81=E7=A8=8B=E5=B9=B6=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?N5S=E6=89=AB=E7=A0=81=E8=AF=86=E5=88=AB=E5=8D=87=E8=87=B31.1.26?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/scanAutoConfig.js | 6 +- src/common/scanConfig.js | 114 +++++++++++- src/manifest.json | 4 +- src/pages/storefabric/storeFabricManualIn.vue | 176 ++++++++++-------- src/pages/sys/user/scan-settings.vue | 11 +- 5 files changed, 219 insertions(+), 92 deletions(-) diff --git a/src/common/scanAutoConfig.js b/src/common/scanAutoConfig.js index db990c0..622f8ac 100644 --- a/src/common/scanAutoConfig.js +++ b/src/common/scanAutoConfig.js @@ -35,7 +35,11 @@ export async function ensureScanConfigAfterLogin(api) { if (result.skipped) { console.log('本地已有扫码设置,跳过自动匹配', result.config && result.config.name); } else if (result.saved) { - console.log('已自动写入扫码设置', result.config && result.config.name); + if (result.reason === 'rematch_n5s_from_seuic') { + console.log('N5S 误识别为东集,已纠正为', result.config && result.config.name); + } else { + console.log('已自动写入扫码设置', result.config && result.config.name); + } } else { console.log('自动匹配扫码设置未写入', result.reason); } diff --git a/src/common/scanConfig.js b/src/common/scanConfig.js index 9a23799..c895b38 100644 --- a/src/common/scanConfig.js +++ b/src/common/scanConfig.js @@ -50,6 +50,14 @@ export const BUILTIN_SCANNER_CONFIGS = [ dataKey: 'SCAN_BARCODE1', needSetup: false, }, + { + // N5S 部分固件走智联天地兼容广播,而不是 nlscan.action + brand: 'nlscan_compat', + name: '新大陆(兼容广播)', + action: 'android.intent.action.RECEIVE_SCANDATA_BROADCAST', + dataKey: 'android.intent.extra.SCAN_BROADCAST_DATA', + needSetup: false, + }, { ...PHONE_SCAN_CONFIG }, ]; @@ -62,10 +70,19 @@ const DETECT_RULES = [ packages: ['com.sunmi.scanner', 'woyou.aidlservice.jiuiv5'], }, { - matchNames: ['新大陆'], - matchActions: ['nlscan.action.SCANNER_RESULT'], - keywords: ['newland', 'nls', 'nlscan'], - packages: ['com.nlscan.barcodescanner', 'com.newland'], + matchNames: ['新大陆', '新大陆(兼容广播)'], + matchActions: [ + 'nlscan.action.SCANNER_RESULT', + 'android.intent.action.RECEIVE_SCANDATA_BROADCAST', + ], + // N5S 机型常标成 alps/zltd,不能只靠 newland 关键字 + keywords: ['newland', 'nls', 'nlscan', 'n5s', 'zltd'], + models: ['n5s', 'n5'], + packages: [ + 'com.nlscan.barcodescanner', + 'com.newland', + 'com.nlscan.android.scan.service', + ], }, { matchNames: ['优博讯'], @@ -94,10 +111,19 @@ const DETECT_RULES = [ ]; const PDA_DEVICE_KEYWORDS = [ - 'newland', 'nls', 'nlscan', 'sunmi', 'urovo', 'ubx', 'zebra', 'honeywell', + 'newland', 'nls', 'nlscan', 'n5s', 'zltd', 'sunmi', 'urovo', 'ubx', 'zebra', 'honeywell', 'idata', 'seuic', 'autoid', '东集', '东大', ]; +/** 明确机型 → 优先品牌,避免通用东集广播抢分 */ +const MODEL_PREFERRED_BRANDS = [ + { + models: ['n5s'], + brands: ['nlscan', 'nlscan_compat'], + score: 220, + }, +]; + const NO_SETUP_HINT_KEY = 'pda_scan_config_hint_shown'; export function isPhoneScanConfig(config) { @@ -319,6 +345,57 @@ function canResolveBroadcast(action) { return false; } +function isModelMatch(identity, models = []) { + const model = String((identity && identity.model) || '').toLowerCase(); + if (!model) return false; + return (models || []).some((item) => model === item || model.includes(item)); +} + +function getModelPreferredBoost(config, identity) { + if (!config || isPhoneScanConfig(config)) { + return 0; + } + const brand = String(config.brand || ''); + for (let i = 0; i < MODEL_PREFERRED_BRANDS.length; i += 1) { + const rule = MODEL_PREFERRED_BRANDS[i]; + if (!isModelMatch(identity, rule.models)) continue; + if ((rule.brands || []).includes(brand)) { + return Number(rule.score) || 0; + } + } + return 0; +} + +/** 新大陆 N5S / 智联天地 N5S:机型名常为 n5s,厂商可能是 newland/zltd/alps */ +export function isNewlandN5sDevice(identity = getDeviceIdentity()) { + const model = String((identity && identity.model) || '').toLowerCase(); + const text = `${identity.manufacturer || ''} ${identity.brand || ''} ${model}`.toLowerCase(); + if (model === 'n5s' || model.includes('n5s')) { + return true; + } + return text.includes('n5s') && ( + text.includes('newland') + || text.includes('zltd') + || text.includes('nlscan') + || text.includes('alps') + ); +} + +function isWrongSeuicOnNewlandDevice(config, identity = getDeviceIdentity()) { + if (!config || isPhoneScanConfig(config)) { + return false; + } + if (!isNewlandN5sDevice(identity) && !isModelMatch(identity, ['n5s'])) { + return false; + } + const brand = String(config.brand || ''); + const action = String(config.action || ''); + return brand === 'seuic' + || action.includes('scannerservice.broadcast') + || String(config.name || '').includes('东集') + || String(config.name || '').includes('东大'); +} + function scoreScannerConfig(config, identity) { if (!config || isPhoneScanConfig(config)) { return 0; @@ -339,6 +416,19 @@ function scoreScannerConfig(config, identity) { if ((rule.keywords || []).some((keyword) => deviceText.includes(String(keyword).toLowerCase()))) { score += 40; } + if (isModelMatch(identity, rule.models || [])) { + score += 80; + } + } + + score += getModelPreferredBoost(config, identity); + + // 明确是 N5S 时,压低东集通用广播抢分 + if (isNewlandN5sDevice(identity) && ( + config.brand === 'seuic' + || String(config.action || '').includes('scannerservice.broadcast') + )) { + score = Math.min(score, 30); } return score; @@ -376,12 +466,16 @@ export function matchBestScanConfig(candidateConfigs = []) { } /** - * 仅本地没有有效配置时,自动匹配并写入扫描设置 + * 仅本地没有有效配置时,自动匹配并写入扫描设置。 + * 若本地误把 N5S 识别成东集,则强制重配。 * @returns {{ saved: boolean, config: object|null, skipped: boolean, reason?: string }} */ export function autoConfigureScanSettings({ remoteConfigs = [] } = {}) { const existing = getScanConfig(BUILTIN_SCANNER_CONFIGS); - if (existing) { + const identity = getDeviceIdentity(); + const forceRematch = !!(existing && isWrongSeuicOnNewlandDevice(existing, identity)); + + if (existing && !forceRematch) { return { saved: false, skipped: true, @@ -396,7 +490,7 @@ export function autoConfigureScanSettings({ remoteConfigs = [] } = {}) { return { saved: false, skipped: false, - config: null, + config: existing || null, reason: 'no_match', }; } @@ -406,6 +500,8 @@ export function autoConfigureScanSettings({ remoteConfigs = [] } = {}) { saved, skipped: false, config: matched, - reason: saved ? 'saved' : 'save_failed', + reason: saved + ? (forceRematch ? 'rematch_n5s_from_seuic' : 'saved') + : 'save_failed', }; } diff --git a/src/manifest.json b/src/manifest.json index 1ad7219..106e14d 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,8 +2,8 @@ "name" : "浩拓织厂", "appid" : "__UNI__F79F300", "description" : "周尚-浩拓织厂", - "versionName" : "1.1.25", - "versionCode" : 125, + "versionName" : "1.1.26", + "versionCode" : 126, "transformPx" : false, "app-plus" : { "optimization" : { diff --git a/src/pages/storefabric/storeFabricManualIn.vue b/src/pages/storefabric/storeFabricManualIn.vue index 6e42a78..198ed6c 100644 --- a/src/pages/storefabric/storeFabricManualIn.vue +++ b/src/pages/storefabric/storeFabricManualIn.vue @@ -9,58 +9,10 @@ - - - 查布工 - - - {{ detail.inspector_name || '请选择查布工' }} - - 取消 - - - - 重量 - - - KG - 取消 - - - - 等级 - - - {{ levelDisplayName || '请选择等级' }} - - 取消 - - - - 存放仓位 - - - 修改 - - - - @@ -73,7 +25,7 @@ :confirm-hold="true" :focus="scanFocus" v-model="scanCode" - placeholder="先选查布工并填写信息,再扫描布票编码" + placeholder="请先扫描布票编码" placeholder-class="manual-in__placeholder" @confirm="onScanConfirm" /> @@ -121,12 +73,71 @@ 坯布编号 {{ detail.grey_fabric_code || '-' }} - + 卷号 - {{ detail.volume_number }} + {{ detail.volume_number != null && detail.volume_number !== '' ? detail.volume_number : '-' }} + + + 查布工 + + + {{ detail.inspector_name || '请选择查布工' }} + + 取消 + + + + 重量 + + + KG + 取消 + + + + 等级 + + + {{ levelDisplayName || '请选择等级' }} + + 取消 + + + + 存放仓位 + + + 修改 + + + + + + + 确认进仓 + + +