|
@@ -25,6 +25,7 @@
|
|
|
{
|
|
{
|
|
|
self.offset = 0;
|
|
self.offset = 0;
|
|
|
[self.content_data removeAllObjects];
|
|
[self.content_data removeAllObjects];
|
|
|
|
|
+ [self.table_order reloadData];
|
|
|
self.status_cadedate = nil;
|
|
self.status_cadedate = nil;
|
|
|
}
|
|
}
|
|
|
-(void) reload_container_getdata:(bool) update_data
|
|
-(void) reload_container_getdata:(bool) update_data
|
|
@@ -32,8 +33,9 @@
|
|
|
[super reload_container_getdata:update_data];
|
|
[super reload_container_getdata:update_data];
|
|
|
if(update_data)
|
|
if(update_data)
|
|
|
{
|
|
{
|
|
|
- self.offset = 0;
|
|
|
|
|
- [self.content_data removeAllObjects];
|
|
|
|
|
|
|
+// self.offset = 0;
|
|
|
|
|
+// [self.content_data removeAllObjects];
|
|
|
|
|
+ self.reset_result=true;
|
|
|
self.norefresh=true;
|
|
self.norefresh=true;
|
|
|
[self loadpage];
|
|
[self loadpage];
|
|
|
}
|
|
}
|
|
@@ -67,6 +69,7 @@
|
|
|
[super viewDidLoad];
|
|
[super viewDidLoad];
|
|
|
self.edgesForExtendedLayout = UIRectEdgeNone;
|
|
self.edgesForExtendedLayout = UIRectEdgeNone;
|
|
|
|
|
|
|
|
|
|
+ self.loading_queue = dispatch_queue_create("orderlist_loading", NULL);
|
|
|
|
|
|
|
|
self.label_net_err.layer.borderColor = [UIColor darkGrayColor].CGColor;
|
|
self.label_net_err.layer.borderColor = [UIColor darkGrayColor].CGColor;
|
|
|
self.label_net_err.layer.borderWidth = 2.0;
|
|
self.label_net_err.layer.borderWidth = 2.0;
|
|
@@ -284,8 +287,8 @@
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
- [self.content_data removeAllObjects];
|
|
|
|
|
- [self.table_order reloadData];
|
|
|
|
|
|
|
+// [self.content_data removeAllObjects];
|
|
|
|
|
+// [self.table_order reloadData];
|
|
|
|
|
|
|
|
|
|
|
|
|
// self.table_order.hidden = true;
|
|
// self.table_order.hidden = true;
|
|
@@ -296,7 +299,8 @@
|
|
|
reF.attributedTitle = [[NSAttributedString alloc]initWithString:@"Pull to refresh"];
|
|
reF.attributedTitle = [[NSAttributedString alloc]initWithString:@"Pull to refresh"];
|
|
|
|
|
|
|
|
self.keywords=self.searchbar.text;
|
|
self.keywords=self.searchbar.text;
|
|
|
- self.offset = 0;
|
|
|
|
|
|
|
+// self.offset = 0;
|
|
|
|
|
+ self.reset_result=true;
|
|
|
// [self.content_data removeAllObjects];
|
|
// [self.content_data removeAllObjects];
|
|
|
// [self.table_order reloadData];
|
|
// [self.table_order reloadData];
|
|
|
|
|
|
|
@@ -308,25 +312,67 @@
|
|
|
}
|
|
}
|
|
|
-(void) loadpage
|
|
-(void) loadpage
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
-dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
|
|
+ dispatch_async(self.loading_queue, ^{
|
|
|
|
|
+
|
|
|
|
|
+ dispatch_sync(dispatch_get_main_queue(), ^{
|
|
|
|
|
+ if(self.reset_result)
|
|
|
|
|
+ {
|
|
|
|
|
+ self.offset = 0;
|
|
|
|
|
+ [self.content_data removeAllObjects];
|
|
|
|
|
+ [self.table_order reloadData];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+// NSMutableArray* arr_status = [[NSMutableArray alloc] init];
|
|
|
|
|
+
|
|
|
|
|
+ NSMutableArray* arr_statusname = [[NSMutableArray alloc] init];
|
|
|
|
|
+ int count = [[self.status_cadedate valueForKey:@"count"] intValue];
|
|
|
|
|
+ for(int i=0;i<count;i++)
|
|
|
|
|
+ {
|
|
|
|
|
+ NSDictionary* val_json =[self.status_cadedate objectForKey:[NSString stringWithFormat:@"val_%d",i]];
|
|
|
|
|
+ int check = [[val_json valueForKey:@"check"] intValue];
|
|
|
|
|
+ if(check==1)
|
|
|
|
|
+ {
|
|
|
|
|
+// [arr_status addObject:[NSString stringWithFormat:@"%@",[val_json valueForKey:@"value_id"]]];
|
|
|
|
|
+ [arr_statusname addObject:[NSString stringWithFormat:@"%@",[val_json valueForKey:@"value"]]];
|
|
|
|
|
+
|
|
|
|
|
+ // break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+// NSString * str_status = [arr_status componentsJoinedByString:@","];
|
|
|
|
|
+ NSString * str_statusname = [arr_statusname componentsJoinedByString:@","];
|
|
|
|
|
+ if(str_statusname.length==0)
|
|
|
|
|
+ str_statusname = @"All";
|
|
|
|
|
+ self.label_filter.text = str_statusname;
|
|
|
|
|
+ if(self.offset==0)
|
|
|
|
|
+ {
|
|
|
|
|
+ self.table_order.hidden = true;
|
|
|
|
|
+
|
|
|
|
|
+ self.mum.center = self.view.center;
|
|
|
|
|
+
|
|
|
|
|
+ self.mum.hidden = false;
|
|
|
|
|
+ [self.mum startAnimating];
|
|
|
|
|
+ }
|
|
|
|
|
+ self.label_net_err.hidden=true;
|
|
|
|
|
+
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+dispatch_async(self.loading_queue, ^{
|
|
|
if(self.isrefreshing)
|
|
if(self.isrefreshing)
|
|
|
return;
|
|
return;
|
|
|
self.isrefreshing=true;
|
|
self.isrefreshing=true;
|
|
|
- if(self.offset==0)
|
|
|
|
|
- {
|
|
|
|
|
- self.table_order.hidden = true;
|
|
|
|
|
|
|
|
|
|
- self.mum.center = self.view.center;
|
|
|
|
|
|
|
|
|
|
- self.mum.hidden = false;
|
|
|
|
|
- [self.mum startAnimating];
|
|
|
|
|
- }
|
|
|
|
|
- self.label_net_err.hidden=true;
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
NSMutableArray* arr_status = [[NSMutableArray alloc] init];
|
|
NSMutableArray* arr_status = [[NSMutableArray alloc] init];
|
|
|
|
|
|
|
|
- NSMutableArray* arr_statusname = [[NSMutableArray alloc] init];
|
|
|
|
|
|
|
+// NSMutableArray* arr_statusname = [[NSMutableArray alloc] init];
|
|
|
int count = [[self.status_cadedate valueForKey:@"count"] intValue];
|
|
int count = [[self.status_cadedate valueForKey:@"count"] intValue];
|
|
|
for(int i=0;i<count;i++)
|
|
for(int i=0;i<count;i++)
|
|
|
{
|
|
{
|
|
@@ -335,26 +381,18 @@ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
if(check==1)
|
|
if(check==1)
|
|
|
{
|
|
{
|
|
|
[arr_status addObject:[NSString stringWithFormat:@"%@",[val_json valueForKey:@"value_id"]]];
|
|
[arr_status addObject:[NSString stringWithFormat:@"%@",[val_json valueForKey:@"value_id"]]];
|
|
|
- [arr_statusname addObject:[NSString stringWithFormat:@"%@",[val_json valueForKey:@"value"]]];
|
|
|
|
|
-
|
|
|
|
|
- // break;
|
|
|
|
|
|
|
+// [arr_statusname addObject:[NSString stringWithFormat:@"%@",[val_json valueForKey:@"value"]]];
|
|
|
|
|
+
|
|
|
|
|
+ // break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
NSString * str_status = [arr_status componentsJoinedByString:@","];
|
|
NSString * str_status = [arr_status componentsJoinedByString:@","];
|
|
|
- NSString * str_statusname = [arr_statusname componentsJoinedByString:@","];
|
|
|
|
|
- if(str_statusname.length==0)
|
|
|
|
|
- str_statusname = @"All";
|
|
|
|
|
- self.label_filter.text = str_statusname;
|
|
|
|
|
|
|
|
|
|
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
NSMutableDictionary* content=nil;
|
|
NSMutableDictionary* content=nil;
|
|
|
content=[[iSalesNetwork request_OrderList:self.offset limit : self.limit keywords:self.keywords status:str_status customer:self.customer_id] mutableCopy];
|
|
content=[[iSalesNetwork request_OrderList:self.offset limit : self.limit keywords:self.keywords status:str_status customer:self.customer_id] mutableCopy];
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
|
|
+ dispatch_sync(dispatch_get_main_queue(), ^{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -398,6 +436,7 @@ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
|
|
|
|
|
|
|
|
self.table_order.hidden = false;
|
|
self.table_order.hidden = false;
|
|
|
|
|
+ self.reset_result=false;
|
|
|
[self.table_order reloadData ];
|
|
[self.table_order reloadData ];
|
|
|
}
|
|
}
|
|
|
else if(result==RESULT_NET_ERROR &&self.offset==0)
|
|
else if(result==RESULT_NET_ERROR &&self.offset==0)
|
|
@@ -427,7 +466,7 @@ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
});
|
|
|
- });
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
@@ -930,8 +969,9 @@ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
|
|
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
|
|
|
{
|
|
{
|
|
|
self.keywords=searchBar.text;
|
|
self.keywords=searchBar.text;
|
|
|
- self.offset = 0;
|
|
|
|
|
- [self.content_data removeAllObjects];
|
|
|
|
|
|
|
+// self.offset = 0;
|
|
|
|
|
+// [self.content_data removeAllObjects];
|
|
|
|
|
+ self.reset_result=true;
|
|
|
[self loadpage];
|
|
[self loadpage];
|
|
|
}
|
|
}
|
|
|
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
|
|
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
|
|
@@ -943,8 +983,9 @@ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
self.reset=true;
|
|
self.reset=true;
|
|
|
self.keywords=nil;
|
|
self.keywords=nil;
|
|
|
|
|
|
|
|
- self.offset = 0;
|
|
|
|
|
- [self.content_data removeAllObjects];
|
|
|
|
|
|
|
+// self.offset = 0;
|
|
|
|
|
+// [self.content_data removeAllObjects];
|
|
|
|
|
+ self.reset_result=true;
|
|
|
[self loadpage];
|
|
[self loadpage];
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
@@ -1228,8 +1269,9 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:
|
|
|
|
|
|
|
|
|
|
|
|
|
// self.keywords=searchBar.text;
|
|
// self.keywords=searchBar.text;
|
|
|
- self.offset = 0;
|
|
|
|
|
- [self.content_data removeAllObjects];
|
|
|
|
|
|
|
+// self.offset = 0;
|
|
|
|
|
+// [self.content_data removeAllObjects];
|
|
|
|
|
+ self.reset_result=true;
|
|
|
[self loadpage];
|
|
[self loadpage];
|
|
|
|
|
|
|
|
//[self.btnStatusFilter setTitle:setTitle:alert ];
|
|
//[self.btnStatusFilter setTitle:setTitle:alert ];
|