@things-factory/warehouse-base 6.0.131 → 6.0.133

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/warehouse-base",
3
- "version": "6.0.131",
3
+ "version": "6.0.133",
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": "^6.0.125",
28
- "@things-factory/id-rule-base": "^6.0.125",
29
- "@things-factory/integration-sellercraft": "^6.0.127",
30
- "@things-factory/marketplace-base": "^6.0.127",
31
- "@things-factory/product-base": "^6.0.125",
32
- "@things-factory/setting-base": "^6.0.125"
27
+ "@things-factory/biz-base": "^6.0.133",
28
+ "@things-factory/id-rule-base": "^6.0.133",
29
+ "@things-factory/integration-sellercraft": "^6.0.133",
30
+ "@things-factory/marketplace-base": "^6.0.133",
31
+ "@things-factory/product-base": "^6.0.133",
32
+ "@things-factory/setting-base": "^6.0.133"
33
33
  },
34
- "gitHead": "32be4941b0997ebf8187c996d011b01cd990fa10"
34
+ "gitHead": "c08bf83d00cbb66e1338cdfeed8ca91d4e130c97"
35
35
  }
@@ -197,6 +197,62 @@ export class InventoryQuery {
197
197
  })
198
198
  }
199
199
 
200
+ @Directive('@privilege(category: "inventory", privilege: "query", domainOwnerGranted: true)')
201
+ @Query(returns => InventoryList)
202
+ async renewInventoriesGroupByProduct(
203
+ @Args() params: ListParam,
204
+ @Ctx() context: ResolverContext
205
+ ): Promise<InventoryList> {
206
+ const { domain } = context.state
207
+
208
+ const queryBuilder = getQueryBuilderFromListParams({
209
+ repository: getRepository(Inventory),
210
+ params,
211
+ alias: 'i',
212
+ domain,
213
+ searchables: ['productName', 'productSKU'],
214
+ filtersMap: {
215
+ productName: {
216
+ relationColumn: 'product',
217
+ columnName: 'name'
218
+ },
219
+ productSKU: {
220
+ relationColumn: 'product',
221
+ columnName: 'sku'
222
+ }
223
+ }
224
+ })
225
+
226
+ queryBuilder
227
+ .select('product.id', 'productId')
228
+ .addSelect('product.name', 'productName')
229
+ .addSelect('product.sku', 'productSKU')
230
+ .addSelect('product.type', 'productType')
231
+ .addSelect('product.primaryValue', 'primaryValue')
232
+ .addSelect('product.primaryUnit', 'primaryUnit')
233
+ .addSelect('product.auxUnit1', 'auxUnit1')
234
+ .addSelect('i.product_color', 'productColor')
235
+ .addSelect('i.product_quality', 'productQuality')
236
+ .addSelect('i.packing_type', 'packingType')
237
+ .addSelect('COALESCE(SUM(i.qty), 0)', 'qty')
238
+ .addSelect('COALESCE(SUM(i.locked_qty), 0)', 'lockQty')
239
+ .addSelect('COALESCE(SUM(i.uom_value), 0)', 'uomValue')
240
+ .addSelect('COALESCE(SUM(i.locked_uom_value), 0)', 'lockedUomValue')
241
+ .innerJoin('i.product', 'product', 'i.product_id = product.id')
242
+ .andWhere('i.status = :status', { status: INVENTORY_STATUS.STORED })
243
+ .andWhere('i.expiration_date >= now()')
244
+ .andWhere('product.domain_id = :domain', { domain: domain.id })
245
+ .groupBy('product.id')
246
+ .addGroupBy('i.product_color')
247
+ .addGroupBy('i.product_quality')
248
+ .addGroupBy('i.packing_type')
249
+
250
+ queryBuilder.orderBy('product.sku', 'ASC')
251
+
252
+ const items = await queryBuilder.getRawMany()
253
+ return { items, total: items.length }
254
+ }
255
+
200
256
  @Directive('@privilege(category: "inventory", privilege: "query", domainOwnerGranted: true)')
201
257
  @Directive('@transaction')
202
258
  @Query(returns => InventoryList)
@@ -1,18 +1,8 @@
1
- import {
2
- Field,
3
- Float,
4
- InputType,
5
- Int,
6
- ObjectType
7
- } from 'type-graphql'
1
+ import { Field, Float, InputType, Int, ObjectType } from 'type-graphql'
8
2
 
9
3
  import { User } from '@things-factory/auth-base'
10
4
  import { ProductBundleSetting } from '@things-factory/product-base'
11
- import {
12
- Domain,
13
- ObjectRef,
14
- ScalarDate
15
- } from '@things-factory/shell'
5
+ import { Domain, ObjectRef, ScalarDate } from '@things-factory/shell'
16
6
 
17
7
  import { Inventory } from './inventory'
18
8
 
@@ -144,6 +134,15 @@ export class InventoryPatch {
144
134
  @Field({ nullable: true })
145
135
  updater?: string
146
136
 
137
+ @Field({ nullable: true })
138
+ productColor?: string
139
+
140
+ @Field({ nullable: true })
141
+ productQuality?: string
142
+
143
+ @Field({ nullable: true })
144
+ auxInfo2?: string
145
+
147
146
  @Field({ nullable: true })
148
147
  cuFlag?: string
149
148
  }
@@ -216,9 +216,38 @@ export class Inventory {
216
216
  @Field({ nullable: true })
217
217
  productSKU: string
218
218
 
219
+ @Field({ nullable: true })
220
+ productType: string
221
+
222
+ @Field({ nullable: true })
223
+ primaryValue: string
224
+
225
+ @Field({ nullable: true })
226
+ primaryUnit: string
227
+
228
+ @Field({ nullable: true })
229
+ auxUnit1: string
230
+
219
231
  @Field({ nullable: true })
220
232
  productBrand: string
221
233
 
234
+ @Column({ nullable: true })
235
+ @Field({ nullable: true })
236
+ productColor?: string
237
+
238
+ @Column({ nullable: true })
239
+ @Field({ nullable: true })
240
+ productQuality?: string
241
+
242
+ @Column({ nullable: true })
243
+ @Field({ nullable: true })
244
+ auxInfo1?: string
245
+
246
+ // 자호
247
+ @Column({ nullable: true })
248
+ @Field({ nullable: true })
249
+ auxInfo2?: string
250
+
222
251
  @Field(type => Float, { nullable: true })
223
252
  averageUnitCost: number
224
253
 
@@ -0,0 +1,21 @@
1
+ {
2
+ "field.location": "ロケーション",
3
+ "field.product_batch": "製品配置",
4
+ "field.lot": "ロット",
5
+ "field.warehouse": "工場",
6
+ "field.zone": "ゾーン",
7
+ "field.section": "セクション",
8
+ "field.unit": "ユニット",
9
+ "field.shelf": "棚",
10
+ "field.bizplace": "作業空間",
11
+ "field.start_qty": "開始数量",
12
+ "field.in_qty": "入荷数量",
13
+ "field.out_qty": "出庫数量",
14
+ "field.end_qty": "完了数量",
15
+ "field.product": "商品",
16
+ "field.qty": "数量",
17
+ "field.state": "国",
18
+ "field.date": "日付",
19
+ "field.type": "タイプ",
20
+ "error.no_location_found": "見つかったロケーションがありません"
21
+ }