@things-factory/sales-base 4.3.257 → 4.3.261

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/sales-base",
3
- "version": "4.3.257",
3
+ "version": "4.3.261",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -35,7 +35,7 @@
35
35
  "@things-factory/setting-base": "^4.3.253",
36
36
  "@things-factory/shell": "^4.3.253",
37
37
  "@things-factory/transport-base": "^4.3.253",
38
- "@things-factory/warehouse-base": "^4.3.256"
38
+ "@things-factory/warehouse-base": "^4.3.261"
39
39
  },
40
- "gitHead": "c1e0f8f18b88e3d9baca5edfb6214b5f97d63a8a"
40
+ "gitHead": "c085fa97b4a7a9abd06aab1820d4e7dbc4ed83ad"
41
41
  }
@@ -4,8 +4,8 @@ import { Bizplace } from '@things-factory/biz-base'
4
4
  import { logger } from '@things-factory/env'
5
5
  import { Platform, Powrup, PowrupAPI } from '@things-factory/integration-powrup'
6
6
  import { Product, ProductDetail } from '@things-factory/product-base'
7
+ import { Inventory, INVENTORY_STATUS, LOCATION_TYPE, ProductDetailStock } from '@things-factory/warehouse-base'
7
8
  import { Domain, User } from '@things-factory/shell'
8
- import { Inventory, INVENTORY_STATUS, LOCATION_TYPE } from '@things-factory/warehouse-base'
9
9
 
10
10
  import { ORDER_STATUS } from '../../constants'
11
11
  import { OrderPackageItem } from '../../service/order-package-item/order-package-item'
@@ -294,12 +294,16 @@ export class PowrupController {
294
294
  }
295
295
  })
296
296
 
297
+ const productDetailStock: ProductDetailStock = await trxMgr
298
+ .getRepository(ProductDetailStock)
299
+ .findOne({ productDetail })
300
+
297
301
  const powrupInvs: any[] = [
298
302
  {
299
303
  refCode: productDetail.refCode,
300
304
  stock: {
301
305
  quantityTotal: inventoryTotalQty || 0,
302
- quantityReserved: inventoryTotalLockedQty || 0,
306
+ quantityReserved: inventoryTotalLockedQty + (productDetailStock.unassignedQty || 0) || 0,
303
307
  quantityBuffer: inventoryBufferQty || 0
304
308
  }
305
309
  }
@@ -94,20 +94,20 @@ export class OrderVasMutation {
94
94
  select wd.*, ov.*
95
95
  from worksheet_details wd
96
96
  left join order_vass ov on wd.target_vas_id = ov.id
97
- where ov.id IN ('${ ids }');
97
+ where ov.id IN ('${ids}');
98
98
  `
99
99
  )
100
-
100
+
101
101
  if (foundWDs.length > 0) {
102
102
  await tx.query(
103
103
  `
104
104
  delete from worksheet_details wd
105
105
  left join order_vass or on wd.target_vas_id = ov.id
106
- where ov.id IN ('${ ids }')
106
+ where ov.id IN ('${ids}')
107
107
  `
108
108
  )
109
109
  }
110
-
110
+
111
111
  await tx.getRepository(OrderVas).delete(ids)
112
112
  return true
113
113
  }
@@ -1,6 +1,7 @@
1
1
  import { ObjectRef } from '@things-factory/shell'
2
2
  import { Field, Float, InputType, Int, ObjectType } from 'type-graphql'
3
3
  import { OrderVas } from './order-vas'
4
+ import { OrderVasItemPatch } from '../order-vas-item/order-vas-item-type'
4
5
 
5
6
  @ObjectType()
6
7
  export class OrderVasList {
@@ -154,6 +155,9 @@ export class OrderVasPatch {
154
155
  @Field(type => ObjectRef, { nullable: true })
155
156
  vas: ObjectRef
156
157
 
158
+ @Field(type => [OrderVasItemPatch], { nullable: true })
159
+ orderVasItemsPatch: OrderVasItemPatch[]
160
+
157
161
  @Field({ nullable: true })
158
162
  operationGuide: string
159
163
 
@@ -183,6 +183,7 @@ export class ReleaseGoodQuery {
183
183
  'arrivalNotice',
184
184
  'orderProducts',
185
185
  'orderProducts.product',
186
+ 'orderProducts.productDetail',
186
187
  'orderPackages',
187
188
  'orderVass',
188
189
  'orderVass.vas',
@@ -293,8 +293,8 @@ export const InventoryUtil = {
293
293
  p.id AS "productId",
294
294
  i.product_detail_id AS "productDetailId",
295
295
  SUM(COALESCE(i.qty, 0)) - SUM(COALESCE(i.locked_qty, 0)) - MAX(COALESCE(oi.release_qty, 0)) - MAX(COALESCE(bp.bundle_product_release_qty, 0)) - SUM(COALESCE(pds.unassigned_qty, 0)) AS "remainQty",
296
- SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0)) - MAX(COALESCE(bp.bundle_product_release_uom_value, 0)) - SUM(COALESCE(pds.unassigned_uom_value)) AS "remainUomValue",
297
- concat(SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0)) - MAX(COALESCE(bp.bundle_product_release_uom_value, 0)) - SUM(COALESCE(pds.unassigned_uom_value)), ' ', i.uom) AS "remainUomValueWithUom",
296
+ SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0)) - MAX(COALESCE(bp.bundle_product_release_uom_value, 0)) - SUM(COALESCE(pds.unassigned_uom_value, 0)) AS "remainUomValue",
297
+ concat(SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0)) - MAX(COALESCE(bp.bundle_product_release_uom_value, 0)) - SUM(COALESCE(pds.unassigned_uom_value, 0)), ' ', i.uom) AS "remainUomValueWithUom",
298
298
  'SINGLE' AS "groupType"
299
299
  FROM
300
300
  inventories i