@things-factory/operato-hub 4.1.34 → 4.1.37

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 (38) hide show
  1. package/dist-server/routers/api/restful-apis/unstable/get-delivery-orders.js +148 -0
  2. package/dist-server/routers/api/restful-apis/unstable/get-delivery-orders.js.map +1 -0
  3. package/dist-server/routers/api/restful-apis/unstable/get-goods-received-notes.js +104 -0
  4. package/dist-server/routers/api/restful-apis/unstable/get-goods-received-notes.js.map +1 -0
  5. package/dist-server/routers/api/restful-apis/unstable/index.js +2 -0
  6. package/dist-server/routers/api/restful-apis/unstable/index.js.map +1 -1
  7. package/dist-server/routers/api/restful-apis/v1/get-delivery-orders.js +148 -0
  8. package/dist-server/routers/api/restful-apis/v1/get-delivery-orders.js.map +1 -0
  9. package/dist-server/routers/api/restful-apis/v1/get-goods-received-notes.js +104 -0
  10. package/dist-server/routers/api/restful-apis/v1/get-goods-received-notes.js.map +1 -0
  11. package/dist-server/routers/api/restful-apis/v1/index.js +2 -0
  12. package/dist-server/routers/api/restful-apis/v1/index.js.map +1 -1
  13. package/dist-server/routers/api/restful-apis/v2/get-delivery-orders.js +148 -0
  14. package/dist-server/routers/api/restful-apis/v2/get-delivery-orders.js.map +1 -0
  15. package/dist-server/routers/api/restful-apis/v2/get-goods-received-notes.js +104 -0
  16. package/dist-server/routers/api/restful-apis/v2/get-goods-received-notes.js.map +1 -0
  17. package/dist-server/routers/api/restful-apis/v2/index.js +2 -0
  18. package/dist-server/routers/api/restful-apis/v2/index.js.map +1 -1
  19. package/openapi/unstable/inbound.yaml +178 -0
  20. package/openapi/unstable/outbound.yaml +316 -0
  21. package/openapi/v1/inbound.yaml +178 -0
  22. package/openapi/v1/outbound.yaml +316 -0
  23. package/openapi/v2/inbound.yaml +178 -0
  24. package/openapi/v2/outbound.yaml +316 -0
  25. package/package.json +10 -10
  26. package/server/routers/api/restful-apis/unstable/get-delivery-orders.ts +162 -0
  27. package/server/routers/api/restful-apis/unstable/get-goods-received-notes.ts +118 -0
  28. package/server/routers/api/restful-apis/unstable/index.ts +2 -0
  29. package/server/routers/api/restful-apis/v1/get-delivery-orders.ts +162 -0
  30. package/server/routers/api/restful-apis/v1/get-goods-received-notes.ts +118 -0
  31. package/server/routers/api/restful-apis/v1/index.ts +2 -0
  32. package/server/routers/api/restful-apis/v2/get-delivery-orders.ts +162 -0
  33. package/server/routers/api/restful-apis/v2/get-goods-received-notes.ts +118 -0
  34. package/server/routers/api/restful-apis/v2/index.ts +2 -0
  35. package/translations/en.json +1 -0
  36. package/translations/ko.json +1 -0
  37. package/translations/ms.json +1 -0
  38. package/translations/zh.json +1 -0
@@ -1,4 +1,272 @@
1
1
  definitions:
