Skip to content

Commit

Permalink
fix multiple scan issue #373
Browse files Browse the repository at this point in the history
  • Loading branch information
panic-coder committed Jan 14, 2020
1 parent ebf518d commit 1abef40
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export class CompleteComponent implements OnInit {
public sortAscending = true;
public sortColumn = 'productModelSku';
public searchSKUText = '';
public searchEntry = '';

constructor(private orgModelApi: OrgModelApi,
private _route: ActivatedRoute,
Expand Down Expand Up @@ -106,11 +107,11 @@ export class CompleteComponent implements OnInit {

searchProductBySku(sku?: string) {
this.loading = true;
var pattern = new RegExp('.*'+sku+'.*', "i"); /* case-insensitive RegExp search */
var filterData = pattern.toString();
// var pattern = new RegExp('.*'+sku+'.*', "i"); /* case-insensitive RegExp search */
// var filterData = pattern.toString();
this.orgModelApi.getProductModels(this.userProfile.orgModelId, {
where: {
api_id: { "regexp": filterData }
sku: sku
}
}).subscribe((data: any) => {
if (data.length) {
Expand Down Expand Up @@ -152,6 +153,9 @@ export class CompleteComponent implements OnInit {

keyUpEvent(event, searchSKUText) {
if(event.keyCode == '13') {
searchSKUText = searchSKUText.replace(this.searchEntry,'');
this.searchEntry = searchSKUText;
this.searchSKUText = searchSKUText;
this.searchProductBySku(searchSKUText)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ export class FulfillComponent implements OnInit {
* calls the search sku function
*/
barcodeSearchSKU($event: any) {
if (this.enableBarcode && this.searchSKUText !== '') {
if (this.enableBarcode && this.searchSKUText !== '' && $event.keyCode == '13') {
console.log("this.searchSKUText : ",this.searchSKUText);
this.searchAndIncrementProduct(this.searchSKUText);
$event.target.select();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export class GeneratedComponent implements OnInit, OnDestroy {
public ccInvalidEmailCounter: number = 0;
public bccValidEmailCounter: number = 0;
public bccInvalidEmailCounter: number = 0;
public searchEntry = '';

constructor(private orgModelApi: OrgModelApi,
private _route: ActivatedRoute,
Expand Down Expand Up @@ -216,6 +217,7 @@ export class GeneratedComponent implements OnInit, OnDestroy {
}

searchProductBySku(sku?: string) {
console.log("searchProductBySku");
this.loading = true;
var pattern = new RegExp('.*'+sku+'.*', "i"); /* case-insensitive RegExp search */
var filterData = pattern.toString();
Expand Down Expand Up @@ -520,6 +522,9 @@ export class GeneratedComponent implements OnInit, OnDestroy {

keyUpEvent(event, searchSKUText) {
if(event.keyCode == '13') {
searchSKUText = searchSKUText.replace(this.searchEntry,'');
this.searchEntry = searchSKUText;
this.searchSKUText = searchSKUText;
this.searchProductBySku(searchSKUText)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ export class ReceiveComponent implements OnInit, OnDestroy {
* @param searchText
*/
barcodeSearchSKU($event) {
if (this.enableBarcode && this.searchSKUText !== '') {
if (this.enableBarcode && this.searchSKUText !== '' && $event.keyCode == '13') {
this.searchAndIncrementProduct(this.searchSKUText);
$event.target.select();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
[(ngModel)]="searchSKUText"
placeholder="Scan SKU barcode here or enter text"
[appAutoFocus]="searchSKUFocused"
(keyup)="barcodeSearchSKU()" (keyup)="keyUpEvent($event)">
(keyup)="barcodeSearchSKU($event)" (keyup)="keyUpEvent($event)">
<span class="input-group-btn">
<button class="btn btn-primary" type="button" (click)="searchSKU()">
<i class="fa fa-search"></i> Search
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class BinLocationsComponent implements OnInit {
public readingBarcode: any;
public enableBarcode: boolean = true;
public searchSKUText: string;
public searchEntry: '';

constructor(private orgModelApi: OrgModelApi,
private _route: ActivatedRoute,
Expand Down Expand Up @@ -70,8 +71,11 @@ export class BinLocationsComponent implements OnInit {
* calls the search sku function
* @param searchText
*/
barcodeSearchSKU() {
if (this.enableBarcode) {
barcodeSearchSKU(event) {
if (this.enableBarcode && event.keyCode == '13') {
this.searchSKUText = this.searchSKUText.replace(this.searchEntry,'');
this.searchEntry = this.searchSKUText;
this.searchSKUText = this.searchSKUText;
clearTimeout(this.readingBarcode);
this.readingBarcode = setTimeout(() => {
this.searchSKU();
Expand Down

0 comments on commit 1abef40

Please sign in to comment.