No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

README.md 1.8 KiB

hace 2 días
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Python scripts for FPSMS backend
  2. This folder holds Python programs that integrate with the FPSMS backend (e.g. calling the public `/py` API).
  3. ## Setup
  4. ```bash
  5. cd python
  6. pip install -r requirements.txt
  7. ```
  8. ## Configuration
  9. Set the backend base URL (optional, default below):
  10. - Environment: `FPSMS_BASE_URL` (default: `http://localhost:8090/api` — includes context path `/api`)
  11. - Or edit the default in each script.
  12. ## Scripts
  13. | Script | Description |
  14. |--------|-------------|
  15. | `Bag1.py` | **GUI**: date selector (default today) and job orders as buttons; click shows "Clicked on Job Order code XXXX item xxxx". Run: `python Bag1.py` |
  16. | `fetch_job_orders.py` | CLI: fetches job orders by plan date from `GET /py/job-orders` |
  17. | `label_zpl.py` | ZPL label generator (90° rotated, UTF-8 Chinese, QR). `generate_zpl(batch_no, item_code, chinese_desc)`, `send_zpl(zpl, host, port)`. Run: `python label_zpl.py` to print one test label. |
  18. ## Building Bag1 as a standalone .exe
  19. To distribute Bag1 to customer PCs **without giving them source code or requiring Python**:
  20. 1. On your development PC (with Python installed), open a terminal in the `python` folder.
  21. 2. Install build dependencies:
  22. ```bash
  23. pip install -r requirements-build.txt
  24. ```
  25. 3. Run the build script:
  26. ```bash
  27. build_exe.bat
  28. ```
  29. Or run PyInstaller directly:
  30. ```bash
  31. pyinstaller --onefile --windowed --name Bag1 Bag1.py
  32. ```
  33. 4. The executable is created at `dist\Bag1.exe`. Copy **only** `Bag1.exe` to the customer computer and run it; no Python or source code is needed. The app will save its settings (`bag1_settings.json`) in the same folder as the exe.
  34. ## Adding new scripts
  35. Add new `.py` files here and list them in this README. Use `requirements.txt` for any new dependencies.