2
+ DO:
3
+ type: 'object'
4
+ properties:
5
+ result:
6
+ type: 'object'
7
+ properties:
8
+ deliveryOrders:
9
+ type: 'object'
10
+ properties:
11
+ items:
12
+ type: 'array'
13
+ items:
14
+ type: 'object'
15
+ properties:
16
+ name:
17
+ type: 'string'
18
+ example: 'DO-202193085211820'
19
+ from:
20
+ type: 'string'
21
+ example: null
22
+ to:
23
+ type: 'string'
24
+ example: null
25
+ contactPointRefId:
26
+ type: 'string'
27
+ example: null
28
+ truckNo:
29
+ type: 'string'
30
+ example: null
31
+ deliveryDate:
32
+ type: 'string'
33
+ example: null
34
+ status:
35
+ type: 'string'
36
+ example: 'READY_TO_DISPATCH'
37
+ ownCollection:
38
+ type: 'boolean'
39
+ example: true
40
+ looseItem:
41
+ type: 'string'
42
+ example: null
43
+ deliveryDateTime:
44
+ type: 'string'
45
+ example: null
46
+ loadWeight:
47
+ type: 'string'
48
+ example: null
49
+ cargoType:
50
+ type: 'string'
51
+ example: null
52
+ urgency:
53
+ type: 'string'
54
+ example: null
55
+ telNo:
56
+ type: 'string'
57
+ example: null
58
+ refNo:
59
+ type: 'string'
60
+ example: '2675858675687'
61
+ otherDriver:
62
+ type: 'string'
63
+ example: null
64
+ palletQty:
65
+ type: 'number'
66
+ example: null
67
+ remark:
68
+ type: 'string'
69
+ example: null
70
+ description:
71
+ type: 'number'
72
+ example: null
73
+ reusablePallet:
74
+ type: 'string'
75
+ example: null
76
+ domain:
77
+ type: 'object'
78
+ properties:
79
+ name:
80
+ type: 'string'
81
+ example: 'ABC Warehouse'
82
+ bizplace:
83
+ type: 'object'
84
+ properties:
85
+ name:
86
+ type: 'string'
87
+ example: 'ABC E-commerce'
88
+ releaseGood:
89
+ type: 'object'
90
+ properties:
91
+ name:
92
+ type: 'string'
93
+ example: 'RO-20219317281764'
94
+ description:
95
+ type: 'string'
96
+ example: null
97
+ status:
98
+ type: 'string'
99
+ example: 'DONE'
100
+ refNo:
101
+ type: 'string'
102
+ example: '678968687688967'
103
+ refNo2:
104
+ type: 'string'
105
+ example: 'Loose'
106
+ refNo3:
107
+ type: 'string'
108
+ example: null
109
+ truckNo:
110
+ type: 'string'
111
+ example: null
112
+ exportOption:
113
+ type: 'boolean'
114
+ example: false
115
+ ownTransport:
116
+ type: 'boolean'
117
+ example: true
118
+ crossDocking:
119
+ type: 'boolean'
120
+ example: false
121
+ releaseDateTime:
122
+ type: 'string'
123
+ example: null
124
+ releaseDate:
125
+ type: 'string'
126
+ example: '2021-09-09'
127
+ remark:
128
+ type: 'string'
129
+ example: null
130
+ courierOption:
131
+ type: 'boolean'
132
+ example: false
133
+ packingOption:
134
+ type: 'boolean'
135
+ example: false
136
+ type:
137
+ type: 'boolean'
138
+ example: 'b2b'
139
+ acceptedAt:
140
+ type: 'number'
141
+ example: 1632958100650
142
+ marketplaceOrderStatus:
143
+ type: 'string'
144
+ example: null
145
+ billingAddress:
146
+ type: 'string'
147
+ example: null
148
+ deliveryAddress1:
149
+ type: 'string'
150
+ example: null
151
+ deliveryAddress2:
152
+ type: 'string'
153
+ example: null
154
+ deliveryAddress3:
155
+ type: 'string'
156
+ example: null
157
+ deliveryAddress4:
158
+ type: 'string'
159
+ example: null
160
+ deliveryAddress5:
161
+ type: 'string'
162
+ example: null
163
+ attentionTo:
164
+ type: 'string'
165
+ example: null
166
+ attentionCompany:
167
+ type: 'string'
168
+ example: null
169
+ city:
170
+ type: 'string'
171
+ example: null
172
+ state:
173
+ type: 'string'
174
+ example: null
175
+ postalCode:
176
+ type: 'string'
177
+ example: null
178
+ country:
179
+ type: 'string'
180
+ example: null
181
+ phone1:
182
+ type: 'string'
183
+ example: null
184
+ phone2:
185
+ type: 'string'
186
+ example: null
187
+ email:
188
+ type: 'string'
189
+ example: null
190
+ transporter:
191
+ type: 'string'
192
+ example: 'Others (West Malaysia)'
193
+ trackingNo:
194
+ type: 'string'
195
+ example: null
196
+ airwayBill:
197
+ type: 'string'
198
+ example: null
199
+ invoice:
200
+ type: 'string'
201
+ example: null
202
+ pickupAddress:
203
+ type: 'string'
204
+ example: null
205
+ pickupTime:
206
+ type: 'string'
207
+ example: null
208
+ handoverType:
209
+ type: 'string'
210
+ example: null
211
+ dropoffAddress:
212
+ type: 'string'
213
+ example: null
214
+ noOfItems:
215
+ type: 'string'
216
+ example: null
217
+ orderProducts:
218
+ type: 'object'
219
+ properties:
220
+ id:
221
+ type: 'string'
222
+ example: 'b6e18590-4876-4cf4-87af-3c53f7c623d1'
223
+ type:
224
+ type: 'string'
225
+ example: null
226
+ batchId:
227
+ type: 'string'
228
+ example: '-'
229
+ packingType:
230
+ type: 'string'
231
+ example: 'CARTON'
232
+ packingSize:
233
+ type: 'number'
234
+ example: 24
235
+ releaseQty:
236
+ type: 'number'
237
+ example: null
238
+ releaseUomValue:
239
+ type: 'number'
240
+ example: null
241
+ status:
242
+ type: 'string'
243
+ example: 'ACTIVE'
244
+ attachments:
245
+ type: 'string'
246
+ example: ''
247
+ createdAt:
248
+ type: 'number'
249
+ example: 1645750026391
250
+ updatedAt:
251
+ type: 'number'
252
+ example: 1645750026391
253
+ updater:
254
+ type: 'object'
255
+ properties:
256
+ id:
257
+ type: 'string'
258
+ example: '2ce54c66-436a-40cf-a042-24d032c28ceb'
259
+ name:
260
+ type: 'string'
261
+ example: 'Ee Chern Hao'
262
+ description:
263
+ type: 'string'
264
+ example: null
265
+ total:
266
+ type: 'number'
267
+ example: 12
268
+ xml:
269
+ name: 'DO'
2
270
  Outbound:
