@things-factory/worksheet-base 6.0.0 → 6.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/worksheet-base",
3
- "version": "6.0.0",
3
+ "version": "6.0.3",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -23,21 +23,21 @@
23
23
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
24
24
  },
25
25
  "dependencies": {
26
- "@things-factory/auth-base": "^6.0.0",
27
- "@things-factory/biz-base": "^6.0.0",
28
- "@things-factory/document-template-base": "^6.0.0",
29
- "@things-factory/id-rule-base": "^6.0.0",
30
- "@things-factory/integration-lmd": "^6.0.0",
31
- "@things-factory/integration-marketplace": "^6.0.0",
32
- "@things-factory/integration-sellercraft": "^6.0.0",
33
- "@things-factory/integration-sftp": "^6.0.0",
34
- "@things-factory/marketplace-base": "^6.0.0",
35
- "@things-factory/notification": "^6.0.0",
36
- "@things-factory/sales-base": "^6.0.0",
37
- "@things-factory/setting-base": "^6.0.0",
38
- "@things-factory/shell": "^6.0.0",
39
- "@things-factory/transport-base": "^6.0.0",
40
- "@things-factory/warehouse-base": "^6.0.0"
26
+ "@things-factory/auth-base": "^6.0.3",
27
+ "@things-factory/biz-base": "^6.0.3",
28
+ "@things-factory/document-template-base": "^6.0.1",
29
+ "@things-factory/id-rule-base": "^6.0.3",
30
+ "@things-factory/integration-lmd": "^6.0.3",
31
+ "@things-factory/integration-marketplace": "^6.0.3",
32
+ "@things-factory/integration-sellercraft": "^6.0.3",
33
+ "@things-factory/integration-sftp": "^6.0.3",
34
+ "@things-factory/marketplace-base": "^6.0.3",
35
+ "@things-factory/notification": "^6.0.3",
36
+ "@things-factory/sales-base": "^6.0.3",
37
+ "@things-factory/setting-base": "^6.0.3",
38
+ "@things-factory/shell": "^6.0.1",
39
+ "@things-factory/transport-base": "^6.0.3",
40
+ "@things-factory/warehouse-base": "^6.0.3"
41
41
  },
42
- "gitHead": "8797165c1e1f734a52cfd2c1ebbb53fe126796e9"
42
+ "gitHead": "6d9a3aef103e6d8293bfce285662d15ec9c0d705"
43
43
  }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./xilnex-controller"), exports);
