@gandalan/weblibs 1.5.17 → 1.5.19

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 (56) hide show
  1. package/JSDOC.md +661 -0
  2. package/README.md +106 -17
  3. package/api/business/ablageApi.js +106 -0
  4. package/api/business/anpassungApi.js +74 -0
  5. package/api/business/artikelApi.js +242 -0
  6. package/api/business/authApi.js +63 -0
  7. package/api/business/avApi.js +458 -0
  8. package/api/business/belegApi.js +365 -0
  9. package/api/business/belegPositionenApi.js +52 -0
  10. package/api/business/benutzerApi.js +96 -0
  11. package/api/business/fakturaApi.js +88 -0
  12. package/api/business/farbeApi.js +129 -0
  13. package/api/business/fileApi.js +72 -0
  14. package/api/business/historieApi.js +144 -0
  15. package/api/business/index.js +63 -0
  16. package/api/business/kontaktApi.js +70 -0
  17. package/api/business/lagerApi.js +162 -0
  18. package/api/business/lieferungApi.js +127 -0
  19. package/api/business/mailApi.js +41 -0
  20. package/api/business/mandantApi.js +137 -0
  21. package/api/business/materialApi.js +37 -0
  22. package/api/business/printApi.js +49 -0
  23. package/api/business/produktionApi.js +141 -0
  24. package/api/business/rechnungApi.js +155 -0
  25. package/api/business/serienApi.js +375 -0
  26. package/api/business/settingsApi.js +168 -0
  27. package/api/business/systemApi.js +209 -0
  28. package/api/business/uiApi.js +256 -0
  29. package/api/business/utilityApi.js +288 -0
  30. package/api/business/vorgangApi.js +128 -0
  31. package/api/dtos/allgemein.js +107 -0
  32. package/api/dtos/artikel.js +46 -0
  33. package/api/dtos/av.js +171 -0
  34. package/api/dtos/belege.js +614 -0
  35. package/api/dtos/benutzer.js +101 -0
  36. package/api/dtos/druck.js +50 -0
  37. package/api/dtos/faktura.js +128 -0
  38. package/api/dtos/farben.js +93 -0
  39. package/api/dtos/index.js +501 -0
  40. package/api/dtos/kunden.js +217 -0
  41. package/api/dtos/lager.js +66 -0
  42. package/api/dtos/mail.js +30 -0
  43. package/api/dtos/mandanten.js +60 -0
  44. package/api/dtos/nachrichten.js +18 -0
  45. package/api/dtos/produktGruppen.js +18 -0
  46. package/api/dtos/produktion.js +564 -0
  47. package/api/dtos/settings.js +172 -0
  48. package/api/dtos/technik.js +163 -0
  49. package/api/dtos/ui.js +496 -0
  50. package/api/dtos/webjob.js +12 -0
  51. package/api/fluentApi.js +10 -8
  52. package/api/fluentAuthManager.js +22 -14
  53. package/api/fluentRestClient.js +7 -7
  54. package/api/idasFluentApi.js +458 -0
  55. package/index.js +53 -6
  56. package/package.json +1 -1
