@newpeak/barista-cli 0.1.10 ā 0.1.12
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/dist/index.js +1 -1
- package/package.json +7 -3
- package/docs/ARCHITECTURE.md +0 -184
- package/docs/COMMANDS.md +0 -352
- package/docs/COMMAND_DESIGN_SPEC.md +0 -840
- package/docs/INTEGRATION_NOTES.md +0 -270
- package/docs/commands/REFERENCE.md +0 -323
- package/docs/commands/arabica/auth/index.md +0 -296
- package/docs/commands/liberica/auth/index.md +0 -133
- package/docs/commands/liberica/calendar/DESIGN.md +0 -333
- package/docs/commands/liberica/client-contacts/create.md +0 -152
- package/docs/commands/liberica/client-contacts/delete.md +0 -123
- package/docs/commands/liberica/client-contacts/get.md +0 -133
- package/docs/commands/liberica/client-contacts/list.md +0 -143
- package/docs/commands/liberica/client-contacts/update.md +0 -158
- package/docs/commands/liberica/context/index.md +0 -60
- package/docs/commands/liberica/currency/create.md +0 -145
- package/docs/commands/liberica/currency/delete.md +0 -121
- package/docs/commands/liberica/currency/disable.md +0 -119
- package/docs/commands/liberica/currency/enable.md +0 -115
- package/docs/commands/liberica/currency/get.md +0 -118
- package/docs/commands/liberica/currency/list.md +0 -149
- package/docs/commands/liberica/currency/update.md +0 -141
- package/docs/commands/liberica/employees/create.md +0 -185
- package/docs/commands/liberica/employees/disable.md +0 -138
- package/docs/commands/liberica/employees/enable.md +0 -137
- package/docs/commands/liberica/employees/get.md +0 -153
- package/docs/commands/liberica/employees/list.md +0 -168
- package/docs/commands/liberica/employees/update.md +0 -180
- package/docs/commands/liberica/locations/create.md +0 -195
- package/docs/commands/liberica/locations/list.md +0 -171
- package/docs/commands/liberica/materials/create.md +0 -293
- package/docs/commands/liberica/materials/delete.md +0 -240
- package/docs/commands/liberica/materials/disable.md +0 -150
- package/docs/commands/liberica/materials/enable.md +0 -146
- package/docs/commands/liberica/materials/get.md +0 -188
- package/docs/commands/liberica/materials/list.md +0 -198
- package/docs/commands/liberica/materials/update.md +0 -250
- package/docs/commands/liberica/orgs/list.md +0 -62
- package/docs/commands/liberica/positions/list.md +0 -61
- package/docs/commands/liberica/roles/list.md +0 -67
- package/docs/commands/liberica/stock/ledger.md +0 -209
- package/docs/commands/liberica/stock/list.md +0 -165
- package/docs/commands/liberica/supplier-contacts/create.md +0 -152
- package/docs/commands/liberica/supplier-contacts/delete.md +0 -123
- package/docs/commands/liberica/supplier-contacts/get.md +0 -133
- package/docs/commands/liberica/supplier-contacts/list.md +0 -143
- package/docs/commands/liberica/supplier-contacts/update.md +0 -158
- package/docs/commands/liberica/teams/issues/close.md +0 -161
- package/docs/commands/liberica/teams/issues/create.md +0 -212
- package/docs/commands/liberica/teams/issues/delete.md +0 -179
- package/docs/commands/liberica/teams/issues/get.md +0 -167
- package/docs/commands/liberica/teams/issues/list.md +0 -182
- package/docs/commands/liberica/teams/issues/tests-design.md +0 -341
- package/docs/commands/liberica/teams/issues/update.md +0 -202
- package/docs/commands/liberica/teams/projects/create.md +0 -174
- package/docs/commands/liberica/teams/projects/delete.md +0 -180
- package/docs/commands/liberica/teams/projects/get.md +0 -150
- package/docs/commands/liberica/teams/projects/list.md +0 -179
- package/docs/commands/liberica/teams/projects/update.md +0 -175
- package/docs/commands/liberica/teams/tasks/create.md +0 -163
- package/docs/commands/liberica/teams/tasks/delete.md +0 -109
- package/docs/commands/liberica/teams/tasks/get.md +0 -121
- package/docs/commands/liberica/teams/tasks/list.md +0 -148
- package/docs/commands/liberica/teams/tasks/update.md +0 -158
- package/docs/commands/liberica/teams/work-logs/create.md +0 -151
- package/docs/commands/liberica/teams/work-logs/delete.md +0 -130
- package/docs/commands/liberica/teams/work-logs/get.md +0 -131
- package/docs/commands/liberica/teams/work-logs/list.md +0 -153
- package/docs/commands/liberica/teams/work-logs/update.md +0 -150
- package/docs/commands/liberica/transfer-in-forms/batch-delete.md +0 -157
- package/docs/commands/liberica/transfer-in-forms/batch-review.md +0 -157
- package/docs/commands/liberica/transfer-in-forms/batch-unreview.md +0 -157
- package/docs/commands/liberica/transfer-in-forms/create.md +0 -220
- package/docs/commands/liberica/transfer-in-forms/get.md +0 -221
- package/docs/commands/liberica/transfer-in-forms/list.md +0 -242
- package/docs/commands/liberica/transfer-in-forms/update.md +0 -185
- package/docs/commands/liberica/transfer-out-forms/batch-delete.md +0 -187
- package/docs/commands/liberica/transfer-out-forms/batch-review.md +0 -157
- package/docs/commands/liberica/transfer-out-forms/batch-unreview.md +0 -157
- package/docs/commands/liberica/transfer-out-forms/create.md +0 -280
- package/docs/commands/liberica/transfer-out-forms/get.md +0 -211
- package/docs/commands/liberica/transfer-out-forms/list.md +0 -233
- package/docs/commands/liberica/transfer-out-forms/update.md +0 -286
- package/docs/commands/liberica/uoms/create.md +0 -136
- package/docs/commands/liberica/uoms/delete.md +0 -119
- package/docs/commands/liberica/uoms/disable.md +0 -117
- package/docs/commands/liberica/uoms/enable.md +0 -115
- package/docs/commands/liberica/uoms/get.md +0 -119
- package/docs/commands/liberica/uoms/list.md +0 -155
- package/docs/commands/liberica/uoms/update.md +0 -148
- package/docs/commands/liberica/users/create.md +0 -170
- package/docs/commands/liberica/users/get.md +0 -151
- package/docs/commands/liberica/users/list.md +0 -175
- package/docs/commands/liberica/warehouses/create.md +0 -222
- package/docs/commands/liberica/warehouses/list.md +0 -184
- package/src/commands/arabica/auth/index.ts +0 -277
- package/src/commands/arabica/auth/login.ts +0 -5
- package/src/commands/arabica/auth/logout.ts +0 -5
- package/src/commands/arabica/auth/register.ts +0 -5
- package/src/commands/arabica/auth/status.ts +0 -5
- package/src/commands/arabica/index.ts +0 -23
- package/src/commands/auth.ts +0 -107
- package/src/commands/context.ts +0 -60
- package/src/commands/liberica/auth/index.ts +0 -176
- package/src/commands/liberica/calendar/index.ts +0 -13
- package/src/commands/liberica/calendar/list.ts +0 -214
- package/src/commands/liberica/calendar/set.ts +0 -130
- package/src/commands/liberica/client-contacts/create.ts +0 -115
- package/src/commands/liberica/client-contacts/delete.ts +0 -140
- package/src/commands/liberica/client-contacts/get.ts +0 -103
- package/src/commands/liberica/client-contacts/index.ts +0 -19
- package/src/commands/liberica/client-contacts/list.ts +0 -118
- package/src/commands/liberica/client-contacts/update.ts +0 -137
- package/src/commands/liberica/clients/create.ts +0 -122
- package/src/commands/liberica/clients/delete.ts +0 -125
- package/src/commands/liberica/clients/get.ts +0 -88
- package/src/commands/liberica/clients/index.ts +0 -19
- package/src/commands/liberica/clients/list.ts +0 -123
- package/src/commands/liberica/clients/update.ts +0 -103
- package/src/commands/liberica/context/index.ts +0 -43
- package/src/commands/liberica/currency/create.ts +0 -183
- package/src/commands/liberica/currency/delete.ts +0 -124
- package/src/commands/liberica/currency/disable.ts +0 -147
- package/src/commands/liberica/currency/enable.ts +0 -128
- package/src/commands/liberica/currency/get.ts +0 -91
- package/src/commands/liberica/currency/index.ts +0 -23
- package/src/commands/liberica/currency/list.ts +0 -140
- package/src/commands/liberica/currency/update.ts +0 -129
- package/src/commands/liberica/dict-types/get.ts +0 -74
- package/src/commands/liberica/dict-types/index.ts +0 -15
- package/src/commands/liberica/dict-types/list.ts +0 -118
- package/src/commands/liberica/dict-types/update.ts +0 -134
- package/src/commands/liberica/dicts/create.ts +0 -175
- package/src/commands/liberica/dicts/delete.ts +0 -107
- package/src/commands/liberica/dicts/get.ts +0 -80
- package/src/commands/liberica/dicts/index.ts +0 -19
- package/src/commands/liberica/dicts/list.ts +0 -114
- package/src/commands/liberica/dicts/update.ts +0 -116
- package/src/commands/liberica/employees/create.ts +0 -275
- package/src/commands/liberica/employees/delete.ts +0 -122
- package/src/commands/liberica/employees/disable.ts +0 -97
- package/src/commands/liberica/employees/enable.ts +0 -97
- package/src/commands/liberica/employees/get.ts +0 -115
- package/src/commands/liberica/employees/index.ts +0 -23
- package/src/commands/liberica/employees/list.ts +0 -131
- package/src/commands/liberica/employees/update.ts +0 -157
- package/src/commands/liberica/index.ts +0 -81
- package/src/commands/liberica/materials/create.ts +0 -199
- package/src/commands/liberica/materials/delete.ts +0 -105
- package/src/commands/liberica/materials/disable.ts +0 -148
- package/src/commands/liberica/materials/enable.ts +0 -129
- package/src/commands/liberica/materials/get.ts +0 -83
- package/src/commands/liberica/materials/index.ts +0 -23
- package/src/commands/liberica/materials/list.ts +0 -142
- package/src/commands/liberica/materials/update.ts +0 -125
- package/src/commands/liberica/mould/get.ts +0 -111
- package/src/commands/liberica/mould/index.ts +0 -17
- package/src/commands/liberica/mould/list.ts +0 -157
- package/src/commands/liberica/mould/set-status.ts +0 -99
- package/src/commands/liberica/mould/stock-in.ts +0 -165
- package/src/commands/liberica/operations/active.ts +0 -153
- package/src/commands/liberica/operations/batch-delete.ts +0 -131
- package/src/commands/liberica/operations/copy.ts +0 -138
- package/src/commands/liberica/operations/create.ts +0 -223
- package/src/commands/liberica/operations/deactive.ts +0 -152
- package/src/commands/liberica/operations/delete.ts +0 -128
- package/src/commands/liberica/operations/design.md +0 -587
- package/src/commands/liberica/operations/get.ts +0 -112
- package/src/commands/liberica/operations/index.ts +0 -27
- package/src/commands/liberica/operations/list.ts +0 -180
- package/src/commands/liberica/operations/update.ts +0 -218
- package/src/commands/liberica/orgs/index.ts +0 -34
- package/src/commands/liberica/positions/index.ts +0 -30
- package/src/commands/liberica/roles/index.ts +0 -59
- package/src/commands/liberica/stock/index.ts +0 -13
- package/src/commands/liberica/stock/ledger.ts +0 -159
- package/src/commands/liberica/stock/list.ts +0 -128
- package/src/commands/liberica/supplier-contacts/create.ts +0 -120
- package/src/commands/liberica/supplier-contacts/delete.ts +0 -88
- package/src/commands/liberica/supplier-contacts/get.ts +0 -94
- package/src/commands/liberica/supplier-contacts/index.ts +0 -19
- package/src/commands/liberica/supplier-contacts/list.ts +0 -130
- package/src/commands/liberica/supplier-contacts/update.ts +0 -127
- package/src/commands/liberica/suppliers/create.ts +0 -149
- package/src/commands/liberica/suppliers/delete.ts +0 -102
- package/src/commands/liberica/suppliers/disable.ts +0 -145
- package/src/commands/liberica/suppliers/enable.ts +0 -126
- package/src/commands/liberica/suppliers/get.ts +0 -86
- package/src/commands/liberica/suppliers/index.ts +0 -23
- package/src/commands/liberica/suppliers/list.ts +0 -134
- package/src/commands/liberica/suppliers/update.ts +0 -128
- package/src/commands/liberica/teams/index.ts +0 -17
- package/src/commands/liberica/teams/issues/close.ts +0 -104
- package/src/commands/liberica/teams/issues/create.ts +0 -254
- package/src/commands/liberica/teams/issues/delete.ts +0 -58
- package/src/commands/liberica/teams/issues/get.ts +0 -78
- package/src/commands/liberica/teams/issues/index.ts +0 -21
- package/src/commands/liberica/teams/issues/list.ts +0 -144
- package/src/commands/liberica/teams/issues/update.ts +0 -141
- package/src/commands/liberica/teams/projects/create.ts +0 -159
- package/src/commands/liberica/teams/projects/delete.ts +0 -58
- package/src/commands/liberica/teams/projects/get.ts +0 -87
- package/src/commands/liberica/teams/projects/index.ts +0 -19
- package/src/commands/liberica/teams/projects/list.ts +0 -147
- package/src/commands/liberica/teams/projects/update.ts +0 -117
- package/src/commands/liberica/teams/tasks/create.ts +0 -102
- package/src/commands/liberica/teams/tasks/delete.ts +0 -92
- package/src/commands/liberica/teams/tasks/get.ts +0 -64
- package/src/commands/liberica/teams/tasks/index.ts +0 -19
- package/src/commands/liberica/teams/tasks/list.ts +0 -102
- package/src/commands/liberica/teams/tasks/update.ts +0 -122
- package/src/commands/liberica/teams/work-logs/create.ts +0 -204
- package/src/commands/liberica/teams/work-logs/delete.ts +0 -58
- package/src/commands/liberica/teams/work-logs/get.ts +0 -87
- package/src/commands/liberica/teams/work-logs/index.ts +0 -19
- package/src/commands/liberica/teams/work-logs/list.ts +0 -141
- package/src/commands/liberica/teams/work-logs/update.ts +0 -120
- package/src/commands/liberica/transfer-in-forms/batch-delete.ts +0 -152
- package/src/commands/liberica/transfer-in-forms/batch-review.ts +0 -151
- package/src/commands/liberica/transfer-in-forms/batch-unreview.ts +0 -152
- package/src/commands/liberica/transfer-in-forms/create.ts +0 -179
- package/src/commands/liberica/transfer-in-forms/get.ts +0 -107
- package/src/commands/liberica/transfer-in-forms/index.ts +0 -23
- package/src/commands/liberica/transfer-in-forms/list.ts +0 -97
- package/src/commands/liberica/transfer-in-forms/update.ts +0 -213
- package/src/commands/liberica/transfer-out-forms/batch-delete.ts +0 -83
- package/src/commands/liberica/transfer-out-forms/batch-review.ts +0 -148
- package/src/commands/liberica/transfer-out-forms/batch-unreview.ts +0 -56
- package/src/commands/liberica/transfer-out-forms/create.ts +0 -194
- package/src/commands/liberica/transfer-out-forms/get.ts +0 -114
- package/src/commands/liberica/transfer-out-forms/index.ts +0 -23
- package/src/commands/liberica/transfer-out-forms/list.ts +0 -125
- package/src/commands/liberica/transfer-out-forms/update.ts +0 -197
- package/src/commands/liberica/uoms/create.ts +0 -134
- package/src/commands/liberica/uoms/delete.ts +0 -105
- package/src/commands/liberica/uoms/disable.ts +0 -148
- package/src/commands/liberica/uoms/enable.ts +0 -129
- package/src/commands/liberica/uoms/get.ts +0 -83
- package/src/commands/liberica/uoms/index.ts +0 -23
- package/src/commands/liberica/uoms/list.ts +0 -129
- package/src/commands/liberica/uoms/update.ts +0 -124
- package/src/commands/liberica/users/create.ts +0 -133
- package/src/commands/liberica/users/delete.ts +0 -49
- package/src/commands/liberica/users/disable.ts +0 -41
- package/src/commands/liberica/users/enable.ts +0 -30
- package/src/commands/liberica/users/get.ts +0 -46
- package/src/commands/liberica/users/index.ts +0 -27
- package/src/commands/liberica/users/list.ts +0 -68
- package/src/commands/liberica/users/me.ts +0 -42
- package/src/commands/liberica/users/reset-password.ts +0 -42
- package/src/commands/liberica/users/update.ts +0 -48
- package/src/commands/liberica/warehouses/create.ts +0 -204
- package/src/commands/liberica/warehouses/delete.ts +0 -112
- package/src/commands/liberica/warehouses/disable.ts +0 -174
- package/src/commands/liberica/warehouses/enable.ts +0 -174
- package/src/commands/liberica/warehouses/get.ts +0 -101
- package/src/commands/liberica/warehouses/index.ts +0 -25
- package/src/commands/liberica/warehouses/list.ts +0 -136
- package/src/commands/liberica/warehouses/locations/create.ts +0 -209
- package/src/commands/liberica/warehouses/locations/delete.ts +0 -116
- package/src/commands/liberica/warehouses/locations/disable.ts +0 -174
- package/src/commands/liberica/warehouses/locations/enable.ts +0 -174
- package/src/commands/liberica/warehouses/locations/get.ts +0 -84
- package/src/commands/liberica/warehouses/locations/index.ts +0 -23
- package/src/commands/liberica/warehouses/locations/list.ts +0 -140
- package/src/commands/liberica/warehouses/locations/update.ts +0 -135
- package/src/commands/liberica/warehouses/update.ts +0 -142
- package/src/core/api/client.ts +0 -4443
- package/src/core/auth/token-manager.ts +0 -183
- package/src/core/config/manager.ts +0 -164
- package/src/index.ts +0 -35
- package/src/types/calendar.ts +0 -36
- package/src/types/client-contact.ts +0 -78
- package/src/types/client.ts +0 -115
- package/src/types/currency.ts +0 -90
- package/src/types/dict.ts +0 -121
- package/src/types/employee.ts +0 -102
- package/src/types/index.ts +0 -93
- package/src/types/location.ts +0 -66
- package/src/types/material.ts +0 -61
- package/src/types/mould-stock-in.ts +0 -82
- package/src/types/mould.ts +0 -74
- package/src/types/operation.ts +0 -72
- package/src/types/org.ts +0 -25
- package/src/types/position.ts +0 -24
- package/src/types/stock.ts +0 -161
- package/src/types/supplier-contact.ts +0 -78
- package/src/types/supplier.ts +0 -66
- package/src/types/team-issue.ts +0 -94
- package/src/types/team-project.ts +0 -74
- package/src/types/team-task.ts +0 -98
- package/src/types/team-work-log.ts +0 -87
- package/src/types/transfer-in-form.ts +0 -265
- package/src/types/transfer-out-form.ts +0 -290
- package/src/types/uom.ts +0 -60
- package/src/types/user.ts +0 -64
- package/src/types/warehouse.ts +0 -82
|
@@ -1,56 +0,0 @@
|
|
|
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 { Environment } from '../../../types/index.js';
|
|
6
|
-
|
|
7
|
-
export function createTransferOutFormBatchUnreviewCommand(): Command {
|
|
8
|
-
const cmd = new Command('batch-unreview');
|
|
9
|
-
cmd
|
|
10
|
-
.description('Batch unreview (åå®”ę ø) transfer-out forms')
|
|
11
|
-
.argument('<ids...>', 'Transfer-out form IDs to unreview')
|
|
12
|
-
.option('--json', 'Output as JSON');
|
|
13
|
-
|
|
14
|
-
cmd.action(async (ids: string[], options: Record<string, unknown>) => {
|
|
15
|
-
const context = configManager.getCurrentContext();
|
|
16
|
-
const environment = context.environment as Environment;
|
|
17
|
-
const tenant = context.tenant;
|
|
18
|
-
const jsonOutput = options.json === true;
|
|
19
|
-
|
|
20
|
-
if (ids.length === 0) {
|
|
21
|
-
const errMsg = 'No transfer-out form IDs provided';
|
|
22
|
-
if (jsonOutput) {
|
|
23
|
-
console.log(JSON.stringify({ success: false, error: { code: 'MISSING_IDS', message: errMsg } }));
|
|
24
|
-
} else {
|
|
25
|
-
console.error(chalk.red(`\nā ${errMsg}\n`));
|
|
26
|
-
}
|
|
27
|
-
process.exit(1);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (!jsonOutput) {
|
|
31
|
-
console.log(chalk.bold(`\nā© Batch Unreview Transfer-Out Forms (${environment})\n`));
|
|
32
|
-
console.log(chalk.gray(` Form IDs: ${ids.join(', ')}`));
|
|
33
|
-
console.log(chalk.gray(` Count: ${ids.length}\n`));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const response = await apiClient.batchUnreviewTransferOutForms(environment, tenant, ids);
|
|
37
|
-
|
|
38
|
-
if (response.success) {
|
|
39
|
-
if (jsonOutput) {
|
|
40
|
-
console.log(JSON.stringify({ success: true, ids, count: ids.length, message: 'Unreviewed successfully' }));
|
|
41
|
-
} else {
|
|
42
|
-
console.log(chalk.green(`\nā ${ids.length} transfer-out form(s) unreviewed successfully\n`));
|
|
43
|
-
}
|
|
44
|
-
} else {
|
|
45
|
-
const errMsg = response.error?.message || 'Failed to unreview';
|
|
46
|
-
if (jsonOutput) {
|
|
47
|
-
console.log(JSON.stringify({ success: false, error: { code: response.error?.code, message: errMsg } }));
|
|
48
|
-
} else {
|
|
49
|
-
console.error(chalk.red(`\nā ${errMsg}\n`));
|
|
50
|
-
}
|
|
51
|
-
process.exit(1);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
return cmd;
|
|
56
|
-
}
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { apiClient } from '../../../core/api/client.js';
|
|
4
|
-
import { configManager } from '../../../core/config/manager.js';
|
|
5
|
-
import {
|
|
6
|
-
CreateTransferOutFormRequest,
|
|
7
|
-
TransferOutFormItemRequest,
|
|
8
|
-
TransferOutForm,
|
|
9
|
-
} from '../../../types/transfer-out-form.js';
|
|
10
|
-
import { Environment } from '../../../types/index.js';
|
|
11
|
-
|
|
12
|
-
function formatTable(data: CreateTransferOutFormRequest): string {
|
|
13
|
-
const lines: string[] = [];
|
|
14
|
-
lines.push(` ${chalk.gray('Warehouse:')} ${data.warehouseCode}`);
|
|
15
|
-
lines.push(` ${chalk.gray('Stock Date:')} ${data.stockDate || '(today)'}`);
|
|
16
|
-
lines.push(` ${chalk.gray('Transfer-out Type:')} ${data.transferOutType}`);
|
|
17
|
-
if (data.transferOutFormCode) lines.push(` ${chalk.gray('Form Code:')} ${data.transferOutFormCode}`);
|
|
18
|
-
if (data.follower) lines.push(` ${chalk.gray('Follower:')} ${data.follower}${data.followerName ? ` (${data.followerName})` : ''}`);
|
|
19
|
-
if (data.remark) lines.push(` ${chalk.gray('Remark:')} ${data.remark}`);
|
|
20
|
-
|
|
21
|
-
const item = data.itemList[0];
|
|
22
|
-
if (item) {
|
|
23
|
-
lines.push('');
|
|
24
|
-
lines.push(` ${chalk.gray('Material Code:')} ${item.materialCode}`);
|
|
25
|
-
if (item.materialNo) lines.push(` ${chalk.gray('Material No:')} ${item.materialNo}`);
|
|
26
|
-
if (item.materialName) lines.push(` ${chalk.gray('Material Name:')} ${item.materialName}`);
|
|
27
|
-
if (item.materialType) lines.push(` ${chalk.gray('Material Type:')} ${item.materialType}`);
|
|
28
|
-
if (item.materialUomCode) lines.push(` ${chalk.gray('Material UOM:')} ${item.materialUomCode}`);
|
|
29
|
-
lines.push(` ${chalk.gray('Form Quantity:')} ${item.formQuantity}`);
|
|
30
|
-
if (item.formMaterialUomCode) lines.push(` ${chalk.gray('Form UOM:')} ${item.formMaterialUomCode}`);
|
|
31
|
-
lines.push(` ${chalk.gray('Stock Quantity:')} ${item.stockQuantity}`);
|
|
32
|
-
if (item.unitPrice) lines.push(` ${chalk.gray('Unit Price:')} ${item.unitPrice}`);
|
|
33
|
-
if (item.lotNoList && item.lotNoList.length > 0) lines.push(` ${chalk.gray('Lot Numbers:')} ${item.lotNoList.join(', ')}`);
|
|
34
|
-
if (item.remark) lines.push(` ${chalk.gray('Item Remark:')} ${item.remark}`);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return lines.join('\n');
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function createTransferOutFormCreateCommand(): Command {
|
|
41
|
-
const cmd = new Command('create');
|
|
42
|
-
cmd.description('Create a transfer-out form');
|
|
43
|
-
|
|
44
|
-
cmd
|
|
45
|
-
.requiredOption('-w, --warehouse-code <code>', 'Warehouse code (required)')
|
|
46
|
-
.requiredOption('-t, --transfer-out-type <type>', 'Transfer-out type (required)')
|
|
47
|
-
.requiredOption('-m, --material-code <code>', 'Material code (required)')
|
|
48
|
-
.requiredOption('--material-uom <code>', 'Material UOM code (required)')
|
|
49
|
-
.requiredOption('--form-uom <code>', 'Form UOM code (required)')
|
|
50
|
-
.option('-d, --stock-date <date>', 'Stock date (YYYY-MM-DD, default: today)')
|
|
51
|
-
.option('-c, --code <code>', 'Transfer-out form code')
|
|
52
|
-
.option('-f, --follower <id>', 'Follower ID')
|
|
53
|
-
.option('--follower-name <name>', 'Follower name')
|
|
54
|
-
.option('-r, --remark <remark>', 'Remark')
|
|
55
|
-
// Item options
|
|
56
|
-
.option('--material-no <no>', 'Material number')
|
|
57
|
-
.option('--material-name <name>', 'Material name')
|
|
58
|
-
.option('--material-type <type>', 'Material type')
|
|
59
|
-
.option('--material-characteristic-code <code>', 'Material characteristic code')
|
|
60
|
-
.option('--color <color>', 'Color')
|
|
61
|
-
.option('--long-x <number>', 'Long X dimension', (val) => parseFloat(val))
|
|
62
|
-
.option('--wide-y <number>', 'Wide Y dimension', (val) => parseFloat(val))
|
|
63
|
-
.option('--high-z <number>', 'High Z dimension', (val) => parseFloat(val))
|
|
64
|
-
.option('-q, --quantity <number>', 'Form quantity (default: 1)', (val) => {
|
|
65
|
-
const n = parseFloat(val);
|
|
66
|
-
if (isNaN(n) || n <= 0) {
|
|
67
|
-
console.error(chalk.red('\nā Error: --quantity must be a positive number\n'));
|
|
68
|
-
process.exit(1);
|
|
69
|
-
}
|
|
70
|
-
return n;
|
|
71
|
-
})
|
|
72
|
-
.option('--stock-qty <qty>', 'Stock quantity (default: same as quantity)', (val) => {
|
|
73
|
-
const n = parseFloat(val);
|
|
74
|
-
if (isNaN(n) || n <= 0) {
|
|
75
|
-
console.error(chalk.red('\nā Error: --stock-qty must be a positive number\n'));
|
|
76
|
-
process.exit(1);
|
|
77
|
-
}
|
|
78
|
-
return n;
|
|
79
|
-
})
|
|
80
|
-
.option('--unit-price <price>', 'Unit price', (val) => parseFloat(val))
|
|
81
|
-
.option('--local-currency <currency>', 'Local currency')
|
|
82
|
-
.option('--stock-amount <amount>', 'Stock amount', (val) => parseFloat(val))
|
|
83
|
-
.option('--lot-no <no>', 'Lot number (single or comma-separated list)')
|
|
84
|
-
.option('--item-remark <remark>', 'Item remark')
|
|
85
|
-
.option('--dry-run', 'Preview mode')
|
|
86
|
-
.option('--json', 'Output as JSON');
|
|
87
|
-
|
|
88
|
-
cmd.action(async () => {
|
|
89
|
-
const context = configManager.getCurrentContext();
|
|
90
|
-
const opts = cmd.opts();
|
|
91
|
-
const environment = context.environment as Environment;
|
|
92
|
-
const tenant = context.tenant;
|
|
93
|
-
const dryRun = opts.dryRun === true;
|
|
94
|
-
const jsonOutput = opts.json === true;
|
|
95
|
-
|
|
96
|
-
// Parse lot numbers
|
|
97
|
-
const lotNoList: string[] = [];
|
|
98
|
-
if (opts.lotNo) {
|
|
99
|
-
if (opts.lotNo.includes(',')) {
|
|
100
|
-
lotNoList.push(...opts.lotNo.split(',').map((s: string) => s.trim()).filter(Boolean));
|
|
101
|
-
} else {
|
|
102
|
-
lotNoList.push(opts.lotNo);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const item: TransferOutFormItemRequest = {
|
|
107
|
-
materialCode: opts.materialCode,
|
|
108
|
-
materialUomCode: opts.materialUom,
|
|
109
|
-
formQuantity: opts.quantity || 1,
|
|
110
|
-
formMaterialUomCode: opts.formUom,
|
|
111
|
-
stockQuantity: opts.stockQty || opts.quantity || 1,
|
|
112
|
-
materialNo: opts.materialNo,
|
|
113
|
-
materialName: opts.materialName,
|
|
114
|
-
materialType: opts.materialType,
|
|
115
|
-
materialCharacteristicCode: opts.materialCharacteristicCode,
|
|
116
|
-
color: opts.color,
|
|
117
|
-
longX: opts.longX,
|
|
118
|
-
wideY: opts.wideY,
|
|
119
|
-
highZ: opts.highZ,
|
|
120
|
-
unitPrice: opts.unitPrice,
|
|
121
|
-
localCurrency: opts.localCurrency,
|
|
122
|
-
stockAmount: opts.stockAmount,
|
|
123
|
-
lotNoList: lotNoList.length > 0 ? lotNoList : undefined,
|
|
124
|
-
remark: opts.itemRemark,
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
const request: CreateTransferOutFormRequest = {
|
|
128
|
-
warehouseCode: opts.warehouseCode,
|
|
129
|
-
stockDate: opts.stockDate || new Date().toISOString().split('T')[0],
|
|
130
|
-
transferOutType: opts.transferOutType,
|
|
131
|
-
transferOutFormCode: opts.code,
|
|
132
|
-
follower: opts.follower,
|
|
133
|
-
followerName: opts.followerName,
|
|
134
|
-
remark: opts.remark,
|
|
135
|
-
itemList: [item],
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
if (dryRun) {
|
|
139
|
-
if (jsonOutput) {
|
|
140
|
-
console.log(JSON.stringify({ success: true, dryRun: true, data: request }));
|
|
141
|
-
} else {
|
|
142
|
-
console.log(chalk.bold('\nš Dry-Run Mode: No changes will be made\n'));
|
|
143
|
-
console.log(' Transfer-out form to be created:');
|
|
144
|
-
console.log(formatTable(request));
|
|
145
|
-
console.log();
|
|
146
|
-
}
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if (!jsonOutput) {
|
|
151
|
-
console.log(chalk.bold('\nš„ Creating Transfer-Out Form\n'));
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const response = await apiClient.createTransferOutForm(environment, tenant, request);
|
|
155
|
-
|
|
156
|
-
if (response.success) {
|
|
157
|
-
if (jsonOutput) {
|
|
158
|
-
console.log(JSON.stringify({ success: true, data: response.data }));
|
|
159
|
-
} else {
|
|
160
|
-
console.log(chalk.green('\nā Transfer-out form created successfully\n'));
|
|
161
|
-
const data = response.data as TransferOutForm | undefined;
|
|
162
|
-
if (data?.transferOutFormCode) {
|
|
163
|
-
console.log(` ${chalk.gray('Form Code:')} ${chalk.green(data.transferOutFormCode)}`);
|
|
164
|
-
}
|
|
165
|
-
if (data?.transferOutFormId) {
|
|
166
|
-
console.log(` ${chalk.gray('Form ID:')} ${data.transferOutFormId}`);
|
|
167
|
-
}
|
|
168
|
-
if (data?.stockDate) {
|
|
169
|
-
console.log(` ${chalk.gray('Stock Date:')} ${data.stockDate}`);
|
|
170
|
-
}
|
|
171
|
-
if (data?.warehouseCode) {
|
|
172
|
-
console.log(` ${chalk.gray('Warehouse:')} ${data.warehouseCode}`);
|
|
173
|
-
}
|
|
174
|
-
if (data?.followerName) {
|
|
175
|
-
console.log(` ${chalk.gray('Follower:')} ${data.followerName}`);
|
|
176
|
-
}
|
|
177
|
-
if (data?.reviewFlag) {
|
|
178
|
-
console.log(` ${chalk.gray('Review Status:')} ${data.reviewFlag}`);
|
|
179
|
-
}
|
|
180
|
-
console.log();
|
|
181
|
-
}
|
|
182
|
-
} else {
|
|
183
|
-
const errMsg = response.error?.message || 'Failed to create';
|
|
184
|
-
if (jsonOutput) {
|
|
185
|
-
console.log(JSON.stringify({ success: false, error: { code: response.error?.code, message: errMsg } }));
|
|
186
|
-
} else {
|
|
187
|
-
console.error(chalk.red(`\nā ${errMsg}\n`));
|
|
188
|
-
}
|
|
189
|
-
process.exit(1);
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
return cmd;
|
|
194
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
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 { Environment } from '../../../types/index.js';
|
|
7
|
-
import { TransferOutForm } from '../../../types/transfer-out-form.js';
|
|
8
|
-
|
|
9
|
-
export function createTransferOutFormGetCommand(): Command {
|
|
10
|
-
const getCommand = new Command('get');
|
|
11
|
-
getCommand.description('Get transfer-out form details by ID');
|
|
12
|
-
getCommand.arguments('<transferOutFormId>');
|
|
13
|
-
getCommand.option('--json', 'Output as JSON');
|
|
14
|
-
|
|
15
|
-
getCommand.action(async (transferOutFormId: string, options: Record<string, unknown>) => {
|
|
16
|
-
const context = configManager.getCurrentContext();
|
|
17
|
-
const environment = (options.env as Environment) || context.environment;
|
|
18
|
-
const tenant = (options.tenant as string) || context.tenant;
|
|
19
|
-
|
|
20
|
-
if (!transferOutFormId || transferOutFormId.trim() === '') {
|
|
21
|
-
console.error(chalk.red('\nā Transfer-out form ID is required\n'));
|
|
22
|
-
process.exit(1);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
const response = await apiClient.getTransferOutForm(environment, tenant, transferOutFormId);
|
|
27
|
-
|
|
28
|
-
if (!response.success) {
|
|
29
|
-
const errorCode = response.error?.code || 'UNKNOWN_ERROR';
|
|
30
|
-
const errorMessage = response.error?.message || 'Unknown error';
|
|
31
|
-
|
|
32
|
-
// Handle "not found" case
|
|
33
|
-
if (errorCode === '01001190001' || errorMessage.includes('äøååØ')) {
|
|
34
|
-
console.error(chalk.red(`\nā Transfer-out form not found: ${transferOutFormId}\n`));
|
|
35
|
-
} else {
|
|
36
|
-
console.error(chalk.red(`\nā Error: ${errorMessage} (${errorCode})\n`));
|
|
37
|
-
}
|
|
38
|
-
process.exit(1);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const form = response.data as TransferOutForm | null;
|
|
42
|
-
|
|
43
|
-
if (!form) {
|
|
44
|
-
console.error(chalk.red('\nā Transfer-out form not found\n'));
|
|
45
|
-
process.exit(1);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (options.json) {
|
|
49
|
-
console.log(JSON.stringify({
|
|
50
|
-
success: true,
|
|
51
|
-
data: form,
|
|
52
|
-
}, null, 2));
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Basic info table
|
|
57
|
-
console.log(chalk.bold('\nš Transfer-Out Form Detail\n'));
|
|
58
|
-
const basicTable = new Table({
|
|
59
|
-
head: [chalk.bold('Field'), chalk.bold('Value')],
|
|
60
|
-
colWidths: [20, 40],
|
|
61
|
-
style: { head: [], border: [] },
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
basicTable.push(
|
|
65
|
-
['Form ID', form.transferOutFormId],
|
|
66
|
-
['Form Code', form.transferOutFormCode],
|
|
67
|
-
['Warehouse', form.warehouseCode],
|
|
68
|
-
['Stock Date', form.stockDate],
|
|
69
|
-
['Type', form.transferOutType],
|
|
70
|
-
['Follower', form.followerName || form.follower || '-'],
|
|
71
|
-
['Review Flag', form.reviewFlag],
|
|
72
|
-
['Reviewer', form.reviewerName || form.reviewer || '-'],
|
|
73
|
-
['Review Time', form.reviewTime || '-'],
|
|
74
|
-
['Stock Sufficient', form.enough ? chalk.green('Yes') : chalk.red('No')],
|
|
75
|
-
['Remark', form.remark || '-']
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
console.log(basicTable.toString());
|
|
79
|
-
|
|
80
|
-
// Items table if present
|
|
81
|
-
if (form.itemList && form.itemList.length > 0) {
|
|
82
|
-
console.log(chalk.bold('\nš¦ Items\n'));
|
|
83
|
-
const itemsTable = new Table({
|
|
84
|
-
head: [chalk.bold('Item ID'), chalk.bold('Material Code'), chalk.bold('Material Name'), chalk.bold('Form Qty'), chalk.bold('Stock Qty'), chalk.bold('UOM')],
|
|
85
|
-
colWidths: [15, 15, 20, 12, 12, 10],
|
|
86
|
-
style: { head: [], border: [] },
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
for (const item of form.itemList) {
|
|
90
|
-
itemsTable.push([
|
|
91
|
-
item.transferOutFormItemId,
|
|
92
|
-
item.materialCode,
|
|
93
|
-
item.materialName || '-',
|
|
94
|
-
item.formQuantity.toString(),
|
|
95
|
-
item.stockQuantity.toString(),
|
|
96
|
-
item.materialUomCode,
|
|
97
|
-
]);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
console.log(itemsTable.toString());
|
|
101
|
-
console.log(chalk.gray(` Total items: ${form.itemList.length}`));
|
|
102
|
-
} else {
|
|
103
|
-
console.log(chalk.gray('\n No items found'));
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
console.log();
|
|
107
|
-
} catch (error) {
|
|
108
|
-
console.error(chalk.red(`\nā Unexpected error: ${error instanceof Error ? error.message : 'Unknown error'}\n`));
|
|
109
|
-
process.exit(1);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
return getCommand;
|
|
114
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { createTransferOutFormListCommand } from './list.js';
|
|
3
|
-
import { createTransferOutFormGetCommand } from './get.js';
|
|
4
|
-
import { createTransferOutFormCreateCommand } from './create.js';
|
|
5
|
-
import { createTransferOutFormUpdateCommand } from './update.js';
|
|
6
|
-
import { createTransferOutFormBatchDeleteCommand } from './batch-delete.js';
|
|
7
|
-
import { createTransferOutFormBatchReviewCommand } from './batch-review.js';
|
|
8
|
-
import { createTransferOutFormBatchUnreviewCommand } from './batch-unreview.js';
|
|
9
|
-
|
|
10
|
-
export function createTransferOutFormsCommand(): Command {
|
|
11
|
-
const transferOutFormsCommand = new Command('transfer-out-forms');
|
|
12
|
-
transferOutFormsCommand.description('Manage transfer-out forms');
|
|
13
|
-
|
|
14
|
-
transferOutFormsCommand.addCommand(createTransferOutFormListCommand());
|
|
15
|
-
transferOutFormsCommand.addCommand(createTransferOutFormGetCommand());
|
|
16
|
-
transferOutFormsCommand.addCommand(createTransferOutFormCreateCommand());
|
|
17
|
-
transferOutFormsCommand.addCommand(createTransferOutFormUpdateCommand());
|
|
18
|
-
transferOutFormsCommand.addCommand(createTransferOutFormBatchDeleteCommand());
|
|
19
|
-
transferOutFormsCommand.addCommand(createTransferOutFormBatchReviewCommand());
|
|
20
|
-
transferOutFormsCommand.addCommand(createTransferOutFormBatchUnreviewCommand());
|
|
21
|
-
|
|
22
|
-
return transferOutFormsCommand;
|
|
23
|
-
}
|
|
@@ -1,125 +0,0 @@
|
|
|
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 { TransferOutFormCompact } from '../../../types/transfer-out-form.js';
|
|
7
|
-
import { Environment } from '../../../types/index.js';
|
|
8
|
-
|
|
9
|
-
export function createTransferOutFormListCommand(): Command {
|
|
10
|
-
const listCommand = new Command('list');
|
|
11
|
-
listCommand.description('List transfer-out forms with pagination');
|
|
12
|
-
|
|
13
|
-
listCommand
|
|
14
|
-
.option('-p, --page <number>', 'Page number', '1')
|
|
15
|
-
.option('-s, --size <number>', 'Page size', '20')
|
|
16
|
-
.option('-c, --code <string>', 'Transfer-out form code')
|
|
17
|
-
.option('-w, --warehouse-code <string>', 'Warehouse code')
|
|
18
|
-
.option('-m, --material-code <string>', 'Material code')
|
|
19
|
-
.option('-n, --material-name <string>', 'Material name (fuzzy)')
|
|
20
|
-
.option('-r, --review-flag <string>', 'Review flag')
|
|
21
|
-
.option('--stock-date-start <string>', 'Stock date start (YYYY-MM-DD)')
|
|
22
|
-
.option('--stock-date-end <string>', 'Stock date end (YYYY-MM-DD)')
|
|
23
|
-
.option('-f, --follower-name <string>', 'Follower name')
|
|
24
|
-
.option('--json', 'Output as JSON')
|
|
25
|
-
.action(async (options) => {
|
|
26
|
-
const context = configManager.getCurrentContext();
|
|
27
|
-
const environment = (options.env as Environment) || context.environment;
|
|
28
|
-
const tenant = options.tenant || context.tenant;
|
|
29
|
-
|
|
30
|
-
const page = parseInt(options.page as string, 10) - 1; // API uses 0-based
|
|
31
|
-
const size = parseInt(options.size as string, 10);
|
|
32
|
-
|
|
33
|
-
const params: Record<string, unknown> = { pageNo: page, pageSize: size };
|
|
34
|
-
if (options.code) params.transferOutFormCode = options.code;
|
|
35
|
-
if (options.warehouseCode) params.warehouseCode = options.warehouseCode;
|
|
36
|
-
if (options.materialCode) params.materialCode = options.materialCode;
|
|
37
|
-
if (options.materialName) params.materialName = options.materialName;
|
|
38
|
-
if (options.reviewFlag) params.reviewFlag = options.reviewFlag;
|
|
39
|
-
if (options.followerName) params.followerName = options.followerName;
|
|
40
|
-
|
|
41
|
-
// Date range handling: if only start or only end, send as stockDate
|
|
42
|
-
if (options.stockDateStart && options.stockDateEnd) {
|
|
43
|
-
params.startDate = options.stockDateStart;
|
|
44
|
-
params.endDate = options.stockDateEnd;
|
|
45
|
-
} else if (options.stockDateStart) {
|
|
46
|
-
params.stockDate = options.stockDateStart;
|
|
47
|
-
} else if (options.stockDateEnd) {
|
|
48
|
-
params.stockDate = options.stockDateEnd;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Note: apiClient type may not include listTransferOutForms due to duplicate definitions
|
|
52
|
-
const response = await (apiClient as any).listTransferOutForms(environment, tenant, params);
|
|
53
|
-
|
|
54
|
-
if (!response.success) {
|
|
55
|
-
console.error(chalk.red(`\nā Failed to list transfer-out forms: ${response.error?.message || 'Unknown error'}`));
|
|
56
|
-
process.exit(1);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const data = response.data;
|
|
60
|
-
if (!data) {
|
|
61
|
-
if (options.json) {
|
|
62
|
-
console.log(JSON.stringify({
|
|
63
|
-
success: true,
|
|
64
|
-
data: {
|
|
65
|
-
items: [],
|
|
66
|
-
pagination: { pageNo: 0, pageSize: size, totalRows: 0 },
|
|
67
|
-
},
|
|
68
|
-
}, null, 2));
|
|
69
|
-
} else {
|
|
70
|
-
console.log(chalk.bold('\nš Transfer-Out Form List\n'));
|
|
71
|
-
console.log(chalk.gray(' No records found\n'));
|
|
72
|
-
}
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (options.json) {
|
|
77
|
-
console.log(JSON.stringify({
|
|
78
|
-
success: true,
|
|
79
|
-
data: {
|
|
80
|
-
items: data.rows || [],
|
|
81
|
-
pagination: {
|
|
82
|
-
pageNo: data.pageNo,
|
|
83
|
-
pageSize: data.pageSize,
|
|
84
|
-
totalRows: data.totalRows,
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
}, null, 2));
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const records = data.rows || [];
|
|
92
|
-
if (records.length === 0) {
|
|
93
|
-
console.log(chalk.bold('\nš Transfer-Out Form List\n'));
|
|
94
|
-
console.log(chalk.gray(' No records found\n'));
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
console.log(chalk.bold('\nš Transfer-Out Form List\n'));
|
|
99
|
-
|
|
100
|
-
const table = new Table({
|
|
101
|
-
head: [chalk.bold('Item ID'), chalk.bold('Form Code'), chalk.bold('Warehouse'), chalk.bold('Material'), chalk.bold('Qty'), chalk.bold('Review'), chalk.bold('Date')],
|
|
102
|
-
colWidths: [20, 15, 12, 20, 10, 10, 12],
|
|
103
|
-
style: { head: [], border: [] },
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
for (const r of records as TransferOutFormCompact[]) {
|
|
107
|
-
table.push([
|
|
108
|
-
r.transferOutFormItemId || '-',
|
|
109
|
-
r.transferOutFormCode || '-',
|
|
110
|
-
r.warehouseCode || '-',
|
|
111
|
-
r.materialName || '-',
|
|
112
|
-
String(r.formQuantity || ''),
|
|
113
|
-
r.reviewFlag === 'REVIEWED' ? chalk.green('Reviewed') : chalk.yellow('Unreviewed'),
|
|
114
|
-
r.stockDate || '-',
|
|
115
|
-
]);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
console.log(table.toString());
|
|
119
|
-
console.log();
|
|
120
|
-
console.log(chalk.gray(` Total: ${data.totalRows} | Page: ${data.pageNo + 1} / ${Math.ceil(data.totalRows / data.pageSize) || 1}`));
|
|
121
|
-
console.log();
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
return listCommand;
|
|
125
|
-
}
|