3
271
  type: 'object'
4
272
  required:
@@ -361,3 +629,51 @@ paths:
361
629
  '500':
362
630
  description: 'Server error'
363
631
  deprecated: false
632
+ /warehouse/{warehouseId}/get-delivery-orders:
633
+ get:
634
+ tags:
635
+ - 'outbound'
636
+ description: 'Use this API to get a list of delivery orders from WMS.'
637
+ operationId: 'getDeliveryOrder'
638
+ produces:
639
+ - 'application/json'
640
+ parameters:
641
+ - in: 'path'
642
+ name: 'warehouseId'
643
+ required: true
644
+ type: 'string'
645
+ - name: 'fromDate'
646
+ in: 'query'
647
+ required: true
648
+ type: 'string'
649
+ - name: 'toDate'
650
+ in: 'query'
651
+ description: 'Maximum date range is 1 month'
652
+ required: true
653
+ type: 'string'
654
+ - name: 'limit'
655
+ in: 'query'
656
+ default: 10
657
+ required: false
658
+ type: 'number'
659
+ - name: 'page'
660
+ in: 'query'
661
+ default: 1
662
+ required: false
663
+ type: 'number'
664
+ responses:
665
+ '200':
666
+ description: 'successful operation'
667
+ content:
668
+ application/json:
669
+ schema:
670
+ $ref: '#/definitions/DO'
671
+ '400':
672
+ description: 'Bad request is sent'
673
+ '401':
674
+ description: 'Authentication Error'
675
+ '404':
676
+ description: 'Resource not found'
677
+ '500':
678
+ description: 'Server error'
679
+ deprecated: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/operato-hub",
3
- "version": "4.1.34",
3
+ "version": "4.1.37",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -77,20 +77,20 @@
77
77
  "@things-factory/i18n-base": "^4.1.28",