@@ -0,0 +1,129 @@
1
+ /**
2
+ * @typedef {import('../fluentApi.js').FluentApi} FluentApi
3
+ * @typedef {import('../dtos/index.js').FarbeDTO} FarbeDTO
4
+ * @typedef {import('../dtos/index.js').FarbGruppeDTO} FarbGruppeDTO
5
+ * @typedef {import('../dtos/index.js').OberflaecheDTO} OberflaecheDTO
6
+ * @typedef {import('../dtos/index.js').FarbKuerzelDTO} FarbKuerzelDTO
7
+ * @typedef {import('../dtos/index.js').FarbKuerzelGruppeDTO} FarbKuerzelGruppeDTO
8
+ * @typedef {import('../dtos/index.js').FarbgruppenaufpreiseDTO} FarbgruppenaufpreiseDTO
9
+ * @typedef {import('../dtos/index.js').ProduzentenFarbGruppeDTO} ProduzentenFarbGruppeDTO
10
+ */
11
+
12
+ /**
13
+ * Farbe API - Color management
14
+ * @param {FluentApi} fluentApi
15
+ */
16
+ export function createFarbeApi(fluentApi) {
17
+ return {
18
+ // FarbenWebRoutinen
19
+ /**
20
+ * Get all colors
21
+ * @returns {Promise<FarbeDTO[]>}
22
+ */
23
+ getAllFarben: () => fluentApi.get("Farben"),
24
+
25
+ /**
26
+ * Save color
27
+ * @param {FarbeDTO} dto
28
+ * @returns {Promise<void>}
29
+ */
30
+ saveFarbe: (dto) => fluentApi.put(`Farben/${dto.farbItemGuid}`, dto),
31
+
32
+ // OberflaechenWebRoutinen
33
+ /**
34
+ * Get all surfaces
35
+ * @returns {Promise<OberflaecheDTO[]>}
36
+ */
37
+ getAllOberflaechen: () => fluentApi.get("Oberflaeche"),
38
+
39
+ /**
40
+ * Save surface
41
+ * @param {OberflaecheDTO} dto
42
+ * @returns {Promise<void>}
43
+ */
44
+ saveOberflaeche: (dto) => fluentApi.put(`Oberflaeche/${dto.oberflaecheGuid}`, dto),
45
+
46
+ // FarbGruppenWebRoutinen
47
+ /**
48
+ * Get all color groups
49
+ * @returns {Promise<FarbGruppeDTO[]>}
50
+ */
51
+ getAllFarbGruppen: () => fluentApi.get("FarbGruppen"),
52
+
53
+ /**
54
+ * Save color group
55
+ * @param {FarbGruppeDTO} dto
56
+ * @returns {Promise<void>}
57
+ */
58
+ saveFarbGruppe: (dto) => fluentApi.put(`FarbGruppen/${dto.farbItemGroupGuid}`, dto),
59
+
60
+ // FarbKuerzelWebRoutinen
61
+ /**
62
+ * Get all color codes
63
+ * @returns {Promise<FarbKuerzelDTO[]>}
64
+ */
65
+ getAllFarbKuerzel: () => fluentApi.get("FarbKuerzel"),
66
+
67
+ /**
68
+ * Save color code
69
+ * @param {FarbKuerzelDTO} dto
70
+ * @returns {Promise<void>}
71
+ */
72
+ saveFarbKuerzel: (dto) => fluentApi.put(`FarbKuerzel/${dto.farbKuerzelGuid}`, dto),
73
+
74
+ // FarbKuerzelGruppenWebRoutinen
75
+ /**
76
+ * Get all color code groups
77
+ * @returns {Promise<FarbKuerzelGruppeDTO[]>}
78
+ */
79
+ getAllFarbKuerzelGruppen: () => fluentApi.get("FarbKuerzelGruppe"),
80
+
81
+ /**
82
+ * Save color code group
83
+ * @param {FarbKuerzelGruppeDTO} dto
84
+ * @returns {Promise<void>}
85
+ */
86
+ saveFarbKuerzelGruppe: (dto) => fluentApi.put("FarbKuerzelGruppe/", dto),
87
+
88
+ // FarbgruppenaufpreisWebRoutinen
89
+ /**
90
+ * Get color group surcharges
91
+ * @returns {Promise<FarbgruppenaufpreiseDTO[]>}
92
+ */
93
+ getFarbgruppenaufpreise: () => fluentApi.get("Farbgruppenaufpreis"),
94
+
95
+ /**
96
+ * Save color group surcharge
97
+ * @param {FarbgruppenaufpreiseDTO} dto
98
+ * @returns {Promise<void>}
99
+ */
100
+ saveFarbgruppenaufpreise: (dto) => fluentApi.put("Farbgruppenaufpreis", dto),
101
+
102
+ // ProduzentenFarbGruppenWebRoutinen
103
+ /**
104
+ * Get all producer color groups
105
+ * @returns {Promise<ProduzentenFarbGruppeDTO[]>}
106
+ */
107
+ getAllProduzentenFarbGruppen: () => fluentApi.get("ProduzentenFarbGruppen"),
108
+
109
+ /**
110
+ * Save producer color group
111
+ * @param {ProduzentenFarbGruppeDTO} dto
112
+ * @returns {Promise<void>}
113
+ */
114
+ saveProduzentenFarbGruppe: (dto) =>
115
+ fluentApi.put(`ProduzentenFarbGruppen/${dto.produzentenFarbGruppeGuid}`, dto),
116
+
117
+ /**
118
+ * Delete producer color group
119
+ * @param {string} produzentenFarbGruppeGuid
120
+ * @returns {Promise<void>}
121
+ */
122
+ deleteProduzentenFarbGruppe: (produzentenFarbGruppeGuid) =>
123
+ fluentApi.delete(`ProduzentenFarbGruppen/${produzentenFarbGruppeGuid}`),
124
+ };
125
+ }
126
+
127
+ /**
128
+ * @typedef {ReturnType<typeof createFarbeApi>} FarbeApi
129
+ */
@@ -0,0 +1,72 @@
1
+ /**
2
+ * @typedef {import('../fluentApi.js').FluentApi} FluentApi
3
+ * @typedef {import('../dtos/index.js').FileInfoDTO} FileInfoDTO
4
+ */
5
+
6
+ /**
7
+ * File API - File management and storage
8
+ * @param {FluentApi} fluentApi
9
+ */
10
+ export function createFileApi(fluentApi) {
11
+ return {
12
+ // FileWebRoutinen
13
+ /**
14
+ * Get file by name
15
+ * @param {string} name
16
+ * @returns {Promise<Uint8Array>}
17
+ */
18
+ get: (name) => fluentApi.get(`StaticFile/?name=${name}`),
19
+
20
+ /**
21
+ * Get file list
22
+ * @returns {Promise<FileInfoDTO[]>}
23
+ */
24
+ getList: () => fluentApi.get("StaticFile"),
25
+
26
+ /**
27
+ * Get files as zip
28
+ * @param {string[]} fileNames
29
+ * @returns {Promise<Uint8Array>}
30
+ */
31
+ getZipped: (fileNames) => fluentApi.put("StaticFile", fileNames),
32
+
33
+ // DataFileWebRoutinen
34
+ data: {
35
+ /**
36
+ * Get data file
37
+ * @param {string} filename
38
+ * @returns {Promise<Uint8Array>}
39
+ */
40
+ get: (filename) => fluentApi.get(`DataFile/?filename=${filename}`),
41
+
42
+ /**
43
+ * Get data file list
44
+ * @param {string} [directory='/']
45
+ * @returns {Promise<FileInfoDTO[]>}
46
+ */
47
+ getList: (directory = "/") =>
48
+ fluentApi.get(`DataFile/?subdir=${encodeURIComponent(directory)}`),
49
+
50
+ /**
51
+ * Save data file
52
+ * @param {string} fileName
53
+ * @param {Uint8Array} data
54
+ * @returns {Promise<void>}
55
+ */
56
+ save: (fileName, data) =>
57
+ fluentApi.put(`DataFile/?filename=${fileName}`, data),
58
+
59
+ /**
60
+ * Delete data file
61
+ * @param {string} filename
62
+ * @returns {Promise<void>}
63
+ */
64
+ delete: (filename) =>
65
+ fluentApi.delete(`DataFile/?filename=${filename}`),
66
+ },
67
+ };
68
+ }
69
+
70
+ /**
71
+ * @typedef {ReturnType<typeof createFileApi>} FileApi
72
+ */
@@ -0,0 +1,144 @@
1
+ /**
2
+ * @typedef {import('../fluentApi.js').FluentApi} FluentApi
3
+ * @typedef {import('../dtos/belege.js').VorgangHistorienDTO} VorgangHistorienDTO
4
+ * @typedef {import('../dtos/belege.js').BelegHistorienDTO} BelegHistorienDTO
5
+ * @typedef {import('../dtos/belege.js').BelegPositionHistorienDTO} BelegPositionHistorienDTO
6
+ * @typedef {import('../dtos/belege.js').VorgangHistorieDTO} VorgangHistorieDTO
7
+ * @typedef {import('../dtos/belege.js').BelegHistorieDTO} BelegHistorieDTO
8
+ * @typedef {import('../dtos/belege.js').BelegPositionHistorieDTO} BelegPositionHistorieDTO
9
+ * @typedef {import('../dtos/index.js').SerieHistorieDTO} SerieHistorieDTO
10
+ */
11
+
12
+ /**
13
+ * Historie API - History tracking and management
14
+ * @param {FluentApi} fluentApi
15
+ */
16
+ export function createHistorieApi(fluentApi) {
17
+ return {
18
+ // HistorieWebRoutinen
19
+ /**
20
+ * Get vorgang history
21
+ * @param {string} vorgangGuid
22
+ * @param {boolean} [includeBelege=false]
23
+ * @param {boolean} [includePositionen=false]
24
+ * @returns {Promise<VorgangHistorienDTO>}
25
+ */
26
+ getVorgangHistorie: (vorgangGuid, includeBelege = false, includePositionen = false) =>
27
+ fluentApi.get(`HistorieVorgang?vorgangGuid=${vorgangGuid}&includeBelege=${includeBelege}&includePositionen=${includePositionen}`),
28
+
29
+ /**
30
+ * Get beleg history
31
+ * @param {string} belegGuid
32
+ * @param {boolean} [includePositionen=false]
33
+ * @returns {Promise<BelegHistorienDTO>}
34
+ */
35
+ getBelegHistorie: (belegGuid, includePositionen = false) =>
36
+ fluentApi.get(`HistorieBeleg?belegGuid=${belegGuid}&includePositionen=${includePositionen}`),
37
+
38
+ /**
39
+ * Get beleg position history
40
+ * @param {string} positionGuid
41
+ * @returns {Promise<BelegPositionHistorienDTO>}
42
+ */
43
+ getBelegPositionHistorie: (positionGuid) =>
44
+ fluentApi.get(`HistorieBelegPosition?positionGuid=${positionGuid}`),
45
+
46
+ /**
47
+ * Get serie history since date
48
+ * @param {Date} sinceWhen
49
+ * @returns {Promise<SerieHistorieDTO[]>}
50
+ */
51
+ getSerieHistorieSince: (sinceWhen) =>
52
+ fluentApi.get(`HistorieSerie?createdSince=${sinceWhen.toISOString()}`),
53
+
54
+ /**
55
+ * Get serie history by GUID
56
+ * @param {string} serieGuid
57
+ * @returns {Promise<SerieHistorieDTO[]>}
58
+ */
59
+ getSerieHistorie: (serieGuid) => fluentApi.get(`HistorieSerie?serieGuid=${serieGuid}`),
60
+
61
+ /**
62
+ * Add vorgang history
63
+ * @param {string} vorgangGuid
64
+ * @param {VorgangHistorieDTO} historyDto
65
+ * @returns {Promise<void>}
66
+ */
67
+ addVorgangHistorie: (vorgangGuid, historyDto) =>
68
+ fluentApi.post(`HistorieVorgang?vorgangGuid=${vorgangGuid}`, historyDto),
69
+
70
+ /**
71
+ * Add beleg history
72
+ * @param {string} belegGuid
73
+ * @param {BelegHistorieDTO} historyDto
74
+ * @returns {Promise<void>}
75
+ */
76
+ addBelegHistorie: (belegGuid, historyDto) =>
77
+ fluentApi.post(`HistorieBeleg?belegGuid=${belegGuid}`, historyDto),
78
+
79
+ /**
80
+ * Add beleg position history
81
+ * @param {string} positionGuid
82
+ * @param {BelegPositionHistorieDTO} historyDto
83
+ * @returns {Promise<void>}
84
+ */
85
+ addBelegPositionHistorie: (positionGuid, historyDto) =>
86
+ fluentApi.post(`HistorieBelegPosition?positionGuid=${positionGuid}`, historyDto),
87
+
88
+ /**
89
+ * Add serie history
90
+ * @param {SerieHistorieDTO} historyDto
91
+ * @returns {Promise<void>}
92
+ */
93
+ addSerieHistorie: (historyDto) => fluentApi.post("HistorieSerie", historyDto),
94
+
95
+ /**
96
+ * Add vorgang history from function
97
+ * @param {string} vorgangGuid
98
+ * @param {VorgangHistorieDTO} historyDto
99
+ * @param {number} mandantID
100
+ * @returns {Promise<void>}
101
+ */
102
+ addVorgangHistorieFromFunction: (vorgangGuid, historyDto, mandantID) =>
103
+ fluentApi.post(`AddVorgangHistorieFromFunction?vorgangGuid=${vorgangGuid}&mandantID=${mandantID}`, historyDto),
104
+
105
+ /**
106
+ * Add beleg position history from function
107
+ * @param {string} positionGuid
108
+ * @param {BelegPositionHistorieDTO} historyDto
109
+ * @param {number} mandantID
110
+ * @returns {Promise<void>}
111
+ */
112
+ addBelegPositionHistorieFromFunction: (positionGuid, historyDto, mandantID) =>
113
+ fluentApi.post(`AddBelegPositionHistorieFromFunction?positionGuid=${positionGuid}&mandantID=${mandantID}`, historyDto),
114
+
115
+ /**
116
+ * Add serie history from function
117
+ * @param {SerieHistorieDTO} historyDto
118
+ * @param {number} mandantID
119
+ * @returns {Promise<void>}
120
+ */
121
+ addSerieHistorieFromFunction: (historyDto, mandantID) =>
122
+ fluentApi.post(`AddBelegPositionHistorieFromFunction?mandantID=${mandantID}`, historyDto),
123
+
124
+ /**
125
+ * Get last editor for beleg
126
+ * @param {string} belegGuid
127
+ * @returns {Promise<string>}
128
+ */
129
+ getLetzterBearbeiter: (belegGuid) =>
130
+ fluentApi.get(`HistorieBeleg/LetzterBearbeiter?belegGuid=${belegGuid}`),
131
+
132
+ /**
133
+ * Get last editors for belege
134
+ * @param {string[]} belegGuids
135
+ * @returns {Promise<Record<string, string>>}
136
+ */
137
+ getLetzteBearbeiter: (belegGuids) =>
138
+ fluentApi.post("HistorieBeleg/LetzteBearbeiter", belegGuids),
139
+ };
140
+ }
141
+
142
+ /**
143
+ * @typedef {ReturnType<typeof createHistorieApi>} HistorieApi
144
+ */
@@ -0,0 +1,63 @@
1
+ // Business Routines API Exports
2
+ // Auto-generated from C# Gandalan.IDAS.WebApi.Client BusinessRoutinen
3
+
4
+ export { createVorgangApi } from "./vorgangApi.js";
5
+ export { createKontaktApi } from "./kontaktApi.js";
6
+ export { createBelegPositionenApi } from "./belegPositionenApi.js";
7
+ export { createMaterialApi } from "./materialApi.js";
8
+ export { createSerienApi } from "./serienApi.js";
9
+ export { createBenutzerApi } from "./benutzerApi.js";
10
+ export { createArtikelApi } from "./artikelApi.js";
11
+ export { createBelegApi } from "./belegApi.js";
12
+ export { createProduktionApi } from "./produktionApi.js";
13
+ export { createFakturaApi } from "./fakturaApi.js";
14
+ export { createSettingsApi } from "./settingsApi.js";
15
+ export { createUiApi } from "./uiApi.js";
16
+ export { createUtilityApi } from "./utilityApi.js";
17
+
18
+ // New API exports
19
+ export { createAblageApi } from "./ablageApi.js";
20
+ export { createAvApi } from "./avApi.js";
21
+ export { createFarbeApi } from "./farbeApi.js";
22
+ export { createLagerApi } from "./lagerApi.js";
23
+ export { createLieferungApi } from "./lieferungApi.js";
24
+ export { createMandantApi } from "./mandantApi.js";
25
+ export { createPrintApi } from "./printApi.js";
26
+ export { createHistorieApi } from "./historieApi.js";
27
+ export { createSystemApi } from "./systemApi.js";
28
+ export { createFileApi } from "./fileApi.js";
29
+ export { createMailApi } from "./mailApi.js";
30
+ export { createAnpassungApi } from "./anpassungApi.js";
31
+ export { createAuthApi } from "./authApi.js";
32
+ export { createRechnungApi } from "./rechnungApi.js";
33
+
34
+ // Type exports for JSDoc
35
+ /** @typedef {import('./vorgangApi.js').VorgangApi} VorgangApi */
36
+ /** @typedef {import('./kontaktApi.js').KontaktApi} KontaktApi */
37
+ /** @typedef {import('./belegPositionenApi.js').BelegPositionenApi} BelegPositionenApi */
38
+ /** @typedef {import('./materialApi.js').MaterialApi} MaterialApi */
39
+ /** @typedef {import('./serienApi.js').SerienApi} SerienApi */
40
+ /** @typedef {import('./benutzerApi.js').BenutzerApi} BenutzerApi */
41
+ /** @typedef {import('./artikelApi.js').ArtikelApi} ArtikelApi */
42
+ /** @typedef {import('./belegApi.js').BelegApi} BelegApi */
43
+ /** @typedef {import('./produktionApi.js').ProduktionApi} ProduktionApi */
44
+ /** @typedef {import('./fakturaApi.js').FakturaApi} FakturaApi */
45
+ /** @typedef {import('./settingsApi.js').SettingsApi} SettingsApi */
46
+ /** @typedef {import('./uiApi.js').UiApi} UiApi */
47
+ /** @typedef {import('./utilityApi.js').UtilityApi} UtilityApi */
48
+ /** @typedef {import('./ablageApi.js').AblageApi} AblageApi */
49
+ /** @typedef {import('./avApi.js').AvApi} AvApi */
50
+ /** @typedef {import('./farbeApi.js').FarbeApi} FarbeApi */
51
+ /** @typedef {import('./lagerApi.js').LagerApi} LagerApi */
52
+ /** @typedef {import('./lieferungApi.js').LieferungApi} LieferungApi */
53
+ /** @typedef {import('./mandantApi.js').MandantApi} MandantApi */
54
+ /** @typedef {import('./printApi.js').PrintApi} PrintApi */
55
+ /** @typedef {import('./historieApi.js').HistorieApi} HistorieApi */
56
+ /** @typedef {import('./systemApi.js').SystemApi} SystemApi */
57
+ /** @typedef {import('./fileApi.js').FileApi} FileApi */
58
+ /** @typedef {import('./mailApi.js').MailApi} MailApi */
59
+ /** @typedef {import('./anpassungApi.js').AnpassungApi} AnpassungApi */
60
+ /** @typedef {import('./authApi.js').AuthApi} AuthApi */
61
+ /** @typedef {import('./rechnungApi.js').RechnungApi} RechnungApi */
62
+
63
+ export {};
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @typedef {import('../dtos/kunden.js').KontaktListItemDTO} KontaktListItemDTO
3
+ * @typedef {import('../dtos/kunden.js').KontaktDTO} KontaktDTO
4
+ */
5
+
6
+ /**
7
+ * @typedef {Object} KontaktApi
8
+ * @property {(ohneEndkunden?: boolean, includeASP?: boolean, includeAdditionalProperties?: boolean) => Promise<KontaktListItemDTO[]>} getList - Get list of all contacts
9
+ * @property {(changedSince?: Date|null, ohneEndkunden?: boolean, includeASP?: boolean, includeAdditionalProperties?: boolean) => Promise<KontaktListItemDTO[]>} getListChangedSince - Get list of contacts changed since a specific date
10
+ * @property {(kontaktGuid: string) => Promise<KontaktDTO>} getByGuid - Get contact by GUID
11
+ * @property {(kundenNummer: string) => Promise<KontaktDTO>} getByKundenNummer - Get contact by customer number
12
+ * @property {(kontakt: KontaktDTO) => Promise<KontaktDTO>} save - Save a contact
13
+ * @property {(kontakteIds: string[]) => Promise<void>} archive - Archive multiple contacts
14
+ * @property {(kontakteIds: string[]) => Promise<void>} unarchive - Unarchive multiple contacts
15
+ * @property {(guidMapping: Record<string, string>) => Promise<void>} setFremdfertigungGuid - Set Fremdfertigung GUID mapping
16
+ * @property {(kontaktGuid: string, mandantId: number) => Promise<KontaktDTO>} getForFunction - Get contact for function
17
+ * @property {(changedSince?: Date|null) => Promise<Record<number, string[]>>} getAllForFunction - Get all contacts for function
18
+ */
19
+
20
+ /**
21
+ * @param {import("../fluentApi.js").FluentApi} fluentApi
22
+ * @returns {KontaktApi}
23
+ */
24
+ export function createKontaktApi(fluentApi) {
25
+ return {
26
+ async getList(ohneEndkunden = false, includeASP = true, includeAdditionalProperties = true) {
27
+ return await fluentApi.get(`Kontakt?ohneEndkunden=${ohneEndkunden}&includeASP=${includeASP}&includeAdditionalProperties=${includeAdditionalProperties}`);
28
+ },
29
+
30
+ async getListChangedSince(changedSince = null, ohneEndkunden = false, includeASP = true, includeAdditionalProperties = true) {
31
+ if (changedSince && changedSince > new Date(0)) {
32
+ return await fluentApi.get(`Kontakt?changedSince=${changedSince.toISOString()}&ohneEndkunden=${ohneEndkunden}&includeASP=${includeASP}&includeAdditionalProperties=${includeAdditionalProperties}`);
33
+ }
34
+ return await fluentApi.get(`Kontakt?ohneEndkunden=${ohneEndkunden}&includeASP=${includeASP}&includeAdditionalProperties=${includeAdditionalProperties}`);
35
+ },
36
+
37
+ async getByGuid(kontaktGuid) {
38
+ return await fluentApi.get(`Kontakt/${kontaktGuid}`);
39
+ },
40
+
41
+ async getByKundenNummer(kundenNummer) {
42
+ return await fluentApi.get(`Kontakt/GetByKundenNummer?kundennummer=${kundenNummer}`);
43
+ },
44
+
45
+ async save(kontakt) {
46
+ return await fluentApi.put("Kontakt", kontakt);
47
+ },
48
+
49
+ async archive(kontakteIds) {
50
+ return await fluentApi.put("kontakt/archivieren", kontakteIds);
51
+ },
52
+
53
+ async unarchive(kontakteIds) {
54
+ return await fluentApi.put("kontakt/entarchivieren", kontakteIds);
55
+ },
56
+
57
+ async setFremdfertigungGuid(guidMapping) {
58
+ return await fluentApi.put("Kontakt/SetFremdfertigungGuid", guidMapping);
59
+ },
60
+
61
+ async getForFunction(kontaktGuid, mandantId) {
62
+ return await fluentApi.get(`GetKontaktForFunction?id=${kontaktGuid}&mandantId=${mandantId}`);
63
+ },
64
+
65
+ async getAllForFunction(changedSince = null) {
66
+ const isoString = changedSince ? changedSince.toISOString() : "";
67
+ return await fluentApi.get(`GetAllKontakteForFunction?changedSince=${isoString}`);
68
+ }
69
+ };
70
+ }
@@ -0,0 +1,162 @@
1
+ /**
2
+ * @typedef {import('../fluentApi.js').FluentApi} FluentApi
3
+ * @typedef {import('../dtos/produktion.js').LagerbestandDTO} LagerbestandDTO
4
+ * @typedef {import('../dtos/produktion.js').LagerbuchungDTO} LagerbuchungDTO
5
+ * @typedef {import('../dtos/produktion.js').LagerReservierungDTO} LagerReservierungDTO
6
+ */
7
+
8
+ /**
9
+ * Lager API - Warehouse/inventory management
10
+ * @param {FluentApi} fluentApi
11
+ */
12
+ export function createLagerApi(fluentApi) {
13
+ return {
14
+ // LagerbestandWebRoutinen
15
+ /**
16
+ * Get inventory by GUID
17
+ * @param {string} guid
18
+ * @returns {Promise<LagerbestandDTO>}
19
+ */
20
+ get: (guid) => fluentApi.get(`Lagerbestand/?id=${guid}`),
21
+
22
+ /**
23
+ * Get inventory from GUID list
24
+ * @param {string[]} guids
25
+ * @returns {Promise<LagerbestandDTO[]>}
26
+ */
27
+ getFromGuidList: (guids) =>
28
+ fluentApi.post("Lagerbestand/GetFromGuidList", guids),
29
+
30
+ /**
31
+ * Get all inventory
32
+ * @param {Date} [changedSince]
33
+ * @returns {Promise<LagerbestandDTO[]>}
34
+ */
35
+ getAll: (changedSince) => {
36
+ if (changedSince) {
37
+ return fluentApi.get(`Lagerbestand?changedSince=${changedSince.toISOString()}`);
38
+ }
39
+ return fluentApi.get("Lagerbestand");
40
+ },
41
+
42
+ /**
43
+ * Get inventory below minimum stock
44
+ * @returns {Promise<LagerbestandDTO[]>}
45
+ */
46
+ getUnterschreitungEisernerBestand: () =>
47
+ fluentApi.get("Lagerbestand/UnterschreitungEisernerBestand"),
48
+
49
+ /**
50
+ * Book inventory
51
+ * @param {LagerbuchungDTO} buchung
52
+ * @returns {Promise<LagerbestandDTO>}
53
+ */
54
+ buchung: (buchung) => fluentApi.put("Lagerbuchung", buchung),
55
+
56
+ /**
57
+ * Book multiple inventory items
58
+ * @param {LagerbuchungDTO[]} buchungen
59
+ * @returns {Promise<LagerbestandDTO[]>}
60
+ */
61
+ buchungListe: (buchungen) =>
62
+ fluentApi.put("Lagerbuchung/PutBuchungListe", buchungen),
63
+
64
+ /**
65
+ * Save inventory
66
+ * @param {LagerbestandDTO} dto
67
+ * @returns {Promise<void>}
68
+ */
69
+ save: (dto) => fluentApi.put("Lagerbestand/", dto),
70
+
71
+ /**
72
+ * Save inventory list
73
+ * @param {LagerbestandDTO[]} dtos
74
+ * @returns {Promise<string[]>}
75
+ */
76
+ saveListe: (dtos) =>
77
+ fluentApi.put("Lagerbestand/PutLagerbestandListe", dtos),
78
+
79
+ /**
80
+ * Delete inventory
81
+ * @param {string} guid
82
+ * @returns {Promise<void>}
83
+ */
84
+ delete: (guid) => fluentApi.delete(`Lagerbestand/?id=${guid}`),
85
+
86
+ /**
87
+ * Get inventory history
88
+ * @param {Date} vonDatum
89
+ * @param {Date} bisDatum
90
+ * @param {boolean} [mitLagerbuchungen=true]
91
+ * @param {boolean} [mitReservierungen=true]
92
+ * @param {string} [katalogArtikelGuid]
93
+ * @returns {Promise<LagerbuchungDTO[]>}
94
+ */
95
+ getHistorie: (vonDatum, bisDatum, mitLagerbuchungen = true, mitReservierungen = true, katalogArtikelGuid) => {
96
+ const url = `Lagerbuchung/?vonDatum=${vonDatum.toISOString()}&bisDatum=${bisDatum.toISOString()}&mitLagerbuchungen=${mitLagerbuchungen}&mitReservierungen=${mitReservierungen}&katalogArtikelGuid=${katalogArtikelGuid || ""}`;
97
+ return fluentApi.get(url);
98
+ },
99
+
100
+ // LagerReservierungen
101
+ reservierung: {
102
+ /**
103
+ * Get reservation by GUID
104
+ * @param {string} guid
105
+ * @returns {Promise<LagerReservierungDTO>}
106
+ */
107
+ get: (guid) => fluentApi.get(`LagerReservierungen/?id=${guid}`),
108
+
109
+ /**
110
+ * Get all reservations
111
+ * @param {string} [artikelnummer]
112
+ * @param {string} [farbkuerzel]
113
+ * @param {string} [farbcode]
114
+ * @param {string} [bezug]
115
+ * @param {string} [oberflaeche]
116
+ * @param {Date} [changedSince]
117
+ * @returns {Promise<LagerReservierungDTO[]>}
118
+ */
119
+ getAll: (artikelnummer = "", farbkuerzel = "", farbcode = "", bezug = "", oberflaeche = "", changedSince) => {
120
+ let url = `LagerReservierungen?artikelnummer=${artikelnummer}&farbkuerzel=${farbkuerzel}&farbcode=${farbcode}&bezug=${bezug}&oberflaeche=${oberflaeche}`;
121
+ if (changedSince) {
122
+ url += `&changedSince=${changedSince.toISOString()}`;
123
+ }
124
+ return fluentApi.get(url);
125
+ },
126
+
127
+ /**
128
+ * Save reservations
129
+ * @param {LagerReservierungDTO[]} dtos
130
+ * @returns {Promise<void>}
131
+ */
132
+ save: (dtos) => fluentApi.put("LagerReservierungen/", dtos),
133
+
134
+ /**
135
+ * Delete reservations
136
+ * @param {string[]} guids
137
+ * @returns {Promise<void>}
138
+ */
139
+ delete: (guids) => fluentApi.delete("LagerReservierungen", guids),
140
+ },
141
+
142
+ // Functions
143
+ /**
144
+ * Get producer mandant IDs
145
+ * @returns {Promise<number[]>}
146
+ */
147
+ getProduzentenMandantIds: () =>
148
+ fluentApi.get("Lagerbestand/GetProduzentIdListe"),
149
+
150
+ /**
151
+ * Initialize inventory for articles
152
+ * @param {number} mandantID
153
+ * @returns {Promise<number[]>}
154
+ */
155
+ initializeBestand: (mandantID) =>
156
+ fluentApi.get(`Lagerbestand/InitializeBestandForArtikel?mandantId=${mandantID}`),
157
+ };
158
+ }
159
+
160
+ /**
161
+ * @typedef {ReturnType<typeof createLagerApi>} LagerApi
162
+ */