修复二维码不准确问题
This commit is contained in:
parent
ae00cfea5e
commit
dccaaed733
|
|
@ -215,7 +215,7 @@ class Printaction extends Base
|
||||||
{
|
{
|
||||||
$zengjie = Db::connect('zengjie_db');
|
$zengjie = Db::connect('zengjie_db');
|
||||||
// 获取可以打印的大箱条形码信息
|
// 获取可以打印的大箱条形码信息
|
||||||
$box_data = $zengjie->table('box_code_all')->where(['is_print' => 0])->field('id,box_code,box_num,content_str')->find();
|
$box_data = $zengjie->table('box_code_all')->where(['is_print' => 0])->field('id,box_code,box_num')->find();
|
||||||
|
|
||||||
$box_barcode_data = '';
|
$box_barcode_data = '';
|
||||||
if (empty($box_data)) {
|
if (empty($box_data)) {
|
||||||
|
|
@ -224,14 +224,26 @@ class Printaction extends Base
|
||||||
$box_barcode_data = $box_data['box_code'].'-'.sprintf("%03d", (int)$box_data['box_num']);
|
$box_barcode_data = $box_data['box_code'].'-'.sprintf("%03d", (int)$box_data['box_num']);
|
||||||
}
|
}
|
||||||
// 获取大箱信息配套的sn二维码码信息
|
// 获取大箱信息配套的sn二维码码信息
|
||||||
// $sn_data = $zengjie->table('sn_code_all')->where(['batch_id' => $box_data['id']])->field('sn_code')->select();
|
$sn_data = $zengjie->table('sn_code_all')->where(['batch_id' => $box_data['id']])->field('sn_code')->select();
|
||||||
// $sn_qrcode_data = [];
|
$sn_qrcode_data = [];
|
||||||
// for ($i=0; $i < count($sn_data); $i++) {
|
foreach ($sn_data as $item) {
|
||||||
// array_push($sn_qrcode_data,$sn_data[$i]['sn_code']);
|
// 多重清理确保数据干净
|
||||||
// }
|
$sn_code = $item['sn_code'];
|
||||||
// $sn_qrcode_data = implode(',',$sn_qrcode_data);
|
|
||||||
|
// 1. 移除所有空字符和不可见字符
|
||||||
|
$sn_code = preg_replace('/[\x00-\x1F\x7F]/', '', $sn_code);
|
||||||
|
|
||||||
|
// 2. 去除首尾空白
|
||||||
|
$sn_code = trim($sn_code);
|
||||||
|
|
||||||
|
// 3. 确保只保留数字(根据业务需求)
|
||||||
|
// $sn_code = preg_replace('/[^\d]/', '', $sn_code);
|
||||||
|
|
||||||
|
$sn_qrcode_data[] = $sn_code;
|
||||||
|
}
|
||||||
|
$sn_qrcode_data = implode(',',$sn_qrcode_data);
|
||||||
|
|
||||||
$sn_qrcode_data = $box_data['content_str'];
|
// $sn_qrcode_data = $box_data['content_str'];
|
||||||
try {
|
try {
|
||||||
/*******************************
|
/*******************************
|
||||||
* 可调整参数区域 - 开始
|
* 可调整参数区域 - 开始
|
||||||
|
|
|
||||||
|
|
@ -265,7 +265,7 @@ class Savemsg extends Base{
|
||||||
|
|
||||||
// 检查更新是否影响了预期的行数
|
// 检查更新是否影响了预期的行数
|
||||||
if ($affectedRows !== count($snCodes)) {
|
if ($affectedRows !== count($snCodes)) {
|
||||||
throw new \Exception('更新SN码数量不匹配');
|
throw new \Exception('更新SN码数量错误,请刷新小程序后重新录入');
|
||||||
}
|
}
|
||||||
Db::commit();
|
Db::commit();
|
||||||
return $this->msg(['id'=>$box_id]);
|
return $this->msg(['id'=>$box_id]);
|
||||||
|
|
|
||||||
|
|
@ -612,7 +612,7 @@ Route::any('/z/ceshiyong', 'app/ZengJieCode/app.savemsg/ceshiyong');
|
||||||
Route::any('/z/print_again', 'app/ZengJieCode/app.savemsg/print_again');
|
Route::any('/z/print_again', 'app/ZengJieCode/app.savemsg/print_again');
|
||||||
|
|
||||||
Route::any('/z/print_device_data_index', 'app/ZengJieCode/admin.printaction/print_device_data_index');
|
Route::any('/z/print_device_data_index', 'app/ZengJieCode/admin.printaction/print_device_data_index');
|
||||||
// Route::any('/z/print_outside_box_index', 'app/ZengJieCode/admin.printaction/print_outside_box_index');
|
Route::any('/z/print_outside_box_index', 'app/ZengJieCode/admin.printaction/print_outside_box_index');
|
||||||
|
|
||||||
// 获取蓝牙录入的未打印条码
|
// 获取蓝牙录入的未打印条码
|
||||||
Route::any('/z/print_device_barcode', 'app/ZengJieCode/admin.printaction/print_device_barcode');
|
Route::any('/z/print_device_barcode', 'app/ZengJieCode/admin.printaction/print_device_barcode');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue