@things-factory/warehouse-base 3.7.1 → 3.7.6
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/graphql/resolvers/inventory/inventories-by-bundle.js +9 -5
- package/dist-server/graphql/resolvers/inventory/inventories-by-bundle.js.map +1 -1
- package/dist-server/graphql/resolvers/inventory/inventories-by-strategy.js +19 -4
- package/dist-server/graphql/resolvers/inventory/inventories-by-strategy.js.map +1 -1
- package/dist-server/graphql/resolvers/inventory/inventories.js +14 -6
- package/dist-server/graphql/resolvers/inventory/inventories.js.map +1 -1
- package/dist-server/graphql/resolvers/inventory-history/index.js +2 -1
- package/dist-server/graphql/resolvers/inventory-history/index.js.map +1 -1
- package/dist-server/graphql/resolvers/inventory-history/onhand-inventories.js +188 -186
- package/dist-server/graphql/resolvers/inventory-history/onhand-inventories.js.map +1 -1
- package/dist-server/graphql/types/inventory/index.js +1 -1
- package/dist-server/graphql/types/inventory/inventory-bundle-group.js +1 -0
- package/dist-server/graphql/types/inventory/inventory-bundle-group.js.map +1 -1
- package/dist-server/index.js +3 -1
- package/dist-server/index.js.map +1 -1
- package/package.json +8 -8
- package/server/graphql/resolvers/inventory/inventories-by-bundle.ts +9 -4
- package/server/graphql/resolvers/inventory/inventories-by-strategy.ts +44 -5
- package/server/graphql/resolvers/inventory/inventories.ts +29 -16
- package/server/graphql/resolvers/inventory-history/index.ts +4 -1
- package/server/graphql/resolvers/inventory-history/onhand-inventories.ts +223 -216
- package/server/graphql/types/inventory/index.ts +1 -1
- package/server/graphql/types/inventory/inventory-bundle-group.ts +1 -0
- package/server/index.ts +1 -0
|
@@ -1,198 +1,200 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.onhandInventoriesResolver = void 0;
|
|
3
|
+
exports.onhandInventories = exports.onhandInventoriesResolver = void 0;
|
|
4
4
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
5
5
|
const biz_base_1 = require("@things-factory/biz-base");
|
|
6
6
|
exports.onhandInventoriesResolver = {
|
|
7
7
|
async onhandInventories(_, { filters, pagination, sortings, locationSortingRules }, context) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
and (lower(prd.name) like any(array[${products}])
|
|
67
|
-
or lower(prd.description) like any(array[${products}])
|
|
68
|
-
or lower(prd.sku) like any(array[${products}]))
|
|
69
|
-
and prd.id = rih.product_id
|
|
70
|
-
group by prd.id
|
|
71
|
-
)`;
|
|
72
|
-
}
|
|
73
|
-
if (location) {
|
|
74
|
-
let locations = location.value
|
|
75
|
-
.map(loc => {
|
|
76
|
-
return "'" + loc + "'";
|
|
77
|
-
})
|
|
78
|
-
.join(',');
|
|
79
|
-
queryFilter =
|
|
80
|
-
queryFilter +
|
|
81
|
-
`and exists (
|
|
82
|
-
select loc.id from locations loc where
|
|
83
|
-
loc.id = any(array[${locations}]::uuid[])
|
|
84
|
-
and loc.id = rih.location_id
|
|
85
|
-
)`;
|
|
86
|
-
}
|
|
87
|
-
// default sorting
|
|
88
|
-
let queryOrder = 'order by created_at desc';
|
|
89
|
-
if (sortings && sortings.length > 0) {
|
|
90
|
-
const arrObjectMap = [
|
|
91
|
-
{ name: 'palletId', value: 'rih.pallet_id' },
|
|
92
|
-
{ name: 'cartonId', value: 'rih.carton_id' },
|
|
93
|
-
{ name: 'batchId', value: 'rih.batch_id' },
|
|
94
|
-
{ name: 'initialInboundAt', value: 'rih.initial_inbound_at' },
|
|
95
|
-
{ name: 'bizplace|name', value: 'bz.name' },
|
|
96
|
-
{ name: 'product|name', value: 'prd.sku' },
|
|
97
|
-
{ name: 'remainQty', value: 'rih.qty' },
|
|
98
|
-
{ name: 'location|name', value: 'loc.name' }
|
|
99
|
-
];
|
|
100
|
-
sortings.forEach((sorting, idx) => {
|
|
101
|
-
let itmIndex = arrObjectMap.findIndex(x => x.name === sorting.name);
|
|
102
|
-
queryOrder = `${idx === 0 ? 'order by' : queryOrder + ','} ${itmIndex >= 0 ? arrObjectMap[itmIndex].value : sorting.name} ${sorting.desc ? 'DESC' : 'ASC'}`;
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
if (batchId)
|
|
106
|
-
queryFilter = `${queryFilter} and lower(rih.batch_id) like '${batchId.value.toLowerCase()}' `;
|
|
107
|
-
if (palletId)
|
|
108
|
-
queryFilter = `${queryFilter} and rih.pallet_id like '${palletId.value}' `;
|
|
109
|
-
if (cartonId)
|
|
110
|
-
queryFilter = `${queryFilter} and rih.carton_id like '${cartonId.value}' `;
|
|
111
|
-
if (packingType)
|
|
112
|
-
queryFilter = `${queryFilter} and rih.packing_type like '${packingType.value}' `;
|
|
113
|
-
let expirationQueryFilter = ``;
|
|
114
|
-
if (expiration)
|
|
115
|
-
expirationQueryFilter = ` and iv.expiration_date >= '${expFromDate.value}'::timestamp + '${timezoneOffset}'::INTERVAL and
|
|
116
|
-
iv.expiration_date <= '${expToDate.value}'::timestamp + '${timezoneOffset}'::INTERVAL + '1 day'::INTERVAL`;
|
|
117
|
-
// query the results
|
|
118
|
-
await tx.query(`
|
|
119
|
-
CREATE TEMP TABLE tmp_bizfilter AS (
|
|
120
|
-
SELECT bizplace_id::uuid FROM (VALUES ${bizplaces}) AS bizFilter(bizplace_id)
|
|
121
|
-
);
|
|
122
|
-
`);
|
|
123
|
-
await tx.query(`
|
|
124
|
-
create temp table tmp_src as (
|
|
125
|
-
select domain_id, pallet_id, carton_id, seq, qty, uom_value, packing_type, batch_id, batch_id_ref, created_at, status,
|
|
126
|
-
product_id::uuid as product_id, bizplace_id::uuid as bizplace_id, location_id::uuid as location_id
|
|
127
|
-
from reduced_inventory_histories rih
|
|
128
|
-
where domain_id = $1 and created_at < $2::timestamp + $3::INTERVAL + '1 day'::INTERVAL
|
|
129
|
-
);
|
|
130
|
-
`, [domain.id, createdAt.value, timezoneOffset]);
|
|
131
|
-
await tx.query(`
|
|
132
|
-
create temp table tmp_data as (
|
|
133
|
-
select dt.*, rih.carton_id, rih.batch_id, rih.batch_id_ref, rih.product_id, rih.packing_type, rih.bizplace_id, rih.location_id, iv.uom,
|
|
134
|
-
iv.expiration_date, iv.reusable_pallet_id, iv.remark
|
|
135
|
-
from
|
|
136
|
-
(
|
|
137
|
-
select ih.domain_id, ih.pallet_id, sum(ih.qty) as qty, sum(ih.uom_value) as uom_value, max(ih.seq) as last_seq, max(ih.created_at) as created_at,
|
|
138
|
-
min(ih.created_at) as initial_inbound_at
|
|
139
|
-
from tmp_src ih
|
|
140
|
-
group by ih.domain_id, ih.pallet_id
|
|
141
|
-
) dt
|
|
142
|
-
inner join tmp_src rih on dt.domain_id = rih.domain_id and dt.pallet_id = rih.pallet_id and dt.last_seq = rih.seq and rih.status <> 'TERMINATED'
|
|
143
|
-
inner join inventories iv on iv.domain_id = dt.domain_id and iv.pallet_id = dt.pallet_id
|
|
8
|
+
return await onhandInventories(filters, pagination, sortings, locationSortingRules, context);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
async function onhandInventories(filters, pagination, sortings, locationSortingRules, context, setPagination = true) {
|
|
12
|
+
const { domain, user, tx } = context.state;
|
|
13
|
+
// define all inputs
|
|
14
|
+
let userFilter = filters.find(data => data.name === 'user');
|
|
15
|
+
let product = filters.find(data => data.name === 'product');
|
|
16
|
+
let createdAt = filters.find(data => data.name === 'created_at');
|
|
17
|
+
let location = filters.find(data => data.name === 'location');
|
|
18
|
+
let batchId = filters.find(data => data.name === 'batchId');
|
|
19
|
+
let palletId = filters.find(data => data.name === 'palletId');
|
|
20
|
+
let cartonId = filters.find(data => data.name === 'cartonId');
|
|
21
|
+
let packingType = filters.find(data => data.name === 'packingType');
|
|
22
|
+
let timezoneOffset = filters.find(data => data.name === 'timezoneOffset').value + ' minutes';
|
|
23
|
+
// expiration date filter
|
|
24
|
+
let expiration = filters.find(data => data.name === 'expiration').value;
|
|
25
|
+
let expFromDate = filters.find(data => data.name === 'expFromDate');
|
|
26
|
+
let expToDate = filters.find(data => data.name === 'expToDate');
|
|
27
|
+
let bizplaceFilter = { name: '', operator: '', value: [] };
|
|
28
|
+
// prepare query filters
|
|
29
|
+
if (userFilter) {
|
|
30
|
+
const user = await tx.getRepository(auth_base_1.User).findOne({
|
|
31
|
+
where: { id: userFilter.value },
|
|
32
|
+
relations: ['bizplaces']
|
|
33
|
+
});
|
|
34
|
+
const bizplace = user.bizplaces[0];
|
|
35
|
+
if (!bizplace)
|
|
36
|
+
throw 'Invalid input';
|
|
37
|
+
bizplaceFilter = { name: 'bizplace', operator: 'eq', value: [bizplace.id] };
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
bizplaceFilter = !filters.find((filter) => filter.name === 'bizplace')
|
|
41
|
+
? {
|
|
42
|
+
name: 'bizplace',
|
|
43
|
+
operator: 'in',
|
|
44
|
+
value: await (0, biz_base_1.getPermittedBizplaceIds)(domain, user),
|
|
45
|
+
relation: true
|
|
46
|
+
}
|
|
47
|
+
: Object.assign(Object.assign({}, filters.find(data => data.name === 'bizplace')), { value: [filters.find(data => data.name === 'bizplace').value] });
|
|
48
|
+
}
|
|
49
|
+
let queryFilter = ``;
|
|
50
|
+
let bizplaces = bizplaceFilter.value.map(id => `('${id}')`).join(',');
|
|
51
|
+
if (product) {
|
|
52
|
+
let products = product.value
|
|
53
|
+
.toLowerCase()
|
|
54
|
+
.split(',')
|
|
55
|
+
.map(prod => {
|
|
56
|
+
return "'%" + prod.trim().replace(/'/g, "''") + "%'";
|
|
57
|
+
})
|
|
58
|
+
.join(',');
|
|
59
|
+
queryFilter =
|
|
60
|
+
queryFilter +
|
|
61
|
+
` and exists (
|
|
62
|
+
select prd.id as product_id from products prd
|
|
63
|
+
inner join bizplaces b on b.id = prd.bizplace_id
|
|
64
|
+
inner join companies c on c.domain_id = b.domain_id
|
|
65
|
+
inner join bizplaces b2 on b2.company_id = c.id
|
|
144
66
|
where exists (
|
|
145
67
|
SELECT * FROM tmp_bizfilter bizFilter
|
|
146
|
-
WHERE bizFilter.bizplace_id = "
|
|
68
|
+
WHERE bizFilter.bizplace_id = "b2"."id"
|
|
147
69
|
)
|
|
148
|
-
${
|
|
149
|
-
${
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
name: itm.location_name,
|
|
186
|
-
type: itm.location_type,
|
|
187
|
-
zone: itm.location_zone
|
|
188
|
-
}, product: {
|
|
189
|
-
id: itm.product_id,
|
|
190
|
-
name: itm.product_name,
|
|
191
|
-
description: itm.product_description,
|
|
192
|
-
sku: itm.product_sku
|
|
193
|
-
} });
|
|
70
|
+
and (lower(prd.name) like any(array[${products}])
|
|
71
|
+
or lower(prd.description) like any(array[${products}])
|
|
72
|
+
or lower(prd.sku) like any(array[${products}]))
|
|
73
|
+
and prd.id = rih.product_id
|
|
74
|
+
group by prd.id
|
|
75
|
+
)`;
|
|
76
|
+
}
|
|
77
|
+
if (location) {
|
|
78
|
+
let locations = location.value
|
|
79
|
+
.map(loc => {
|
|
80
|
+
return "'" + loc + "'";
|
|
81
|
+
})
|
|
82
|
+
.join(',');
|
|
83
|
+
queryFilter =
|
|
84
|
+
queryFilter +
|
|
85
|
+
`and exists (
|
|
86
|
+
select loc.id from locations loc where
|
|
87
|
+
loc.id = any(array[${locations}]::uuid[])
|
|
88
|
+
and loc.id = rih.location_id
|
|
89
|
+
)`;
|
|
90
|
+
}
|
|
91
|
+
// default sorting
|
|
92
|
+
let queryOrder = 'order by created_at desc';
|
|
93
|
+
if (sortings && sortings.length > 0) {
|
|
94
|
+
const arrObjectMap = [
|
|
95
|
+
{ name: 'palletId', value: 'rih.pallet_id' },
|
|
96
|
+
{ name: 'cartonId', value: 'rih.carton_id' },
|
|
97
|
+
{ name: 'batchId', value: 'rih.batch_id' },
|
|
98
|
+
{ name: 'initialInboundAt', value: 'rih.initial_inbound_at' },
|
|
99
|
+
{ name: 'bizplace|name', value: 'bz.name' },
|
|
100
|
+
{ name: 'product|name', value: 'prd.sku' },
|
|
101
|
+
{ name: 'remainQty', value: 'rih.qty' },
|
|
102
|
+
{ name: 'location|name', value: 'loc.name' }
|
|
103
|
+
];
|
|
104
|
+
sortings.forEach((sorting, idx) => {
|
|
105
|
+
let itmIndex = arrObjectMap.findIndex(x => x.name === sorting.name);
|
|
106
|
+
queryOrder = `${idx === 0 ? 'order by' : queryOrder + ','} ${itmIndex >= 0 ? arrObjectMap[itmIndex].value : sorting.name} ${sorting.desc ? 'DESC' : 'ASC'}`;
|
|
194
107
|
});
|
|
195
|
-
return { items, total: total[0].count };
|
|
196
108
|
}
|
|
197
|
-
|
|
109
|
+
if (batchId)
|
|
110
|
+
queryFilter = `${queryFilter} and lower(rih.batch_id) like '${batchId.value.toLowerCase()}' `;
|
|
111
|
+
if (palletId)
|
|
112
|
+
queryFilter = `${queryFilter} and rih.pallet_id like '${palletId.value}' `;
|
|
113
|
+
if (cartonId)
|
|
114
|
+
queryFilter = `${queryFilter} and rih.carton_id like '${cartonId.value}' `;
|
|
115
|
+
if (packingType)
|
|
116
|
+
queryFilter = `${queryFilter} and rih.packing_type like '${packingType.value}' `;
|
|
117
|
+
let expirationQueryFilter = ``;
|
|
118
|
+
if (expiration)
|
|
119
|
+
expirationQueryFilter = ` and iv.expiration_date >= '${expFromDate.value}'::timestamp + '${timezoneOffset}'::INTERVAL and
|
|
120
|
+
iv.expiration_date <= '${expToDate.value}'::timestamp + '${timezoneOffset}'::INTERVAL + '1 day'::INTERVAL`;
|
|
121
|
+
// query the results
|
|
122
|
+
await tx.query(`
|
|
123
|
+
CREATE TEMP TABLE tmp_bizfilter on commit drop AS (
|
|
124
|
+
SELECT bizplace_id::uuid FROM (VALUES ${bizplaces}) AS bizFilter(bizplace_id)
|
|
125
|
+
);
|
|
126
|
+
`);
|
|
127
|
+
await tx.query(`
|
|
128
|
+
create temp table tmp_src on commit drop as (
|
|
129
|
+
select domain_id, pallet_id, carton_id, seq, qty, uom_value, packing_type, batch_id, batch_id_ref, created_at, status,
|
|
130
|
+
product_id::uuid as product_id, bizplace_id::uuid as bizplace_id, location_id::uuid as location_id
|
|
131
|
+
from reduced_inventory_histories rih
|
|
132
|
+
where domain_id = $1 and created_at < $2::timestamp + $3::INTERVAL + '1 day'::INTERVAL
|
|
133
|
+
);
|
|
134
|
+
`, [domain.id, createdAt.value, timezoneOffset]);
|
|
135
|
+
await tx.query(`
|
|
136
|
+
create temp table tmp_data on commit drop as (
|
|
137
|
+
select dt.*, rih.carton_id, rih.batch_id, rih.batch_id_ref, rih.product_id, rih.packing_type, rih.bizplace_id, rih.location_id, iv.uom,
|
|
138
|
+
iv.expiration_date, iv.reusable_pallet_id, iv.remark
|
|
139
|
+
from
|
|
140
|
+
(
|
|
141
|
+
select ih.domain_id, ih.pallet_id, sum(ih.qty) as qty, sum(ih.uom_value) as uom_value, max(ih.seq) as last_seq, max(ih.created_at) as created_at,
|
|
142
|
+
min(ih.created_at) as initial_inbound_at
|
|
143
|
+
from tmp_src ih
|
|
144
|
+
group by ih.domain_id, ih.pallet_id
|
|
145
|
+
) dt
|
|
146
|
+
inner join tmp_src rih on dt.domain_id = rih.domain_id and dt.pallet_id = rih.pallet_id and dt.last_seq = rih.seq and rih.status <> 'TERMINATED'
|
|
147
|
+
inner join inventories iv on iv.domain_id = dt.domain_id and iv.pallet_id = dt.pallet_id
|
|
148
|
+
where exists (
|
|
149
|
+
SELECT * FROM tmp_bizfilter bizFilter
|
|
150
|
+
WHERE bizFilter.bizplace_id = "rih"."bizplace_id"
|
|
151
|
+
)
|
|
152
|
+
${queryFilter}
|
|
153
|
+
${expirationQueryFilter}
|
|
154
|
+
);
|
|
155
|
+
`);
|
|
156
|
+
const total = await tx.query(`select count(*) from tmp_data`);
|
|
157
|
+
const result = await tx.query(`
|
|
158
|
+
select
|
|
159
|
+
rih.domain_id, rih.pallet_id as "palletId", rih.carton_id as "cartonId", rih.qty as "remainQty", rih.uom_value as "uomValue", rih.uom, rih.last_seq, rih.created_at,
|
|
160
|
+
rih.initial_inbound_at as "initialInboundAt",
|
|
161
|
+
case when rih.reusable_pallet_id is not null then concat(rih.batch_id, ' (', plt.name, ')') else rih.batch_id end as "batchId",
|
|
162
|
+
rih.batch_id_ref as "batchIdRef", rih.product_id, rih.packing_type as "packingType", rih.bizplace_id, rih.location_id,
|
|
163
|
+
prd.id as product_id, prd.name as product_name, prd.sku as product_sku, prd.description as product_description,
|
|
164
|
+
bz.id as bizplace_id, bz.name as bizplace_name,
|
|
165
|
+
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,
|
|
166
|
+
wh.name as warehouse_name, plt.name as reusable_pallet_name,
|
|
167
|
+
rih.remark,
|
|
168
|
+
rih.expiration_date as "expirationDate"
|
|
169
|
+
from tmp_data rih
|
|
170
|
+
left join pallets plt on plt.id = rih.reusable_pallet_id
|
|
171
|
+
inner join products prd on prd.id = rih.product_id
|
|
172
|
+
inner join bizplaces bz on bz.id = rih.bizplace_id
|
|
173
|
+
inner join locations loc on loc.id = rih.location_id
|
|
174
|
+
inner join warehouses wh on wh.id = loc.warehouse_id
|
|
175
|
+
WHERE 1 = 1
|
|
176
|
+
${queryOrder}
|
|
177
|
+
${setPagination ? 'OFFSET ' + (pagination.page - 1) * pagination.limit + ' LIMIT ' + pagination.limit : ''}
|
|
178
|
+
;
|
|
179
|
+
`);
|
|
180
|
+
// map all results
|
|
181
|
+
let items = result.map(itm => {
|
|
182
|
+
return Object.assign(Object.assign({}, itm), { bizplace: {
|
|
183
|
+
id: itm.bizplace_id,
|
|
184
|
+
name: itm.bizplace_name
|
|
185
|
+
}, location: {
|
|
186
|
+
id: itm.location_id,
|
|
187
|
+
name: itm.location_name,
|
|
188
|
+
type: itm.location_type,
|
|
189
|
+
zone: itm.location_zone
|
|
190
|
+
}, product: {
|
|
191
|
+
id: itm.product_id,
|
|
192
|
+
name: itm.product_name,
|
|
193
|
+
description: itm.product_description,
|
|
194
|
+
sku: itm.product_sku
|
|
195
|
+
} });
|
|
196
|
+
});
|
|
197
|
+
return { items, total: total[0].count };
|
|
198
|
+
}
|
|
199
|
+
exports.onhandInventories = onhandInventories;
|
|
198
200
|
//# sourceMappingURL=onhand-inventories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onhand-inventories.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/inventory-history/onhand-inventories.ts"],"names":[],"mappings":";;;AAEA,yDAAgD;AAChD,uDAA4E;AAG/D,QAAA,yBAAyB,GAAG;IACvC,KAAK,CAAC,iBAAiB,CAAC,CAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,oBAAoB,EAAE,EAAE,OAAY;QACnG,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAsD,OAAO,CAAC,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"onhand-inventories.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/inventory-history/onhand-inventories.ts"],"names":[],"mappings":";;;AAEA,yDAAgD;AAChD,uDAA4E;AAG/D,QAAA,yBAAyB,GAAG;IACvC,KAAK,CAAC,iBAAiB,CAAC,CAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,oBAAoB,EAAE,EAAE,OAAY;QACnG,OAAO,MAAM,iBAAiB,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,oBAAoB,EAAE,OAAO,CAAC,CAAA;IAC9F,CAAC;CACF,CAAA;AAEM,KAAK,UAAU,iBAAiB,CACrC,OAAO,EACP,UAAU,EACV,QAAQ,EACR,oBAAoB,EACpB,OAAO,EACP,aAAa,GAAG,IAAI;IAEpB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAsD,OAAO,CAAC,KAAK,CAAA;IAE7F,oBAAoB;IACpB,IAAI,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,CAAA;IAC3D,IAAI,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAA;IAC3D,IAAI,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,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E,CAAA;AACzC,CAAC;AAvOD,8CAuOC"}
|
|
@@ -45,7 +45,7 @@ exports.Query = `
|
|
|
45
45
|
inventory(palletId: String!): Inventory @privilege(category: "inventory", privilege: "query")
|
|
46
46
|
inventoryByPallet(palletId: String!): Inventory @privilege(category: "inventory", privilege: "query")
|
|
47
47
|
inventoriesByProduct(filters: [Filter], pagination: Pagination, sortings: [Sorting]): InventoryList @privilege(category: "inventory", privilege: "query") @transaction
|
|
48
|
-
inventoriesByStrategy(worksheetId: String!, batchId: String!, bizplaceId: String, productName: String!, productSku: String!, packingType: String!, pickingStrategy: String! locationSortingRules: [Sorting]): InventoryList @transaction
|
|
48
|
+
inventoriesByStrategy(worksheetId: String!, batchId: String!, bizplaceId: String, productName: String!, productSku: String!, packingType: String!, packingSize: Float!, uom: String!, pickingStrategy: String! locationSortingRules: [Sorting]): InventoryList @transaction
|
|
49
49
|
checkProductIdenticality(palletA: String!, palletB: String!): Boolean @transaction
|
|
50
50
|
checkCartonIdenticality(cartonA: String!, palletA: String!, cartonB: String!): Boolean
|
|
51
51
|
checkInventoryOwner(palletId: String!, bizplaceName: String!): Boolean
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inventory-bundle-group.js","sourceRoot":"","sources":["../../../../server/graphql/types/inventory/inventory-bundle-group.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA6B;AAEhB,QAAA,oBAAoB,GAAG,IAAA,qBAAG,EAAA
|
|
1
|
+
{"version":3,"file":"inventory-bundle-group.js","sourceRoot":"","sources":["../../../../server/graphql/types/inventory/inventory-bundle-group.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA6B;AAEhB,QAAA,oBAAoB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BtC,CAAA"}
|
package/dist-server/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.updateWarehouse = exports.deleteWarehouses = exports.deleteWarehouse = exports.createWarehouse = exports.updateLocation = exports.deleteLocations = exports.deleteLocation = exports.createLocation = void 0;
|
|
13
|
+
exports.onhandInventories = exports.updateWarehouse = exports.deleteWarehouses = exports.deleteWarehouse = exports.createWarehouse = exports.updateLocation = exports.deleteLocations = exports.deleteLocation = exports.createLocation = void 0;
|
|
14
14
|
__exportStar(require("./constants"), exports);
|
|
15
15
|
__exportStar(require("./entities"), exports);
|
|
16
16
|
__exportStar(require("./graphql"), exports);
|
|
@@ -24,6 +24,8 @@ Object.defineProperty(exports, "createWarehouse", { enumerable: true, get: funct
|
|
|
24
24
|
Object.defineProperty(exports, "deleteWarehouse", { enumerable: true, get: function () { return warehouse_1.deleteWarehouse; } });
|
|
25
25
|
Object.defineProperty(exports, "deleteWarehouses", { enumerable: true, get: function () { return warehouse_1.deleteWarehouses; } });
|
|
26
26
|
Object.defineProperty(exports, "updateWarehouse", { enumerable: true, get: function () { return warehouse_1.updateWarehouse; } });
|
|
27
|
+
var onhand_inventories_1 = require("./graphql/resolvers/inventory-history/onhand-inventories");
|
|
28
|
+
Object.defineProperty(exports, "onhandInventories", { enumerable: true, get: function () { return onhand_inventories_1.onhandInventories; } });
|
|
27
29
|
__exportStar(require("./migrations"), exports);
|
|
28
30
|
__exportStar(require("./utils"), exports);
|
|
29
31
|
//# sourceMappingURL=index.js.map
|
package/dist-server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,6CAA0B;AAC1B,4CAAyB;AACzB,yDAA8G;AAArG,0GAAA,cAAc,OAAA;AAAE,0GAAA,cAAc,OAAA;AAAE,2GAAA,eAAe,OAAA;AAAE,0GAAA,cAAc,OAAA;AACxE,2DAAmH;AAA1G,4GAAA,eAAe,OAAA;AAAE,4GAAA,eAAe,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AAAE,4GAAA,eAAe,OAAA;AAC5E,+CAA4B;AAC5B,0CAAuB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,6CAA0B;AAC1B,4CAAyB;AACzB,yDAA8G;AAArG,0GAAA,cAAc,OAAA;AAAE,0GAAA,cAAc,OAAA;AAAE,2GAAA,eAAe,OAAA;AAAE,0GAAA,cAAc,OAAA;AACxE,2DAAmH;AAA1G,4GAAA,eAAe,OAAA;AAAE,4GAAA,eAAe,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AAAE,4GAAA,eAAe,OAAA;AAC5E,+FAA4F;AAAnF,uHAAA,iBAAiB,OAAA;AAC1B,+CAA4B;AAC5B,0CAAuB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/warehouse-base",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.6",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@things-factory/biz-base": "^3.7.
|
|
28
|
-
"@things-factory/id-rule-base": "^3.7.
|
|
29
|
-
"@things-factory/integration-sellercraft": "^3.7.
|
|
30
|
-
"@things-factory/marketplace-base": "^3.7.
|
|
31
|
-
"@things-factory/product-base": "^3.7.
|
|
32
|
-
"@things-factory/setting-base": "^3.7.
|
|
27
|
+
"@things-factory/biz-base": "^3.7.5",
|
|
28
|
+
"@things-factory/id-rule-base": "^3.7.6",
|
|
29
|
+
"@things-factory/integration-sellercraft": "^3.7.5",
|
|
30
|
+
"@things-factory/marketplace-base": "^3.7.6",
|
|
31
|
+
"@things-factory/product-base": "^3.7.5",
|
|
32
|
+
"@things-factory/setting-base": "^3.7.5"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "d9d72c07fc3b01af2ede46808ec0aced3241ed51"
|
|
35
35
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { getRepository, SelectQueryBuilder } from 'typeorm'
|
|
2
|
+
|
|
1
3
|
import { User } from '@things-factory/auth-base'
|
|
2
4
|
import { getPermittedBizplaceIds } from '@things-factory/biz-base'
|
|
5
|
+
import { ProductBundleSetting } from '@things-factory/product-base'
|
|
3
6
|
import { buildQuery, Domain } from '@things-factory/shell'
|
|
4
|
-
|
|
7
|
+
|
|
5
8
|
import { Inventory } from '../../../entities'
|
|
6
|
-
import { ProductBundleSetting } from '@things-factory/product-base'
|
|
7
9
|
|
|
8
10
|
export const inventoriesByBundleResolver = {
|
|
9
11
|
async inventoriesByBundle(_: any, { filters, pagination, sortings }, context: any) {
|
|
@@ -70,6 +72,7 @@ export const inventoriesByBundleResolver = {
|
|
|
70
72
|
.addSelect('iv.batch_id', 'batchId')
|
|
71
73
|
.addSelect('iv.batch_id_ref', 'batchIdRef')
|
|
72
74
|
.addSelect('iv.packing_type', 'packingType')
|
|
75
|
+
.addSelect('iv.uom', 'uom')
|
|
73
76
|
.addSelect('SUM(iv.qty)', 'qty')
|
|
74
77
|
.addSelect('SUM(iv.locked_qty)', 'lockedQty')
|
|
75
78
|
.addSelect('SUM(iv.uom_value)', 'uomValue')
|
|
@@ -78,7 +81,7 @@ export const inventoriesByBundleResolver = {
|
|
|
78
81
|
.addSelect('prd.name', 'productName')
|
|
79
82
|
.addSelect('prd.description', 'productDescription')
|
|
80
83
|
.addSelect('prd.type', 'productType')
|
|
81
|
-
.addSelect('prd.primary_unit', '
|
|
84
|
+
// .addSelect('prd.primary_unit', 'productUom')
|
|
82
85
|
.leftJoin('iv.product', 'prd')
|
|
83
86
|
|
|
84
87
|
if (remainOnly) {
|
|
@@ -98,12 +101,13 @@ export const inventoriesByBundleResolver = {
|
|
|
98
101
|
.addGroupBy('iv.batch_id')
|
|
99
102
|
.addGroupBy('iv.batch_id_ref')
|
|
100
103
|
.addGroupBy('iv.packing_type')
|
|
104
|
+
.addGroupBy('iv.uom')
|
|
101
105
|
.addGroupBy('prd.sku')
|
|
102
106
|
.addGroupBy('prd.name')
|
|
103
107
|
.addGroupBy('prd.description')
|
|
104
108
|
.addGroupBy('prd.type')
|
|
105
109
|
.addOrderBy('prd.name')
|
|
106
|
-
.addGroupBy('prd.primary_unit')
|
|
110
|
+
// .addGroupBy('prd.primary_unit')
|
|
107
111
|
.addOrderBy('iv.batch_id')
|
|
108
112
|
|
|
109
113
|
let bundleGroup = await qb.getRawMany()
|
|
@@ -114,6 +118,7 @@ export const inventoriesByBundleResolver = {
|
|
|
114
118
|
bundleId: productBundleId,
|
|
115
119
|
remainQty: item.qty - (item.lockedQty ? item.lockedQty : 0),
|
|
116
120
|
remainUomValue: item.uomValue - (item.lockedUomValue ? item.lockedUomValue : 0),
|
|
121
|
+
// productUom: item.productUom,
|
|
117
122
|
uom: item.uom,
|
|
118
123
|
bundleQty: productBundleSettings.filter(pbs => pbs.product.id === item.productId)[0].bundleQty
|
|
119
124
|
}
|