78
78
  "@things-factory/import-ui": "^4.1.28",
79
79
  "@things-factory/import-ui-excel": "^4.1.28",
80
- "@things-factory/integration-accounting": "^4.1.34",
80
+ "@things-factory/integration-accounting": "^4.1.37",
81
81
  "@things-factory/integration-fulfillment": "^4.1.28",
82
82
  "@things-factory/integration-lmd": "^4.1.28",
83
- "@things-factory/integration-marketplace": "^4.1.33",
83
+ "@things-factory/integration-marketplace": "^4.1.35",
84
84
  "@things-factory/integration-pos": "^4.1.28",
85
- "@things-factory/integration-sellercraft": "^4.1.33",
86
- "@things-factory/integration-sftp": "^4.1.28",
85
+ "@things-factory/integration-sellercraft": "^4.1.35",
86
+ "@things-factory/integration-sftp": "^4.1.36",
87
87
  "@things-factory/lite-menu": "^4.1.28",
88
88
  "@things-factory/more-ui": "^4.1.28",
89
89
  "@things-factory/notification": "^4.1.28",
90
90
  "@things-factory/pdf": "^4.1.28",
91
- "@things-factory/product-ui": "^4.1.34",
91
+ "@things-factory/product-ui": "^4.1.37",
92
92
  "@things-factory/resource-ui": "^4.1.28",
93
- "@things-factory/sales-base": "^4.1.34",
93
+ "@things-factory/sales-base": "^4.1.37",
94
94
  "@things-factory/scene-data-transform": "^4.1.28",
95
95
  "@things-factory/scene-excel": "^4.1.28",
96
96
  "@things-factory/scene-firebase": "^4.1.28",
@@ -105,8 +105,8 @@
105
105
  "@things-factory/setting-ui": "^4.1.28",
106
106
  "@things-factory/shell": "^4.1.28",
107
107
  "@things-factory/system-ui": "^4.1.28",
108
- "@things-factory/warehouse-base": "^4.1.34",
109
- "@things-factory/worksheet-base": "^4.1.34",
108
+ "@things-factory/warehouse-base": "^4.1.37",
109
+ "@things-factory/worksheet-base": "^4.1.37",
110
110
  "koa2-swagger-ui": "^5.0.2",
111
111
  "swagger-jsdoc": "^5.0.0",
112
112
  "yamljs": "^0.3.0"
@@ -117,5 +117,5 @@
117
117
  "resolutions": {
118
118
  "core-js": "^3.16.0"
119
119
  },
120
- "gitHead": "44aa74caa0f26a4b09ddf29c16cf8f3bfcd9b6bd"
120
+ "gitHead": "cc34a73ab56ed192e1f2babe6954a817c473a46c"
121
121
  }
