@newpeak/barista-cli 0.1.8 → 0.1.9

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.
Files changed (61) hide show
  1. package/README.md +10 -10
  2. package/dist/commands/liberica/index.d.ts.map +1 -1
  3. package/dist/commands/liberica/index.js +2 -0
  4. package/dist/commands/liberica/index.js.map +1 -1
  5. package/dist/commands/liberica/materials/create.d.ts.map +1 -1
  6. package/dist/commands/liberica/materials/create.js +13 -6
  7. package/dist/commands/liberica/materials/create.js.map +1 -1
  8. package/dist/commands/liberica/materials/update.js +1 -1
  9. package/dist/commands/liberica/materials/update.js.map +1 -1
  10. package/dist/commands/liberica/mould/get.d.ts +3 -0
  11. package/dist/commands/liberica/mould/get.d.ts.map +1 -0
  12. package/dist/commands/liberica/mould/get.js +90 -0
  13. package/dist/commands/liberica/mould/get.js.map +1 -0
  14. package/dist/commands/liberica/mould/index.d.ts +3 -0
  15. package/dist/commands/liberica/mould/index.d.ts.map +1 -0
  16. package/dist/commands/liberica/mould/index.js +15 -0
  17. package/dist/commands/liberica/mould/index.js.map +1 -0
  18. package/dist/commands/liberica/mould/list.d.ts +3 -0
  19. package/dist/commands/liberica/mould/list.d.ts.map +1 -0
  20. package/dist/commands/liberica/mould/list.js +114 -0
  21. package/dist/commands/liberica/mould/list.js.map +1 -0
  22. package/dist/commands/liberica/mould/set-status.d.ts +3 -0
  23. package/dist/commands/liberica/mould/set-status.d.ts.map +1 -0
  24. package/dist/commands/liberica/mould/set-status.js +84 -0
  25. package/dist/commands/liberica/mould/set-status.js.map +1 -0
  26. package/dist/commands/liberica/mould/stock-in.d.ts +3 -0
  27. package/dist/commands/liberica/mould/stock-in.d.ts.map +1 -0
  28. package/dist/commands/liberica/mould/stock-in.js +160 -0
  29. package/dist/commands/liberica/mould/stock-in.js.map +1 -0
  30. package/dist/core/api/client.d.ts +17 -0
  31. package/dist/core/api/client.d.ts.map +1 -1
  32. package/dist/core/api/client.js +172 -0
  33. package/dist/core/api/client.js.map +1 -1
  34. package/dist/index.js +1 -1
  35. package/dist/types/index.d.ts +2 -0
  36. package/dist/types/index.d.ts.map +1 -1
  37. package/dist/types/material.d.ts +1 -1
  38. package/dist/types/material.d.ts.map +1 -1
  39. package/dist/types/mould-stock-in.d.ts +70 -0
  40. package/dist/types/mould-stock-in.d.ts.map +1 -0
  41. package/dist/types/mould-stock-in.js +3 -0
  42. package/dist/types/mould-stock-in.js.map +1 -0
  43. package/dist/types/mould.d.ts +61 -0
  44. package/dist/types/mould.d.ts.map +1 -0
  45. package/dist/types/mould.js +2 -0
  46. package/dist/types/mould.js.map +1 -0
  47. package/package.json +1 -1
  48. package/src/commands/liberica/index.ts +2 -0
  49. package/src/commands/liberica/materials/create.ts +13 -5
  50. package/src/commands/liberica/materials/update.ts +1 -1
  51. package/src/commands/liberica/mould/get.ts +111 -0
  52. package/src/commands/liberica/mould/index.ts +17 -0
  53. package/src/commands/liberica/mould/list.ts +157 -0
  54. package/src/commands/liberica/mould/set-status.ts +99 -0
  55. package/src/commands/liberica/mould/stock-in.ts +165 -0
  56. package/src/core/api/client.ts +202 -0
  57. package/src/index.ts +1 -1
  58. package/src/types/index.ts +2 -0
  59. package/src/types/material.ts +1 -1
  60. package/src/types/mould-stock-in.ts +82 -0
  61. package/src/types/mould.ts +74 -0
