add: scripts for invoice-order matching and SKU discovery

Analysis scripts to match GoMag orders with Oracle invoices by
date/client/total, then compare line items by price to discover
SKU → id_articol mappings. Generates SQL for nom_articole codmat
updates and CSV for ARTICOLE_TERTI repackaging/set mappings.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-03-17 12:01:51 +00:00
parent dafc2df0d4
commit 3d73d9e422
14 changed files with 2451 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
import sys, json, httpx
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
API_URL = 'https://api.gomag.ro/api/v1/order/read/json'
headers = {
'Apikey': '4c5e46df8f6c4f054fe2787de7a13d4a',
'ApiShop': 'https://coffeepoint.ro',
'User-Agent': 'Mozilla/5.0',
'Content-Type': 'application/json',
}
target = sys.argv[1] if len(sys.argv) > 1 else '480700091'
for page in range(1, 20):
resp = httpx.get(API_URL, headers=headers, params={'startDate': '2026-03-08', 'page': page, 'limit': 250}, timeout=60)
data = resp.json()
orders = data.get('orders', {})
if isinstance(orders, dict) and target in orders:
print(json.dumps(orders[target], indent=2, ensure_ascii=False))
sys.exit(0)
# Also check by 'number' field
if isinstance(orders, dict):
for key, order in orders.items():
if isinstance(order, dict) and str(order.get('number', '')) == target:
print(json.dumps(order, indent=2, ensure_ascii=False))
sys.exit(0)
if page >= data.get('pages', 1):
break
print(f"Order {target} not found")