@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.
- package/JSDOC.md +661 -0
- package/README.md +106 -17
- package/api/business/ablageApi.js +106 -0
- package/api/business/anpassungApi.js +74 -0
- package/api/business/artikelApi.js +242 -0
- package/api/business/authApi.js +63 -0
- package/api/business/avApi.js +458 -0
- package/api/business/belegApi.js +365 -0
- package/api/business/belegPositionenApi.js +52 -0
- package/api/business/benutzerApi.js +96 -0
- package/api/business/fakturaApi.js +88 -0
- package/api/business/farbeApi.js +129 -0
- package/api/business/fileApi.js +72 -0
- package/api/business/historieApi.js +144 -0
- package/api/business/index.js +63 -0
- package/api/business/kontaktApi.js +70 -0
- package/api/business/lagerApi.js +162 -0
- package/api/business/lieferungApi.js +127 -0
- package/api/business/mailApi.js +41 -0
- package/api/business/mandantApi.js +137 -0
- package/api/business/materialApi.js +37 -0
- package/api/business/printApi.js +49 -0
- package/api/business/produktionApi.js +141 -0
- package/api/business/rechnungApi.js +155 -0
- package/api/business/serienApi.js +375 -0
- package/api/business/settingsApi.js +168 -0
- package/api/business/systemApi.js +209 -0
- package/api/business/uiApi.js +256 -0
- package/api/business/utilityApi.js +288 -0
- package/api/business/vorgangApi.js +128 -0
- package/api/dtos/allgemein.js +107 -0
- package/api/dtos/artikel.js +46 -0
- package/api/dtos/av.js +171 -0
- package/api/dtos/belege.js +614 -0
- package/api/dtos/benutzer.js +101 -0
- package/api/dtos/druck.js +50 -0
- package/api/dtos/faktura.js +128 -0
- package/api/dtos/farben.js +93 -0
- package/api/dtos/index.js +501 -0
- package/api/dtos/kunden.js +217 -0
- package/api/dtos/lager.js +66 -0
- package/api/dtos/mail.js +30 -0
- package/api/dtos/mandanten.js +60 -0
- package/api/dtos/nachrichten.js +18 -0
- package/api/dtos/produktGruppen.js +18 -0
- package/api/dtos/produktion.js +564 -0
- package/api/dtos/settings.js +172 -0
- package/api/dtos/technik.js +163 -0
- package/api/dtos/ui.js +496 -0
- package/api/dtos/webjob.js +12 -0
- package/api/fluentApi.js +10 -8
- package/api/fluentAuthManager.js +22 -14
- package/api/fluentRestClient.js +7 -7
- package/api/idasFluentApi.js +458 -0
- package/index.js +53 -6
- package/package.json +1 -1
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../fluentApi.js').FluentApi} FluentApi
|
|
3
|
+
* @typedef {import('../dtos/produktion.js').LieferzusageDTO} LieferzusageDTO
|
|
4
|
+
* @typedef {import('../dtos/produktion.js').GesamtLieferzusageDTO} GesamtLieferzusageDTO
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Lieferung API - Delivery promises and commitments
|
|
9
|
+
* @param {FluentApi} fluentApi
|
|
10
|
+
*/
|
|
11
|
+
export function createLieferungApi(fluentApi) {
|
|
12
|
+
return {
|
|
13
|
+
// LieferzusageWebRoutinen
|
|
14
|
+
/**
|
|
15
|
+
* Get all delivery promises for serie
|
|
16
|
+
* @param {string} serieGuid
|
|
17
|
+
* @param {string} [lieferant]
|
|
18
|
+
* @returns {Promise<LieferzusageDTO[]>}
|
|
19
|
+
*/
|
|
20
|
+
getAllLieferzusagen: (serieGuid, lieferant = "") =>
|
|
21
|
+
fluentApi.get(`Lieferzusage/?serieGuid=${serieGuid}&lieferant=${lieferant}`),
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Get delivery promises count
|
|
25
|
+
* @param {string} serieGuid
|
|
26
|
+
* @param {string} [lieferant]
|
|
27
|
+
* @returns {Promise<number>}
|
|
28
|
+
*/
|
|
29
|
+
getLieferzusagenCount: (serieGuid, lieferant = "") =>
|
|
30
|
+
fluentApi.get(`Lieferzusage/GetCount/${serieGuid}/${lieferant}`),
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Submit material delivery promise
|
|
34
|
+
* @param {LieferzusageDTO} lieferzusage
|
|
35
|
+
* @returns {Promise<string>}
|
|
36
|
+
*/
|
|
37
|
+
materialZusagen: (lieferzusage) =>
|
|
38
|
+
fluentApi.post("Lieferzusage", lieferzusage),
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Submit multiple material delivery promises
|
|
42
|
+
* @param {LieferzusageDTO[]} lieferzusagen
|
|
43
|
+
* @returns {Promise<string>}
|
|
44
|
+
*/
|
|
45
|
+
materialZusagenListe: (lieferzusagen) =>
|
|
46
|
+
fluentApi.post("Lieferzusage/PutLieferzusagenListe", lieferzusagen),
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Reset delivery promise
|
|
50
|
+
* @param {string} lieferzusageGuid
|
|
51
|
+
* @returns {Promise<void>}
|
|
52
|
+
*/
|
|
53
|
+
resetLieferzusage: (lieferzusageGuid) =>
|
|
54
|
+
fluentApi.delete(`Lieferzusage?zusageGuid=${lieferzusageGuid}`),
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Reset multiple delivery promises
|
|
58
|
+
* @param {string[]} lieferzusagenGuids
|
|
59
|
+
* @returns {Promise<string>}
|
|
60
|
+
*/
|
|
61
|
+
resetLieferzusagen: (lieferzusagenGuids) =>
|
|
62
|
+
fluentApi.delete("Lieferzusage/DeleteLieferzusagen", lieferzusagenGuids),
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Reset delivery promises by serie
|
|
66
|
+
* @param {string} serieGuid
|
|
67
|
+
* @param {string} [lieferant]
|
|
68
|
+
* @returns {Promise<void>}
|
|
69
|
+
*/
|
|
70
|
+
resetLieferzusagenBySerie: (serieGuid, lieferant = "") =>
|
|
71
|
+
fluentApi.delete(`Lieferzusage/DeleteLieferzusagenBySerie/?serieGuid=${serieGuid}&lieferant=${lieferant}`),
|
|
72
|
+
|
|
73
|
+
// GesamtLieferzusagenWebRoutinen
|
|
74
|
+
gesamt: {
|
|
75
|
+
/**
|
|
76
|
+
* Get total delivery promises
|
|
77
|
+
* @param {Date} [stichTag]
|
|
78
|
+
* @returns {Promise<GesamtLieferzusageDTO[]>}
|
|
79
|
+
*/
|
|
80
|
+
getAll: (stichTag) =>
|
|
81
|
+
fluentApi.get(`GesamtLieferzusagen?stichTag=${stichTag?.toISOString() || ""}`),
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Save total delivery promise
|
|
85
|
+
* @param {GesamtLieferzusageDTO} dto
|
|
86
|
+
* @returns {Promise<void>}
|
|
87
|
+
*/
|
|
88
|
+
save: (dto) => fluentApi.put("GesamtLieferzusagen", dto),
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Save multiple total delivery promises
|
|
92
|
+
* @param {GesamtLieferzusageDTO[]} dtoSet
|
|
93
|
+
* @returns {Promise<string>}
|
|
94
|
+
*/
|
|
95
|
+
saveListe: (dtoSet) =>
|
|
96
|
+
fluentApi.put("GesamtLieferzusagen/PutGesamtLieferzusagenListe", dtoSet),
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Book serie delivery promises
|
|
100
|
+
* @param {string} serieGuid
|
|
101
|
+
* @returns {Promise<void>}
|
|
102
|
+
*/
|
|
103
|
+
serieBuchen: (serieGuid) =>
|
|
104
|
+
fluentApi.post(`GesamtLieferzusagen/SerieBuchen?serieGuid=${serieGuid}`, null),
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Delete total delivery promise
|
|
108
|
+
* @param {string} gesamtLieferzusageGuid
|
|
109
|
+
* @returns {Promise<void>}
|
|
110
|
+
*/
|
|
111
|
+
delete: (gesamtLieferzusageGuid) =>
|
|
112
|
+
fluentApi.delete(`GesamtLieferzusage?gesamtLieferzusageGuid=${gesamtLieferzusageGuid}`),
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Delete multiple total delivery promises
|
|
116
|
+
* @param {string[]} gesamtLieferzusagenGuids
|
|
117
|
+
* @returns {Promise<string>}
|
|
118
|
+
*/
|
|
119
|
+
deleteListe: (gesamtLieferzusagenGuids) =>
|
|
120
|
+
fluentApi.delete("GesamtLieferzusage/DeleteGesamtLieferzusagen", gesamtLieferzusagenGuids),
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @typedef {ReturnType<typeof createLieferungApi>} LieferungApi
|
|
127
|
+
*/
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../fluentApi.js').FluentApi} FluentApi
|
|
3
|
+
* @typedef {import('../dtos/index.js').JobStatusResponseDTO} JobStatusResponseDTO
|
|
4
|
+
* @typedef {import('../dtos/index.js').JobStatusEntryDTO} JobStatusEntryDTO
|
|
5
|
+
* @typedef {import('../dtos/index.js').MailJobInfo} MailJobInfo
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Mail API - Email sending and management
|
|
10
|
+
* @param {FluentApi} fluentApi
|
|
11
|
+
*/
|
|
12
|
+
export function createMailApi(fluentApi) {
|
|
13
|
+
return {
|
|
14
|
+
// MailWebRoutinen
|
|
15
|
+
/**
|
|
16
|
+
* Send mail
|
|
17
|
+
* @param {MailJobInfo} job
|
|
18
|
+
* @param {string[]} [attachments]
|
|
19
|
+
* @returns {Promise<JobStatusResponseDTO>}
|
|
20
|
+
*/
|
|
21
|
+
send: (job, attachments) => {
|
|
22
|
+
const formData = new FormData();
|
|
23
|
+
formData.append("jobAsString", JSON.stringify(job));
|
|
24
|
+
if (attachments?.length) {
|
|
25
|
+
attachments.forEach(file => formData.append("files", file));
|
|
26
|
+
}
|
|
27
|
+
return fluentApi.post("Mail", formData);
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Get mail status
|
|
32
|
+
* @param {string} guid
|
|
33
|
+
* @returns {Promise<JobStatusEntryDTO[]>}
|
|
34
|
+
*/
|
|
35
|
+
getStatus: (guid) => fluentApi.get(`Mail/${guid}`),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @typedef {ReturnType<typeof createMailApi>} MailApi
|
|
41
|
+
*/
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../fluentApi.js').FluentApi} FluentApi
|
|
3
|
+
* @typedef {import('../dtos/settings.js').MandantDTO} MandantDTO
|
|
4
|
+
* @typedef {import('../dtos/index.js').BenutzerDTO} BenutzerDTO
|
|
5
|
+
* @typedef {import('../dtos/index.js').AppActivationStatusDTO} AppActivationStatusDTO
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Mandant API - Mandant/tenant management
|
|
10
|
+
* @param {FluentApi} fluentApi
|
|
11
|
+
*/
|
|
12
|
+
export function createMandantApi(fluentApi) {
|
|
13
|
+
return {
|
|
14
|
+
// MandantenWebRoutinen
|
|
15
|
+
/**
|
|
16
|
+
* Sync mandanten list
|
|
17
|
+
* @param {MandantDTO[]} list
|
|
18
|
+
* @returns {Promise<void>}
|
|
19
|
+
*/
|
|
20
|
+
abgleichen: (list) =>
|
|
21
|
+
Promise.all(list.map(m => fluentApi.put("Mandanten", m))),
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Create mandant
|
|
25
|
+
* @param {MandantDTO} mandant
|
|
26
|
+
* @returns {Promise<MandantDTO>}
|
|
27
|
+
*/
|
|
28
|
+
anlegen: (mandant) => fluentApi.put("Mandanten", mandant),
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Load mandanten with filter
|
|
32
|
+
* @param {string} filter
|
|
33
|
+
* @returns {Promise<MandantDTO[]>}
|
|
34
|
+
*/
|
|
35
|
+
ladenMitFilter: (filter) =>
|
|
36
|
+
fluentApi.get(`Mandanten?filter=${encodeURIComponent(filter)}`),
|
|
37
|
+
|
|
38
|
+
// MandantenAdminWebRoutinen
|
|
39
|
+
admin: {
|
|
40
|
+
/**
|
|
41
|
+
* Load mandanten with filter (admin)
|
|
42
|
+
* @param {string} filter
|
|
43
|
+
* @param {boolean} onlyHaendler
|
|
44
|
+
* @param {boolean} onlyProduzenten
|
|
45
|
+
* @returns {Promise<MandantDTO[]>}
|
|
46
|
+
*/
|
|
47
|
+
ladenMitFilter: (filter, onlyHaendler, onlyProduzenten) =>
|
|
48
|
+
fluentApi.get(`MandantenAdmin?filter=${encodeURIComponent(filter || "")}&onlyHaendler=${onlyHaendler}&onlyProduzenten=${onlyProduzenten}`),
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Load mandant by GUID (admin)
|
|
52
|
+
* @param {string} guid
|
|
53
|
+
* @returns {Promise<MandantDTO>}
|
|
54
|
+
*/
|
|
55
|
+
laden: (guid) => fluentApi.get(`MandantenAdmin?guid=${guid}`),
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Move mandant
|
|
59
|
+
* @param {string} mandantGuid
|
|
60
|
+
* @param {string} zielMandantGuid
|
|
61
|
+
* @returns {Promise<void>}
|
|
62
|
+
*/
|
|
63
|
+
umziehen: (mandantGuid, zielMandantGuid) =>
|
|
64
|
+
fluentApi.put("MandantenAdmin", [mandantGuid, zielMandantGuid]),
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Add admin rights
|
|
68
|
+
* @param {string} email
|
|
69
|
+
* @returns {Promise<void>}
|
|
70
|
+
*/
|
|
71
|
+
addAdminRechte: (email) =>
|
|
72
|
+
fluentApi.post(`MandantenAdmin/SetAdminRechte?email=${encodeURIComponent(email)}`, null),
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
// AppWebRoutinen
|
|
76
|
+
app: {
|
|
77
|
+
/**
|
|
78
|
+
* Get mandant status by customer
|
|
79
|
+
* @param {string} kundeGuid
|
|
80
|
+
* @returns {Promise<AppActivationStatusDTO>}
|
|
81
|
+
*/
|
|
82
|
+
getStatusByKunde: (kundeGuid) => fluentApi.get(`AppMandant/${kundeGuid}`),
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Set mandant status by customer
|
|
86
|
+
* @param {AppActivationStatusDTO} data
|
|
87
|
+
* @returns {Promise<AppActivationStatusDTO>}
|
|
88
|
+
*/
|
|
89
|
+
setStatusByKunde: (data) => fluentApi.put("AppMandant", data),
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Get mandanten
|
|
93
|
+
* @returns {Promise<MandantDTO[]>}
|
|
94
|
+
*/
|
|
95
|
+
getAll: () => fluentApi.get("AppMandant/"),
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Get users by customer
|
|
99
|
+
* @param {string} kundeGuid
|
|
100
|
+
* @returns {Promise<BenutzerDTO[]>}
|
|
101
|
+
*/
|
|
102
|
+
getBenutzerByKunde: (kundeGuid) => fluentApi.get(`AppBenutzer/${kundeGuid}`),
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Create or update user by customer
|
|
106
|
+
* @param {string} kundeGuid
|
|
107
|
+
* @param {BenutzerDTO} data
|
|
108
|
+
* @param {boolean} [pwSenden=false]
|
|
109
|
+
* @param {string} [passwort]
|
|
110
|
+
* @returns {Promise<BenutzerDTO>}
|
|
111
|
+
*/
|
|
112
|
+
createOrUpdateBenutzer: (kundeGuid, data, pwSenden = false, passwort = "") =>
|
|
113
|
+
fluentApi.post(`AppBenutzer/?kundeGuid=${kundeGuid}&pwSenden=${pwSenden}&passwort=${passwort}`, data),
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Delete user by customer
|
|
117
|
+
* @param {string} kundeGuid
|
|
118
|
+
* @param {BenutzerDTO} data
|
|
119
|
+
* @returns {Promise<void>}
|
|
120
|
+
*/
|
|
121
|
+
deleteBenutzer: (kundeGuid, data) =>
|
|
122
|
+
fluentApi.delete(`AppBenutzer/?kundeGuid=${kundeGuid}&benutzerGuid=${data.benutzerGuid}`),
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Activate mandant
|
|
126
|
+
* @param {string} adminEmail
|
|
127
|
+
* @returns {Promise<void>}
|
|
128
|
+
*/
|
|
129
|
+
aktiviere: (adminEmail) =>
|
|
130
|
+
fluentApi.post("ProduzentAktivieren", { adminEmail }),
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @typedef {ReturnType<typeof createMandantApi>} MandantApi
|
|
137
|
+
*/
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} MaterialDTO
|
|
3
|
+
* @property {string} MaterialGuid
|
|
4
|
+
* @property {string} Bezeichnung
|
|
5
|
+
* @property {boolean} IstSaegbar
|
|
6
|
+
* @property {boolean} IstBeschichtbar
|
|
7
|
+
* @property {boolean} IstFaerbbar
|
|
8
|
+
* @property {Date} ChangedDate
|
|
9
|
+
* @property {number} Version
|
|
10
|
+
* @property {Array<string>} MoeglicheBearbeitungsMethoden
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** @typedef {import('../fluentApi.js').FluentApi} FluentApi */
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {Object} MaterialApi
|
|
17
|
+
* @property {() => Promise<MaterialDTO[]>} getAll - Get all materials
|
|
18
|
+
* @property {(material: MaterialDTO) => Promise<void>} saveMaterial - Save a material
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @param {FluentApi} fluentApi
|
|
23
|
+
* @returns {MaterialApi}
|
|
24
|
+
*/
|
|
25
|
+
export function createMaterialApi(fluentApi) {
|
|
26
|
+
const api = fluentApi.withBaseUrl("ModellDaten");
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
async getAll() {
|
|
30
|
+
return await api.get("Material");
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
async saveMaterial(material) {
|
|
34
|
+
return await api.put("Material", material);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../fluentApi.js').FluentApi} FluentApi
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Print API - Document printing and generation
|
|
7
|
+
* @param {FluentApi} fluentApi
|
|
8
|
+
*/
|
|
9
|
+
export function createPrintApi(fluentApi) {
|
|
10
|
+
return {
|
|
11
|
+
// PrintWebRoutinen
|
|
12
|
+
/**
|
|
13
|
+
* Generate PDF for beleg
|
|
14
|
+
* @param {string} belegGuid
|
|
15
|
+
* @returns {Promise<Uint8Array>}
|
|
16
|
+
*/
|
|
17
|
+
pdfErzeugen: (belegGuid) =>
|
|
18
|
+
fluentApi.post(`Print/?bguid=${belegGuid}`, []),
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Generate XPS for beleg
|
|
22
|
+
* @param {string} belegGuid
|
|
23
|
+
* @returns {Promise<Uint8Array>}
|
|
24
|
+
*/
|
|
25
|
+
xpsErzeugen: (belegGuid) =>
|
|
26
|
+
fluentApi.post(`Print/?bguid=${belegGuid}&fileFormat=XPS`, []),
|
|
27
|
+
|
|
28
|
+
// PrintV2WebRoutinen
|
|
29
|
+
/**
|
|
30
|
+
* Generate PDF v2
|
|
31
|
+
* @param {string} belegGuid
|
|
32
|
+
* @param {string} email
|
|
33
|
+
* @returns {Promise<Uint8Array>}
|
|
34
|
+
*/
|
|
35
|
+
pdfV2: (belegGuid, email) =>
|
|
36
|
+
fluentApi.get(`PrintV2/Pdf?bguid=${belegGuid}&email=${encodeURIComponent(email)}`),
|
|
37
|
+
|
|
38
|
+
// BriefbogenWebRoutinen
|
|
39
|
+
/**
|
|
40
|
+
* Load letterhead
|
|
41
|
+
* @returns {Promise<Uint8Array>}
|
|
42
|
+
*/
|
|
43
|
+
briefbogenLaden: () => fluentApi.get("Briefbogen"),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @typedef {ReturnType<typeof createPrintApi>} PrintApi
|
|
49
|
+
*/
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../fluentApi.js').FluentApi} FluentApi
|
|
3
|
+
* @typedef {import('../dtos/produktion.js').BearbeitungDTO} BearbeitungDTO
|
|
4
|
+
* @typedef {import('../dtos/produktion.js').MaterialbedarfDTO} MaterialbedarfDTO
|
|
5
|
+
* @typedef {import('../dtos/belege.js').VorgangDTO} VorgangDTO
|
|
6
|
+
* @typedef {import('../dtos/belege.js').BelegartWechselDTO} BelegartWechselDTO
|
|
7
|
+
* @typedef {import('../dtos/produktion.js').ProduktionsStatusDTO} ProduktionsStatusDTO
|
|
8
|
+
* @typedef {import('../dtos/produktion.js').ProduktionsStatusHistorieDTO} ProduktionsStatusHistorieDTO
|
|
9
|
+
* @typedef {import('../dtos/produktion.js').ProduktionsfreigabeItemDTO} ProduktionsfreigabeItemDTO
|
|
10
|
+
* @typedef {import('../dtos/produktion.js').ProduktionsInfoDTO} ProduktionsInfoDTO
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Produktion API - Production and manufacturing management
|
|
15
|
+
* @param {FluentApi} fluentApi
|
|
16
|
+
*/
|
|
17
|
+
export function createProduktionApi(fluentApi) {
|
|
18
|
+
return {
|
|
19
|
+
// ProduktionWebRoutinen
|
|
20
|
+
/**
|
|
21
|
+
* Calculate production for position
|
|
22
|
+
* @param {string} belegPositionsGuid
|
|
23
|
+
* @returns {Promise<string>}
|
|
24
|
+
*/
|
|
25
|
+
produktionBerechnen: (belegPositionsGuid) =>
|
|
26
|
+
fluentApi.get(`Script/PosBerechnen?pguid=${belegPositionsGuid}`),
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get production for position
|
|
30
|
+
* @param {string} belegPositionsGuid
|
|
31
|
+
* @returns {Promise<BearbeitungDTO[]>}
|
|
32
|
+
*/
|
|
33
|
+
getProduktion: (belegPositionsGuid) =>
|
|
34
|
+
fluentApi.get(`Produktion/?posguid=${belegPositionsGuid}`),
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Get material requirements for position
|
|
38
|
+
* @param {string} belegPositionsGuid
|
|
39
|
+
* @returns {Promise<MaterialbedarfDTO[]>}
|
|
40
|
+
*/
|
|
41
|
+
getMaterialBedarf: (belegPositionsGuid) =>
|
|
42
|
+
fluentApi.get(`MaterialBedarf/?posguid=${belegPositionsGuid}`),
|
|
43
|
+
|
|
44
|
+
// ProduktionsfreigabeWebRoutinen
|
|
45
|
+
/**
|
|
46
|
+
* Add production release
|
|
47
|
+
* @param {BelegartWechselDTO} dto
|
|
48
|
+
* @returns {Promise<VorgangDTO>}
|
|
49
|
+
*/
|
|
50
|
+
addProduktionsfreigabe: (dto) => fluentApi.put("Produktionsfreigabe", dto),
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Run production release web job
|
|
54
|
+
* @returns {Promise<void>}
|
|
55
|
+
*/
|
|
56
|
+
produktionsfreigabeWebJob: () => fluentApi.post("Produktionsfreigabe/WebJob", null),
|
|
57
|
+
|
|
58
|
+
// ProduktionsfreigabeListeWebRoutinen
|
|
59
|
+
/**
|
|
60
|
+
* Get all production release items
|
|
61
|
+
* @returns {Promise<ProduktionsfreigabeItemDTO[]>}
|
|
62
|
+
*/
|
|
63
|
+
getAllProduktionsfreigabeItems: () => fluentApi.get("ProduktionsfreigabeListe"),
|
|
64
|
+
|
|
65
|
+
// ProduktionsfreigabeInfoWebRoutinen
|
|
66
|
+
/**
|
|
67
|
+
* Get production release info for belege
|
|
68
|
+
* @param {string[]} belegGuids
|
|
69
|
+
* @returns {Promise<Record<string, Date>>}
|
|
70
|
+
*/
|
|
71
|
+
getProduktionsfreigabeInfo: (belegGuids) =>
|
|
72
|
+
fluentApi.put("ProduktionsfreigabeInfo", belegGuids),
|
|
73
|
+
|
|
74
|
+
// ProduktionsStatusWebRoutinen
|
|
75
|
+
/**
|
|
76
|
+
* Get all production statuses
|
|
77
|
+
* @returns {Promise<ProduktionsStatusDTO[]>}
|
|
78
|
+
*/
|
|
79
|
+
getAllProduktionsStatus: () => fluentApi.get("ProduktionsStatus"),
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Get production status by GUID
|
|
83
|
+
* @param {string} guid
|
|
84
|
+
* @returns {Promise<ProduktionsStatusDTO>}
|
|
85
|
+
*/
|
|
86
|
+
getProduktionsStatus: (guid) => fluentApi.get(`ProduktionsStatus/${guid}`),
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Save production status
|
|
90
|
+
* @param {ProduktionsStatusDTO} status
|
|
91
|
+
* @returns {Promise<void>}
|
|
92
|
+
*/
|
|
93
|
+
saveProduktionsStatus: (status) => fluentApi.put("ProduktionsStatus", status),
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Save production status history
|
|
97
|
+
* @param {string} avGuid
|
|
98
|
+
* @param {ProduktionsStatusHistorieDTO} historie
|
|
99
|
+
* @returns {Promise<void>}
|
|
100
|
+
*/
|
|
101
|
+
saveProduktionsStatusHistorie: (avGuid, historie) =>
|
|
102
|
+
fluentApi.put(`ProduktionsStatus/AddHistorie/${avGuid}`, historie),
|
|
103
|
+
|
|
104
|
+
// ProduktionsInfoWebRoutinen
|
|
105
|
+
/**
|
|
106
|
+
* Get production info for vorgang
|
|
107
|
+
* @param {string} vorgangGuid
|
|
108
|
+
* @returns {Promise<ProduktionsInfoDTO>}
|
|
109
|
+
*/
|
|
110
|
+
getProduktionsInfo: (vorgangGuid) => fluentApi.get(`ProduktionsInfo?vorgangGuid=${vorgangGuid}`),
|
|
111
|
+
|
|
112
|
+
// IBOS1Routinen
|
|
113
|
+
/**
|
|
114
|
+
* Calculate IBOS1 production
|
|
115
|
+
* @param {string} belegPositionsGuid
|
|
116
|
+
* @returns {Promise<string>}
|
|
117
|
+
*/
|
|
118
|
+
ibos1ProduktionBerechnen: (belegPositionsGuid) =>
|
|
119
|
+
fluentApi.get(`IBOS1/Print?bguid=${belegPositionsGuid}`),
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Test IBOS1 position
|
|
123
|
+
* @param {string} belegPositionsGuid
|
|
124
|
+
* @returns {Promise<string>}
|
|
125
|
+
*/
|
|
126
|
+
ibos1PositionTesten: (belegPositionsGuid) =>
|
|
127
|
+
fluentApi.get(`Test?bguid=${belegPositionsGuid}`),
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Get IBOS1 production
|
|
131
|
+
* @param {string} guid
|
|
132
|
+
* @returns {Promise<string>}
|
|
133
|
+
*/
|
|
134
|
+
getIbos1Produktion: (guid) =>
|
|
135
|
+
fluentApi.get(`Produktion/?posguid=${guid}`),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* @typedef {ReturnType<typeof createProduktionApi>} ProduktionApi
|
|
141
|
+
*/
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../fluentApi.js').FluentApi} FluentApi
|
|
3
|
+
* @typedef {import('../dtos/faktura.js').BelegeInfoDTO} BelegeInfoDTO
|
|
4
|
+
* @typedef {import('../dtos/belege.js').BelegartWechselDTO} BelegartWechselDTO
|
|
5
|
+
* @typedef {import('../dtos/faktura.js').SammelrechnungDTO} SammelrechnungDTO
|
|
6
|
+
* @typedef {import('../dtos/faktura.js').SammelrechnungListItemDTO} SammelrechnungListItemDTO
|
|
7
|
+
* @typedef {import('../dtos/faktura.js').CreateSammelrechnungDTO} CreateSammelrechnungDTO
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Rechnung API - Invoice creation and management
|
|
12
|
+
* Corresponds to RechnungenWebRoutinen and SammelrechnungenWebRoutinen in C#
|
|
13
|
+
* @param {FluentApi} fluentApi
|
|
14
|
+
*/
|
|
15
|
+
export function createRechnungApi(fluentApi) {
|
|
16
|
+
return {
|
|
17
|
+
// RechnungenWebRoutinen
|
|
18
|
+
/**
|
|
19
|
+
* Get all deliverable delivery notes
|
|
20
|
+
* @returns {Promise<BelegeInfoDTO[]>}
|
|
21
|
+
*/
|
|
22
|
+
getAllAbFakturierbar: () =>
|
|
23
|
+
fluentApi.get("Rechnungen/GetABFakturierbar"),
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Get all printable invoices
|
|
27
|
+
* @param {Date} [printedSince]
|
|
28
|
+
* @returns {Promise<BelegeInfoDTO[]>}
|
|
29
|
+
*/
|
|
30
|
+
getAllDruckbar: (printedSince) =>
|
|
31
|
+
fluentApi.get(`Rechnungen/GetNotPrintedRechnungen?printedSince=${printedSince?.toISOString()}`),
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Get all exportable invoices
|
|
35
|
+
* @param {Date} [exportedSince]
|
|
36
|
+
* @returns {Promise<BelegeInfoDTO[]>}
|
|
37
|
+
*/
|
|
38
|
+
getAllExportierbar: (exportedSince) =>
|
|
39
|
+
fluentApi.get(`Rechnungen/GetNotExportedRechnungen?exportedSince=${exportedSince?.toISOString()}`),
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Set belege as printed
|
|
43
|
+
* @param {string[]} belegListe
|
|
44
|
+
* @returns {Promise<void>}
|
|
45
|
+
*/
|
|
46
|
+
setBelegePrinted: (belegListe) =>
|
|
47
|
+
fluentApi.post("Rechnungen/SetBelegePrinted", belegListe),
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Set belege as exported
|
|
51
|
+
* @param {string[]} belegListe
|
|
52
|
+
* @returns {Promise<void>}
|
|
53
|
+
*/
|
|
54
|
+
setBelegeExported: (belegListe) =>
|
|
55
|
+
fluentApi.post("Rechnungen/SetBelegeExported", belegListe),
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Create invoices from delivery notes
|
|
59
|
+
* @param {BelegartWechselDTO[]} belegeWechsel
|
|
60
|
+
* @returns {Promise<Record<string, string>>} Map of belegGuid to rechnungGuid
|
|
61
|
+
*/
|
|
62
|
+
erstelleRechnungen: (belegeWechsel) =>
|
|
63
|
+
fluentApi.post("Rechnungen/ErstelleRechnungen", belegeWechsel),
|
|
64
|
+
|
|
65
|
+
// SammelrechnungenWebRoutinen
|
|
66
|
+
sammel: {
|
|
67
|
+
/**
|
|
68
|
+
* Create collective invoice
|
|
69
|
+
* @param {CreateSammelrechnungDTO} dto
|
|
70
|
+
* @returns {Promise<SammelrechnungListItemDTO>}
|
|
71
|
+
*/
|
|
72
|
+
erstellen: (dto) =>
|
|
73
|
+
fluentApi.post("Sammelrechnungen/ErstelleSammelrechnungen", dto),
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Get not printed collective invoices
|
|
77
|
+
* @param {Date} [printedSince]
|
|
78
|
+
* @returns {Promise<SammelrechnungListItemDTO[]>}
|
|
79
|
+
*/
|
|
80
|
+
getNotPrinted: (printedSince) =>
|
|
81
|
+
fluentApi.get(`Sammelrechnungen/GetNotPrintedSammelrechnungen?printedSince=${printedSince?.toISOString()}`),
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Get not exported collective invoices
|
|
85
|
+
* @param {Date} [exportedSince]
|
|
86
|
+
* @returns {Promise<SammelrechnungListItemDTO[]>}
|
|
87
|
+
*/
|
|
88
|
+
getNotExported: (exportedSince) =>
|
|
89
|
+
fluentApi.get(`Sammelrechnungen/GetNotExportedSammelrechnungen?exportedSince=${exportedSince?.toISOString()}`),
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Get collective invoice by GUID
|
|
93
|
+
* @param {string} guid
|
|
94
|
+
* @param {boolean} includeBelegDruckDTO
|
|
95
|
+
* @returns {Promise<SammelrechnungDTO>}
|
|
96
|
+
*/
|
|
97
|
+
get: (guid, includeBelegDruckDTO) =>
|
|
98
|
+
fluentApi.get(`Sammelrechnungen/GetSammelrechnung?guid=${guid}&includeBelegDruckDTO=${includeBelegDruckDTO}`),
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Get possible collective invoice items
|
|
102
|
+
* @returns {Promise<BelegeInfoDTO[]>}
|
|
103
|
+
*/
|
|
104
|
+
getPossibleRechnungen: () =>
|
|
105
|
+
fluentApi.get("Sammelrechnungen/GetPossibleSammelrechnungRechnungen"),
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Update collective invoice
|
|
109
|
+
* @param {SammelrechnungDTO} dto
|
|
110
|
+
* @returns {Promise<SammelrechnungDTO>}
|
|
111
|
+
*/
|
|
112
|
+
update: (dto) =>
|
|
113
|
+
fluentApi.post("Sammelrechnungen/UpdateSammelrechnung", dto),
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Add invoice to collective invoice
|
|
117
|
+
* @param {string} belegGuid
|
|
118
|
+
* @param {string} sammelrechnungGuid
|
|
119
|
+
* @returns {Promise<SammelrechnungListItemDTO>}
|
|
120
|
+
*/
|
|
121
|
+
addRechnung: (belegGuid, sammelrechnungGuid) =>
|
|
122
|
+
fluentApi.post("Sammelrechnungen/AddRechnungToSammelrechnungen", { belegGuid, sammelrechnungGuid }),
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Set invoices as printed
|
|
126
|
+
* @param {string[]} guidListe
|
|
127
|
+
* @param {boolean} [setEinzel=false]
|
|
128
|
+
* @returns {Promise<void>}
|
|
129
|
+
*/
|
|
130
|
+
setAlsGedruckt: (guidListe, setEinzel = false) =>
|
|
131
|
+
fluentApi.post(`Sammelrechnungen/SetSammelrechnungPrinted?setEinzel=${setEinzel}`, guidListe),
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Set invoices as exported to accounting
|
|
135
|
+
* @param {string[]} guidListe
|
|
136
|
+
* @param {boolean} [setEinzel=false]
|
|
137
|
+
* @returns {Promise<void>}
|
|
138
|
+
*/
|
|
139
|
+
setAlsFibuUebergeben: (guidListe, setEinzel = false) =>
|
|
140
|
+
fluentApi.post(`Sammelrechnungen/SetSammelrechnungExported?setEinzel=${setEinzel}`, guidListe),
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Search collective invoices
|
|
144
|
+
* @param {string} term
|
|
145
|
+
* @returns {Promise<SammelrechnungListItemDTO[]>}
|
|
146
|
+
*/
|
|
147
|
+
search: (term) =>
|
|
148
|
+
fluentApi.get(`Sammelrechnungen/SearchSammelrechnung?term=${term}`),
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* @typedef {ReturnType<typeof createRechnungApi>} RechnungApi
|
|
155
|
+
*/
|