@@ -0,0 +1,165 @@
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 { MouldEntityRegFormRequest } from '../../../types/mould-stock-in.js';
6
+
7
+ function formatTable(data: MouldEntityRegFormRequest): string {
8
+ const lines: string[] = [];
9
+ lines.push(` ${chalk.gray('Form Code:')} ${data.mouldEntityRegFormCode || '(auto)'}`);
10
+ lines.push(` ${chalk.gray('Stock Date:')} ${data.stockDate || '(today)'}`);
11
+ lines.push(` ${chalk.gray('Warehouse:')} ${data.mainWarehouseCode}`);
12
+ lines.push(` ${chalk.gray('Follower:')} ${data.follower}${data.followerName ? ` (${data.followerName})` : ''}`);
13
+ if (data.remark) lines.push(` ${chalk.gray('Remark:')} ${data.remark}`);
14
+
15
+ const item = data.itemList[0];
16
+ if (item) {
17
+ lines.push('');
18
+ lines.push(` ${chalk.gray('Material:')} ${item.materialCode}`);
19
+ if (item.materialName) lines.push(` ${chalk.gray('Material Name:')} ${item.materialName}`);
20
+ if (item.materialNo) lines.push(` ${chalk.gray('Material No:')} ${item.materialNo}`);
21
+ if (item.materialType) lines.push(` ${chalk.gray('Material Type:')} ${item.materialType}`);
22
+ lines.push(` ${chalk.gray('Quantity:')} ${item.formQuantity}`);
23
+ if (item.formMaterialUomCode) lines.push(` ${chalk.gray('Form UOM:')} ${item.formMaterialUomCode}`);
24
+ if (item.producedDate) lines.push(` ${chalk.gray('Produced Date:')} ${item.producedDate}`);
25
+ if (item.mouldType) lines.push(` ${chalk.gray('Mould Type:')} ${item.mouldType}`);
26
+ }
27
+
28
+ return lines.join('\n');
29
+ }
30
+
31
+ export function createMouldStockInCommand(): Command {
32
+ const cmd = new Command('stock-in');
33
+ cmd.description('Create a mould stock-in (入库单) to add mould materials to the entity list');
34
+
35
+ cmd
36
+ .requiredOption('-m, --material-code <code>', 'Material code (required)')
37
+ .requiredOption('-w, --warehouse-code <code>', 'Main warehouse code (required)')
38
+ .requiredOption('-f, --follower <id>', 'Follower (入库人员) ID (required)')
39
+ .option('--follower-name <name>', 'Follower name')
40
+ .option('-q, --quantity <number>', 'Form quantity (default: 1)', (val) => {
41
+ const n = parseInt(val, 10);
42
+ if (isNaN(n) || n <= 0) {
43
+ console.error(chalk.red('\n✗ Error: --quantity must be a positive integer\n'));
44
+ process.exit(1);
45
+ }
46
+ return n;
47
+ })
48
+ .option('--form-uom <code>', 'Form unit of measure code (required)')
49
+ .option('--material-no <no>', 'Material number')
50
+ .option('--material-name <name>', 'Material name')
51
+ .option('--material-type <type>', 'Material type')
52
+ .option('--produced-date <date>', 'Produced date (ISO format YYYY-MM-DD)')
53
+ .option('--mould-type <type>', 'Mould type')
54
+ .option('--remark <remark>', 'Remark / 备注')
55
+ .option('--stock-date <date>', 'Stock-in date (default: today YYYY-MM-DD)')
56
+ .option('--dry-run', 'Preview mode, do not call API')
57
+ .option('--json', 'Output as JSON');
58
+
59
+ cmd.action(async () => {
60
+ const context = configManager.getCurrentContext();
61
+ const opts = cmd.opts();
62
+
63
+ const materialCode = opts.materialCode as string;
64
+ const warehouseCode = opts.warehouseCode as string;
65
+ const follower = opts.follower as string;
66
+ const followerName = opts.followerName as string | undefined;
67
+ const quantity = opts.quantity as number | undefined;
68
+ const formUom = opts.formUom as string | undefined;
69
+ const materialNo = opts.materialNo as string | undefined;
70
+ const materialName = opts.materialName as string | undefined;
71
+ const materialType = opts.materialType as string | undefined;
72
+ const producedDate = opts.producedDate as string | undefined;
73
+ const mouldType = opts.mouldType as string | undefined;
74
+ const remark = opts.remark as string | undefined;
75
+ const stockDate = opts.stockDate as string | undefined;
76
+ const dryRun = opts.dryRun === true;
77
+ const jsonOutput = opts.json === true;
78
+
79
+ const request: MouldEntityRegFormRequest = {
80
+ mouldEntityRegFormCode: '',
81
+ stockDate: stockDate || new Date().toISOString().split('T')[0],
82
+ mainWarehouseCode: warehouseCode,
83
+ follower,
84
+ followerName,
85
+ remark,
86
+ itemList: [
87
+ {
88
+ materialCode,
89
+ materialNo,
90
+ materialName,
91
+ materialType,
92
+ formQuantity: quantity || 1,
93
+ formMaterialUomCode: formUom,
94
+ producedDate,
95
+ mouldType,
96
+ warehouseCode,
97
+ },
98
+ ],
99
+ };
100
+
101
+ if (dryRun) {
102
+ if (jsonOutput) {
103
+ console.log(JSON.stringify({ success: true, dryRun: true, data: request }));
104
+ } else {
105
+ console.log(chalk.bold('\n🔍 Dry-Run Mode: No changes will be made\n'));
106
+ console.log(' Mould stock-in to be created:');
107
+ console.log(formatTable(request));
108
+ console.log();
109
+ }
110
+ return;
111
+ }
112
+
113
+ if (!jsonOutput) {
114
+ console.log(chalk.bold('\n📥 Creating Mould Stock-In\n'));
115
+ }
116
+
117
+ const response = await apiClient.createMouldStockIn(context.environment, context.tenant, request);
118
+
119
+ if (!response.success) {
120
+ const errorMsg = response.error?.message || 'Failed to create stock-in';
121
+ const errorCode = response.error?.code || 'CREATE_MOULD_STOCK_IN_ERROR';
122
+ if (jsonOutput) {
123
+ console.log(JSON.stringify({ success: false, error: { code: errorCode, message: errorMsg } }));
124
+ } else {
125
+ console.error(chalk.red(`\n✗ Failed to create stock-in: ${errorMsg}`));
126
+ if (response.error?.code) {
127
+ console.error(chalk.gray(` Error code: ${response.error.code}`));
128
+ }
129
+ console.error();
130
+ }
131
+ process.exit(1);
132
+ }
133
+
134
+ if (response.success) {
135
+ const data = response.data;
136
+
137
+ if (jsonOutput) {
138
+ console.log(JSON.stringify({ success: true, data }));
139
+ } else {
140
+ console.log(chalk.green('\n✓ Mould stock-in created successfully\n'));
141
+ if (data?.mouldEntityRegFormCode) {
142
+ console.log(` ${chalk.gray('Form Code:')} ${chalk.green(data.mouldEntityRegFormCode)}`);
143
+ }
144
+ if (data?.mouldEntityRegFormId) {
145
+ console.log(` ${chalk.gray('Form ID:')} ${data.mouldEntityRegFormId}`);
146
+ }
147
+ if (data?.stockDate) {
148
+ console.log(` ${chalk.gray('Stock Date:')} ${data.stockDate}`);
149
+ }
150
+ if (data?.mainWarehouseName) {
151
+ console.log(` ${chalk.gray('Warehouse:')} ${data.mainWarehouseName}`);
152
+ }
153
+ if (data?.followerName) {
154
+ console.log(` ${chalk.gray('Follower:')} ${data.followerName}`);
155
+ }
156
+ if (data?.status) {
157
+ console.log(` ${chalk.gray('Status:')} ${data.status}`);
158
+ }
159
+ console.log();
160
+ }
161
+ }
162
+ });
163
+
164
+ return cmd;
165
+ }
@@ -94,6 +94,15 @@ import {
94
94
  CalendarApiResponse,
95
95
  CalendarSetRequest,
96
96
  } from '../../types/calendar.js';
