@things-factory/operato-mms 3.6.14 → 3.6.24
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/client/bootstrap.js +32 -16
- package/config.development.js +30 -53
- package/dist-server/graphql/resolvers/interface-with-hub/add-release-order.js +50 -8
- package/dist-server/graphql/resolvers/interface-with-hub/add-release-order.js.map +1 -1
- package/dist-server/graphql/resolvers/interface-with-hub/auto-add-release-order.js +64 -7
- package/dist-server/graphql/resolvers/interface-with-hub/auto-add-release-order.js.map +1 -1
- package/package.json +61 -61
- package/server/graphql/resolvers/interface-with-hub/add-release-order.ts +53 -14
- package/server/graphql/resolvers/interface-with-hub/auto-add-release-order.ts +71 -7
package/client/bootstrap.js
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
+
import '@things-factory/auth-ui' /* for domain-switch */
|
|
2
|
+
import '@things-factory/notification'
|
|
3
|
+
import './menu'
|
|
4
|
+
import './viewparts/user-circle'
|
|
5
|
+
|
|
6
|
+
import { html } from 'lit-element'
|
|
7
|
+
|
|
1
8
|
import { APPEND_APP_TOOL } from '@things-factory/apptool-base'
|
|
9
|
+
import { auth } from '@things-factory/auth-base'
|
|
10
|
+
import { setAuthManagementMenus } from '@things-factory/auth-ui'
|
|
2
11
|
import { appendViewpart, toggleOverlay, TOOL_POSITION, VIEWPART_POSITION } from '@things-factory/layout-base'
|
|
3
12
|
import { setupMenuPart } from '@things-factory/lite-menu'
|
|
4
13
|
import { ADD_MORENDA } from '@things-factory/more-base'
|
|
5
|
-
import { auth } from '@things-factory/auth-base'
|
|
6
|
-
import '@things-factory/auth-ui' /* for domain-switch */
|
|
7
|
-
import { setAuthManagementMenus } from '@things-factory/auth-ui'
|
|
8
|
-
import '@things-factory/notification'
|
|
9
14
|
import { ADD_SETTING } from '@things-factory/setting-base'
|
|
10
15
|
import { navigate, store } from '@things-factory/shell'
|
|
11
16
|
import { isMobileDevice } from '@things-factory/utils'
|
|
12
|
-
import { html } from 'lit-element'
|
|
13
|
-
import mms from './reducers/mms'
|
|
14
17
|
|
|
15
|
-
import './menu'
|
|
16
|
-
import './viewparts/user-circle'
|
|
17
18
|
import { fetchMmsStatus } from './actions/mms'
|
|
19
|
+
import mms from './reducers/mms'
|
|
18
20
|
|
|
19
21
|
console.log(
|
|
20
22
|
`%c
|
|
@@ -92,6 +94,28 @@ export default function bootstrap() {
|
|
|
92
94
|
position: VIEWPART_POSITION.ASIDEBAR
|
|
93
95
|
})
|
|
94
96
|
|
|
97
|
+
store.dispatch({
|
|
98
|
+
type: ADD_MORENDA,
|
|
99
|
+
morenda: {
|
|
100
|
+
icon: html` <mwc-icon>device_hub</mwc-icon> `,
|
|
101
|
+
name: html` <i18n-msg msgid="text.connection"></i18n-msg> `,
|
|
102
|
+
action: () => {
|
|
103
|
+
navigate('connection')
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
store.dispatch({
|
|
109
|
+
type: ADD_MORENDA,
|
|
110
|
+
morenda: {
|
|
111
|
+
icon: html` <mwc-icon>format_list_numbered</mwc-icon> `,
|
|
112
|
+
name: html` <i18n-msg msgid="text.scenario"></i18n-msg> `,
|
|
113
|
+
action: () => {
|
|
114
|
+
navigate('scenario')
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
})
|
|
118
|
+
|
|
95
119
|
store.dispatch({
|
|
96
120
|
type: ADD_SETTING,
|
|
97
121
|
setting: {
|
|
@@ -99,12 +123,4 @@ export default function bootstrap() {
|
|
|
99
123
|
template: html` <notification-setting-let></notification-setting-let> `
|
|
100
124
|
}
|
|
101
125
|
})
|
|
102
|
-
|
|
103
|
-
// store.dispatch({
|
|
104
|
-
// type: APPEND_APP_TOOL,
|
|
105
|
-
// tool: {
|
|
106
|
-
// template: html` <user-circle> </user-circle> `,
|
|
107
|
-
// position: TOOL_POSITION.REAR
|
|
108
|
-
// }
|
|
109
|
-
// })
|
|
110
126
|
}
|
package/config.development.js
CHANGED
|
@@ -2,29 +2,30 @@ module.exports = {
|
|
|
2
2
|
domainType: 'company',
|
|
3
3
|
ormconfig: {
|
|
4
4
|
name: 'default',
|
|
5
|
-
type: '
|
|
6
|
-
database: '
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
type: 'sqlite',
|
|
6
|
+
database: 'db.sqlite',
|
|
7
|
+
synchronize: false,
|
|
8
|
+
logging: true,
|
|
9
|
+
logger: 'debug'
|
|
10
|
+
// name: 'default',
|
|
11
|
+
// type: 'postgres',
|
|
12
|
+
// database: 'postgres',
|
|
13
|
+
// username: 'postgres',
|
|
14
|
+
// password: 'abcd1234',
|
|
15
|
+
// host: 'localhost',
|
|
16
|
+
// port: 15432,
|
|
17
|
+
// synchronize: true,
|
|
18
|
+
// logging: true
|
|
19
|
+
},
|
|
20
|
+
oauth2: {
|
|
21
|
+
platforms: [
|
|
22
|
+
{
|
|
23
|
+
name: 'Operato Hub',
|
|
24
|
+
apiURL: 'http://operato-m.localhost:3000/api'
|
|
25
|
+
}
|
|
26
|
+
]
|
|
13
27
|
},
|
|
14
|
-
// ormconfig: {
|
|
15
|
-
// name: 'default',
|
|
16
|
-
// type: 'postgres',
|
|
17
|
-
// database: 'postgres',
|
|
18
|
-
// username: 'postgres',
|
|
19
|
-
// password: 'abcd1234',
|
|
20
|
-
// host: 'operatov3.cluster-cijhm4n1hbst.ap-southeast-1.rds.amazonaws.com',
|
|
21
|
-
// port: 55432,
|
|
22
|
-
// synchronize: true,
|
|
23
|
-
// logging: true
|
|
24
|
-
// },
|
|
25
28
|
useVirtualHostBasedDomain: false,
|
|
26
|
-
accessTokenCookieKey: 'access_token.mms',
|
|
27
|
-
subdomainOffset: 2,
|
|
28
29
|
port: 5000,
|
|
29
30
|
uploads: 'uploads',
|
|
30
31
|
attachmentsPath: 'attachments',
|
|
@@ -39,13 +40,14 @@ module.exports = {
|
|
|
39
40
|
level: 'info'
|
|
40
41
|
}
|
|
41
42
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
fulfillmentIntegrationOperato: {
|
|
44
|
+
host: 'operatohub.com',
|
|
45
|
+
platform: 'operato',
|
|
46
|
+
application: 'Operato MMS',
|
|
47
|
+
appKey: '480d19cbfb0655357878119559d47333',
|
|
48
|
+
appSecret: 'dc5078bc17d50a18ef6fc3188934bbbd',
|
|
49
|
+
callback: 'https://www.myoperato.com/callback-operato'
|
|
50
|
+
},
|
|
49
51
|
marketplaceIntegrationShopee: {
|
|
50
52
|
platform: 'shopee',
|
|
51
53
|
isUAT: false,
|
|
@@ -60,31 +62,6 @@ module.exports = {
|
|
|
60
62
|
appSecret: 'HB3RTNEXHlVSlBr9SmWF8AjbSUT7a825',
|
|
61
63
|
callback: 'https://myoperato.com/lazada-callback'
|
|
62
64
|
},
|
|
63
|
-
marketplaceIntegrationShopify: {
|
|
64
|
-
platform: 'shopify',
|
|
65
|
-
application: 'Operato MMS',
|
|
66
|
-
apiKey: '21e55f83b2b705172364c93a18cf560c',
|
|
67
|
-
apiSecret: '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'
|
|
68
|
-
},
|
|
69
|
-
marketplaceIntegrationShopifyPrivate: {
|
|
70
|
-
platform: 'shopify',
|
|
71
|
-
application: 'Operato MMS Test',
|
|
72
|
-
apiKey: '5be8c95bc9a03d41e3c0da3d8c033747',
|
|
73
|
-
apiSecret: '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'
|
|
74
|
-
},
|
|
75
|
-
fulfillmentIntegrationOperato: {
|
|
76
|
-
protocol: 'http',
|
|
77
|
-
host: 'operato-h.com:3000',
|
|
78
|
-
platform: 'operato',
|
|
79
|
-
application: 'Operato MMS',
|
|
80
|
-
appKey: 'a9bf751e622bf146662b240d58971051',
|
|
81
|
-
appSecret: '1c385935dc131c4b902b9bbf6a4798af',
|
|
82
|
-
callback: 'http://operato-m.com:5000/callback-operato'
|
|
83
|
-
},
|
|
84
|
-
lmdIntegrationCitylink: {
|
|
85
|
-
protocol: 'http',
|
|
86
|
-
host: '202.133.101.28:8889'
|
|
87
|
-
},
|
|
88
65
|
notification: {
|
|
89
66
|
fcm: {
|
|
90
67
|
serviceAccount: {
|
|
@@ -24,21 +24,63 @@ exports.addReleaseOrderResolver = {
|
|
|
24
24
|
});
|
|
25
25
|
const marketplaceOrderShippings = await tx
|
|
26
26
|
.getRepository(marketplace_base_1.MarketplaceOrderShipping)
|
|
27
|
-
.find({
|
|
28
|
-
where: { orderNoRef: marketplaceOrder.orderNo, domain }
|
|
29
|
-
});
|
|
30
|
-
const marketplaceOrderShippingsLength = marketplaceOrderShippings.length;
|
|
27
|
+
.find({ where: { orderNoRef: marketplaceOrder.orderNo, domain } });
|
|
31
28
|
for (var j = 0; j < marketplaceOrderShippings.length; j++) {
|
|
32
29
|
const marketplaceOrderShipping = marketplaceOrderShippings[j];
|
|
33
|
-
const
|
|
30
|
+
const date = new Date();
|
|
31
|
+
const releaseDate = `${date.getFullYear()}-${(date.getMonth() + 1)
|
|
32
|
+
.toString()
|
|
33
|
+
.padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`;
|
|
34
|
+
const newMarketplaceOrder = {
|
|
35
|
+
releaseDate,
|
|
36
|
+
type: 'b2c',
|
|
37
|
+
transporter: marketplaceOrder.shippingProvider,
|
|
38
|
+
trackingNo: (marketplaceOrderShipping === null || marketplaceOrderShipping === void 0 ? void 0 : marketplaceOrderShipping.ownTrackingNo)
|
|
39
|
+
? marketplaceOrderShipping.ownTrackingNo
|
|
40
|
+
: marketplaceOrderShipping.trackingNo,
|
|
41
|
+
packingOption: true,
|
|
42
|
+
exportOption: false,
|
|
43
|
+
ownTransport: true,
|
|
44
|
+
courierOption: true,
|
|
45
|
+
collectionOrderNo: marketplaceOrder.orderNo,
|
|
46
|
+
refNo: marketplaceOrder.orderNo,
|
|
47
|
+
refNo2: marketplaceOrder.orderNo + ' - ' + (j + 1) + '/' + marketplaceOrderShippings.length,
|
|
48
|
+
deliverTo: {
|
|
49
|
+
deliveryAddress1: marketplaceOrderShipping.address1,
|
|
50
|
+
deliveryAddress2: marketplaceOrderShipping.address2,
|
|
51
|
+
deliveryAddress3: marketplaceOrderShipping.address3,
|
|
52
|
+
deliveryAddress4: marketplaceOrderShipping.address4,
|
|
53
|
+
deliveryAddress5: marketplaceOrderShipping.address5,
|
|
54
|
+
attentionTo: marketplaceOrderShipping.attentionTo,
|
|
55
|
+
city: marketplaceOrderShipping.city,
|
|
56
|
+
postalCode: marketplaceOrderShipping.postCode,
|
|
57
|
+
country: marketplaceOrderShipping.country,
|
|
58
|
+
state: marketplaceOrderShipping.state,
|
|
59
|
+
phone1: marketplaceOrderShipping.phone1,
|
|
60
|
+
phone2: (marketplaceOrderShipping === null || marketplaceOrderShipping === void 0 ? void 0 : marketplaceOrderShipping.phone2) ? marketplaceOrderShipping.phone2 : null
|
|
61
|
+
},
|
|
62
|
+
marketplaceOrderStatus: marketplaceOrder.status,
|
|
63
|
+
airwayBill: (marketplaceOrderShipping === null || marketplaceOrderShipping === void 0 ? void 0 : marketplaceOrderShipping.airwayBill) ? marketplaceOrderShipping.airwayBill : null,
|
|
64
|
+
invoice: (marketplaceOrderShipping === null || marketplaceOrderShipping === void 0 ? void 0 : marketplaceOrderShipping.invoice) ? marketplaceOrderShipping.invoice : null,
|
|
65
|
+
orderInventories: marketplaceOrder.marketplaceOrderItems
|
|
66
|
+
.filter(item => {
|
|
34
67
|
if (item.marketplaceOrderShipping.id === marketplaceOrderShipping.id) {
|
|
35
68
|
return item;
|
|
36
69
|
}
|
|
37
|
-
})
|
|
38
|
-
|
|
70
|
+
})
|
|
71
|
+
.map((orderItem) => {
|
|
72
|
+
const { marketplaceProductVariation: productVariation } = orderItem;
|
|
73
|
+
return {
|
|
74
|
+
product: {
|
|
75
|
+
sku: productVariation.sku
|
|
76
|
+
},
|
|
77
|
+
releaseQty: orderItem.qty
|
|
78
|
+
};
|
|
79
|
+
})
|
|
80
|
+
};
|
|
39
81
|
var releaseOrder = await integration_fulfillment_1.FulfillmentAPI.createOutboundOrder(fulfilmentCenter, {
|
|
40
82
|
customerBizplaceId,
|
|
41
|
-
|
|
83
|
+
releaseOrder: newMarketplaceOrder
|
|
42
84
|
});
|
|
43
85
|
}
|
|
44
86
|
marketplaceOrder.releaseOrderId = releaseOrder.id;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-release-order.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/add-release-order.ts"],"names":[],"mappings":";;;AAEA,uDAAyE;AACzE,qFAA2F;AAC3F,uEAA6F;AAC7F,iDAA8C;AAEjC,QAAA,uBAAuB,GAAG;IACrC,KAAK,CAAC,eAAe,CACnB,CAAO,EACP,EAAE,mBAAmB,EAAE,WAAW,EAAqD,EACvF,OAAY;QAEZ,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAA0C,OAAO,CAAC,KAAK,CAAA;QAE3E,MAAM,gBAAgB,GAAsB,MAAM,wCAAc,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAA;QAClG,MAAM,QAAQ,GAAW,gBAAgB,CAAC,QAAQ,CAAA;QAElD,IAAI,eAAe,GAAW,MAAM,EAAE,CAAC,aAAa,CAAC,cAAM,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAA;QACxG,IAAI,iBAAiB,GAAe,MAAM,IAAA,+BAAoB,EAAC,eAAe,CAAC,CAAA;QAE/E,MAAM,kBAAkB,GAAW,iBAAiB,CAAC,IAAI,CACvD,gBAAgB,CAAC,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE,CACrE,CAAC,EAAE,CAAA;QAEJ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,mBAAmB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACnD,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAA;YAEjD,MAAM,gBAAgB,GAAqB,MAAM,EAAE,CAAC,aAAa,CAAC,mCAAgB,CAAC,CAAC,OAAO,CAAC,kBAAkB,EAAE;gBAC9G,SAAS,EAAE;oBACT,uBAAuB;oBACvB,mDAAmD;oBACnD,gDAAgD;iBACjD;aACF,CAAC,CAAA;YAEF,MAAM,yBAAyB,GAA+B,MAAM,EAAE;iBACnE,aAAa,CAAC,2CAAwB,CAAC;iBACvC,IAAI,CAAC
|
|
1
|
+
{"version":3,"file":"add-release-order.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/add-release-order.ts"],"names":[],"mappings":";;;AAEA,uDAAyE;AACzE,qFAA2F;AAC3F,uEAA6F;AAC7F,iDAA8C;AAEjC,QAAA,uBAAuB,GAAG;IACrC,KAAK,CAAC,eAAe,CACnB,CAAO,EACP,EAAE,mBAAmB,EAAE,WAAW,EAAqD,EACvF,OAAY;QAEZ,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAA0C,OAAO,CAAC,KAAK,CAAA;QAE3E,MAAM,gBAAgB,GAAsB,MAAM,wCAAc,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAA;QAClG,MAAM,QAAQ,GAAW,gBAAgB,CAAC,QAAQ,CAAA;QAElD,IAAI,eAAe,GAAW,MAAM,EAAE,CAAC,aAAa,CAAC,cAAM,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAA;QACxG,IAAI,iBAAiB,GAAe,MAAM,IAAA,+BAAoB,EAAC,eAAe,CAAC,CAAA;QAE/E,MAAM,kBAAkB,GAAW,iBAAiB,CAAC,IAAI,CACvD,gBAAgB,CAAC,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,KAA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;oBAC7F,OAAO,EAAE,CAAA,wBAAwB,aAAxB,wBAAwB,uBAAxB,wBAAwB,CAAE,OAAO,EAAC,CAAC,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;oBACpF,gBAAgB,EAAE,gBAAgB,CAAC,qBAAqB;yBACrD,MAAM,CAAC,IAAI,CAAC,EAAE;wBACb,IAAI,IAAI,CAAC,wBAAwB,CAAC,EAAE,KAAK,wBAAwB,CAAC,EAAE,EAAE;4BACpE,OAAO,IAAI,CAAA;yBACZ;oBACH,CAAC,CAAC;yBACD,GAAG,CAAC,CAAC,SAAc,EAAE,EAAE;wBACtB,MAAM,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,GAAQ,SAAS,CAAA;wBACxE,OAAO;4BACL,OAAO,EAAE;gCACP,GAAG,EAAE,gBAAgB,CAAC,GAAG;6BAC1B;4BACD,UAAU,EAAE,SAAS,CAAC,GAAG;yBAC1B,CAAA;oBACH,CAAC,CAAC;iBACL,CAAA;gBAED,IAAI,YAAY,GAAQ,MAAM,wCAAc,CAAC,mBAAmB,CAAC,gBAAgB,EAAE;oBACjF,kBAAkB;oBAClB,YAAY,EAAE,mBAAmB;iBAClC,CAAC,CAAA;aACH;YAED,gBAAgB,CAAC,cAAc,GAAG,YAAY,CAAC,EAAE,CAAA;YACjD,gBAAgB,CAAC,iBAAiB,GAAG,gBAAgB,CAAA;YACrD,MAAM,EAAE,CAAC,aAAa,CAAC,mCAAgB,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;SAChE;IACH,CAAC;CACF,CAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.autoAddReleaseOrderResolver = void 0;
|
|
4
|
+
const typeorm_1 = require("typeorm");
|
|
5
|
+
const biz_base_1 = require("@things-factory/biz-base");
|
|
4
6
|
const integration_fulfillment_1 = require("@things-factory/integration-fulfillment");
|
|
5
|
-
const shell_1 = require("@things-factory/shell");
|
|
6
7
|
const marketplace_base_1 = require("@things-factory/marketplace-base");
|
|
7
|
-
const
|
|
8
|
-
const typeorm_1 = require("typeorm");
|
|
8
|
+
const shell_1 = require("@things-factory/shell");
|
|
9
9
|
exports.autoAddReleaseOrderResolver = {
|
|
10
10
|
async autoAddReleaseOrder(_, { warehouseId }, context) {
|
|
11
11
|
const { domain } = context.state;
|
|
@@ -23,13 +23,70 @@ exports.autoAddReleaseOrderResolver = {
|
|
|
23
23
|
var centerId = fulfilmentCenter.centerId;
|
|
24
24
|
var warehouseDomain = await (0, typeorm_1.getRepository)(shell_1.Domain).findOne({ where: { subdomain: centerId } });
|
|
25
25
|
var customerBizplaces = await (0, biz_base_1.getCustomerBizplaces)(warehouseDomain);
|
|
26
|
-
|
|
26
|
+
const customerBizplaceId = customerBizplaces.find(customerBizplace => customerBizplace.company.domain.id === domain.id).id;
|
|
27
27
|
for (var i = 0; i < marketplaceOrders.length; i++) {
|
|
28
28
|
const marketplaceOrder = marketplaceOrders[i];
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
marketplaceOrder
|
|
29
|
+
const marketplaceOrderShippings = await (0, typeorm_1.getRepository)(marketplace_base_1.MarketplaceOrderShipping).find({
|
|
30
|
+
where: { orderNoRef: marketplaceOrder.orderNo, domain }
|
|
32
31
|
});
|
|
32
|
+
for (var j = 0; j < marketplaceOrderShippings.length; j++) {
|
|
33
|
+
const marketplaceOrderShipping = marketplaceOrderShippings[j];
|
|
34
|
+
const date = new Date();
|
|
35
|
+
const releaseDate = `${date.getFullYear()}-${(date.getMonth() + 1)
|
|
36
|
+
.toString()
|
|
37
|
+
.padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`;
|
|
38
|
+
const newMarketplaceOrder = {
|
|
39
|
+
releaseDate,
|
|
40
|
+
type: 'b2c',
|
|
41
|
+
transporter: marketplaceOrder.shippingProvider,
|
|
42
|
+
trackingNo: (marketplaceOrderShipping === null || marketplaceOrderShipping === void 0 ? void 0 : marketplaceOrderShipping.ownTrackingNo)
|
|
43
|
+
? marketplaceOrderShipping.ownTrackingNo
|
|
44
|
+
: marketplaceOrderShipping.trackingNo,
|
|
45
|
+
packingOption: true,
|
|
46
|
+
exportOption: false,
|
|
47
|
+
ownTransport: true,
|
|
48
|
+
courierOption: true,
|
|
49
|
+
collectionOrderNo: marketplaceOrder.orderNo,
|
|
50
|
+
refNo: marketplaceOrder.orderNo,
|
|
51
|
+
refNo2: marketplaceOrder.orderNo + ' - ' + (j + 1) + '/' + marketplaceOrderShippings.length,
|
|
52
|
+
deliverTo: {
|
|
53
|
+
deliveryAddress1: marketplaceOrderShipping.address1,
|
|
54
|
+
deliveryAddress2: marketplaceOrderShipping.address2,
|
|
55
|
+
deliveryAddress3: marketplaceOrderShipping.address3,
|
|
56
|
+
deliveryAddress4: marketplaceOrderShipping.address4,
|
|
57
|
+
deliveryAddress5: marketplaceOrderShipping.address5,
|
|
58
|
+
attentionTo: marketplaceOrderShipping.attentionTo,
|
|
59
|
+
city: marketplaceOrderShipping.city,
|
|
60
|
+
postalCode: marketplaceOrderShipping.postCode,
|
|
61
|
+
country: marketplaceOrderShipping.country,
|
|
62
|
+
state: marketplaceOrderShipping.state,
|
|
63
|
+
phone1: marketplaceOrderShipping.phone1,
|
|
64
|
+
phone2: (marketplaceOrderShipping === null || marketplaceOrderShipping === void 0 ? void 0 : marketplaceOrderShipping.phone2) ? marketplaceOrderShipping.phone2 : null
|
|
65
|
+
},
|
|
66
|
+
marketplaceOrderStatus: marketplaceOrder.status,
|
|
67
|
+
airwayBill: (marketplaceOrderShipping === null || marketplaceOrderShipping === void 0 ? void 0 : marketplaceOrderShipping.airwayBill) ? marketplaceOrderShipping.airwayBill : null,
|
|
68
|
+
invoice: (marketplaceOrderShipping === null || marketplaceOrderShipping === void 0 ? void 0 : marketplaceOrderShipping.invoice) ? marketplaceOrderShipping.invoice : null,
|
|
69
|
+
orderInventories: marketplaceOrder.marketplaceOrderItems
|
|
70
|
+
.filter(item => {
|
|
71
|
+
if (item.marketplaceOrderShipping.id === marketplaceOrderShipping.id) {
|
|
72
|
+
return item;
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
.map((orderItem) => {
|
|
76
|
+
const { marketplaceProductVariation: productVariation } = orderItem;
|
|
77
|
+
return {
|
|
78
|
+
product: {
|
|
79
|
+
sku: productVariation.sku
|
|
80
|
+
},
|
|
81
|
+
releaseQty: orderItem.qty
|
|
82
|
+
};
|
|
83
|
+
})
|
|
84
|
+
};
|
|
85
|
+
var releaseOrder = await integration_fulfillment_1.FulfillmentAPI.createOutboundOrder(fulfilmentCenter, {
|
|
86
|
+
customerBizplaceId,
|
|
87
|
+
releaseOrder: newMarketplaceOrder
|
|
88
|
+
});
|
|
89
|
+
}
|
|
33
90
|
marketplaceOrder.releaseOrderId = releaseOrder.id;
|
|
34
91
|
marketplaceOrder.fulfillmentCenter = fulfilmentCenter;
|
|
35
92
|
await (0, typeorm_1.getRepository)(marketplace_base_1.MarketplaceOrder).save(marketplaceOrder);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-add-release-order.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/auto-add-release-order.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"auto-add-release-order.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/auto-add-release-order.ts"],"names":[],"mappings":";;;AAAA,qCAA+E;AAE/E,uDAAyE;AACzE,qFAAwE;AACxE,uEAA6F;AAC7F,iDAA8C;AAEjC,QAAA,2BAA2B,GAAG;IACzC,KAAK,CAAC,mBAAmB,CAAC,CAAO,EAAE,EAAE,WAAW,EAA2B,EAAE,OAAY;QACvF,MAAM,EAAE,MAAM,EAAE,GAAuB,OAAO,CAAC,KAAK,CAAA;QAEpD,MAAM,EAAE,GAAyC,IAAA,4BAAkB,EAAC,mCAAgB,EAAE,IAAI,CAAC,CAAA;Q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;wBACxE,OAAO;4BACL,OAAO,EAAE;gCACP,GAAG,EAAE,gBAAgB,CAAC,GAAG;6BAC1B;4BACD,UAAU,EAAE,SAAS,CAAC,GAAG;yBAC1B,CAAA;oBACH,CAAC,CAAC;iBACL,CAAA;gBAED,IAAI,YAAY,GAAQ,MAAM,wCAAc,CAAC,mBAAmB,CAAC,gBAAgB,EAAE;oBACjF,kBAAkB;oBAClB,YAAY,EAAE,mBAAmB;iBAClC,CAAC,CAAA;aACH;YAED,gBAAgB,CAAC,cAAc,GAAG,YAAY,CAAC,EAAE,CAAA;YACjD,gBAAgB,CAAC,iBAAiB,GAAG,gBAAgB,CAAA;YACrD,MAAM,IAAA,uBAAa,EAAC,mCAAgB,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;SAC7D;IACH,CAAC;CACF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/operato-mms",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.24",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -41,68 +41,68 @@
|
|
|
41
41
|
"@material/mwc-formfield": "^0.22.1",
|
|
42
42
|
"@material/mwc-linear-progress": "^0.22.1",
|
|
43
43
|
"@material/mwc-radio": "^0.22.1",
|
|
44
|
-
"@things-factory/apptool-ui": "^3.6.
|
|
45
|
-
"@things-factory/attachment-base": "^3.6.
|
|
46
|
-
"@things-factory/auth-ui": "^3.6.
|
|
47
|
-
"@things-factory/biz-base": "^3.6.
|
|
48
|
-
"@things-factory/board-service": "^3.6.
|
|
49
|
-
"@things-factory/board-ui": "^3.6.
|
|
50
|
-
"@things-factory/code-ui": "^3.6.
|
|
51
|
-
"@things-factory/context-ui": "^3.6.
|
|
52
|
-
"@things-factory/dashboard": "^3.6.
|
|
53
|
-
"@things-factory/export-ui": "^3.6.
|
|
54
|
-
"@things-factory/export-ui-csv": "^3.6.
|
|
55
|
-
"@things-factory/export-ui-excel": "^3.6.
|
|
56
|
-
"@things-factory/geography": "^3.6.
|
|
57
|
-
"@things-factory/grist-ui": "^3.6.
|
|
58
|
-
"@things-factory/help": "^3.6.
|
|
59
|
-
"@things-factory/i18n-ui": "^3.6.
|
|
60
|
-
"@things-factory/integration-fulfillment": "^3.6.
|
|
61
|
-
"@things-factory/integration-lmd": "^3.6.
|
|
62
|
-
"@things-factory/lite-menu": "^3.6.
|
|
63
|
-
"@things-factory/marketplace-base": "^3.6.
|
|
64
|
-
"@things-factory/more-ui": "^3.6.
|
|
65
|
-
"@things-factory/notification": "^3.6.
|
|
66
|
-
"@things-factory/oauth2-client": "^3.6.
|
|
67
|
-
"@things-factory/pdf": "^3.6.
|
|
68
|
-
"@things-factory/product-base": "^3.6.
|
|
69
|
-
"@things-factory/resource-ui": "^3.6.
|
|
70
|
-
"@things-factory/scene-chartjs": "^3.6.
|
|
71
|
-
"@things-factory/scene-clock": "^3.6.
|
|
72
|
-
"@things-factory/scene-clone": "^3.6.
|
|
73
|
-
"@things-factory/scene-compass": "^3.6.
|
|
74
|
-
"@things-factory/scene-data-transform": "^3.6.
|
|
75
|
-
"@things-factory/scene-excel": "^3.6.
|
|
76
|
-
"@things-factory/scene-firebase": "^3.6.
|
|
77
|
-
"@things-factory/scene-form": "^3.6.
|
|
78
|
-
"@things-factory/scene-gauge": "^3.6.
|
|
79
|
-
"@things-factory/scene-google-map": "^3.6.
|
|
80
|
-
"@things-factory/scene-graphql": "^3.6.
|
|
81
|
-
"@things-factory/scene-grist": "^3.6.
|
|
82
|
-
"@things-factory/scene-half-roundrect": "^3.6.
|
|
83
|
-
"@things-factory/scene-indoor-map": "^3.6.
|
|
84
|
-
"@things-factory/scene-integration": "^3.6.
|
|
85
|
-
"@things-factory/scene-label": "^3.6.
|
|
86
|
-
"@things-factory/scene-legend": "^3.6.
|
|
87
|
-
"@things-factory/scene-marker": "^3.6.
|
|
88
|
-
"@things-factory/scene-mqtt": "^3.6.
|
|
89
|
-
"@things-factory/scene-news-ticker": "^3.6.
|
|
90
|
-
"@things-factory/scene-progressbar": "^3.6.
|
|
91
|
-
"@things-factory/scene-random": "^3.6.
|
|
92
|
-
"@things-factory/scene-restful": "^3.6.
|
|
93
|
-
"@things-factory/scene-switch": "^3.6.
|
|
94
|
-
"@things-factory/scene-tab": "^3.6.
|
|
95
|
-
"@things-factory/scene-table": "^3.6.
|
|
96
|
-
"@things-factory/scene-timer": "^3.6.
|
|
97
|
-
"@things-factory/scene-visualizer": "^3.6.
|
|
98
|
-
"@things-factory/scene-wheel-sorter": "^3.6.
|
|
99
|
-
"@things-factory/setting-ui": "^3.6.
|
|
100
|
-
"@things-factory/system-ui": "^3.6.
|
|
101
|
-
"@things-factory/warehouse-base": "^3.6.
|
|
44
|
+
"@things-factory/apptool-ui": "^3.6.24",
|
|
45
|
+
"@things-factory/attachment-base": "^3.6.24",
|
|
46
|
+
"@things-factory/auth-ui": "^3.6.24",
|
|
47
|
+
"@things-factory/biz-base": "^3.6.24",
|
|
48
|
+
"@things-factory/board-service": "^3.6.24",
|
|
49
|
+
"@things-factory/board-ui": "^3.6.24",
|
|
50
|
+
"@things-factory/code-ui": "^3.6.24",
|
|
51
|
+
"@things-factory/context-ui": "^3.6.24",
|
|
52
|
+
"@things-factory/dashboard": "^3.6.24",
|
|
53
|
+
"@things-factory/export-ui": "^3.6.24",
|
|
54
|
+
"@things-factory/export-ui-csv": "^3.6.24",
|
|
55
|
+
"@things-factory/export-ui-excel": "^3.6.24",
|
|
56
|
+
"@things-factory/geography": "^3.6.24",
|
|
57
|
+
"@things-factory/grist-ui": "^3.6.24",
|
|
58
|
+
"@things-factory/help": "^3.6.24",
|
|
59
|
+
"@things-factory/i18n-ui": "^3.6.24",
|
|
60
|
+
"@things-factory/integration-fulfillment": "^3.6.24",
|
|
61
|
+
"@things-factory/integration-lmd": "^3.6.24",
|
|
62
|
+
"@things-factory/lite-menu": "^3.6.24",
|
|
63
|
+
"@things-factory/marketplace-base": "^3.6.24",
|
|
64
|
+
"@things-factory/more-ui": "^3.6.24",
|
|
65
|
+
"@things-factory/notification": "^3.6.24",
|
|
66
|
+
"@things-factory/oauth2-client": "^3.6.24",
|
|
67
|
+
"@things-factory/pdf": "^3.6.24",
|
|
68
|
+
"@things-factory/product-base": "^3.6.24",
|
|
69
|
+
"@things-factory/resource-ui": "^3.6.24",
|
|
70
|
+
"@things-factory/scene-chartjs": "^3.6.24",
|
|
71
|
+
"@things-factory/scene-clock": "^3.6.24",
|
|
72
|
+
"@things-factory/scene-clone": "^3.6.24",
|
|
73
|
+
"@things-factory/scene-compass": "^3.6.24",
|
|
74
|
+
"@things-factory/scene-data-transform": "^3.6.24",
|
|
75
|
+
"@things-factory/scene-excel": "^3.6.24",
|
|
76
|
+
"@things-factory/scene-firebase": "^3.6.24",
|
|
77
|
+
"@things-factory/scene-form": "^3.6.24",
|
|
78
|
+
"@things-factory/scene-gauge": "^3.6.24",
|
|
79
|
+
"@things-factory/scene-google-map": "^3.6.24",
|
|
80
|
+
"@things-factory/scene-graphql": "^3.6.24",
|
|
81
|
+
"@things-factory/scene-grist": "^3.6.24",
|
|
82
|
+
"@things-factory/scene-half-roundrect": "^3.6.24",
|
|
83
|
+
"@things-factory/scene-indoor-map": "^3.6.24",
|
|
84
|
+
"@things-factory/scene-integration": "^3.6.24",
|
|
85
|
+
"@things-factory/scene-label": "^3.6.24",
|
|
86
|
+
"@things-factory/scene-legend": "^3.6.24",
|
|
87
|
+
"@things-factory/scene-marker": "^3.6.24",
|
|
88
|
+
"@things-factory/scene-mqtt": "^3.6.24",
|
|
89
|
+
"@things-factory/scene-news-ticker": "^3.6.24",
|
|
90
|
+
"@things-factory/scene-progressbar": "^3.6.24",
|
|
91
|
+
"@things-factory/scene-random": "^3.6.24",
|
|
92
|
+
"@things-factory/scene-restful": "^3.6.24",
|
|
93
|
+
"@things-factory/scene-switch": "^3.6.24",
|
|
94
|
+
"@things-factory/scene-tab": "^3.6.24",
|
|
95
|
+
"@things-factory/scene-table": "^3.6.24",
|
|
96
|
+
"@things-factory/scene-timer": "^3.6.24",
|
|
97
|
+
"@things-factory/scene-visualizer": "^3.6.24",
|
|
98
|
+
"@things-factory/scene-wheel-sorter": "^3.6.24",
|
|
99
|
+
"@things-factory/setting-ui": "^3.6.24",
|
|
100
|
+
"@things-factory/system-ui": "^3.6.24",
|
|
101
|
+
"@things-factory/warehouse-base": "^3.6.24"
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
|
-
"@things-factory/builder": "^3.6.
|
|
104
|
+
"@things-factory/builder": "^3.6.24",
|
|
105
105
|
"@types/node-fetch": "^2.5.7"
|
|
106
106
|
},
|
|
107
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "b6277d4b37ae6f304a683c150e983bdb81baaa72"
|
|
108
108
|
}
|
|
@@ -36,28 +36,67 @@ export const addReleaseOrderResolver = {
|
|
|
36
36
|
|
|
37
37
|
const marketplaceOrderShippings: MarketplaceOrderShipping[] = await tx
|
|
38
38
|
.getRepository(MarketplaceOrderShipping)
|
|
39
|
-
.find({
|
|
40
|
-
where: { orderNoRef: marketplaceOrder.orderNo, domain }
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
const marketplaceOrderShippingsLength: number = marketplaceOrderShippings.length
|
|
39
|
+
.find({ where: { orderNoRef: marketplaceOrder.orderNo, domain } })
|
|
44
40
|
|
|
45
41
|
for (var j = 0; j < marketplaceOrderShippings.length; j++) {
|
|
46
42
|
const marketplaceOrderShipping: MarketplaceOrderShipping = marketplaceOrderShippings[j]
|
|
43
|
+
|
|
44
|
+
const date: Date = new Date()
|
|
45
|
+
const releaseDate = `${date.getFullYear()}-${(date.getMonth() + 1)
|
|
46
|
+
.toString()
|
|
47
|
+
.padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`
|
|
48
|
+
|
|
47
49
|
const newMarketplaceOrder: any = {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
releaseDate,
|
|
51
|
+
type: 'b2c',
|
|
52
|
+
transporter: marketplaceOrder.shippingProvider,
|
|
53
|
+
trackingNo: marketplaceOrderShipping?.ownTrackingNo
|
|
54
|
+
? marketplaceOrderShipping.ownTrackingNo
|
|
55
|
+
: marketplaceOrderShipping.trackingNo,
|
|
56
|
+
packingOption: true,
|
|
57
|
+
exportOption: false,
|
|
58
|
+
ownTransport: true,
|
|
59
|
+
courierOption: true,
|
|
60
|
+
collectionOrderNo: marketplaceOrder.orderNo,
|
|
61
|
+
refNo: marketplaceOrder.orderNo,
|
|
62
|
+
refNo2: marketplaceOrder.orderNo + ' - ' + (j + 1) + '/' + marketplaceOrderShippings.length,
|
|
63
|
+
deliverTo: {
|
|
64
|
+
deliveryAddress1: marketplaceOrderShipping.address1,
|
|
65
|
+
deliveryAddress2: marketplaceOrderShipping.address2,
|
|
66
|
+
deliveryAddress3: marketplaceOrderShipping.address3,
|
|
67
|
+
deliveryAddress4: marketplaceOrderShipping.address4,
|
|
68
|
+
deliveryAddress5: marketplaceOrderShipping.address5,
|
|
69
|
+
attentionTo: marketplaceOrderShipping.attentionTo,
|
|
70
|
+
city: marketplaceOrderShipping.city,
|
|
71
|
+
postalCode: marketplaceOrderShipping.postCode,
|
|
72
|
+
country: marketplaceOrderShipping.country,
|
|
73
|
+
state: marketplaceOrderShipping.state,
|
|
74
|
+
phone1: marketplaceOrderShipping.phone1,
|
|
75
|
+
phone2: marketplaceOrderShipping?.phone2 ? marketplaceOrderShipping.phone2 : null
|
|
76
|
+
},
|
|
77
|
+
marketplaceOrderStatus: marketplaceOrder.status,
|
|
78
|
+
airwayBill: marketplaceOrderShipping?.airwayBill ? marketplaceOrderShipping.airwayBill : null,
|
|
79
|
+
invoice: marketplaceOrderShipping?.invoice ? marketplaceOrderShipping.invoice : null,
|
|
80
|
+
orderInventories: marketplaceOrder.marketplaceOrderItems
|
|
81
|
+
.filter(item => {
|
|
82
|
+
if (item.marketplaceOrderShipping.id === marketplaceOrderShipping.id) {
|
|
83
|
+
return item
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
.map((orderItem: any) => {
|
|
87
|
+
const { marketplaceProductVariation: productVariation }: any = orderItem
|
|
88
|
+
return {
|
|
89
|
+
product: {
|
|
90
|
+
sku: productVariation.sku
|
|
91
|
+
},
|
|
92
|
+
releaseQty: orderItem.qty
|
|
93
|
+
}
|
|
94
|
+
})
|
|
55
95
|
}
|
|
56
96
|
|
|
57
|
-
// temp fix to find the first partner
|
|
58
97
|
var releaseOrder: any = await FulfillmentAPI.createOutboundOrder(fulfilmentCenter, {
|
|
59
98
|
customerBizplaceId,
|
|
60
|
-
|
|
99
|
+
releaseOrder: newMarketplaceOrder
|
|
61
100
|
})
|
|
62
101
|
}
|
|
63
102
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { createQueryBuilder, getRepository, SelectQueryBuilder } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
import { Bizplace, getCustomerBizplaces } from '@things-factory/biz-base'
|
|
1
4
|
import { FulfillmentAPI } from '@things-factory/integration-fulfillment'
|
|
5
|
+
import { MarketplaceOrder, MarketplaceOrderShipping } from '@things-factory/marketplace-base'
|
|
2
6
|
import { Domain } from '@things-factory/shell'
|
|
3
|
-
import { MarketplaceOrder } from '@things-factory/marketplace-base'
|
|
4
|
-
import { Bizplace, getCustomerBizplaces } from '@things-factory/biz-base'
|
|
5
|
-
import { getRepository, SelectQueryBuilder, createQueryBuilder } from 'typeorm'
|
|
6
7
|
|
|
7
8
|
export const autoAddReleaseOrderResolver = {
|
|
8
9
|
async autoAddReleaseOrder(_: void, { warehouseId }: { warehouseId: string }, context: any): Promise<void> {
|
|
@@ -24,16 +25,79 @@ export const autoAddReleaseOrderResolver = {
|
|
|
24
25
|
|
|
25
26
|
var warehouseDomain: Domain = await getRepository(Domain).findOne({ where: { subdomain: centerId } })
|
|
26
27
|
var customerBizplaces: Bizplace[] = await getCustomerBizplaces(warehouseDomain)
|
|
27
|
-
|
|
28
|
+
const customerBizplaceId: string = customerBizplaces.find(
|
|
29
|
+
customerBizplace => customerBizplace.company.domain.id === domain.id
|
|
30
|
+
).id
|
|
28
31
|
|
|
29
32
|
for (var i = 0; i < marketplaceOrders.length; i++) {
|
|
30
33
|
const marketplaceOrder = marketplaceOrders[i]
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
marketplaceOrder
|
|
35
|
+
const marketplaceOrderShippings: MarketplaceOrderShipping[] = await getRepository(MarketplaceOrderShipping).find({
|
|
36
|
+
where: { orderNoRef: marketplaceOrder.orderNo, domain }
|
|
35
37
|
})
|
|
36
38
|
|
|
39
|
+
for (var j = 0; j < marketplaceOrderShippings.length; j++) {
|
|
40
|
+
const marketplaceOrderShipping: MarketplaceOrderShipping = marketplaceOrderShippings[j]
|
|
41
|
+
|
|
42
|
+
const date: Date = new Date()
|
|
43
|
+
const releaseDate = `${date.getFullYear()}-${(date.getMonth() + 1)
|
|
44
|
+
.toString()
|
|
45
|
+
.padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`
|
|
46
|
+
|
|
47
|
+
const newMarketplaceOrder: any = {
|
|
48
|
+
releaseDate,
|
|
49
|
+
type: 'b2c',
|
|
50
|
+
transporter: marketplaceOrder.shippingProvider,
|
|
51
|
+
trackingNo: marketplaceOrderShipping?.ownTrackingNo
|
|
52
|
+
? marketplaceOrderShipping.ownTrackingNo
|
|
53
|
+
: marketplaceOrderShipping.trackingNo,
|
|
54
|
+
packingOption: true,
|
|
55
|
+
exportOption: false,
|
|
56
|
+
ownTransport: true,
|
|
57
|
+
courierOption: true,
|
|
58
|
+
collectionOrderNo: marketplaceOrder.orderNo,
|
|
59
|
+
refNo: marketplaceOrder.orderNo,
|
|
60
|
+
refNo2: marketplaceOrder.orderNo + ' - ' + (j + 1) + '/' + marketplaceOrderShippings.length,
|
|
61
|
+
deliverTo: {
|
|
62
|
+
deliveryAddress1: marketplaceOrderShipping.address1,
|
|
63
|
+
deliveryAddress2: marketplaceOrderShipping.address2,
|
|
64
|
+
deliveryAddress3: marketplaceOrderShipping.address3,
|
|
65
|
+
deliveryAddress4: marketplaceOrderShipping.address4,
|
|
66
|
+
deliveryAddress5: marketplaceOrderShipping.address5,
|
|
67
|
+
attentionTo: marketplaceOrderShipping.attentionTo,
|
|
68
|
+
city: marketplaceOrderShipping.city,
|
|
69
|
+
postalCode: marketplaceOrderShipping.postCode,
|
|
70
|
+
country: marketplaceOrderShipping.country,
|
|
71
|
+
state: marketplaceOrderShipping.state,
|
|
72
|
+
phone1: marketplaceOrderShipping.phone1,
|
|
73
|
+
phone2: marketplaceOrderShipping?.phone2 ? marketplaceOrderShipping.phone2 : null
|
|
74
|
+
},
|
|
75
|
+
marketplaceOrderStatus: marketplaceOrder.status,
|
|
76
|
+
airwayBill: marketplaceOrderShipping?.airwayBill ? marketplaceOrderShipping.airwayBill : null,
|
|
77
|
+
invoice: marketplaceOrderShipping?.invoice ? marketplaceOrderShipping.invoice : null,
|
|
78
|
+
orderInventories: marketplaceOrder.marketplaceOrderItems
|
|
79
|
+
.filter(item => {
|
|
80
|
+
if (item.marketplaceOrderShipping.id === marketplaceOrderShipping.id) {
|
|
81
|
+
return item
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
.map((orderItem: any) => {
|
|
85
|
+
const { marketplaceProductVariation: productVariation }: any = orderItem
|
|
86
|
+
return {
|
|
87
|
+
product: {
|
|
88
|
+
sku: productVariation.sku
|
|
89
|
+
},
|
|
90
|
+
releaseQty: orderItem.qty
|
|
91
|
+
}
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
var releaseOrder: any = await FulfillmentAPI.createOutboundOrder(fulfilmentCenter, {
|
|
96
|
+
customerBizplaceId,
|
|
97
|
+
releaseOrder: newMarketplaceOrder
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
|
|
37
101
|
marketplaceOrder.releaseOrderId = releaseOrder.id
|
|
38
102
|
marketplaceOrder.fulfillmentCenter = fulfilmentCenter
|
|
39
103
|
await getRepository(MarketplaceOrder).save(marketplaceOrder)
|