@things-factory/operato-hub 6.2.102 → 6.2.103
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/controllers/bizplace-initializer/codes.js +21 -0
- package/dist-server/controllers/bizplace-initializer/codes.js.map +1 -0
- package/dist-server/controllers/bizplace-initializer/dataset/codes.js +402 -0
- package/dist-server/controllers/bizplace-initializer/dataset/codes.js.map +1 -0
- package/dist-server/controllers/bizplace-initializer/dataset/groups.js +24 -0
- package/dist-server/controllers/bizplace-initializer/dataset/groups.js.map +1 -0
- package/dist-server/controllers/bizplace-initializer/dataset/index.js +9 -0
- package/dist-server/controllers/bizplace-initializer/dataset/index.js.map +1 -0
- package/dist-server/controllers/bizplace-initializer/dataset/menus.js +504 -0
- package/dist-server/controllers/bizplace-initializer/dataset/menus.js.map +1 -0
- package/dist-server/controllers/bizplace-initializer/dataset/roles-privileges.js +406 -0
- package/dist-server/controllers/bizplace-initializer/dataset/roles-privileges.js.map +1 -0
- package/dist-server/controllers/bizplace-initializer/dataset/settings.js +94 -0
- package/dist-server/controllers/bizplace-initializer/dataset/settings.js.map +1 -0
- package/dist-server/controllers/bizplace-initializer/generate-bizplace-domain-roles.js +26 -0
- package/dist-server/controllers/bizplace-initializer/generate-bizplace-domain-roles.js.map +1 -0
- package/dist-server/controllers/bizplace-initializer/generate-bizplace-domain.js +44 -0
- package/dist-server/controllers/bizplace-initializer/generate-bizplace-domain.js.map +1 -0
- package/dist-server/controllers/bizplace-initializer/groups.js +18 -0
- package/dist-server/controllers/bizplace-initializer/groups.js.map +1 -0
- package/dist-server/controllers/bizplace-initializer/index.js +9 -0
- package/dist-server/controllers/bizplace-initializer/index.js.map +1 -0
- package/dist-server/controllers/bizplace-initializer/menus.js +28 -0
- package/dist-server/controllers/bizplace-initializer/menus.js.map +1 -0
- package/dist-server/controllers/bizplace-initializer/settings.js +16 -0
- package/dist-server/controllers/bizplace-initializer/settings.js.map +1 -0
- package/dist-server/controllers/company-initializer/business-register.js +48 -0
- package/dist-server/controllers/company-initializer/business-register.js.map +1 -0
- package/dist-server/controllers/company-initializer/codes.js +137 -0
- package/dist-server/controllers/company-initializer/codes.js.map +1 -0
- package/dist-server/controllers/company-initializer/generate-company-roles.js +117 -0
- package/dist-server/controllers/company-initializer/generate-company-roles.js.map +1 -0
- package/dist-server/controllers/company-initializer/index.js +10 -0
- package/dist-server/controllers/company-initializer/index.js.map +1 -0
- package/dist-server/controllers/company-initializer/menus.js +348 -0
- package/dist-server/controllers/company-initializer/menus.js.map +1 -0
- package/dist-server/controllers/company-initializer/settings.js +31 -0
- package/dist-server/controllers/company-initializer/settings.js.map +1 -0
- package/dist-server/controllers/company-initializer/transporter.js +18 -0
- package/dist-server/controllers/company-initializer/transporter.js.map +1 -0
- package/dist-server/controllers/index.js +1 -0
- package/dist-server/controllers/index.js.map +1 -0
- package/dist-server/controllers/invitation.js +119 -0
- package/dist-server/controllers/invitation.js.map +1 -0
- package/dist-server/controllers/utils/make-invitation-token.js +10 -0
- package/dist-server/controllers/utils/make-invitation-token.js.map +1 -0
- package/dist-server/controllers/utils/save-invitation-token.js +13 -0
- package/dist-server/controllers/utils/save-invitation-token.js.map +1 -0
- package/dist-server/entities/index.js +1 -0
- package/dist-server/entities/index.js.map +1 -0
- package/dist-server/errors/index.js +5 -0
- package/dist-server/errors/index.js.map +1 -0
- package/dist-server/errors/validation-error.js +14 -0
- package/dist-server/errors/validation-error.js.map +1 -0
- package/dist-server/graphql/index.js +11 -0
- package/dist-server/graphql/index.js.map +1 -0
- package/dist-server/graphql/resolvers/generators/generate-bizplace.js +38 -0
- package/dist-server/graphql/resolvers/generators/generate-bizplace.js.map +1 -0
- package/dist-server/graphql/resolvers/generators/generate-company.js +61 -0
- package/dist-server/graphql/resolvers/generators/generate-company.js.map +1 -0
- package/dist-server/graphql/resolvers/generators/index.js +8 -0
- package/dist-server/graphql/resolvers/generators/index.js.map +1 -0
- package/dist-server/graphql/resolvers/generators/update-domain-extType.js +46 -0
- package/dist-server/graphql/resolvers/generators/update-domain-extType.js.map +1 -0
- package/dist-server/graphql/resolvers/index.js +11 -0
- package/dist-server/graphql/resolvers/index.js.map +1 -0
- package/dist-server/graphql/resolvers/invitations/index.js +6 -0
- package/dist-server/graphql/resolvers/invitations/index.js.map +1 -0
- package/dist-server/graphql/resolvers/invitations/partner-invitation.js +52 -0
- package/dist-server/graphql/resolvers/invitations/partner-invitation.js.map +1 -0
- package/dist-server/graphql/resolvers/oauth2/company-roles-by-scope.js +33 -0
- package/dist-server/graphql/resolvers/oauth2/company-roles-by-scope.js.map +1 -0
- package/dist-server/graphql/resolvers/oauth2/index.js +6 -0
- package/dist-server/graphql/resolvers/oauth2/index.js.map +1 -0
- package/dist-server/graphql/resolvers/synchronization/auto-update-all-marketplace-product-variation-quantity.js +149 -0
- package/dist-server/graphql/resolvers/synchronization/auto-update-all-marketplace-product-variation-quantity.js.map +1 -0
- package/dist-server/graphql/resolvers/synchronization/create-dat-shipments.js +58 -0
- package/dist-server/graphql/resolvers/synchronization/create-dat-shipments.js.map +1 -0
- package/dist-server/graphql/resolvers/synchronization/fetch-sync-invoices.js +41 -0
- package/dist-server/graphql/resolvers/synchronization/fetch-sync-invoices.js.map +1 -0
- package/dist-server/graphql/resolvers/synchronization/fetch-sync-products.js +81 -0
- package/dist-server/graphql/resolvers/synchronization/fetch-sync-products.js.map +1 -0
- package/dist-server/graphql/resolvers/synchronization/fetch-sync-purchase-orders.js +57 -0
- package/dist-server/graphql/resolvers/synchronization/fetch-sync-purchase-orders.js.map +1 -0
- package/dist-server/graphql/resolvers/synchronization/index.js +16 -0
- package/dist-server/graphql/resolvers/synchronization/index.js.map +1 -0
- package/dist-server/graphql/resolvers/synchronization/sellercraft-pack-marketplace-order.js +68 -0
- package/dist-server/graphql/resolvers/synchronization/sellercraft-pack-marketplace-order.js.map +1 -0
- package/dist-server/graphql/resolvers/synchronization/sync-all-products-to-sellercraft.js +35 -0
- package/dist-server/graphql/resolvers/synchronization/sync-all-products-to-sellercraft.js.map +1 -0
- package/dist-server/graphql/resolvers/synchronization/sync-products-from-account.js +34 -0
- package/dist-server/graphql/resolvers/synchronization/sync-products-from-account.js.map +1 -0
- package/dist-server/graphql/resolvers/synchronization/sync-products-to-account.js +55 -0
- package/dist-server/graphql/resolvers/synchronization/sync-products-to-account.js.map +1 -0
- package/dist-server/graphql/resolvers/synchronization/sync-products-to-sellercraft.js +142 -0
- package/dist-server/graphql/resolvers/synchronization/sync-products-to-sellercraft.js.map +1 -0
- package/dist-server/graphql/types/generators/generate-bizplace-input.js +15 -0
- package/dist-server/graphql/types/generators/generate-bizplace-input.js.map +1 -0
- package/dist-server/graphql/types/generators/generate-company-input.js +15 -0
- package/dist-server/graphql/types/generators/generate-company-input.js.map +1 -0
- package/dist-server/graphql/types/generators/index.js +13 -0
- package/dist-server/graphql/types/generators/index.js.map +1 -0
- package/dist-server/graphql/types/generators/update-domain-type-input.js +12 -0
- package/dist-server/graphql/types/generators/update-domain-type-input.js.map +1 -0
- package/dist-server/graphql/types/index.js +12 -0
- package/dist-server/graphql/types/index.js.map +1 -0
- package/dist-server/graphql/types/invitations/index.js +9 -0
- package/dist-server/graphql/types/invitations/index.js.map +1 -0
- package/dist-server/graphql/types/oauth2/company-role.js +12 -0
- package/dist-server/graphql/types/oauth2/company-role.js.map +1 -0
- package/dist-server/graphql/types/oauth2/index.js +9 -0
- package/dist-server/graphql/types/oauth2/index.js.map +1 -0
- package/dist-server/graphql/types/synchronization/index.js +34 -0
- package/dist-server/graphql/types/synchronization/index.js.map +1 -0
- package/dist-server/graphql/types/synchronization/sync-invoice-list.js +12 -0
- package/dist-server/graphql/types/synchronization/sync-invoice-list.js.map +1 -0
- package/dist-server/graphql/types/synchronization/sync-invoice-set.js +42 -0
- package/dist-server/graphql/types/synchronization/sync-invoice-set.js.map +1 -0
- package/dist-server/graphql/types/synchronization/sync-product-list.js +12 -0
- package/dist-server/graphql/types/synchronization/sync-product-list.js.map +1 -0
- package/dist-server/graphql/types/synchronization/sync-product-set.js +12 -0
- package/dist-server/graphql/types/synchronization/sync-product-set.js.map +1 -0
- package/dist-server/graphql/types/synchronization/sync-purchase-order-list.js +12 -0
- package/dist-server/graphql/types/synchronization/sync-purchase-order-list.js.map +1 -0
- package/dist-server/graphql/types/synchronization/sync-purchase-order-set.js +32 -0
- package/dist-server/graphql/types/synchronization/sync-purchase-order-set.js.map +1 -0
- package/dist-server/index.js +29 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/middlewares/business-middleware.js +31 -0
- package/dist-server/middlewares/business-middleware.js.map +1 -0
- package/dist-server/middlewares/index.js +21 -0
- package/dist-server/middlewares/index.js.map +1 -0
- package/dist-server/middlewares/store-middleware.js +34 -0
- package/dist-server/middlewares/store-middleware.js.map +1 -0
- package/dist-server/middlewares/warehouse-middleware.js +34 -0
- package/dist-server/middlewares/warehouse-middleware.js.map +1 -0
- package/dist-server/migrations/1597668478399-SeedBusinessDomain.js +26 -0
- package/dist-server/migrations/1597668478399-SeedBusinessDomain.js.map +1 -0
- package/dist-server/migrations/1597668478401-SeedBusinessRoles.js +377 -0
- package/dist-server/migrations/1597668478401-SeedBusinessRoles.js.map +1 -0
- package/dist-server/migrations/1608009991065-SeedUser.js +52 -0
- package/dist-server/migrations/1608009991065-SeedUser.js.map +1 -0
- package/dist-server/migrations/index.js +12 -0
- package/dist-server/migrations/index.js.map +1 -0
- package/dist-server/routers/api/index.js +6 -0
- package/dist-server/routers/api/index.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/add-contact-point.js +74 -0
- package/dist-server/routers/api/restful-apis/unstable/add-contact-point.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/add-draft-release-order.js +171 -0
- package/dist-server/routers/api/restful-apis/unstable/add-draft-release-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/add-inbound-order.js +215 -0
- package/dist-server/routers/api/restful-apis/unstable/add-inbound-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/add-marketplace-order.js +142 -0
- package/dist-server/routers/api/restful-apis/unstable/add-marketplace-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/add-products.js +86 -0
- package/dist-server/routers/api/restful-apis/unstable/add-products.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/add-release-order.js +850 -0
- package/dist-server/routers/api/restful-apis/unstable/add-release-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/add-sales-invoice.js +127 -0
- package/dist-server/routers/api/restful-apis/unstable/add-sales-invoice.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/bizplace.js +43 -0
- package/dist-server/routers/api/restful-apis/unstable/bizplace.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/cancel-marketplace-order.js +61 -0
- package/dist-server/routers/api/restful-apis/unstable/cancel-marketplace-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/cancel-release-order.js +64 -0
- package/dist-server/routers/api/restful-apis/unstable/cancel-release-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/get-contact-point-list.js +101 -0
- package/dist-server/routers/api/restful-apis/unstable/get-contact-point-list.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/get-delivery-order-detail.js +45 -0
- package/dist-server/routers/api/restful-apis/unstable/get-delivery-order-detail.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/get-delivery-order-list.js +122 -0
- package/dist-server/routers/api/restful-apis/unstable/get-delivery-order-list.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/get-delivery-orders.js +162 -0
- package/dist-server/routers/api/restful-apis/unstable/get-delivery-orders.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/get-goods-received-notes.js +118 -0
- package/dist-server/routers/api/restful-apis/unstable/get-goods-received-notes.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/get-inbound-order-detail.js +113 -0
- package/dist-server/routers/api/restful-apis/unstable/get-inbound-order-detail.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/get-inbound-order-list.js +123 -0
- package/dist-server/routers/api/restful-apis/unstable/get-inbound-order-list.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/get-inventory-overall-product-group.js +86 -0
- package/dist-server/routers/api/restful-apis/unstable/get-inventory-overall-product-group.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/get-inventory-product-group.js +93 -0
- package/dist-server/routers/api/restful-apis/unstable/get-inventory-product-group.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/get-marketplace-order-shipping-list.js +144 -0
- package/dist-server/routers/api/restful-apis/unstable/get-marketplace-order-shipping-list.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/get-marketplace-store-list.js +77 -0
- package/dist-server/routers/api/restful-apis/unstable/get-marketplace-store-list.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/get-onhand-inventories.js +108 -0
- package/dist-server/routers/api/restful-apis/unstable/get-onhand-inventories.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/get-partners.js +24 -0
- package/dist-server/routers/api/restful-apis/unstable/get-partners.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/get-products.js +208 -0
- package/dist-server/routers/api/restful-apis/unstable/get-products.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/get-release-order-detail.js +123 -0
- package/dist-server/routers/api/restful-apis/unstable/get-release-order-detail.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/get-release-order-list.js +191 -0
- package/dist-server/routers/api/restful-apis/unstable/get-release-order-list.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/get-warehouses.js +20 -0
- package/dist-server/routers/api/restful-apis/unstable/get-warehouses.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/index.js +35 -0
- package/dist-server/routers/api/restful-apis/unstable/index.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/reject-inbound-order.js +33 -0
- package/dist-server/routers/api/restful-apis/unstable/reject-inbound-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/set-marketplace-order-delivered.js +43 -0
- package/dist-server/routers/api/restful-apis/unstable/set-marketplace-order-delivered.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/set-marketplace-order-failed-delivery.js +43 -0
- package/dist-server/routers/api/restful-apis/unstable/set-marketplace-order-failed-delivery.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/update-marketplace-order.js +91 -0
- package/dist-server/routers/api/restful-apis/unstable/update-marketplace-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/update-marketplace-shipping-order.js +86 -0
- package/dist-server/routers/api/restful-apis/unstable/update-marketplace-shipping-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/unstable/update-release-order-details.js +80 -0
- package/dist-server/routers/api/restful-apis/unstable/update-release-order-details.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/add-contact-point.js +62 -0
- package/dist-server/routers/api/restful-apis/v1/add-contact-point.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/add-draft-release-order.js +169 -0
- package/dist-server/routers/api/restful-apis/v1/add-draft-release-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/add-inbound-order.js +212 -0
- package/dist-server/routers/api/restful-apis/v1/add-inbound-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/add-marketplace-order.js +142 -0
- package/dist-server/routers/api/restful-apis/v1/add-marketplace-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/add-products.js +86 -0
- package/dist-server/routers/api/restful-apis/v1/add-products.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/add-release-order.js +772 -0
- package/dist-server/routers/api/restful-apis/v1/add-release-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/bizplace.js +43 -0
- package/dist-server/routers/api/restful-apis/v1/bizplace.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/cancel-marketplace-order.js +61 -0
- package/dist-server/routers/api/restful-apis/v1/cancel-marketplace-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/cancel-release-order.js +64 -0
- package/dist-server/routers/api/restful-apis/v1/cancel-release-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/get-contact-point-list.js +101 -0
- package/dist-server/routers/api/restful-apis/v1/get-contact-point-list.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/get-delivery-order-detail.js +45 -0
- package/dist-server/routers/api/restful-apis/v1/get-delivery-order-detail.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/get-delivery-order-list.js +122 -0
- package/dist-server/routers/api/restful-apis/v1/get-delivery-order-list.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/get-delivery-orders.js +162 -0
- package/dist-server/routers/api/restful-apis/v1/get-delivery-orders.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/get-goods-received-notes.js +118 -0
- package/dist-server/routers/api/restful-apis/v1/get-goods-received-notes.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/get-inbound-order-detail.js +113 -0
- package/dist-server/routers/api/restful-apis/v1/get-inbound-order-detail.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/get-inbound-order-list.js +123 -0
- package/dist-server/routers/api/restful-apis/v1/get-inbound-order-list.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/get-inventory-overall-product-group.js +86 -0
- package/dist-server/routers/api/restful-apis/v1/get-inventory-overall-product-group.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/get-inventory-product-group.js +99 -0
- package/dist-server/routers/api/restful-apis/v1/get-inventory-product-group.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/get-marketplace-order-shipping-list.js +144 -0
- package/dist-server/routers/api/restful-apis/v1/get-marketplace-order-shipping-list.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/get-marketplace-store-list.js +77 -0
- package/dist-server/routers/api/restful-apis/v1/get-marketplace-store-list.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/get-onhand-inventories.js +108 -0
- package/dist-server/routers/api/restful-apis/v1/get-onhand-inventories.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/get-partners.js +24 -0
- package/dist-server/routers/api/restful-apis/v1/get-partners.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/get-products.js +208 -0
- package/dist-server/routers/api/restful-apis/v1/get-products.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/get-release-order-detail.js +120 -0
- package/dist-server/routers/api/restful-apis/v1/get-release-order-detail.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/get-release-order-list.js +189 -0
- package/dist-server/routers/api/restful-apis/v1/get-release-order-list.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/get-warehouses.js +20 -0
- package/dist-server/routers/api/restful-apis/v1/get-warehouses.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/index.js +34 -0
- package/dist-server/routers/api/restful-apis/v1/index.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/reject-inbound-order.js +33 -0
- package/dist-server/routers/api/restful-apis/v1/reject-inbound-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/set-marketplace-order-delivered.js +43 -0
- package/dist-server/routers/api/restful-apis/v1/set-marketplace-order-delivered.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/set-marketplace-order-failed-delivery.js +43 -0
- package/dist-server/routers/api/restful-apis/v1/set-marketplace-order-failed-delivery.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/update-marketplace-order.js +91 -0
- package/dist-server/routers/api/restful-apis/v1/update-marketplace-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/update-marketplace-shipping-order.js +83 -0
- package/dist-server/routers/api/restful-apis/v1/update-marketplace-shipping-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/update-release-order-details.js +80 -0
- package/dist-server/routers/api/restful-apis/v1/update-release-order-details.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/add-contact-point.js +62 -0
- package/dist-server/routers/api/restful-apis/v2/add-contact-point.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/add-draft-release-order.js +169 -0
- package/dist-server/routers/api/restful-apis/v2/add-draft-release-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/add-inbound-order.js +212 -0
- package/dist-server/routers/api/restful-apis/v2/add-inbound-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/add-marketplace-order.js +142 -0
- package/dist-server/routers/api/restful-apis/v2/add-marketplace-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/add-products.js +86 -0
- package/dist-server/routers/api/restful-apis/v2/add-products.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/add-release-order.js +772 -0
- package/dist-server/routers/api/restful-apis/v2/add-release-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/bizplace.js +43 -0
- package/dist-server/routers/api/restful-apis/v2/bizplace.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/cancel-marketplace-order.js +61 -0
- package/dist-server/routers/api/restful-apis/v2/cancel-marketplace-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/cancel-release-order.js +64 -0
- package/dist-server/routers/api/restful-apis/v2/cancel-release-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/get-contact-point-list.js +101 -0
- package/dist-server/routers/api/restful-apis/v2/get-contact-point-list.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/get-delivery-order-detail.js +45 -0
- package/dist-server/routers/api/restful-apis/v2/get-delivery-order-detail.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/get-delivery-order-list.js +122 -0
- package/dist-server/routers/api/restful-apis/v2/get-delivery-order-list.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/get-delivery-orders.js +162 -0
- package/dist-server/routers/api/restful-apis/v2/get-delivery-orders.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/get-goods-received-notes.js +118 -0
- package/dist-server/routers/api/restful-apis/v2/get-goods-received-notes.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/get-inbound-order-detail.js +113 -0
- package/dist-server/routers/api/restful-apis/v2/get-inbound-order-detail.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/get-inbound-order-list.js +123 -0
- package/dist-server/routers/api/restful-apis/v2/get-inbound-order-list.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/get-inventory-overall-product-group.js +86 -0
- package/dist-server/routers/api/restful-apis/v2/get-inventory-overall-product-group.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/get-inventory-product-group.js +99 -0
- package/dist-server/routers/api/restful-apis/v2/get-inventory-product-group.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/get-marketplace-order-shipping-list.js +144 -0
- package/dist-server/routers/api/restful-apis/v2/get-marketplace-order-shipping-list.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/get-marketplace-store-list.js +77 -0
- package/dist-server/routers/api/restful-apis/v2/get-marketplace-store-list.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/get-onhand-inventories.js +108 -0
- package/dist-server/routers/api/restful-apis/v2/get-onhand-inventories.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/get-partners.js +24 -0
- package/dist-server/routers/api/restful-apis/v2/get-partners.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/get-products.js +208 -0
- package/dist-server/routers/api/restful-apis/v2/get-products.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/get-release-order-detail.js +120 -0
- package/dist-server/routers/api/restful-apis/v2/get-release-order-detail.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/get-release-order-list.js +189 -0
- package/dist-server/routers/api/restful-apis/v2/get-release-order-list.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/get-warehouses.js +20 -0
- package/dist-server/routers/api/restful-apis/v2/get-warehouses.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/index.js +34 -0
- package/dist-server/routers/api/restful-apis/v2/index.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/reject-inbound-order.js +33 -0
- package/dist-server/routers/api/restful-apis/v2/reject-inbound-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/set-marketplace-order-delivered.js +43 -0
- package/dist-server/routers/api/restful-apis/v2/set-marketplace-order-delivered.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/set-marketplace-order-failed-delivery.js +43 -0
- package/dist-server/routers/api/restful-apis/v2/set-marketplace-order-failed-delivery.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/update-marketplace-order.js +91 -0
- package/dist-server/routers/api/restful-apis/v2/update-marketplace-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/update-marketplace-shipping-order.js +83 -0
- package/dist-server/routers/api/restful-apis/v2/update-marketplace-shipping-order.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/update-release-order-details.js +80 -0
- package/dist-server/routers/api/restful-apis/v2/update-release-order-details.js.map +1 -0
- package/dist-server/routers/auth-invitation-router.js +23 -0
- package/dist-server/routers/auth-invitation-router.js.map +1 -0
- package/dist-server/routers/business/bizplace-register-router.js +23 -0
- package/dist-server/routers/business/bizplace-register-router.js.map +1 -0
- package/dist-server/routers/business/business-register-router.js +25 -0
- package/dist-server/routers/business/business-register-router.js.map +1 -0
- package/dist-server/routers/business/index.js +7 -0
- package/dist-server/routers/business/index.js.map +1 -0
- package/dist-server/routers/business/path-base-business-router.js +16 -0
- package/dist-server/routers/business/path-base-business-router.js.map +1 -0
- package/dist-server/routes.js +18 -0
- package/dist-server/routes.js.map +1 -0
- package/dist-server/templates/account-unlock-email.js +70 -0
- package/dist-server/templates/account-unlock-email.js.map +1 -0
- package/dist-server/templates/invitation-email.js +71 -0
- package/dist-server/templates/invitation-email.js.map +1 -0
- package/dist-server/templates/reset-password-email.js +70 -0
- package/dist-server/templates/reset-password-email.js.map +1 -0
- package/dist-server/templates/verification-email.js +71 -0
- package/dist-server/templates/verification-email.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/dist-server/utils/build-map.js +19 -0
- package/dist-server/utils/build-map.js.map +1 -0
- package/dist-server/utils/get-warehouses.js +117 -0
- package/dist-server/utils/get-warehouses.js.map +1 -0
- package/dist-server/utils/index.js +7 -0
- package/dist-server/utils/index.js.map +1 -0
- package/dist-server/utils/order-no-generator.js +11 -0
- package/dist-server/utils/order-no-generator.js.map +1 -0
- package/package.json +43 -43
|
@@ -0,0 +1,772 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._composeTargetInventories = exports.checkMandatoryKey = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
|
|
6
|
+
const typeorm_1 = require("typeorm");
|
|
7
|
+
const api_1 = require("@things-factory/api");
|
|
8
|
+
const biz_base_1 = require("@things-factory/biz-base");
|
|
9
|
+
const integration_base_1 = require("@things-factory/integration-base");
|
|
10
|
+
const product_base_1 = require("@things-factory/product-base");
|
|
11
|
+
const sales_base_1 = require("@things-factory/sales-base");
|
|
12
|
+
const setting_base_1 = require("@things-factory/setting-base");
|
|
13
|
+
const warehouse_base_1 = require("@things-factory/warehouse-base");
|
|
14
|
+
const business_middleware_1 = require("../../../../middlewares/business-middleware");
|
|
15
|
+
const warehouse_middleware_1 = require("../../../../middlewares/warehouse-middleware");
|
|
16
|
+
const debug = require('debug')('things-factory:operato-hub:restful-api:unstable:add-release-order');
|
|
17
|
+
const apiVersion = 'v1';
|
|
18
|
+
api_1.restfulApiRouter.post(`/${apiVersion}/warehouse/:warehouseId/add-release-order`, business_middleware_1.businessMiddleware, warehouse_middleware_1.warehouseMiddleware, async (context, next) => {
|
|
19
|
+
return await (0, typeorm_1.getConnection)().transaction(async (tx) => {
|
|
20
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
21
|
+
const { client, domain } = context.state;
|
|
22
|
+
const { warehouseId: customerBizplaceId } = context.params;
|
|
23
|
+
const { t } = context;
|
|
24
|
+
const bodyReq = context.request.body;
|
|
25
|
+
try {
|
|
26
|
+
if (!customerBizplaceId)
|
|
27
|
+
context.throw(404, t('error.warehouse id not found'));
|
|
28
|
+
if (typeof bodyReq === undefined || !((_a = Object.keys(bodyReq)) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
29
|
+
context.throw(400, t('error.invalid body request format'));
|
|
30
|
+
}
|
|
31
|
+
debug('post:/add-release-order request.body', bodyReq);
|
|
32
|
+
await checkMandatoryKey(context, bodyReq);
|
|
33
|
+
const isAutoAssign = bodyReq.hasOwnProperty('isAutoAssign') ? bodyReq.isAutoAssign : true;
|
|
34
|
+
const requiredDraft = bodyReq.hasOwnProperty('requiredDraft') ? bodyReq.requiredDraft : true;
|
|
35
|
+
// get customer company's bizplace
|
|
36
|
+
const custCompanyBizplace = await (0, biz_base_1.getCompanyBizplace)(null, null, customerBizplaceId, tx);
|
|
37
|
+
const customerBizplace = await tx.getRepository(biz_base_1.Bizplace).findOne({
|
|
38
|
+
where: { id: customerBizplaceId }
|
|
39
|
+
});
|
|
40
|
+
let locationSortingRules = [];
|
|
41
|
+
const inventoryAssignmentSetting = await tx.getRepository(setting_base_1.Setting).findOne({
|
|
42
|
+
where: { domain: { id: domain.id }, name: 'rule-for-inventory-assignment' }
|
|
43
|
+
});
|
|
44
|
+
if (inventoryAssignmentSetting) {
|
|
45
|
+
let locationSetting = JSON.parse(inventoryAssignmentSetting.value);
|
|
46
|
+
for (const key in locationSetting) {
|
|
47
|
+
locationSortingRules.push({ name: key, desc: locationSetting[key] == 'ASC' ? false : true });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
const pickingProductSetting = await tx.getRepository(setting_base_1.Setting).findOne({
|
|
52
|
+
where: { domain: { id: domain.id }, name: 'rule-for-picking-product' }
|
|
53
|
+
});
|
|
54
|
+
if (pickingProductSetting) {
|
|
55
|
+
let locationSetting = JSON.parse(pickingProductSetting.value);
|
|
56
|
+
for (const key in locationSetting) {
|
|
57
|
+
locationSortingRules.push({ name: key, desc: locationSetting[key] == 'ASC' ? false : true });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const orderInventories = bodyReq.orderInventories;
|
|
62
|
+
let newOrderInventories = [];
|
|
63
|
+
let bundleInfo = [];
|
|
64
|
+
await Promise.all(orderInventories.map(async (orderInventory) => {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
const sku = (_a = orderInventory.product) === null || _a === void 0 ? void 0 : _a.sku;
|
|
67
|
+
const refCode = (_b = orderInventory.product) === null || _b === void 0 ? void 0 : _b.refCode;
|
|
68
|
+
const packingType = orderInventory.packingType;
|
|
69
|
+
const qb = tx
|
|
70
|
+
.getRepository(product_base_1.ProductDetail)
|
|
71
|
+
.createQueryBuilder('PD')
|
|
72
|
+
.innerJoinAndSelect('PD.product', 'PROD')
|
|
73
|
+
.where('PROD.bizplace_id = :bizplaceId', { bizplaceId: custCompanyBizplace.id });
|
|
74
|
+
if (!sku && !refCode) {
|
|
75
|
+
context.throw(404, t('error.sku or refCode not found'));
|
|
76
|
+
}
|
|
77
|
+
if (refCode) {
|
|
78
|
+
qb.andWhere('PD.ref_code = :refCode', { refCode });
|
|
79
|
+
}
|
|
80
|
+
if (sku) {
|
|
81
|
+
qb.andWhere('PROD.sku = :sku', { sku });
|
|
82
|
+
}
|
|
83
|
+
if (packingType) {
|
|
84
|
+
qb.andWhere('PD.packing_type = :packingType', { packingType });
|
|
85
|
+
}
|
|
86
|
+
if (!packingType && !refCode) {
|
|
87
|
+
qb.andWhere('PD.is_default = :isDefault', { isDefault: true });
|
|
88
|
+
}
|
|
89
|
+
const productDetail = await qb.getOne();
|
|
90
|
+
if (productDetail) {
|
|
91
|
+
let newOrderInventory = Object.assign({}, orderInventory);
|
|
92
|
+
newOrderInventory.product.sku = productDetail.product.sku;
|
|
93
|
+
newOrderInventory.product = productDetail.product;
|
|
94
|
+
newOrderInventory.packingType = productDetail.packingType;
|
|
95
|
+
newOrderInventory.uomValue = productDetail.uomValue;
|
|
96
|
+
newOrderInventories.push(newOrderInventory);
|
|
97
|
+
}
|
|
98
|
+
if (!productDetail) {
|
|
99
|
+
const qb = tx
|
|
100
|
+
.getRepository(product_base_1.ProductBundle)
|
|
101
|
+
.createQueryBuilder('PB')
|
|
102
|
+
.innerJoinAndSelect('PB.productBundleSettings', 'PBS')
|
|
103
|
+
.innerJoinAndSelect('PBS.productDetail', 'PBD')
|
|
104
|
+
.innerJoinAndSelect('PBD.product', 'PROD')
|
|
105
|
+
.where('PB.bizplace_id = :bizplaceId', { bizplaceId: custCompanyBizplace.id });
|
|
106
|
+
if (!sku && !refCode) {
|
|
107
|
+
context.throw(404, t('error.sku or refCode not found'));
|
|
108
|
+
}
|
|
109
|
+
if (refCode) {
|
|
110
|
+
qb.andWhere('PB.ref_code = :refCode', { refCode });
|
|
111
|
+
}
|
|
112
|
+
if (sku) {
|
|
113
|
+
qb.andWhere('PB.sku = :sku', { sku });
|
|
114
|
+
}
|
|
115
|
+
if (packingType) {
|
|
116
|
+
qb.andWhere('PB.packing_type = :packingType', { packingType });
|
|
117
|
+
}
|
|
118
|
+
const foundProductBundle = await qb.getOne();
|
|
119
|
+
if (foundProductBundle) {
|
|
120
|
+
bundleInfo.push({
|
|
121
|
+
productBundleId: foundProductBundle.id,
|
|
122
|
+
sku: foundProductBundle.sku,
|
|
123
|
+
releaseQty: orderInventory.releaseQty
|
|
124
|
+
});
|
|
125
|
+
const bundleProductSettings = foundProductBundle.productBundleSettings;
|
|
126
|
+
bundleProductSettings.map(bundleProductSetting => {
|
|
127
|
+
const productDetailBundle = bundleProductSetting.productDetail;
|
|
128
|
+
let newOrderInventory = Object.assign({}, orderInventory);
|
|
129
|
+
newOrderInventory.product.sku = productDetailBundle.product.sku;
|
|
130
|
+
newOrderInventory.packingType = productDetailBundle.packingType;
|
|
131
|
+
newOrderInventory.uomValue = productDetailBundle.uomValue;
|
|
132
|
+
newOrderInventory.releaseQty = orderInventory.releaseQty * bundleProductSetting.bundleQty;
|
|
133
|
+
newOrderInventory.product = productDetailBundle.product;
|
|
134
|
+
newOrderInventories.push(newOrderInventory);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
if (sku && refCode) {
|
|
139
|
+
context.throw(404, t(`error.sku ${sku} and refCode ${refCode} not exist in product / bundle master`));
|
|
140
|
+
}
|
|
141
|
+
if (sku) {
|
|
142
|
+
context.throw(404, t(`error.sku ${sku} not exist in product / bundle master`));
|
|
143
|
+
}
|
|
144
|
+
if (refCode) {
|
|
145
|
+
context.throw(404, t(`error.refCode ${refCode} not exist in product / bundle master`));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}));
|
|
150
|
+
let finalOrderInventories = [];
|
|
151
|
+
// Case 1. Every order inventories has specified batch id
|
|
152
|
+
if (newOrderInventories.every((orderInventory) => orderInventory.batchId)) {
|
|
153
|
+
finalOrderInventories = await Promise.all(newOrderInventories.map(async (orderInventory) => {
|
|
154
|
+
let filters = [
|
|
155
|
+
{
|
|
156
|
+
name: 'batchId',
|
|
157
|
+
operator: 'eq',
|
|
158
|
+
value: orderInventory.batchId
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: 'productName',
|
|
162
|
+
operator: 'eq',
|
|
163
|
+
value: orderInventory.product.sku
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: 'bizplace',
|
|
167
|
+
operator: 'in',
|
|
168
|
+
value: [customerBizplaceId]
|
|
169
|
+
}
|
|
170
|
+
];
|
|
171
|
+
let sortings = [];
|
|
172
|
+
switch (orderInventory.product.pickingStrategy) {
|
|
173
|
+
case 'FIFO':
|
|
174
|
+
sortings.push({ name: 'created_at', desc: false });
|
|
175
|
+
break;
|
|
176
|
+
case 'LIFO':
|
|
177
|
+
sortings.push({ name: 'created_at', desc: true });
|
|
178
|
+
break;
|
|
179
|
+
case 'FEFO':
|
|
180
|
+
sortings.push({ name: 'expiration_date', desc: false }, { name: 'created_at', desc: false });
|
|
181
|
+
break;
|
|
182
|
+
case 'FMFO':
|
|
183
|
+
sortings.push({ name: 'manufacture_date', desc: false }, { name: 'created_at', desc: false });
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
// 2. get all inventory data according to SKU and batchId
|
|
187
|
+
const response = await client.query({
|
|
188
|
+
query: (0, graphql_tag_1.default) `
|
|
189
|
+
query inventoriesByPallet(
|
|
190
|
+
$filters: [Filter]
|
|
191
|
+
$sortings: [Sorting]
|
|
192
|
+
$locationSortingRules: [Sorting]
|
|
193
|
+
) {
|
|
194
|
+
inventoriesByPallet(
|
|
195
|
+
filters: $filters
|
|
196
|
+
sortings: $sortings
|
|
197
|
+
locationSortingRules: $locationSortingRules
|
|
198
|
+
) {
|
|
199
|
+
items {
|
|
200
|
+
product {
|
|
201
|
+
id
|
|
202
|
+
name
|
|
203
|
+
description
|
|
204
|
+
}
|
|
205
|
+
batchId
|
|
206
|
+
packingType
|
|
207
|
+
remainQty
|
|
208
|
+
remainUomValue
|
|
209
|
+
}
|
|
210
|
+
total
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
`,
|
|
214
|
+
variables: { filters, sortings, locationSortingRules },
|
|
215
|
+
context: Object.assign(Object.assign({}, context), { state: Object.assign(Object.assign({}, context.state), { bizplace: customerBizplace, domain }) })
|
|
216
|
+
});
|
|
217
|
+
if (!response.errors) {
|
|
218
|
+
const items = response.data.inventoriesByPallet.items || [];
|
|
219
|
+
if (requiredDraft) {
|
|
220
|
+
if (!(items === null || items === void 0 ? void 0 : items.length)) {
|
|
221
|
+
context.body = {
|
|
222
|
+
result: await createDraftOrder(client, customerBizplace, bodyReq, bundleInfo, domain, context, orderInventories, tx)
|
|
223
|
+
};
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
items.forEach(async (item) => {
|
|
228
|
+
if (requiredDraft) {
|
|
229
|
+
if (orderInventory.releaseQty > item.remainQty || orderInventory.releaseQty <= 0) {
|
|
230
|
+
context.body = {
|
|
231
|
+
result: await createDraftOrder(client, customerBizplace, bodyReq, bundleInfo, domain, context, orderInventories, tx)
|
|
232
|
+
};
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
// 3. add more information to orderInventory
|
|
237
|
+
orderInventory.product.id = item.product.id;
|
|
238
|
+
orderInventory.packingType = item.packingType;
|
|
239
|
+
orderInventory.batchId = item.batchId;
|
|
240
|
+
orderInventory.type = sales_base_1.ORDER_TYPES.RELEASE_OF_GOODS;
|
|
241
|
+
orderInventory.releaseUomValue = orderInventory.releaseQty * orderInventory.uomValue;
|
|
242
|
+
orderInventory.uom = item.uom;
|
|
243
|
+
});
|
|
244
|
+
return orderInventory;
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
if (requiredDraft) {
|
|
248
|
+
context.body = {
|
|
249
|
+
result: await createDraftOrder(client, customerBizplace, bodyReq, bundleInfo, domain, context, orderInventories, tx)
|
|
250
|
+
};
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}));
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
// Case 2. Some of order inventories doesn't have specified batch id
|
|
258
|
+
// MMS order doesn't have batch ID field.
|
|
259
|
+
// To cover this case first result of found inventory will be a target of RO
|
|
260
|
+
// To combine items from different bundles
|
|
261
|
+
newOrderInventories = combineItems(newOrderInventories);
|
|
262
|
+
for (let i = 0; i < newOrderInventories.length; i++) {
|
|
263
|
+
const orderInventory = newOrderInventories[i];
|
|
264
|
+
const { product, packingType } = orderInventory;
|
|
265
|
+
const pickingStrategy = product.pickingStrategy;
|
|
266
|
+
if (isAutoAssign) {
|
|
267
|
+
let qb = tx.getRepository(warehouse_base_1.Inventory).createQueryBuilder('iv');
|
|
268
|
+
qb.leftJoinAndSelect('iv.location', 'loc')
|
|
269
|
+
.andWhere('"iv"."domain_id" = :domainId')
|
|
270
|
+
.andWhere('"iv"."bizplace_id" = :bizplaceId')
|
|
271
|
+
.andWhere('"iv"."packing_type" = :packingType')
|
|
272
|
+
.andWhere('"iv"."product_id" = :productId')
|
|
273
|
+
.andWhere('"iv"."status" = :status')
|
|
274
|
+
.andWhere('"loc"."type" NOT IN (:...locationTypes)')
|
|
275
|
+
.setParameters({
|
|
276
|
+
domainId: domain.id,
|
|
277
|
+
bizplaceId: customerBizplace.id,
|
|
278
|
+
packingType: packingType,
|
|
279
|
+
productId: product.id,
|
|
280
|
+
status: warehouse_base_1.INVENTORY_STATUS.STORED,
|
|
281
|
+
locationTypes: [warehouse_base_1.LOCATION_TYPE.QUARANTINE, warehouse_base_1.LOCATION_TYPE.RESERVE]
|
|
282
|
+
});
|
|
283
|
+
switch (pickingStrategy) {
|
|
284
|
+
case 'FIFO':
|
|
285
|
+
qb.orderBy('"iv"."created_at"', 'ASC');
|
|
286
|
+
if ((locationSortingRules === null || locationSortingRules === void 0 ? void 0 : locationSortingRules.length) > 0) {
|
|
287
|
+
locationSortingRules.forEach((rule, idx) => {
|
|
288
|
+
qb.addOrderBy(`loc.${rule.name}`, rule.desc ? 'DESC' : 'ASC');
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
break;
|
|
292
|
+
case 'LIFO':
|
|
293
|
+
qb.orderBy('"iv"."created_at"', 'DESC');
|
|
294
|
+
if ((locationSortingRules === null || locationSortingRules === void 0 ? void 0 : locationSortingRules.length) > 0) {
|
|
295
|
+
locationSortingRules.forEach((rule, idx) => {
|
|
296
|
+
qb.addOrderBy(`loc.${rule.name}`, rule.desc ? 'DESC' : 'ASC');
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
break;
|
|
300
|
+
case 'FEFO':
|
|
301
|
+
qb.orderBy('"iv"."expiration_date"', 'ASC');
|
|
302
|
+
qb.orderBy('"iv"."created_at"', 'ASC');
|
|
303
|
+
if ((locationSortingRules === null || locationSortingRules === void 0 ? void 0 : locationSortingRules.length) > 0) {
|
|
304
|
+
locationSortingRules.forEach((rule, idx) => {
|
|
305
|
+
qb.addOrderBy(`loc.${rule.name}`, rule.desc ? 'DESC' : 'ASC');
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
break;
|
|
309
|
+
case 'FMFO':
|
|
310
|
+
qb.orderBy('"iv"."manufacture_date"', 'ASC');
|
|
311
|
+
qb.orderBy('"iv"."created_at"', 'ASC');
|
|
312
|
+
if ((locationSortingRules === null || locationSortingRules === void 0 ? void 0 : locationSortingRules.length) > 0) {
|
|
313
|
+
locationSortingRules.forEach((rule, idx) => {
|
|
314
|
+
qb.addOrderBy(`loc.${rule.name}`, rule.desc ? 'DESC' : 'ASC');
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
break;
|
|
318
|
+
case 'LOCATION':
|
|
319
|
+
if ((locationSortingRules === null || locationSortingRules === void 0 ? void 0 : locationSortingRules.length) > 0) {
|
|
320
|
+
locationSortingRules.forEach((rule, idx) => {
|
|
321
|
+
idx === 0
|
|
322
|
+
? qb.orderBy(`loc.${rule.name}`, rule.desc ? 'DESC' : 'ASC')
|
|
323
|
+
: qb.addOrderBy(`loc.${rule.name}`, rule.desc ? 'DESC' : 'ASC');
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
qb.orderBy('"loc"."name"', 'DESC');
|
|
328
|
+
}
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
331
|
+
let inventories = await qb.getMany();
|
|
332
|
+
if (requiredDraft) {
|
|
333
|
+
if (!(inventories === null || inventories === void 0 ? void 0 : inventories.length)) {
|
|
334
|
+
context.body = {
|
|
335
|
+
result: await createDraftOrder(client, customerBizplace, bodyReq, bundleInfo, domain, context, orderInventories, tx)
|
|
336
|
+
};
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
inventories = inventories
|
|
341
|
+
.map(inventory => {
|
|
342
|
+
return Object.assign(Object.assign({}, inventory), { remainQty: inventory.qty - inventory.lockedQty, remainUomValue: inventory.uomValue - inventory.lockedUomValue });
|
|
343
|
+
})
|
|
344
|
+
.filter(inventory => inventory.remainQty > 0);
|
|
345
|
+
let targetInventories;
|
|
346
|
+
try {
|
|
347
|
+
targetInventories = _composeTargetInventories(context, product, orderInventory, inventories);
|
|
348
|
+
}
|
|
349
|
+
catch (e) {
|
|
350
|
+
if (requiredDraft) {
|
|
351
|
+
context.body = {
|
|
352
|
+
result: await createDraftOrder(client, customerBizplace, bodyReq, bundleInfo, domain, context, orderInventories, tx)
|
|
353
|
+
};
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
targetInventories = _composeTargetInventories(context, product, orderInventory, inventories);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
if (!(targetInventories === null || targetInventories === void 0 ? void 0 : targetInventories.length)) {
|
|
361
|
+
context.throw(404, t(`error.no inventories found`));
|
|
362
|
+
}
|
|
363
|
+
targetInventories.map(item => {
|
|
364
|
+
finalOrderInventories.push(item.targetInventory);
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
let filters = [
|
|
369
|
+
{
|
|
370
|
+
name: 'productName',
|
|
371
|
+
operator: 'eq',
|
|
372
|
+
value: orderInventory.product.sku
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
name: 'bizplace_id',
|
|
376
|
+
operator: 'eq',
|
|
377
|
+
value: customerBizplaceId
|
|
378
|
+
}
|
|
379
|
+
];
|
|
380
|
+
// 2. get all inventory data according to SKU and batchId
|
|
381
|
+
const response = await client.query({
|
|
382
|
+
query: (0, graphql_tag_1.default) `
|
|
383
|
+
query inventoryProductGroup($filters: [Filter]) {
|
|
384
|
+
inventoryProductGroup(filters: $filters) {
|
|
385
|
+
items {
|
|
386
|
+
productId
|
|
387
|
+
productSKU
|
|
388
|
+
productName
|
|
389
|
+
batchId
|
|
390
|
+
packingType
|
|
391
|
+
remainQty
|
|
392
|
+
remainUomValue
|
|
393
|
+
}
|
|
394
|
+
total
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
`,
|
|
398
|
+
variables: { filters },
|
|
399
|
+
context: Object.assign(Object.assign({}, context), { state: Object.assign(Object.assign({}, context.state), { bizplace: customerBizplace, domain }) })
|
|
400
|
+
});
|
|
401
|
+
if (!response.errors) {
|
|
402
|
+
const items = response.data.inventoryProductGroup.items || [];
|
|
403
|
+
if (requiredDraft) {
|
|
404
|
+
if (!(items === null || items === void 0 ? void 0 : items.length)) {
|
|
405
|
+
context.body = {
|
|
406
|
+
result: await createDraftOrder(client, customerBizplace, bodyReq, bundleInfo, domain, context, orderInventories, tx)
|
|
407
|
+
};
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
items.forEach(async (item) => {
|
|
412
|
+
if (requiredDraft) {
|
|
413
|
+
if (orderInventory.releaseQty > item.remainQty || orderInventory.releaseQty <= 0) {
|
|
414
|
+
context.body = {
|
|
415
|
+
result: await createDraftOrder(client, customerBizplace, bodyReq, bundleInfo, domain, context, orderInventories, tx)
|
|
416
|
+
};
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
// 3. add more information to orderInventory
|
|
421
|
+
orderInventory.product = { id: item.productId };
|
|
422
|
+
orderInventory.packingType = item.packingType;
|
|
423
|
+
orderInventory.batchId = item.batchId;
|
|
424
|
+
orderInventory.type = sales_base_1.ORDER_TYPES.RELEASE_OF_GOODS;
|
|
425
|
+
orderInventory.releaseUomValue = orderInventory.releaseQty * orderInventory.uomValue;
|
|
426
|
+
orderInventory.uom = item.uom;
|
|
427
|
+
});
|
|
428
|
+
delete orderInventory.uomValue;
|
|
429
|
+
finalOrderInventories.push(orderInventory);
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
if (requiredDraft) {
|
|
433
|
+
context.body = {
|
|
434
|
+
result: await createDraftOrder(client, customerBizplace, bodyReq, bundleInfo, domain, context, orderInventories, tx)
|
|
435
|
+
};
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
context.body = {
|
|
443
|
+
result: (await client.mutate({
|
|
444
|
+
mutation: (0, graphql_tag_1.default) `
|
|
445
|
+
mutation addReleaseGood(
|
|
446
|
+
$releaseGood: NewReleaseGood
|
|
447
|
+
$shippingOrder: ShippingOrderPatch
|
|
448
|
+
$file: Upload
|
|
449
|
+
) {
|
|
450
|
+
addReleaseGood(releaseGood: $releaseGood, shippingOrder: $shippingOrder, file: $file) {
|
|
451
|
+
id
|
|
452
|
+
name
|
|
453
|
+
refNo
|
|
454
|
+
status
|
|
455
|
+
truckNo
|
|
456
|
+
ownTransport
|
|
457
|
+
crossDocking
|
|
458
|
+
marketplaceOrderStatus
|
|
459
|
+
billingAddress
|
|
460
|
+
deliveryAddress1
|
|
461
|
+
deliveryAddress2
|
|
462
|
+
deliveryAddress3
|
|
463
|
+
deliveryAddress4
|
|
464
|
+
deliveryAddress5
|
|
465
|
+
attentionTo
|
|
466
|
+
attentionCompany
|
|
467
|
+
city
|
|
468
|
+
state
|
|
469
|
+
postalCode
|
|
470
|
+
country
|
|
471
|
+
phone1
|
|
472
|
+
phone2
|
|
473
|
+
email
|
|
474
|
+
transporter
|
|
475
|
+
trackingNo
|
|
476
|
+
airwayBill
|
|
477
|
+
invoice
|
|
478
|
+
type
|
|
479
|
+
storeName
|
|
480
|
+
storeId
|
|
481
|
+
routeId
|
|
482
|
+
stopId
|
|
483
|
+
arrivalNotice {
|
|
484
|
+
name
|
|
485
|
+
}
|
|
486
|
+
exportOption
|
|
487
|
+
releaseDate
|
|
488
|
+
collectionOrderNo
|
|
489
|
+
bizplace {
|
|
490
|
+
name
|
|
491
|
+
}
|
|
492
|
+
orderInventories {
|
|
493
|
+
product {
|
|
494
|
+
sku
|
|
495
|
+
name
|
|
496
|
+
description
|
|
497
|
+
}
|
|
498
|
+
batchId
|
|
499
|
+
packingType
|
|
500
|
+
packingSize
|
|
501
|
+
releaseQty
|
|
502
|
+
releaseUomValue
|
|
503
|
+
}
|
|
504
|
+
orderVass {
|
|
505
|
+
vas {
|
|
506
|
+
name
|
|
507
|
+
operationGuide
|
|
508
|
+
operationGuideType
|
|
509
|
+
}
|
|
510
|
+
set
|
|
511
|
+
targetType
|
|
512
|
+
targetBatchId
|
|
513
|
+
targetProduct {
|
|
514
|
+
name
|
|
515
|
+
description
|
|
516
|
+
}
|
|
517
|
+
packingType
|
|
518
|
+
qty
|
|
519
|
+
uomValue
|
|
520
|
+
otherTarget
|
|
521
|
+
description
|
|
522
|
+
remark
|
|
523
|
+
status
|
|
524
|
+
operationGuide
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
`,
|
|
529
|
+
variables: {
|
|
530
|
+
releaseGood: {
|
|
531
|
+
customerBizplaceId: customerBizplace.id,
|
|
532
|
+
courierOption: bodyReq.courierOption,
|
|
533
|
+
collectionOrderNo: bodyReq.collectionOrderNo,
|
|
534
|
+
exportOption: bodyReq.exportOption,
|
|
535
|
+
orderInventories: finalOrderInventories,
|
|
536
|
+
ownTransport: bodyReq.ownTransport,
|
|
537
|
+
packingOption: bodyReq.packingOption,
|
|
538
|
+
refNo: bodyReq.refNo,
|
|
539
|
+
refNo2: bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.refNo2,
|
|
540
|
+
releaseDate: bodyReq.releaseDate,
|
|
541
|
+
type: bodyReq.type,
|
|
542
|
+
marketplaceOrderStatus: bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.marketplaceOrderStatus,
|
|
543
|
+
remark: (bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.remark) || null,
|
|
544
|
+
billingAddress: ((_b = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.billTo) === null || _b === void 0 ? void 0 : _b.billingAddress) || null,
|
|
545
|
+
deliveryAddress1: ((_c = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _c === void 0 ? void 0 : _c.deliveryAddress1) || null,
|
|
546
|
+
deliveryAddress2: ((_d = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _d === void 0 ? void 0 : _d.deliveryAddress2) || null,
|
|
547
|
+
deliveryAddress3: ((_e = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _e === void 0 ? void 0 : _e.deliveryAddress3) || null,
|
|
548
|
+
deliveryAddress4: ((_f = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _f === void 0 ? void 0 : _f.deliveryAddress4) || null,
|
|
549
|
+
deliveryAddress5: ((_g = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _g === void 0 ? void 0 : _g.deliveryAddress5) || null,
|
|
550
|
+
attentionTo: ((_h = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _h === void 0 ? void 0 : _h.attentionTo) || null,
|
|
551
|
+
attentionCompany: ((_j = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _j === void 0 ? void 0 : _j.attentionCompany) || null,
|
|
552
|
+
city: ((_k = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _k === void 0 ? void 0 : _k.city) || null,
|
|
553
|
+
state: ((_l = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _l === void 0 ? void 0 : _l.state) || null,
|
|
554
|
+
postalCode: ((_m = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _m === void 0 ? void 0 : _m.postalCode) || null,
|
|
555
|
+
country: ((_o = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _o === void 0 ? void 0 : _o.country) || null,
|
|
556
|
+
phone1: ((_p = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _p === void 0 ? void 0 : _p.phone1) || null,
|
|
557
|
+
phone2: ((_q = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _q === void 0 ? void 0 : _q.phone2) || null,
|
|
558
|
+
email: ((_r = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _r === void 0 ? void 0 : _r.email) || null,
|
|
559
|
+
transporter: bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.transporter,
|
|
560
|
+
trackingNo: bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.trackingNo,
|
|
561
|
+
airwayBill: bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.airwayBill,
|
|
562
|
+
invoice: bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.invoice,
|
|
563
|
+
bundleInfo: JSON.stringify(bundleInfo),
|
|
564
|
+
storeName: bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.storeName,
|
|
565
|
+
storeId: bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.storeId,
|
|
566
|
+
routeId: bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.routeId,
|
|
567
|
+
stopId: bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.stopId
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
context: Object.assign(Object.assign({}, context), { hasUpload: true, state: Object.assign(Object.assign({}, context.state), { customerBizplace,
|
|
571
|
+
domain, type: 'api' }) })
|
|
572
|
+
})).data
|
|
573
|
+
};
|
|
574
|
+
(0, integration_base_1.createPayloadLog)(customerBizplaceId, `/${apiVersion}/warehouse/:warehouseId/add-release-order`, bodyReq, context.body, context, integration_base_1.PayloadType.INGESTION, 'hub-api');
|
|
575
|
+
}
|
|
576
|
+
catch (error) {
|
|
577
|
+
(0, integration_base_1.createPayloadLog)(customerBizplaceId, `/${apiVersion}/warehouse/:warehouseId/add-release-order`, bodyReq, error, context, integration_base_1.PayloadType.INGESTION, 'hub-api');
|
|
578
|
+
throw error;
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
});
|
|
582
|
+
async function checkMandatoryKey(context, params) {
|
|
583
|
+
let noparams = ['releaseDate', 'exportOption'].filter(param => !(param in params));
|
|
584
|
+
if ('ownTransport' in params) {
|
|
585
|
+
if (params.ownTransport == true) {
|
|
586
|
+
if (!params.hasOwnProperty('collectionOrderNo')) {
|
|
587
|
+
noparams.push('collectionOrderNo');
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
else {
|
|
592
|
+
noparams.push('ownTransport');
|
|
593
|
+
}
|
|
594
|
+
if ('exportOption' in params) {
|
|
595
|
+
if (params.exportOption === true) {
|
|
596
|
+
if (params.exportOption.filter(record => !record.containerNo || !record.containerArrivalDate || !record.containerLeavingDate || !record.shipName).length) {
|
|
597
|
+
noparams.push('exportOption');
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
if ('orderInventories' in params) {
|
|
602
|
+
params.orderInventories.forEach((param, key) => {
|
|
603
|
+
let noSubParams = [];
|
|
604
|
+
if (!(param === null || param === void 0 ? void 0 : param.releaseQty))
|
|
605
|
+
noSubParams.push('releaseQty');
|
|
606
|
+
if (!(param === null || param === void 0 ? void 0 : param.product))
|
|
607
|
+
noSubParams.push('product');
|
|
608
|
+
if (noSubParams === null || noSubParams === void 0 ? void 0 : noSubParams.length)
|
|
609
|
+
context.throw(400, context.t('error.required param x not found', { x: `${noSubParams.join(', ')}` }));
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
else {
|
|
613
|
+
noparams.push('orderInventories');
|
|
614
|
+
}
|
|
615
|
+
if (noparams === null || noparams === void 0 ? void 0 : noparams.length) {
|
|
616
|
+
context.throw(400, context.t('error.required param x not found', { x: `${noparams.join(', ')}` }));
|
|
617
|
+
}
|
|
618
|
+
return params;
|
|
619
|
+
}
|
|
620
|
+
exports.checkMandatoryKey = checkMandatoryKey;
|
|
621
|
+
function _composeTargetInventories(context, product, record, inventories) {
|
|
622
|
+
const { t } = context;
|
|
623
|
+
let leftReleaseQty = record.releaseQty;
|
|
624
|
+
let leftReleaseUomValue = record.releaseUomValue;
|
|
625
|
+
let compReleaseQty = 0;
|
|
626
|
+
let compReleaseUomValue = 0;
|
|
627
|
+
let totalInventoryQty = 0;
|
|
628
|
+
inventories.map(inventory => {
|
|
629
|
+
totalInventoryQty += inventory.remainQty;
|
|
630
|
+
});
|
|
631
|
+
if (totalInventoryQty < record.releaseQty) {
|
|
632
|
+
context.throw(404, t(`error.invalid release qty for ${product === null || product === void 0 ? void 0 : product.sku}`)); //
|
|
633
|
+
}
|
|
634
|
+
let targetInventories = [];
|
|
635
|
+
let idx = 0;
|
|
636
|
+
while (compReleaseQty < record.releaseQty) {
|
|
637
|
+
const inv = inventories[idx];
|
|
638
|
+
if (inv.remainQty > leftReleaseQty) {
|
|
639
|
+
compReleaseQty += leftReleaseQty;
|
|
640
|
+
compReleaseUomValue += leftReleaseUomValue;
|
|
641
|
+
targetInventories.push({
|
|
642
|
+
targetInventory: {
|
|
643
|
+
inventory: { id: inv.id },
|
|
644
|
+
packingType: inv.packingType,
|
|
645
|
+
batchId: inv.batchId,
|
|
646
|
+
releaseQty: leftReleaseQty,
|
|
647
|
+
releaseUomValue: leftReleaseQty * record.uomValue,
|
|
648
|
+
uom: inv.uom,
|
|
649
|
+
product: { id: product.id },
|
|
650
|
+
type: sales_base_1.ORDER_TYPES.RELEASE_OF_GOODS
|
|
651
|
+
}
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
else {
|
|
655
|
+
compReleaseQty += inv.remainQty;
|
|
656
|
+
compReleaseUomValue += inv.remainUomValue;
|
|
657
|
+
leftReleaseQty -= inv.remainQty;
|
|
658
|
+
leftReleaseUomValue -= inv.remainUomValue;
|
|
659
|
+
targetInventories.push({
|
|
660
|
+
targetInventory: {
|
|
661
|
+
inventory: { id: inv.id },
|
|
662
|
+
packingType: inv.packingType,
|
|
663
|
+
batchId: inv.batchId,
|
|
664
|
+
releaseQty: inv.remainQty,
|
|
665
|
+
releaseUomValue: inv.remainUomValue,
|
|
666
|
+
uom: inv.uom,
|
|
667
|
+
product: { id: product.id },
|
|
668
|
+
type: sales_base_1.ORDER_TYPES.RELEASE_OF_GOODS
|
|
669
|
+
}
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
idx++;
|
|
673
|
+
}
|
|
674
|
+
return targetInventories;
|
|
675
|
+
}
|
|
676
|
+
exports._composeTargetInventories = _composeTargetInventories;
|
|
677
|
+
function combineItems(inventoryList) {
|
|
678
|
+
let mappedList = [];
|
|
679
|
+
inventoryList.map(e => {
|
|
680
|
+
let item = mappedList.find(i => i.product.id === e.product.id);
|
|
681
|
+
if (item) {
|
|
682
|
+
mappedList = mappedList.filter(m => m != item);
|
|
683
|
+
item.releaseQty += e.releaseQty;
|
|
684
|
+
mappedList.push(item);
|
|
685
|
+
}
|
|
686
|
+
else {
|
|
687
|
+
mappedList.push(e);
|
|
688
|
+
}
|
|
689
|
+
});
|
|
690
|
+
return mappedList;
|
|
691
|
+
}
|
|
692
|
+
async function createDraftOrder(client, customerBizplace, bodyReq, bundleInfo, domain, context, orderInventories, tx) {
|
|
693
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
694
|
+
return (await client.mutate({
|
|
695
|
+
mutation: (0, graphql_tag_1.default) `
|
|
696
|
+
mutation upsertDraftReleaseGood(
|
|
697
|
+
$draftReleaseGood: DraftReleaseGoodPatch!
|
|
698
|
+
$orderProducts: [OrderProductPatch!]!
|
|
699
|
+
) {
|
|
700
|
+
upsertDraftReleaseGood(draftReleaseGood: $draftReleaseGood, orderProducts: $orderProducts) {
|
|
701
|
+
id
|
|
702
|
+
name
|
|
703
|
+
refNo
|
|
704
|
+
refNo2
|
|
705
|
+
status
|
|
706
|
+
truckNo
|
|
707
|
+
ownTransport
|
|
708
|
+
marketplaceOrderStatus
|
|
709
|
+
billingAddress
|
|
710
|
+
deliveryAddress1
|
|
711
|
+
deliveryAddress2
|
|
712
|
+
deliveryAddress3
|
|
713
|
+
deliveryAddress4
|
|
714
|
+
deliveryAddress5
|
|
715
|
+
attentionTo
|
|
716
|
+
attentionCompany
|
|
717
|
+
city
|
|
718
|
+
state
|
|
719
|
+
postalCode
|
|
720
|
+
country
|
|
721
|
+
phone1
|
|
722
|
+
phone2
|
|
723
|
+
email
|
|
724
|
+
type
|
|
725
|
+
exportOption
|
|
726
|
+
releaseDate
|
|
727
|
+
collectionOrderNo
|
|
728
|
+
bizplace {
|
|
729
|
+
name
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
`,
|
|
734
|
+
variables: {
|
|
735
|
+
draftReleaseGood: {
|
|
736
|
+
bizplace: {
|
|
737
|
+
id: customerBizplace.id
|
|
738
|
+
},
|
|
739
|
+
courierOption: bodyReq.courierOption,
|
|
740
|
+
collectionOrderNo: bodyReq.collectionOrderNo,
|
|
741
|
+
exportOption: bodyReq.exportOption,
|
|
742
|
+
ownTransport: bodyReq.ownTransport,
|
|
743
|
+
packingOption: bodyReq.packingOption,
|
|
744
|
+
refNo: bodyReq.refNo,
|
|
745
|
+
refNo2: bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.refNo2,
|
|
746
|
+
releaseDate: bodyReq.releaseDate,
|
|
747
|
+
type: bodyReq.type,
|
|
748
|
+
marketplaceOrderStatus: bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.marketplaceOrderStatus,
|
|
749
|
+
remark: (bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.remark) || null,
|
|
750
|
+
billingAddress: ((_a = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.billTo) === null || _a === void 0 ? void 0 : _a.billingAddress) || null,
|
|
751
|
+
deliveryAddress1: ((_b = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _b === void 0 ? void 0 : _b.deliveryAddress1) || null,
|
|
752
|
+
deliveryAddress2: ((_c = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _c === void 0 ? void 0 : _c.deliveryAddress2) || null,
|
|
753
|
+
deliveryAddress3: ((_d = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _d === void 0 ? void 0 : _d.deliveryAddress3) || null,
|
|
754
|
+
deliveryAddress4: ((_e = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _e === void 0 ? void 0 : _e.deliveryAddress4) || null,
|
|
755
|
+
deliveryAddress5: ((_f = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _f === void 0 ? void 0 : _f.deliveryAddress5) || null,
|
|
756
|
+
attentionTo: ((_g = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _g === void 0 ? void 0 : _g.attentionTo) || null,
|
|
757
|
+
attentionCompany: ((_h = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _h === void 0 ? void 0 : _h.attentionCompany) || null,
|
|
758
|
+
city: ((_j = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _j === void 0 ? void 0 : _j.city) || null,
|
|
759
|
+
state: ((_k = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _k === void 0 ? void 0 : _k.state) || null,
|
|
760
|
+
postalCode: ((_l = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _l === void 0 ? void 0 : _l.postalCode) || null,
|
|
761
|
+
country: ((_m = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _m === void 0 ? void 0 : _m.country) || null,
|
|
762
|
+
phone1: ((_o = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _o === void 0 ? void 0 : _o.phone1) || null,
|
|
763
|
+
phone2: ((_p = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _p === void 0 ? void 0 : _p.phone2) || null,
|
|
764
|
+
email: ((_q = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _q === void 0 ? void 0 : _q.email) || null
|
|
765
|
+
},
|
|
766
|
+
orderProducts: orderInventories
|
|
767
|
+
},
|
|
768
|
+
context: Object.assign(Object.assign({}, context), { hasUpload: true, state: Object.assign(Object.assign({}, context.state), { customerBizplace,
|
|
769
|
+
domain, type: 'api' }) })
|
|
770
|
+
})).data;
|
|
771
|
+
}
|
|
772
|
+
//# sourceMappingURL=add-release-order.js.map
|