@things-factory/warehouse-base 4.3.246 → 4.3.249

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 (34) hide show
  1. package/dist-server/constants/location.js +2 -1
  2. package/dist-server/constants/location.js.map +1 -1
  3. package/dist-server/service/index.js +7 -2
  4. package/dist-server/service/index.js.map +1 -1
  5. package/dist-server/service/inventory/inventory-query.js +47 -21
  6. package/dist-server/service/inventory/inventory-query.js.map +1 -1
  7. package/dist-server/service/inventory/inventory.js +4 -0
  8. package/dist-server/service/inventory/inventory.js.map +1 -1
  9. package/dist-server/service/inventory-change/inventory-change-mutation.js +6 -7
  10. package/dist-server/service/inventory-change/inventory-change-mutation.js.map +1 -1
  11. package/dist-server/service/inventory-history/inventory-history-query.js +3 -1
  12. package/dist-server/service/inventory-history/inventory-history-query.js.map +1 -1
  13. package/dist-server/service/product-detail-stock/index.js +9 -0
  14. package/dist-server/service/product-detail-stock/index.js.map +1 -0
  15. package/dist-server/service/product-detail-stock/product-detail-stock-mutation.js +120 -0
  16. package/dist-server/service/product-detail-stock/product-detail-stock-mutation.js.map +1 -0
  17. package/dist-server/service/product-detail-stock/product-detail-stock-query.js +66 -0
  18. package/dist-server/service/product-detail-stock/product-detail-stock-query.js.map +1 -0
  19. package/dist-server/service/product-detail-stock/product-detail-stock-types.js +57 -0
  20. package/dist-server/service/product-detail-stock/product-detail-stock-types.js.map +1 -0
  21. package/dist-server/service/product-detail-stock/product-detail-stock.js +90 -0
  22. package/dist-server/service/product-detail-stock/product-detail-stock.js.map +1 -0
  23. package/package.json +9 -9
  24. package/server/constants/location.ts +2 -1
  25. package/server/service/index.ts +10 -2
  26. package/server/service/inventory/inventory-query.ts +52 -24
  27. package/server/service/inventory/inventory.ts +3 -0
  28. package/server/service/inventory-change/inventory-change-mutation.ts +6 -7
  29. package/server/service/inventory-history/inventory-history-query.ts +3 -1
  30. package/server/service/product-detail-stock/index.ts +6 -0
  31. package/server/service/product-detail-stock/product-detail-stock-mutation.ts +112 -0
  32. package/server/service/product-detail-stock/product-detail-stock-query.ts +33 -0
  33. package/server/service/product-detail-stock/product-detail-stock-types.ts +30 -0
  34. package/server/service/product-detail-stock/product-detail-stock.ts +79 -0
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var _a;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.ProductDetailStockQuery = void 0;
17
+ const type_graphql_1 = require("type-graphql");
18
+ const typeorm_1 = require("typeorm");
19
+ const shell_1 = require("@things-factory/shell");
20
+ const product_detail_stock_1 = require("./product-detail-stock");
21
+ const product_detail_stock_types_1 = require("./product-detail-stock-types");
22
+ let ProductDetailStockQuery = class ProductDetailStockQuery {
23
+ async productDetailStock(id, context) {
24
+ const { domain } = context.state;
25
+ return await (0, typeorm_1.getRepository)(product_detail_stock_1.ProductDetailStock).findOne({
26
+ where: { domain, id }
27
+ });
28
+ }
29
+ async productDetailStocks(params, context) {
30
+ const { domain } = context.state;
31
+ const convertedParams = (0, shell_1.convertListParams)(params, domain.id);
32
+ const [items, total] = await (0, typeorm_1.getRepository)(product_detail_stock_1.ProductDetailStock).findAndCount(convertedParams);
33
+ return { items, total };
34
+ }
35
+ async domain(productDetailStock) {
36
+ return await (0, typeorm_1.getRepository)(shell_1.Domain).findOne(productDetailStock.domainId);
37
+ }
38
+ };
39
+ __decorate([
40
+ (0, type_graphql_1.Query)(returns => product_detail_stock_1.ProductDetailStock, { description: 'To fetch a ProductDetailStock' }),
41
+ __param(0, (0, type_graphql_1.Arg)('id')),
42
+ __param(1, (0, type_graphql_1.Ctx)()),
43
+ __metadata("design:type", Function),
44
+ __metadata("design:paramtypes", [String, Object]),
45
+ __metadata("design:returntype", Promise)
46
+ ], ProductDetailStockQuery.prototype, "productDetailStock", null);
47
+ __decorate([
48
+ (0, type_graphql_1.Query)(returns => product_detail_stock_types_1.ProductDetailStockList, { description: 'To fetch multiple ProductDetailStocks' }),
49
+ __param(0, (0, type_graphql_1.Args)()),
50
+ __param(1, (0, type_graphql_1.Ctx)()),
51
+ __metadata("design:type", Function),
52
+ __metadata("design:paramtypes", [typeof (_a = typeof shell_1.ListParam !== "undefined" && shell_1.ListParam) === "function" ? _a : Object, Object]),
53
+ __metadata("design:returntype", Promise)
54
+ ], ProductDetailStockQuery.prototype, "productDetailStocks", null);
55
+ __decorate([
56
+ (0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
57
+ __param(0, (0, type_graphql_1.Root)()),
58
+ __metadata("design:type", Function),
59
+ __metadata("design:paramtypes", [product_detail_stock_1.ProductDetailStock]),
60
+ __metadata("design:returntype", Promise)
61
+ ], ProductDetailStockQuery.prototype, "domain", null);
62
+ ProductDetailStockQuery = __decorate([
63
+ (0, type_graphql_1.Resolver)(product_detail_stock_1.ProductDetailStock)
64
+ ], ProductDetailStockQuery);
65
+ exports.ProductDetailStockQuery = ProductDetailStockQuery;
66
+ //# sourceMappingURL=product-detail-stock-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-detail-stock-query.js","sourceRoot":"","sources":["../../../server/service/product-detail-stock/product-detail-stock-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA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,EAAE,uCAAuC,EAAE,CAAC;IACxE,WAAA,IAAA,mBAAI,GAAE,CAAA;IAAqB,WAAA,IAAA,kBAAG,GAAE,CAAA;;yDAAjB,iBAAS,oBAAT,iBAAS;;kEAOlD;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAqB,yCAAkB;;qDAE1D;AAvBU,uBAAuB;IADnC,IAAA,uBAAQ,EAAC,yCAAkB,CAAC;GAChB,uBAAuB,CAwBnC;AAxBY,0DAAuB"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ProductDetailStockList = exports.ProductDetailStockPatch = exports.NewProductDetailStock = void 0;
13
+ const type_graphql_1 = require("type-graphql");
14
+ const product_detail_stock_1 = require("./product-detail-stock");
15
+ let NewProductDetailStock = class NewProductDetailStock {
16
+ };
17
+ __decorate([
18
+ (0, type_graphql_1.Field)(),
19
+ __metadata("design:type", String)
20
+ ], NewProductDetailStock.prototype, "name", void 0);
21
+ NewProductDetailStock = __decorate([
22
+ (0, type_graphql_1.InputType)()
23
+ ], NewProductDetailStock);
24
+ exports.NewProductDetailStock = NewProductDetailStock;
25
+ let ProductDetailStockPatch = class ProductDetailStockPatch {
26
+ };
27
+ __decorate([
28
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
29
+ __metadata("design:type", String)
30
+ ], ProductDetailStockPatch.prototype, "id", void 0);
31
+ __decorate([
32
+ (0, type_graphql_1.Field)({ nullable: true }),
33
+ __metadata("design:type", String)
34
+ ], ProductDetailStockPatch.prototype, "name", void 0);
35
+ __decorate([
36
+ (0, type_graphql_1.Field)(),
37
+ __metadata("design:type", String)
38
+ ], ProductDetailStockPatch.prototype, "cuFlag", void 0);
39
+ ProductDetailStockPatch = __decorate([
40
+ (0, type_graphql_1.InputType)()
41
+ ], ProductDetailStockPatch);
42
+ exports.ProductDetailStockPatch = ProductDetailStockPatch;
43
+ let ProductDetailStockList = class ProductDetailStockList {
44
+ };
45
+ __decorate([
46
+ (0, type_graphql_1.Field)(type => [product_detail_stock_1.ProductDetailStock]),
47
+ __metadata("design:type", Array)
48
+ ], ProductDetailStockList.prototype, "items", void 0);
49
+ __decorate([
50
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
51
+ __metadata("design:type", Number)
52
+ ], ProductDetailStockList.prototype, "total", void 0);
53
+ ProductDetailStockList = __decorate([
54
+ (0, type_graphql_1.ObjectType)()
55
+ ], ProductDetailStockList);
56
+ exports.ProductDetailStockList = ProductDetailStockList;
57
+ //# sourceMappingURL=product-detail-stock-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-detail-stock-types.js","sourceRoot":"","sources":["../../../server/service/product-detail-stock/product-detail-stock-types.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAsF;AAEtF,iEAAqF;AAG9E,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;CAGjC,CAAA;AAFC;IAAC,IAAA,oBAAK,GAAE;;mDACI;AAFD,qBAAqB;IADjC,IAAA,wBAAS,GAAE;GACC,qBAAqB,CAGjC;AAHY,sDAAqB;AAM3B,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;CASnC,CAAA;AARC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDAC3B;AAEX;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACb;AAEb;IAAC,IAAA,oBAAK,GAAE;;uDACM;AARH,uBAAuB;IADnC,IAAA,wBAAS,GAAE;GACC,uBAAuB,CASnC;AATY,0DAAuB;AAY7B,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;CAMlC,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,yCAAkB,CAAC,CAAC;;qDACT;AAE3B;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;qDACN;AALF,sBAAsB;IADlC,IAAA,yBAAU,GAAE;GACA,sBAAsB,CAMlC;AANY,wDAAsB"}
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var _a, _b;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.ProductDetailStock = exports.ProductDetailStockStatus = void 0;
14
+ const typeorm_1 = require("typeorm");
15
+ const type_graphql_1 = require("type-graphql");
16
+ const product_base_1 = require("@things-factory/product-base");
17
+ const shell_1 = require("@things-factory/shell");
18
+ var ProductDetailStockStatus;
19
+ (function (ProductDetailStockStatus) {
20
+ ProductDetailStockStatus["STATUS_A"] = "STATUS_A";
21
+ ProductDetailStockStatus["STATUS_B"] = "STATUS_B";
22
+ })(ProductDetailStockStatus = exports.ProductDetailStockStatus || (exports.ProductDetailStockStatus = {}));
23
+ (0, type_graphql_1.registerEnumType)(ProductDetailStockStatus, {
24
+ name: 'ProductDetailStockStatus',
25
+ description: 'state enumeration of a productDetailStock'
26
+ });
27
+ let ProductDetailStock = class ProductDetailStock {
28
+ };
29
+ __decorate([
30
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
31
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID),
32
+ __metadata("design:type", String)
33
+ ], ProductDetailStock.prototype, "id", void 0);
34
+ __decorate([
35
+ (0, typeorm_1.OneToOne)(type => product_base_1.ProductDetail, { nullable: true }),
36
+ (0, typeorm_1.JoinColumn)(),
37
+ (0, type_graphql_1.Field)(type => product_base_1.ProductDetail, { nullable: true }),
38
+ __metadata("design:type", typeof (_a = typeof product_base_1.ProductDetail !== "undefined" && product_base_1.ProductDetail) === "function" ? _a : Object)
39
+ ], ProductDetailStock.prototype, "productDetail", void 0);
40
+ __decorate([
41
+ (0, typeorm_1.Column)('float'),
42
+ (0, type_graphql_1.Field)({ nullable: true }),
43
+ __metadata("design:type", Number)
44
+ ], ProductDetailStock.prototype, "qty", void 0);
45
+ __decorate([
46
+ (0, typeorm_1.Column)('float', { nullable: true }),
47
+ (0, type_graphql_1.Field)({ nullable: true }),
48
+ __metadata("design:type", Number)
49
+ ], ProductDetailStock.prototype, "lockedQty", void 0);
50
+ __decorate([
51
+ (0, typeorm_1.Column)('float', { nullable: true }),
52
+ (0, type_graphql_1.Field)({ nullable: true }),
53
+ __metadata("design:type", Number)
54
+ ], ProductDetailStock.prototype, "unassignedQty", void 0);
55
+ __decorate([
56
+ (0, typeorm_1.Column)('float', { nullable: true }),
57
+ (0, type_graphql_1.Field)({ nullable: true }),
58
+ __metadata("design:type", Number)
59
+ ], ProductDetailStock.prototype, "uomValue", void 0);
60
+ __decorate([
61
+ (0, typeorm_1.Column)('float', { nullable: true }),
62
+ (0, type_graphql_1.Field)({ nullable: true }),
63
+ __metadata("design:type", Number)
64
+ ], ProductDetailStock.prototype, "lockedUomValue", void 0);
65
+ __decorate([
66
+ (0, typeorm_1.Column)('float', { nullable: true }),
67
+ (0, type_graphql_1.Field)({ nullable: true }),
68
+ __metadata("design:type", Number)
69
+ ], ProductDetailStock.prototype, "unassignedUomValue", void 0);
70
+ __decorate([
71
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
72
+ (0, type_graphql_1.Field)({ nullable: true }),
73
+ __metadata("design:type", typeof (_b = typeof shell_1.Domain !== "undefined" && shell_1.Domain) === "function" ? _b : Object)
74
+ ], ProductDetailStock.prototype, "domain", void 0);
75
+ __decorate([
76
+ (0, typeorm_1.RelationId)((productDetailStock) => productDetailStock.domain),
77
+ __metadata("design:type", String)
78
+ ], ProductDetailStock.prototype, "domainId", void 0);
79
+ __decorate([
80
+ (0, typeorm_1.UpdateDateColumn)(),
81
+ (0, type_graphql_1.Field)({ nullable: true }),
82
+ __metadata("design:type", Date)
83
+ ], ProductDetailStock.prototype, "updatedAt", void 0);
84
+ ProductDetailStock = __decorate([
85
+ (0, typeorm_1.Entity)(),
86
+ (0, typeorm_1.Index)('ix_product_detail_stock_0', (productDetailStock) => [productDetailStock.domain, productDetailStock.id], { unique: true }),
87
+ (0, type_graphql_1.ObjectType)({ description: 'Entity for ProductDetailStock' })
88
+ ], ProductDetailStock);
89
+ exports.ProductDetailStock = ProductDetailStock;
90
+ //# sourceMappingURL=product-detail-stock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-detail-stock.js","sourceRoot":"","sources":["../../../server/service/product-detail-stock/product-detail-stock.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAWgB;AAChB,+CAA2E;AA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AA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACV;AAEhB;IAAC,IAAA,gBAAM,EAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACnC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0DACJ;AAEtB;IAAC,IAAA,gBAAM,EAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACnC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8DACA;AAE1B;IAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;kDACjB,cAAM,oBAAN,cAAM;kDAAA;AAEf;IAAC,IAAA,oBAAU,EAAC,CAAC,kBAAsC,EAAE,EAAE,CAAC,kBAAkB,CAAC,MAAM,CAAC;;oDACjE;AAEjB;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACd,IAAI;qDAAA;AA3CL,kBAAkB;IAP9B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,2BAA2B,EAC3B,CAAC,kBAAsC,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAAE,CAAC,EAC9F,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;GAChD,kBAAkB,CA4C9B;AA5CY,gDAAkB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/warehouse-base",
3
- "version": "4.3.246",
3
+ "version": "4.3.249",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -23,13 +23,13 @@
23
23
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
24
24
  },
