Przeglądaj źródła

160928
Modify: message when server not response.

Ray Zhang 9 lat temu
rodzic
commit
16bc292931

BIN
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/Ray.xcuserdatad/UserInterfaceState.xcuserstate


+ 3 - 1
RedAnt ERP Mobile/common/Functions/cart/CartViewController.m

@@ -1735,6 +1735,8 @@
         [tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
         
         dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//            ModelItemCell* cell=[self.itemListTable cellForRowAtIndexPath:indexPath];
+//            [cell cancel_setQTY];
             
             NSDictionary* return_json = [iSalesNetwork move_cart2wish:cart_item_id ];
             
@@ -1762,7 +1764,7 @@
                         }
                         
                     }
-                    [self.itemListTable reloadData];
+                    //[self.itemListTable reloadData];
                     //                    if(self.WatchlistBlock!=nil)
                     //                    {
                     //                        UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];

+ 2 - 0
RedAnt ERP Mobile/common/Functions/cart/ModelItemCell.h

@@ -62,6 +62,8 @@
 
 @property int totalchange;
 
+
+-(void) cancel_setQTY;
 //@property (strong,nonatomic) NSString* last_edit;
 
 //@property int step;

+ 7 - 2
RedAnt ERP Mobile/common/Functions/cart/ModelItemCell.m

@@ -151,11 +151,16 @@
 //    }
     self.pre_val = (int)sender.value;
     
-    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(delayRun) object:nil];
     
-    [self performSelector:@selector(delayRun) withObject:nil afterDelay:1];
+    [self cancel_setQTY];
+    [self performSelector:@selector(delayRun) withObject:nil afterDelay:0.8];
     
 }
+
+-(void) cancel_setQTY
+{
+    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(delayRun) object:nil];
+}
 -(void) delayRun
 {
 //    NSThread *thread = [[NSThread alloc] initWithTarget:self selector:@selector(calculate) object:nil];

+ 11 - 3
RedAnt ERP Mobile/iSales-NPD/AppDelegate.m

@@ -56,7 +56,7 @@
 {
     _customerInfo=customerInfo;
     int count=customerInfo[@"count"];
-    assert(count==0);
+    //assert(count==0);
     
 }
 -(void) set_main_button_panel
@@ -1295,7 +1295,7 @@ void UncaughtExceptionHandler(NSException *exception) {
         //     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
         int count=0;
         //  __block bool preparing = true;
-        while ([[download_json valueForKey:@"result"] intValue]!=2&&count<REQUEST_DOWNLOAD_RETRY_TIMES) //超过10分钟还没准被好数据就视为服务器出错。
+        while ([[download_json valueForKey:@"result"] intValue]!=2&&count<REQUEST_DOWNLOAD_RETRY_TIMES) //超过60分钟还没准被好数据就视为服务器出错。
         {
             sleep(RETRY_DELAY);
             
@@ -1562,6 +1562,7 @@ void UncaughtExceptionHandler(NSException *exception) {
         int count = [[self.download_task valueForKey:@"count"] intValue];
         bool alldone=true;
         bool trouble=false;
+        bool response = false;
         for (int i = 0;i<count;i++)
         {
             NSDictionary* itemjson = [self.download_task objectForKey:[NSString stringWithFormat:@"item_%d",i]];
@@ -1583,6 +1584,7 @@ void UncaughtExceptionHandler(NSException *exception) {
                 {
                     alldone=false;
                     trouble=true;
+                    response = [itemjson[@"response"] boolValue];
                     break;
                 }
             }
@@ -1590,7 +1592,12 @@ void UncaughtExceptionHandler(NSException *exception) {
         }
         if(trouble)
         {
-            [self add_downloadlog:@"offline sync got some trouble, sync canceled."];
+            NSString* msg =@"offline sync got some trouble, sync canceled.";
+            if(response==false)
+            {
+                msg=@"Cannot connect to server, please check your network.";
+            }
+            [self add_downloadlog:msg];
             dispatch_async(dispatch_get_main_queue(), ^{
                 //        self.downloadlog=nil;
                 self.downloading=false;
@@ -1936,6 +1943,7 @@ void UncaughtExceptionHandler(NSException *exception) {
         //self.fileName = response.suggestedFilename;
         
         currenttask[@"fileName"] = response.suggestedFilename;
+        currenttask[@"response"] = @"true";
         [self add_downloadlog:[NSString stringWithFormat:@"Begin download file %@.",currenttask[@"fileName"]]];
         
         self.download_task [[NSString stringWithFormat:@"item_%d",self.current_task]]=currenttask;