18
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/controllers/pos/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAmC"}
@@ -1,183 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.XilnexController = void 0;
4
- const env_1 = require("@things-factory/env");
5
- const integration_accounting_1 = require("@things-factory/integration-accounting");
6
- const sales_base_1 = require("@things-factory/sales-base");
7
- const warehouse_base_1 = require("@things-factory/warehouse-base");
8
- const entities_1 = require("../../entities");
9
- const worksheet_controller_1 = require("../worksheet-controller");
10
- class XilnexController extends worksheet_controller_1.WorksheetController {
11
- async createInboundDocument(tx, xilnex, arrivalNoticeId, inventoryIds) {
12
- try {
13
- const arrivalNotice = await tx.getRepository(sales_base_1.ArrivalNotice).findOne({
14
- where: { id: arrivalNoticeId },
15
- relations: ['domain', 'bizplace', 'bizplace.domain']
16
- });
17
- let qb = tx
18
- .getRepository(warehouse_base_1.Inventory)
19
- .createQueryBuilder('iv')
20
- .select('p.sku', 'productSku')
21
- .addSelect('SUM(COALESCE(iv.qty,0))', 'totalQty')
22
- .addSelect('SUM(COALESCE(iv.unit_cost,0))', 'unitCost')
23
- .innerJoin('iv.location', 'loc')
24
- .innerJoin('iv.product', 'p')
25
- .where('"iv"."id" IN (:...inventoryIds)')
26
- .groupBy('iv.product_id')
27
- .addGroupBy('p.sku')
28
- .setParameters({
29
- inventoryIds: inventoryIds
30
- });
31
- let qbResult = await qb.getRawMany();
32
- let orderProducts = qbResult.map(item => {
33
- return {
34
- product: {
35
- sku: item.productSku
36
- },
37
- actualPackQty: item.totalQty,
38
- unitPrice: item.unitCost
39
- };
40
- });
41
- const orderSourceType = arrivalNotice.orderSourceType;
42
- switch (orderSourceType) {
43
- case sales_base_1.ORDER_SOURCE_TYPE.XILNEX_PO:
44
- await integration_accounting_1.AccountingAPI.createPurchaseReceive(xilnex, {
45
- arrivalNotice,
46
- orderProducts: orderProducts
47
- });
48
- break;
49
- case sales_base_1.ORDER_SOURCE_TYPE.XILNEX_TRANSFER_NOTE:
50
- await integration_accounting_1.AccountingAPI.createGoodsReceivedNote(xilnex, {
51
- arrivalNotice,
52
- orderProducts: orderProducts
53
- });
54
- break;
55
- default:
56
- break;
57
- }
58
- }
59
- catch (error) {
60
- env_1.logger.error(`xilnex-controller[createInboundDocument]: ${error}`);
61
- }
62
- }
63
- async createPartialUnloadInboundDocument(tx, xilnex, arrivalNotice, worksheetDetails) {
64
- try {
65
- let orderProducts = [];
66
- await Promise.all(worksheetDetails.map(async (wd) => {
67
- let worksheetDetail = await tx.getRepository(entities_1.WorksheetDetail).findOne({
68
- where: { name: wd.name, domain: arrivalNotice.domain, bizplace: arrivalNotice.bizplace },
69
- relations: ['targetProduct', 'targetProduct.product']
70
- });
71
- orderProducts.push({
72
- product: {
73
- sku: worksheetDetail.targetProduct.product.sku
74
- },
75
- actualPackQty: wd.actualPackQty,
76
- unitPrice: worksheetDetail.targetProduct.unitPrice
77
- });
78
- }));
79
- const orderSourceType = arrivalNotice.orderSourceType;
80
- switch (orderSourceType) {
81
- case sales_base_1.ORDER_SOURCE_TYPE.XILNEX_PO:
82
- await integration_accounting_1.AccountingAPI.createPurchaseReceive(xilnex, {
83
- arrivalNotice,
84
- orderProducts: orderProducts
85
- });
86
- break;
87
- case sales_base_1.ORDER_SOURCE_TYPE.XILNEX_TRANSFER_NOTE:
88
- await integration_accounting_1.AccountingAPI.createGoodsReceivedNote(xilnex, {
89
- arrivalNotice,
90
- orderProducts: orderProducts
91
- });
92
- break;
93
- default:
94
- break;
95
- }
96
- }
97
- catch (error) {
98
- env_1.logger.error(`xilnex-controller[createInboundDocument]: ${error}`);
99
- }
100
- }
101
- async deliveryTransferNote(tx, xilnex, releaseGoodId) {
102
- try {
103
- const releaseGood = await tx.getRepository(sales_base_1.ReleaseGood).findOne({
104
- where: { id: releaseGoodId },
105
- relations: ['domain', 'bizplace', 'bizplace.domain', 'deliveryOrders']
106
- });
107
- let deliveryOrders = releaseGood.deliveryOrders;
108
- await Promise.all(deliveryOrders.map(async (deliveryOrder) => {
109
- let qb = tx
110
- .getRepository(sales_base_1.OrderInventory)
111
- .createQueryBuilder('oi')
112
- .select('op.ref_item_id', 'refItemId')
113
- .addSelect('SUM(COALESCE(oi.release_qty,0))', 'totalReleaseQty')
114
- .leftJoin('oi.orderProduct', 'op')
115
- .where('"oi"."delivery_order_id" = :deliveryOrderId')
116
- .andWhere('"oi"."domain_id" = :domainId')
117
- .andWhere('"oi"."bizplace_id" = :bizplaceId')
118
- .groupBy('op.ref_item_id')
119
- .setParameters({
120
- deliveryOrderId: deliveryOrder.id,
121
- domainId: releaseGood.domain.id,
122
- bizplaceId: releaseGood.bizplace.id
123
- });
124
- let qbResult = await qb.getRawMany();
125
- let orderProducts = qbResult.map(item => {
126
- return {
127
- refItemId: item.refItemId,
128
- releaseQty: item.totalReleaseQty
129
- };
130
- });
131
- await integration_accounting_1.AccountingAPI.deliveryTransferNote(xilnex, {
132
- releaseGood,
133
- orderProducts: orderProducts
134
- });
135
- }));
136
- }
137
- catch (error) {
138
- env_1.logger.error(`xilnex-controller[createShipment]: ${error}`);
139
- }
140
- }
141
- async createShipment(tx, xilnex, releaseGoodId) {
142
- try {
143
- const releaseGood = await tx.getRepository(sales_base_1.ReleaseGood).findOne({
144
- where: { id: releaseGoodId },
145
- relations: ['domain', 'bizplace', 'bizplace.domain', 'deliveryOrders']
146
- });
147
- let deliveryOrders = releaseGood.deliveryOrders;
148
- await Promise.all(deliveryOrders.map(async (deliveryOrder) => {
149
- let qb = tx
150
- .getRepository(sales_base_1.OrderInventory)
151
- .createQueryBuilder('oi')
152
- .select('op.ref_item_id', 'refItemId')
153
- .addSelect('SUM(COALESCE(oi.release_qty,0))', 'totalReleaseQty')
154
- .leftJoin('oi.order_product', 'op')
155
- .where('"oi"."delivery_order_id" = :deliveryOrderId')
156
- .andWhere('"oi"."domain_id" = :domainId')
157
- .andWhere('"oi"."bizplace_id" = :bizplaceId')
158
- .groupBy('op.ref_item_id')
159
- .setParameters({
160
- deliveryOrderId: deliveryOrder.id,
161
- domainId: releaseGood.domain.id,
162
- bizplaceId: releaseGood.bizplace.id
163
- });
164
- let qbResult = await qb.getRawMany();
165
- let orderProducts = qbResult.map(item => {
166
- return {
167
- refItemId: item.refItemId,
168
- releaseQty: item.totalReleaseQty
169
- };
170
- });
171
- await integration_accounting_1.AccountingAPI.createShipment(xilnex, {
172
- releaseGood,
173
- orderProducts: orderProducts
174
- });
175
- }));
176
- }
177
- catch (error) {
178
- env_1.logger.error(`xilnex-controller[createShipment]: ${error}`);
179
- }
180
- }
181
- }
182
- exports.XilnexController = XilnexController;
183
- //# sourceMappingURL=xilnex-controller.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"xilnex-controller.js","sourceRoot":"","sources":["../../../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