97
+ import {
98
+ MouldEntityQueryParams,
99
+ MouldEntitySetStatusRequest,
100
+ MouldEntityApiResponse,
101
+ } from '../../types/mould.js';
102
+ import {
103
+ MouldEntityRegFormRequest,
104
+ MouldEntityRegFormApiResponse,
105
+ } from '../../types/mould-stock-in.js';
97
106
 
98
107
  export interface LoginResponse {
99
108
  token: string;
@@ -285,6 +294,7 @@ export function createAPIClient(service: Service, environment: Environment, tena
285
294
 
286
295
  const orgCache = new Map<string, { items: OrgListItem[]; timestamp: number }>();
287
296
  const positionCache = new Map<string, { items: PositionListItem[]; timestamp: number }>();
297
+ const dictItemsCache = new Map<string, { items: { dictCode: string; dictName: string }[]; timestamp: number }>();
288
298
  const CACHE_TTL_MS = 5 * 60 * 1000;
289
299
 
290
300
  export const apiClient = {
@@ -766,6 +776,40 @@ const response = await client.getClient().get<DictTypeApiResponse>(
766
776
  }
767
777
  },
768
778
 
779
+ async getDictItems(
780
+ environment: Environment,
781
+ tenant: string,
782
+ dictTypeCode: string
783
+ ): Promise<{ success: boolean; data?: { dictCode: string; dictName: string }[]; error?: { code: string; message: string } }> {
784
+ const cacheKey = `${environment}:${tenant}:${dictTypeCode}`;
785
+ const cached = dictItemsCache.get(cacheKey);
786
+ if (cached && Date.now() - cached.timestamp < CACHE_TTL_MS) {
787
+ return { success: true, data: cached.items };
788
+ }
789
+ try {
790
+ const token = await tokenManager.getToken({ service: 'liberica', environment, tenant });
791
+ if (!token) {
792
+ return { success: false, error: { code: 'NO_TOKEN', message: 'Not logged in' } };
793
+ }
794
+ const client = createAPIClient('liberica' as Service, environment, tenant);
795
+ client.setAuthToken(token);
796
+ const response = await client.getClient().get<{ success: boolean; data?: { dictCode: string; dictName: string }[]; message?: string }>(
797
+ `/api/enterprise/master/dict/list?dictTypeCode=${dictTypeCode}`
798
+ );
799
+ if (response.data?.success && response.data?.data) {
800
+ dictItemsCache.set(cacheKey, { items: response.data.data, timestamp: Date.now() });
801
+ return { success: true, data: response.data.data };
802
+ }
803
+ if (response.data?.success && Array.isArray(response.data?.data)) {
804
+ dictItemsCache.set(cacheKey, { items: response.data.data as any, timestamp: Date.now() });
805
+ return { success: true, data: response.data.data as any };
806
+ }
807
+ return response.data as { success: boolean; data?: { dictCode: string; dictName: string }[]; error?: { code: string; message: string } };
808
+ } catch (error) {
809
+ return handleApiError(error) as { success: boolean; data?: { dictCode: string; dictName: string }[]; error?: { code: string; message: string } };
810
+ }
811
+ },
812
+
769
813
  async getOperationCode(
770
814
  environment: Environment,
771
815
  tenant: string
@@ -1818,6 +1862,125 @@ const response = await client.getClient().get<DictTypeApiResponse>(
1818
1862
  }
1819
1863
  },
1820
1864
 
1865
+ async listMouldEntities(
1866
+ environment: Environment,
1867
+ tenant: string,
1868
+ params: MouldEntityQueryParams
1869
+ ): Promise<MouldEntityApiResponse> {
1870
+ try {
1871
+ const token = await tokenManager.getToken({ service: 'liberica', environment, tenant });
1872
+ if (!token) {
1873
+ return { success: false, error: { code: 'NO_TOKEN', message: 'Not logged in. Run: barista auth login --service liberica --env ' + environment } };
1874
+ }
1875
+ const client = createAPIClient('liberica' as Service, environment, tenant);
1876
+ client.setAuthToken(token);
1877
+ // CLI page 1 → API pageNo 0 (subtract 1)
1878
+ const queryString = new URLSearchParams();
1879
+ if (params.pageNo !== undefined) queryString.append('pageNo', (params.pageNo - 1).toString());
1880
+ if (params.pageSize) queryString.append('pageSize', params.pageSize.toString());
1881
+ if (params.status) queryString.append('status', params.status.toString());
1882
+ if (params.mouldEntityId) queryString.append('mouldEntityId', params.mouldEntityId);
1883
+ if (params.mouldEntityCode) queryString.append('mouldEntityCode', params.mouldEntityCode);
1884
+ if (params.materialCode) queryString.append('materialCode', params.materialCode);
1885
+ if (params.materialNo) queryString.append('materialNo', params.materialNo);
1886
+ if (params.materialName) queryString.append('materialName', params.materialName);
1887
+ if (params.seqNo) queryString.append('seqNo', params.seqNo);
1888
+ if (params.lotNo) queryString.append('lotNo', params.lotNo);
1889
+ if (params.mouldType) queryString.append('mouldType', params.mouldType);
1890
+ if (params.mouldFaceNumber) queryString.append('mouldFaceNumber', params.mouldFaceNumber.toString());
1891
+ if (params.mouldStatus) queryString.append('mouldStatus', params.mouldStatus);
1892
+ if (params.currentWarehouseCode) queryString.append('currentWarehouseCode', params.currentWarehouseCode);
1893
+ const url = `/api/enterprise/manufacture/mouldEntity/page${queryString.toString() ? '?' + queryString.toString() : ''}`;
1894
+ const response = await client.getClient().get<MouldEntityApiResponse>(url);
1895
+ return response.data;
1896
+ } catch (error) {
1897
+ return handleApiErrorMould(error);
1898
+ }
1899
+ },
1900
+
1901
+ async getMouldEntity(
1902
+ environment: Environment,
1903
+ tenant: string,
1904
+ id: string
1905
+ ): Promise<MouldEntityApiResponse> {
1906
+ try {
1907
+ const token = await tokenManager.getToken({ service: 'liberica', environment, tenant });
1908
+ if (!token) {
1909
+ return { success: false, error: { code: 'NO_TOKEN', message: 'Not logged in. Run: barista auth login --service liberica --env ' + environment } };
1910
+ }
1911
+ const client = createAPIClient('liberica' as Service, environment, tenant);
1912
+ client.setAuthToken(token);
1913
+ const response = await client.getClient().post<MouldEntityApiResponse>(
1914
+ '/api/enterprise/manufacture/mouldEntity/detail',
1915
+ { mouldEntityId: id }
1916
+ );
1917
+ return response.data;
1918
+ } catch (error) {
1919
+ return handleApiErrorMould(error);
1920
+ }
1921
+ },
1922
+
1923
+ async setMouldStatus(
1924
+ environment: Environment,
1925
+ tenant: string,
1926
+ request: MouldEntitySetStatusRequest
1927
+ ): Promise<MouldEntityApiResponse> {
1928
+ try {
1929
+ const token = await tokenManager.getToken({ service: 'liberica', environment, tenant });
1930
+ if (!token) {
1931
+ return { success: false, error: { code: 'NO_TOKEN', message: 'Not logged in. Run: barista auth login --service liberica --env ' + environment } };
1932
+ }
1933
+ const client = createAPIClient('liberica' as Service, environment, tenant);
1934
+ client.setAuthToken(token);
1935
+ const response = await client.getClient().post<MouldEntityApiResponse>(
1936
+ '/api/enterprise/manufacture/mouldEntity/setMouldStatus',
1937
+ request
1938
+ );
1939
+ return response.data;
1940
+ } catch (error) {
1941
+ return handleApiErrorMould(error);
1942
+ }
1943
+ },
1944
+
1945
+ async createMouldStockIn(
1946
+ environment: Environment,
1947
+ tenant: string,
1948
+ request: MouldEntityRegFormRequest
1949
+ ): Promise<MouldEntityRegFormApiResponse> {
1950
+ try {
1951
+ const token = await tokenManager.getToken({ service: 'liberica', environment, tenant });
1952
+ if (!token) {
1953
+ return { success: false, error: { code: 'NO_TOKEN', message: 'Not logged in. Run: barista auth login --service liberica --env ' + environment } };
1954
+ }
1955
+
1956
+ const codeResponse = await this.getCodeByType(environment, tenant, 'TenantMouldRegFormCode');
1957
+ if (!codeResponse.success || !codeResponse.data) {
1958
+ return { success: false, error: { code: 'CODE_GENERATION_FAILED', message: codeResponse.error?.message || 'Failed to generate form code' } };
1959
+ }
1960
+ request.mouldEntityRegFormCode = codeResponse.data;
1961
+
1962
+ for (const item of request.itemList) {
1963
+ if (!item.mouldEntityRegFormItemCode) {
1964
+ const itemCodeResponse = await this.getCodeByType(environment, tenant, 'TenantMouldRegFormItemCode');
1965
+ if (!itemCodeResponse.success || !itemCodeResponse.data) {
1966
+ return { success: false, error: { code: 'CODE_GENERATION_FAILED', message: itemCodeResponse.error?.message || 'Failed to generate item code' } };
1967
+ }
1968
+ item.mouldEntityRegFormItemCode = itemCodeResponse.data;
1969
+ }
1970
+ }
1971
+
1972
+ const client = createAPIClient('liberica' as Service, environment, tenant);
1973
+ client.setAuthToken(token);
1974
+ const response = await client.getClient().post<MouldEntityRegFormApiResponse>(
1975
+ '/api/enterprise/manufacture/mouldEntityRegForm/add',
1976
+ request
1977
+ );
1978
+ return response.data;
1979
+ } catch (error) {
1980
+ return handleApiErrorMould(error) as unknown as MouldEntityRegFormApiResponse;
1981
+ }
1982
+ },
1983
+
1821
1984
  async listUoms(
1822
1985
  environment: Environment,
1823
1986
  tenant: string,
@@ -3210,4 +3373,43 @@ function handleApiErrorStock(error: unknown): MasterStockApiResponse {
3210
3373
  message: error instanceof Error ? error.message : 'Unknown error occurred',
3211
3374
  },
3212
3375
  };
3376
+ }
3377
+
3378
+ function handleApiErrorMould(error: unknown): MouldEntityApiResponse {
3379
+ if (axios.isAxiosError(error)) {
3380
+ const axiosError = error as AxiosError<Record<string, unknown>>;
3381
+ const responseData = axiosError.response?.data;
3382
+ if (responseData) {
3383
+ const success = responseData.success as boolean | undefined;
3384
+ if (success === false) {
3385
+ const code = responseData.code as string | undefined;
3386
+ const message = responseData.message as string | undefined;
3387
+ const errorObj = responseData.error as { code?: string; message?: string } | undefined;
3388
+ if (!errorObj && (code || message)) {
3389
+ return {
3390
+ success: false,
3391
+ error: {
3392
+ code: code || 'API_ERROR',
3393
+ message: message || 'API error occurred',
3394
+ },
3395
+ };
3396
+ }
3397
+ }
3398
+ return responseData as unknown as MouldEntityApiResponse;
3399
+ }
3400
+ return {
3401
+ success: false,
3402
+ error: {
3403
+ code: 'NETWORK_ERROR',
3404
+ message: axiosError.message || 'Network error occurred',
3405
+ },
3406
+ };
3407
+ }
3408
+ return {
3409
+ success: false,
3410
+ error: {
3411
+ code: 'UNKNOWN_ERROR',
3412
+ message: error instanceof Error ? error.message : 'Unknown error occurred',
3413
+ },
3414
+ };
3213
3415
  }
package/src/index.ts CHANGED
@@ -15,7 +15,7 @@ async function main(): Promise<void> {
15
15
  program
16
16
  .name('barista')
17
17
  .description('Barista CLI - Bridge between AI agents and Liberica/Arabica')
18
- .version('0.1.8')
18
+ .version('0.1.9')
19
19
  .option('-e, --env <environment>', 'Target environment (dev|test|prod-cn|prod-jp)')
20
20
  .option('-t, --tenant <tenant>', 'Target tenant (for Liberica)')
21
21
  .option('--debug', 'Enable debug mode');
@@ -84,3 +84,5 @@ export type { DictType, DictItem, DictTypeListResponse, DictItemListResponse, Di
84
84
  export type { MasterStockQueryParams, MasterWarehouseStockItem, MasterStockPageResult, MasterStockApiResponse, StockFlag, StockJourneyQueryParams, StockJourneyItem, StockJourneyApiResponse, StockJourneySummary, StockJourneySummaryApiResponse } from './stock.js';
85
85
  export type { ClientContact, CreateClientContactRequest, UpdateClientContactRequest, ClientContactQueryParams, ClientContactListResponse, ClientContactApiResponse } from './client-contact.js';
86
86
  export type { SupplierContact, CreateSupplierContactRequest, UpdateSupplierContactRequest, SupplierContactQueryParams, SupplierContactListResponse, SupplierContactApiResponse } from './supplier-contact.js';
87
+ export type { MouldEntity, MouldEntityQueryParams, MouldEntityListResponse, MouldEntitySetStatusRequest, MouldEntityApiResponse, MouldStatus, MouldStatusFlag } from './mould.js';
88
+ export type { MouldEntityRegFormRequest, MouldEntityRegFormItemRequest, MouldEntityRegFormApiResponse, MouldEntityRegFormData, MouldEntityRegFormItemResponse, MouldEntityRegFormListResponse } from './mould-stock-in.js';
@@ -16,7 +16,7 @@ export interface MaterialRequest {
16
16
  materialName: string;
17
17
  materialClass: string;
18
18
  materialType?: string;
19
- materialUnit?: string;
19
+ materialUomCode?: string;
20
20
  materialCode?: string;
21
21
  materialNo?: string;
22
22
  }
@@ -0,0 +1,82 @@
1
+ // Mould stock-in (入库单) types
2
+
3
+ // Stock-in form item request
4
+ export interface MouldEntityRegFormItemRequest {
5
+ mouldEntityRegFormItemCode?: string;
6
+ materialCode: string;
7
+ materialNo?: string;
8
+ materialName?: string;
9
+ materialType?: string;
10
+ formQuantity: number;
11
+ formMaterialUomCode?: string;
12
+ materialUomCode?: string;
13
+ producedDate?: string;
14
+ mouldType?: string;
15
+ mouldFaceNumber?: number;
16
+ warehouseCode?: string;
17
+ remark?: string;
18
+ }
19
+
20
+ // Stock-in form request
21
+ export interface MouldEntityRegFormRequest {
22
+ mouldEntityRegFormCode: string;
23
+ stockDate?: string;
24
+ mainWarehouseCode: string;
25
+ follower: string;
26
+ followerName?: string;
27
+ remark?: string;
28
+ itemList: MouldEntityRegFormItemRequest[];
29
+ }
30
+
31
+ // API response wrapper for stock-in forms
32
+ export interface MouldEntityRegFormApiResponse {
33
+ success: boolean;
34
+ data?: MouldEntityRegFormData;
35
+ error?: {
36
+ code: string;
37
+ message: string;
38
+ };
39
+ }
40
+
41
+ // Stock-in form data response
42
+ export interface MouldEntityRegFormData {
43
+ mouldEntityRegFormId: string;
44
+ mouldEntityRegFormCode: string;
45
+ stockDate?: string;
46
+ mainWarehouseCode?: string;
47
+ mainWarehouseName?: string;
48
+ follower?: string;
49
+ followerName?: string;
50
+ remark?: string;
51
+ status?: string;
52
+ itemList?: MouldEntityRegFormItemResponse[];
53
+ createdBy?: string;
54
+ createdTime?: string;
55
+ updatedBy?: string;
56
+ updatedTime?: string;
57
+ }
58
+
59
+ // Stock-in form item response
60
+ export interface MouldEntityRegFormItemResponse {
61
+ mouldEntityRegFormItemId: string;
62
+ mouldEntityRegFormId: string;
63
+ materialCode?: string;
64
+ materialNo?: string;
65
+ materialName?: string;
66
+ materialType?: string;
67
+ formQuantity?: number;
68
+ producedDate?: string;
69
+ mouldType?: string;
70
+ mouldFaceNumber?: number;
71
+ warehouseCode?: string;
72
+ warehouseName?: string;
73
+ remark?: string;
74
+ }
75
+
76
+ // List response for stock-in forms
77
+ export interface MouldEntityRegFormListResponse {
78
+ totalRows: number;
79
+ pageSize: number;
80
+ pageNo: number;
81
+ rows: MouldEntityRegFormData[];
82
+ }
@@ -0,0 +1,74 @@
1
+ // Mould status literal type
2
+ export type MouldStatus = 'FINE' | 'REPAIR' | 'SCRAP';
3
+
4
+ // Status flag literal type
5
+ export type MouldStatusFlag = 1 | 2;
6
+
7
+ // Full Mould entity (from MouldEntityResponse)
8
+ export interface MouldEntity {
9
+ mouldEntityId: string;
10
+ mouldEntityCode: string;
11
+ mouldEntityRegFormItemId?: string;
12
+ tenantId?: string;
13
+ materialCode?: string;
14
+ materialNo?: string;
15
+ materialName?: string;
16
+ seqNo?: string;
17
+ lotNo?: string;
18
+ mouldType?: string;
19
+ mouldFaceNumber?: number;
20
+ mouldStatus?: MouldStatus;
21
+ currentWarehouseCode?: string;
22
+ unitPrice?: number;
23
+ currency?: string;
24
+ producedDate?: string;
25
+ lastStockOutTime?: string;
26
+ remark?: string;
27
+ }
28
+
29
+ // Query params for list/pagination
30
+ export interface MouldEntityQueryParams {
31
+ pageNo?: number;
32
+ pageSize?: number;
33
+ status?: MouldStatusFlag;
34
+ mouldEntityId?: string;
35
+ mouldEntityCode?: string;
36
+ materialCode?: string;
37
+ materialNo?: string;
38
+ materialName?: string;
39
+ seqNo?: string;
40
+ lotNo?: string;
41
+ mouldType?: string;
42
+ mouldFaceNumber?: number;
43
+ mouldStatus?: MouldStatus;
44
+ currentWarehouseCode?: string;
45
+ }
46
+
47
+ // Paginated response wrapper (PageResult from Roses framework)
48
+ export interface PageResult<T> {
49
+ totalRows: number;
50
+ pageSize: number;
51
+ pageNo: number;
52
+ rows: T[];
53
+ }
54
+
55
+ // List response type
56
+ export interface MouldEntityListResponse extends PageResult<MouldEntity> {}
57
+
58
+ // Request for setting mould status (set-status API)
59
+ export interface MouldEntitySetStatusRequest {
60
+ mouldEntityId: string;
61
+ tenantId?: string;
62
+ mouldStatus: MouldStatus;
63
+ remark?: string;
64
+ }
65
+
66
+ // API response wrapper
67
+ export interface MouldEntityApiResponse {
68
+ success: boolean;
69
+ data?: MouldEntity | MouldEntityListResponse;
70
+ error?: {
71
+ code: string;
72
+ message: string;
73
+ };
74
+ }