Showing
2 changed files
with
5 additions
and
2 deletions
| ... | @@ -59,7 +59,7 @@ class OcrController extends Controller | ... | @@ -59,7 +59,7 @@ class OcrController extends Controller |
| 59 | { | 59 | { |
| 60 | try { | 60 | try { |
| 61 | // Lấy template name từ request hoặc mặc định | 61 | // Lấy template name từ request hoặc mặc định |
| 62 | - $templateName = $request->get('template_name', 'A'); | 62 | + $templateName = $request->get('template_name', ''); |
| 63 | 63 | ||
| 64 | // Giả sử file OCR JSON & ảnh nằm trong storage/app/public/image/ | 64 | // Giả sử file OCR JSON & ảnh nằm trong storage/app/public/image/ |
| 65 | $jsonPath = public_path("image/data_picking_detail_1754967679.json"); | 65 | $jsonPath = public_path("image/data_picking_detail_1754967679.json"); |
| ... | @@ -110,6 +110,7 @@ class OcrController extends Controller | ... | @@ -110,6 +110,7 @@ class OcrController extends Controller |
| 110 | ]; | 110 | ]; |
| 111 | } | 111 | } |
| 112 | } | 112 | } |
| 113 | +// dd($formData, $dataMapping); | ||
| 113 | 114 | ||
| 114 | return response()->json([ | 115 | return response()->json([ |
| 115 | 'success' => true, | 116 | 'success' => true, | ... | ... |
| ... | @@ -802,8 +802,10 @@ | ... | @@ -802,8 +802,10 @@ |
| 802 | // Tìm tất cả các box OCR nằm trong vùng manual | 802 | // Tìm tất cả các box OCR nằm trong vùng manual |
| 803 | this.ocrData.forEach(item => { | 803 | this.ocrData.forEach(item => { |
| 804 | if (!item.isManual && this.isBoxInside(item.bbox, newBbox) && item.text.trim()) { | 804 | if (!item.isManual && this.isBoxInside(item.bbox, newBbox) && item.text.trim()) { |
| 805 | + const partial = this.getPartialText(item.text, item.bbox, newBbox); | ||
| 806 | + // console.log(`Found OCR item for manual mapping: ${partial} at bbox ${item.bbox}`); | ||
| 805 | foundItems.push({ | 807 | foundItems.push({ |
| 806 | - text: item.text, | 808 | + text: partial, |
| 807 | bbox: item.bbox, | 809 | bbox: item.bbox, |
| 808 | index: this.ocrData.indexOf(item) | 810 | index: this.ocrData.indexOf(item) |
| 809 | }); | 811 | }); | ... | ... |
-
Please register or sign in to post a comment