@newpeak/barista-cli 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +714 -0
- package/README.ja.md +708 -0
- package/README.md +68 -0
- package/README.vi.md +714 -0
- package/dist/commands/liberica/calendar/index.d.ts +3 -0
- package/dist/commands/liberica/calendar/index.d.ts.map +1 -0
- package/dist/commands/liberica/calendar/index.js +11 -0
- package/dist/commands/liberica/calendar/index.js.map +1 -0
- package/dist/commands/liberica/calendar/list.d.ts +3 -0
- package/dist/commands/liberica/calendar/list.d.ts.map +1 -0
- package/dist/commands/liberica/calendar/list.js +181 -0
- package/dist/commands/liberica/calendar/list.js.map +1 -0
- package/dist/commands/liberica/calendar/set.d.ts +3 -0
- package/dist/commands/liberica/calendar/set.d.ts.map +1 -0
- package/dist/commands/liberica/calendar/set.js +120 -0
- package/dist/commands/liberica/calendar/set.js.map +1 -0
- package/dist/commands/liberica/client-contacts/create.d.ts +3 -0
- package/dist/commands/liberica/client-contacts/create.d.ts.map +1 -0
- package/dist/commands/liberica/client-contacts/create.js +132 -0
- package/dist/commands/liberica/client-contacts/create.js.map +1 -0
- package/dist/commands/liberica/client-contacts/delete.d.ts +3 -0
- package/dist/commands/liberica/client-contacts/delete.d.ts.map +1 -0
- package/dist/commands/liberica/client-contacts/delete.js +139 -0
- package/dist/commands/liberica/client-contacts/delete.js.map +1 -0
- package/dist/commands/liberica/client-contacts/get.d.ts +3 -0
- package/dist/commands/liberica/client-contacts/get.d.ts.map +1 -0
- package/dist/commands/liberica/client-contacts/get.js +92 -0
- package/dist/commands/liberica/client-contacts/get.js.map +1 -0
- package/dist/commands/liberica/client-contacts/index.d.ts +3 -0
- package/dist/commands/liberica/client-contacts/index.d.ts.map +1 -0
- package/dist/commands/liberica/client-contacts/index.js +17 -0
- package/dist/commands/liberica/client-contacts/index.js.map +1 -0
- package/dist/commands/liberica/client-contacts/list.d.ts +3 -0
- package/dist/commands/liberica/client-contacts/list.d.ts.map +1 -0
- package/dist/commands/liberica/client-contacts/list.js +92 -0
- package/dist/commands/liberica/client-contacts/list.js.map +1 -0
- package/dist/commands/liberica/client-contacts/update.d.ts +3 -0
- package/dist/commands/liberica/client-contacts/update.d.ts.map +1 -0
- package/dist/commands/liberica/client-contacts/update.js +156 -0
- package/dist/commands/liberica/client-contacts/update.js.map +1 -0
- package/dist/commands/liberica/dict-types/get.d.ts +3 -0
- package/dist/commands/liberica/dict-types/get.d.ts.map +1 -0
- package/dist/commands/liberica/dict-types/get.js +62 -0
- package/dist/commands/liberica/dict-types/get.js.map +1 -0
- package/dist/commands/liberica/dict-types/index.d.ts +3 -0
- package/dist/commands/liberica/dict-types/index.d.ts.map +1 -0
- package/dist/commands/liberica/dict-types/index.js +13 -0
- package/dist/commands/liberica/dict-types/index.js.map +1 -0
- package/dist/commands/liberica/dict-types/list.d.ts +3 -0
- package/dist/commands/liberica/dict-types/list.d.ts.map +1 -0
- package/dist/commands/liberica/dict-types/list.js +91 -0
- package/dist/commands/liberica/dict-types/list.js.map +1 -0
- package/dist/commands/liberica/dict-types/update.d.ts +3 -0
- package/dist/commands/liberica/dict-types/update.d.ts.map +1 -0
- package/dist/commands/liberica/dict-types/update.js +127 -0
- package/dist/commands/liberica/dict-types/update.js.map +1 -0
- package/dist/commands/liberica/dicts/create.d.ts +3 -0
- package/dist/commands/liberica/dicts/create.d.ts.map +1 -0
- package/dist/commands/liberica/dicts/create.js +157 -0
- package/dist/commands/liberica/dicts/create.js.map +1 -0
- package/dist/commands/liberica/dicts/delete.d.ts +3 -0
- package/dist/commands/liberica/dicts/delete.d.ts.map +1 -0
- package/dist/commands/liberica/dicts/delete.js +106 -0
- package/dist/commands/liberica/dicts/delete.js.map +1 -0
- package/dist/commands/liberica/dicts/get.d.ts +3 -0
- package/dist/commands/liberica/dicts/get.d.ts.map +1 -0
- package/dist/commands/liberica/dicts/get.js +69 -0
- package/dist/commands/liberica/dicts/get.js.map +1 -0
- package/dist/commands/liberica/dicts/index.d.ts +3 -0
- package/dist/commands/liberica/dicts/index.d.ts.map +1 -0
- package/dist/commands/liberica/dicts/index.js +17 -0
- package/dist/commands/liberica/dicts/index.js.map +1 -0
- package/dist/commands/liberica/dicts/list.d.ts +3 -0
- package/dist/commands/liberica/dicts/list.d.ts.map +1 -0
- package/dist/commands/liberica/dicts/list.js +88 -0
- package/dist/commands/liberica/dicts/list.js.map +1 -0
- package/dist/commands/liberica/dicts/update.d.ts +3 -0
- package/dist/commands/liberica/dicts/update.d.ts.map +1 -0
- package/dist/commands/liberica/dicts/update.js +112 -0
- package/dist/commands/liberica/dicts/update.js.map +1 -0
- package/dist/commands/liberica/index.d.ts.map +1 -1
- package/dist/commands/liberica/index.js +22 -0
- package/dist/commands/liberica/index.js.map +1 -1
- package/dist/commands/liberica/materials/create.d.ts.map +1 -1
- package/dist/commands/liberica/materials/create.js +35 -9
- package/dist/commands/liberica/materials/create.js.map +1 -1
- package/dist/commands/liberica/operations/active.d.ts +3 -0
- package/dist/commands/liberica/operations/active.d.ts.map +1 -0
- package/dist/commands/liberica/operations/active.js +152 -0
- package/dist/commands/liberica/operations/active.js.map +1 -0
- package/dist/commands/liberica/operations/batch-delete.d.ts +3 -0
- package/dist/commands/liberica/operations/batch-delete.d.ts.map +1 -0
- package/dist/commands/liberica/operations/batch-delete.js +130 -0
- package/dist/commands/liberica/operations/batch-delete.js.map +1 -0
- package/dist/commands/liberica/operations/copy.d.ts +3 -0
- package/dist/commands/liberica/operations/copy.d.ts.map +1 -0
- package/dist/commands/liberica/operations/copy.js +137 -0
- package/dist/commands/liberica/operations/copy.js.map +1 -0
- package/dist/commands/liberica/operations/create.d.ts +3 -0
- package/dist/commands/liberica/operations/create.d.ts.map +1 -0
- package/dist/commands/liberica/operations/create.js +212 -0
- package/dist/commands/liberica/operations/create.js.map +1 -0
- package/dist/commands/liberica/operations/deactive.d.ts +3 -0
- package/dist/commands/liberica/operations/deactive.d.ts.map +1 -0
- package/dist/commands/liberica/operations/deactive.js +152 -0
- package/dist/commands/liberica/operations/deactive.js.map +1 -0
- package/dist/commands/liberica/operations/delete.d.ts +3 -0
- package/dist/commands/liberica/operations/delete.d.ts.map +1 -0
- package/dist/commands/liberica/operations/delete.js +128 -0
- package/dist/commands/liberica/operations/delete.js.map +1 -0
- package/dist/commands/liberica/operations/get.d.ts +3 -0
- package/dist/commands/liberica/operations/get.d.ts.map +1 -0
- package/dist/commands/liberica/operations/get.js +93 -0
- package/dist/commands/liberica/operations/get.js.map +1 -0
- package/dist/commands/liberica/operations/index.d.ts +3 -0
- package/dist/commands/liberica/operations/index.d.ts.map +1 -0
- package/dist/commands/liberica/operations/index.js +25 -0
- package/dist/commands/liberica/operations/index.js.map +1 -0
- package/dist/commands/liberica/operations/list.d.ts +3 -0
- package/dist/commands/liberica/operations/list.d.ts.map +1 -0
- package/dist/commands/liberica/operations/list.js +141 -0
- package/dist/commands/liberica/operations/list.js.map +1 -0
- package/dist/commands/liberica/operations/update.d.ts +3 -0
- package/dist/commands/liberica/operations/update.d.ts.map +1 -0
- package/dist/commands/liberica/operations/update.js +208 -0
- package/dist/commands/liberica/operations/update.js.map +1 -0
- package/dist/commands/liberica/orgs/index.d.ts.map +1 -1
- package/dist/commands/liberica/orgs/index.js.map +1 -1
- package/dist/commands/liberica/stock/__tests__/ledger.test.d.ts +2 -0
- package/dist/commands/liberica/stock/__tests__/ledger.test.d.ts.map +1 -0
- package/dist/commands/liberica/stock/__tests__/ledger.test.js +41 -0
- package/dist/commands/liberica/stock/__tests__/ledger.test.js.map +1 -0
- package/dist/commands/liberica/stock/__tests__/list.test.d.ts +2 -0
- package/dist/commands/liberica/stock/__tests__/list.test.d.ts.map +1 -0
- package/dist/commands/liberica/stock/__tests__/list.test.js +39 -0
- package/dist/commands/liberica/stock/__tests__/list.test.js.map +1 -0
- package/dist/commands/liberica/stock/index.d.ts +3 -0
- package/dist/commands/liberica/stock/index.d.ts.map +1 -0
- package/dist/commands/liberica/stock/index.js +11 -0
- package/dist/commands/liberica/stock/index.js.map +1 -0
- package/dist/commands/liberica/stock/ledger.d.ts +3 -0
- package/dist/commands/liberica/stock/ledger.d.ts.map +1 -0
- package/dist/commands/liberica/stock/ledger.js +154 -0
- package/dist/commands/liberica/stock/ledger.js.map +1 -0
- package/dist/commands/liberica/stock/list.d.ts +3 -0
- package/dist/commands/liberica/stock/list.d.ts.map +1 -0
- package/dist/commands/liberica/stock/list.js +127 -0
- package/dist/commands/liberica/stock/list.js.map +1 -0
- package/dist/commands/liberica/supplier-contacts/create.d.ts +3 -0
- package/dist/commands/liberica/supplier-contacts/create.d.ts.map +1 -0
- package/dist/commands/liberica/supplier-contacts/create.js +129 -0
- package/dist/commands/liberica/supplier-contacts/create.js.map +1 -0
- package/dist/commands/liberica/supplier-contacts/delete.d.ts +3 -0
- package/dist/commands/liberica/supplier-contacts/delete.d.ts.map +1 -0
- package/dist/commands/liberica/supplier-contacts/delete.js +88 -0
- package/dist/commands/liberica/supplier-contacts/delete.js.map +1 -0
- package/dist/commands/liberica/supplier-contacts/get.d.ts +3 -0
- package/dist/commands/liberica/supplier-contacts/get.d.ts.map +1 -0
- package/dist/commands/liberica/supplier-contacts/get.js +84 -0
- package/dist/commands/liberica/supplier-contacts/get.js.map +1 -0
- package/dist/commands/liberica/supplier-contacts/index.d.ts +3 -0
- package/dist/commands/liberica/supplier-contacts/index.d.ts.map +1 -0
- package/dist/commands/liberica/supplier-contacts/index.js +17 -0
- package/dist/commands/liberica/supplier-contacts/index.js.map +1 -0
- package/dist/commands/liberica/supplier-contacts/list.d.ts +3 -0
- package/dist/commands/liberica/supplier-contacts/list.d.ts.map +1 -0
- package/dist/commands/liberica/supplier-contacts/list.js +98 -0
- package/dist/commands/liberica/supplier-contacts/list.js.map +1 -0
- package/dist/commands/liberica/supplier-contacts/update.d.ts +3 -0
- package/dist/commands/liberica/supplier-contacts/update.d.ts.map +1 -0
- package/dist/commands/liberica/supplier-contacts/update.js +136 -0
- package/dist/commands/liberica/supplier-contacts/update.js.map +1 -0
- package/dist/commands/liberica/users/create.d.ts.map +1 -1
- package/dist/commands/liberica/users/create.js +1 -0
- package/dist/commands/liberica/users/create.js.map +1 -1
- package/dist/commands/liberica/warehouses/create.d.ts +3 -0
- package/dist/commands/liberica/warehouses/create.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/create.js +196 -0
- package/dist/commands/liberica/warehouses/create.js.map +1 -0
- package/dist/commands/liberica/warehouses/delete.d.ts +3 -0
- package/dist/commands/liberica/warehouses/delete.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/delete.js +111 -0
- package/dist/commands/liberica/warehouses/delete.js.map +1 -0
- package/dist/commands/liberica/warehouses/disable.d.ts +3 -0
- package/dist/commands/liberica/warehouses/disable.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/disable.js +173 -0
- package/dist/commands/liberica/warehouses/disable.js.map +1 -0
- package/dist/commands/liberica/warehouses/enable.d.ts +3 -0
- package/dist/commands/liberica/warehouses/enable.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/enable.js +173 -0
- package/dist/commands/liberica/warehouses/enable.js.map +1 -0
- package/dist/commands/liberica/warehouses/get.d.ts +3 -0
- package/dist/commands/liberica/warehouses/get.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/get.js +90 -0
- package/dist/commands/liberica/warehouses/get.js.map +1 -0
- package/dist/commands/liberica/warehouses/index.d.ts +3 -0
- package/dist/commands/liberica/warehouses/index.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/index.js +23 -0
- package/dist/commands/liberica/warehouses/index.js.map +1 -0
- package/dist/commands/liberica/warehouses/list.d.ts +3 -0
- package/dist/commands/liberica/warehouses/list.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/list.js +101 -0
- package/dist/commands/liberica/warehouses/list.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/create.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/create.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/create.js +199 -0
- package/dist/commands/liberica/warehouses/locations/create.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/delete.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/delete.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/delete.js +115 -0
- package/dist/commands/liberica/warehouses/locations/delete.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/disable.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/disable.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/disable.js +173 -0
- package/dist/commands/liberica/warehouses/locations/disable.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/enable.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/enable.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/enable.js +173 -0
- package/dist/commands/liberica/warehouses/locations/enable.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/get.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/get.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/get.js +73 -0
- package/dist/commands/liberica/warehouses/locations/get.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/index.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/index.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/index.js +21 -0
- package/dist/commands/liberica/warehouses/locations/index.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/list.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/list.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/list.js +104 -0
- package/dist/commands/liberica/warehouses/locations/list.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/update.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/update.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/update.js +128 -0
- package/dist/commands/liberica/warehouses/locations/update.js.map +1 -0
- package/dist/commands/liberica/warehouses/update.d.ts +3 -0
- package/dist/commands/liberica/warehouses/update.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/update.js +143 -0
- package/dist/commands/liberica/warehouses/update.js.map +1 -0
- package/dist/core/api/client.d.ts +62 -0
- package/dist/core/api/client.d.ts.map +1 -1
- package/dist/core/api/client.js +1203 -104
- package/dist/core/api/client.js.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/types/calendar.d.ts +28 -0
- package/dist/types/calendar.d.ts.map +1 -0
- package/dist/types/calendar.js +2 -0
- package/dist/types/calendar.js.map +1 -0
- package/dist/types/client-contact.d.ts +65 -0
- package/dist/types/client-contact.d.ts.map +1 -0
- package/dist/types/client-contact.js +4 -0
- package/dist/types/client-contact.js.map +1 -0
- package/dist/types/dict.d.ts +97 -0
- package/dist/types/dict.d.ts.map +1 -0
- package/dist/types/dict.js +2 -0
- package/dist/types/dict.js.map +1 -0
- package/dist/types/index.d.ts +9 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/location.d.ts +53 -0
- package/dist/types/location.d.ts.map +1 -0
- package/dist/types/location.js +2 -0
- package/dist/types/location.js.map +1 -0
- package/dist/types/operation.d.ts +66 -0
- package/dist/types/operation.d.ts.map +1 -0
- package/dist/types/operation.js +2 -0
- package/dist/types/operation.js.map +1 -0
- package/dist/types/stock.d.ts +133 -0
- package/dist/types/stock.d.ts.map +1 -0
- package/dist/types/stock.js +3 -0
- package/dist/types/stock.js.map +1 -0
- package/dist/types/supplier-contact.d.ts +65 -0
- package/dist/types/supplier-contact.d.ts.map +1 -0
- package/dist/types/supplier-contact.js +4 -0
- package/dist/types/supplier-contact.js.map +1 -0
- package/dist/types/warehouse.d.ts +68 -0
- package/dist/types/warehouse.d.ts.map +1 -0
- package/dist/types/warehouse.js +2 -0
- package/dist/types/warehouse.js.map +1 -0
- package/docs/commands/REFERENCE.md +24 -4
- package/docs/commands/liberica/calendar/DESIGN.md +333 -0
- package/docs/commands/liberica/client-contacts/create.md +152 -0
- package/docs/commands/liberica/client-contacts/delete.md +123 -0
- package/docs/commands/liberica/client-contacts/get.md +133 -0
- package/docs/commands/liberica/client-contacts/list.md +143 -0
- package/docs/commands/liberica/client-contacts/update.md +158 -0
- package/docs/commands/liberica/locations/create.md +195 -0
- package/docs/commands/liberica/locations/list.md +171 -0
- package/docs/commands/liberica/stock/ledger.md +209 -0
- package/docs/commands/liberica/stock/list.md +165 -0
- package/docs/commands/liberica/supplier-contacts/create.md +152 -0
- package/docs/commands/liberica/supplier-contacts/delete.md +123 -0
- package/docs/commands/liberica/supplier-contacts/get.md +133 -0
- package/docs/commands/liberica/supplier-contacts/list.md +143 -0
- package/docs/commands/liberica/supplier-contacts/update.md +158 -0
- package/docs/commands/liberica/warehouses/create.md +222 -0
- package/docs/commands/liberica/warehouses/list.md +184 -0
- package/package.json +1 -1
- package/src/commands/liberica/calendar/index.ts +13 -0
- package/src/commands/liberica/calendar/list.ts +214 -0
- package/src/commands/liberica/calendar/set.ts +130 -0
- package/src/commands/liberica/client-contacts/create.ts +115 -0
- package/src/commands/liberica/client-contacts/delete.ts +140 -0
- package/src/commands/liberica/client-contacts/get.ts +103 -0
- package/src/commands/liberica/client-contacts/index.ts +19 -0
- package/src/commands/liberica/client-contacts/list.ts +118 -0
- package/src/commands/liberica/client-contacts/update.ts +137 -0
- package/src/commands/liberica/dict-types/get.ts +74 -0
- package/src/commands/liberica/dict-types/index.ts +15 -0
- package/src/commands/liberica/dict-types/list.ts +118 -0
- package/src/commands/liberica/dict-types/update.ts +134 -0
- package/src/commands/liberica/dicts/create.ts +175 -0
- package/src/commands/liberica/dicts/delete.ts +107 -0
- package/src/commands/liberica/dicts/get.ts +80 -0
- package/src/commands/liberica/dicts/index.ts +19 -0
- package/src/commands/liberica/dicts/list.ts +114 -0
- package/src/commands/liberica/dicts/update.ts +116 -0
- package/src/commands/liberica/index.ts +22 -0
- package/src/commands/liberica/materials/create.ts +32 -9
- package/src/commands/liberica/operations/active.ts +153 -0
- package/src/commands/liberica/operations/batch-delete.ts +131 -0
- package/src/commands/liberica/operations/copy.ts +138 -0
- package/src/commands/liberica/operations/create.ts +223 -0
- package/src/commands/liberica/operations/deactive.ts +152 -0
- package/src/commands/liberica/operations/delete.ts +128 -0
- package/src/commands/liberica/operations/design.md +587 -0
- package/src/commands/liberica/operations/get.ts +112 -0
- package/src/commands/liberica/operations/index.ts +27 -0
- package/src/commands/liberica/operations/list.ts +180 -0
- package/src/commands/liberica/operations/update.ts +218 -0
- package/src/commands/liberica/orgs/index.ts +0 -1
- package/src/commands/liberica/stock/index.ts +13 -0
- package/src/commands/liberica/stock/ledger.ts +159 -0
- package/src/commands/liberica/stock/list.ts +128 -0
- package/src/commands/liberica/supplier-contacts/create.ts +120 -0
- package/src/commands/liberica/supplier-contacts/delete.ts +88 -0
- package/src/commands/liberica/supplier-contacts/get.ts +94 -0
- package/src/commands/liberica/supplier-contacts/index.ts +19 -0
- package/src/commands/liberica/supplier-contacts/list.ts +130 -0
- package/src/commands/liberica/supplier-contacts/update.ts +127 -0
- package/src/commands/liberica/users/create.ts +1 -0
- package/src/commands/liberica/warehouses/create.ts +204 -0
- package/src/commands/liberica/warehouses/delete.ts +112 -0
- package/src/commands/liberica/warehouses/disable.ts +174 -0
- package/src/commands/liberica/warehouses/enable.ts +174 -0
- package/src/commands/liberica/warehouses/get.ts +101 -0
- package/src/commands/liberica/warehouses/index.ts +25 -0
- package/src/commands/liberica/warehouses/list.ts +136 -0
- package/src/commands/liberica/warehouses/locations/create.ts +209 -0
- package/src/commands/liberica/warehouses/locations/delete.ts +116 -0
- package/src/commands/liberica/warehouses/locations/disable.ts +174 -0
- package/src/commands/liberica/warehouses/locations/enable.ts +174 -0
- package/src/commands/liberica/warehouses/locations/get.ts +84 -0
- package/src/commands/liberica/warehouses/locations/index.ts +23 -0
- package/src/commands/liberica/warehouses/locations/list.ts +140 -0
- package/src/commands/liberica/warehouses/locations/update.ts +135 -0
- package/src/commands/liberica/warehouses/update.ts +142 -0
- package/src/core/api/client.ts +1493 -78
- package/src/index.ts +1 -3
- package/src/types/calendar.ts +36 -0
- package/src/types/client-contact.ts +78 -0
- package/src/types/dict.ts +121 -0
- package/src/types/index.ts +9 -4
- package/src/types/location.ts +66 -0
- package/src/types/operation.ts +72 -0
- package/src/types/stock.ts +161 -0
- package/src/types/supplier-contact.ts +78 -0
- package/src/types/warehouse.ts +82 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { createOperationsListCommand } from './list.js';
|
|
3
|
+
import { createOperationGetCommand } from './get.js';
|
|
4
|
+
import { createOperationCreateCommand } from './create.js';
|
|
5
|
+
import { createOperationsUpdateCommand } from './update.js';
|
|
6
|
+
import { createOperationsDeleteCommand } from './delete.js';
|
|
7
|
+
import { createOperationsCopyCommand } from './copy.js';
|
|
8
|
+
import { createBatchDeleteCommand } from './batch-delete.js';
|
|
9
|
+
import { createOperationActiveCommand } from './active.js';
|
|
10
|
+
import { createOperationDeactiveCommand } from './deactive.js';
|
|
11
|
+
|
|
12
|
+
export function createOperationsCommand(): Command {
|
|
13
|
+
const operationsCommand = new Command('operations');
|
|
14
|
+
operationsCommand.description('Manage operations');
|
|
15
|
+
|
|
16
|
+
operationsCommand.addCommand(createOperationsListCommand());
|
|
17
|
+
operationsCommand.addCommand(createOperationGetCommand());
|
|
18
|
+
operationsCommand.addCommand(createOperationCreateCommand());
|
|
19
|
+
operationsCommand.addCommand(createOperationsUpdateCommand());
|
|
20
|
+
operationsCommand.addCommand(createOperationsDeleteCommand());
|
|
21
|
+
operationsCommand.addCommand(createOperationsCopyCommand());
|
|
22
|
+
operationsCommand.addCommand(createBatchDeleteCommand());
|
|
23
|
+
operationsCommand.addCommand(createOperationActiveCommand());
|
|
24
|
+
operationsCommand.addCommand(createOperationDeactiveCommand());
|
|
25
|
+
|
|
26
|
+
return operationsCommand;
|
|
27
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import Table from 'cli-table3';
|
|
4
|
+
import { configManager } from '../../../core/config/manager.js';
|
|
5
|
+
import { apiClient } from '../../../core/api/client.js';
|
|
6
|
+
import { OperationListResponse, OperationType, StatusFlag } from '../../../types/operation.js';
|
|
7
|
+
import { Environment } from '../../../types/index.js';
|
|
8
|
+
|
|
9
|
+
const OPERATION_TYPE_MAP: Record<OperationType, string> = {
|
|
10
|
+
EQUIPMENT: '机器',
|
|
11
|
+
HUMAN: '手工',
|
|
12
|
+
PACKAGE: '包装',
|
|
13
|
+
QUALITY_TESTING: '质检',
|
|
14
|
+
OTHER: '其它',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const OPERATION_TYPE_REVERSE: Record<string, OperationType> = {
|
|
18
|
+
EQUIPMENT: 'EQUIPMENT',
|
|
19
|
+
equipment: 'EQUIPMENT',
|
|
20
|
+
'机器': 'EQUIPMENT',
|
|
21
|
+
HUMAN: 'HUMAN',
|
|
22
|
+
human: 'HUMAN',
|
|
23
|
+
'手工': 'HUMAN',
|
|
24
|
+
PACKAGE: 'PACKAGE',
|
|
25
|
+
package: 'PACKAGE',
|
|
26
|
+
'包装': 'PACKAGE',
|
|
27
|
+
QUALITY_TESTING: 'QUALITY_TESTING',
|
|
28
|
+
quality_testing: 'QUALITY_TESTING',
|
|
29
|
+
qualitytesting: 'QUALITY_TESTING',
|
|
30
|
+
'质检': 'QUALITY_TESTING',
|
|
31
|
+
OTHER: 'OTHER',
|
|
32
|
+
other: 'OTHER',
|
|
33
|
+
'其它': 'OTHER',
|
|
34
|
+
'其他': 'OTHER',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
function normalizeOperationType(input: string | undefined): OperationType | undefined {
|
|
38
|
+
if (!input) return undefined;
|
|
39
|
+
const normalized = input.trim().toUpperCase();
|
|
40
|
+
return OPERATION_TYPE_REVERSE[normalized] || OPERATION_TYPE_REVERSE[input];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function getOperationTypeDisplay(type: OperationType): string {
|
|
44
|
+
return OPERATION_TYPE_MAP[type] || type;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function createOperationsListCommand(): Command {
|
|
48
|
+
const listCommand = new Command('list');
|
|
49
|
+
listCommand.description('List operations with pagination');
|
|
50
|
+
|
|
51
|
+
listCommand
|
|
52
|
+
.option('-p, --page <number>', 'Page number', '1')
|
|
53
|
+
.option('-s, --size <number>', 'Page size', '20')
|
|
54
|
+
.option('--status <number>', 'Status filter (1=enable, 2=disable)')
|
|
55
|
+
.option('--keyword <string>', 'Filter by operation name or code (partial match)')
|
|
56
|
+
.option('--type <string>', 'Filter by operation type (EQUIPMENT/HUMAN/PACKAGE/QUALITY_TESTING/OTHER or Chinese: 机器/手工/包装/质检/其它)')
|
|
57
|
+
.option('--json', 'Output as JSON')
|
|
58
|
+
.action(async (options) => {
|
|
59
|
+
const context = configManager.getCurrentContext();
|
|
60
|
+
const environment = (options.env as Environment) || context.environment;
|
|
61
|
+
const tenant = options.tenant || context.tenant;
|
|
62
|
+
|
|
63
|
+
const page = parseInt(options.page as string, 10) - 1;
|
|
64
|
+
const size = parseInt(options.size as string, 10);
|
|
65
|
+
|
|
66
|
+
const params: {
|
|
67
|
+
pageNo: number;
|
|
68
|
+
pageSize: number;
|
|
69
|
+
status?: StatusFlag;
|
|
70
|
+
operationCode?: string;
|
|
71
|
+
operationName?: string;
|
|
72
|
+
operationType?: OperationType;
|
|
73
|
+
} = { pageNo: page, pageSize: size };
|
|
74
|
+
|
|
75
|
+
if (options.status !== undefined) {
|
|
76
|
+
const statusNum = parseInt(options.status as string, 10);
|
|
77
|
+
if (statusNum === 1 || statusNum === 2) {
|
|
78
|
+
params.status = statusNum as StatusFlag;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (options.keyword !== undefined) {
|
|
83
|
+
params.operationCode = options.keyword as string;
|
|
84
|
+
params.operationName = options.keyword as string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (options.type !== undefined) {
|
|
88
|
+
const normalizedType = normalizeOperationType(options.type as string);
|
|
89
|
+
if (normalizedType) {
|
|
90
|
+
params.operationType = normalizedType;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const response = await apiClient.listOperations(environment, tenant, params);
|
|
95
|
+
|
|
96
|
+
if (!response.success) {
|
|
97
|
+
console.error(chalk.red(`\n✗ Failed to list operations: ${response.error?.message || 'Unknown error'}`));
|
|
98
|
+
if (response.error?.code) {
|
|
99
|
+
console.error(chalk.gray(` Error code: ${response.error.code}`));
|
|
100
|
+
}
|
|
101
|
+
console.error();
|
|
102
|
+
process.exit(1);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const data = response.data as OperationListResponse | null;
|
|
106
|
+
|
|
107
|
+
if (!data) {
|
|
108
|
+
if (options.json) {
|
|
109
|
+
console.log(JSON.stringify({ success: true, data: { items: [], pagination: { pageNo: 0, pageSize: 20, totalRows: 0 } } }, null, 2));
|
|
110
|
+
} else {
|
|
111
|
+
console.log(chalk.bold('\n📋 Operation List\n'));
|
|
112
|
+
console.log(chalk.gray(' No operations found\n'));
|
|
113
|
+
}
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (options.json) {
|
|
118
|
+
console.log(
|
|
119
|
+
JSON.stringify(
|
|
120
|
+
{
|
|
121
|
+
success: true,
|
|
122
|
+
data: {
|
|
123
|
+
items: data.rows || [],
|
|
124
|
+
pagination: {
|
|
125
|
+
pageNo: data.pageNo,
|
|
126
|
+
pageSize: data.pageSize,
|
|
127
|
+
totalRows: data.totalRows,
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
null,
|
|
132
|
+
2
|
|
133
|
+
)
|
|
134
|
+
);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const records = data.rows || [];
|
|
139
|
+
|
|
140
|
+
if (records.length === 0) {
|
|
141
|
+
console.log(chalk.bold('\n📋 Operation List\n'));
|
|
142
|
+
console.log(chalk.gray(' No operations found\n'));
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
console.log(chalk.bold('\n📋 Operation List\n'));
|
|
147
|
+
|
|
148
|
+
const table = new Table({
|
|
149
|
+
head: [chalk.bold('ID'), chalk.bold('Code'), chalk.bold('Name'), chalk.bold('Type'), chalk.bold('Work Center'), chalk.bold('Status')],
|
|
150
|
+
colWidths: [12, 14, 22, 12, 18, 10],
|
|
151
|
+
style: {
|
|
152
|
+
head: [],
|
|
153
|
+
border: [],
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
for (const op of records) {
|
|
158
|
+
const statusText = op.statusFlag === 1 ? chalk.green('Enable') : chalk.red('Disable');
|
|
159
|
+
table.push([
|
|
160
|
+
op.operationId,
|
|
161
|
+
op.operationCode || '-',
|
|
162
|
+
op.operationName || '-',
|
|
163
|
+
getOperationTypeDisplay(op.operationType),
|
|
164
|
+
op.workCenterCode || '-',
|
|
165
|
+
statusText,
|
|
166
|
+
]);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
console.log(table.toString());
|
|
170
|
+
console.log();
|
|
171
|
+
console.log(
|
|
172
|
+
chalk.gray(
|
|
173
|
+
` Total: ${data.totalRows} | Page: ${data.pageNo + 1} / ${Math.ceil(data.totalRows / data.pageSize) || 1} | Size: ${data.pageSize}`
|
|
174
|
+
)
|
|
175
|
+
);
|
|
176
|
+
console.log();
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
return listCommand;
|
|
180
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { configManager } from '../../../core/config/manager.js';
|
|
4
|
+
import { apiClient } from '../../../core/api/client.js';
|
|
5
|
+
import { Operation, OperationUpdateRequest, StatusFlag } from '../../../types/operation.js';
|
|
6
|
+
import { Environment } from '../../../types/index.js';
|
|
7
|
+
|
|
8
|
+
// Dictionary mapping for operation type display
|
|
9
|
+
const OPERATION_TYPE_MAP: Record<string, string> = {
|
|
10
|
+
EQUIPMENT: '机器',
|
|
11
|
+
HUMAN: '手工',
|
|
12
|
+
PACKAGE: '包装',
|
|
13
|
+
QUALITY_TESTING: '质检',
|
|
14
|
+
OTHER: '其它',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// Reverse mapping for parsing CLI input
|
|
18
|
+
const OPERATION_TYPE_REVERSE: Record<string, string> = {
|
|
19
|
+
EQUIPMENT: 'EQUIPMENT',
|
|
20
|
+
equipment: 'EQUIPMENT',
|
|
21
|
+
'机器': 'EQUIPMENT',
|
|
22
|
+
HUMAN: 'HUMAN',
|
|
23
|
+
human: 'HUMAN',
|
|
24
|
+
'手工': 'HUMAN',
|
|
25
|
+
PACKAGE: 'PACKAGE',
|
|
26
|
+
package: 'PACKAGE',
|
|
27
|
+
'包装': 'PACKAGE',
|
|
28
|
+
QUALITY_TESTING: 'QUALITY_TESTING',
|
|
29
|
+
quality_testing: 'QUALITY_TESTING',
|
|
30
|
+
qualitytesting: 'QUALITY_TESTING',
|
|
31
|
+
'质检': 'QUALITY_TESTING',
|
|
32
|
+
OTHER: 'OTHER',
|
|
33
|
+
other: 'OTHER',
|
|
34
|
+
'其它': 'OTHER',
|
|
35
|
+
'其他': 'OTHER',
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
function normalizeOperationType(input: string | undefined): string | undefined {
|
|
39
|
+
if (!input) return undefined;
|
|
40
|
+
const normalized = input.trim().toUpperCase();
|
|
41
|
+
return OPERATION_TYPE_REVERSE[normalized] || OPERATION_TYPE_REVERSE[input];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function getOperationTypeDisplay(type: string): string {
|
|
45
|
+
return OPERATION_TYPE_MAP[type] || type;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function createOperationsUpdateCommand(): Command {
|
|
49
|
+
const updateCommand = new Command('update');
|
|
50
|
+
updateCommand
|
|
51
|
+
.description('Update operation information')
|
|
52
|
+
.option('--id <id>', 'Operation ID')
|
|
53
|
+
.option('-n, --name <name>', 'Operation name')
|
|
54
|
+
.option('-t, --type <type>', 'Operation type (EQUIPMENT/HUMAN/PACKAGE/QUALITY_TESTING/OTHER or Chinese: 机器/手工/包装/质检/其它)')
|
|
55
|
+
.option('-w, --work-center <workCenter>', 'Work center code')
|
|
56
|
+
.option('--mould-code <mouldCode>', 'Mould code')
|
|
57
|
+
.option('--mould-type <mouldType>', 'Mould type')
|
|
58
|
+
.option('--equipment-type <equipmentType>', 'Equipment type')
|
|
59
|
+
.option('--lead-time <leadTime>', 'Lead time (hours)', (val) => parseInt(val, 10))
|
|
60
|
+
.option('--remark <remark>', 'Remarks')
|
|
61
|
+
.option('--status <status>', 'Status (1=enable, 2=disable)', (val) => parseInt(val, 10))
|
|
62
|
+
.option('--dry-run', 'Preview changes without making API call')
|
|
63
|
+
.option('--json', 'Output result as JSON')
|
|
64
|
+
.action(async (options: Record<string, unknown>) => {
|
|
65
|
+
const operationId = options.id as string | undefined;
|
|
66
|
+
if (!operationId) {
|
|
67
|
+
console.error(chalk.red('\n✗ --id is required\n'));
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
const operationIdStr: string = operationId;
|
|
71
|
+
const context = configManager.getCurrentContext();
|
|
72
|
+
const environment: Environment = (options.env as Environment) || context.environment;
|
|
73
|
+
const tenant: string = (options.tenant as string) || context.tenant;
|
|
74
|
+
|
|
75
|
+
const fields: Partial<OperationUpdateRequest> = {};
|
|
76
|
+
if (options.name) fields.operationName = options.name as string;
|
|
77
|
+
if (options.type) {
|
|
78
|
+
const normalizedType = normalizeOperationType(options.type as string);
|
|
79
|
+
if (normalizedType) {
|
|
80
|
+
fields.operationType = normalizedType as 'EQUIPMENT' | 'HUMAN' | 'PACKAGE' | 'QUALITY_TESTING' | 'OTHER';
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (options.workCenter) fields.workCenterCode = options.workCenter as string;
|
|
84
|
+
if (options.mouldCode) fields.mouldCode = options.mouldCode as string;
|
|
85
|
+
if (options.mouldType) fields.mouldType = options.mouldType as string;
|
|
86
|
+
if (options.equipmentType) fields.equipmentType = options.equipmentType as string;
|
|
87
|
+
if (options.leadTime) fields.leadTime = options.leadTime as number;
|
|
88
|
+
if (options.remark) fields.remark = options.remark as string;
|
|
89
|
+
if (options.status) {
|
|
90
|
+
const statusVal = options.status as number;
|
|
91
|
+
if (statusVal === 1 || statusVal === 2) {
|
|
92
|
+
fields.statusFlag = statusVal as StatusFlag;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const providedFields = Object.keys(fields).filter(
|
|
97
|
+
(k) => fields[k as keyof OperationUpdateRequest] !== undefined
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
if (providedFields.length === 0) {
|
|
101
|
+
console.error(
|
|
102
|
+
chalk.red('\n✗ No fields to update. Provide at least one of: --name, --type, --work-center, --mould-code, --mould-type, --equipment-type, --lead-time, --remark, --status\n')
|
|
103
|
+
);
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Validate lead time
|
|
108
|
+
if (options.leadTime && (isNaN(options.leadTime as number) || (options.leadTime as number) < 0)) {
|
|
109
|
+
console.error(chalk.red('\n✗ Invalid lead time. Must be a non-negative number\n'));
|
|
110
|
+
process.exit(1);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Validate status
|
|
114
|
+
if (options.status) {
|
|
115
|
+
const statusVal = options.status as number;
|
|
116
|
+
if (statusVal !== 1 && statusVal !== 2) {
|
|
117
|
+
console.error(chalk.red('\n✗ Invalid status. Use 1 (enable) or 2 (disable)\n'));
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (options.dryRun) {
|
|
123
|
+
console.log(chalk.bold(`\n📋 Update Operation — Dry Run (${environment})\n`));
|
|
124
|
+
console.log(chalk.gray(` Operation ID: ${operationId}`));
|
|
125
|
+
console.log(chalk.gray('\n Changes to be applied:'));
|
|
126
|
+
for (const field of providedFields) {
|
|
127
|
+
const label = field.replace(/([A-Z])/g, (m) => ` ${m.toLowerCase()}`).trim();
|
|
128
|
+
if (field === 'operationType') {
|
|
129
|
+
const displayType = getOperationTypeDisplay(fields[field as keyof OperationUpdateRequest] as string);
|
|
130
|
+
console.log(chalk.cyan(` ${label}: "${displayType}"`));
|
|
131
|
+
} else {
|
|
132
|
+
console.log(chalk.cyan(` ${label}: "${fields[field as keyof OperationUpdateRequest]}"`));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
console.log();
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
let currentOperation: Operation | undefined;
|
|
140
|
+
try {
|
|
141
|
+
const operationResponse = await apiClient.getOperationDetail(environment, tenant, operationIdStr);
|
|
142
|
+
if (!operationResponse.success || !operationResponse.data || Array.isArray(operationResponse.data)) {
|
|
143
|
+
console.error(chalk.red(`\n✗ Operation not found: ${operationIdStr}`));
|
|
144
|
+
if (operationResponse.error?.message) {
|
|
145
|
+
console.error(chalk.gray(` ${operationResponse.error.message}`));
|
|
146
|
+
}
|
|
147
|
+
if (operationResponse.error?.code) {
|
|
148
|
+
console.error(chalk.gray(` Error code: ${operationResponse.error.code}`));
|
|
149
|
+
}
|
|
150
|
+
console.error();
|
|
151
|
+
process.exit(1);
|
|
152
|
+
}
|
|
153
|
+
currentOperation = operationResponse.data as Operation;
|
|
154
|
+
} catch (error) {
|
|
155
|
+
console.error(chalk.red(`\n✗ Failed to fetch operation: ${error instanceof Error ? error.message : 'Unknown error'}\n`));
|
|
156
|
+
process.exit(1);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
console.log(chalk.bold(`\n📋 Update Operation (${environment})\n`));
|
|
160
|
+
console.log(chalk.gray(` Operation ID: ${operationId}`));
|
|
161
|
+
console.log(chalk.gray(` Current Name: ${currentOperation.operationName}`));
|
|
162
|
+
console.log(chalk.gray('\n Changes:'));
|
|
163
|
+
for (const field of providedFields) {
|
|
164
|
+
const label = field.replace(/([A-Z])/g, (m) => ` ${m.toLowerCase()}`).trim();
|
|
165
|
+
let currentVal = (currentOperation as unknown as Record<string, unknown>)[field] ?? '(not set)';
|
|
166
|
+
let newVal = fields[field as keyof OperationUpdateRequest];
|
|
167
|
+
|
|
168
|
+
if (field === 'operationType') {
|
|
169
|
+
currentVal = getOperationTypeDisplay(currentVal as string);
|
|
170
|
+
newVal = getOperationTypeDisplay(newVal as string) as typeof newVal;
|
|
171
|
+
}
|
|
172
|
+
if (field === 'statusFlag') {
|
|
173
|
+
currentVal = currentVal === 1 ? 'Enable' : 'Disable';
|
|
174
|
+
newVal = newVal === 1 ? 'Enable' : 'Disable';
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
console.log(chalk.cyan(` ${label}: "${currentVal}" → "${newVal}"`));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const updateData: OperationUpdateRequest = { operationId: operationIdStr, ...fields };
|
|
181
|
+
try {
|
|
182
|
+
const response = await apiClient.updateOperation(environment, tenant, updateData);
|
|
183
|
+
|
|
184
|
+
if (response.success) {
|
|
185
|
+
if (options.json) {
|
|
186
|
+
console.log(JSON.stringify({ success: true, data: response.data }, null, 2));
|
|
187
|
+
} else {
|
|
188
|
+
console.log(chalk.green('\n✓ Operation updated successfully\n'));
|
|
189
|
+
}
|
|
190
|
+
} else {
|
|
191
|
+
if (options.json) {
|
|
192
|
+
console.log(JSON.stringify({ success: false, error: response.error }, null, 2));
|
|
193
|
+
} else {
|
|
194
|
+
console.error(chalk.red(`\n✗ Update failed: ${response.error?.message || 'Unknown error'}`));
|
|
195
|
+
if (response.error?.code) {
|
|
196
|
+
console.error(chalk.gray(` Error code: ${response.error.code}`));
|
|
197
|
+
}
|
|
198
|
+
console.error();
|
|
199
|
+
}
|
|
200
|
+
process.exit(1);
|
|
201
|
+
}
|
|
202
|
+
} catch (error) {
|
|
203
|
+
if (options.json) {
|
|
204
|
+
console.log(
|
|
205
|
+
JSON.stringify({
|
|
206
|
+
success: false,
|
|
207
|
+
error: { message: error instanceof Error ? error.message : 'Unknown error' },
|
|
208
|
+
})
|
|
209
|
+
);
|
|
210
|
+
} else {
|
|
211
|
+
console.error(chalk.red(`\n✗ Error: ${error instanceof Error ? error.message : 'Unknown error'}\n`));
|
|
212
|
+
}
|
|
213
|
+
process.exit(1);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
return updateCommand;
|
|
218
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
-
import Table from 'cli-table3';
|
|
4
3
|
import { configManager } from '../../../core/config/manager.js';
|
|
5
4
|
import { apiClient } from '../../../core/api/client.js';
|
|
6
5
|
import { Environment } from '../../../types/index.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { createStockListCommand } from './list.js';
|
|
3
|
+
import { createStockLedgerCommand } from './ledger.js';
|
|
4
|
+
|
|
5
|
+
export function createStockCommand(): Command {
|
|
6
|
+
const stockCommand = new Command('stock');
|
|
7
|
+
stockCommand.description('Manage stock inventory and ledger');
|
|
8
|
+
|
|
9
|
+
stockCommand.addCommand(createStockListCommand());
|
|
10
|
+
stockCommand.addCommand(createStockLedgerCommand());
|
|
11
|
+
|
|
12
|
+
return stockCommand;
|
|
13
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import Table from 'cli-table3';
|
|
4
|
+
import { configManager } from '../../../core/config/manager.js';
|
|
5
|
+
import { apiClient } from '../../../core/api/client.js';
|
|
6
|
+
import { StockJourneyQueryParams, StockJourneyApiResponse, StockJourneySummaryApiResponse } from '../../../types/stock.js';
|
|
7
|
+
import { Environment } from '../../../types/index.js';
|
|
8
|
+
|
|
9
|
+
export function createStockLedgerCommand(): Command {
|
|
10
|
+
const ledgerCommand = new Command('ledger');
|
|
11
|
+
ledgerCommand.description('Query stock ledger/journey (inbound/outbound history)');
|
|
12
|
+
|
|
13
|
+
ledgerCommand
|
|
14
|
+
.option('--stock-id <string>', 'Stock/Journey ID')
|
|
15
|
+
.option('--stock-form-code <string>', 'Stock form document code')
|
|
16
|
+
.option('--stock-type <string>', 'Stock type (e.g. PURCHASE_STOCK_IN)')
|
|
17
|
+
.option('--stock-flag <INBOUND|OUTBOUND>', 'Stock flag (INBOUND or OUTBOUND)')
|
|
18
|
+
.option('--warehouse-code <string>', 'Warehouse code')
|
|
19
|
+
.option('--material-code <string>', 'Material code')
|
|
20
|
+
.option('--material-no <string>', 'Material number')
|
|
21
|
+
.option('--material-name <string>', 'Material name')
|
|
22
|
+
.option('--material-type <string>', 'Material type/spec')
|
|
23
|
+
.option('--color <string>', 'Color')
|
|
24
|
+
.option('--lot-no <string>', 'Lot/Batch number')
|
|
25
|
+
.option('--lot-code <string>', 'System lot code')
|
|
26
|
+
.option('--source-type <string>', 'Source document type')
|
|
27
|
+
.option('--source-code <string>', 'Source document code')
|
|
28
|
+
.option('--start-date <YYYY-MM-DD>', 'Stock date range start')
|
|
29
|
+
.option('--end-date <YYYY-MM-DD>', 'Stock date range end')
|
|
30
|
+
.option('--posting-month <YYYY-MM>', 'Posting month (e.g. 2026-01)')
|
|
31
|
+
.option('--summary', 'Show only summary (no detail list)')
|
|
32
|
+
.option('-p, --page <number>', 'Page number (1-based)', '1')
|
|
33
|
+
.option('-s, --size <number>', 'Page size', '20')
|
|
34
|
+
.option('--json', 'Output as JSON')
|
|
35
|
+
.action(async (options) => {
|
|
36
|
+
const context = configManager.getCurrentContext();
|
|
37
|
+
const environment = (options.env as Environment) || context.environment;
|
|
38
|
+
const tenant = (options.tenant as string) || context.tenant;
|
|
39
|
+
|
|
40
|
+
if (!tenant) {
|
|
41
|
+
console.error(chalk.red('\n✗ No tenant configured. Run "barista liberica auth login" first.\n'));
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const pageNo = parseInt(options.page as string, 10) - 1;
|
|
46
|
+
const pageSize = parseInt(options.size as string, 10);
|
|
47
|
+
|
|
48
|
+
const params: StockJourneyQueryParams = {
|
|
49
|
+
pageNo,
|
|
50
|
+
pageSize,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
if (options.stockId) params.stockId = options.stockId;
|
|
54
|
+
if (options.stockFormCode) params.stockFormCode = options.stockFormCode;
|
|
55
|
+
if (options.stockType) params.stockType = options.stockType;
|
|
56
|
+
if (options.stockFlag) params.stockFlag = options.stockFlag;
|
|
57
|
+
if (options.warehouseCode) params.warehouseCode = options.warehouseCode;
|
|
58
|
+
if (options.materialCode) params.materialCode = options.materialCode;
|
|
59
|
+
if (options.materialNo) params.materialNo = options.materialNo;
|
|
60
|
+
if (options.materialName) params.materialName = options.materialName;
|
|
61
|
+
if (options.materialType) params.materialType = options.materialType;
|
|
62
|
+
if (options.color) params.color = options.color;
|
|
63
|
+
if (options.lotNo) params.lotNo = options.lotNo;
|
|
64
|
+
if (options.lotCode) params.lotCode = options.lotCode;
|
|
65
|
+
if (options.sourceType) params.sourceType = options.sourceType;
|
|
66
|
+
if (options.sourceCode) params.sourceCode = options.sourceCode;
|
|
67
|
+
if (options.startDate) params.startDate = options.startDate;
|
|
68
|
+
if (options.endDate) params.endDate = options.endDate;
|
|
69
|
+
if (options.postingMonth) params.postingMonth = options.postingMonth;
|
|
70
|
+
|
|
71
|
+
const showOnlySummary = options.summary === true;
|
|
72
|
+
|
|
73
|
+
const summaryResponse: StockJourneySummaryApiResponse = await apiClient.getStockLedgerSummary(environment, tenant, params);
|
|
74
|
+
|
|
75
|
+
if (!summaryResponse.success) {
|
|
76
|
+
console.error(chalk.red(`\n✗ Failed to get summary: ${summaryResponse.error?.message}\n`));
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const summary = summaryResponse.data;
|
|
81
|
+
|
|
82
|
+
if (options.json) {
|
|
83
|
+
if (showOnlySummary) {
|
|
84
|
+
console.log(JSON.stringify({ success: true, summary }, null, 2));
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const listResponse: StockJourneyApiResponse = await apiClient.listStockLedger(environment, tenant, params);
|
|
88
|
+
if (!listResponse.success) {
|
|
89
|
+
console.error(chalk.red(`\n✗ Failed: ${listResponse.error?.message}\n`));
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}
|
|
92
|
+
console.log(JSON.stringify({ success: true, summary, data: listResponse.data }, null, 2));
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
console.log(chalk.bold('\n Stock Ledger Summary\n'));
|
|
97
|
+
if (summary) {
|
|
98
|
+
console.log(` ${chalk.gray('Total Inbound:')} ${chalk.green(summary.totalInboundCount?.toLocaleString() || 0)} units ${chalk.green('¥' + (summary.totalInboundAmount || 0).toLocaleString())}`);
|
|
99
|
+
console.log(` ${chalk.gray('Total Outbound:')} ${chalk.red(summary.totalOutboundCount?.toLocaleString() || 0)} units ${chalk.red('¥' + (summary.totalOutboundAmount || 0).toLocaleString())}`);
|
|
100
|
+
}
|
|
101
|
+
console.log();
|
|
102
|
+
|
|
103
|
+
if (showOnlySummary) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const listResponse: StockJourneyApiResponse = await apiClient.listStockLedger(environment, tenant, params);
|
|
108
|
+
if (!listResponse.success) {
|
|
109
|
+
console.error(chalk.red(`\n✗ Failed: ${listResponse.error?.message}\n`));
|
|
110
|
+
process.exit(1);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const data = listResponse.data!;
|
|
114
|
+
const items = data.rows || [];
|
|
115
|
+
|
|
116
|
+
if (items.length === 0) {
|
|
117
|
+
console.log(chalk.yellow(' No ledger records found.\n'));
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const table = new Table({
|
|
122
|
+
head: [
|
|
123
|
+
chalk.bold('Date'),
|
|
124
|
+
chalk.bold('Flag'),
|
|
125
|
+
chalk.bold('Warehouse'),
|
|
126
|
+
chalk.bold('Material'),
|
|
127
|
+
chalk.bold('Lot No'),
|
|
128
|
+
chalk.bold('In Qty'),
|
|
129
|
+
chalk.bold('Out Qty'),
|
|
130
|
+
chalk.bold('Doc No'),
|
|
131
|
+
],
|
|
132
|
+
colWidths: [12, 8, 10, 16, 12, 8, 8, 16],
|
|
133
|
+
style: { border: [], head: [] },
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
for (const item of items) {
|
|
137
|
+
const flagColor = item.stockFlag === 'INBOUND' ? chalk.green : chalk.red;
|
|
138
|
+
table.push([
|
|
139
|
+
item.stockDate || '-',
|
|
140
|
+
flagColor(item.stockFlag || '-'),
|
|
141
|
+
item.warehouseCode || '-',
|
|
142
|
+
item.materialCode || '-',
|
|
143
|
+
item.lotNo || '-',
|
|
144
|
+
item.inboundCount != null ? item.inboundCount.toLocaleString() : '-',
|
|
145
|
+
item.outboundCount != null ? item.outboundCount.toLocaleString() : '-',
|
|
146
|
+
item.stockFormCode || '-',
|
|
147
|
+
]);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
console.log(chalk.bold(' Stock Ledger Detail\n'));
|
|
151
|
+
console.log(table.toString());
|
|
152
|
+
|
|
153
|
+
const totalPages = Math.ceil(data.totalRows / pageSize);
|
|
154
|
+
const currentPage = pageNo + 1;
|
|
155
|
+
console.log(chalk.gray(`\n Page ${currentPage} of ${totalPages} (Total: ${data.totalRows.toLocaleString()})\n`));
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
return ledgerCommand;
|
|
159
|
+
}
|