@@ -0,0 +1,162 @@
1
+ import gql from 'graphql-tag'
2
+ import { EntityManager, getConnection } from 'typeorm'
3
+
4
+ import { restfulApiRouter as router } from '@things-factory/api'
5
+
6
+ import { businessMiddleware } from '../../../../middlewares/business-middleware'
7
+ import { warehouseMiddleware } from '../../../../middlewares/warehouse-middleware'
8
+
9
+ const debug = require('debug')('things-factory:operato-hub:restful-api:unstable:get-delivery-orders')
10
+
11
+ router.get(
12
+ '/unstable/warehouse/:warehouseId/get-delivery-orders',
13
+ businessMiddleware,
14
+ warehouseMiddleware,
15
+ async (context, next) => {
16
+ return await getConnection().transaction(async (tx: EntityManager) => {
17
+ const { client, warehouse: bizplace, domain } = context.state
18
+ const { warehouseId: customerBizplaceId } = context.params
19
+ const { t } = context
20
+
21
+ const { fromDate, toDate, limit = 10, page = 1 } = context.query
22
+
23
+ if (!customerBizplaceId) context.throw(404, t('Error: Warehouse id not found'))
24
+ if (!fromDate || !toDate) context.throw(400, t('Error: Date range not provided correctly'))
25
+ if (limit > 100 || limit < 0) context.throw(400, t('Error: Limit value exceed 100 maximum threshold'))
26
+
27
+ let noOfDays = (new Date(toDate).getTime() - new Date(fromDate).getTime()) / (1000 * 3600 * 24)
28
+ if (noOfDays >= 31 || noOfDays <= 0)
29
+ context.throw(400, t('Error: Date range value exceed 1 month maximum threshold'))
30
+
31
+ let filters: any = [
32
+ { name: 'bizplace', operator: 'in', value: [customerBizplaceId], relation: true },
33
+ { name: 'createdAt', operator: 'between', value: [fromDate, toDate] },
34
+ { name: 'orderProductsApi', operator: 'equal', value: true }
35
+ ]
36
+
37
+ let pagination: any = { page: parseInt(page), limit: parseInt(limit) }
38
+
39
+ let data = {
40
+ result: (
41
+ await client.query({
42
+ query: gql`
43
+ query deliveryOrders($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
44
+ deliveryOrders(filters: $filters, pagination: $pagination, sortings: $sortings) {
45
+ items {
46
+ name
47
+ from
48
+ to
49
+ contactPointRefId
50
+ truckNo
51
+ deliveryDate
52
+ status
53
+ ownCollection
54
+ looseItem
55
+ deliveryDateTime
56
+ loadWeight
57
+ cargoType
58
+ urgency
59
+ telNo
60
+ refNo
61
+ otherDriver
62
+ palletQty
63
+ remark
64
+ description
65
+ reusablePallet
66
+ domain {
67
+ name
68
+ }
69
+ bizplace {
70
+ name
71
+ }
72
+ attachments {
73
+ name
74
+ refBy
75
+ path
76
+ }
77
+ releaseGood {
78
+ name
79
+ description
80
+ refNo
81
+ collectionOrderNo
82
+ truckNo
83
+ exportOption
84
+ ownTransport
85
+ crossDocking
86
+ status
87
+ releaseDateTime
88
+ releaseDate
89
+ remark
90
+ courierOption
91
+ packingOption
92
+ refNo2
93
+ refNo3
94
+ type
95
+ acceptedAt
96
+ marketplaceOrderStatus
97
+ billingAddress
98
+ deliveryAddress1
99
+ deliveryAddress2
100
+ deliveryAddress3
101
+ deliveryAddress4
102
+ deliveryAddress5
103
+ attentionTo
104
+ attentionCompany
105
+ city
106
+ state
107
+ postalCode
108
+ country
109
+ phone1
110
+ phone2
111
+ email
112
+ transporter
113
+ trackingNo
114
+ airwayBill
115
+ invoice
116
+ pickupAddress
117
+ pickupTime
118
+ handoverType
119
+ dropoffAddress
120
+ noOfItems
121
+ orderProducts {
122
+ id
123
+ type
124
+ batchId
125
+ packingType
126
+ packingSize
127
+ releaseQty
128
+ releaseUomValue
129
+ status
130
+ }
131
+ }
132
+ createdAt
133
+ updatedAt
134
+ updater {
135
+ name
136
+ }
137
+ }
138
+ total
139
+ }
140
+ }
141
+ `,
142
+ variables: {
143
+ filters,
144
+ pagination,
145
+ sortings: [{ name: 'createdAt', desc: true }]
146
+ },
147
+ context: {
148
+ ...context,
149
+ state: {
150
+ ...context.state,
151
+ bizplace,
152
+ domain
153
+ }
154
+ }
155
+ } as any)
156
+ ).data
157
+ }
158
+
159
+ context.body = data?.result?.deliveryOrders?.items?.length == 0 ? 'No data available' : data
160
+ })
161
+ }
162
+ )
@@ -0,0 +1,118 @@
1
+ import gql from 'graphql-tag'
2
+ import { EntityManager, getConnection } from 'typeorm'
3
+
4
+ import { restfulApiRouter as router } from '@things-factory/api'
5
+
6
+ import { businessMiddleware } from '../../../../middlewares/business-middleware'
7
+ import { warehouseMiddleware } from '../../../../middlewares/warehouse-middleware'
8
+
9
+ const debug = require('debug')('things-factory:operato-hub:restful-api:unstable:get-goods-received-notes')
10
+
11
+ router.get(
12
+ '/unstable/warehouse/:warehouseId/get-goods-received-notes',
13
+ businessMiddleware,
14
+ warehouseMiddleware,
15
+ async (context, next) => {
16
+ return await getConnection().transaction(async (tx: EntityManager) => {
17
+ const { client, warehouse: bizplace, domain } = context.state
18
+ const { warehouseId: customerBizplaceId } = context.params
19
+ const { t } = context
20
+
21
+ const { fromDate, toDate, limit = 10, page = 1 } = context.query
22
+
23
+ if (!customerBizplaceId) context.throw(404, t('Error: Warehouse id not found'))
24
+ if (!fromDate || !toDate) context.throw(400, t('Error: Date range not provided correctly'))
25
+ if (limit > 100 || limit < 0) context.throw(400, t('Error: Limit value exceed 100 maximum threshold'))
26
+
27
+ let noOfDays = (new Date(toDate).getTime() - new Date(fromDate).getTime()) / (1000 * 3600 * 24)
28
+ if (noOfDays >= 31 || noOfDays <= 0)
29
+ context.throw(400, t('Error: Date range value exceed 1 month maximum threshold'))
30
+
31
+ let filters: any = [
32
+ { name: 'bizplace', operator: 'in', value: [customerBizplaceId], relation: true },
33
+ { name: 'createdAt', operator: 'between', value: [fromDate, toDate] },
34
+ { name: 'orderProductsApi', operator: 'equal', value: true }
35
+ ]
36
+
37
+ let pagination: any = { page: parseInt(page), limit: parseInt(limit) }
38
+
39
+ let data = {
40
+ result: (
41
+ await client.query({
42
+ query: gql`
43
+ query goodsReceivalNotes($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
44
+ goodsReceivalNotes(filters: $filters, pagination: $pagination, sortings: $sortings) {
45
+ items {
46
+ id
47
+ name
48
+ refNo
49
+ description
50
+ customerStatus
51
+ status
52
+ domain {
53
+ id
54
+ name
55
+ }
56
+ arrivalNotice {
57
+ id
58
+ name
59
+ description
60
+ status
61
+ refNo
62
+ refNo2
63
+ refNo3
64
+ orderProducts {
65
+ id
66
+ type
67
+ batchId
68
+ packingType
69
+ packingSize
70
+ releaseQty
71
+ releaseUomValue
72
+ status
73
+ }
74
+ }
75
+ bizplace {
76
+ id
77
+ name
78
+ description
79
+ }
80
+ attachments {
81
+ id
82
+ name
83
+ refBy
84
+ path
85
+ }
86
+ createdAt
87
+ updatedAt
88
+ updater {
89
+ id
90
+ name
91
+ description
92
+ }
93
+ }
94
+ total
95
+ }
96
+ }
97
+ `,
98
+ variables: {
99
+ filters,
100
+ pagination,
101
+ sortings: [{ name: 'createdAt', desc: true }]
102
+ },
103
+ context: {
104
+ ...context,
105
+ state: {
106
+ ...context.state,
107
+ bizplace,
108
+ domain
109
+ }
110
+ }
111
+ } as any)
112
+ ).data
113
+ }
114
+
115
+ context.body = data?.result?.goodsReceivalNotes?.items?.length == 0 ? 'No data available' : data
116
+ })
117
+ }
118
+ )
@@ -27,3 +27,5 @@ import './set-marketplace-order-failed-delivery'
27
27
  import './update-marketplace-order'
28
28
  import './update-marketplace-shipping-order'
29
29
  import './update-release-order-details'
30
+ import './get-goods-received-notes'
31
+ import './get-delivery-orders'