25
25
  "dependencies": {
26
- "@things-factory/biz-base": "^4.3.237",
27
- "@things-factory/id-rule-base": "^4.3.237",
28
- "@things-factory/integration-accounting": "^4.3.239",
29
- "@things-factory/integration-sellercraft": "^4.3.239",
30
- "@things-factory/marketplace-base": "^4.3.239",
31
- "@things-factory/product-base": "^4.3.237",
32
- "@things-factory/setting-base": "^4.3.237"
26
+ "@things-factory/biz-base": "^4.3.248",
27
+ "@things-factory/id-rule-base": "^4.3.248",
28
+ "@things-factory/integration-accounting": "^4.3.248",
29
+ "@things-factory/integration-sellercraft": "^4.3.248",
30
+ "@things-factory/marketplace-base": "^4.3.248",
31
+ "@things-factory/product-base": "^4.3.248",
32
+ "@things-factory/setting-base": "^4.3.248"
33
33
  },
34
- "gitHead": "7e218f27deddcbd2c4585870c45f06cd889f74d3"
34
+ "gitHead": "ebd830d0d88c40b83c406c8f7f663c8fa345b2d5"
35
35
  }
@@ -11,5 +11,6 @@ export const LOCATION_TYPE = {
11
11
  BIN: 'BIN',
12
12
  QUARANTINE: 'QUARANTINE',
13
13
  RESERVE: 'RESERVE',
14
- STORAGE: 'STORAGE'
14
+ STORAGE: 'STORAGE',
15
+ DAMAGE: 'DAMAGE'
15
16
  }
