feat(scanner): 多厂商PDA扫码器兼容方案及扫码功能重构
- 采用策略模式及配置表驱动方式支持多品牌扫码器广播注册 - 实现扫码广播的统一注册和注销管理,支持并发多个扫码广播接收器 - 重构扫码处理逻辑,统一处理扫码结果,支持条码和二维码识别 - 移除原有单一品牌扫码注册,整合商米、新大陆等扫码头支持 - 调整扫码相关页面代码,集成scanMixin,实现扫码广播注册和注销自动化 - 优化扫码结果处理,支持删除模式及整缸扫描状态区分 - 修正多处界面文本格式与代码风格,提高代码一致性和可维护性 - 升级manifest版本号至1.1.3,标记此功能更新
This commit is contained in:
parent
9e4be6db92
commit
9272ed0e23
@ -1,143 +1,175 @@
|
||||
// common/scanMixin.js
|
||||
// 多厂商PDA扫码器兼容方案 - 策略模式 + 配置表驱动
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
scanReceiver: null,
|
||||
isPageActive: false
|
||||
scanReceivers: [], // 支持多个接收器
|
||||
isPageActive: false,
|
||||
registeredBrands: [] // 已注册的品牌
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 注册扫码广播(兼容多种设备)
|
||||
// 扫码器配置表 - 方便扩展新厂商
|
||||
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
|
||||
// }
|
||||
];
|
||||
},
|
||||
|
||||
// 注册所有扫码广播(推荐方式:同时注册所有厂商)
|
||||
registerScanBroadcast(scanCallback) {
|
||||
// #ifdef APP-PLUS
|
||||
const configs = this.getScannerConfigs();
|
||||
|
||||
configs.forEach(config => {
|
||||
try {
|
||||
// 先尝试注册商米扫码头
|
||||
this.registerSunmiBroadcast(scanCallback)
|
||||
.then(() => {
|
||||
console.log('商米扫码头注册成功');
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('商米扫码头注册失败,尝试新大陆扫码头:', error);
|
||||
// 如果商米扫码头注册失败,尝试新大陆扫码头
|
||||
this.registerNewlandBroadcast(scanCallback);
|
||||
});
|
||||
this.registerSingleBroadcast(config, scanCallback);
|
||||
this.registeredBrands.push(config.brand);
|
||||
console.log(`${config.name}扫码广播注册成功`);
|
||||
} catch (error) {
|
||||
console.error("注册扫码广播失败:", error);
|
||||
console.log(`${config.name}扫码广播注册失败:`, error);
|
||||
}
|
||||
});
|
||||
|
||||
if (this.registeredBrands.length > 0) {
|
||||
console.log('扫码广播注册完成,已注册厂商:', this.registeredBrands.join(', '));
|
||||
return true;
|
||||
}
|
||||
|
||||
console.error('所有扫码广播注册均失败');
|
||||
return false;
|
||||
// #endif
|
||||
},
|
||||
|
||||
// 注册指定厂商的扫码广播
|
||||
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
|
||||
},
|
||||
|
||||
// 注册商米扫码头广播接收器
|
||||
registerSunmiBroadcast(scanCallback) {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
// 单个广播注册的核心方法
|
||||
registerSingleBroadcast(config, scanCallback) {
|
||||
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;
|
||||
|
||||
// 如果需要预配置(如东集)
|
||||
if (config.needSetup && config.setupAction) {
|
||||
try {
|
||||
// 导入 Intent 类以使用其方法
|
||||
const Intent = plus.android.importClass("android.content.Intent");
|
||||
const Intent = plus.android.importClass('android.content.Intent');
|
||||
const setupIntent = new Intent(config.setupAction);
|
||||
|
||||
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();
|
||||
} catch (error) {
|
||||
console.error('注册商米广播接收器失败:', error);
|
||||
reject(error);
|
||||
}
|
||||
Object.keys(config.setupParams || {}).forEach(key => {
|
||||
setupIntent.putExtra(key, config.setupParams[key]);
|
||||
});
|
||||
},
|
||||
|
||||
// 注册新大陆扫码头广播接收器
|
||||
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('新大陆扫码枪广播配置完成');
|
||||
main.sendBroadcast(setupIntent);
|
||||
console.log(`${config.name}扫码配置完成`);
|
||||
} catch (error) {
|
||||
console.error("配置新大陆扫码枪广播失败:", error);
|
||||
console.error(`${config.name}扫码配置失败:`, error);
|
||||
}
|
||||
}
|
||||
|
||||
// 注册广播接收器
|
||||
const IntentFilter = plus.android.importClass(
|
||||
"android.content.IntentFilter"
|
||||
);
|
||||
const IntentFilter = plus.android.importClass('android.content.IntentFilter');
|
||||
const filter = new IntentFilter();
|
||||
filter.addAction("com.android.server.scannerservice.broadcast");
|
||||
console.log("添加新大陆广播action完成");
|
||||
filter.addAction(config.action);
|
||||
|
||||
const self = this;
|
||||
const receiver = plus.android.implements(
|
||||
"io.dcloud.feature.internal.reflect.BroadcastReceiver",
|
||||
'io.dcloud.feature.internal.reflect.BroadcastReceiver',
|
||||
{
|
||||
onReceive: (context, intent) => {
|
||||
console.log('新大陆扫码广播接收,isPageActive:', self.isPageActive);
|
||||
// 只有当页面活动时才处理广播
|
||||
console.log(`${config.name}扫码广播接收,isPageActive:`, self.isPageActive);
|
||||
|
||||
if (!self.isPageActive) return;
|
||||
|
||||
try {
|
||||
// 导入 Intent 类以使用其方法
|
||||
const Intent = plus.android.importClass("android.content.Intent");
|
||||
plus.android.importClass('android.content.Intent');
|
||||
const scanResult = intent.getStringExtra(config.dataKey);
|
||||
|
||||
console.log(`${config.name}扫码结果:`, scanResult);
|
||||
|
||||
const scanResult = intent.getStringExtra("scannerdata");
|
||||
console.log("新大陆扫码结果:", scanResult);
|
||||
if (scanResult) {
|
||||
self.handleScanResult(scanResult, scanCallback);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("处理新大陆广播数据时出错:", error);
|
||||
console.error(`处理${config.name}广播数据出错:`, error);
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
// 注册广播接收器
|
||||
main.registerReceiver(receiver, filter);
|
||||
this.scanReceiver = receiver;
|
||||
console.log("新大陆扫码广播注册成功,等待扫码...");
|
||||
} catch (error) {
|
||||
console.error("注册新大陆扫码广播失败:", error);
|
||||
throw error;
|
||||
}
|
||||
|
||||
// 保存接收器引用,用于后续注销
|
||||
this.scanReceivers.push({
|
||||
brand: config.brand,
|
||||
receiver: receiver
|
||||
});
|
||||
},
|
||||
|
||||
// 处理扫码结果的统一方法
|
||||
@ -156,18 +188,30 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
// 取消扫码广播监听
|
||||
// 取消所有扫码广播监听
|
||||
unregisterScanBroadcast() {
|
||||
if (this.scanReceiver) {
|
||||
// #ifdef APP-PLUS
|
||||
if (this.scanReceivers.length === 0) return;
|
||||
|
||||
try {
|
||||
const main = plus.android.runtimeMainActivity();
|
||||
main.unregisterReceiver(this.scanReceiver);
|
||||
this.scanReceiver = null;
|
||||
console.log("扫码广播注销成功");
|
||||
|
||||
this.scanReceivers.forEach(item => {
|
||||
try {
|
||||
main.unregisterReceiver(item.receiver);
|
||||
console.log(`${item.brand}扫码广播注销成功`);
|
||||
} catch (err) {
|
||||
console.error("注销扫码广播失败:", err);
|
||||
console.error(`${item.brand}扫码广播注销失败:`, err);
|
||||
}
|
||||
});
|
||||
|
||||
this.scanReceivers = [];
|
||||
this.registeredBrands = [];
|
||||
console.log('所有扫码广播注销完成');
|
||||
} catch (err) {
|
||||
console.error('注销扫码广播失败:', err);
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
|
||||
// 通用的商品扫描处理方法
|
||||
|
||||
@ -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" : {
|
||||
|
||||
@ -6,31 +6,17 @@
|
||||
<text class="title" style="width: 200px">日期:{{ BillDate }}</text>
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title" style="width: 200px"
|
||||
>客户名称:{{ CustomerName }}</text
|
||||
>
|
||||
<text class="title" style="width: 200px"
|
||||
>销 售 员:{{ SaleUserName }}</text
|
||||
>
|
||||
<text class="title" style="width: 200px">客户名称:{{ CustomerName }}</text>
|
||||
<text class="title" style="width: 200px">销 售 员:{{ SaleUserName }}</text>
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title" style="width: 200px"
|
||||
>仓库名称:{{ StoreName }}{{ ToStoreName }}</text
|
||||
>
|
||||
<text class="title" style="width: 200px">仓库名称:{{ StoreName }}{{ ToStoreName }}</text>
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title" style="width: 200px"
|
||||
>备注内容:{{ BillRemark }}</text
|
||||
>
|
||||
<text class="title" style="width: 200px">备注内容:{{ BillRemark }}</text>
|
||||
</u-form-item>
|
||||
<u-form-item label-width="130" label="条码资料:">
|
||||
<input
|
||||
type="text"
|
||||
v-model="QRBarCode"
|
||||
maxlength="-1"
|
||||
style="width: 170px"
|
||||
@confirm="SalePickBillDetailScan"
|
||||
/>
|
||||
<input type="text" v-model="QRBarCode" maxlength="-1" style="width: 170px" @confirm="SalePickBillDetailScan" />
|
||||
<checkbox-group @change="handleAllCrockNoChange">
|
||||
<checkbox :checked="AllCrockNoScanStatus">整缸</checkbox>
|
||||
</checkbox-group>
|
||||
@ -41,58 +27,38 @@
|
||||
</u-form>
|
||||
<u-form ref="uForm">
|
||||
<u-form-item>
|
||||
<text class="title" style="width: 400px"
|
||||
>成品名称:{{ FabricGoodsNo }}{{ FabricGoodsName }}</text
|
||||
>
|
||||
<text class="title" style="width: 400px">成品名称:{{ FabricGoodsNo }}{{ FabricGoodsName }}</text>
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title" style="width: 400px"
|
||||
>色号颜色:{{ GoodsCodeNo }}{{ GoodsCodeName }}</text
|
||||
>
|
||||
<text class="title" style="width: 400px">色号颜色:{{ GoodsCodeNo }}{{ GoodsCodeName }}</text>
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title" style="width: 200px">成品缸号:{{ CrockNo }}</text>
|
||||
<text class="title" style="width: 200px"
|
||||
>成品卷号:{{ GoodsBillNo }}</text
|
||||
>
|
||||
<text class="title" style="width: 200px">成品卷号:{{ GoodsBillNo }}</text>
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title">{{ BillDataMessage }}</text>
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title" style="width: 130px"
|
||||
>配布条数:{{ BillSumRoll }}</text
|
||||
>
|
||||
<text class="title" style="width: 130px">配布条数:{{ BillSumRoll }}</text>
|
||||
<text class="title" style="width: 130px">数量:{{ BillSumQty }}</text>
|
||||
<text class="title" style="width: 120px">米数:{{ BillSumMQty }}</text>
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title" style="width: 130px"
|
||||
>已配条数:{{ BillScanRoll }}</text
|
||||
>
|
||||
<text class="title" style="width: 130px">已配条数:{{ BillScanRoll }}</text>
|
||||
<text class="title" style="width: 130px">数量:{{ BillScanQty }}</text>
|
||||
<text class="title" style="width: 120px">米数:{{ BillScanMQty }}</text>
|
||||
</u-form-item>
|
||||
<view class="submitView">
|
||||
<u-button
|
||||
type="primary"
|
||||
class="submitBtn"
|
||||
:ripple="true"
|
||||
:loading="submitLoading"
|
||||
ripple-bg-color="#909399"
|
||||
@click="submitBtnFun"
|
||||
>
|
||||
<u-button type="primary" class="submitBtn" :ripple="true" :loading="submitLoading" ripple-bg-color="#909399"
|
||||
@click="submitBtnFun">
|
||||
{{ pageType ? "保存" : "提交" }}
|
||||
</u-button>
|
||||
</view>
|
||||
</u-form>
|
||||
<view class="u-demo-area">
|
||||
<u-toast ref="uToast"></u-toast>
|
||||
<wyb-table
|
||||
ref="table"
|
||||
:headers="headersMaster"
|
||||
:contents="GoodsDetailList"
|
||||
/>
|
||||
<wyb-table ref="table" :headers="headersMaster" :contents="GoodsDetailList" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@ -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: "", // 单号
|
||||
@ -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
|
||||
},
|
||||
|
||||
@ -412,160 +383,6 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
// 注册扫码广播接收器(支持商米和新大陆扫码头)
|
||||
registerScanBroadcast() {
|
||||
try {
|
||||
// 先尝试注册商米扫码头
|
||||
this.registerSunmiBroadcast()
|
||||
.then(() => {
|
||||
console.log('商米扫码头注册成功');
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('商米扫码头注册失败,尝试新大陆扫码头:', error);
|
||||
// 如果商米扫码头注册失败,尝试新大陆扫码头
|
||||
this.registerNewlandBroadcast();
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("注册扫码广播失败:", error);
|
||||
}
|
||||
},
|
||||
|
||||
// 注册商米扫码头广播接收器
|
||||
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");
|
||||
|
||||
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("data");
|
||||
const sourceBytes = intent.getByteArrayExtra("source_byte");
|
||||
|
||||
console.log('商米扫码结果:', scanResult, sourceBytes);
|
||||
|
||||
if (scanResult) {
|
||||
this.handleScanResult(scanResult);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('处理商米广播数据时出错:', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// 注册广播接收器
|
||||
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);
|
||||
}
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
// 注册广播接收器
|
||||
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);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
SalePickBillDetailScan() {
|
||||
// 聚焦输入框触发的方法
|
||||
this.handleScans();
|
||||
@ -601,13 +418,13 @@ export default {
|
||||
}
|
||||
},
|
||||
// 新增提交订单的方法
|
||||
submitOrder: function() {
|
||||
submitOrder: function () {
|
||||
this.submitLoading = true
|
||||
this.$u.api.outFpmArrangeOrder({
|
||||
id: parseInt(this.BillMasterID)
|
||||
}).then(res => {
|
||||
this.submitLoading = false
|
||||
console.log('outFpmArrangeOrder res',res)
|
||||
console.log('outFpmArrangeOrder res', res)
|
||||
if (res) {
|
||||
this.BillDataMessage = "成功生成出仓单!";
|
||||
this.playSuccess();
|
||||
@ -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%;
|
||||
|
||||
@ -2,12 +2,12 @@
|
||||
<view class="wrap">
|
||||
<u-form ref="uForm">
|
||||
<u-form-item>
|
||||
<text class="title" style="width:200px;">单号:{{GoodsCheckBillNo}}</text>
|
||||
<text class="title" style="width:200px;">日期:{{GoodsCheckBillDate}}</text>
|
||||
<text class="title" style="width:200px;">单号:{{ GoodsCheckBillNo }}</text>
|
||||
<text class="title" style="width:200px;">日期:{{ GoodsCheckBillDate }}</text>
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title" style="width:200px;">仓库名称:{{StoreName}}</text>
|
||||
<text class="title" style="width:200px;">仓位名称:{{StoreStationName}}</text>
|
||||
<text class="title" style="width:200px;">仓库名称:{{ StoreName }}</text>
|
||||
<text class="title" style="width:200px;">仓位名称:{{ StoreStationName }}</text>
|
||||
</u-form-item>
|
||||
<u-form-item label-width="150" label="条码资料:">
|
||||
<input type="text" v-model="QRBarCode" maxlength="-1" style="width:200px;"
|
||||
@ -17,32 +17,32 @@
|
||||
</checkbox-group>
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title">{{BillDataMessage}}</text>
|
||||
<text class="title">{{ BillDataMessage }}</text>
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title" style="width:200px;">成品编号:{{FabricGoodsNo}}</text>
|
||||
<text class="title" style="width:200px;">成品重量:{{GoodsQty}}KG</text>
|
||||
<text class="title" style="width:200px;">成品编号:{{ FabricGoodsNo }}</text>
|
||||
<text class="title" style="width:200px;">成品重量:{{ GoodsQty }}KG</text>
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title" style="width:200px;">成品色号:{{GoodsCodeNo}}</text>
|
||||
<text class="title" style="width:200px;">成品颜色:{{GoodsCodeName}}</text>
|
||||
<text class="title" style="width:200px;">成品色号:{{ GoodsCodeNo }}</text>
|
||||
<text class="title" style="width:200px;">成品颜色:{{ GoodsCodeName }}</text>
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title" style="width:200px;">成品缸号:{{CrockNo}}</text>
|
||||
<text class="title" style="width:200px;">缸号卷号:{{GoodsBillNo}}</text>
|
||||
<text class="title" style="width:200px;">成品缸号:{{ CrockNo }}</text>
|
||||
<text class="title" style="width:200px;">缸号卷号:{{ GoodsBillNo }}</text>
|
||||
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title" style="width:200px;">本架盘前:{{BillSumOldRoll}}条</text>
|
||||
<text class="title" style="width:200px;">本架实盘:{{BillSumNewRoll}}条</text>
|
||||
<text class="title" style="width:200px;">本架盘前:{{ BillSumOldRoll }}条</text>
|
||||
<text class="title" style="width:200px;">本架实盘:{{ BillSumNewRoll }}条</text>
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title" style="width:200px;">本色盘前:{{GoodsCodeNoSumOldRoll}}条</text>
|
||||
<text class="title" style="width:200px;">本色实盘:{{GoodsCodeNoSumNewRoll}}条</text>
|
||||
<text class="title" style="width:200px;">本色盘前:{{ GoodsCodeNoSumOldRoll }}条</text>
|
||||
<text class="title" style="width:200px;">本色实盘:{{ GoodsCodeNoSumNewRoll }}条</text>
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title" style="width:200px;">本缸盘前:{{CrockNoSumOldRoll}}条</text>
|
||||
<text class="title" style="width:200px;">本缸实盘:{{CrockNoSumNewRoll}}条</text>
|
||||
<text class="title" style="width:200px;">本缸盘前:{{ CrockNoSumOldRoll }}条</text>
|
||||
<text class="title" style="width:200px;">本缸实盘:{{ CrockNoSumNewRoll }}条</text>
|
||||
</u-form-item>
|
||||
</u-form>
|
||||
<view class="u-demo-area">
|
||||
@ -55,23 +55,23 @@
|
||||
<view class="submitView">
|
||||
<u-button type="primary" style="width:100px;" class="commitBtn" :ripple="true" ripple-bg-color="#909399"
|
||||
@click="commitBtnFun">
|
||||
{{CommitType ? '消审' : '审核'}}
|
||||
{{ CommitType ? '消审' : '审核' }}
|
||||
</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import util, {
|
||||
import util, {
|
||||
parFabricGoodsBarCode2D,
|
||||
parYarnGoodsBarCode2D,
|
||||
playSuccessAudio,
|
||||
playErrorAudio
|
||||
} from '../../common/util';
|
||||
import scanMixin from '@/common/scanMixin.js';
|
||||
import wybTable from '@/components/wyb-table/wyb-table.vue';
|
||||
//let that = '';
|
||||
export default {
|
||||
} from '../../common/util';
|
||||
import scanMixin from '@/common/scanMixin.js';
|
||||
import wybTable from '@/components/wyb-table/wyb-table.vue';
|
||||
//let that = '';
|
||||
export default {
|
||||
mixins: [scanMixin],
|
||||
data() {
|
||||
return {
|
||||
@ -147,27 +147,35 @@
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 调用 mixin 中的 onShow 方法
|
||||
if (this.$options.mixins && this.$options.mixins[0] && this.$options.mixins[0].onShow) {
|
||||
this.$options.mixins[0].onShow.call(this);
|
||||
}
|
||||
// 设置页面激活状态
|
||||
this.isPageActive = true;
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
this.registerScanBroadcast((scanResult) => {
|
||||
console.log("扫码结果:", scanResult);
|
||||
|
||||
// 处理扫描结果,按照原有逻辑
|
||||
if(!this.QRBarCode){
|
||||
console.log("请先扫描资料!", scanResult);
|
||||
// 处理扫描结果
|
||||
this.QRBarCode = scanResult;
|
||||
this.$nextTick(() => {
|
||||
this.GoodsCheckBillDetailScan();
|
||||
});
|
||||
return;
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
|
||||
onHide() {
|
||||
this.isPageActive = false;
|
||||
// #ifdef APP-PLUS
|
||||
this.unregisterScanBroadcast();
|
||||
// #endif
|
||||
},
|
||||
|
||||
onUnload() {
|
||||
this.isPageActive = false;
|
||||
// #ifdef APP-PLUS
|
||||
this.unregisterScanBroadcast();
|
||||
// #endif
|
||||
},
|
||||
methods: {
|
||||
// 添加通用错误提示方法
|
||||
showError(message) {
|
||||
@ -186,7 +194,7 @@
|
||||
util.playErrorAudio();
|
||||
},
|
||||
|
||||
BarCodeDelChange: function() {
|
||||
BarCodeDelChange: function () {
|
||||
this.BarCodeDelStatus = !this.BarCodeDelStatus;
|
||||
},
|
||||
|
||||
@ -204,13 +212,13 @@
|
||||
|
||||
var aQRBarCode = '';
|
||||
var aBarCode = '';
|
||||
if (cleanCode.startsWith('66^')>0 || cleanCode.startsWith('99^')>0 || /[\u4E00-\u9FA5]/.test(cleanCode)){
|
||||
if (cleanCode.startsWith('66^') > 0 || cleanCode.startsWith('99^') > 0 || /[\u4E00-\u9FA5]/.test(cleanCode)) {
|
||||
aQRBarCode = cleanCode
|
||||
}else {
|
||||
} else {
|
||||
aBarCode = cleanCode;
|
||||
}
|
||||
|
||||
if (aQRBarCode == '' && aBarCode == ''){
|
||||
if (aQRBarCode == '' && aBarCode == '') {
|
||||
this.QRBarCode = '';
|
||||
this.aBarCode = ''
|
||||
this.showError('请扫描二维码或者条码');
|
||||
@ -233,7 +241,7 @@
|
||||
},
|
||||
success: (res) => {
|
||||
console.log("-->>--" + JSON.stringify(res.data));
|
||||
if (res.data.code == '0'){
|
||||
if (res.data.code == '0') {
|
||||
let aResultData = res.data.data;
|
||||
this.FabricGoodsNo = aResultData.product_code;
|
||||
this.FabricGoodsName = aResultData.product_name;
|
||||
@ -242,12 +250,12 @@
|
||||
this.CrockNo = aResultData.dyelot_number;
|
||||
this.GoodsBillNo = aResultData.volume_number;
|
||||
this.GoodsQty = aResultData.weight / 10000;
|
||||
this.BillSumOldRoll = aResultData.warehouse_bin_check_before_roll/100;
|
||||
this.BillSumNewRoll = aResultData.warehouse_bin_check_roll/100;
|
||||
this.GoodsCodeNoSumOldRoll = aResultData.color_check_before_roll/100;
|
||||
this.GoodsCodeNoSumNewRoll = aResultData.color_check_roll/100;
|
||||
this.CrockNoSumOldRoll = aResultData.dye_check_before_roll/100;
|
||||
this.CrockNoSumNewRoll = aResultData.dye_check_roll/100;
|
||||
this.BillSumOldRoll = aResultData.warehouse_bin_check_before_roll / 100;
|
||||
this.BillSumNewRoll = aResultData.warehouse_bin_check_roll / 100;
|
||||
this.GoodsCodeNoSumOldRoll = aResultData.color_check_before_roll / 100;
|
||||
this.GoodsCodeNoSumNewRoll = aResultData.color_check_roll / 100;
|
||||
this.CrockNoSumOldRoll = aResultData.dye_check_before_roll / 100;
|
||||
this.CrockNoSumNewRoll = aResultData.dye_check_roll / 100;
|
||||
|
||||
this.playSuccess();
|
||||
this.GoodsCheckBillDetailData();
|
||||
@ -261,12 +269,12 @@
|
||||
},
|
||||
fail: (error) => {
|
||||
this.showError('连接服务器出错,请检查后台服务是否启动!');
|
||||
console.log('error',error)
|
||||
console.log('error', error)
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
GoodsCheckBillDetailData: function() {
|
||||
GoodsCheckBillDetailData: function () {
|
||||
console.log("--aaa->>" + this.GoodsCheckBillID);
|
||||
console.log("--aaa->>" + this.GoodsCheckBillID);
|
||||
util.request({
|
||||
@ -302,7 +310,7 @@
|
||||
},
|
||||
|
||||
// 审核按钮方法
|
||||
commitBtnFun: function() {
|
||||
commitBtnFun: function () {
|
||||
if (this.BillMasterID <= 0) {
|
||||
this.showError('当前单据未提交,不能审核或消审!');
|
||||
return;
|
||||
@ -320,7 +328,7 @@
|
||||
// this.BillDataMessage = '当前' + aCommitRecallName + '操作配置有误,不能审核!';
|
||||
// return;
|
||||
// }
|
||||
console.log('GoodsCheckBillID',this.GoodsCheckBillID)
|
||||
console.log('GoodsCheckBillID', this.GoodsCheckBillID)
|
||||
util.request({
|
||||
url: '/product/productCheckOrder/updateProductCheckOrderAuditStatusPass',
|
||||
method: 'put',
|
||||
@ -328,10 +336,10 @@
|
||||
'id': parseInt(this.GoodsCheckBillID),
|
||||
},
|
||||
success: (res) => {
|
||||
console.log('审核',res)
|
||||
console.log('审核', res)
|
||||
if (res.data.code == '0') {
|
||||
var aResultData = JSON.parse(res.data.data);
|
||||
console.log('aResultData',aResultData)
|
||||
console.log('aResultData', aResultData)
|
||||
if (aResultData.code == '0' && aResultData.msg ==
|
||||
'success') {
|
||||
this.playSuccess();
|
||||
@ -358,20 +366,20 @@
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
page {
|
||||
background-color: #F8F8F8;
|
||||
padding-bottom: 260rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.u-radio {
|
||||
.u-radio {
|
||||
width: 200rpx !important;
|
||||
}
|
||||
}
|
||||
|
||||
.submitView {
|
||||
.submitView {
|
||||
width: 100%;
|
||||
padding: 16rpx 0 26rpx;
|
||||
background-color: #FFFFFF;
|
||||
@ -383,19 +391,19 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 100;
|
||||
}
|
||||
}
|
||||
|
||||
.submitBtn {
|
||||
.submitBtn {
|
||||
width: 666rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.productBox {
|
||||
.productBox {
|
||||
background-color: #FFFFFF;
|
||||
margin-top: 32rpx;
|
||||
padding: 26rpx 0;
|
||||
}
|
||||
}
|
||||
|
||||
.tjcpName {
|
||||
.tjcpName {
|
||||
width: 686rpx;
|
||||
height: 40rpx;
|
||||
font-size: 16px;
|
||||
@ -404,60 +412,60 @@
|
||||
padding-left: 12rpx;
|
||||
margin-left: 26rpx;
|
||||
margin-top: 26rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.cpInput {
|
||||
.cpInput {
|
||||
width: 150rpx !important;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.cpInput>input {
|
||||
.cpInput>input {
|
||||
box-sizing: border-box;
|
||||
border: 1rpx solid #DDDDDD;
|
||||
width: 100%;
|
||||
height: 60rpx;
|
||||
border-radius: 10rpx;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.cpInput1 {
|
||||
.cpInput1 {
|
||||
width: 200rpx !important;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.cpInput1>input {
|
||||
.cpInput1>input {
|
||||
box-sizing: border-box;
|
||||
border: 1rpx solid #DDDDDD;
|
||||
width: 100%;
|
||||
height: 60rpx;
|
||||
border-radius: 10rpx;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.clearIcon {
|
||||
.clearIcon {
|
||||
position: absolute;
|
||||
right: 6rpx;
|
||||
top: 6rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.greenPrice {
|
||||
.greenPrice {
|
||||
font-size: 16px;
|
||||
color: #19BE6B !important;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.disFlex {
|
||||
.disFlex {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.inputName {
|
||||
.inputName {
|
||||
color: #ADADAD;
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.addHKQS {
|
||||
.addHKQS {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 16rpx 26rpx;
|
||||
@ -467,5 +475,5 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -3,94 +3,79 @@
|
||||
<u-form ref="uForm">
|
||||
<view @click="pickerSelectFun('仓库名称')" class="flex-white-plr26 ptb20 bdb_f5 first">
|
||||
<text class="mr26">仓库名称<text class="redXingh">*</text></text>
|
||||
<view :class="StoreName ? '' : 'cBlack'"> {{StoreName ? StoreName : '请选择'}}
|
||||
<view :class="StoreName ? '' : 'cBlack'"> {{ StoreName ? StoreName : '请选择' }}
|
||||
<u-icon class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<u-form-item label-width="150" label="调出仓位:"
|
||||
:class="{'input-highlight': shouldHighlightFrom}"
|
||||
>
|
||||
<input type="text"
|
||||
v-model="FromStoreStationNo"
|
||||
maxlength="-1"
|
||||
style="width:100px;"
|
||||
<u-form-item label-width="150" label="调出仓位:" :class="{ 'input-highlight': shouldHighlightFrom }">
|
||||
<input type="text" v-model="FromStoreStationNo" maxlength="-1" style="width:100px;"
|
||||
@confirm="GetFromStoreStationName" />
|
||||
<text style="width:100px;">{{FromStoreStationName}}</text>
|
||||
<text style="width:100px;">{{ FromStoreStationName }}</text>
|
||||
<checkbox-group @change="AllCrockNoCheckChange">
|
||||
<checkbox ref="checkBoxRef" :checked="AllCrockNoScanStatus">整缸</checkbox>
|
||||
</checkbox-group>
|
||||
</u-form-item>
|
||||
<u-form-item label-width="150" label="调至仓位:"
|
||||
:class="{'input-highlight': shouldHighlightTo}"
|
||||
|
||||
>
|
||||
<input type="text"
|
||||
v-model="ToStoreStationNo"
|
||||
maxlength="-1"
|
||||
style="width:100px;"
|
||||
<u-form-item label-width="150" label="调至仓位:" :class="{ 'input-highlight': shouldHighlightTo }">
|
||||
<input type="text" v-model="ToStoreStationNo" maxlength="-1" style="width:100px;"
|
||||
@confirm="GetToStoreStationName" />
|
||||
<text style="width:100px;">{{ToStoreStationName}}</text>
|
||||
<text style="width:100px;">{{ ToStoreStationName }}</text>
|
||||
<checkbox-group @change="AllStoreStationChange">
|
||||
<checkbox ref="checkBoxRef" :checked="AllStoreStationScanStatus">整架</checkbox>
|
||||
</checkbox-group>
|
||||
</u-form-item>
|
||||
<u-form-item label-width="150" label="条码资料:"
|
||||
:class="{'input-highlight': shouldHighlightQR}"
|
||||
|
||||
>
|
||||
<input type="text"
|
||||
v-model="QRBarCode"
|
||||
maxlength="-1"
|
||||
style="width:150px;"
|
||||
<u-form-item label-width="150" label="条码资料:" :class="{ 'input-highlight': shouldHighlightQR }">
|
||||
<input type="text" v-model="QRBarCode" maxlength="-1" style="width:150px;"
|
||||
@confirm="GoodsStoreStationMoveScan" />
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title">{{BillDataMessage}}</text>
|
||||
<text class="title">{{ BillDataMessage }}</text>
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title" style="width:200px;">成品编号:{{FabricGoodsNo}}</text>
|
||||
<text class="title" style="width:200px;">成品重量:{{GoodsQty}}KG</text>
|
||||
<text class="title" style="width:200px;">成品编号:{{ FabricGoodsNo }}</text>
|
||||
<text class="title" style="width:200px;">成品重量:{{ GoodsQty }}KG</text>
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title" style="width:200px;">成品色号:{{GoodsCodeNo}}</text>
|
||||
<text class="title" style="width:200px;">成品颜色:{{GoodsCodeName}}</text>
|
||||
<text class="title" style="width:200px;">成品色号:{{ GoodsCodeNo }}</text>
|
||||
<text class="title" style="width:200px;">成品颜色:{{ GoodsCodeName }}</text>
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title" style="width:200px;">成品缸号:{{CrockNo}}</text>
|
||||
<text class="title" style="width:200px;">缸号卷号:{{GoodsBillNo}}</text>
|
||||
<text class="title" style="width:200px;">成品缸号:{{ CrockNo }}</text>
|
||||
<text class="title" style="width:200px;">缸号卷号:{{ GoodsBillNo }}</text>
|
||||
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title" style="width:200px;">本架条数:{{StoreStationSumRoll}}条</text>
|
||||
<text class="title" style="width:200px;">本架数量:{{StoreStationSumQty}}KG</text>
|
||||
<text class="title" style="width:200px;">本架条数:{{ StoreStationSumRoll }}条</text>
|
||||
<text class="title" style="width:200px;">本架数量:{{ StoreStationSumQty }}KG</text>
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title" style="width:200px;">本色条数:{{GoodsCodeSumRoll}}条</text>
|
||||
<text class="title" style="width:200px;">本色数量:{{GoodsCodeSumQty}}KG</text>
|
||||
<text class="title" style="width:200px;">本色条数:{{ GoodsCodeSumRoll }}条</text>
|
||||
<text class="title" style="width:200px;">本色数量:{{ GoodsCodeSumQty }}KG</text>
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<text class="title" style="width:200px;">本缸条数:{{CrockNoSumRoll}}条</text>
|
||||
<text class="title" style="width:200px;">本缸数量:{{CrockNoSumQty}}KG</text>
|
||||
<text class="title" style="width:200px;">本缸条数:{{ CrockNoSumRoll }}条</text>
|
||||
<text class="title" style="width:200px;">本缸数量:{{ CrockNoSumQty }}KG</text>
|
||||
</u-form-item>
|
||||
</u-form>
|
||||
<view class="u-demo-area">
|
||||
<u-toast ref="uToast"></u-toast>
|
||||
<wyb-table ref="table" :headers="headersMaster" :contents="GoodsDetailList"/>
|
||||
<wyb-table ref="table" :headers="headersMaster" :contents="GoodsDetailList" />
|
||||
</view>
|
||||
<u-select v-model="selectShow" :list="selectList" @confirm="selectConfirmFun"></u-select>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
let that = '';
|
||||
import util, {
|
||||
let that = '';
|
||||
import util, {
|
||||
parFabricGoodsBarCode2D,
|
||||
parYarnGoodsBarCode2D,
|
||||
playSuccessAudio,
|
||||
playErrorAudio
|
||||
} from '../../common/util';
|
||||
import wybTable from '@/components/wyb-table/wyb-table.vue';
|
||||
export default {
|
||||
} from '../../common/util';
|
||||
import wybTable from '@/components/wyb-table/wyb-table.vue';
|
||||
import scanMixin from '@/common/scanMixin.js';
|
||||
export default {
|
||||
mixins: [scanMixin],
|
||||
data() {
|
||||
return {
|
||||
borderColor: '#e4e7ed',
|
||||
@ -130,13 +115,14 @@
|
||||
StoreNameDataList: [],
|
||||
GoodsDetailList: [],
|
||||
BillDataMessage: '',
|
||||
// scanReceiver 和 isPageActive 已由 scanMixin 提供
|
||||
headersMaster: [{
|
||||
label: '成品编号',
|
||||
key: 'product_code'
|
||||
}, {
|
||||
label: '成品名称',
|
||||
key: 'product_name'
|
||||
},{
|
||||
}, {
|
||||
label: '成品色号',
|
||||
key: 'product_color_code'
|
||||
}, {
|
||||
@ -151,9 +137,7 @@
|
||||
}, {
|
||||
label: '数量',
|
||||
key: 'weight'
|
||||
}],
|
||||
scanReceiver: null,
|
||||
isPageActive: false, // 添加页面活动状态标志
|
||||
}]
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
@ -167,30 +151,11 @@
|
||||
this.StoreName = getApp().globalData.StoreName;
|
||||
};
|
||||
// #ifdef APP-PLUS
|
||||
this.isPageActive = true;
|
||||
this.registerScanBroadcast();
|
||||
// #endif
|
||||
/* uni.$on('bjdKehuBindFun', that.bjdKehuBindFun)
|
||||
uni.$on('chanpinBindFun', that.chanpinBindFun)
|
||||
uni.$on('bjdLxrBindFun', that.bjdLxrBindFun)
|
||||
uni.$on('shangjiBindFun', that.shangjiBindFun) */
|
||||
},
|
||||
onUnload() {
|
||||
// #ifdef APP-PLUS
|
||||
this.isPageActive = false;
|
||||
// this.unregisterBroadcast();
|
||||
// 使用 scanMixin 的方法注册扫码广播,传入自定义回调
|
||||
this.registerScanBroadcast(this.handleScanCode);
|
||||
// #endif
|
||||
},
|
||||
|
||||
onHide() {
|
||||
// 页面隐藏时
|
||||
this.isPageActive = false;
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 页面显示时
|
||||
this.isPageActive = true;
|
||||
},
|
||||
// onUnload, onHide, onShow 已由 scanMixin 自动处理
|
||||
/* onBackPress() {
|
||||
uni.$off('bjdKehuBindFun', that.bjdKehuBindFun)
|
||||
uni.$off('chanpinBindFun', that.chanpinBindFun)
|
||||
@ -216,18 +181,48 @@
|
||||
util.playErrorAudio();
|
||||
},
|
||||
|
||||
AllCrockNoCheckChange:function () {
|
||||
// 自定义扫码处理回调 - 处理本页面特有的扫码逻辑
|
||||
handleScanCode(scanResult) {
|
||||
console.log("扫码结果:", scanResult);
|
||||
|
||||
if (!this.StoreName) {
|
||||
this.showError("请先选择仓库名称");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.FromStoreStationNo) {
|
||||
this.FromStoreStationNo = scanResult;
|
||||
this.$nextTick(() => {
|
||||
this.GetFromStoreStationName();
|
||||
});
|
||||
return;
|
||||
} else if (!this.ToStoreStationNo) {
|
||||
this.ToStoreStationNo = scanResult;
|
||||
this.$nextTick(() => {
|
||||
this.GetToStoreStationName();
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
this.QRBarCode = scanResult;
|
||||
this.$nextTick(() => {
|
||||
this.GoodsStoreStationMoveScan();
|
||||
});
|
||||
return;
|
||||
}
|
||||
},
|
||||
|
||||
AllCrockNoCheckChange: function () {
|
||||
this.AllCrockNoScanStatus = !this.AllCrockNoScanStatus;
|
||||
this.AllStoreStationScanStatus = false;
|
||||
},
|
||||
|
||||
AllStoreStationChange:function () {
|
||||
AllStoreStationChange: function () {
|
||||
this.AllStoreStationScanStatus = !this.AllStoreStationScanStatus;
|
||||
this.AllCrockNoScanStatus = false;
|
||||
},
|
||||
|
||||
// 展示相应数据选择框
|
||||
pickerSelectFun: function(str) {
|
||||
pickerSelectFun: function (str) {
|
||||
that.selectList = [];
|
||||
if (str == '仓库名称') {
|
||||
that.selectList = this.StoreNameDataList;
|
||||
@ -237,7 +232,7 @@
|
||||
that.selectType = str;
|
||||
},
|
||||
|
||||
scanFun: function() {
|
||||
scanFun: function () {
|
||||
uni.scanCode({
|
||||
success(res) {
|
||||
that.code = res.result;
|
||||
@ -246,7 +241,7 @@
|
||||
},
|
||||
|
||||
// 选择框选中事件
|
||||
selectConfirmFun: function(e) {
|
||||
selectConfirmFun: function (e) {
|
||||
if (that.selectType == '仓库名称') {
|
||||
that.StoreNameID = e[0].value;
|
||||
that.StoreName = e[0].label;
|
||||
@ -257,102 +252,8 @@
|
||||
/* that.selectType = str; */
|
||||
},
|
||||
|
||||
// 注册扫码广播接收器
|
||||
registerScanBroadcast() {
|
||||
try {
|
||||
const main = plus.android.runtimeMainActivity();
|
||||
// registerScanBroadcast 和 unregisterScanBroadcast 已由 scanMixin 提供
|
||||
|
||||
// 先配置扫码枪广播设置
|
||||
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);
|
||||
} 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) => {
|
||||
// 只有当页面活动时才处理广播
|
||||
if (!this.isPageActive) return;
|
||||
|
||||
try {
|
||||
console.log("Newland intent:", intent);
|
||||
const scanResult = intent.getStringExtra("scannerdata");
|
||||
console.log("配布单详情-扫码结果:", scanResult);
|
||||
if(!this.StoreName){
|
||||
this.showError("请先选择仓库名称");
|
||||
return
|
||||
}
|
||||
if (scanResult) {
|
||||
if(!this.FromStoreStationNo){
|
||||
this.FromStoreStationNo = scanResult
|
||||
this.$nextTick(() => {
|
||||
this.GetFromStoreStationName();
|
||||
});
|
||||
return
|
||||
}else if(!this.ToStoreStationNo){
|
||||
this.ToStoreStationNo = scanResult;
|
||||
this.$nextTick(() => {
|
||||
this.GetToStoreStationName();
|
||||
});
|
||||
return
|
||||
|
||||
}else if(!this.QRBarCode) {
|
||||
this.QRBarCode = scanResult;
|
||||
this.$nextTick(() => {
|
||||
this.GoodsStoreStationMoveScan();
|
||||
});
|
||||
return
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
this.showError("处理扫码数据时出错");
|
||||
console.error("处理广播数据时出错:", error, error.stack);
|
||||
}
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
// 注册广播接收器
|
||||
main.registerReceiver(receiver, filter);
|
||||
this.scanReceiver = receiver;
|
||||
console.log("扫码广播注册成功,等待扫码...");
|
||||
} catch (error) {
|
||||
console.error("注册扫码广播失败:", error);
|
||||
console.error("错误详情:", error.message);
|
||||
console.error("错误堆栈:", error.stack);
|
||||
}
|
||||
},
|
||||
|
||||
// 注销扫码广播接收器
|
||||
unregisterScanBroadcast() {
|
||||
if (this.scanReceiver) {
|
||||
try {
|
||||
const main = plus.android.runtimeMainActivity();
|
||||
main.unregisterReceiver(this.scanReceiver);
|
||||
this.scanReceiver = null;
|
||||
console.log("扫码广播注销成功");
|
||||
} catch (error) {
|
||||
console.error("注销扫码广播失败:", error);
|
||||
}
|
||||
}
|
||||
},
|
||||
// 添加一个通用的错误提示方法
|
||||
showError(message) {
|
||||
this.playError();
|
||||
@ -371,7 +272,7 @@
|
||||
},
|
||||
success: (res) => {
|
||||
console.log("getStoreNameData" + res);
|
||||
if (res.data.code == '0' && res.data.msg == 'success'){
|
||||
if (res.data.code == '0' && res.data.msg == 'success') {
|
||||
var aResultData = res.data.data.list;
|
||||
for (var i = 0; i < aResultData.length; i++) {
|
||||
this.StoreNameDataList.push({
|
||||
@ -380,20 +281,20 @@
|
||||
})
|
||||
}
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.StoreNameDataList = []
|
||||
}
|
||||
},
|
||||
fail: (error) => {
|
||||
this.showError('连接服务器出错,请检查后台服务是否启动!' + error.errMsg);
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
uni.hideLoading();
|
||||
}, 5000);
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
GetFromStoreStationName: function() {
|
||||
GetFromStoreStationName: function () {
|
||||
console.log("<<<>>>>>" + this.FromStoreStationNo + '<<<<>>>>');
|
||||
util.request({
|
||||
url: '/warehouse/warehouseBin/getWarehouseBin',
|
||||
@ -402,9 +303,9 @@
|
||||
'qr_code': this.FromStoreStationNo,
|
||||
},
|
||||
success: (res) => {
|
||||
console.log('GetFromStoreStationName',res)
|
||||
if (res.data.msg == 'success'){
|
||||
if(res.data.data.physical_warehouse_id !== this.StoreNameID) {
|
||||
console.log('GetFromStoreStationName', res)
|
||||
if (res.data.msg == 'success') {
|
||||
if (res.data.data.physical_warehouse_id !== this.StoreNameID) {
|
||||
this.showError('该仓位不属于当前仓库')
|
||||
return
|
||||
}
|
||||
@ -420,14 +321,14 @@
|
||||
},
|
||||
fail: (error) => {
|
||||
this.showError('连接服务器出错,请检查后台服务是否启动!' + error.errMsg);
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
uni.hideLoading();
|
||||
}, 5000);
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
GetToStoreStationName: function() {
|
||||
GetToStoreStationName: function () {
|
||||
console.log("<<<>>>>>" + this.ToStoreStationNo + '<<<<>>>>');
|
||||
util.request({
|
||||
url: '/warehouse/warehouseBin/getWarehouseBin',
|
||||
@ -436,8 +337,8 @@
|
||||
'qr_code': this.ToStoreStationNo,
|
||||
},
|
||||
success: (res) => {
|
||||
if (res.data.msg == 'success'){
|
||||
if(res.data.data.physical_warehouse_id !== this.StoreNameID) {
|
||||
if (res.data.msg == 'success') {
|
||||
if (res.data.data.physical_warehouse_id !== this.StoreNameID) {
|
||||
this.showError('该仓位不属于当前仓库')
|
||||
return
|
||||
}
|
||||
@ -453,7 +354,7 @@
|
||||
},
|
||||
fail: (error) => {
|
||||
this.showError('连接服务器出错,请检查后台服务是否启动!' + error.errMsg);
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
uni.hideLoading();
|
||||
}, 5000);
|
||||
},
|
||||
@ -472,41 +373,41 @@
|
||||
}
|
||||
|
||||
let aAllStoreStationScanStatus = 0;
|
||||
if (this.AllStoreStationScanStatus){
|
||||
if (this.AllStoreStationScanStatus) {
|
||||
aAllStoreStationScanStatus = '1';
|
||||
};
|
||||
|
||||
let aAllCrockNoScanStatus = 0;
|
||||
if (this.AllCrockNoScanStatus){
|
||||
if (this.AllCrockNoScanStatus) {
|
||||
aAllCrockNoScanStatus = '1';
|
||||
};
|
||||
|
||||
if (this.AllStoreStationScanStatus && this.FromStoreStationName == ''){
|
||||
if (this.AllStoreStationScanStatus && this.FromStoreStationName == '') {
|
||||
this.showError('选择整架调仓位,必须要先输入调出仓位');
|
||||
return;
|
||||
};
|
||||
|
||||
if (this.aAllCrockNoScanStatus && this.FromStoreStationName == ''){
|
||||
if (this.aAllCrockNoScanStatus && this.FromStoreStationName == '') {
|
||||
this.showError('选择整缸调仓位,必须要先输入调出仓位');
|
||||
return;
|
||||
};
|
||||
|
||||
let aTypeID = 1;
|
||||
if (this.aAllCrockNoScanStatus){
|
||||
if (this.aAllCrockNoScanStatus) {
|
||||
aTypeID = 2
|
||||
} else if (this.AllStoreStationScanStatus){
|
||||
} else if (this.AllStoreStationScanStatus) {
|
||||
aTypeID = 3
|
||||
}
|
||||
|
||||
var aQRBarCode = '';
|
||||
var aBarCode = '';
|
||||
if (this.QRBarCode.startsWith('66^')>0){
|
||||
if (this.QRBarCode.startsWith('66^') > 0) {
|
||||
aQRBarCode = this.QRBarCode
|
||||
}else {
|
||||
} else {
|
||||
aBarCode = this.QRBarCode;
|
||||
}
|
||||
|
||||
if (aQRBarCode == ''){
|
||||
if (aQRBarCode == '') {
|
||||
this.QRBarCode = '';
|
||||
this.QRBarCodeFocus = false;
|
||||
this.$nextTick(() => {
|
||||
@ -527,7 +428,7 @@
|
||||
},
|
||||
success: (res) => {
|
||||
console.log("-->>--" + JSON.stringify(res.data.data));
|
||||
if (res.data.code == '0'){
|
||||
if (res.data.code == '0') {
|
||||
let aResultData = res.data.data;
|
||||
this.FabricGoodsNo = aResultData.product_code;
|
||||
this.FabricGoodsName = aResultData.product_name;
|
||||
@ -536,12 +437,12 @@
|
||||
this.CrockNo = aResultData.dyelot_number;
|
||||
this.GoodsBillNo = aResultData.volume_number;
|
||||
this.GoodsQty = aResultData.weight / 10000;
|
||||
this.StoreStationSumRoll = aResultData.warehouse_bin_roll/100;
|
||||
this.StoreStationSumQty = aResultData.warehouse_bin_weight/10000;
|
||||
this.GoodsCodeSumRoll = aResultData.color_roll/100;
|
||||
this.GoodsCodeSumQty = aResultData.color_weight/10000;
|
||||
this.CrockNoSumRoll = aResultData.dye_roll/100;
|
||||
this.CrockNoSumQty = aResultData.dye_weight/10000;
|
||||
this.StoreStationSumRoll = aResultData.warehouse_bin_roll / 100;
|
||||
this.StoreStationSumQty = aResultData.warehouse_bin_weight / 10000;
|
||||
this.GoodsCodeSumRoll = aResultData.color_roll / 100;
|
||||
this.GoodsCodeSumQty = aResultData.color_weight / 10000;
|
||||
this.CrockNoSumRoll = aResultData.dye_roll / 100;
|
||||
this.CrockNoSumQty = aResultData.dye_weight / 10000;
|
||||
|
||||
this.playSuccess();
|
||||
this.GoodsStoreStationMoveData();
|
||||
@ -565,7 +466,7 @@
|
||||
})
|
||||
},
|
||||
|
||||
GoodsStoreStationMoveData: function() {
|
||||
GoodsStoreStationMoveData: function () {
|
||||
util.request({
|
||||
url: '/product/stockProduct/getStockProductDyelotNumberList',
|
||||
method: 'GET',
|
||||
@ -593,30 +494,33 @@
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.first{
|
||||
.first {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.wrap{
|
||||
}
|
||||
|
||||
.wrap {
|
||||
width: 100vw;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.input-highlight {
|
||||
border: 1px solid #ff0000 !important;
|
||||
}
|
||||
page {
|
||||
|
||||
page {
|
||||
background-color: #F8F8F8;
|
||||
padding-bottom: 260rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.u-radio {
|
||||
.u-radio {
|
||||
width: 200rpx !important;
|
||||
}
|
||||
}
|
||||
|
||||
.submitView {
|
||||
.submitView {
|
||||
width: 100%;
|
||||
padding: 16rpx 0 26rpx;
|
||||
background-color: #FFFFFF;
|
||||
@ -628,19 +532,19 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 100;
|
||||
}
|
||||
}
|
||||
|
||||
.submitBtn {
|
||||
.submitBtn {
|
||||
width: 666rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.productBox {
|
||||
.productBox {
|
||||
background-color: #FFFFFF;
|
||||
margin-top: 32rpx;
|
||||
padding: 26rpx 0;
|
||||
}
|
||||
}
|
||||
|
||||
.tjcpName {
|
||||
.tjcpName {
|
||||
width: 686rpx;
|
||||
height: 40rpx;
|
||||
font-size: 16px;
|
||||
@ -649,60 +553,60 @@
|
||||
padding-left: 12rpx;
|
||||
margin-left: 26rpx;
|
||||
margin-top: 26rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.cpInput {
|
||||
.cpInput {
|
||||
width: 150rpx !important;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.cpInput>input {
|
||||
.cpInput>input {
|
||||
box-sizing: border-box;
|
||||
border: 1rpx solid #DDDDDD;
|
||||
width: 100%;
|
||||
height: 60rpx;
|
||||
border-radius: 10rpx;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.cpInput1 {
|
||||
.cpInput1 {
|
||||
width: 200rpx !important;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.cpInput1>input {
|
||||
.cpInput1>input {
|
||||
box-sizing: border-box;
|
||||
border: 1rpx solid #DDDDDD;
|
||||
width: 100%;
|
||||
height: 60rpx;
|
||||
border-radius: 10rpx;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.clearIcon {
|
||||
.clearIcon {
|
||||
position: absolute;
|
||||
right: 6rpx;
|
||||
top: 6rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.greenPrice {
|
||||
.greenPrice {
|
||||
font-size: 16px;
|
||||
color: #19BE6B !important;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.disFlex {
|
||||
.disFlex {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.inputName {
|
||||
.inputName {
|
||||
color: #ADADAD;
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.addHKQS {
|
||||
.addHKQS {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 16rpx 26rpx;
|
||||
@ -712,5 +616,5 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -3,12 +3,7 @@
|
||||
<common-navbar title="工作台" :showBack="false">
|
||||
<template #right>
|
||||
<view class="scan_box">
|
||||
<u-icon
|
||||
name="scan"
|
||||
color="#333333"
|
||||
size="46"
|
||||
@click="handleScan"
|
||||
></u-icon>
|
||||
<u-icon name="scan" color="#333333" size="46" @click="handleScan"></u-icon>
|
||||
</view>
|
||||
</template>
|
||||
</common-navbar>
|
||||
@ -21,10 +16,7 @@
|
||||
</view>
|
||||
<view class="grid-text">成品配布</view>
|
||||
</u-grid-item>
|
||||
<u-grid-item
|
||||
:index="1"
|
||||
@click="navTo('/pages/storegoods/QRBarCodeReview')"
|
||||
>
|
||||
<u-grid-item :index="1" @click="navTo('/pages/storegoods/QRBarCodeReview')">
|
||||
<view class="home-icon icon-color02">
|
||||
<i class="iconfont icon-mall-bag"></i>
|
||||
</view>
|
||||
@ -35,44 +27,31 @@
|
||||
<view class="workbench-title">成品管理</view>
|
||||
<view class="toolbar">
|
||||
<u-grid class="grid" :col="4" :border="false">
|
||||
<u-grid-item
|
||||
:index="0"
|
||||
@click="navTo('/pages/storegoods/dyeworksDyeback')"
|
||||
>
|
||||
<u-grid-item :index="0" @click="navTo('/pages/storegoods/dyeworksDyeback')">
|
||||
<view class="home-icon icon-color04">
|
||||
<i class="iconfont icon-finance"></i>
|
||||
</view>
|
||||
<view class="grid-text">染整进仓</view>
|
||||
</u-grid-item>
|
||||
<u-grid-item
|
||||
:index="1"
|
||||
@click="navTo('/pages/storegoods/storeGoodsBusinessIn')"
|
||||
>
|
||||
<u-grid-item :index="1" @click="navTo('/pages/storegoods/storeGoodsBusinessIn')">
|
||||
<view class="home-icon icon-color03">
|
||||
<i class="iconfont icon-mall-bag"></i>
|
||||
</view>
|
||||
<view class="grid-text">成品进仓</view>
|
||||
</u-grid-item>
|
||||
<u-grid-item
|
||||
:index="2"
|
||||
@click="navTo('/pages/storegoods/storeGoodsBusinessOut')"
|
||||
>
|
||||
<u-grid-item :index="2" @click="navTo('/pages/storegoods/storeGoodsBusinessOut')">
|
||||
<view class="home-icon icon-color12">
|
||||
<i class="iconfont icon-baoxiaodan"></i>
|
||||
</view>
|
||||
<view class="grid-text">成品出仓</view>
|
||||
</u-grid-item>
|
||||
<u-grid-item
|
||||
@click="navTo('/pages/storegoods/storeGoodsBusinessCheck')"
|
||||
>
|
||||
<u-grid-item @click="navTo('/pages/storegoods/storeGoodsBusinessCheck')">
|
||||
<view class="home-icon icon-color04">
|
||||
<i class="iconfont icon-shenpi"></i>
|
||||
</view>
|
||||
<view class="grid-text">成品盘点</view>
|
||||
</u-grid-item>
|
||||
<u-grid-item
|
||||
@click="navTo('/pages/storegoods/storeGoodsBusinessStationMoveOnly')"
|
||||
>
|
||||
<u-grid-item @click="navTo('/pages/storegoods/storeGoodsBusinessStationMoveOnly')">
|
||||
<view class="home-icon icon-color04">
|
||||
<i class="iconfont icon-shenpi"></i>
|
||||
</view>
|
||||
@ -151,6 +130,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import CommonNavbar from "@/components/common-navbar/index";
|
||||
import scanMixin from '@/common/scanMixin.js';
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://aidex.vip All rights reserved.
|
||||
*/
|
||||
@ -158,6 +138,7 @@ export default {
|
||||
components: {
|
||||
CommonNavbar,
|
||||
},
|
||||
mixins: [scanMixin],
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
@ -168,34 +149,17 @@ export default {
|
||||
//{image: '/static/aidex/banner/banner03.png'}
|
||||
],
|
||||
todoCount: 3,
|
||||
scanReceiver: null,
|
||||
isPageActive: false,
|
||||
// scanReceiver 和 isPageActive 已由 scanMixin 提供
|
||||
};
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
// #ifdef APP-PLUS
|
||||
this.isPageActive = true;
|
||||
this.registerScanBroadcast();
|
||||
// 使用 scanMixin 的方法注册扫码广播,传入自定义回调
|
||||
this.registerScanBroadcast(this.handleScanCode);
|
||||
// #endif
|
||||
},
|
||||
|
||||
onUnload() {
|
||||
// #ifdef APP-PLUS
|
||||
this.isPageActive = false;
|
||||
this.unregisterBroadcast();
|
||||
// #endif
|
||||
},
|
||||
|
||||
onHide() {
|
||||
// 页面隐藏时
|
||||
this.isPageActive = false;
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 页面显示时
|
||||
this.isPageActive = true;
|
||||
},
|
||||
// onUnload, onHide, onShow 已由 scanMixin 自动处理
|
||||
|
||||
computed: {
|
||||
contentStyle() {
|
||||
@ -206,6 +170,15 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 自定义扫码处理回调 - 处理本页面特有的扫码逻辑
|
||||
handleScanCode(scanResult) {
|
||||
console.log('工作台-扫码结果:', scanResult);
|
||||
const cleanResult = scanResult.trim().replace(/[\r\n]/g, '');
|
||||
uni.navigateTo({
|
||||
url: '/pages/saleship/salepickscandetail?order_no=' + cleanResult
|
||||
});
|
||||
},
|
||||
|
||||
navTo(url) {
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
@ -217,7 +190,7 @@ export default {
|
||||
itemClick(index) {
|
||||
console.log(index);
|
||||
},
|
||||
// 处理扫码
|
||||
// 处理扫码(手动点击扫码按钮)
|
||||
handleScan() {
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/saleship/salepickscandetail?order_no=FPD-PB-202412270196'
|
||||
@ -275,99 +248,32 @@ export default {
|
||||
});
|
||||
}
|
||||
},
|
||||
// 注册扫码广播
|
||||
registerScanBroadcast() {
|
||||
try {
|
||||
console.log('开始注册扫码广播');
|
||||
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');
|
||||
|
||||
const receiver = plus.android.implements('io.dcloud.feature.internal.reflect.BroadcastReceiver', {
|
||||
onReceive: (context, intent) => {
|
||||
// 只有当页面活动时才处理广播
|
||||
if (!this.isPageActive) return;
|
||||
|
||||
try {
|
||||
console.log("Workbench intent:", intent);
|
||||
const scanResult = intent.getStringExtra('scannerdata');
|
||||
console.log('工作台-扫码结果:', scanResult);
|
||||
|
||||
if (scanResult) {
|
||||
this.$nextTick(() => {
|
||||
const cleanResult = scanResult.trim().replace(/[\r\n]/g, '');
|
||||
uni.navigateTo({
|
||||
url: '/pages/saleship/salepickscandetail?order_no=' + cleanResult
|
||||
});
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('处理广播数据时出错:', error, error.stack);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 注册广播接收器
|
||||
main.registerReceiver(receiver, filter);
|
||||
this.scanReceiver = receiver;
|
||||
console.log('扫码广播注册成功,等待扫码...');
|
||||
|
||||
} catch (error) {
|
||||
console.error('注册扫码广播失败:', error);
|
||||
console.error('错误详情:', error.message);
|
||||
console.error('错误堆栈:', error.stack);
|
||||
}
|
||||
},
|
||||
|
||||
// 注销广播接收器
|
||||
unregisterBroadcast() {
|
||||
if (this.scanReceiver) {
|
||||
try {
|
||||
const main = plus.android.runtimeMainActivity();
|
||||
main.unregisterReceiver(this.scanReceiver);
|
||||
this.scanReceiver = null;
|
||||
console.log('扫码广播注销成功');
|
||||
} catch (error) {
|
||||
console.error('注销扫码广播失败:', error);
|
||||
}
|
||||
}
|
||||
},
|
||||
// registerScanBroadcast 和 unregisterScanBroadcast 已由 scanMixin 提供
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
@import "index.scss";
|
||||
|
||||
.scan_box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.scan_text {
|
||||
font-size: 12px;
|
||||
color: #2979ff;
|
||||
}
|
||||
}
|
||||
|
||||
.banner-box {
|
||||
padding: 0 2%;
|
||||
width: 96%;
|
||||
height: 170rpx;
|
||||
margin: 30rpx 0 30rpx;
|
||||
}
|
||||
|
||||
.u-swiper-wrap {
|
||||
padding: 0 10px;
|
||||
}
|
||||
@ -378,6 +284,7 @@ export default {
|
||||
display: inline-block;
|
||||
margin: 0 1.5%;
|
||||
}
|
||||
|
||||
.banner-pic image {
|
||||
width: 100%;
|
||||
height: 170rpx;
|
||||
@ -394,12 +301,14 @@ export default {
|
||||
position: relative;
|
||||
top: -3px;
|
||||
}
|
||||
|
||||
.workbench-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
padding: 15px 30rpx;
|
||||
}
|
||||
|
||||
.home-icon i.icon-tongzhi {
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user