@things-factory/worksheet-base 4.3.430 → 4.3.434
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-server/controllers/outbound/picking-worksheet-controller.js +36 -30
- package/dist-server/controllers/outbound/picking-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/render-manual-do.js +4 -0
- package/dist-server/controllers/render-manual-do.js.map +1 -1
- package/dist-server/controllers/render-ro-do.js +5 -1
- package/dist-server/controllers/render-ro-do.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/delivery-order-by-worksheet.js +2 -0
- package/dist-server/graphql/resolvers/worksheet/delivery-order-by-worksheet.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/picking/complete-batch-picking.js +60 -62
- package/dist-server/graphql/resolvers/worksheet/picking/complete-batch-picking.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/worksheet.js +1 -1
- package/dist-server/graphql/resolvers/worksheet/worksheet.js.map +1 -1
- package/dist-server/graphql/types/worksheet/delivery-order-info.js +2 -0
- package/dist-server/graphql/types/worksheet/delivery-order-info.js.map +1 -1
- package/dist-server/utils/lmd-util.js +3 -2
- package/dist-server/utils/lmd-util.js.map +1 -1
- package/package.json +20 -20
- package/server/controllers/outbound/picking-worksheet-controller.ts +4 -0
- package/server/controllers/render-manual-do.ts +4 -0
- package/server/controllers/render-ro-do.ts +4 -0
- package/server/graphql/resolvers/worksheet/delivery-order-by-worksheet.ts +2 -0
- package/server/graphql/resolvers/worksheet/picking/complete-batch-picking.ts +28 -45
- package/server/graphql/types/worksheet/delivery-order-info.ts +2 -0
- package/server/utils/lmd-util.ts +3 -2
|
@@ -372,6 +372,7 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
372
372
|
break
|
|
373
373
|
|
|
374
374
|
default:
|
|
375
|
+
if (!releaseGood?.orderPackages?.length){
|
|
375
376
|
let orderPackage: OrderPackage = {
|
|
376
377
|
name: OrderNoGenerator.orderPackage(),
|
|
377
378
|
packageId: null,
|
|
@@ -387,6 +388,7 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
387
388
|
updater: releaseGood.updater
|
|
388
389
|
}
|
|
389
390
|
await createOrderPackageAndItems(this.trxMgr, releaseGood, orderPackage)
|
|
391
|
+
}
|
|
390
392
|
break
|
|
391
393
|
}
|
|
392
394
|
} catch (error) {
|
|
@@ -2631,6 +2633,7 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
2631
2633
|
break
|
|
2632
2634
|
|
|
2633
2635
|
default:
|
|
2636
|
+
if(!releaseGood?.orderPackages?.length){
|
|
2634
2637
|
let orderPackage: OrderPackage = {
|
|
2635
2638
|
name: OrderNoGenerator.orderPackage(),
|
|
2636
2639
|
packageId: null,
|
|
@@ -2646,6 +2649,7 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
2646
2649
|
updater: releaseGood.updater
|
|
2647
2650
|
}
|
|
2648
2651
|
await createOrderPackageAndItems(this.trxMgr, releaseGood, orderPackage)
|
|
2652
|
+
}
|
|
2649
2653
|
break
|
|
2650
2654
|
}
|
|
2651
2655
|
} catch (e) {
|
|
@@ -101,10 +101,13 @@ export async function renderManualDO({ doNo }, context: any) {
|
|
|
101
101
|
|
|
102
102
|
// #8. find truck driver name
|
|
103
103
|
let foundDriver: any = null
|
|
104
|
+
let foundDriverCode: any = null
|
|
104
105
|
if (foundDO?.ownCollection && foundDO?.otherDriver) {
|
|
105
106
|
foundDriver = foundDO.otherDriver
|
|
107
|
+
foundDriverCode = foundDO.otherDriverCode
|
|
106
108
|
} else {
|
|
107
109
|
foundDriver = foundDO.transportDriver.name
|
|
110
|
+
foundDriverCode = foundDO.transportDriver.driverCode
|
|
108
111
|
}
|
|
109
112
|
|
|
110
113
|
// #9. get product data
|
|
@@ -207,6 +210,7 @@ export async function renderManualDO({ doNo }, context: any) {
|
|
|
207
210
|
delivery_date: foundDO.deliveryDate || '',
|
|
208
211
|
truck_no: foundDO.truckNo,
|
|
209
212
|
driver_name: foundDriver || '',
|
|
213
|
+
driver_code: foundDriverCode || '',
|
|
210
214
|
pallet_qty: foundDO.palletQty,
|
|
211
215
|
worker_name: '',
|
|
212
216
|
do_remark: foundDO.remark,
|
|
@@ -151,11 +151,14 @@ export async function renderRODO({ doNo }, context: any) {
|
|
|
151
151
|
})
|
|
152
152
|
|
|
153
153
|
let foundDriver: any = null
|
|
154
|
+
let foundDriverCode: any = null
|
|
154
155
|
if (foundDO.status !== ORDER_STATUS.READY_TO_DISPATCH) {
|
|
155
156
|
if (foundDO?.ownCollection && foundDO?.otherDriver) {
|
|
156
157
|
foundDriver = foundDO.otherDriver
|
|
158
|
+
foundDriverCode = foundDO.otherDriverCode
|
|
157
159
|
} else {
|
|
158
160
|
foundDriver = foundDO?.transportDriver?.name
|
|
161
|
+
foundDriverCode = foundDO?.transportDriver?.driverCode
|
|
159
162
|
}
|
|
160
163
|
}
|
|
161
164
|
|
|
@@ -382,6 +385,7 @@ export async function renderRODO({ doNo }, context: any) {
|
|
|
382
385
|
ro_created_date: DateTimeConverter.date(foundRO.createdAt),
|
|
383
386
|
truck_no: foundDO.truckNo,
|
|
384
387
|
driver_name: foundDriver || '',
|
|
388
|
+
driver_code: foundDriverCode || '',
|
|
385
389
|
pallet_qty: foundDO.palletQty,
|
|
386
390
|
worker_name: foundWS.updater.name,
|
|
387
391
|
do_remark: foundDO.remark,
|
|
@@ -78,9 +78,11 @@ export const deliveryOrderByWorksheetResolver = {
|
|
|
78
78
|
deliverTo: foundDO.contactPointRefId || '',
|
|
79
79
|
deliveryDate: foundDO.deliveryDate || '',
|
|
80
80
|
driverName: foundTransportDriver.name,
|
|
81
|
+
driverCode: foundTransportDriver.driverCode,
|
|
81
82
|
otherDestination: foundDO.otherDestination || false,
|
|
82
83
|
contactName: foundDO.contactName || '',
|
|
83
84
|
otherDriver: foundDO.otherDriver || '',
|
|
85
|
+
otherDriverCode: foundDO.otherDriverCode || '',
|
|
84
86
|
looseItem: foundDO.looseItem || false,
|
|
85
87
|
remark: foundDO.remark || '',
|
|
86
88
|
reusablePallet: foundDO.reusablePallet || '',
|
|
@@ -1,29 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EntityManager,
|
|
3
|
-
getManager,
|
|
4
|
-
In
|
|
5
|
-
} from 'typeorm'
|
|
1
|
+
import { EntityManager, getManager, In } from 'typeorm'
|
|
6
2
|
|
|
7
|
-
import {
|
|
8
|
-
ApplicationType,
|
|
9
|
-
User
|
|
10
|
-
} from '@things-factory/auth-base'
|
|
3
|
+
import { ApplicationType, User } from '@things-factory/auth-base'
|
|
11
4
|
import { logger } from '@things-factory/env'
|
|
12
5
|
import { Account } from '@things-factory/integration-accounting'
|
|
13
6
|
import { sqsSendMessage } from '@things-factory/integration-base'
|
|
14
7
|
import { MarketplaceStore } from '@things-factory/integration-marketplace'
|
|
15
8
|
import { Powrup } from '@things-factory/integration-powrup'
|
|
16
|
-
import {
|
|
17
|
-
Sellercraft,
|
|
18
|
-
SellercraftStatus
|
|
19
|
-
} from '@things-factory/integration-sellercraft'
|
|
9
|
+
import { Sellercraft, SellercraftStatus } from '@things-factory/integration-sellercraft'
|
|
20
10
|
import { MarketplaceOrder } from '@things-factory/marketplace-base'
|
|
21
11
|
import {
|
|
22
12
|
ORDER_STATUS,
|
|
23
13
|
OrderInventory,
|
|
24
14
|
OrderNoGenerator,
|
|
25
15
|
OrderPackage,
|
|
26
|
-
OrderPackageItem,
|
|
27
16
|
PowrupController,
|
|
28
17
|
ReleaseGood
|
|
29
18
|
} from '@things-factory/sales-base'
|
|
@@ -39,10 +28,7 @@ import {
|
|
|
39
28
|
SortingWorksheetController
|
|
40
29
|
} from '../../../../controllers/'
|
|
41
30
|
import { EcommerceController } from '../../../../controllers/ecommerce'
|
|
42
|
-
import {
|
|
43
|
-
Worksheet,
|
|
44
|
-
WorksheetDetail
|
|
45
|
-
} from '../../../../entities'
|
|
31
|
+
import { Worksheet, WorksheetDetail } from '../../../../entities'
|
|
46
32
|
|
|
47
33
|
export const completeBatchPickingResolver = {
|
|
48
34
|
async completeBatchPicking(_: any, { taskNo }, context: any) {
|
|
@@ -167,7 +153,6 @@ export async function completeBatchPicking(
|
|
|
167
153
|
if (rtsTriggerLevel && parseInt(rtsTriggerLevel?.value || 0) == 1) {
|
|
168
154
|
await sellercraftCtrl.initiateOrderShipment(sellercraft, foundReleaseGood)
|
|
169
155
|
}
|
|
170
|
-
|
|
171
156
|
})
|
|
172
157
|
}
|
|
173
158
|
|
|
@@ -220,7 +205,7 @@ export async function completeBatchPicking(
|
|
|
220
205
|
break
|
|
221
206
|
|
|
222
207
|
default:
|
|
223
|
-
if(!foundReleaseGood?.orderPackages?.length){
|
|
208
|
+
if (!foundReleaseGood?.orderPackages?.length) {
|
|
224
209
|
let orderPackage: OrderPackage = {
|
|
225
210
|
name: OrderNoGenerator.orderPackage(),
|
|
226
211
|
packageId: null,
|
|
@@ -234,8 +219,9 @@ export async function completeBatchPicking(
|
|
|
234
219
|
creator: foundReleaseGood.creator,
|
|
235
220
|
updater: foundReleaseGood.updater
|
|
236
221
|
}
|
|
237
|
-
|
|
238
|
-
|
|
222
|
+
|
|
223
|
+
await createOrderPackageAndItems(tx, foundReleaseGood, orderPackage)
|
|
224
|
+
}
|
|
239
225
|
break
|
|
240
226
|
}
|
|
241
227
|
|
|
@@ -309,35 +295,32 @@ export async function completeBatchPicking(
|
|
|
309
295
|
} catch (e) {
|
|
310
296
|
logger.error(`[get-lmd-awb-sof-trigger]: ${e}`)
|
|
311
297
|
}
|
|
312
|
-
//
|
|
313
298
|
}
|
|
314
|
-
//
|
|
315
|
-
}
|
|
316
299
|
|
|
317
|
-
|
|
318
|
-
|
|
300
|
+
// generate packing worksheet based on orders WITH packing option
|
|
301
|
+
const pickPackOrders: ReleaseGood[] = uniqueReleaseGoods.filter(rg => rg.packingOption)
|
|
319
302
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
303
|
+
if (pickPackOrders?.length) {
|
|
304
|
+
const roNoList: string[] = pickPackOrders.map((rg: ReleaseGood) => rg.name)
|
|
305
|
+
const packingWSCtrl: PackingWorksheetController = new PackingWorksheetController(tx, domain, user)
|
|
306
|
+
await packingWSCtrl.generatePackingWorksheetByBulk(roNoList)
|
|
307
|
+
}
|
|
325
308
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
309
|
+
// generate packing worksheet with orderInventory based on orders WITHOUT packing option
|
|
310
|
+
const pickSortTargetInventories: OrderInventory[] = targetInventories
|
|
311
|
+
.filter(targetInventory => !targetInventory.releaseGood.packingOption)
|
|
312
|
+
.map((pickSortTargetInventory: OrderInventory) => {
|
|
313
|
+
return pickSortTargetInventory
|
|
314
|
+
})
|
|
332
315
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
316
|
+
// loop to generate sorting worksheet
|
|
317
|
+
if (pickSortTargetInventories?.length) {
|
|
318
|
+
const sortingWSCtrl: SortingWorksheetController = new SortingWorksheetController(tx, domain, user)
|
|
319
|
+
await sortingWSCtrl.generateSortingWorksheet(worksheet, pickSortTargetInventories)
|
|
320
|
+
}
|
|
338
321
|
|
|
339
|
-
|
|
340
|
-
|
|
322
|
+
return false
|
|
323
|
+
}
|
|
341
324
|
} else {
|
|
342
325
|
let foundObsoleteInventories: any = worksheet
|
|
343
326
|
await tx.getRepository(Inventory).update({ id: In(foundObsoleteInventories) }, { obsolete: true })
|
|
@@ -10,9 +10,11 @@ export const DeliveryOrderInfo = gql`
|
|
|
10
10
|
deliverTo: String
|
|
11
11
|
deliveryDate: String
|
|
12
12
|
driverName: String
|
|
13
|
+
driverCode: String
|
|
13
14
|
otherDestination: Boolean
|
|
14
15
|
contactName: String
|
|
15
16
|
otherDriver: String
|
|
17
|
+
otherDriverCode: String
|
|
16
18
|
looseItem: Boolean
|
|
17
19
|
remark: String
|
|
18
20
|
reusablePallet: String
|
package/server/utils/lmd-util.ts
CHANGED
|
@@ -93,8 +93,9 @@ export async function createLmdParcel(releaseGoods, tx, domain, user, marketplac
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
if (lmd?.platform == 'CITYLINK') {
|
|
96
|
-
const currentDate = new Date()
|
|
97
|
-
|
|
96
|
+
const currentDate = new Date()
|
|
97
|
+
let expiredDate = new Date(lmd?.expiresIn)
|
|
98
|
+
if (currentDate > expiredDate) {
|
|
98
99
|
let lastMileDelivery = await getAccessTokenCityLink(lmd?.id, { state: { tx } })
|
|
99
100
|
lmd.accessToken = lastMileDelivery.accessToken
|
|
100
101
|
}
|