@things-factory/operato-wms 4.3.60 → 4.3.63
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/pages/components/select-inventory-popup.js +626 -0
- package/client/pages/inbound/unload-product.js +10 -9
- package/client/pages/inventory/inventory-adjustment.js +1 -1
- package/client/pages/inventory/inventory-by-product-detail.js +99 -92
- package/client/pages/inventory/inventory-by-product.js +170 -68
- package/client/pages/inventory-check/inspecting-product.js +1 -1
- package/client/pages/order/release-order/b2b/b2b-order-list.js +76 -80
- package/client/pages/order/release-order/b2c/b2c-order-requests.js +93 -81
- package/client/pages/order/release-order/batch-picking-popup.js +11 -0
- package/client/pages/order/release-order/create-release-order.js +258 -252
- package/client/pages/order/release-order/release-extra-product-popup.js +10 -3
- package/client/pages/order/release-order/release-order-detail.js +202 -63
- package/client/pages/order/transport-order/delivery-note-popup.js +12 -17
- package/client/pages/order/transport-order/upload-delivery-note.js +6 -4
- package/client/pages/order/transport-order/view-delivery-note.js +0 -1
- package/client/pages/outbound/generate-worksheet-popup.js +337 -0
- package/client/pages/outbound/inventory-reassign-popup.js +1097 -0
- package/client/pages/outbound/loading-product.js +2 -2
- package/client/pages/outbound/picking-product.js +174 -100
- package/client/pages/outbound/sorting-product.js +5 -5
- package/client/pages/outbound/worksheet-batch-picking.js +39 -5
- package/client/pages/outbound/worksheet-picking.js +45 -6
- package/client/pages/report/outbound-order-details-report.js +181 -49
- package/client/pages/report/release-inventory-report.js +503 -0
- package/client/route.js +5 -0
- package/dist-server/graphql/resolvers/extra/add-release-good-products.js +54 -3
- package/dist-server/graphql/resolvers/extra/add-release-good-products.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/index.js +2 -1
- package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +63 -28
- package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/release-inventory-report.js +180 -0
- package/dist-server/graphql/resolvers/reports/release-inventory-report.js.map +1 -0
- package/dist-server/graphql/types/reports/index.js +6 -1
- package/dist-server/graphql/types/reports/index.js.map +1 -1
- package/dist-server/graphql/types/reports/outbound-order-details-report.js +14 -1
- package/dist-server/graphql/types/reports/outbound-order-details-report.js.map +1 -1
- package/dist-server/graphql/types/reports/release-inventory-report-list.js +14 -0
- package/dist-server/graphql/types/reports/release-inventory-report-list.js.map +1 -0
- package/dist-server/graphql/types/reports/release-inventory-report.js +29 -0
- package/dist-server/graphql/types/reports/release-inventory-report.js.map +1 -0
- package/dist-server/utils/report-query-util.js +4 -2
- package/dist-server/utils/report-query-util.js.map +1 -1
- package/helps/release-note.ko.md +13 -7
- package/helps/release-note.md +13 -7
- package/helps/release-note.ms.md +13 -7
- package/helps/release-note.zh.md +13 -7
- package/package.json +9 -9
- package/server/graphql/resolvers/extra/add-release-good-products.ts +66 -3
- package/server/graphql/resolvers/reports/index.ts +3 -1
- package/server/graphql/resolvers/reports/outbound-order-details-report.ts +66 -29
- package/server/graphql/resolvers/reports/release-inventory-report.ts +202 -0
- package/server/graphql/types/reports/index.ts +6 -1
- package/server/graphql/types/reports/outbound-order-details-report.ts +14 -1
- package/server/graphql/types/reports/release-inventory-report-list.ts +8 -0
- package/server/graphql/types/reports/release-inventory-report.ts +23 -0
- package/server/utils/report-query-util.ts +4 -2
- package/things-factory.config.js +4 -0
- package/translations/en.json +73 -16
- package/translations/ko.json +157 -110
- package/translations/ms.json +65 -16
- package/translations/zh.json +79 -29
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { i18next, localize } from '@things-factory/i18n-base'
|
|
2
|
+
import { css, html, LitElement } from 'lit-element'
|
|
3
|
+
import { SingleColumnFormStyles, MultiColumnFormStyles } from '@things-factory/form-ui'
|
|
4
|
+
import { client, navigate } from '@things-factory/shell'
|
|
5
|
+
import gql from 'graphql-tag'
|
|
6
|
+
import { isMobileDevice } from '@things-factory/utils'
|
|
7
|
+
import { fetchSettingRule } from '../../fetch-setting-value'
|
|
8
|
+
import { ORDER_STATUS } from '../constants'
|
|
9
|
+
|
|
10
|
+
class GenerateWorksheetPopup extends localize(i18next)(LitElement) {
|
|
11
|
+
static get properties() {
|
|
12
|
+
return {
|
|
13
|
+
_generateStd: String,
|
|
14
|
+
gristData: Object,
|
|
15
|
+
_partnerBizplaceIds: Array,
|
|
16
|
+
_releaseGoods: Array,
|
|
17
|
+
_batchLimit: String,
|
|
18
|
+
_groupedReleaseGoods: Array
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static get styles() {
|
|
23
|
+
return [
|
|
24
|
+
MultiColumnFormStyles,
|
|
25
|
+
SingleColumnFormStyles,
|
|
26
|
+
css`
|
|
27
|
+
:host {
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
overflow-x: overlay;
|
|
31
|
+
background-color: var(--main-section-background-color);
|
|
32
|
+
}
|
|
33
|
+
.container {
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
}
|
|
37
|
+
.button-container {
|
|
38
|
+
padding: var(--button-container-padding);
|
|
39
|
+
margin: var(--button-container-margin);
|
|
40
|
+
text-align: var(--button-container-align);
|
|
41
|
+
background-color: var(--button-container-background);
|
|
42
|
+
height: var(--button-container-height);
|
|
43
|
+
}
|
|
44
|
+
.picking-div {
|
|
45
|
+
width: max-content;
|
|
46
|
+
margin: 10px auto auto -10px;
|
|
47
|
+
display: flex;
|
|
48
|
+
gap: 5em;
|
|
49
|
+
}
|
|
50
|
+
.radio-div {
|
|
51
|
+
margin: auto;
|
|
52
|
+
}
|
|
53
|
+
input[type='radio'] {
|
|
54
|
+
top: 2px;
|
|
55
|
+
}
|
|
56
|
+
.multi-column-form {
|
|
57
|
+
display: table !important;
|
|
58
|
+
}
|
|
59
|
+
.grist {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
flex: 1;
|
|
63
|
+
overflow-y: auto;
|
|
64
|
+
}
|
|
65
|
+
.grist-container {
|
|
66
|
+
overflow-y: hidden;
|
|
67
|
+
display: flex;
|
|
68
|
+
flex: 1;
|
|
69
|
+
padding: 10px;
|
|
70
|
+
}
|
|
71
|
+
data-grist {
|
|
72
|
+
overflow-y: auto;
|
|
73
|
+
flex: 1;
|
|
74
|
+
}
|
|
75
|
+
`
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
render() {
|
|
80
|
+
return html`
|
|
81
|
+
<div class="container">
|
|
82
|
+
<form id="input-form" class="multi-column-form">
|
|
83
|
+
<fieldset>
|
|
84
|
+
<legend>${i18next.t('title.please_select_generate_type')}</legend>
|
|
85
|
+
<div class="picking-div">
|
|
86
|
+
<div class="radio-div">
|
|
87
|
+
<input
|
|
88
|
+
id="order-picking"
|
|
89
|
+
name="generate-std"
|
|
90
|
+
type="radio"
|
|
91
|
+
value="single"
|
|
92
|
+
@change="${e => {
|
|
93
|
+
this._generateStd = e.currentTarget.value
|
|
94
|
+
}}"
|
|
95
|
+
.checked="true"
|
|
96
|
+
checked
|
|
97
|
+
/>
|
|
98
|
+
<label for="order-picking">${i18next.t('text.single_picking')}</label>
|
|
99
|
+
</div>
|
|
100
|
+
<div class="radio-div">
|
|
101
|
+
<input
|
|
102
|
+
id="batch-picking"
|
|
103
|
+
name="generate-std"
|
|
104
|
+
type="radio"
|
|
105
|
+
value="batch"
|
|
106
|
+
@change="${e => {
|
|
107
|
+
this._generateStd = e.currentTarget.value
|
|
108
|
+
}}"
|
|
109
|
+
/>
|
|
110
|
+
<label for="batch-picking">${i18next.t('text.batch_picking')}</label>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
</fieldset>
|
|
114
|
+
</form>
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
<div class="grist-container">
|
|
118
|
+
<div class="grist">
|
|
119
|
+
<data-grist
|
|
120
|
+
id="grist"
|
|
121
|
+
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
122
|
+
.config=${this.config}
|
|
123
|
+
.fetchHandler=${this._calculatePossibleWorksheets.bind(this)}
|
|
124
|
+
></data-grist>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
<div class="button-container">
|
|
128
|
+
<mwc-button
|
|
129
|
+
raised
|
|
130
|
+
@click="${async () =>
|
|
131
|
+
this._generateStd == 'single' ? this._generatePickingWorksheet() : this._generateBatchPickingWorksheet()}"
|
|
132
|
+
label="${i18next.t('button.confirm')}"
|
|
133
|
+
></mwc-button>
|
|
134
|
+
</div>
|
|
135
|
+
`
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
get grist() {
|
|
139
|
+
return this.shadowRoot.querySelector('data-grist#grist')
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
constructor() {
|
|
143
|
+
super()
|
|
144
|
+
this._generateStd = 'single'
|
|
145
|
+
this._partnerBizplaceIds = []
|
|
146
|
+
this._releaseGoods = []
|
|
147
|
+
this._groupedReleaseGoods = []
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
async firstUpdated() {
|
|
151
|
+
this.config = {
|
|
152
|
+
pagination: { infinite: true },
|
|
153
|
+
rows: {
|
|
154
|
+
appendable: false
|
|
155
|
+
},
|
|
156
|
+
columns: [
|
|
157
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
158
|
+
{
|
|
159
|
+
type: 'string',
|
|
160
|
+
name: 'company',
|
|
161
|
+
header: i18next.t('field.company'),
|
|
162
|
+
width: 180
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
type: 'int',
|
|
166
|
+
name: 'totalReleaseOrder',
|
|
167
|
+
header: i18next.t('field.release_order'),
|
|
168
|
+
width: 180
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
type: 'string',
|
|
172
|
+
name: 'totalBatchWorksheet',
|
|
173
|
+
header: i18next.t('field.merged_worksheet'),
|
|
174
|
+
width: 180
|
|
175
|
+
}
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
this._batchLimit = await fetchSettingRule('batch-picking-limit')
|
|
180
|
+
//calculate possible worksheets from selected orders
|
|
181
|
+
await this._calculatePossibleWorksheets()
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
async _generatePickingWorksheet() {
|
|
185
|
+
try {
|
|
186
|
+
let releaseGoodNos = this.gristData.selected
|
|
187
|
+
.filter(itm => itm.status === ORDER_STATUS.PENDING_WORKSHEET.value)
|
|
188
|
+
.map(itm => itm.name)
|
|
189
|
+
|
|
190
|
+
const response = await client.mutate({
|
|
191
|
+
mutation: gql`
|
|
192
|
+
mutation generateMultipleReleaseGoodWorksheet($releaseGoodNos: [String!]) {
|
|
193
|
+
generateMultipleReleaseGoodWorksheet(releaseGoodNos: $releaseGoodNos)
|
|
194
|
+
}
|
|
195
|
+
`,
|
|
196
|
+
variables: {
|
|
197
|
+
releaseGoodNos
|
|
198
|
+
}
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
if (!response.errors) {
|
|
202
|
+
navigate('single_outbound_worksheets')
|
|
203
|
+
this._showToast({ message: i18next.t('text.worksheet(s)_has_been_generated') })
|
|
204
|
+
}
|
|
205
|
+
} catch (e) {
|
|
206
|
+
this._showToast(e)
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
async _generateBatchPickingWorksheet() {
|
|
211
|
+
try {
|
|
212
|
+
await this._validateWorksheets()
|
|
213
|
+
const response = await client.mutate({
|
|
214
|
+
mutation: gql`
|
|
215
|
+
mutation generateBatchPickingWorksheet($releaseGoods: [[GenerateBatchPickInfo!]]) {
|
|
216
|
+
generateBatchPickingWorksheet(releaseGoodWithBiz: $releaseGoods) {
|
|
217
|
+
name
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
`,
|
|
221
|
+
variables: {
|
|
222
|
+
releaseGoods: this._groupedReleaseGoods
|
|
223
|
+
}
|
|
224
|
+
})
|
|
225
|
+
|
|
226
|
+
if (!response.errors) {
|
|
227
|
+
navigate('merged_outbound_worksheets')
|
|
228
|
+
this._showToast({ message: i18next.t('text.worksheet(s)_has_been_generated') })
|
|
229
|
+
}
|
|
230
|
+
} catch (e) {
|
|
231
|
+
this._showToast(e)
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
async _splitOrdersForGenerateBatchWorksheet() {
|
|
236
|
+
this._releaseGoods = this.gristData.selected
|
|
237
|
+
.filter(itm => itm.status === ORDER_STATUS.PENDING_WORKSHEET.value)
|
|
238
|
+
.map(itm => {
|
|
239
|
+
return {
|
|
240
|
+
releaseGoodNo: itm.name,
|
|
241
|
+
bizplaceId: itm.bizplace.id,
|
|
242
|
+
bizplaceName: itm.bizplace.name
|
|
243
|
+
}
|
|
244
|
+
})
|
|
245
|
+
|
|
246
|
+
this._partnerBizplaceIds = [...new Set(this._releaseGoods.map(item => item.bizplaceId))]
|
|
247
|
+
|
|
248
|
+
//separate orders by bizplace
|
|
249
|
+
let array = []
|
|
250
|
+
this._releaseGoods.forEach(rg => {
|
|
251
|
+
const { bizplaceId } = rg
|
|
252
|
+
array[bizplaceId] = array[bizplaceId] ?? []
|
|
253
|
+
|
|
254
|
+
array[bizplaceId].push(rg)
|
|
255
|
+
return array
|
|
256
|
+
})
|
|
257
|
+
|
|
258
|
+
//check if there is at least 2 orders, separate orders based on batch picking limit
|
|
259
|
+
this._partnerBizplaceIds.forEach(itm => {
|
|
260
|
+
let insufficientOrders = this._releaseGoods.filter(rg => rg.bizplaceId == itm)
|
|
261
|
+
|
|
262
|
+
if (insufficientOrders?.length > 1) {
|
|
263
|
+
while (array[itm].length > 0) {
|
|
264
|
+
array.push(array[itm].splice(0, parseInt(this._batchLimit) ? parseInt(this._batchLimit) : 20))
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
delete array[itm]
|
|
268
|
+
}
|
|
269
|
+
})
|
|
270
|
+
|
|
271
|
+
return array
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
async _calculatePossibleWorksheets() {
|
|
275
|
+
//get grouped release goods
|
|
276
|
+
this._groupedReleaseGoods = await this._splitOrdersForGenerateBatchWorksheet()
|
|
277
|
+
let batchLimit = parseInt(this._batchLimit) ? parseInt(this._batchLimit) : 20
|
|
278
|
+
//for each bizplace, generate data of possible worksheets
|
|
279
|
+
let data = this._partnerBizplaceIds.map(id => {
|
|
280
|
+
let selectedOrders = this._releaseGoods.filter(rg => rg.bizplaceId == id)
|
|
281
|
+
let possibleBatchWorksheet = Math.ceil(selectedOrders.length / batchLimit)
|
|
282
|
+
|
|
283
|
+
return {
|
|
284
|
+
company: selectedOrders[0].bizplaceName,
|
|
285
|
+
totalReleaseOrder: selectedOrders.length,
|
|
286
|
+
totalBatchWorksheet: possibleBatchWorksheet
|
|
287
|
+
}
|
|
288
|
+
})
|
|
289
|
+
|
|
290
|
+
return { records: data, total: data.length }
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
_validateWorksheets() {
|
|
294
|
+
//check if there is at least 2 orders, separate orders based on batch picking limit
|
|
295
|
+
this._partnerBizplaceIds.forEach(itm => {
|
|
296
|
+
let insufficientOrders = this._releaseGoods.filter(rg => rg.bizplaceId == itm)
|
|
297
|
+
|
|
298
|
+
if (insufficientOrders?.length < 2) {
|
|
299
|
+
throw new Error(i18next.t('text.minimum_of_2_orders_required_for_batch_picking'))
|
|
300
|
+
}
|
|
301
|
+
})
|
|
302
|
+
|
|
303
|
+
//check recall and normal orders are selected together
|
|
304
|
+
let uniqueWS = this.gristData.selected.filter(
|
|
305
|
+
res => res.recall !== this.gristData.selected[0].recall && res.status === ORDER_STATUS.PENDING_WORKSHEET.value
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
if (uniqueWS.length > 0) {
|
|
309
|
+
throw new Error(i18next.t('text.recall_release_order_cant_be_generated_together_with_normal_release_order'))
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
//check route and without route orders are selected together
|
|
313
|
+
let withRouteLabel = this.gristData.selected.find(
|
|
314
|
+
itm => itm.routeId && itm.status === ORDER_STATUS.PENDING_WORKSHEET.value
|
|
315
|
+
)
|
|
316
|
+
let withoutRouteLabel = this.gristData.selected.find(
|
|
317
|
+
itm => itm.routeId == null && itm.status === ORDER_STATUS.PENDING_WORKSHEET.value
|
|
318
|
+
)
|
|
319
|
+
|
|
320
|
+
if (withRouteLabel && withoutRouteLabel) {
|
|
321
|
+
throw new Error(i18next.t('text.release_order_without_route_labelling_is_included_in_the_batch_picking'))
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
_showToast({ type, message }) {
|
|
326
|
+
document.dispatchEvent(
|
|
327
|
+
new CustomEvent('notify', {
|
|
328
|
+
detail: {
|
|
329
|
+
type,
|
|
330
|
+
message
|
|
331
|
+
}
|
|
332
|
+
})
|
|
333
|
+
)
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
window.customElements.define('generate-worksheet-popup', GenerateWorksheetPopup)
|