@things-factory/worksheet-base 5.0.0-alpha.4 → 5.0.0-alpha.40
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/constants/template.js +1 -0
- package/dist-server/constants/template.js.map +1 -1
- package/dist-server/controllers/ecommerce/sellercraft-controller.js +9 -3
- package/dist-server/controllers/ecommerce/sellercraft-controller.js.map +1 -1
- package/dist-server/controllers/inbound/unloading-worksheet-controller.js +309 -4
- package/dist-server/controllers/inbound/unloading-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/index.js +2 -0
- package/dist-server/controllers/index.js.map +1 -1
- package/dist-server/controllers/outbound/loading-worksheet-controller.js +10 -0
- package/dist-server/controllers/outbound/loading-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/outbound/packing-worksheet-controller.js +172 -7
- package/dist-server/controllers/outbound/packing-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/outbound/picking-worksheet-controller.js +352 -11
- package/dist-server/controllers/outbound/picking-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/outbound/returning-worksheet-controller.js +11 -1
- package/dist-server/controllers/outbound/returning-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/outbound/sorting-worksheet-controller.js +110 -3
- package/dist-server/controllers/outbound/sorting-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/render-fm-grn.js +229 -0
- package/dist-server/controllers/render-fm-grn.js.map +1 -0
- package/dist-server/controllers/render-grn.js +45 -21
- package/dist-server/controllers/render-grn.js.map +1 -1
- package/dist-server/controllers/render-invoices.js +103 -65
- package/dist-server/controllers/render-invoices.js.map +1 -1
- package/dist-server/controllers/render-orientage-do.js.map +1 -1
- package/dist-server/controllers/render-orientage-grn.js +1 -0
- package/dist-server/controllers/render-orientage-grn.js.map +1 -1
- package/dist-server/controllers/render-po.js +147 -0
- package/dist-server/controllers/render-po.js.map +1 -0
- package/dist-server/controllers/render-ro-do.js +65 -1
- package/dist-server/controllers/render-ro-do.js.map +1 -1
- package/dist-server/controllers/worksheet-controller.js +15 -0
- package/dist-server/controllers/worksheet-controller.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/cycle-count-adjustment.js +10 -3
- package/dist-server/graphql/resolvers/worksheet/cycle-count-adjustment.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/find-release-orders-by-task-no.js +30 -1
- package/dist-server/graphql/resolvers/worksheet/find-release-orders-by-task-no.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/generate-worksheet/generate-arrival-notice-worksheet.js +27 -23
- package/dist-server/graphql/resolvers/worksheet/generate-worksheet/generate-arrival-notice-worksheet.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/inventories-by-pallet.js +3 -0
- package/dist-server/graphql/resolvers/worksheet/inventories-by-pallet.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/loading/complete-loading.js +26 -2
- package/dist-server/graphql/resolvers/worksheet/loading/complete-loading.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/packing/index.js +2 -1
- package/dist-server/graphql/resolvers/worksheet/packing/index.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/packing/packing.js +4 -4
- package/dist-server/graphql/resolvers/worksheet/packing/packing.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/packing/scan-product-packing.js +4 -4
- package/dist-server/graphql/resolvers/worksheet/packing/scan-product-packing.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/packing/undo-serial-number-packing.js +15 -0
- package/dist-server/graphql/resolvers/worksheet/packing/undo-serial-number-packing.js.map +1 -0
- package/dist-server/graphql/resolvers/worksheet/packing-worksheet.js +152 -132
- package/dist-server/graphql/resolvers/worksheet/packing-worksheet.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/picking/assign-picking-worker.js +13 -10
- package/dist-server/graphql/resolvers/worksheet/picking/assign-picking-worker.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/picking/complete-picking.js +6 -19
- package/dist-server/graphql/resolvers/worksheet/picking/complete-picking.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/picking/index.js +2 -1
- package/dist-server/graphql/resolvers/worksheet/picking/index.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/picking/picking-assignment-status-by-user.js +49 -58
- package/dist-server/graphql/resolvers/worksheet/picking/picking-assignment-status-by-user.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/picking/undo-serial-number-picking.js +15 -0
- package/dist-server/graphql/resolvers/worksheet/picking/undo-serial-number-picking.js.map +1 -0
- package/dist-server/graphql/resolvers/worksheet/sorting/scan-product-sorting.js +4 -4
- package/dist-server/graphql/resolvers/worksheet/sorting/scan-product-sorting.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/sorting/sorting-product.js +4 -4
- package/dist-server/graphql/resolvers/worksheet/sorting/sorting-product.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/sorting-worksheet.js +6 -0
- package/dist-server/graphql/resolvers/worksheet/sorting-worksheet.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/unloaded-inventories.js +3 -2
- package/dist-server/graphql/resolvers/worksheet/unloaded-inventories.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/unloading/index.js +3 -1
- package/dist-server/graphql/resolvers/worksheet/unloading/index.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/unloading/scan-serial-number-unload.js +15 -0
- package/dist-server/graphql/resolvers/worksheet/unloading/scan-serial-number-unload.js.map +1 -0
- package/dist-server/graphql/resolvers/worksheet/unloading/undo-serial-number-unload.js +15 -0
- package/dist-server/graphql/resolvers/worksheet/unloading/undo-serial-number-unload.js.map +1 -0
- package/dist-server/graphql/resolvers/worksheet/unloading/unload.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/unloading-worksheet.js +3 -1
- package/dist-server/graphql/resolvers/worksheet/unloading-worksheet.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/worksheets.js +18 -0
- package/dist-server/graphql/resolvers/worksheet/worksheets.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet-detail/generate-batch-picking-worksheet-details-by-bulk.js +4 -5
- package/dist-server/graphql/resolvers/worksheet-detail/generate-batch-picking-worksheet-details-by-bulk.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet-detail/generate-picking-worksheet-details.js +4 -2
- package/dist-server/graphql/resolvers/worksheet-detail/generate-picking-worksheet-details.js.map +1 -1
- package/dist-server/graphql/types/worksheet/find-release-orders-by-task-no.js +11 -0
- package/dist-server/graphql/types/worksheet/find-release-orders-by-task-no.js.map +1 -0
- package/dist-server/graphql/types/worksheet/index.js +33 -6
- package/dist-server/graphql/types/worksheet/index.js.map +1 -1
- package/dist-server/graphql/types/worksheet/picking-assignment-status.js +2 -2
- package/dist-server/graphql/types/worksheet/worksheet-detail-info.js +3 -0
- package/dist-server/graphql/types/worksheet/worksheet-detail-info.js.map +1 -1
- package/dist-server/graphql/types/worksheet/worksheet-info.js +1 -0
- package/dist-server/graphql/types/worksheet/worksheet-info.js.map +1 -1
- package/dist-server/graphql/types/worksheet/worksheet-patch.js +1 -0
- package/dist-server/graphql/types/worksheet/worksheet-patch.js.map +1 -1
- package/dist-server/graphql/types/worksheet-detail/index.js +0 -2
- package/dist-server/graphql/types/worksheet-detail/index.js.map +1 -1
- package/dist-server/index.js +5 -0
- package/dist-server/index.js.map +1 -1
- package/dist-server/routes.js +12 -0
- package/dist-server/routes.js.map +1 -1
- package/dist-server/utils/inventory-util.js +14 -25
- package/dist-server/utils/inventory-util.js.map +1 -1
- package/package.json +17 -17
- package/server/constants/template.ts +1 -0
- package/server/controllers/ecommerce/sellercraft-controller.ts +10 -3
- package/server/controllers/inbound/unloading-worksheet-controller.ts +376 -8
- package/server/controllers/index.ts +3 -0
- package/server/controllers/outbound/loading-worksheet-controller.ts +13 -0
- package/server/controllers/outbound/packing-worksheet-controller.ts +224 -9
- package/server/controllers/outbound/picking-worksheet-controller.ts +465 -16
- package/server/controllers/outbound/returning-worksheet-controller.ts +12 -1
- package/server/controllers/outbound/sorting-worksheet-controller.ts +149 -4
- package/server/controllers/render-fm-grn.ts +266 -0
- package/server/controllers/render-grn.ts +57 -23
- package/server/controllers/render-invoices.ts +119 -72
- package/server/controllers/render-orientage-do.ts +11 -11
- package/server/controllers/render-orientage-grn.ts +12 -11
- package/server/controllers/render-po.ts +170 -0
- package/server/controllers/render-ro-do.ts +93 -8
- package/server/controllers/worksheet-controller.ts +18 -2
- package/server/graphql/resolvers/worksheet/cycle-count-adjustment.ts +13 -4
- package/server/graphql/resolvers/worksheet/find-release-orders-by-task-no.ts +35 -2
- package/server/graphql/resolvers/worksheet/generate-worksheet/generate-arrival-notice-worksheet.ts +35 -25
- package/server/graphql/resolvers/worksheet/inventories-by-pallet.ts +2 -0
- package/server/graphql/resolvers/worksheet/loading/complete-loading.ts +41 -8
- package/server/graphql/resolvers/worksheet/packing/index.ts +3 -1
- package/server/graphql/resolvers/worksheet/packing/packing.ts +5 -4
- package/server/graphql/resolvers/worksheet/packing/scan-product-packing.ts +9 -4
- package/server/graphql/resolvers/worksheet/packing/undo-serial-number-packing.ts +24 -0
- package/server/graphql/resolvers/worksheet/packing-worksheet.ts +167 -145
- package/server/graphql/resolvers/worksheet/picking/assign-picking-worker.ts +15 -11
- package/server/graphql/resolvers/worksheet/picking/complete-picking.ts +5 -20
- package/server/graphql/resolvers/worksheet/picking/index.ts +3 -1
- package/server/graphql/resolvers/worksheet/picking/picking-assignment-status-by-user.ts +62 -61
- package/server/graphql/resolvers/worksheet/picking/undo-serial-number-picking.ts +24 -0
- package/server/graphql/resolvers/worksheet/sorting/scan-product-sorting.ts +5 -4
- package/server/graphql/resolvers/worksheet/sorting/sorting-product.ts +5 -4
- package/server/graphql/resolvers/worksheet/sorting-worksheet.ts +6 -0
- package/server/graphql/resolvers/worksheet/unloaded-inventories.ts +6 -2
- package/server/graphql/resolvers/worksheet/unloading/index.ts +4 -0
- package/server/graphql/resolvers/worksheet/unloading/scan-serial-number-unload.ts +26 -0
- package/server/graphql/resolvers/worksheet/unloading/undo-serial-number-unload.ts +24 -0
- package/server/graphql/resolvers/worksheet/unloading/unload.ts +3 -1
- package/server/graphql/resolvers/worksheet/unloading-worksheet.ts +3 -1
- package/server/graphql/resolvers/worksheet/worksheets.ts +26 -0
- package/server/graphql/resolvers/worksheet-detail/generate-batch-picking-worksheet-details-by-bulk.ts +10 -12
- package/server/graphql/resolvers/worksheet-detail/generate-picking-worksheet-details.ts +4 -2
- package/server/graphql/types/worksheet/find-release-orders-by-task-no.ts +8 -0
- package/server/graphql/types/worksheet/index.ts +33 -6
- package/server/graphql/types/worksheet/picking-assignment-status.ts +2 -2
- package/server/graphql/types/worksheet/worksheet-detail-info.ts +3 -0
- package/server/graphql/types/worksheet/worksheet-info.ts +1 -0
- package/server/graphql/types/worksheet/worksheet-patch.ts +1 -0
- package/server/graphql/types/worksheet-detail/index.ts +0 -2
- package/server/index.ts +5 -0
- package/server/routes.ts +17 -0
- package/server/utils/inventory-util.ts +15 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/worksheet-base",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.40",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -24,21 +24,21 @@
|
|
|
24
24
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@things-factory/auth-base": "^5.0.0-alpha.
|
|
28
|
-
"@things-factory/biz-base": "^5.0.0-alpha.
|
|
29
|
-
"@things-factory/document-template-base": "^5.0.0-alpha.
|
|
30
|
-
"@things-factory/id-rule-base": "^5.0.0-alpha.
|
|
31
|
-
"@things-factory/integration-lmd": "^5.0.0-alpha.
|
|
32
|
-
"@things-factory/integration-marketplace": "^5.0.0-alpha.
|
|
33
|
-
"@things-factory/integration-sellercraft": "^5.0.0-alpha.
|
|
34
|
-
"@things-factory/integration-sftp": "^5.0.0-alpha.
|
|
35
|
-
"@things-factory/marketplace-base": "^5.0.0-alpha.
|
|
36
|
-
"@things-factory/notification": "^5.0.0-alpha.
|
|
37
|
-
"@things-factory/sales-base": "^5.0.0-alpha.
|
|
38
|
-
"@things-factory/setting-base": "^5.0.0-alpha.
|
|
39
|
-
"@things-factory/shell": "^5.0.0-alpha.
|
|
40
|
-
"@things-factory/transport-base": "^5.0.0-alpha.
|
|
41
|
-
"@things-factory/warehouse-base": "^5.0.0-alpha.
|
|
27
|
+
"@things-factory/auth-base": "^5.0.0-alpha.40",
|
|
28
|
+
"@things-factory/biz-base": "^5.0.0-alpha.40",
|
|
29
|
+
"@things-factory/document-template-base": "^5.0.0-alpha.40",
|
|
30
|
+
"@things-factory/id-rule-base": "^5.0.0-alpha.40",
|
|
31
|
+
"@things-factory/integration-lmd": "^5.0.0-alpha.40",
|
|
32
|
+
"@things-factory/integration-marketplace": "^5.0.0-alpha.40",
|
|
33
|
+
"@things-factory/integration-sellercraft": "^5.0.0-alpha.40",
|
|
34
|
+
"@things-factory/integration-sftp": "^5.0.0-alpha.40",
|
|
35
|
+
"@things-factory/marketplace-base": "^5.0.0-alpha.40",
|
|
36
|
+
"@things-factory/notification": "^5.0.0-alpha.40",
|
|
37
|
+
"@things-factory/sales-base": "^5.0.0-alpha.40",
|
|
38
|
+
"@things-factory/setting-base": "^5.0.0-alpha.40",
|
|
39
|
+
"@things-factory/shell": "^5.0.0-alpha.40",
|
|
40
|
+
"@things-factory/transport-base": "^5.0.0-alpha.40",
|
|
41
|
+
"@things-factory/warehouse-base": "^5.0.0-alpha.40"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "c64462e85c9b744250f5649d28c0ec4bd56a1b38"
|
|
44
44
|
}
|
|
@@ -160,6 +160,7 @@ export class SellercraftController extends WorksheetController {
|
|
|
160
160
|
|
|
161
161
|
let inventories: Inventory[] = await qb.getMany()
|
|
162
162
|
let inventoryTotalQty: number = 0
|
|
163
|
+
let inventoryTotalLockedQty: number = 0
|
|
163
164
|
|
|
164
165
|
let defaultProductDetail: ProductDetail = product.productDetails.find(productDetail => productDetail.isDefault)
|
|
165
166
|
|
|
@@ -177,12 +178,17 @@ export class SellercraftController extends WorksheetController {
|
|
|
177
178
|
packingSize = await this.getChildPackingSize(productDetails, defaultProductDetail, unmatchingProductDetail)
|
|
178
179
|
}
|
|
179
180
|
|
|
180
|
-
return {
|
|
181
|
+
return { totalQty: inventory.qty * packingSize, totalLockedQty: inventory.lockedQty * packingSize }
|
|
181
182
|
})
|
|
182
183
|
)
|
|
183
184
|
|
|
184
185
|
inventoryTotalQty = sellercraftInvs.reduce((total, currentValue) => {
|
|
185
|
-
total += currentValue.
|
|
186
|
+
total += currentValue.totalQty
|
|
187
|
+
return total
|
|
188
|
+
}, 0)
|
|
189
|
+
|
|
190
|
+
inventoryTotalQty = sellercraftInvs.reduce((total, currentValue) => {
|
|
191
|
+
total += currentValue.totalLockedQty
|
|
186
192
|
return total
|
|
187
193
|
}, 0)
|
|
188
194
|
}
|
|
@@ -192,7 +198,8 @@ export class SellercraftController extends WorksheetController {
|
|
|
192
198
|
sku: product.sku,
|
|
193
199
|
gtin: defaultProductDetail.gtin,
|
|
194
200
|
stock: {
|
|
195
|
-
|
|
201
|
+
quantity_total: inventoryTotalQty,
|
|
202
|
+
quantity_reserved: inventoryTotalLockedQty,
|
|
196
203
|
unit_of_measure: 'EA'
|
|
197
204
|
},
|
|
198
205
|
package_weight_gm: defaultProductDetail.nettWeight < 1 ? 1 : defaultProductDetail.nettWeight,
|
|
@@ -20,11 +20,14 @@ import {
|
|
|
20
20
|
VAS_TYPES
|
|
21
21
|
} from '@things-factory/sales-base'
|
|
22
22
|
import { Domain } from '@things-factory/shell'
|
|
23
|
+
import { PartnerSetting, Setting } from '@things-factory/setting-base'
|
|
23
24
|
import {
|
|
24
25
|
Inventory,
|
|
26
|
+
INVENTORY_ITEM_SOURCE,
|
|
25
27
|
INVENTORY_STATUS,
|
|
26
28
|
INVENTORY_TRANSACTION_TYPE,
|
|
27
29
|
InventoryHistory,
|
|
30
|
+
InventoryItem,
|
|
28
31
|
InventoryNoGenerator,
|
|
29
32
|
Location,
|
|
30
33
|
Pallet,
|
|
@@ -33,7 +36,7 @@ import {
|
|
|
33
36
|
|
|
34
37
|
import { RULE_TYPE, WORKSHEET_STATUS, WORKSHEET_TYPE } from '../../constants'
|
|
35
38
|
import { Worksheet, WorksheetDetail } from '../../entities'
|
|
36
|
-
import { DateGenerator } from '../../utils'
|
|
39
|
+
import { DateGenerator, generateInventoryHistory } from '../../utils'
|
|
37
40
|
import { VasWorksheetController } from '../vas/vas-worksheet-controller'
|
|
38
41
|
|
|
39
42
|
export type UnloadingWorksheetDetail = Partial<WorksheetDetail> & {
|
|
@@ -98,6 +101,10 @@ export class UnloadingWorksheetController extends VasWorksheetController {
|
|
|
98
101
|
]
|
|
99
102
|
})
|
|
100
103
|
if (!worksheetDetail) throw new Error(this.ERROR_MSG.FIND.NO_RESULT(worksheetDetailName))
|
|
104
|
+
const targetProduct: OrderProduct = worksheetDetail.targetProduct
|
|
105
|
+
|
|
106
|
+
if (targetProduct.status == ORDER_PRODUCT_STATUS.EDITED)
|
|
107
|
+
throw new Error('this product is pending for changes approval')
|
|
101
108
|
|
|
102
109
|
const bizplace: Bizplace = worksheetDetail.bizplace
|
|
103
110
|
const companyDomain: Domain = bizplace?.company?.domain
|
|
@@ -105,7 +112,6 @@ export class UnloadingWorksheetController extends VasWorksheetController {
|
|
|
105
112
|
const arrivalNotice: ArrivalNotice = worksheet.arrivalNotice
|
|
106
113
|
const returnOrder: ReturnOrder = worksheet.returnOrder
|
|
107
114
|
const orderId: string = Boolean(arrivalNotice?.id) ? arrivalNotice.id : returnOrder.id
|
|
108
|
-
const targetProduct: OrderProduct = worksheetDetail.targetProduct
|
|
109
115
|
const targetInventory: OrderInventory = worksheetDetail?.targetInventory
|
|
110
116
|
const originInventory: OrderInventory = targetInventory ? targetInventory.inventory : null
|
|
111
117
|
const batchId: string = Boolean(arrivalNotice) ? targetProduct.batchId : targetInventory.batchId
|
|
@@ -241,6 +247,193 @@ export class UnloadingWorksheetController extends VasWorksheetController {
|
|
|
241
247
|
}
|
|
242
248
|
}
|
|
243
249
|
|
|
250
|
+
async scanSerialNumberUnload(
|
|
251
|
+
worksheetDetailName: string,
|
|
252
|
+
serialNumber: string,
|
|
253
|
+
inventory: Partial<Inventory>
|
|
254
|
+
): Promise<void> {
|
|
255
|
+
const worksheetDetail: WorksheetDetail = await this.trxMgr.getRepository(WorksheetDetail).findOne({
|
|
256
|
+
where: {
|
|
257
|
+
name: worksheetDetailName,
|
|
258
|
+
status: Not(Equal(WORKSHEET_STATUS.DEACTIVATED))
|
|
259
|
+
},
|
|
260
|
+
relations: [
|
|
261
|
+
'bizplace',
|
|
262
|
+
'worksheet',
|
|
263
|
+
'worksheet.arrivalNotice',
|
|
264
|
+
'worksheet.returnOrder',
|
|
265
|
+
'worksheet.bufferLocation',
|
|
266
|
+
'worksheet.bufferLocation.warehouse',
|
|
267
|
+
'targetProduct',
|
|
268
|
+
'targetProduct.product',
|
|
269
|
+
'targetProduct.product.productDetails',
|
|
270
|
+
'targetProduct.product.productDetails.childProductDetail',
|
|
271
|
+
'targetInventory',
|
|
272
|
+
'targetInventory.product',
|
|
273
|
+
'targetInventory.product.productDetails',
|
|
274
|
+
'targetInventory.product.productDetails.childProductDetail'
|
|
275
|
+
]
|
|
276
|
+
})
|
|
277
|
+
if (!worksheetDetail) throw new Error(this.ERROR_MSG.FIND.NO_RESULT(worksheetDetailName))
|
|
278
|
+
|
|
279
|
+
if (!inventory?.palletId)
|
|
280
|
+
inventory.palletId = await generateId({
|
|
281
|
+
domain: this.domain,
|
|
282
|
+
type: RULE_TYPE.LOT_NUMBER_ID,
|
|
283
|
+
seed: { date: DateGenerator.generateDate() }
|
|
284
|
+
})
|
|
285
|
+
|
|
286
|
+
const targetProduct: OrderProduct = worksheetDetail.targetProduct
|
|
287
|
+
|
|
288
|
+
if (targetProduct.status == ORDER_PRODUCT_STATUS.EDITED)
|
|
289
|
+
throw new Error('this product is pending for changes approval')
|
|
290
|
+
|
|
291
|
+
const bizplace: Bizplace = worksheetDetail.bizplace
|
|
292
|
+
const worksheet: Worksheet = worksheetDetail.worksheet
|
|
293
|
+
const arrivalNotice: ArrivalNotice = worksheet.arrivalNotice
|
|
294
|
+
const returnOrder: ReturnOrder = worksheet.returnOrder
|
|
295
|
+
const targetInventory: OrderInventory = worksheetDetail.targetInventory
|
|
296
|
+
const product: Product = Boolean(arrivalNotice) ? targetProduct.product : targetInventory.product
|
|
297
|
+
const packingType: string = Boolean(arrivalNotice) ? targetProduct.packingType : targetInventory.packingType
|
|
298
|
+
const packingSize: number = Boolean(arrivalNotice) ? targetProduct.packingSize : targetInventory.packingSize
|
|
299
|
+
const batchId: string = Boolean(arrivalNotice) ? targetProduct.batchId : targetInventory.batchId
|
|
300
|
+
let qty: number = 0
|
|
301
|
+
let uom: string = Boolean(arrivalNotice) ? targetProduct.uom : targetInventory.uom
|
|
302
|
+
const cartonId: string = inventory.cartonId
|
|
303
|
+
const orderId: string = Boolean(arrivalNotice) ? arrivalNotice.id : returnOrder.id
|
|
304
|
+
await this.checkSerialNumberDuplication(serialNumber, product)
|
|
305
|
+
|
|
306
|
+
qty++
|
|
307
|
+
|
|
308
|
+
const invQb: SelectQueryBuilder<Inventory> = await this.trxMgr
|
|
309
|
+
.getRepository(Inventory)
|
|
310
|
+
.createQueryBuilder('INV')
|
|
311
|
+
.where('INV.domain_id = :domainId', { domainId: this.domain.id })
|
|
312
|
+
.andWhere('INV.bizplace_id = :bizplaceId', { bizplaceId: bizplace.id })
|
|
313
|
+
.andWhere('INV.product_id = :productId', { productId: product.id })
|
|
314
|
+
.andWhere('INV.batch_id = :batchId', { batchId: batchId })
|
|
315
|
+
.andWhere('INV.packing_type = :packingType', { packingType: packingType })
|
|
316
|
+
.andWhere('INV.packing_size = :packingSize', { packingSize: packingSize })
|
|
317
|
+
|
|
318
|
+
if (arrivalNotice) invQb.andWhere('INV.ref_order_id = :arrivalNoticeId', { arrivalNoticeId: arrivalNotice.id })
|
|
319
|
+
else if (returnOrder) invQb.andWhere('INV.ref_order_id = :returnOrderId', { returnOrderId: returnOrder.id })
|
|
320
|
+
|
|
321
|
+
if (inventory?.expirationDate) {
|
|
322
|
+
invQb.andWhere('INV.expiration_date = :expirationDate', {
|
|
323
|
+
expirationDate: inventory.expirationDate
|
|
324
|
+
})
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if (inventory?.cartonId) invQb.andWhere('INV.carton_id = :cartonId', { cartonId: inventory.cartonId })
|
|
328
|
+
else invQb.andWhere('INV.pallet_id = :palletId', { palletId: inventory.palletId })
|
|
329
|
+
|
|
330
|
+
let foundInventory: Inventory = await invQb.getOne()
|
|
331
|
+
|
|
332
|
+
const batchIdRef: string = Boolean(arrivalNotice) ? targetProduct.batchIdRef : null
|
|
333
|
+
const remark: string = Boolean(arrivalNotice) ? targetProduct.remark : targetInventory.remark
|
|
334
|
+
const manufactureDate: number = Boolean(arrivalNotice) ? targetProduct.manufactureDate : null
|
|
335
|
+
const location: Location = worksheet.bufferLocation
|
|
336
|
+
const warehouse: Warehouse = location.warehouse
|
|
337
|
+
const zone: string = location.zone
|
|
338
|
+
const unitCost: number = Boolean(arrivalNotice)
|
|
339
|
+
? targetProduct?.unitPrice
|
|
340
|
+
? ((targetProduct.packQty * targetProduct.unitPrice + targetProduct.miscAmt - targetProduct.discountAmt) *
|
|
341
|
+
(1 + targetProduct.taxRate / 100)) /
|
|
342
|
+
targetProduct.packQty
|
|
343
|
+
: 0
|
|
344
|
+
: null
|
|
345
|
+
|
|
346
|
+
if (!foundInventory) {
|
|
347
|
+
let newInventory: Partial<Inventory> = new Inventory()
|
|
348
|
+
newInventory.bizplace = bizplace
|
|
349
|
+
newInventory.domain = this.domain
|
|
350
|
+
newInventory.name = InventoryNoGenerator.inventoryName()
|
|
351
|
+
newInventory.palletId = inventory.palletId
|
|
352
|
+
newInventory.cartonId = inventory.cartonId
|
|
353
|
+
newInventory.batchId = batchId
|
|
354
|
+
newInventory.batchIdRef = batchIdRef
|
|
355
|
+
newInventory.product = product
|
|
356
|
+
newInventory.packingType = packingType
|
|
357
|
+
newInventory.packingSize = packingSize
|
|
358
|
+
newInventory.uom = uom
|
|
359
|
+
newInventory.remark = remark
|
|
360
|
+
newInventory.qty = qty
|
|
361
|
+
newInventory.uomValue =
|
|
362
|
+
Math.round(
|
|
363
|
+
qty *
|
|
364
|
+
(Boolean(arrivalNotice)
|
|
365
|
+
? targetProduct.uomValue
|
|
366
|
+
: targetInventory.returnUomValue / targetInventory.returnQty) *
|
|
367
|
+
100
|
|
368
|
+
) / 100
|
|
369
|
+
newInventory.manufactureDate = manufactureDate
|
|
370
|
+
newInventory.refOrderId = orderId
|
|
371
|
+
newInventory.unitCost = unitCost
|
|
372
|
+
if (inventory.reusablePallet?.id) {
|
|
373
|
+
newInventory.reusablePallet = await this.trxMgr.getRepository(Pallet).findOne(inventory.reusablePallet.id)
|
|
374
|
+
}
|
|
375
|
+
newInventory.orderProductId = Boolean(arrivalNotice) ? targetProduct.id : null
|
|
376
|
+
newInventory.orderInventoryId = Boolean(returnOrder) ? targetInventory.id : null
|
|
377
|
+
newInventory.warehouse = warehouse
|
|
378
|
+
newInventory.location = location
|
|
379
|
+
newInventory.zone = zone
|
|
380
|
+
newInventory.status = INVENTORY_STATUS.CHECKED
|
|
381
|
+
newInventory.creator = this.user
|
|
382
|
+
|
|
383
|
+
if (inventory?.expirationDate) {
|
|
384
|
+
newInventory.expirationDate = new Date(inventory.expirationDate)
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
if (arrivalNotice) {
|
|
388
|
+
targetProduct.actualPalletQty++
|
|
389
|
+
targetProduct.actualPackQty = Boolean(targetProduct.actualPackQty) ? targetProduct.actualPackQty + qty : qty
|
|
390
|
+
} else if (returnOrder) {
|
|
391
|
+
targetInventory.actualPalletQty++
|
|
392
|
+
targetInventory.actualPackQty = Boolean(targetInventory.actualPackQty)
|
|
393
|
+
? targetInventory.actualPackQty + qty
|
|
394
|
+
: qty
|
|
395
|
+
}
|
|
396
|
+
foundInventory = await this.trxMgr.getRepository(Inventory).save(newInventory)
|
|
397
|
+
} else {
|
|
398
|
+
const updatedQty: number = foundInventory.qty + qty
|
|
399
|
+
foundInventory.expirationDate = new Date(foundInventory.expirationDate)
|
|
400
|
+
foundInventory.qty = updatedQty
|
|
401
|
+
foundInventory.uomValue +=
|
|
402
|
+
Math.round(
|
|
403
|
+
qty *
|
|
404
|
+
(Boolean(arrivalNotice)
|
|
405
|
+
? targetProduct.uomValue
|
|
406
|
+
: targetInventory.returnUomValue / targetInventory.returnQty) *
|
|
407
|
+
100
|
|
408
|
+
) / 100
|
|
409
|
+
if (arrivalNotice) targetProduct.actualPackQty = targetProduct.actualPackQty + qty
|
|
410
|
+
else if (returnOrder) targetInventory.actualPackQty = targetInventory.actualPackQty + qty
|
|
411
|
+
foundInventory = await this.trxMgr.getRepository(Inventory).save(foundInventory)
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
let inventoryItem: InventoryItem = new InventoryItem()
|
|
415
|
+
inventoryItem.name = InventoryNoGenerator.inventoryItemName()
|
|
416
|
+
inventoryItem.serialNumber = serialNumber
|
|
417
|
+
inventoryItem.status = foundInventory.status
|
|
418
|
+
inventoryItem.inboundOrderId = foundInventory.refOrderId
|
|
419
|
+
inventoryItem.product = product
|
|
420
|
+
inventoryItem.inventory = foundInventory
|
|
421
|
+
inventoryItem.source = INVENTORY_ITEM_SOURCE.INBOUND
|
|
422
|
+
inventoryItem.domain = this.domain
|
|
423
|
+
inventoryItem.creator = this.user
|
|
424
|
+
inventoryItem.updater = this.user
|
|
425
|
+
|
|
426
|
+
await this.trxMgr.getRepository(InventoryItem).save(inventoryItem)
|
|
427
|
+
|
|
428
|
+
if (arrivalNotice) {
|
|
429
|
+
targetProduct.updater = this.user
|
|
430
|
+
this.updateOrderTargets([targetProduct])
|
|
431
|
+
} else if (returnOrder) {
|
|
432
|
+
targetInventory.updater = this.user
|
|
433
|
+
this.updateOrderTargets([targetInventory])
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
244
437
|
async scanProductUnload(
|
|
245
438
|
worksheetDetailName: string,
|
|
246
439
|
productBarcode: string,
|
|
@@ -277,11 +470,15 @@ export class UnloadingWorksheetController extends VasWorksheetController {
|
|
|
277
470
|
seed: { date: DateGenerator.generateDate() }
|
|
278
471
|
})
|
|
279
472
|
|
|
473
|
+
const targetProduct: OrderProduct = worksheetDetail.targetProduct
|
|
474
|
+
|
|
475
|
+
if (targetProduct.status == ORDER_PRODUCT_STATUS.EDITED)
|
|
476
|
+
throw new Error('this product is pending for changes approval')
|
|
477
|
+
|
|
280
478
|
const bizplace: Bizplace = worksheetDetail.bizplace
|
|
281
479
|
const worksheet: Worksheet = worksheetDetail.worksheet
|
|
282
480
|
const arrivalNotice: ArrivalNotice = worksheet.arrivalNotice
|
|
283
481
|
const returnOrder: ReturnOrder = worksheet.returnOrder
|
|
284
|
-
const targetProduct: OrderProduct = worksheetDetail.targetProduct
|
|
285
482
|
const targetInventory: OrderInventory = worksheetDetail.targetInventory
|
|
286
483
|
const product: Product = Boolean(arrivalNotice) ? targetProduct.product : targetInventory.product
|
|
287
484
|
const packingType: string = Boolean(arrivalNotice) ? targetProduct.packingType : targetInventory.packingType
|
|
@@ -561,6 +758,7 @@ export class UnloadingWorksheetController extends VasWorksheetController {
|
|
|
561
758
|
targetProduct.status = ORDER_PRODUCT_STATUS.UNLOADING
|
|
562
759
|
} else {
|
|
563
760
|
targetProduct.actualPackQty--
|
|
761
|
+
// targetProduct.actualPalletQty--
|
|
564
762
|
}
|
|
565
763
|
targetProduct.updater = this.user
|
|
566
764
|
await this.updateOrderTargets([targetProduct])
|
|
@@ -587,6 +785,7 @@ export class UnloadingWorksheetController extends VasWorksheetController {
|
|
|
587
785
|
targetInventory.status = ORDER_PRODUCT_STATUS.UNLOADING
|
|
588
786
|
} else {
|
|
589
787
|
targetInventory.actualPackQty--
|
|
788
|
+
// targetInventory.actualPalletQty--
|
|
590
789
|
}
|
|
591
790
|
targetInventory.updater = this.user
|
|
592
791
|
await this.updateOrderTargets([targetInventory])
|
|
@@ -656,6 +855,60 @@ export class UnloadingWorksheetController extends VasWorksheetController {
|
|
|
656
855
|
}
|
|
657
856
|
}
|
|
658
857
|
|
|
858
|
+
async undoSerialNumberUnload(worksheetDetailName: string, inventoryItemId: string): Promise<void> {
|
|
859
|
+
const worksheetDetail: WorksheetDetail = await this.trxMgr.getRepository(WorksheetDetail).findOne({
|
|
860
|
+
where: { name: worksheetDetailName, domain: this.domain, status: Not(Equal(WORKSHEET_STATUS.DEACTIVATED)) },
|
|
861
|
+
relations: [
|
|
862
|
+
'worksheet',
|
|
863
|
+
'worksheet.arrivalNotice',
|
|
864
|
+
'worksheet.returnOrder',
|
|
865
|
+
'targetProduct',
|
|
866
|
+
'targetProduct.product'
|
|
867
|
+
]
|
|
868
|
+
})
|
|
869
|
+
|
|
870
|
+
let worksheet: Worksheet = worksheetDetail.worksheet
|
|
871
|
+
let arrivalNotice: ArrivalNotice = worksheet.arrivalNotice
|
|
872
|
+
let returnOrder: ReturnOrder = worksheet.returnOrder
|
|
873
|
+
let targetInventory: OrderInventory = worksheetDetail.targetInventory
|
|
874
|
+
let targetProduct: OrderProduct = worksheetDetail.targetProduct
|
|
875
|
+
let inventoryItem: InventoryItem = await this.trxMgr.getRepository(InventoryItem).findOne({
|
|
876
|
+
where: { domain: this.domain, id: inventoryItemId },
|
|
877
|
+
relations: ['inventory', 'product']
|
|
878
|
+
})
|
|
879
|
+
let inventory: Inventory = inventoryItem.inventory
|
|
880
|
+
|
|
881
|
+
await this.trxMgr.getRepository(InventoryItem).delete(inventoryItem.id)
|
|
882
|
+
|
|
883
|
+
inventory.qty--
|
|
884
|
+
inventory.uomValue =
|
|
885
|
+
Math.round(
|
|
886
|
+
inventory.qty *
|
|
887
|
+
(Boolean(arrivalNotice)
|
|
888
|
+
? targetProduct.uomValue
|
|
889
|
+
: targetInventory.returnUomValue / targetInventory.returnQty) *
|
|
890
|
+
100
|
|
891
|
+
) / 100
|
|
892
|
+
await this.trxMgr
|
|
893
|
+
.getRepository(Inventory)
|
|
894
|
+
.update({ id: inventory.id }, { qty: inventory.qty, uomValue: inventory.uomValue })
|
|
895
|
+
|
|
896
|
+
targetProduct.actualPackQty--
|
|
897
|
+
|
|
898
|
+
const inventoryItems: InventoryItem[] = await this.trxMgr.getRepository(InventoryItem).find({
|
|
899
|
+
where: { domain: this.domain, inboundOrderId: arrivalNotice.id, inventory }
|
|
900
|
+
})
|
|
901
|
+
|
|
902
|
+
if (inventoryItems?.length == 0) {
|
|
903
|
+
await this.trxMgr.getRepository(Inventory).delete(inventory.id)
|
|
904
|
+
|
|
905
|
+
targetProduct.actualPalletQty--
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
targetProduct.updater = this.user
|
|
909
|
+
await this.updateOrderTargets([targetProduct])
|
|
910
|
+
}
|
|
911
|
+
|
|
659
912
|
async activateUnloading(
|
|
660
913
|
worksheetNo: string,
|
|
661
914
|
unloadingWorksheetDetails: UnloadingWorksheetDetail[]
|
|
@@ -715,6 +968,70 @@ export class UnloadingWorksheetController extends VasWorksheetController {
|
|
|
715
968
|
return worksheet
|
|
716
969
|
}
|
|
717
970
|
|
|
971
|
+
async getProductScanningVal(arrivalNotice: ArrivalNotice) {
|
|
972
|
+
let productScanning: string = 'false'
|
|
973
|
+
const enableProductScanning: Setting = await this.trxMgr.getRepository(Setting).findOne({
|
|
974
|
+
where: { domain: this.domain, category: 'id-rule', name: 'enable-product-scanning' }
|
|
975
|
+
})
|
|
976
|
+
|
|
977
|
+
if (enableProductScanning) productScanning = enableProductScanning.value
|
|
978
|
+
|
|
979
|
+
const partnerEnableProductScanning: PartnerSetting = await this.trxMgr.getRepository(PartnerSetting).findOne({
|
|
980
|
+
where: { setting: enableProductScanning, domain: this.domain, partnerDomain: arrivalNotice.bizplace?.domain }
|
|
981
|
+
})
|
|
982
|
+
|
|
983
|
+
if (partnerEnableProductScanning) productScanning = partnerEnableProductScanning.value
|
|
984
|
+
|
|
985
|
+
return productScanning
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
async getInputQtyVal(arrivalNotice: ArrivalNotice) {
|
|
989
|
+
let inputQty: string = 'false'
|
|
990
|
+
const enableInputQty: Setting = await this.trxMgr.getRepository(Setting).findOne({
|
|
991
|
+
where: { domain: this.domain, category: 'id-rule', name: 'enable-input-qty' }
|
|
992
|
+
})
|
|
993
|
+
|
|
994
|
+
if (enableInputQty) inputQty = enableInputQty.value
|
|
995
|
+
|
|
996
|
+
const partnerEnableInputQty: PartnerSetting = await this.trxMgr.getRepository(PartnerSetting).findOne({
|
|
997
|
+
where: { setting: enableInputQty, domain: this.domain, partnerDomain: arrivalNotice.bizplace?.domain }
|
|
998
|
+
})
|
|
999
|
+
|
|
1000
|
+
if (partnerEnableInputQty) inputQty = partnerEnableInputQty.value
|
|
1001
|
+
|
|
1002
|
+
return inputQty
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
// only creates inventory history upon partial or full unload when
|
|
1006
|
+
// productScanning is true
|
|
1007
|
+
// inputQty is false
|
|
1008
|
+
async createInventoryHistory(arrivalNotice: ArrivalNotice, inventories?: Inventory[]) {
|
|
1009
|
+
try {
|
|
1010
|
+
if (inventories === undefined) {
|
|
1011
|
+
const inventoryList = await this.trxMgr.getRepository(Inventory).findAndCount({
|
|
1012
|
+
where: {
|
|
1013
|
+
domain: this.domain,
|
|
1014
|
+
refOrderId: arrivalNotice.id
|
|
1015
|
+
}
|
|
1016
|
+
})
|
|
1017
|
+
|
|
1018
|
+
inventories = inventoryList[0]
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
for (const inventory of inventories) {
|
|
1022
|
+
await this.transactionInventory(
|
|
1023
|
+
inventory,
|
|
1024
|
+
arrivalNotice,
|
|
1025
|
+
inventory.qty,
|
|
1026
|
+
inventory.uomValue,
|
|
1027
|
+
INVENTORY_TRANSACTION_TYPE.UNLOADING
|
|
1028
|
+
)
|
|
1029
|
+
}
|
|
1030
|
+
} catch (e) {
|
|
1031
|
+
throw e
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
|
|
718
1035
|
async completeUnloading(
|
|
719
1036
|
arrivalNoticeNo: string,
|
|
720
1037
|
unloadingWorksheetDetails: Partial<WorksheetDetail>[]
|
|
@@ -722,7 +1039,7 @@ export class UnloadingWorksheetController extends VasWorksheetController {
|
|
|
722
1039
|
let arrivalNotice: ArrivalNotice = await this.findRefOrder(
|
|
723
1040
|
ArrivalNotice,
|
|
724
1041
|
{ domain: this.domain, name: arrivalNoticeNo, status: In([ORDER_STATUS.PROCESSING, ORDER_STATUS.PUTTING_AWAY]) },
|
|
725
|
-
['orderProducts', 'releaseGood']
|
|
1042
|
+
['orderProducts', 'releaseGood', 'bizplace', 'bizplace.domain']
|
|
726
1043
|
)
|
|
727
1044
|
|
|
728
1045
|
if (arrivalNotice.crossDocking) {
|
|
@@ -785,6 +1102,47 @@ export class UnloadingWorksheetController extends VasWorksheetController {
|
|
|
785
1102
|
await this.completeWorksheet(worksheet)
|
|
786
1103
|
}
|
|
787
1104
|
|
|
1105
|
+
const productScanning = await this.getProductScanningVal(arrivalNotice)
|
|
1106
|
+
const inputQty = await this.getInputQtyVal(arrivalNotice)
|
|
1107
|
+
if (productScanning === 'true' && inputQty === 'false') await this.createInventoryHistory(arrivalNotice)
|
|
1108
|
+
|
|
1109
|
+
const inventories: Inventory[] = await this.trxMgr.getRepository(Inventory).find({
|
|
1110
|
+
where: {
|
|
1111
|
+
domain: this.domain,
|
|
1112
|
+
refOrderId: arrivalNotice.id,
|
|
1113
|
+
status: In([INVENTORY_STATUS.UNLOADED, INVENTORY_STATUS.CHECKED])
|
|
1114
|
+
},
|
|
1115
|
+
relations: ['domain', 'bizplace', 'product', 'warehouse', 'location']
|
|
1116
|
+
})
|
|
1117
|
+
|
|
1118
|
+
for (let inventory of inventories) {
|
|
1119
|
+
let inventoryItems: InventoryItem[] = await this.trxMgr.getRepository(InventoryItem).find({
|
|
1120
|
+
where: { domain: this.domain, inventory }
|
|
1121
|
+
})
|
|
1122
|
+
|
|
1123
|
+
if (inventoryItems?.length) {
|
|
1124
|
+
inventory.status = INVENTORY_STATUS.STORED
|
|
1125
|
+
|
|
1126
|
+
await Promise.all(
|
|
1127
|
+
inventoryItems.map(async inventoryItem => {
|
|
1128
|
+
await this.trxMgr
|
|
1129
|
+
.getRepository(InventoryItem)
|
|
1130
|
+
.update({ id: inventoryItem.id }, { status: INVENTORY_STATUS.STORED })
|
|
1131
|
+
})
|
|
1132
|
+
)
|
|
1133
|
+
|
|
1134
|
+
await generateInventoryHistory(
|
|
1135
|
+
inventory,
|
|
1136
|
+
arrivalNotice,
|
|
1137
|
+
INVENTORY_TRANSACTION_TYPE.UNLOADING,
|
|
1138
|
+
inventory.qty,
|
|
1139
|
+
inventory.uomValue,
|
|
1140
|
+
this.user,
|
|
1141
|
+
this.trxMgr
|
|
1142
|
+
)
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
|
|
788
1146
|
let vasWorksheet: Worksheet = await this.trxMgr.getRepository(Worksheet).findOne({
|
|
789
1147
|
where: {
|
|
790
1148
|
arrivalNotice,
|
|
@@ -828,10 +1186,15 @@ export class UnloadingWorksheetController extends VasWorksheetController {
|
|
|
828
1186
|
arrivalNoticeNo: string,
|
|
829
1187
|
unloadingWorksheetDetail: Partial<WorksheetDetail>[]
|
|
830
1188
|
): Promise<Worksheet> {
|
|
831
|
-
const arrivalNotice: ArrivalNotice = await this.findRefOrder(
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
1189
|
+
const arrivalNotice: ArrivalNotice = await this.findRefOrder(
|
|
1190
|
+
ArrivalNotice,
|
|
1191
|
+
{
|
|
1192
|
+
domain: this.domain,
|
|
1193
|
+
name: arrivalNoticeNo,
|
|
1194
|
+
status: In([ORDER_STATUS.PROCESSING, ORDER_STATUS.PUTTING_AWAY])
|
|
1195
|
+
},
|
|
1196
|
+
['bizplace', 'bizplace.domain']
|
|
1197
|
+
)
|
|
835
1198
|
|
|
836
1199
|
const worksheet: Worksheet = await this.findWorksheetByRefOrder(arrivalNotice, WORKSHEET_TYPE.UNLOADING, [
|
|
837
1200
|
'worksheetDetails',
|
|
@@ -870,6 +1233,11 @@ export class UnloadingWorksheetController extends VasWorksheetController {
|
|
|
870
1233
|
})
|
|
871
1234
|
await this.trxMgr.getRepository(Inventory).save(inventories)
|
|
872
1235
|
|
|
1236
|
+
const productScanning = await this.getProductScanningVal(arrivalNotice)
|
|
1237
|
+
const inputQty = await this.getInputQtyVal(arrivalNotice)
|
|
1238
|
+
if (productScanning === 'true' && inputQty === 'false')
|
|
1239
|
+
await this.createInventoryHistory(arrivalNotice, inventories)
|
|
1240
|
+
|
|
873
1241
|
let vasWorksheet: Worksheet = await this.trxMgr.getRepository(Worksheet).findOne({
|
|
874
1242
|
where: {
|
|
875
1243
|
arrivalNotice,
|
|
@@ -7,7 +7,10 @@ export * from './render-kimeda-grn'
|
|
|
7
7
|
export * from './render-orientage-grn'
|
|
8
8
|
export * from './render-orientage-do'
|
|
9
9
|
export * from './render-seebuu-grn'
|
|
10
|
+
export * from './render-fm-grn'
|
|
10
11
|
export * from './render-manifest'
|
|
12
|
+
export * from './render-po'
|
|
13
|
+
|
|
11
14
|
|
|
12
15
|
/* Worksheet Controllers */
|
|
13
16
|
export * from './worksheet-controller'
|
|
@@ -118,6 +118,15 @@ export class LoadingWorksheetController extends VasWorksheetController {
|
|
|
118
118
|
const pickedQty: number = targetInventory.releaseQty
|
|
119
119
|
let inventory: Inventory = targetInventory.inventory
|
|
120
120
|
|
|
121
|
+
targetInventory.loadedAt = new Date()
|
|
122
|
+
targetInventory.loadedByUser = this.user;
|
|
123
|
+
|
|
124
|
+
let loadedBy: string[] = targetInventory.loadedBy ? (targetInventory.loadedBy).split(',') : []
|
|
125
|
+
if (!loadedBy.find(x => x == this.user.name)) {
|
|
126
|
+
loadedBy.push(this.user.name)
|
|
127
|
+
targetInventory.loadedBy = loadedBy.join(',')
|
|
128
|
+
}
|
|
129
|
+
|
|
121
130
|
if (loadedQty > pickedQty) {
|
|
122
131
|
throw new Error(this.ERROR_MSG.VALIDITY.CANT_PROCEED_STEP_BY('load', `loaded quantity can't exceed picked qty`))
|
|
123
132
|
} else if (loadedQty == pickedQty) {
|
|
@@ -205,6 +214,10 @@ export class LoadingWorksheetController extends VasWorksheetController {
|
|
|
205
214
|
undoTargetOrderInventory.deliveryOrder = null
|
|
206
215
|
undoTargetOrderInventory.updater = this.user
|
|
207
216
|
|
|
217
|
+
undoTargetOrderInventory.loadedAt = null
|
|
218
|
+
undoTargetOrderInventory.loadedByUser = null
|
|
219
|
+
undoTargetOrderInventory.loadedBy = null
|
|
220
|
+
|
|
208
221
|
let prevTargetInventory: OrderInventory = await this.trxMgr.getRepository(OrderInventory).findOne({
|
|
209
222
|
where: {
|
|
210
223
|
domain: this.domain,
|