@things-factory/sales-base 4.3.23 → 4.3.26

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.
@@ -11,22 +11,19 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- var __importDefault = (this && this.__importDefault) || function (mod) {
15
- return (mod && mod.__esModule) ? mod : { "default": mod };
16
- };
17
14
  Object.defineProperty(exports, "__esModule", { value: true });
18
15
  exports.ShippingOrderMutation = void 0;
19
16
  const biz_base_1 = require("@things-factory/biz-base");
20
17
  const type_graphql_1 = require("type-graphql");
21
18
  const typeorm_1 = require("typeorm");
22
- const v4_1 = __importDefault(require("uuid/v4"));
19
+ const uuid_1 = require("uuid");
23
20
  const __1 = require("../");
24
21
  const shipping_order_1 = require("./shipping-order");
25
22
  let ShippingOrderMutation = class ShippingOrderMutation {
26
23
  async createShippingOrder(shippingOrder, context) {
27
24
  const { tx } = context.state;
28
25
  const repository = tx.getRepository(shipping_order_1.ShippingOrder);
29
- const newShippingOrder = Object.assign({ id: (0, v4_1.default)() }, shippingOrder);
26
+ const newShippingOrder = Object.assign({ id: (0, uuid_1.v4)() }, shippingOrder);
30
27
  return await repository.save(newShippingOrder);
31
28
  }
32
29
  async updateShippingOrder(name, patch, context) {
@@ -1 +1 @@
1
- {"version":3,"file":"shipping-order-mutation.js","sourceRoot":"","sources":["../../../server/service/shipping-order/shipping-order-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,uDAAkE;AAElE,+CAAsE;AACtE,qCAA2C;AAC3C,iDAA0B;AAC1B,2BAA0D;AAC1D,qDAAgD;AAGhD,IAAa,qBAAqB,GAAlC,MAAa,qBAAqB;IAGhC,KAAK,CAAC,mBAAmB,CACyB,aAA+B,EACxE,OAAY;QAEnB,MAAM,EAAE,EAAE,EAAE,GAA0B,OAAO,CAAC,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gB,CAAC,CAAA;IAC9C,WAAA,IAAA,kBAAG,GAAE,CAAA;;qCADyD,oBAAgB;;gEAYhF;AAID;IAFC,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,8BAAa,CAAC;IAEhC,WAAA,IAAA,kBAAG,EAAC,MAAM,CAAC,CAAA;IACX,WAAA,IAAA,kBAAG,EAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,sBAAkB,CAAC,CAAA;IACxC,WAAA,IAAA,kBAAG,GAAE,CAAA;;6CAD2C,sBAAkB;;gEAkBpE;AAID;IAFC,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC;IACF,WAAA,IAAA,kBAAG,EAAC,MAAM,CAAC,CAAA;IAAgB,WAAA,IAAA,kBAAG,GAAE,CAAA;;;;gEAK1D;AAjDU,qBAAqB;IADjC,IAAA,uBAAQ,EAAC,8BAAa,CAAC;GACX,qBAAqB,CAkDjC;AAlDY,sDAAqB"}
1
+ {"version":3,"file":"shipping-order-mutation.js","sourceRoot":"","sources":["../../../server/service/shipping-order/shipping-order-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,uDAAkE;AAElE,+CAAsE;AACtE,qCAA2C;AAC3C,+BAAmC;AACnC,2BAA0D;AAC1D,qDAAgD;AAGhD,IAAa,qBAAqB,GAAlC,MAAa,qBAAqB;IAGhC,KAAK,CAAC,mBAAmB,CACyB,aAA+B,EACxE,OAAY;QAEnB,MAAM,EAAE,EAAE,EAAE,GAA0B,OAAO,CAAC,KAAK,CAAA;QAEnD,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,8BAAa,CAAC,CAAA;QAClD,MAAM,gBAAgB,mBACpB,EAAE,EAAE,IAAA,SAAM,GAAE,IACT,aAAa,CACjB,CAAA;QAED,OAAO,MAAM,UAAU,CAAC,IAAI,CAA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IAAA,kBAAG,EAAC,MAAM,CAAC,CAAA;IACX,WAAA,IAAA,kBAAG,EAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,sBAAkB,CAAC,CAAA;IACxC,WAAA,IAAA,kBAAG,GAAE,CAAA;;6CAD2C,sBAAkB;;gEAkBpE;AAID;IAFC,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC;IACF,WAAA,IAAA,kBAAG,EAAC,MAAM,CAAC,CAAA;IAAgB,WAAA,IAAA,kBAAG,GAAE,CAAA;;;;gEAK1D;AAjDU,qBAAqB;IADjC,IAAA,uBAAQ,EAAC,8BAAa,CAAC;GACX,qBAAqB,CAkDjC;AAlDY,sDAAqB"}
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.OrderNoGenerator = void 0;
7
- const v4_1 = __importDefault(require("uuid/v4"));
4
+ const uuid_1 = require("uuid");
8
5
  class OrderNoGenerator {
9
6
  static arrivalNotice() {
10
7
  const currentDate = new Date();
@@ -35,19 +32,19 @@ class OrderNoGenerator {
35
32
  return `LM-${currentDate.getFullYear()}${currentDate.getMonth() + 1}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`;
36
33
  }
37
34
  static orderInventory() {
38
- return (0, v4_1.default)();
35
+ return (0, uuid_1.v4)();
39
36
  }
40
37
  static orderProduct() {
41
- return `OP-${(0, v4_1.default)()}`;
38
+ return `OP-${(0, uuid_1.v4)()}`;
42
39
  }
43
40
  static invoiceProduct() {
44
- return `IP-${(0, v4_1.default)()}`;
41
+ return `IP-${(0, uuid_1.v4)()}`;
45
42
  }
46
43
  static orderVas() {
47
- return `OV-${(0, v4_1.default)()}`;
44
+ return `OV-${(0, uuid_1.v4)()}`;
48
45
  }
49
46
  static orderToteItem() {
50
- return `OTI-${(0, v4_1.default)()}`;
47
+ return `OTI-${(0, uuid_1.v4)()}`;
51
48
  }
52
49
  static purchaseOrder() {
53
50
  const currentDate = new Date();
@@ -62,7 +59,7 @@ class OrderNoGenerator {
62
59
  return `ODO-${currentDate.getFullYear()}${currentDate.getMonth() + 1}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`;
63
60
  }
64
61
  static releaseVas() {
65
- return (0, v4_1.default)();
62
+ return (0, uuid_1.v4)();
66
63
  }
67
64
  static retailReplenishmentOrder() {
68
65
  const currentDate = new Date();
@@ -1 +1 @@
1
- {"version":3,"file":"order-no-generator.js","sourceRoot":"","sources":["../../server/utils/order-no-generator.ts"],"names":[],"mappings":";;;;;;AAAA,iDAA0B;AAE1B,MAAa,gBAAgB;IAC3B,MAAM,CAAC,aAAa;QAClB,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAA;QAC9B,OAAO,OAAO,WAAW,CAAC,WAAW,EAAE,GAAG,WAAW,CAAC,QAAQ,EAAE,GAAG,CACjE,GAAG,WAAW,CAAC,OAAO,EAAE,GAAG,WAAW,CAAC,QAAQ,EAAE,GAAG,WAAW,CAAC,UAAU,EAAE,GAAG,WAAW,CAAC,UAAU,EAAE,GAAG,WAAW,CAAC,eAAe,EAAE,EAAE,CAAA;IAC7I,CAAC;IAED,MAAM,CAAC,eAAe;QACpB,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAA;QAC9B,OAAO,MAAM,WAAW,CAAC,WAAW,EAAE,GAAG,WAAW,CAAC,QAAQ,EAAE,GAAG,CAChE,GAAG,WAAW,CAAC,OAAO,EAAE,GAAG,WAAW,CAAC,QAAQ,EAAE,GAAG,WAAW,CAAC,UAAU,EAAE,GAAG,WAAW,CAAC,UAAU,EAAE,GAAG,WAAW,CAAC,eAAe,EAAE,EAAE,C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AAC,QAAQ,EAAE,GAAG,WAAW,CAAC,UAAU,EAAE,GAAG,WAAW,CAAC,UAAU,EAAE,GAAG,WAAW,CAAC,eAAe,EAAE,EAAE,CAAA;IAC3I,CAAC;IAED,MAAM,CAAC,QAAQ;QACb,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAA;QAC9B,OAAO,MAAM,WAAW,CAAC,WAAW,EAAE,GACpC,WAAW,CAAC,QAAQ,EAAE,GAAG,CAC3B,GAAG,WAAW,CAAC,OAAO,EAAE,GAAG,WAAW,CAAC,QAAQ,EAAE,GAAG,WAAW,CAAC,UAAU,EAAE,GAAG,WAAW,CAAC,UAAU,EAAE,GAAG,WAAW,CAAC,eAAe,EAAE,EAAE,CAAA;IAC3I,CAAC;IAED,MAAM,CAAC,OAAO;QACZ,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAA;QAC9B,OAAO,OAAO,WAAW,CAAC,WAAW,EAAE,GACrC,WAAW,CAAC,QAAQ,EAAE,GAAG,CAC3B,GAAG,WAAW,CAAC,OAAO,EAAE,GAAG,WAAW,CAAC,QAAQ,EAAE,GAAG,WAAW,CAAC,UAAU,EAAE,GAAG,WAAW,CAAC,UAAU,EAAE,GAAG,WAAW,CAAC,eAAe,EAAE,EAAE,CAAA;IAC3I,CAAC;CACF;AA/ID,4CA+IC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/sales-base",
3
- "version": "4.3.23",
3
+ "version": "4.3.26",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -24,17 +24,17 @@
24
24
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
25
25
  },
26
26
  "dependencies": {
27
- "@things-factory/attachment-base": "^4.3.23",
28
- "@things-factory/auth-base": "^4.3.23",
29
- "@things-factory/biz-base": "^4.3.23",
30
- "@things-factory/code-base": "^4.3.23",
31
- "@things-factory/integration-sftp": "^4.3.23",
32
- "@things-factory/notification": "^4.3.23",
33
- "@things-factory/product-base": "^4.3.23",
34
- "@things-factory/setting-base": "^4.3.23",
27
+ "@things-factory/attachment-base": "^4.3.24",
28
+ "@things-factory/auth-base": "^4.3.24",
29
+ "@things-factory/biz-base": "^4.3.24",
30
+ "@things-factory/code-base": "^4.3.24",
31
+ "@things-factory/integration-sftp": "^4.3.25",
32
+ "@things-factory/notification": "^4.3.24",
33
+ "@things-factory/product-base": "^4.3.24",
34
+ "@things-factory/setting-base": "^4.3.24",
35
35
  "@things-factory/shell": "^4.3.23",
36
- "@things-factory/transport-base": "^4.3.23",
37
- "@things-factory/warehouse-base": "^4.3.23"
36
+ "@things-factory/transport-base": "^4.3.24",
37
+ "@things-factory/warehouse-base": "^4.3.26"
38
38
  },
39
- "gitHead": "1fc1cde1702acc5f1c1b7adedeb1ba4448438848"
39
+ "gitHead": "dbb4dc519a8a7bd8fd295ec91f2f80ba6b1b3250"
40
40
  }
@@ -23,13 +23,16 @@ export class OtherQuery {
23
23
  @Directive('@privilege(category: "inventory", privilege: "query")')
24
24
  @Directive('@transaction')
25
25
  @Query(returns => InventoryProductGroupList)
26
- async allBizplaceProductInventory(@Ctx() context: any, @Args() params: ListParam): Promise<InventoryProductGroupList> {
26
+ async allBizplaceProductInventory(
27
+ @Ctx() context: any,
28
+ @Args() params: ListParam
29
+ ): Promise<InventoryProductGroupList> {
27
30
  const { domain, user, tx, bizplace }: { domain: Domain; user: User; tx: EntityManager; bizplace: Bizplace } =
28
31
  context.state
29
32
 
30
33
  let permittedBizplaces: Bizplace[] = await getPermittedBizplaces(domain, user)
31
34
 
32
- let bizplaceId: any = params.filters.find(filter => filter.name === 'bizplaceId').value
35
+ let bizplaceId: any = params.filters.find(filter => filter.name === 'bizplace_id').value
33
36
  let foundPermittedBizplace: Bizplace
34
37
  let companyBizplace: Bizplace
35
38
 
@@ -200,11 +203,11 @@ export class OtherQuery {
200
203
  inventory:
201
204
  total > 0
202
205
  ? {
203
- ...items[0],
204
- remainQty: total > 0 ? items[0].remainQty : null,
205
- remainUomValue: total > 0 ? items[0].remainUomValue : null,
206
- remainUomValueWithUom: total > 0 ? items[0].remainUomValueWithUom : ''
207
- }
206
+ ...items[0],
207
+ remainQty: total > 0 ? items[0].remainQty : null,
208
+ remainUomValue: total > 0 ? items[0].remainUomValue : null,
209
+ remainUomValueWithUom: total > 0 ? items[0].remainUomValueWithUom : ''
210
+ }
208
211
  : null,
209
212
  productId: total > 0 ? items[0].productId : null,
210
213
  productSKU: total > 0 ? items[0].productSKU : orderInventory.productSKU,
@@ -339,7 +342,7 @@ export class OtherQuery {
339
342
  let productDetail: ProductDetail
340
343
  const hasConditions: boolean = Boolean(
341
344
  (orderProduct?.packingType && orderProduct?.packingType.trim() != '') ||
342
- (orderProduct?.uom && orderProduct?.uom.trim() != '')
345
+ (orderProduct?.uom && orderProduct?.uom.trim() != '')
343
346
  )
344
347
  let productDetailCondition: any = { product: foundProduct }
345
348
 
@@ -362,8 +365,8 @@ export class OtherQuery {
362
365
  ? productDetail.uomValue
363
366
  : null
364
367
  : orderProduct?.uomValue
365
- ? orderProduct.uomValue
366
- : productDetail.uomValue
368
+ ? orderProduct.uomValue
369
+ : productDetail.uomValue
367
370
 
368
371
  newOrderProduct = {
369
372
  ...orderProduct,
@@ -60,45 +60,54 @@ export class ReleaseGoodQuery {
60
60
 
61
61
  const qb: SelectQueryBuilder<ReleaseGood> = getRepository(ReleaseGood).createQueryBuilder('rg')
62
62
  buildQuery(qb, params, context)
63
- qb.addSelect('COALESCE("cc".rank, 99999)', 'rank')
64
- qb.leftJoinAndSelect('rg.domain', 'domain')
65
- qb.leftJoinAndSelect('rg.bizplace', 'bizplace')
66
- qb.leftJoinAndSelect('rg.orderInventories', 'oi')
67
- qb.leftJoinAndSelect('rg.orderProducts', 'op')
68
- qb.leftJoinAndSelect('oi.inventory', 'inv')
69
- qb.leftJoinAndSelect('oi.product', 'prod')
70
- qb.leftJoinAndSelect('rg.arrivalNotice', 'an')
71
- qb.leftJoinAndSelect('rg.creator', 'creator')
72
- qb.leftJoinAndSelect('rg.updater', 'updater')
73
- qb.leftJoin(
74
- subQuery => {
75
- return subQuery
76
- .select(`ccd.rank`, 'rank')
77
- .addSelect(`ccd.name`, 'status')
78
- .from(`common_code_details`, 'ccd')
79
- .innerJoin(`ccd.commonCode`, 'cc')
80
- .where(`ccd.domain_id = :domainId`, { domainId: domain.id })
81
- .andWhere(`cc.name = 'RO_LIST_STATUS'`)
82
- },
83
- 'cc',
84
- 'cc.status = rg.status'
85
- )
86
-
87
- const arrChildSortData = ['bizplace']
88
- const sort = (params.sortings || []).reduce(
89
- (acc, sort) => ({
90
- ...acc,
91
- [arrChildSortData.indexOf(sort.name) >= 0 ? sort.name + '.name' : 'rg.' + sort.name]: sort.desc
92
- ? 'DESC'
93
- : 'ASC'
94
- }),
95
- !params.sortings.some(e => e.name === 'status') ? { rank: 'ASC' } : {}
96
- )
63
+ let items: any
64
+ let total: number
65
+ if (!params.filters.find((filter: any) => filter.name === 'releaseGoodOnly')) {
66
+ qb.addSelect('COALESCE("cc".rank, 99999)', 'rank')
67
+ qb.leftJoinAndSelect('rg.domain', 'domain')
68
+ qb.leftJoinAndSelect('rg.bizplace', 'bizplace')
69
+ qb.leftJoinAndSelect('rg.orderInventories', 'oi')
70
+ qb.leftJoinAndSelect('rg.orderProducts', 'op')
71
+ qb.leftJoinAndSelect('oi.inventory', 'inv')
72
+ qb.leftJoinAndSelect('oi.product', 'prod')
73
+ qb.leftJoinAndSelect('rg.arrivalNotice', 'an')
74
+ qb.leftJoinAndSelect('rg.creator', 'creator')
75
+ qb.leftJoinAndSelect('rg.updater', 'updater')
76
+ qb.leftJoin(
77
+ subQuery => {
78
+ return subQuery
79
+ .select(`ccd.rank`, 'rank')
80
+ .addSelect(`ccd.name`, 'status')
81
+ .from(`common_code_details`, 'ccd')
82
+ .innerJoin(`ccd.commonCode`, 'cc')
83
+ .where(`ccd.domain_id = :domainId`, { domainId: domain.id })
84
+ .andWhere(`cc.name = 'RO_LIST_STATUS'`)
85
+ },
86
+ 'cc',
87
+ 'cc.status = rg.status'
88
+ )
97
89
 
98
- qb.orderBy(sort)
90
+ const arrChildSortData = ['bizplace']
91
+ const sort = (params.sortings || []).reduce(
92
+ (acc, sort) => ({
93
+ ...acc,
94
+ [arrChildSortData.indexOf(sort.name) >= 0 ? sort.name + '.name' : 'rg.' + sort.name]: sort.desc
95
+ ? 'DESC'
96
+ : 'ASC'
97
+ }),
98
+ !params.sortings.some(e => e.name === 'status') ? { rank: 'ASC' } : {}
99
+ )
99
100
 
100
- const [items, total] = await qb.getManyAndCount()
101
+ qb.orderBy(sort)
101
102
 
103
+ let [itemsRes, totalRes] = await qb.getManyAndCount()
104
+ items = itemsRes
105
+ total = totalRes
106
+ } else {
107
+ let itemsRes = await qb.getOne()
108
+ items = itemsRes ? [itemsRes] : []
109
+ total = items.length
110
+ }
102
111
  return { items, total }
103
112
  } catch (error) {
104
113
  throw error
@@ -468,24 +477,27 @@ export class ReleaseGoodQuery {
468
477
  ${batchId ? `AND LOWER(${INV_ALIAS}.batch_id) LIKE '%${batchId.toLowerCase()}%'` : ''}
469
478
  ${packingType ? `AND LOWER(${INV_ALIAS}.packing_type) LIKE '%${packingType.toLowerCase()}%'` : ''}
470
479
  ${containerNo ? `AND LOWER(${GAN_ALIAS}.container_no) LIKE '%${containerNo.toLowerCase()}%'` : ''}
471
- ${product?.length > 0 && product[0]
472
- ? `AND ${PROD_ALIAS}.id IN (${product.map((id: string) => `'${id}'`).join(', ')})`
473
- : product[0] === null
474
- ? `AND ${PROD_ALIAS}.id isnull`
475
- : ''
476
- }
477
- ${inventory?.length > 0
478
- ? `
479
- AND (${INV_ALIAS}.batch_id, ${PROD_ALIAS}.id) ${filters.find((filter: { name: string; operator: string; value: any }) => filter.name === 'inventory')
480
- .operator
481
- } (
480
+ ${
481
+ product?.length > 0 && product[0]
482
+ ? `AND ${PROD_ALIAS}.id IN (${product.map((id: string) => `'${id}'`).join(', ')})`
483
+ : product[0] === null
484
+ ? `AND ${PROD_ALIAS}.id isnull`
485
+ : ''
486
+ }
487
+ ${
488
+ inventory?.length > 0
489
+ ? `
490
+ AND (${INV_ALIAS}.batch_id, ${PROD_ALIAS}.id) ${
491
+ filters.find((filter: { name: string; operator: string; value: any }) => filter.name === 'inventory')
492
+ .operator
493
+ } (
482
494
  ${inventory
483
- .map((inv: { batchId: string; productId: string }) => `('${inv.batchId}', '${inv.productId}')`)
484
- .join(', ')}
495
+ .map((inv: { batchId: string; productId: string }) => `('${inv.batchId}', '${inv.productId}')`)
496
+ .join(', ')}
485
497
  )
486
498
  `
487
- : ''
488
- }
499
+ : ''
500
+ }
489
501
  `
490
502
 
491
503
  // ${product?.length > 0 ? `AND ${PROD_ALIAS}.id IN (${product.map((id: string) => id ? `'${id}'` : null).join(', ')})` : ''}
@@ -660,7 +672,7 @@ export async function bulkReleaseGoodsAvailableItemsFunction(
660
672
  packing_size: raw.packingSize,
661
673
  uom: raw.uom,
662
674
  releaseQty: raw.releaseQty,
663
- release_qty: raw.releaseQty,
675
+ release_qty: raw.releaseQty
664
676
  }
665
677
  })
666
678
  )
@@ -840,16 +852,16 @@ function _extractData(rawData, validatedData) {
840
852
  !raw.productId || !raw.productDetailId
841
853
  ? 'inventory or product not found'
842
854
  : raw.releaseQty <= 0
843
- ? 'invalid release qty'
844
- : raw.assignedQty < raw.releaseQty
845
- ? 'insufficient stock'
846
- : raw.releaseDate == ''
847
- ? 'release date is empty'
848
- : releaseDate < _getStdDateStr(new Date())
849
- ? 'backdate is not allowed'
850
- : !raw.refNo
851
- ? 'ref no is empty'
852
- : ''
855
+ ? 'invalid release qty'
856
+ : raw.assignedQty < raw.releaseQty
857
+ ? 'insufficient stock'
858
+ : raw.releaseDate == ''
859
+ ? 'release date is empty'
860
+ : releaseDate < _getStdDateStr(new Date())
861
+ ? 'backdate is not allowed'
862
+ : !raw.refNo
863
+ ? 'ref no is empty'
864
+ : ''
853
865
  }
854
866
  })
855
867
  }
@@ -3,7 +3,7 @@ import { getPermittedBizplaceIds } from '@things-factory/biz-base'
3
3
  import { Domain } from '@things-factory/shell'
4
4
  import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
5
5
  import { EntityManager, In } from 'typeorm'
6
- import uuid from 'uuid/v4'
6
+ import { v4 as uuidv4 } from 'uuid'
7
7
  import { NewShippingOrder, ShippingOrderPatch } from '../'
8
8
  import { ShippingOrder } from './shipping-order'
9
9
 
@@ -19,7 +19,7 @@ export class ShippingOrderMutation {
19
19
 
20
20
  const repository = tx.getRepository(ShippingOrder)
21
21
  const newShippingOrder = {
22
- id: uuid(),
22
+ id: uuidv4(),
23
23
  ...shippingOrder
24
24
  }
25
25
 
@@ -1,129 +1,146 @@
1
- import uuid from 'uuid/v4'
1
+ import { v4 as uuidv4 } from 'uuid'
2
2
 
3
3
  export class OrderNoGenerator {
4
4
  static arrivalNotice() {
5
5
  const currentDate = new Date()
6
- return `GAN-${currentDate.getFullYear()}${currentDate.getMonth() + 1
7
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
6
+ return `GAN-${currentDate.getFullYear()}${
7
+ currentDate.getMonth() + 1
8
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
8
9
  }
9
10
 
10
11
  static collectionOrder() {
11
12
  const currentDate = new Date()
12
- return `CO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
13
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
13
+ return `CO-${currentDate.getFullYear()}${
14
+ currentDate.getMonth() + 1
15
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
14
16
  }
15
17
 
16
18
  static cycleCount() {
17
19
  const currentDate = new Date()
18
- return `CC-${currentDate.getFullYear()}${currentDate.getMonth() + 1
19
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
20
+ return `CC-${currentDate.getFullYear()}${
21
+ currentDate.getMonth() + 1
22
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
20
23
  }
21
24
 
22
25
  static deliveryOrder() {
23
26
  const currentDate = new Date()
24
- return `DO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
25
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
27
+ return `DO-${currentDate.getFullYear()}${
28
+ currentDate.getMonth() + 1
29
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
26
30
  }
27
31
 
28
32
  static goodsReceiveNote() {
29
33
  const currentDate = new Date()
30
- return `GRN-${currentDate.getFullYear()}${currentDate.getMonth() + 1
31
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
34
+ return `GRN-${currentDate.getFullYear()}${
35
+ currentDate.getMonth() + 1
36
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
32
37
  }
33
38
 
34
39
  static jobSheet(domainName) {
35
40
  const currentDate = new Date()
36
- return `${domainName}-${currentDate.getFullYear()}${currentDate.getMonth() + 1
37
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
41
+ return `${domainName}-${currentDate.getFullYear()}${
42
+ currentDate.getMonth() + 1
43
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
38
44
  }
39
45
 
40
46
  static manifest() {
41
47
  const currentDate = new Date()
42
- return `LM-${currentDate.getFullYear()}${currentDate.getMonth() + 1
43
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
48
+ return `LM-${currentDate.getFullYear()}${
49
+ currentDate.getMonth() + 1
50
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
44
51
  }
45
52
 
46
53
  static orderInventory() {
47
- return uuid()
54
+ return uuidv4()
48
55
  }
49
56
 
50
57
  static orderProduct() {
51
- return `OP-${uuid()}`
58
+ return `OP-${uuidv4()}`
52
59
  }
53
60
 
54
61
  static invoiceProduct() {
55
- return `IP-${uuid()}`
62
+ return `IP-${uuidv4()}`
56
63
  }
57
64
 
58
65
  static orderVas() {
59
- return `OV-${uuid()}`
66
+ return `OV-${uuidv4()}`
60
67
  }
61
68
 
62
69
  static orderToteItem() {
63
- return `OTI-${uuid()}`
70
+ return `OTI-${uuidv4()}`
64
71
  }
65
72
 
66
73
  static purchaseOrder() {
67
74
  const currentDate = new Date()
68
- return `PO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
69
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
75
+ return `PO-${currentDate.getFullYear()}${
76
+ currentDate.getMonth() + 1
77
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
70
78
  }
71
79
 
72
80
  static releaseGood() {
73
81
  const currentDate = new Date()
74
- return `RO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
75
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
82
+ return `RO-${currentDate.getFullYear()}${
83
+ currentDate.getMonth() + 1
84
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
76
85
  }
77
86
 
78
87
  static draftReleaseGood() {
79
88
  const currentDate = new Date()
80
- return `ODO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
81
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
89
+ return `ODO-${currentDate.getFullYear()}${
90
+ currentDate.getMonth() + 1
91
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
82
92
  }
83
93
 
84
94
  static releaseVas() {
85
- return uuid()
95
+ return uuidv4()
86
96
  }
87
97
 
88
98
  static retailReplenishmentOrder() {
89
99
  const currentDate = new Date()
90
- return `RR-${currentDate.getFullYear()}${currentDate.getMonth() + 1
91
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
100
+ return `RR-${currentDate.getFullYear()}${
101
+ currentDate.getMonth() + 1
102
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
92
103
  }
93
104
 
94
105
  static returnOrder() {
95
106
  const currentDate = new Date()
96
- return `RTO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
97
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
107
+ return `RTO-${currentDate.getFullYear()}${
108
+ currentDate.getMonth() + 1
109
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
98
110
  }
99
111
 
100
112
  static shippingOrder() {
101
113
  const currentDate = new Date()
102
- return `SO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
103
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
114
+ return `SO-${currentDate.getFullYear()}${
115
+ currentDate.getMonth() + 1
116
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
104
117
  }
105
118
 
106
119
  static stockTake() {
107
120
  const currentDate = new Date()
108
- return `ST-${currentDate.getFullYear()}${currentDate.getMonth() + 1
109
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
121
+ return `ST-${currentDate.getFullYear()}${
122
+ currentDate.getMonth() + 1
123
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
110
124
  }
111
125
 
112
126
  static transferOrder() {
113
127
  const currentDate = new Date()
114
- return `TO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
115
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
128
+ return `TO-${currentDate.getFullYear()}${
129
+ currentDate.getMonth() + 1
130
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
116
131
  }
117
132
 
118
133
  static vasOrder() {
119
134
  const currentDate = new Date()
120
- return `VO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
121
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
135
+ return `VO-${currentDate.getFullYear()}${
136
+ currentDate.getMonth() + 1
137
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
122
138
  }
123
139
 
124
140
  static invoice() {
125
141
  const currentDate = new Date()
126
- return `INV-${currentDate.getFullYear()}${currentDate.getMonth() + 1
127
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
142
+ return `INV-${currentDate.getFullYear()}${
143
+ currentDate.getMonth() + 1
144
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
128
145
  }
129
146
  }