@@ -14,8 +14,13 @@ import { entities as PalletHistoryEntities, resolvers as PalletHistoryResolvers
14
14
  import { entities as ReducedInventoryHistoryEntities } from './reduced-inventory-history'
15
15
  import { entities as WarehouseEntities, resolvers as WarehouseResolvers } from './warehouse'
16
16
  import { entities as ToteEntities, resolvers as ToteResolvers } from './tote'
17
+ import {
18
+ entities as ProductDetailStockEntities,
19
+ resolvers as ProductDetailStockResolvers
20
+ } from './product-detail-stock'
17
21
 
18
22
  /* EXPORT ENTITY TYPES */
23
+ export * from './product-detail-stock/product-detail-stock'
19
24
  export * from './inventory-item-change/inventory-item-change'
20
25
  export * from './inventory-item/inventory-item'
21
26
  export * from './inventory-item-change/inventory-item-change'
@@ -32,6 +37,7 @@ export * from './reduced-inventory-history/reduced-inventory-history'
32
37
  export * from './tote/tote'
33
38
 
34
39
  /* EXPORT TYPES */
40
+ export * from './product-detail-stock/product-detail-stock-types'
35
41
  export * from './inventory/inventory-types'
36
42
  export * from './inventory/inventory-types'
37
43
  export * from './inventory-item/inventory-item'
@@ -59,7 +65,8 @@ export const entities = [
59
65
  ...PalletHistoryEntities,
60
66
  ...WarehouseEntities,
61
67
  ...ReducedInventoryHistoryEntities,
62
- ...ToteEntities
68
+ ...ToteEntities,
69
+ ...ProductDetailStockEntities
63
70
  ]
64
71
 
65
72
  export const schema = {
@@ -75,6 +82,7 @@ export const schema = {
75
82
  ...PalletCountResolvers,
76
83
  ...PalletHistoryResolvers,
77
84
  ...WarehouseResolvers,
78
- ...ToteResolvers
85
+ ...ToteResolvers,
86
+ ...ProductDetailStockResolvers
79
87
  ]
80
88
  }
@@ -341,11 +341,30 @@ export class InventoryQuery {
341
341
  thresholdQuery = `AND SUM(COALESCE("maxQty", 0)) > 0 AND SUM(COALESCE("maxQty", 0)) < SUM("availableQty")`
342
342
  }
343
343
 
344
+ // await tx.query(
345
+ // `
346
+ // CREATE TEMP TABLE order_inventories_by_products AS (
347
+ // SELECT "product_id", "packing_type", sum("release_qty") AS "total_release_qty" FROM order_inventories oi
348
+ // WHERE "type" = 'RELEASE_OF_GOODS'
349
+ // AND "domain_id" = $1
350
+ // AND "inventory_id" ISNULL
351
+ // AND "status" IN ('PENDING','PENDING_RECEIVE','PENDING_WORKSHEET','READY_TO_PICK'/*, 'PENDING_SPLIT' kiv sebab kalau pending split, ada yang dah assign tapi belum delete*/)
352
+ // GROUP BY "product_id", "packing_type"
353
+ // )`,
354
+ // [domain.id]
355
+ // )
356
+
357
+ /* old logic to calculate, monitoring new logic
358
+ (CASE WHEN "Location"."type" NOT IN ('${LOCATION_TYPE.QUARANTINE}','${LOCATION_TYPE.RESERVE}')
359
+ THEN SUM(COALESCE("Inventory"."locked_qty", 0)) ELSE 0 END) AS "releaseQty",
360
+ */
361
+
362
+ // correction on the as --> AS
344
363
  await tx.query(
345
364
  `
346
365
  create temp table temp_inv_history AS
347
366
  (
348
- SELECT "Product"."id" AS "id", "Product"."sku" AS "sku", "Product"."brand" AS "brand", "Product"."name" AS "name", "Product"."type" AS "type", "Product"."description" AS "description",
367
+ SELECT "Product"."id" AS "id","ProductDetails"."id" AS "productDetailId", "Product"."sku" AS "sku", "Product"."brand" AS "brand", "Product"."name" AS "name", "Product"."type" AS "type", "Product"."description" AS "description",
349
368
  "Inventory"."packing_type" AS "packingType", "ProductDetails"."aux_unit_1" AS "auxUnit1", "ProductDetails"."aux_value_1" AS "auxValue1",
350
369
  "ProductDetails"."aux_unit_2" AS "auxUnit2", "ProductDetails"."aux_value_2" AS "auxValue2",
351
370
  "ProductDetails"."aux_unit_3" AS "auxUnit3", "ProductDetails"."aux_value_3" AS "auxValue3",
@@ -370,8 +389,6 @@ export class InventoryQuery {
370
389
  THEN
371
390
  CASE WHEN SUM("Inventory"."qty") > 0 THEN SUM("Inventory"."qty") ELSE 0 END - SUM(COALESCE("Inventory"."locked_qty", 0))
372
391
  ELSE 0 END) AS "availableQty",
373
- (CASE WHEN "Location"."type" NOT IN ('${LOCATION_TYPE.QUARANTINE}','${LOCATION_TYPE.RESERVE}')
374
- THEN SUM(COALESCE("Inventory"."locked_qty", 0)) ELSE 0 END) AS "releaseQty",
375
392
  CASE WHEN "Location"."type" = '${LOCATION_TYPE.QUARANTINE}'
376
393
  THEN
377
394
  CASE WHEN SUM("Inventory"."qty") > 0
@@ -395,6 +412,12 @@ export class InventoryQuery {
395
412
  THEN SUM("Inventory"."qty")
396
413
  ELSE 0 END
397
414
  ELSE 0 END AS "obsoleteQty",
415
+ CASE WHEN "Location"."type" = '${LOCATION_TYPE.DAMAGE}'
416
+ THEN
417
+ CASE WHEN SUM("Inventory"."qty") > 0
418
+ THEN SUM("Inventory"."qty")
419
+ ELSE 0 END
420
+ ELSE 0 END AS "damageQty",
398
421
  CASE WHEN "Location"."type" = '${LOCATION_TYPE.STORAGE}'
399
422
  THEN
400
423
  CASE WHEN SUM("Inventory"."qty") > 0
@@ -404,11 +427,13 @@ export class InventoryQuery {
404
427
  CASE WHEN "Inventory"."transfer_qty" > 0
405
428
  THEN
406
429
  SUM("Inventory"."transfer_qty")
407
- ELSE 0 END AS "transferQty"
430
+ ELSE 0 END AS "transferQty",
431
+ SUM(COALESCE("Inventory"."locked_qty", 0)) AS "locked_qty"
408
432
  FROM "inventories" "Inventory"
409
433
  LEFT JOIN "products" "Product" ON "Product"."id"="Inventory"."product_id"
410
434
  LEFT JOIN "product_details" "ProductDetails" ON "ProductDetails"."product_id" = "Product"."id" AND "ProductDetails"."is_default"
411
- LEFT JOIN "product_detail_bizplace_settings" "ProductDetailBizplaceSetting" ON "ProductDetailBizplaceSetting"."product_detail_id" = "ProductDetails"."id"
435
+ LEFT JOIN "product_detail_bizplace_settings" "ProductDetailBizplaceSetting" ON "ProductDetailBizplaceSetting"."product_detail_id" = "ProductDetails"."id"
436
+ LEFT JOIN "product_detail_stocks" "ProductDetailStock" ON "ProductDetailStock"."product_detail_id" = "ProductDetails"."id"
412
437
  AND "ProductDetailBizplaceSetting"."domain_id" = "Inventory"."domain_id"
413
438
  LEFT JOIN "products" "ProductRef" ON "ProductRef"."id"="Product"."product_ref_id"
414
439
  INNER JOIN "bizplaces" "Bizplace" ON "Bizplace"."id"="Inventory"."bizplace_id"
@@ -431,21 +456,22 @@ export class InventoryQuery {
431
456
  await tx.query(
432
457
  `
433
458
  CREATE TEMP TABLE grouped_inventories_product AS (
434
- SELECT "id", "sku", "brand", "name", "description", "auxUnit1", "auxValue1", "auxUnit2", "auxValue2", "auxUnit3", "auxValue3", "auxUnit4", "auxValue4", "auxUnit5", "auxValue5",
459
+ SELECT "tih"."id", "sku", "brand", "name", "description", "auxUnit1", "auxValue1", "auxUnit2", "auxValue2", "auxUnit3", "auxValue3", "auxUnit4", "auxValue4", "auxUnit5", "auxValue5",
435
460
  "packingType", "bizplaceId", "bizplaceName", SUM("averageUnitCost") AS "averageUnitCost",
436
- SUM("minQty") AS "minQty", SUM("maxQty") AS "maxQty",
437
- COALESCE("putawayinv"."putaway_qty", 0) AS "putawayQty",
438
- SUM("qty") AS "qty",
439
- SUM("quarantineQty") AS "quarantineQty",
440
- SUM("reserveQty") AS "reserveQty",
441
- COALESCE("opd"."total_release_qty", 0) as "draftQty",
442
- SUM("releaseQty") AS "releaseQty",
443
- COALESCE("opd"."total_release_qty", 0) - SUM("availableQty") - COALESCE("putawayinv"."putaway_qty", 0) AS "insufficientQty",
444
- SUM("availableQty") + COALESCE("putawayinv"."putaway_qty", 0) AS "availableQty",
445
- SUM("quarantineQty" + "reserveQty" + "availableQty") + COALESCE("putawayinv"."putaway_qty", 0) - COALESCE("opd"."total_release_qty", 0) AS "warehouseQty",
446
- SUM("obsoleteQty") AS "obsoleteQty",
447
- SUM("storageQty") AS "storageQty",
448
- SUM("transferQty") AS "transferQty"
461
+ SUM("minQty") AS "minQty", SUM("maxQty") AS "maxQty",
462
+ COALESCE("putawayinv"."putaway_qty", 0) AS "putawayQty",
463
+ SUM("tih"."qty") AS "qty",
464
+ SUM("quarantineQty") AS "quarantineQty",
465
+ SUM("reserveQty") AS "reserveQty",
466
+ COALESCE("opd"."total_release_qty", 0) as "draftQty",
467
+ SUM("tih"."locked_qty") + "pds"."unassigned_qty" as "releaseQty",
468
+ COALESCE("opd"."total_release_qty", 0) - SUM("availableQty") - COALESCE("putawayinv"."putaway_qty", 0) AS "insufficientQty",
469
+ SUM("availableQty") + COALESCE("putawayinv"."putaway_qty", 0) AS "availableQty",
470
+ SUM("quarantineQty" + "reserveQty" + "availableQty") + COALESCE("putawayinv"."putaway_qty", 0) - COALESCE("opd"."total_release_qty", 0) AS "warehouseQty",
471
+ SUM("obsoleteQty") AS "obsoleteQty",
472
+ SUM("damageQty") AS "damageQty",
473
+ SUM("storageQty") AS "storageQty",
474
+ SUM("transferQty") AS "transferQty"
449
475
  FROM "temp_inv_history" tih
450
476
  LEFT JOIN
451
477
  (
@@ -467,8 +493,9 @@ export class InventoryQuery {
467
493
  WHERE i.status = 'PUTTING_AWAY' and i.domain_id = $1
468
494
  GROUP BY i.product_id, i.packing_type, i.packing_size, i.uom
469
495
  ) AS "putawayinv" ON "tih"."id" = "putawayinv"."product_id" AND "tih"."packingType" = "putawayinv"."packing_type"
470
- GROUP BY "id", "sku", "brand", "name", "description", "packingType", "bizplaceId", "bizplaceName", "opd"."total_release_qty","putawayinv"."putaway_qty",
471
- "auxUnit1", "auxValue1", "auxUnit2", "auxValue2", "auxUnit3", "auxValue3", "auxUnit4", "auxValue4", "auxUnit5", "auxValue5"
496
+ LEFT JOIN "product_detail_stocks" pds on pds.product_detail_id = "tih"."productDetailId"
497
+ GROUP BY "tih"."id", "sku", "brand", "name", "description", "packingType", "bizplaceId", "bizplaceName", "opd"."total_release_qty","putawayinv"."putaway_qty",
498
+ "auxUnit1", "auxValue1", "auxUnit2", "auxValue2", "auxUnit3", "auxValue3", "auxUnit4", "auxValue4", "auxUnit5", "auxValue5", pds.unassigned_qty
472
499
  HAVING 1 = 1
473
500
  ${thresholdQuery}
474
501
  )
@@ -526,6 +553,7 @@ export class InventoryQuery {
526
553
  draftQty: item.draftQty,
527
554
  warehouseQty: item.warehouseQty,
528
555
  obsoleteQty: item.obsoleteQty,
556
+ damageQty: item.damageQty,
529
557
  storageQty: item.storageQty,
530
558
  transferQty: item.transferQty
531
559
  }
@@ -882,9 +910,9 @@ export class InventoryQuery {
882
910
 
883
911
  productInfoFilter
884
912
  ? qb.andWhere(
885
- '(p.name ~* :productFilterValue or p.sku ~* :productFilterValue or p.description ~* :productFilterValue or p.brand ~* :productFilterValue or p.brand_sku ~* :productFilterValue)',
886
- { productFilterValue }
887
- )
913
+ '(p.name ~* :productFilterValue or p.sku ~* :productFilterValue or p.description ~* :productFilterValue or p.brand ~* :productFilterValue or p.brand_sku ~* :productFilterValue)',
914
+ { productFilterValue }
915
+ )
888
916
  : ''
889
917
 
890
918
  bizplaceFilter ? qb.andWhere('biz.id = :bizplaceId', { bizplaceId: bizplaceFilter.value }) : ''
@@ -337,6 +337,9 @@ export class Inventory {
337
337
  @Field({ nullable: true })
338
338
  insufficientQty: number
339
339
 
340
+ @Field({ nullable: true })
341
+ damageQty: number
342
+
340
343
  constructor(obj?) {
341
344
  if (obj) {
342
345
  this.id = obj.inventory_id
@@ -901,13 +901,13 @@ export async function approveInventoryChanges(patches: any, context: any) {
901
901
  }
902
902
 
903
903
  let expirationDate = newRecord?.expirationDate ? newRecord.expirationDate : inventory.expirationDate
904
- const { shelfLife } = inventory.product
904
+ const { minOutboundShelfLife } = inventory.product
905
905
 
906
- if (shelfLife && expirationDate) {
906
+ if (minOutboundShelfLife && expirationDate) {
907
907
  let date: Date = new Date()
908
908
  expirationDate = new Date(expirationDate)
909
909
 
910
- const releaseBefore: Date = new Date(expirationDate.setDate(expirationDate.getDate() - shelfLife))
910
+ const releaseBefore: Date = new Date(expirationDate.setDate(expirationDate.getDate() - minOutboundShelfLife))
911
911
 
912
912
  if (date > releaseBefore) {
913
913
  inventory.obsolete = true
@@ -1074,14 +1074,13 @@ export async function approveInventoryChanges(patches: any, context: any) {
1074
1074
  ? null
1075
1075
  : newRecord.expirationDate
1076
1076
 
1077
- const { shelfLife } = newRecord.product
1077
+ const { minOutboundShelfLife } = newRecord.product
1078
1078
 
1079
- if (shelfLife && expirationDate) {
1079
+ if (minOutboundShelfLife && expirationDate) {
1080
1080
  let date: Date = new Date()
1081
1081
  expirationDate = new Date(expirationDate)
1082
1082
 
1083
- const releaseBefore: Date = new Date(expirationDate)
1084
- releaseBefore.setDate(expirationDate.getDate() - shelfLife)
1083
+ const releaseBefore: Date = new Date(expirationDate.setDate(expirationDate.getDate() - minOutboundShelfLife))
1085
1084
 
1086
1085
  if (date > releaseBefore) {
1087
1086
  newRecord.obsolete = true
@@ -1173,11 +1173,12 @@ export class InventoryHistoryQuery {
1173
1173
  rih.batch_id_ref as "batchIdRef", rih.product_id, rih.packing_type as "packingType", rih.bizplace_id, rih.location_id,
1174
1174
  prd.id as product_id, prd.name as product_name, prd.sku as product_sku, prd.brand as product_brand, prd.description as product_description, prd.volume as product_volume,
1175
1175
  bz.id as bizplace_id, bz.name as bizplace_name,
1176
- loc.id as location_id, loc.name as location_name, loc."zone" as location_zone, loc."row" as location_row, loc."column" as location_column, loc.shelf as location_shelf,
1176
+ loc.id as location_id, loc.name as location_name, loc."zone" as location_zone, loc."type" as location_type, loc."row" as location_row, loc."column" as location_column, loc.shelf as location_shelf,
1177
1177
  wh.name as warehouse_name, plt.name as reusable_pallet_name,
1178
1178
  rih.remark,
1179
1179
  rih.manufacture_date as "manufactureDate",
1180
1180
  rih.expiration_date as "expirationDate",
1181
+ i.adjustment_note as "adjustmentNote",
1181
1182
  coalesce((
1182
1183
  select sum(oi1.release_qty) as nonLoadedQty from order_inventories oi1
1183
1184
  inner join release_goods rg1 on rg1.id = oi1.release_good_id
@@ -1202,6 +1203,7 @@ export class InventoryHistoryQuery {
1202
1203
  inner join bizplaces bz on bz.id = rih.bizplace_id
1203
1204
  inner join locations loc on loc.id = rih.location_id
1204
1205
  inner join warehouses wh on wh.id = loc.warehouse_id
1206
+ inner join inventories i on i.id = rih.inventory_id
1205
1207
  WHERE 1 = 1
1206
1208
  ${queryOrder}
1207
1209
  ${setPagination ? 'OFFSET ' + (pagination.page - 1) * pagination.limit + ' LIMIT ' + pagination.limit : ''}
@@ -0,0 +1,6 @@
1
+ import { ProductDetailStock } from './product-detail-stock'
2
+ import { ProductDetailStockQuery } from './product-detail-stock-query'
3
+ import { ProductDetailStockMutation } from './product-detail-stock-mutation'
4
+
5
+ export const entities = [ProductDetailStock]
6
+ export const resolvers = [ProductDetailStockQuery, ProductDetailStockMutation]