@things-factory/operato-wms 4.3.515 → 4.3.518

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.
@@ -1,14 +1,13 @@
1
1
  import '@things-factory/grist-ui'
2
2
 
3
- import { sendToPrinter } from '../../util'
4
3
  import { DirectPrinter } from '@things-factory/barcode-base'
5
4
  import { SingleColumnFormStyles } from '@things-factory/form-ui'
6
5
  import { i18next, localize } from '@things-factory/i18n-base'
7
6
  import { client, store } from '@things-factory/shell'
8
7
  import { css, html, LitElement } from 'lit-element'
9
8
  import { connect } from 'pwa-helpers/connect-mixin'
10
- import { CARTON_LABEL_SETTING_KEY, CARTON_LABEL_BY_SKU_SETTING_KEY } from '../constants'
11
- import { sleep } from '@things-factory/utils'
9
+ import { sendToPrinter } from '../../util'
10
+ import { CARTON_LABEL_BY_SKU_SETTING_KEY, CARTON_LABEL_SETTING_KEY } from '../constants'
12
11
 
13
12
  import gql from 'graphql-tag'
14
13
 
@@ -208,21 +207,22 @@ class CartonLabelPopup extends connect(store)(localize(i18next)(LitElement)) {
208
207
  const filters = this._filters
209
208
  let labelId = filters.find(itm => itm.value == (this?.type ? this.type : 'default')).board.id
210
209
  let bizplaceName = this.bizplaceName
210
+ let printData = []
211
211
 
212
212
  switch (this.type) {
213
213
  case 'bySku':
214
214
  let selected = this.dataGrist.selected
215
215
 
216
216
  if (selected.length > 0) {
217
- let printData = []
218
217
 
219
218
  const cartonLabels = await this._getCartonId(selected.length)
220
219
 
221
220
  selected.forEach((obj, idx) => {
222
221
  for (let index = 0; index < obj.printQty; index++) {
223
- let manufactureDate = new Date(obj.manufactureDate)
224
- let manufactureYear = manufactureDate.getFullYear()
225
- printData.push({
222
+ let manufactureDate = new Date(obj.manufactureDate);
223
+ let manufactureYear = manufactureDate.getFullYear();
224
+
225
+ let data = {
226
226
  batchId: obj.batchId,
227
227
  productSku: obj.productSku,
228
228
  packingType: obj.packingType,
@@ -235,15 +235,13 @@ class CartonLabelPopup extends connect(store)(localize(i18next)(LitElement)) {
235
235
  manufactureYear: manufactureYear.toString(),
236
236
  cartonId: cartonLabels[idx].cartonId,
237
237
  customer: bizplaceName,
238
- printCount: index + 1
239
- })
238
+ printCount: index + 1,
239
+ carton: cartonLabels[idx].cartonId
240
+ }
241
+ printData.push(data);
240
242
  }
241
243
  })
242
-
243
- for (let i = 0; i < printData.length; i++) {
244
- await sendToPrinter(labelId, { ...printData[i], carton: printData[i].cartonId }, this._printer)
245
- await sleep(300)
246
- }
244
+ await sendToPrinter(labelId, printData, this._printer)
247
245
  }
248
246
  break
249
247
  default:
@@ -255,12 +253,13 @@ class CartonLabelPopup extends connect(store)(localize(i18next)(LitElement)) {
255
253
  const results = await this._getCartonId(printQty)
256
254
 
257
255
  for (let i = 0; i < results.length; i++) {
258
- let printData = {
256
+ let data = {
259
257
  cartonId: results[i].cartonId,
260
258
  customer: bizplaceName
261
259
  }
262
- await sendToPrinter(labelId, printData, this._printer)
260
+ printData.push(data)
263
261
  }
262
+ await sendToPrinter(labelId, printData, this._printer)
264
263
  }
265
264
  } catch (e) {
266
265
  delete this._printer
@@ -297,9 +297,9 @@ class WarehouseList extends localize(i18next)(PageView) {
297
297
  }
298
298
 
299
299
  async _saveWarehouse() {
300
- try {
300
+ try {
301
301
  let patches = this.dataGrist.exportPatchList({ flagName: 'cuFlag' })
302
- if (patches.some(p => (!p.name || !p.type) && p.cuFlag == '+')) {
302
+ if (patches.some(p => (!p.name || !p.type) && p.cuFlag == '+' )) {
303
303
  throw new Error(i18next.t('text.empty_value_in_list'))
304
304
  }
305
305
 
@@ -1,28 +1,34 @@
1
- export const sendToPrinter = async function (labelId, printData, printer) {
1
+ export const sendToPrinter = async function (labelId, printDataArray, printer) { //retrieve parameters from carton-label-popup
2
2
  if (!printer) {
3
3
  throw 'Printer is not defined'
4
4
  }
5
5
 
6
- let searchParams = new URLSearchParams()
7
- Object.entries(printData).forEach(obj => {
8
- if (typeof obj[1] != 'object') {
9
- searchParams.append(obj[0], obj[1])
10
- }
11
- })
12
-
13
- try {
14
- const response = await fetch(`label-command/${labelId}?${searchParams.toString()}`, {
15
- method: 'GET'
6
+ let commands = ''
7
+ for (const printData of printDataArray){
8
+ let searchParams = new URLSearchParams()
9
+ Object.entries(printData).forEach(obj => {
10
+ if (typeof obj[1] != 'object') {
11
+ searchParams.append(obj[0], obj[1])
12
+ }
16
13
  })
17
14
 
18
- if (response.status !== 200) {
19
- throw `Error : Can't get label command from server (response: ${response.status})`
20
- }
15
+ try {
16
+ const response = await fetch(`label-command/${labelId}?${searchParams.toString()}`, {
17
+ method: 'GET'
18
+ })
21
19
 
22
- let command = await response.text()
20
+ if (response.status !== 200) {
21
+ throw `Error : Can't get label command from server (response: ${response.status})`
22
+ }
23
23
 
24
- await printer.print(command)
25
- } catch (ex) {
26
- throw ex
24
+ let command = await response.text()
25
+ commands += command + ' '
26
+
27
+
28
+
29
+ } catch (ex) {
30
+ throw ex
31
+ }
27
32
  }
33
+ await printer.print(commands)
28
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/operato-wms",
3
- "version": "4.3.515",
3
+ "version": "4.3.518",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -63,35 +63,35 @@
63
63
  "@operato/scene-table": "^0.1.8",
64
64
  "@operato/scene-wheel-sorter": "^0.1.8",
65
65
  "@things-factory/apptool-ui": "^4.3.434",
66
- "@things-factory/attachment-ui": "^4.3.452",
67
- "@things-factory/auth-ui": "^4.3.452",
66
+ "@things-factory/attachment-ui": "^4.3.518",
67
+ "@things-factory/auth-ui": "^4.3.518",
68
68
  "@things-factory/barcode-ui": "^4.3.434",
69
- "@things-factory/biz-ui": "^4.3.452",
70
- "@things-factory/board-service": "^4.3.452",
71
- "@things-factory/board-ui": "^4.3.452",
72
- "@things-factory/code-ui": "^4.3.452",
69
+ "@things-factory/biz-ui": "^4.3.518",
70
+ "@things-factory/board-service": "^4.3.518",
71
+ "@things-factory/board-ui": "^4.3.518",
72
+ "@things-factory/code-ui": "^4.3.518",
73
73
  "@things-factory/context-ui": "^4.3.434",
74
74
  "@things-factory/export-ui": "^4.3.434",
75
75
  "@things-factory/export-ui-csv": "^4.3.434",
76
76
  "@things-factory/export-ui-excel": "^4.3.434",
77
- "@things-factory/fav-base": "^4.3.452",
77
+ "@things-factory/fav-base": "^4.3.518",
78
78
  "@things-factory/form-ui": "^4.3.434",
79
- "@things-factory/geography": "^4.3.452",
79
+ "@things-factory/geography": "^4.3.518",
80
80
  "@things-factory/grist-ui": "^4.3.434",
81
81
  "@things-factory/help": "^4.3.434",
82
82
  "@things-factory/i18n-base": "^4.3.434",
83
- "@things-factory/id-rule-base": "^4.3.452",
83
+ "@things-factory/id-rule-base": "^4.3.518",
84
84
  "@things-factory/import-ui": "^4.3.434",
85
85
  "@things-factory/import-ui-excel": "^4.3.434",
86
- "@things-factory/menu-ui": "^4.3.452",
86
+ "@things-factory/menu-ui": "^4.3.518",
87
87
  "@things-factory/more-ui": "^4.3.434",
88
- "@things-factory/notification": "^4.3.452",
88
+ "@things-factory/notification": "^4.3.518",
89
89
  "@things-factory/pdf": "^4.3.381",
90
90
  "@things-factory/print-proxy-service": "^4.3.434",
91
91
  "@things-factory/print-ui": "^4.3.434",
92
- "@things-factory/product-base": "^4.3.495",
93
- "@things-factory/resource-ui": "^4.3.452",
94
- "@things-factory/sales-ui": "^4.3.515",
92
+ "@things-factory/product-base": "^4.3.518",
93
+ "@things-factory/resource-ui": "^4.3.518",
94
+ "@things-factory/sales-ui": "^4.3.518",
95
95
  "@things-factory/scene-data-transform": "^4.3.381",
96
96
  "@things-factory/scene-excel": "^4.3.381",
97
97
  "@things-factory/scene-firebase": "^4.3.381",
@@ -103,12 +103,12 @@
103
103
  "@things-factory/scene-mqtt": "^4.3.381",
104
104
  "@things-factory/scene-restful": "^4.3.381",
105
105
  "@things-factory/scene-visualizer": "^4.3.381",
106
- "@things-factory/setting-ui": "^4.3.452",
106
+ "@things-factory/setting-ui": "^4.3.518",
107
107
  "@things-factory/system-ui": "^4.3.434",
108
- "@things-factory/transport-base": "^4.3.452",
109
- "@things-factory/tutorial-ui": "^4.3.452",
110
- "@things-factory/warehouse-base": "^4.3.515",
111
- "@things-factory/worksheet-base": "^4.3.515"
108
+ "@things-factory/transport-base": "^4.3.518",
109
+ "@things-factory/tutorial-ui": "^4.3.518",
110
+ "@things-factory/warehouse-base": "^4.3.518",
111
+ "@things-factory/worksheet-base": "^4.3.518"
112
112
  },
113
113
  "devDependencies": {
114
114
  "@things-factory/builder": "^4.3.381",
@@ -117,5 +117,5 @@
117
117
  "cypress-localstorage-commands": "^1.6.1",
118
118
  "eslint-plugin-cypress": "^2.12.1"
119
119
  },
120
- "gitHead": "f916cbe75616628eadc2efbeead208978e43b50e"
120
+ "gitHead": "463e272569a16f091b20eb9a99fdd8739fb99939"
121
121
  }