@things-factory/operato-hub 4.0.22 → 4.0.23
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 +4 -0
- package/package.json +54 -54
- package/dist-server/routers/api/restful-apis/unstable/add-product.js +0 -85
- package/dist-server/routers/api/restful-apis/unstable/add-product.js.map +0 -1
- package/dist-server/routers/api/restful-apis/unstable/add-replenishment-order.js +0 -98
- package/dist-server/routers/api/restful-apis/unstable/add-replenishment-order.js.map +0 -1
- package/dist-server/routers/api/restful-apis/unstable/add-transfer-order.js +0 -77
- package/dist-server/routers/api/restful-apis/unstable/add-transfer-order.js.map +0 -1
- package/dist-server/routers/api/restful-apis/unstable/application.js +0 -28
- package/dist-server/routers/api/restful-apis/unstable/application.js.map +0 -1
- package/dist-server/routers/api/restful-apis/unstable/cancel-replenishment-order.js +0 -67
- package/dist-server/routers/api/restful-apis/unstable/cancel-replenishment-order.js.map +0 -1
- package/dist-server/routers/api/restful-apis/unstable/cancel-transfer-order.js +0 -70
- package/dist-server/routers/api/restful-apis/unstable/cancel-transfer-order.js.map +0 -1
- package/dist-server/routers/api/restful-apis/unstable/confirm-inbound-order.js +0 -98
- package/dist-server/routers/api/restful-apis/unstable/confirm-inbound-order.js.map +0 -1
- package/dist-server/routers/api/restful-apis/unstable/delete-inbound-order.js +0 -37
- package/dist-server/routers/api/restful-apis/unstable/delete-inbound-order.js.map +0 -1
- package/dist-server/routers/api/restful-apis/unstable/generate-inbound-order.js +0 -206
- package/dist-server/routers/api/restful-apis/unstable/generate-inbound-order.js.map +0 -1
- package/dist-server/routers/api/restful-apis/unstable/get-product-detail.js +0 -78
- package/dist-server/routers/api/restful-apis/unstable/get-product-detail.js.map +0 -1
- package/dist-server/routers/api/restful-apis/unstable/get-product-list.js +0 -114
- package/dist-server/routers/api/restful-apis/unstable/get-product-list.js.map +0 -1
- package/dist-server/routers/api/restful-apis/unstable/get-transfer-order-detail.js +0 -58
- package/dist-server/routers/api/restful-apis/unstable/get-transfer-order-detail.js.map +0 -1
- package/dist-server/routers/api/restful-apis/unstable/get-transfer-order-list.js +0 -124
- package/dist-server/routers/api/restful-apis/unstable/get-transfer-order-list.js.map +0 -1
- package/dist-server/routers/api/restful-apis/unstable/update-replenishment-order-product.js +0 -76
- package/dist-server/routers/api/restful-apis/unstable/update-replenishment-order-product.js.map +0 -1
- package/dist-server/routers/api/restful-apis/unstable/update-replenishment-order-status.js +0 -73
- package/dist-server/routers/api/restful-apis/unstable/update-replenishment-order-status.js.map +0 -1
- package/dist-server/routers/api/restful-apis/unstable/update-transfer-order-status.js +0 -76
- package/dist-server/routers/api/restful-apis/unstable/update-transfer-order-status.js.map +0 -1
- package/dist-server/routers/api/restful-apis/unstable/utils/api-error-message.js +0 -13
- package/dist-server/routers/api/restful-apis/unstable/utils/api-error-message.js.map +0 -1
- package/dist-server/routers/api/restful-apis/unstable/utils/index.js +0 -14
- package/dist-server/routers/api/restful-apis/unstable/utils/index.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/application.js +0 -28
- package/dist-server/routers/api/restful-apis/v1/application.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v1/order.js +0 -28
- package/dist-server/routers/api/restful-apis/v1/order.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v2/application.js +0 -28
- package/dist-server/routers/api/restful-apis/v2/application.js.map +0 -1
- package/dist-server/routers/api/restful-apis/v2/order.js +0 -28
- package/dist-server/routers/api/restful-apis/v2/order.js.map +0 -1
package/client/bootstrap.js
CHANGED
|
@@ -5,6 +5,7 @@ import './menu'
|
|
|
5
5
|
|
|
6
6
|
import { html } from 'lit-element'
|
|
7
7
|
|
|
8
|
+
import { registerDefaultGroups } from '@operato/board/dist/src/component/register-default-groups'
|
|
8
9
|
import { APPEND_APP_TOOL } from '@things-factory/apptool-base'
|
|
9
10
|
import { auth } from '@things-factory/auth-base'
|
|
10
11
|
import { appendViewpart, toggleOverlay, TOOL_POSITION, VIEWPART_POSITION } from '@things-factory/layout-base'
|
|
@@ -32,6 +33,9 @@ export default function bootstrap() {
|
|
|
32
33
|
/* initialize reducers */
|
|
33
34
|
store.addReducers({ hub })
|
|
34
35
|
|
|
36
|
+
/* set board-modeller group and default templates */
|
|
37
|
+
registerDefaultGroups()
|
|
38
|
+
|
|
35
39
|
setupMenuPart({
|
|
36
40
|
slotTemplate: html` <domain-switch slot="head"></domain-switch> `
|
|
37
41
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/operato-hub",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.23",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -54,67 +54,67 @@
|
|
|
54
54
|
"@operato/scene-tab": "^0.0.22",
|
|
55
55
|
"@operato/scene-table": "^0.0.22",
|
|
56
56
|
"@operato/scene-wheel-sorter": "^0.0.22",
|
|
57
|
-
"@things-factory/api": "^4.0.
|
|
58
|
-
"@things-factory/apptool-ui": "^4.0.
|
|
59
|
-
"@things-factory/attachment-base": "^4.0.
|
|
60
|
-
"@things-factory/auth-base": "^4.0.
|
|
61
|
-
"@things-factory/auth-ui": "^4.0.
|
|
62
|
-
"@things-factory/biz-base": "^4.0.
|
|
63
|
-
"@things-factory/biz-ui": "^4.0.
|
|
64
|
-
"@things-factory/board-service": "^4.0.
|
|
65
|
-
"@things-factory/board-ui": "^4.0.
|
|
66
|
-
"@things-factory/code-ui": "^4.0.
|
|
67
|
-
"@things-factory/component-ui": "^4.0.
|
|
68
|
-
"@things-factory/context-ui": "^4.0.
|
|
69
|
-
"@things-factory/document-template-ui": "^4.0.
|
|
70
|
-
"@things-factory/export-ui": "^4.0.
|
|
71
|
-
"@things-factory/export-ui-csv": "^4.0.
|
|
72
|
-
"@things-factory/export-ui-excel": "^4.0.
|
|
73
|
-
"@things-factory/grist-ui": "^4.0.
|
|
74
|
-
"@things-factory/i18n-base": "^4.0.
|
|
75
|
-
"@things-factory/i18n-ui": "^4.0.
|
|
76
|
-
"@things-factory/import-ui": "^4.0.
|
|
77
|
-
"@things-factory/import-ui-excel": "^4.0.
|
|
78
|
-
"@things-factory/integration-accounting": "^4.0.
|
|
79
|
-
"@things-factory/integration-fulfillment": "^4.0.
|
|
80
|
-
"@things-factory/integration-lmd": "^4.0.
|
|
81
|
-
"@things-factory/integration-marketplace": "^4.0.
|
|
82
|
-
"@things-factory/integration-pos": "^4.0.
|
|
83
|
-
"@things-factory/integration-sellercraft": "^4.0.
|
|
84
|
-
"@things-factory/lite-menu": "^4.0.
|
|
85
|
-
"@things-factory/more-ui": "^4.0.
|
|
86
|
-
"@things-factory/notification": "^4.0.
|
|
87
|
-
"@things-factory/pdf": "^4.0.
|
|
88
|
-
"@things-factory/product-ui": "^4.0.
|
|
89
|
-
"@things-factory/resource-ui": "^4.0.
|
|
90
|
-
"@things-factory/sales-base": "^4.0.
|
|
91
|
-
"@things-factory/scene-data-transform": "^4.0.
|
|
92
|
-
"@things-factory/scene-excel": "^4.0.
|
|
93
|
-
"@things-factory/scene-firebase": "^4.0.
|
|
94
|
-
"@things-factory/scene-form": "^4.0.
|
|
95
|
-
"@things-factory/scene-google-map": "^4.0.
|
|
96
|
-
"@things-factory/scene-graphql": "^4.0.
|
|
57
|
+
"@things-factory/api": "^4.0.23",
|
|
58
|
+
"@things-factory/apptool-ui": "^4.0.23",
|
|
59
|
+
"@things-factory/attachment-base": "^4.0.23",
|
|
60
|
+
"@things-factory/auth-base": "^4.0.23",
|
|
61
|
+
"@things-factory/auth-ui": "^4.0.23",
|
|
62
|
+
"@things-factory/biz-base": "^4.0.23",
|
|
63
|
+
"@things-factory/biz-ui": "^4.0.23",
|
|
64
|
+
"@things-factory/board-service": "^4.0.23",
|
|
65
|
+
"@things-factory/board-ui": "^4.0.23",
|
|
66
|
+
"@things-factory/code-ui": "^4.0.23",
|
|
67
|
+
"@things-factory/component-ui": "^4.0.23",
|
|
68
|
+
"@things-factory/context-ui": "^4.0.23",
|
|
69
|
+
"@things-factory/document-template-ui": "^4.0.23",
|
|
70
|
+
"@things-factory/export-ui": "^4.0.23",
|
|
71
|
+
"@things-factory/export-ui-csv": "^4.0.23",
|
|
72
|
+
"@things-factory/export-ui-excel": "^4.0.23",
|
|
73
|
+
"@things-factory/grist-ui": "^4.0.23",
|
|
74
|
+
"@things-factory/i18n-base": "^4.0.23",
|
|
75
|
+
"@things-factory/i18n-ui": "^4.0.23",
|
|
76
|
+
"@things-factory/import-ui": "^4.0.23",
|
|
77
|
+
"@things-factory/import-ui-excel": "^4.0.23",
|
|
78
|
+
"@things-factory/integration-accounting": "^4.0.23",
|
|
79
|
+
"@things-factory/integration-fulfillment": "^4.0.23",
|
|
80
|
+
"@things-factory/integration-lmd": "^4.0.23",
|
|
81
|
+
"@things-factory/integration-marketplace": "^4.0.23",
|
|
82
|
+
"@things-factory/integration-pos": "^4.0.23",
|
|
83
|
+
"@things-factory/integration-sellercraft": "^4.0.23",
|
|
84
|
+
"@things-factory/lite-menu": "^4.0.23",
|
|
85
|
+
"@things-factory/more-ui": "^4.0.23",
|
|
86
|
+
"@things-factory/notification": "^4.0.23",
|
|
87
|
+
"@things-factory/pdf": "^4.0.23",
|
|
88
|
+
"@things-factory/product-ui": "^4.0.23",
|
|
89
|
+
"@things-factory/resource-ui": "^4.0.23",
|
|
90
|
+
"@things-factory/sales-base": "^4.0.23",
|
|
91
|
+
"@things-factory/scene-data-transform": "^4.0.23",
|
|
92
|
+
"@things-factory/scene-excel": "^4.0.23",
|
|
93
|
+
"@things-factory/scene-firebase": "^4.0.23",
|
|
94
|
+
"@things-factory/scene-form": "^4.0.23",
|
|
95
|
+
"@things-factory/scene-google-map": "^4.0.23",
|
|
96
|
+
"@things-factory/scene-graphql": "^4.0.23",
|
|
97
97
|
"@things-factory/scene-half-roundrect": "^4.0.9",
|
|
98
|
-
"@things-factory/scene-label": "^4.0.
|
|
99
|
-
"@things-factory/scene-marker": "^4.0.
|
|
100
|
-
"@things-factory/scene-mqtt": "^4.0.
|
|
101
|
-
"@things-factory/scene-news-ticker": "^4.0.
|
|
102
|
-
"@things-factory/scene-restful": "^4.0.
|
|
103
|
-
"@things-factory/scene-visualizer": "^4.0.
|
|
104
|
-
"@things-factory/setting-ui": "^4.0.
|
|
105
|
-
"@things-factory/shell": "^4.0.
|
|
106
|
-
"@things-factory/system-ui": "^4.0.
|
|
107
|
-
"@things-factory/warehouse-base": "^4.0.
|
|
108
|
-
"@things-factory/worksheet-base": "^4.0.
|
|
98
|
+
"@things-factory/scene-label": "^4.0.23",
|
|
99
|
+
"@things-factory/scene-marker": "^4.0.23",
|
|
100
|
+
"@things-factory/scene-mqtt": "^4.0.23",
|
|
101
|
+
"@things-factory/scene-news-ticker": "^4.0.23",
|
|
102
|
+
"@things-factory/scene-restful": "^4.0.23",
|
|
103
|
+
"@things-factory/scene-visualizer": "^4.0.23",
|
|
104
|
+
"@things-factory/setting-ui": "^4.0.23",
|
|
105
|
+
"@things-factory/shell": "^4.0.23",
|
|
106
|
+
"@things-factory/system-ui": "^4.0.23",
|
|
107
|
+
"@things-factory/warehouse-base": "^4.0.23",
|
|
108
|
+
"@things-factory/worksheet-base": "^4.0.23",
|
|
109
109
|
"koa2-swagger-ui": "^5.0.2",
|
|
110
110
|
"swagger-jsdoc": "^5.0.0",
|
|
111
111
|
"yamljs": "^0.3.0"
|
|
112
112
|
},
|
|
113
113
|
"devDependencies": {
|
|
114
|
-
"@things-factory/builder": "^4.0.
|
|
114
|
+
"@things-factory/builder": "^4.0.23"
|
|
115
115
|
},
|
|
116
116
|
"resolutions": {
|
|
117
117
|
"core-js": "^3.16.0"
|
|
118
118
|
},
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "49ba662dea1d349e9608a9a58c8fcfbc1310a5d6"
|
|
120
120
|
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.checkMandatoryKey = void 0;
|
|
7
|
-
const utils_1 = require("./utils");
|
|
8
|
-
const api_1 = require("@things-factory/api");
|
|
9
|
-
const warehouse_middleware_1 = require("../../../../middlewares/warehouse-middleware");
|
|
10
|
-
const business_middleware_1 = require("../../../../middlewares/business-middleware");
|
|
11
|
-
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
12
|
-
const debug = require('debug')('things-factory:operato-hub:restful-api:unstable:add-product');
|
|
13
|
-
api_1.restfulApiRouter.post('/unstable/warehouse/:warehouseId/add-product', business_middleware_1.businessMiddleware, warehouse_middleware_1.warehouseMiddleware, async (context, next) => {
|
|
14
|
-
const { client, warehouse: bizplace, domain } = context.state;
|
|
15
|
-
const { warehouseId } = context.params;
|
|
16
|
-
let bodyReq = context.request.body;
|
|
17
|
-
if (!warehouseId)
|
|
18
|
-
throw new Error(utils_1.ERROR_MSG.REQUEST.BAD_REQUEST('warehouseId'));
|
|
19
|
-
if (typeof bodyReq === undefined || Object.keys(bodyReq).length === 0) {
|
|
20
|
-
throw new Error(utils_1.ERROR_MSG.REQUEST.BAD_REQUEST('bodyReq'));
|
|
21
|
-
}
|
|
22
|
-
await checkMandatoryKey(bodyReq);
|
|
23
|
-
debug('post:/add-product request.body', context.request.body);
|
|
24
|
-
const patches = bodyReq.map(patch => {
|
|
25
|
-
return Object.assign(Object.assign({}, patch), { cuFlag: '+' });
|
|
26
|
-
});
|
|
27
|
-
context.body = {
|
|
28
|
-
result: (await client.query({
|
|
29
|
-
query: graphql_tag_1.default `
|
|
30
|
-
mutation($patches: [ProductPatch]!) {
|
|
31
|
-
updateMultipleProduct(patches: $patches) {
|
|
32
|
-
sku
|
|
33
|
-
name
|
|
34
|
-
description
|
|
35
|
-
productRef {
|
|
36
|
-
name
|
|
37
|
-
description
|
|
38
|
-
}
|
|
39
|
-
childProducts {
|
|
40
|
-
name
|
|
41
|
-
description
|
|
42
|
-
}
|
|
43
|
-
bundleQty
|
|
44
|
-
packingType
|
|
45
|
-
type
|
|
46
|
-
expirationPeriod
|
|
47
|
-
weightUnit
|
|
48
|
-
weight
|
|
49
|
-
density
|
|
50
|
-
lengthUnit
|
|
51
|
-
width
|
|
52
|
-
depth
|
|
53
|
-
height
|
|
54
|
-
auxUnit1
|
|
55
|
-
auxValue1
|
|
56
|
-
auxUnit2
|
|
57
|
-
auxValue2
|
|
58
|
-
auxUnit3
|
|
59
|
-
auxValue3
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
`,
|
|
63
|
-
variables: { patches },
|
|
64
|
-
context: Object.assign(Object.assign({}, context), { state: Object.assign(Object.assign({}, context.state), { bizplace,
|
|
65
|
-
domain }) })
|
|
66
|
-
})).data
|
|
67
|
-
};
|
|
68
|
-
});
|
|
69
|
-
async function checkMandatoryKey(params) {
|
|
70
|
-
params.forEach((param, key) => {
|
|
71
|
-
let noparams = [];
|
|
72
|
-
if (!param.sku)
|
|
73
|
-
noparams.push('sku');
|
|
74
|
-
if (!param.name)
|
|
75
|
-
noparams.push('name');
|
|
76
|
-
if (!param.packingType)
|
|
77
|
-
noparams.push('packingType');
|
|
78
|
-
if (!param.type)
|
|
79
|
-
noparams.push('type');
|
|
80
|
-
if (noparams.length > 0)
|
|
81
|
-
throw new Error(`required parameters ${noparams.join(', ')} at element ${key} is missing`);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
exports.checkMandatoryKey = checkMandatoryKey;
|
|
85
|
-
//# sourceMappingURL=add-product.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-product.js","sourceRoot":"","sources":["../../../../../server/routers/api/restful-apis/unstable/add-product.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAmC;AACnC,6CAAgE;AAChE,uFAAkF;AAClF,qFAAgF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AAK,kCACA,OAAO,CAAC,KAAK,KAChB,QAAQ;oBACR,MAAM,MAET;SACK,CAAC,CACV,CAAC,IAAI;KACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEK,KAAK,UAAU,iBAAiB,CAAC,MAAM;IAC5C,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QAC5B,IAAI,QAAQ,GAAG,EAAE,CAAA;QAEjB,IAAI,CAAC,KAAK,CAAC,GAAG;YAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAEpC,IAAI,CAAC,KAAK,CAAC,IAAI;YAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAEtC,IAAI,CAAC,KAAK,CAAC,WAAW;YAAE,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;QAEpD,IAAI,CAAC,KAAK,CAAC,IAAI;YAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAEtC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,GAAG,aAAa,CAAC,CAAA;IACrH,CAAC,CAAC,CAAA;AACJ,CAAC;AAdD,8CAcC"}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.checkMandatoryKey = void 0;
|
|
7
|
-
const utils_1 = require("./utils");
|
|
8
|
-
const typeorm_1 = require("typeorm");
|
|
9
|
-
const utils_2 = require("@things-factory/utils");
|
|
10
|
-
const product_base_1 = require("@things-factory/product-base");
|
|
11
|
-
const api_1 = require("@things-factory/api");
|
|
12
|
-
const warehouse_middleware_1 = require("../../../../middlewares/warehouse-middleware");
|
|
13
|
-
const business_middleware_1 = require("../../../../middlewares/business-middleware");
|
|
14
|
-
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
15
|
-
const debug = require('debug')('things-factory:operato-hub:restful-api:unstable:add-replenishment-order');
|
|
16
|
-
api_1.restfulApiRouter.post('/unstable/warehouse/:warehouseId/add-replenishment-order', business_middleware_1.businessMiddleware, warehouse_middleware_1.warehouseMiddleware, async (context, next) => {
|
|
17
|
-
const { client, warehouse: bizplace, domain } = context.state;
|
|
18
|
-
const { warehouseId } = context.params;
|
|
19
|
-
const attachments = undefined;
|
|
20
|
-
let bodyReq = context.request.body;
|
|
21
|
-
if (!warehouseId)
|
|
22
|
-
throw new Error(utils_1.ERROR_MSG.REQUEST.BAD_REQUEST('warehouseId'));
|
|
23
|
-
if (typeof bodyReq === undefined || Object.keys(bodyReq).length === 0) {
|
|
24
|
-
throw new Error(utils_1.ERROR_MSG.REQUEST.BAD_REQUEST('bodyReq'));
|
|
25
|
-
}
|
|
26
|
-
await checkMandatoryKey(bodyReq);
|
|
27
|
-
debug('post:/add-replenishment-order request.body', context.request.body);
|
|
28
|
-
//#1 to get all product list
|
|
29
|
-
const products = await typeorm_1.getRepository(product_base_1.Product).find({
|
|
30
|
-
where: {
|
|
31
|
-
bizplace: warehouseId,
|
|
32
|
-
sku: typeorm_1.In(bodyReq.orderProducts.map(orderProduct => orderProduct.product.sku))
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
//#2 assign product id found to order product
|
|
36
|
-
bodyReq.orderProducts = bodyReq.orderProducts.map(orderProduct => {
|
|
37
|
-
products.forEach(product => {
|
|
38
|
-
if (orderProduct.product.sku === product.sku) {
|
|
39
|
-
orderProduct.product.id = product.id;
|
|
40
|
-
orderProduct.packingType = product.packingType;
|
|
41
|
-
orderProduct.uom = product.primaryUnit;
|
|
42
|
-
orderProduct.uomValue = product.primaryValue;
|
|
43
|
-
orderProduct.totalUomValue = `${(orderProduct.uomValue * orderProduct.packQty).toFixed(2)} ${orderProduct.uom}`;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
return orderProduct;
|
|
47
|
-
});
|
|
48
|
-
//#3 check if product is not found
|
|
49
|
-
bodyReq.orderProducts.forEach(orderProduct => {
|
|
50
|
-
if (!orderProduct.product.id)
|
|
51
|
-
throw new Error(`SKU '${orderProduct.product.sku}' is not exist`);
|
|
52
|
-
});
|
|
53
|
-
const args = {
|
|
54
|
-
retailReplenishmentOrder: Object.assign(Object.assign({}, bodyReq), { warehouseId })
|
|
55
|
-
};
|
|
56
|
-
context.body = {
|
|
57
|
-
result: (await client.query({
|
|
58
|
-
query: graphql_tag_1.default `
|
|
59
|
-
mutation {
|
|
60
|
-
createRetailReplenishmentOrder(${utils_2.gqlBuilder.buildArgs(args)}) {
|
|
61
|
-
name
|
|
62
|
-
bizplace {
|
|
63
|
-
name
|
|
64
|
-
}
|
|
65
|
-
issuedDate
|
|
66
|
-
refNo
|
|
67
|
-
remark
|
|
68
|
-
orderProducts {
|
|
69
|
-
product {
|
|
70
|
-
sku
|
|
71
|
-
name
|
|
72
|
-
}
|
|
73
|
-
batchId
|
|
74
|
-
packQty
|
|
75
|
-
status
|
|
76
|
-
}
|
|
77
|
-
status
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
`,
|
|
81
|
-
variables: {},
|
|
82
|
-
context: Object.assign(Object.assign({}, context), { state: Object.assign(Object.assign({}, context.state), { bizplace,
|
|
83
|
-
domain }) })
|
|
84
|
-
})).data
|
|
85
|
-
};
|
|
86
|
-
});
|
|
87
|
-
async function checkMandatoryKey(params) {
|
|
88
|
-
var noparams = ['issuedDate', 'refNo', 'orderProducts'].filter(param => !(param in params));
|
|
89
|
-
if ('orderProducts' in params) {
|
|
90
|
-
if (params.orderProducts.filter(record => !record.product || !record.packQty).length)
|
|
91
|
-
noparams.push('orderProducts');
|
|
92
|
-
}
|
|
93
|
-
if (noparams.length > 0) {
|
|
94
|
-
throw new Error(utils_1.ERROR_MSG.REQUEST.REQUIRED_PARAMS(noparams.join(', ')));
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
exports.checkMandatoryKey = checkMandatoryKey;
|
|
98
|
-
//# sourceMappingURL=add-replenishment-order.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-replenishment-order.js","sourceRoot":"","sources":["../../../../../server/routers/api/restful-apis/unstable/add-replenishment-order.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAmC;AACnC,qCAA2C;AAC3C,iDAAkD;AAClD,+DAAsD;AACtD,6CAAgE;AAChE,uFAAkF;AAClF,qFAAgF;AAChF,8DAA6B;AAE7B,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,yEAAyE,CAAC,CAAA;AAEzG,sBAAM,CAAC,IAAI,CAAC,0DAA0D,EAAE,wCAAkB,EAAE,0CAAmB,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACvI,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAC7D,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,MAAM,CAAA;IACtC,MAAM,WAAW,GAAG,SAAS,CAAA;IAC7B,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAA;IAElC,IAAI,CAAC,WAAW;QAAE,MAAM,IAAI,KAAK,CAAC,iBAAS,CAAC,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAA;IAE/E,IAAI,OAAO,OAAO,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;QACrE,MAAM,IAAI,KAAK,CAAC,iBAAS,CAAC,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAA;KAC1D;IAED,MAAM,iBAAiB,CAAC,OAAO,CAAC,CA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(mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.checkMandatoryKey = void 0;
|
|
7
|
-
const utils_1 = require("./utils");
|
|
8
|
-
const utils_2 = require("@things-factory/utils");
|
|
9
|
-
const api_1 = require("@things-factory/api");
|
|
10
|
-
const warehouse_middleware_1 = require("../../../../middlewares/warehouse-middleware");
|
|
11
|
-
const business_middleware_1 = require("../../../../middlewares/business-middleware");
|
|
12
|
-
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
13
|
-
const debug = require('debug')('things-factory:operato-hub:restful-api:unstable:add-transfer-order');
|
|
14
|
-
api_1.restfulApiRouter.post('/unstable/warehouse/:warehouseId/add-transfer-order', business_middleware_1.businessMiddleware, warehouse_middleware_1.warehouseMiddleware, async (context, next) => {
|
|
15
|
-
const { client, warehouse: bizplace, domain } = context.state;
|
|
16
|
-
const { warehouseId } = context.params;
|
|
17
|
-
const attachments = undefined;
|
|
18
|
-
let bodyReq = context.request.body;
|
|
19
|
-
if (!warehouseId)
|
|
20
|
-
throw new Error(utils_1.ERROR_MSG.REQUEST.BAD_REQUEST('warehouseId'));
|
|
21
|
-
if (typeof bodyReq === undefined || Object.keys(bodyReq).length === 0) {
|
|
22
|
-
throw new Error(utils_1.ERROR_MSG.REQUEST.BAD_REQUEST('bodyReq'));
|
|
23
|
-
}
|
|
24
|
-
await checkMandatoryKey(bodyReq);
|
|
25
|
-
debug('post:/add-transfer-order request.body', context.request.body);
|
|
26
|
-
const args = {
|
|
27
|
-
transferOrder: Object.assign(Object.assign({}, bodyReq), { warehouseId })
|
|
28
|
-
};
|
|
29
|
-
context.body = {
|
|
30
|
-
result: (await client.query({
|
|
31
|
-
query: graphql_tag_1.default `
|
|
32
|
-
mutation {
|
|
33
|
-
createTransferOrder(${utils_2.gqlBuilder.buildArgs(args)}) {
|
|
34
|
-
name
|
|
35
|
-
bizplace {
|
|
36
|
-
name
|
|
37
|
-
}
|
|
38
|
-
issuedDate
|
|
39
|
-
refNo
|
|
40
|
-
remark
|
|
41
|
-
orderInventories {
|
|
42
|
-
inventory {
|
|
43
|
-
palletId
|
|
44
|
-
name
|
|
45
|
-
}
|
|
46
|
-
product {
|
|
47
|
-
sku
|
|
48
|
-
name
|
|
49
|
-
description
|
|
50
|
-
}
|
|
51
|
-
batchId
|
|
52
|
-
releaseQty
|
|
53
|
-
remark
|
|
54
|
-
status
|
|
55
|
-
}
|
|
56
|
-
status
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
`,
|
|
60
|
-
variables: {},
|
|
61
|
-
context: Object.assign(Object.assign({}, context), { state: Object.assign(Object.assign({}, context.state), { bizplace,
|
|
62
|
-
domain }) })
|
|
63
|
-
})).data
|
|
64
|
-
};
|
|
65
|
-
});
|
|
66
|
-
function checkMandatoryKey(params) {
|
|
67
|
-
var noparams = ['issuedDate', 'refNo', 'orderInventories', 'type', 'ownTransport'].filter(param => !(param in params));
|
|
68
|
-
if ('orderInventories' in params) {
|
|
69
|
-
if (params.orderInventories.filter(record => !record.batchId || !record.batchExp || !record.releaseQty || !record.remark).length)
|
|
70
|
-
noparams.push('orderInventories');
|
|
71
|
-
}
|
|
72
|
-
if (noparams.length > 0) {
|
|
73
|
-
throw new Error(utils_1.ERROR_MSG.REQUEST.REQUIRED_PARAMS(noparams.join(', ')));
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.checkMandatoryKey = checkMandatoryKey;
|
|
77
|
-
//# sourceMappingURL=add-transfer-order.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-transfer-order.js","sourceRoot":"","sources":["../../../../../server/routers/api/restful-apis/unstable/add-transfer-order.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAmC;AACnC,iDAAkD;AAClD,6CAAgE;AAChE,uFAAkF;AAClF,qFAAgF;AAChF,8DAA6B;AAE7B,MAAM,KAAK,GAA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Q;oBACR,MAAM,MAET;SACK,CAAC,CACV,CAAC,IAAI;KACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,SAAgB,iBAAiB,CAAC,MAAM;IACtC,IAAI,QAAQ,GAAG,CAAC,YAAY,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,CAAC,CAAA;IAEtH,IAAI,kBAAkB,IAAI,MAAM,EAAE;QAChC,IACE,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAC5B,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,MAAM,CAAC,MAAM,CACtF,CAAC,MAAM;YAER,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;KACpC;IAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;QACvB,MAAM,IAAI,KAAK,CAAC,iBAAS,CAAC,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;KACxE;AACH,CAAC;AAfD,8CAeC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
7
|
-
const api_1 = require("@things-factory/api");
|
|
8
|
-
api_1.restfulApiRouter.get('/unstable/appBindings', async (context, next) => {
|
|
9
|
-
const { client } = context.state;
|
|
10
|
-
context.body = {
|
|
11
|
-
result: (await client.query({
|
|
12
|
-
query: graphql_tag_1.default `
|
|
13
|
-
query {
|
|
14
|
-
appBindings {
|
|
15
|
-
items {
|
|
16
|
-
name
|
|
17
|
-
status
|
|
18
|
-
}
|
|
19
|
-
total
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
`,
|
|
23
|
-
variables: {},
|
|
24
|
-
context
|
|
25
|
-
})).data
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
|
-
//# sourceMappingURL=application.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../../../../server/routers/api/restful-apis/unstable/application.ts"],"names":[],"mappings":";;;;;AAAA,8DAA6B;AAC7B,6CAAgE;AAEhE,sBAAM,CAAC,GAAG,CAAC,uBAAuB,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IAC1D,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAEhC,OAAO,CAAC,IAAI,GAAG;QACb,MAAM,EAAE,CACN,MAAM,MAAM,CAAC,KAAK,CAAC;YACjB,KAAK,EAAE,qBAAG,CAAA;;;;;;;;;;SAUT;YACD,SAAS,EAAE,EAAE;YACb,OAAO;SACD,CAAC,CACV,CAAC,IAAI;KACP,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.checkMandatoryKey = void 0;
|
|
7
|
-
const utils_1 = require("@things-factory/utils");
|
|
8
|
-
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
9
|
-
const api_1 = require("@things-factory/api");
|
|
10
|
-
const warehouse_middleware_1 = require("../../../../middlewares/warehouse-middleware");
|
|
11
|
-
const business_middleware_1 = require("../../../../middlewares/business-middleware");
|
|
12
|
-
const sales_base_1 = require("@things-factory/sales-base");
|
|
13
|
-
const debug = require('debug')('things-factory:operato-hub:restful-api:unstable:cancel-replenishment-order');
|
|
14
|
-
api_1.restfulApiRouter.post('/unstable/warehouse/:warehouseId/cancel-replenishment-order', business_middleware_1.businessMiddleware, warehouse_middleware_1.warehouseMiddleware, async (context, next) => {
|
|
15
|
-
const { client, warehouse: bizplace, domain } = context.state;
|
|
16
|
-
const { warehouseId } = context.params;
|
|
17
|
-
const bodyReq = context.request.body;
|
|
18
|
-
if (typeof bodyReq === undefined || bodyReq.body === '') {
|
|
19
|
-
context.throw(400, context.t('text.no body'));
|
|
20
|
-
}
|
|
21
|
-
const convertedBodyReq = JSON.parse(bodyReq.body);
|
|
22
|
-
checkMandatoryKey(context, convertedBodyReq);
|
|
23
|
-
debug('post:/cancel-replenishment-order request.body', context.request.body);
|
|
24
|
-
const args = {
|
|
25
|
-
patch: Object.assign(Object.assign({}, convertedBodyReq), { warehouseId, status: sales_base_1.ORDER_STATUS.PENDING_CANCEL })
|
|
26
|
-
};
|
|
27
|
-
context.body = {
|
|
28
|
-
result: (await client.query({
|
|
29
|
-
query: graphql_tag_1.default `
|
|
30
|
-
mutation {
|
|
31
|
-
cancelRetailReplenishmentOrder(${utils_1.gqlBuilder.buildArgs(args)}) {
|
|
32
|
-
name
|
|
33
|
-
bizplace {
|
|
34
|
-
id
|
|
35
|
-
name
|
|
36
|
-
}
|
|
37
|
-
issuedDate
|
|
38
|
-
refNo
|
|
39
|
-
remark
|
|
40
|
-
orderProducts {
|
|
41
|
-
product {
|
|
42
|
-
sku
|
|
43
|
-
name
|
|
44
|
-
}
|
|
45
|
-
batchId
|
|
46
|
-
releaseQty
|
|
47
|
-
remark
|
|
48
|
-
status
|
|
49
|
-
}
|
|
50
|
-
status
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
`,
|
|
54
|
-
variables: {},
|
|
55
|
-
context: Object.assign(Object.assign({}, context), { state: Object.assign(Object.assign({}, context.state), { bizplace,
|
|
56
|
-
domain }) })
|
|
57
|
-
})).data
|
|
58
|
-
};
|
|
59
|
-
});
|
|
60
|
-
function checkMandatoryKey(context, params) {
|
|
61
|
-
var noparams = ['name', 'remark'].filter(param => !(param in params));
|
|
62
|
-
if (noparams.length > 0) {
|
|
63
|
-
context.throw(400, context.t('text.required parameters not found', { parameters: noparams.join(',') }));
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
exports.checkMandatoryKey = checkMandatoryKey;
|
|
67
|
-
//# sourceMappingURL=cancel-replenishment-order.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cancel-replenishment-order.js","sourceRoot":"","sources":["../../../../../server/routers/api/restful-apis/unstable/cancel-replenishment-order.ts"],"names":[],"mappings":";;;;;;AAAA,iDAAkD;AAClD,8DAA6B;AAC7B,6CAAgE;AAChE,uFAAkF;AAClF,qFAAgF;AAChF,2DAAyD;AAEzD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,4EAA4E,CAAC,CAAA;AAE5G,sBAAM,CAAC,IAAI,CACT,6DAA6D,EAC7D,wCAAkB,EAClB,0CAAmB,EACnB,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACtB,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAC7D,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,MAAM,CAAA;IAEtC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAA;IACpC,IAAI,OAAO,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,IAAI,KAAK,EAAE,EAAE;QACvD,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAA;KAC9C;IACD,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACjD,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAA;IAE5C,KAAK,CAAC,+CAA+C,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAE5E,MAAM,IAAI,GAAG;QACX,KAAK,kCACA,gBAAgB,KACnB,WAAW,EACX,MAAM,EAAE,yBAAY,CAAC,cAAc,GACpC;KACF,CAAA;IAED,OAAO,CAAC,IAAI,GAAG;QACb,MAAM,EAAE,CACN,MAAM,MAAM,CAAC,KAAK,CAAC;YACjB,KAAK,EAAE,qBAAG,CAAA;;6CAEyB,kBAAU,CAAC,SAAS,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;SAsB9D;YACC,SAAS,EAAE,EAAE;YACb,OAAO,kCACF,OAAO,KACV,KAAK,kCACA,OAAO,CAAC,KAAK,KAChB,QAAQ;oBACR,MAAM,MAET;SACK,CAAC,CACV,CAAC,IAAI;KACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,SAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM;IAC/C,IAAI,QAAQ,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,CAAC,CAAA;IAErE,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;QACvB,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,oCAAoC,EAAE,EAAE,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;KACxG;AACH,CAAC;AAND,8CAMC"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.checkMandatoryKey = void 0;
|
|
7
|
-
const utils_1 = require("@things-factory/utils");
|
|
8
|
-
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
9
|
-
const api_1 = require("@things-factory/api");
|
|
10
|
-
const warehouse_middleware_1 = require("../../../../middlewares/warehouse-middleware");
|
|
11
|
-
const business_middleware_1 = require("../../../../middlewares/business-middleware");
|
|
12
|
-
const sales_base_1 = require("@things-factory/sales-base");
|
|
13
|
-
const debug = require('debug')('things-factory:operato-hub:restful-api:unstable:cancel-transfer-order');
|
|
14
|
-
api_1.restfulApiRouter.post('/unstable/warehouse/:warehouseId/cancel-transfer-order', business_middleware_1.businessMiddleware, warehouse_middleware_1.warehouseMiddleware, async (context, next) => {
|
|
15
|
-
const { client, warehouse: bizplace, domain } = context.state;
|
|
16
|
-
const { warehouseId } = context.params;
|
|
17
|
-
const bodyReq = context.request.body;
|
|
18
|
-
if (typeof bodyReq === undefined || bodyReq.body === '') {
|
|
19
|
-
context.throw(400, context.t('text.no body'));
|
|
20
|
-
}
|
|
21
|
-
const convertedBodyReq = JSON.parse(bodyReq.body);
|
|
22
|
-
await checkMandatoryKey(context, convertedBodyReq);
|
|
23
|
-
debug('post:/cancel-transfer-order request.body', context.request.body);
|
|
24
|
-
const args = {
|
|
25
|
-
patch: Object.assign(Object.assign({}, convertedBodyReq), { warehouseId, status: sales_base_1.ORDER_STATUS.PENDING_CANCEL })
|
|
26
|
-
};
|
|
27
|
-
context.body = {
|
|
28
|
-
result: (await client.query({
|
|
29
|
-
query: graphql_tag_1.default `
|
|
30
|
-
mutation {
|
|
31
|
-
cancelTransferOrder(${utils_1.gqlBuilder.buildArgs(args)}) {
|
|
32
|
-
name
|
|
33
|
-
bizplace {
|
|
34
|
-
id
|
|
35
|
-
name
|
|
36
|
-
}
|
|
37
|
-
issuedDate
|
|
38
|
-
refNo
|
|
39
|
-
remark
|
|
40
|
-
orderInventories {
|
|
41
|
-
inventory {
|
|
42
|
-
palletId
|
|
43
|
-
}
|
|
44
|
-
product {
|
|
45
|
-
sku
|
|
46
|
-
name
|
|
47
|
-
}
|
|
48
|
-
batchId
|
|
49
|
-
releaseQty
|
|
50
|
-
remark
|
|
51
|
-
status
|
|
52
|
-
}
|
|
53
|
-
status
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
`,
|
|
57
|
-
variables: {},
|
|
58
|
-
context: Object.assign(Object.assign({}, context), { state: Object.assign(Object.assign({}, context.state), { bizplace,
|
|
59
|
-
domain }) })
|
|
60
|
-
})).data
|
|
61
|
-
};
|
|
62
|
-
});
|
|
63
|
-
function checkMandatoryKey(context, params) {
|
|
64
|
-
var noparams = ['name', 'remark'].filter(param => !(param in params));
|
|
65
|
-
if (noparams.length > 0) {
|
|
66
|
-
context.throw(400, context.t('text.required parameters not found', { parameters: noparams.join(',') }));
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.checkMandatoryKey = checkMandatoryKey;
|
|
70
|
-
//# sourceMappingURL=cancel-transfer-order.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cancel-transfer-order.js","sourceRoot":"","sources":["../../../../../server/routers/api/restful-apis/unstable/cancel-transfer-order.ts"],"names":[],"mappings":";;;;;;AAAA,iDAAkD;AAClD,8DAA6B;AAC7B,6CAAgE;AAChE,uFAAkF;AAClF,qFAAgF;AAChF,2DAAyD;AAGzD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,uEAAuE,CAAC,CAAA;AAEvG,sBAAM,CAAC,IAAI,CAAC,wDAAwD,EAAE,wCAAkB,EAAE,0CAAmB,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACrI,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAC7D,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,MAAM,CAAA;IAEtC,MAAM,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