From 9272ed0e23ad588a941f94cab509b1882f6bfbfb Mon Sep 17 00:00:00 2001 From: xuan <1359774872@qq.com> Date: Sun, 4 Jan 2026 13:57:28 +0800 Subject: [PATCH] =?UTF-8?q?feat(scanner):=20=E5=A4=9A=E5=8E=82=E5=95=86PDA?= =?UTF-8?q?=E6=89=AB=E7=A0=81=E5=99=A8=E5=85=BC=E5=AE=B9=E6=96=B9=E6=A1=88?= =?UTF-8?q?=E5=8F=8A=E6=89=AB=E7=A0=81=E5=8A=9F=E8=83=BD=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 采用策略模式及配置表驱动方式支持多品牌扫码器广播注册 - 实现扫码广播的统一注册和注销管理,支持并发多个扫码广播接收器 - 重构扫码处理逻辑,统一处理扫码结果,支持条码和二维码识别 - 移除原有单一品牌扫码注册,整合商米、新大陆等扫码头支持 - 调整扫码相关页面代码,集成scanMixin,实现扫码广播注册和注销自动化 - 优化扫码结果处理,支持删除模式及整缸扫描状态区分 - 修正多处界面文本格式与代码风格,提高代码一致性和可维护性 - 升级manifest版本号至1.1.3,标记此功能更新 --- src/common/scanMixin.js | 310 +++-- src/manifest.json | 4 +- src/pages/saleship/salepickscandetail.vue | 409 ++---- .../storeGoodsBusinessCheckDetail.vue | 794 +++++------ .../storeGoodsBusinessStationMoveOnly.vue | 1160 ++++++++--------- src/pages/sys/workbench/index.vue | 165 +-- 6 files changed, 1262 insertions(+), 1580 deletions(-) diff --git a/src/common/scanMixin.js b/src/common/scanMixin.js index aca9889..fd8e126 100644 --- a/src/common/scanMixin.js +++ b/src/common/scanMixin.js @@ -1,143 +1,175 @@ // common/scanMixin.js +// 多厂商PDA扫码器兼容方案 - 策略模式 + 配置表驱动 export default { data() { return { - scanReceiver: null, - isPageActive: false + scanReceivers: [], // 支持多个接收器 + isPageActive: false, + registeredBrands: [] // 已注册的品牌 } }, methods: { - // 注册扫码广播(兼容多种设备) - registerScanBroadcast(scanCallback) { - try { - // 先尝试注册商米扫码头 - this.registerSunmiBroadcast(scanCallback) - .then(() => { - console.log('商米扫码头注册成功'); - }) - .catch((error) => { - console.log('商米扫码头注册失败,尝试新大陆扫码头:', error); - // 如果商米扫码头注册失败,尝试新大陆扫码头 - this.registerNewlandBroadcast(scanCallback); - }); - } catch (error) { - console.error("注册扫码广播失败:", error); - return false; - } + // 扫码器配置表 - 方便扩展新厂商 + getScannerConfigs() { + return [ + { + brand: 'newland', // 东集 + name: '东集', + action: 'com.android.server.scannerservice.broadcast', + dataKey: 'scannerdata', + needSetup: true, + setupAction: 'com.android.scanner.service_settings', + setupParams: { + action_barcode_broadcast: 'com.android.server.scannerservice.broadcast', + key_barcode_broadcast: 'scannerdata', + endchar: 'ENTER' + } + }, + { + brand: 'sunmi', // 商米 + name: '商米', + action: 'com.sunmi.scanner.ACTION_DATA_CODE_RECEIVED', + dataKey: 'data', + needSetup: false + }, + // { + // brand: 'honeywell', // 霍尼韦尔 + // name: '霍尼韦尔', + // action: 'com.honeywell.decode.intent.action.EDIT_DATA', + // dataKey: 'data', + // needSetup: false + // }, + // { + // brand: 'zebra', // 斑马 + // name: '斑马', + // action: 'com.symbol.datawedge.api.RESULT_ACTION', + // dataKey: 'com.symbol.datawedge.data_string', + // needSetup: false + // }, + // { + // brand: 'idata', // 盈达聚力 + // name: '盈达聚力', + // action: 'android.intent.action.SCANRESULT', + // dataKey: 'value', + // needSetup: false + // }, + // { + // brand: 'urovo', // 优博讯 + // name: '优博讯', + // action: 'android.intent.ACTION_DECODE_DATA', + // dataKey: 'barcode_string', + // needSetup: false + // } + ]; }, - // 注册商米扫码头广播接收器 - registerSunmiBroadcast(scanCallback) { - return new Promise((resolve, reject) => { + // 注册所有扫码广播(推荐方式:同时注册所有厂商) + registerScanBroadcast(scanCallback) { + // #ifdef APP-PLUS + const configs = this.getScannerConfigs(); + + configs.forEach(config => { try { - const main = plus.android.runtimeMainActivity(); - const IntentFilter = plus.android.importClass("android.content.IntentFilter"); - - const filter = new IntentFilter(); - filter.addAction("com.sunmi.scanner.ACTION_DATA_CODE_RECEIVED"); - - const self = this; - const receiver = plus.android.implements( - "io.dcloud.feature.internal.reflect.BroadcastReceiver", - { - onReceive: (context, intent) => { - console.log('商米扫码广播接收,isPageActive:', self.isPageActive); - // 只有当页面活动时才处理广播 - if (!self.isPageActive) return; - - try { - // 导入 Intent 类以使用其方法 - const Intent = plus.android.importClass("android.content.Intent"); - - const scanResult = intent.getStringExtra("data"); - const sourceBytes = intent.getByteArrayExtra("source_byte"); - - console.log('商米扫码结果:', scanResult, sourceBytes); - - if (scanResult) { - self.handleScanResult(scanResult, scanCallback); - } - } catch (error) { - console.error('处理商米广播数据时出错:', error); - } - } - } - ); - - // 注册广播接收器 - main.registerReceiver(receiver, filter); - this.scanReceiver = receiver; - console.log('商米扫码广播接收器注册成功'); - resolve(); + this.registerSingleBroadcast(config, scanCallback); + this.registeredBrands.push(config.brand); + console.log(`${config.name}扫码广播注册成功`); } catch (error) { - console.error('注册商米广播接收器失败:', error); - reject(error); + console.log(`${config.name}扫码广播注册失败:`, error); } }); + + if (this.registeredBrands.length > 0) { + console.log('扫码广播注册完成,已注册厂商:', this.registeredBrands.join(', ')); + return true; + } + + console.error('所有扫码广播注册均失败'); + return false; + // #endif }, - // 注册新大陆扫码头广播接收器 - registerNewlandBroadcast(scanCallback) { - try { - const main = plus.android.runtimeMainActivity(); - - // 先配置扫码枪广播设置 - try { - const Intent = plus.android.importClass("android.content.Intent"); - const intent = new Intent("com.android.scanner.service_settings"); - intent.putExtra( - "action_barcode_broadcast", - "com.android.server.scannerservice.broadcast" - ); - intent.putExtra("key_barcode_broadcast", "scannerdata"); - main.sendBroadcast(intent); - console.log('新大陆扫码枪广播配置完成'); - } catch (error) { - console.error("配置新大陆扫码枪广播失败:", error); - } - - // 注册广播接收器 - const IntentFilter = plus.android.importClass( - "android.content.IntentFilter" - ); - const filter = new IntentFilter(); - filter.addAction("com.android.server.scannerservice.broadcast"); - console.log("添加新大陆广播action完成"); - - const self = this; - const receiver = plus.android.implements( - "io.dcloud.feature.internal.reflect.BroadcastReceiver", - { - onReceive: (context, intent) => { - console.log('新大陆扫码广播接收,isPageActive:', self.isPageActive); - // 只有当页面活动时才处理广播 - if (!self.isPageActive) return; - - try { - // 导入 Intent 类以使用其方法 - const Intent = plus.android.importClass("android.content.Intent"); - - const scanResult = intent.getStringExtra("scannerdata"); - console.log("新大陆扫码结果:", scanResult); - if (scanResult) { - self.handleScanResult(scanResult, scanCallback); - } - } catch (error) { - console.error("处理新大陆广播数据时出错:", error); - } - }, - } - ); - - // 注册广播接收器 - main.registerReceiver(receiver, filter); - this.scanReceiver = receiver; - console.log("新大陆扫码广播注册成功,等待扫码..."); - } catch (error) { - console.error("注册新大陆扫码广播失败:", error); - throw error; + // 注册指定厂商的扫码广播 + registerScanBroadcastByBrand(brand, scanCallback) { + // #ifdef APP-PLUS + const configs = this.getScannerConfigs(); + const config = configs.find(c => c.brand === brand); + + if (!config) { + console.error(`未找到厂商配置: ${brand}`); + return false; } + + try { + this.registerSingleBroadcast(config, scanCallback); + this.registeredBrands.push(config.brand); + console.log(`${config.name}扫码广播注册成功`); + return true; + } catch (error) { + console.error(`${config.name}扫码广播注册失败:`, error); + return false; + } + // #endif + }, + + // 单个广播注册的核心方法 + registerSingleBroadcast(config, scanCallback) { + const main = plus.android.runtimeMainActivity(); + + // 如果需要预配置(如东集) + if (config.needSetup && config.setupAction) { + try { + const Intent = plus.android.importClass('android.content.Intent'); + const setupIntent = new Intent(config.setupAction); + + Object.keys(config.setupParams || {}).forEach(key => { + setupIntent.putExtra(key, config.setupParams[key]); + }); + + main.sendBroadcast(setupIntent); + console.log(`${config.name}扫码配置完成`); + } catch (error) { + console.error(`${config.name}扫码配置失败:`, error); + } + } + + // 注册广播接收器 + const IntentFilter = plus.android.importClass('android.content.IntentFilter'); + const filter = new IntentFilter(); + filter.addAction(config.action); + + const self = this; + const receiver = plus.android.implements( + 'io.dcloud.feature.internal.reflect.BroadcastReceiver', + { + onReceive: (context, intent) => { + console.log(`${config.name}扫码广播接收,isPageActive:`, self.isPageActive); + + if (!self.isPageActive) return; + + try { + plus.android.importClass('android.content.Intent'); + const scanResult = intent.getStringExtra(config.dataKey); + + console.log(`${config.name}扫码结果:`, scanResult); + + if (scanResult) { + self.handleScanResult(scanResult, scanCallback); + } + } catch (error) { + console.error(`处理${config.name}广播数据出错:`, error); + } + } + } + ); + + main.registerReceiver(receiver, filter); + + // 保存接收器引用,用于后续注销 + this.scanReceivers.push({ + brand: config.brand, + receiver: receiver + }); }, // 处理扫码结果的统一方法 @@ -156,18 +188,30 @@ export default { } }, - // 取消扫码广播监听 + // 取消所有扫码广播监听 unregisterScanBroadcast() { - if (this.scanReceiver) { - try { - const main = plus.android.runtimeMainActivity(); - main.unregisterReceiver(this.scanReceiver); - this.scanReceiver = null; - console.log("扫码广播注销成功"); - } catch (err) { - console.error("注销扫码广播失败:", err); - } + // #ifdef APP-PLUS + if (this.scanReceivers.length === 0) return; + + try { + const main = plus.android.runtimeMainActivity(); + + this.scanReceivers.forEach(item => { + try { + main.unregisterReceiver(item.receiver); + console.log(`${item.brand}扫码广播注销成功`); + } catch (err) { + console.error(`${item.brand}扫码广播注销失败:`, err); + } + }); + + this.scanReceivers = []; + this.registeredBrands = []; + console.log('所有扫码广播注销完成'); + } catch (err) { + console.error('注销扫码广播失败:', err); } + // #endif }, // 通用的商品扫描处理方法 diff --git a/src/manifest.json b/src/manifest.json index 318f849..3b4d586 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,8 +2,8 @@ "name" : "浩拓技术", "appid" : "__UNI__F79F300", "description" : "浩拓纺织平台", - "versionName" : "1.1.2", - "versionCode" : 112, + "versionName" : "1.1.3", + "versionCode" : 103, "transformPx" : false, "app-plus" : { "optimization" : { diff --git a/src/pages/saleship/salepickscandetail.vue b/src/pages/saleship/salepickscandetail.vue index 25f2056..1a41b23 100644 --- a/src/pages/saleship/salepickscandetail.vue +++ b/src/pages/saleship/salepickscandetail.vue @@ -6,31 +6,17 @@ 日期:{{ BillDate }} - 客户名称:{{ CustomerName }} - 销 售 员:{{ SaleUserName }} + 客户名称:{{ CustomerName }} + 销 售 员:{{ SaleUserName }} - 仓库名称:{{ StoreName }}{{ ToStoreName }} + 仓库名称:{{ StoreName }}{{ ToStoreName }} - 备注内容:{{ BillRemark }} + 备注内容:{{ BillRemark }} - + 整缸 @@ -41,58 +27,38 @@ - 成品名称:{{ FabricGoodsNo }}{{ FabricGoodsName }} + 成品名称:{{ FabricGoodsNo }}{{ FabricGoodsName }} - 色号颜色:{{ GoodsCodeNo }}{{ GoodsCodeName }} + 色号颜色:{{ GoodsCodeNo }}{{ GoodsCodeName }} 成品缸号:{{ CrockNo }} - 成品卷号:{{ GoodsBillNo }} + 成品卷号:{{ GoodsBillNo }} {{ BillDataMessage }} - 配布条数:{{ BillSumRoll }} + 配布条数:{{ BillSumRoll }} 数量:{{ BillSumQty }} 米数:{{ BillSumMQty }} - 已配条数:{{ BillScanRoll }} + 已配条数:{{ BillScanRoll }} 数量:{{ BillScanQty }} 米数:{{ BillScanMQty }} - + {{ pageType ? "保存" : "提交" }} - + @@ -105,8 +71,10 @@ import util, { playErrorAudio, } from "../../common/util"; import wybTable from "@/components/wyb-table/wyb-table.vue"; +import scanMixin from "@/common/scanMixin.js"; let that = ""; export default { + mixins: [scanMixin], data() { return { SaleBillNo: "", // 单号 @@ -115,7 +83,7 @@ export default { align: "center", index: 0, pageType: "", - submitLoading: false, + submitLoading: false, actionSheetShow: false, QRBarCode: "", BillNo: "", @@ -192,8 +160,7 @@ export default { ], scanningInput: "", // 用于累积扫码输入 lastKeyTime: 0, // 用于判断扫码速度 - scanReceiver: null, - isPageActive: false, // 添加页面活动状态标志 + // scanReceiver 和 isPageActive 由 scanMixin 提供 }; }, @@ -214,14 +181,13 @@ export default { }, onUnload() { - // #ifdef APP-PLUS this.isPageActive = false; + // #ifdef APP-PLUS this.unregisterScanBroadcast(); // #endif }, onHide() { - // 页面隐藏时 this.isPageActive = false; // #ifdef APP-PLUS this.unregisterScanBroadcast(); @@ -229,10 +195,15 @@ export default { }, onShow() { - // 页面显示时 this.isPageActive = true; // #ifdef APP-PLUS - this.registerScanBroadcast(); + this.registerScanBroadcast((scanResult) => { + console.log("配布单详情-扫码结果:", scanResult); + this.QRBarCode = scanResult; + this.$nextTick(() => { + this.handleScans(); + }); + }); // #endif }, @@ -300,7 +271,7 @@ export default { } this.GoodsDetailList = aResultDataList; - + }).catch(error => { this.triggered = false; this.showError(error.msg); @@ -323,247 +294,93 @@ export default { icon: 'success' }); }, - handleScans() { - // 删除模式判断 - let aBarCodeDelStatus = 1; // 1=正常扫码,3=删除模式 - if (this.BarCodeDelStatus) { - aBarCodeDelStatus = 3; - } - - // 整缸扫描判断 - let aAllCrockNoScanStatus = 2; // 0=普通扫描,1=整缸扫描 - if (this.AllCrockNoScanStatus) { - aAllCrockNoScanStatus = "1"; - } - - // 数据清理:去除空格、换行符等 - let cleanCode = this.QRBarCode.replace(/\s+/g, '').replace(/[\r\n]/g, ''); - - console.log("this.QRBarCode ---->>" + cleanCode); - - // 初始化条码和二维码变量 - let aQRBarCode = ""; - let aBarCode = ""; - - if (cleanCode.startsWith("66^") || cleanCode.startsWith("99^") || /[\u4E00-\u9FA5]/.test(cleanCode)) { - aQRBarCode = cleanCode; - } else { - aBarCode = cleanCode; - } - - if (aQRBarCode == "" && aBarCode == "") { - this.QRBarCode = ""; - this.showError('请扫描二维码或者条码'); - return; - } - - console.log('请求参数', aBarCodeDelStatus); - console.log('请求参数', aBarCode); - console.log('请求参数', aQRBarCode); - console.log('请求参数', this.BillMasterID); - console.log('请求参数 SaleBillNo', this.SaleBillNo); - console.log('请求参数 token', uni.getStorageSync("userToken").Token); - // 发送请求 - util.request({ - url: "/product/fpmArrangeOrder/updateFpmArrangeOrder", - method: "PUT", - header: { - Platform: 2, - Authorization: uni.getStorageSync("userToken").Token, - }, - data: { - arrange_type: aBarCodeDelStatus, // 1=正常扫码,3=删除模式 - bar_code: aBarCode, // 条码(如果是条形码就使用这个) - qr_code: aQRBarCode, // 二维码(如果是二维码就使用这个) - id: parseInt(this.BillMasterID), // 订单ID - // order_no: this.SaleBillNo, // 单号 - }, - success: (res) => { - console.log('API响应:', res); - - if (res.data.code == 0 && res.data.msg == "success") { - var aResultData = res.data.data; - this.playSuccess(); - this.FabricGoodsNo = aResultData.product_code; - this.FabricGoodsName = aResultData.product_name; - this.GoodsCodeNo = aResultData.product_color_code; - this.GoodsCodeName = aResultData.product_color_name; - this.CrockNo = aResultData.dyelot_number; - this.GoodsBillNo = aResultData.volume_number; - this.QRBarCode = ""; - - if (aBarCodeDelStatus == 1) { - this.showSuccess("扫描成功!"); - } else { - this.showSuccess("删除成功!"); - } - - this.SalePickDetail(); - } else { - this.showError("扫描出错," + res.data.msg); - this.QRBarCode = ""; - } - }, - fail: (error) => { - console.error('API请求失败:', error); - this.QRBarCode = ""; - this.showError("连接服务器出错,请检查后台服务是否启动!"); - }, - }); - }, - - // 注册扫码广播接收器(支持商米和新大陆扫码头) - registerScanBroadcast() { - try { - // 先尝试注册商米扫码头 - this.registerSunmiBroadcast() - .then(() => { - console.log('商米扫码头注册成功'); - }) - .catch((error) => { - console.log('商米扫码头注册失败,尝试新大陆扫码头:', error); - // 如果商米扫码头注册失败,尝试新大陆扫码头 - this.registerNewlandBroadcast(); - }); - } catch (error) { - console.error("注册扫码广播失败:", error); + handleScans() { + // 删除模式判断 + let aBarCodeDelStatus = 1; // 1=正常扫码,3=删除模式 + if (this.BarCodeDelStatus) { + aBarCodeDelStatus = 3; } - }, - // 注册商米扫码头广播接收器 - registerSunmiBroadcast() { - return new Promise((resolve, reject) => { - try { - const main = plus.android.runtimeMainActivity(); - const IntentFilter = plus.android.importClass("android.content.IntentFilter"); - - const filter = new IntentFilter(); - filter.addAction("com.sunmi.scanner.ACTION_DATA_CODE_RECEIVED"); + // 整缸扫描判断 + let aAllCrockNoScanStatus = 2; // 0=普通扫描,1=整缸扫描 + if (this.AllCrockNoScanStatus) { + aAllCrockNoScanStatus = "1"; + } - const receiver = plus.android.implements( - "io.dcloud.feature.internal.reflect.BroadcastReceiver", - { - onReceive: (context, intent) => { - console.log('商米扫码广播接收,isPageActive:', this.isPageActive); - // 只有当页面活动时才处理广播 - if (!this.isPageActive) return; + // 数据清理:去除空格、换行符等 + let cleanCode = this.QRBarCode.replace(/\s+/g, '').replace(/[\r\n]/g, ''); - try { - const scanResult = intent.getStringExtra("data"); - const sourceBytes = intent.getByteArrayExtra("source_byte"); - - console.log('商米扫码结果:', scanResult, sourceBytes); - - if (scanResult) { - this.handleScanResult(scanResult); - } - } catch (error) { - console.error('处理商米广播数据时出错:', error); - } - } + console.log("this.QRBarCode ---->>" + cleanCode); + + // 初始化条码和二维码变量 + let aQRBarCode = ""; + let aBarCode = ""; + + if (cleanCode.startsWith("66^") || cleanCode.startsWith("99^") || /[\u4E00-\u9FA5]/.test(cleanCode)) { + aQRBarCode = cleanCode; + } else { + aBarCode = cleanCode; + } + + if (aQRBarCode == "" && aBarCode == "") { + this.QRBarCode = ""; + this.showError('请扫描二维码或者条码'); + return; + } + + console.log('请求参数', aBarCodeDelStatus); + console.log('请求参数', aBarCode); + console.log('请求参数', aQRBarCode); + console.log('请求参数', this.BillMasterID); + console.log('请求参数 SaleBillNo', this.SaleBillNo); + console.log('请求参数 token', uni.getStorageSync("userToken").Token); + // 发送请求 + util.request({ + url: "/product/fpmArrangeOrder/updateFpmArrangeOrder", + method: "PUT", + header: { + Platform: 2, + Authorization: uni.getStorageSync("userToken").Token, + }, + data: { + arrange_type: aBarCodeDelStatus, // 1=正常扫码,3=删除模式 + bar_code: aBarCode, // 条码(如果是条形码就使用这个) + qr_code: aQRBarCode, // 二维码(如果是二维码就使用这个) + id: parseInt(this.BillMasterID), // 订单ID + // order_no: this.SaleBillNo, // 单号 + }, + success: (res) => { + console.log('API响应:', res); + + if (res.data.code == 0 && res.data.msg == "success") { + var aResultData = res.data.data; + this.playSuccess(); + this.FabricGoodsNo = aResultData.product_code; + this.FabricGoodsName = aResultData.product_name; + this.GoodsCodeNo = aResultData.product_color_code; + this.GoodsCodeName = aResultData.product_color_name; + this.CrockNo = aResultData.dyelot_number; + this.GoodsBillNo = aResultData.volume_number; + this.QRBarCode = ""; + + if (aBarCodeDelStatus == 1) { + this.showSuccess("扫描成功!"); + } else { + this.showSuccess("删除成功!"); } - ); - // 注册广播接收器 - main.registerReceiver(receiver, filter); - this.scanReceiver = receiver; - console.log('商米扫码广播接收器注册成功'); - resolve(); - } catch (error) { - console.error('注册商米广播接收器失败:', error); - reject(error); - } - }); - }, - - // 注册新大陆扫码头广播接收器 - registerNewlandBroadcast() { - try { - const main = plus.android.runtimeMainActivity(); - - // 先配置扫码枪广播设置 - try { - const Intent = plus.android.importClass("android.content.Intent"); - const intent = new Intent("com.android.scanner.service_settings"); - intent.putExtra( - "action_barcode_broadcast", - "com.android.server.scannerservice.broadcast" - ); - intent.putExtra("key_barcode_broadcast", "scannerdata"); - main.sendBroadcast(intent); - console.log('新大陆扫码枪广播配置完成'); - } catch (error) { - console.error("配置新大陆扫码枪广播失败:", error); - } - - // 注册广播接收器 - const IntentFilter = plus.android.importClass( - "android.content.IntentFilter" - ); - const filter = new IntentFilter(); - filter.addAction("com.android.server.scannerservice.broadcast"); - console.log("添加新大陆广播action完成"); - - const receiver = plus.android.implements( - "io.dcloud.feature.internal.reflect.BroadcastReceiver", - { - onReceive: (context, intent) => { - console.log('新大陆扫码广播接收,isPageActive:', this.isPageActive); - // 只有当页面活动时才处理广播 - if (!this.isPageActive) return; - - try { - const scanResult = intent.getStringExtra("scannerdata"); - console.log("新大陆扫码结果:", scanResult); - if (scanResult) { - this.handleScanResult(scanResult); - } - } catch (error) { - console.error("处理新大陆广播数据时出错:", error); - } - }, + this.SalePickDetail(); + } else { + this.showError("扫描出错," + res.data.msg); + this.QRBarCode = ""; } - ); - - // 注册广播接收器 - main.registerReceiver(receiver, filter); - this.scanReceiver = receiver; - console.log("新大陆扫码广播注册成功,等待扫码..."); - } catch (error) { - console.error("注册新大陆扫码广播失败:", error); - throw error; - } - }, - - // 处理扫码结果的统一方法 - handleScanResult(scanResult) { - try { - // 数据清理:去除空格、换行符等 - let cleanCode = scanResult.replace(/\s+/g, '').replace(/[\r\n]/g, ''); - - console.log("配布单详情-扫码结果:", cleanCode); - - this.QRBarCode = cleanCode; - this.$nextTick(() => { - this.handleScans(); - }); - } catch (error) { - console.error("处理扫码结果时出错:", error); - } - }, - - // 注销扫码广播接收器 - unregisterScanBroadcast() { - if (this.scanReceiver) { - try { - const main = plus.android.runtimeMainActivity(); - main.unregisterReceiver(this.scanReceiver); - this.scanReceiver = null; - console.log("扫码广播注销成功"); - } catch (error) { - console.error("注销扫码广播失败:", error); - } - } + }, + fail: (error) => { + console.error('API请求失败:', error); + this.QRBarCode = ""; + this.showError("连接服务器出错,请检查后台服务是否启动!"); + }, + }); }, SalePickBillDetailScan() { @@ -601,13 +418,13 @@ export default { } }, // 新增提交订单的方法 - submitOrder: function() { - this.submitLoading = true + submitOrder: function () { + this.submitLoading = true this.$u.api.outFpmArrangeOrder({ id: parseInt(this.BillMasterID) }).then(res => { - this.submitLoading = false - console.log('outFpmArrangeOrder res',res) + this.submitLoading = false + console.log('outFpmArrangeOrder res', res) if (res) { this.BillDataMessage = "成功生成出仓单!"; this.playSuccess(); @@ -617,7 +434,7 @@ export default { return; } }).catch(error => { - this.submitLoading = false + this.submitLoading = false this.playError(); this.BillDataMessage = "连接服务器出错,请检查后台服务是否启动!"; }); @@ -676,7 +493,7 @@ page { margin-right: 12rpx; } -.cpInput > input { +.cpInput>input { box-sizing: border-box; border: 1rpx solid #dddddd; width: 100%; @@ -690,7 +507,7 @@ page { margin-right: 12rpx; } -.cpInput1 > input { +.cpInput1>input { box-sizing: border-box; border: 1rpx solid #dddddd; width: 100%; diff --git a/src/pages/storegoods/storeGoodsBusinessCheckDetail.vue b/src/pages/storegoods/storeGoodsBusinessCheckDetail.vue index c3152e9..2a17e66 100644 --- a/src/pages/storegoods/storeGoodsBusinessCheckDetail.vue +++ b/src/pages/storegoods/storeGoodsBusinessCheckDetail.vue @@ -2,12 +2,12 @@ - 单号:{{GoodsCheckBillNo}} - 日期:{{GoodsCheckBillDate}} + 单号:{{ GoodsCheckBillNo }} + 日期:{{ GoodsCheckBillDate }} - 仓库名称:{{StoreName}} - 仓位名称:{{StoreStationName}} + 仓库名称:{{ StoreName }} + 仓位名称:{{ StoreStationName }} - {{BillDataMessage}} + {{ BillDataMessage }} - 成品编号:{{FabricGoodsNo}} - 成品重量:{{GoodsQty}}KG + 成品编号:{{ FabricGoodsNo }} + 成品重量:{{ GoodsQty }}KG - 成品色号:{{GoodsCodeNo}} - 成品颜色:{{GoodsCodeName}} + 成品色号:{{ GoodsCodeNo }} + 成品颜色:{{ GoodsCodeName }} - 成品缸号:{{CrockNo}} - 缸号卷号:{{GoodsBillNo}} + 成品缸号:{{ CrockNo }} + 缸号卷号:{{ GoodsBillNo }} - 本架盘前:{{BillSumOldRoll}}条 - 本架实盘:{{BillSumNewRoll}}条 + 本架盘前:{{ BillSumOldRoll }}条 + 本架实盘:{{ BillSumNewRoll }}条 - 本色盘前:{{GoodsCodeNoSumOldRoll}}条 - 本色实盘:{{GoodsCodeNoSumNewRoll}}条 + 本色盘前:{{ GoodsCodeNoSumOldRoll }}条 + 本色实盘:{{ GoodsCodeNoSumNewRoll }}条 - 本缸盘前:{{CrockNoSumOldRoll}}条 - 本缸实盘:{{CrockNoSumNewRoll}}条 + 本缸盘前:{{ CrockNoSumOldRoll }}条 + 本缸实盘:{{ CrockNoSumNewRoll }}条 @@ -55,417 +55,425 @@ - {{CommitType ? '消审' : '审核'}} + {{ CommitType ? '消审' : '审核' }} diff --git a/src/pages/storegoods/storeGoodsBusinessStationMoveOnly.vue b/src/pages/storegoods/storeGoodsBusinessStationMoveOnly.vue index af4f6aa..a53f4a2 100644 --- a/src/pages/storegoods/storeGoodsBusinessStationMoveOnly.vue +++ b/src/pages/storegoods/storeGoodsBusinessStationMoveOnly.vue @@ -3,714 +3,618 @@ 仓库名称* - {{StoreName ? StoreName : '请选择'}} + {{ StoreName ? StoreName : '请选择' }} - - + - {{FromStoreStationName}} + {{ FromStoreStationName }} 整缸 - - + - {{ToStoreStationName}} + {{ ToStoreStationName }} 整架 - - + - {{BillDataMessage}} + {{ BillDataMessage }} - 成品编号:{{FabricGoodsNo}} - 成品重量:{{GoodsQty}}KG + 成品编号:{{ FabricGoodsNo }} + 成品重量:{{ GoodsQty }}KG - 成品色号:{{GoodsCodeNo}} - 成品颜色:{{GoodsCodeName}} + 成品色号:{{ GoodsCodeNo }} + 成品颜色:{{ GoodsCodeName }} - 成品缸号:{{CrockNo}} - 缸号卷号:{{GoodsBillNo}} - + 成品缸号:{{ CrockNo }} + 缸号卷号:{{ GoodsBillNo }} + - 本架条数:{{StoreStationSumRoll}}条 - 本架数量:{{StoreStationSumQty}}KG + 本架条数:{{ StoreStationSumRoll }}条 + 本架数量:{{ StoreStationSumQty }}KG - 本色条数:{{GoodsCodeSumRoll}}条 - 本色数量:{{GoodsCodeSumQty}}KG + 本色条数:{{ GoodsCodeSumRoll }}条 + 本色数量:{{ GoodsCodeSumQty }}KG - 本缸条数:{{CrockNoSumRoll}}条 - 本缸数量:{{CrockNoSumQty}}KG + 本缸条数:{{ CrockNoSumRoll }}条 + 本缸数量:{{ CrockNoSumQty }}KG - + diff --git a/src/pages/sys/workbench/index.vue b/src/pages/sys/workbench/index.vue index 8e83b68..ab2978c 100644 --- a/src/pages/sys/workbench/index.vue +++ b/src/pages/sys/workbench/index.vue @@ -3,12 +3,7 @@ @@ -21,10 +16,7 @@ 成品配布 - + @@ -35,44 +27,31 @@ 成品管理 - + 染整进仓 - + 成品进仓 - + 成品出仓 - + 成品盘点 - + @@ -151,6 +130,7 @@