Skip to content

Commit

Permalink
fix bar code scan and validations while search
Browse files Browse the repository at this point in the history
  • Loading branch information
panic-coder committed Jan 7, 2020
1 parent c2cc0a9 commit d850692
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class CompleteComponent implements OnInit {
public totalLineItems: number;
public sortAscending = true;
public sortColumn = 'productModelSku';
public searchSKUText = '';

constructor(private orgModelApi: OrgModelApi,
private _route: ActivatedRoute,
Expand All @@ -50,8 +51,8 @@ export class CompleteComponent implements OnInit {
limit = 100;
skip = 0;
}
if (!productModelIds && productModelIds.length) {
this.searchSKUText = ''
if ((productModelIds !== undefined && productModelIds !== null) && (!productModelIds && productModelIds.length > 0)) {
this.searchSKUText = '';
}
let sortOrder = this.sortAscending ? 'ASC' : 'DESC';
let whereFilter = {
Expand Down Expand Up @@ -82,8 +83,8 @@ export class CompleteComponent implements OnInit {
let countFilter = {
reportModelId: this.order.id
};
if (productModelId)
countFilter['productModelId'] = productModelId;
if (productModelIds && productModelIds.length)
countFilter['productModelId'] = {inq: productModelIds};
this.loading = true;
let fetchLineItems = combineLatest(
this.orgModelApi.getStockOrderLineitemModels(this.userProfile.orgModelId, filter),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class FulfillComponent implements OnInit {
limit = 100;
skip = 0;
}
if (!productModelIds && productModelIds.length) {
if ((productModelIds !== undefined && productModelIds !== null) && (!productModelIds && productModelIds.length > 0)) {
this.searchSKUText = ''
}
let sortOrder = this.sortAscending ? 'ASC' : 'DESC';
Expand Down Expand Up @@ -157,7 +157,7 @@ export class FulfillComponent implements OnInit {
limit = 100;
skip = 0;
}
if (!productModelIds && productModelIds.length) {
if ((productModelIds !== undefined && productModelIds !== null) && (!productModelIds && productModelIds.length > 0)) {
this.searchSKUText = ''
}
let sortOrder = this.sortAscending ? 'ASC' : 'DESC';
Expand Down Expand Up @@ -397,6 +397,7 @@ export class FulfillComponent implements OnInit {
*/
barcodeSearchSKU($event: any) {
if (this.enableBarcode && this.searchSKUText !== '') {
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 @@ -95,7 +95,7 @@ export class ReceiveComponent implements OnInit, OnDestroy {
limit = 100;
skip = 0;
}
if (!productModelIds && productModelIds.length) {
if ((productModelIds !== undefined && productModelIds !== null) && (!productModelIds && productModelIds.length > 0)) {
this.searchSKUText = ''
}
let sortOrder = this.sortAscending ? 'ASC' : 'DESC';
Expand Down Expand Up @@ -160,7 +160,7 @@ export class ReceiveComponent implements OnInit, OnDestroy {
limit = 100;
skip = 0;
}
if (!productModelIds && productModelIds.length) {
if ((productModelIds !== undefined && productModelIds !== null) && (!productModelIds && productModelIds.length > 0)) {
this.searchSKUText = ''
}
let sortOrder = this.sortAscending ? 'ASC' : 'DESC';
Expand Down
12 changes: 6 additions & 6 deletions common/models/stock-order-lineitem-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ module.exports = function (StockOrderLineitemModel) {
force,
options
});
let searchPattern = new RegExp(productSku, 'i');
// let searchPattern = new RegExp(productSku, 'i');
var pattern = new RegExp('.*'+productSku+'.*', "i"); /* case-insensitive RegExp search */
var filterData = pattern.toString();
return StockOrderLineitemModel.app.models.ProductModel.findOne({
where: {
orgModelId,
sku: {
like: searchPattern
}
orgModelId: orgModelId,
sku: { "regexp": filterData }
}
})
.catch(function (error) {
Expand Down Expand Up @@ -151,7 +151,7 @@ module.exports = function (StockOrderLineitemModel) {
});
return Promise.all([Promise.resolve({showDiscrepancyAlert: true}), Promise.resolve(orderLineItem.id)]);
}
}else {
} else {
logger.debug({
functionName: 'scanBarcodeStockOrder',
message: 'Force "true" received will increment forcefully',
Expand Down
2 changes: 1 addition & 1 deletion nginx.warehouse.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ upstream notification-service {
}
server {
listen 80 default;
server_name _;
server_name shrey.shoppinpal.com;
# configure real ip if anyone using CloudFlare
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
Expand Down

0 comments on commit d850692

Please sign in to comment.