Parcourir la source

hmlg scan order 1.13,修复1.12 测试发现的bug。去掉customer 设置 discount

Ray Zhang il y a 3 ans
Parent
commit
c0237c9ac4

+ 4 - 4
RedAnt ERP Mobile/HMLG Scan Order.xcodeproj/project.pbxproj

@@ -2713,7 +2713,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				CURRENT_PROJECT_VERSION = 51350;
+				CURRENT_PROJECT_VERSION = 51371;
 				DEVELOPMENT_TEAM = HXWLAA5YN5;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -2730,7 +2730,7 @@
 					"$(PROJECT_DIR)/ScanApiSDK-10.2.227-2/lib",
 					"$(PROJECT_DIR)/GoogleAnalytics/GoogleAnalytics/Libraries",
 				);
-				MARKETING_VERSION = 1.12;
+				MARKETING_VERSION = 1.13;
 				OTHER_LDFLAGS = (
 					"$(inherited)",
 					"-ObjC",
@@ -2757,7 +2757,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				CURRENT_PROJECT_VERSION = 51350;
+				CURRENT_PROJECT_VERSION = 51371;
 				DEVELOPMENT_TEAM = HXWLAA5YN5;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -2774,7 +2774,7 @@
 					"$(PROJECT_DIR)/ScanApiSDK-10.2.227-2/lib",
 					"$(PROJECT_DIR)/GoogleAnalytics/GoogleAnalytics/Libraries",
 				);
-				MARKETING_VERSION = 1.12;
+				MARKETING_VERSION = 1.13;
 				OTHER_LDFLAGS = (
 					"$(inherited)",
 					"-ObjC",

+ 20 - 12
RedAnt ERP Mobile/common/Functions/cart/CartViewController.m

@@ -3315,7 +3315,7 @@
     
     NSString *CellIdentifier;
 #ifdef SCANNER_ORDER
-    
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     CellIdentifier = @"ScanCartItemCell";
     ScanCartItemCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
     
@@ -3356,21 +3356,29 @@
     double discount=[[item_json valueForKey:@"discount"] doubleValue];
     cell.discount = discount;
     
-    switch(RASingleton.sharedInstance.price_type)
+    if(appDelegate.user_type == USER_ROLE_CUSTOMER)
     {
-        case 0: cell.btnScanDiscount.hidden = true;
-            break;;
-        case 1:
+        cell.btnScanDiscount.hidden = true;
+    }
+    else
+    {
+        switch(RASingleton.sharedInstance.price_type)
         {
-            if(![item_json[@"special_price"] boolValue]&&![item_json[@"net_price"] boolValue])
-                cell.btnScanDiscount.hidden = false;
-            else
-                cell.btnScanDiscount.hidden = true;
+            case 0: cell.btnScanDiscount.hidden = true;
+                break;;
+            case 1:
+            {
+                if(![item_json[@"special_price"] boolValue]&&![item_json[@"net_price"] boolValue])
+                    cell.btnScanDiscount.hidden = false;
+                else
+                    cell.btnScanDiscount.hidden = true;
+            }
+                break;;
+    //        case 2: pricename = @"25%";
+    //            break;
         }
-            break;;
-//        case 2: pricename = @"25%";
-//            break;
     }
+
     
 
     

+ 1 - 1
RedAnt ERP Mobile/common/Functions/order/CreateOrderViewController.m

@@ -3741,7 +3741,7 @@
         realuser = appDelegate.user;
         realpassword = appDelegate.password;
     }
-    if(appDelegate.user_type==USER_ROLE_CUSTOMER || [upparams[@"customer_cid"] stringValue].length>0 ||[appDelegate.user.uppercaseString isEqualToString:@"GUEST"])
+    if((appDelegate.user_type==USER_ROLE_CUSTOMER && [upparams[@"customer_cid"] stringValue].length>0) || [upparams[@"customer_cid"] stringValue].length>0 ||[appDelegate.user.uppercaseString isEqualToString:@"GUEST"])
     {
         NSMutableDictionary* param = [NSMutableDictionary new];
         

+ 92 - 84
RedAnt ERP Mobile/common/data_provider/RADataProvider.m

@@ -62,106 +62,114 @@
         
         [RAUtils deletefiles:[documents stringByAppendingPathComponent:@"download"]];
         
-//        NSString* file_name=[appDelegate.downloadurl lastPathComponent];
-        
-        dispatch_async(dispatch_get_global_queue(0, 0), ^{
-            
-            NSData*  download_data = [NSData dataWithContentsOfURL:[NSURL URLWithString:appDelegate.downloadurl]];
-            dispatch_async(dispatch_get_main_queue(), ^{
+        __block UIAlertController * waitalert = [RAUtils waiting_alert:vc title:@"Update local data" completion:^{
+            dispatch_async(dispatch_get_global_queue(0, 0), ^{
                 
-                
-                
-                if(download_data!=nil)
-                {
-                    NSString* file_name=[appDelegate.downloadurl lastPathComponent];
-                    NSString* path = [documents stringByAppendingPathComponent:file_name];
-                    [RAUtils saveData:download_data toPath:path];
+                NSData*  download_data = [NSData dataWithContentsOfURL:[NSURL URLWithString:appDelegate.downloadurl]];
+                dispatch_async(dispatch_get_main_queue(), ^{
                     
-                    ZipArchive* zip = [[ZipArchive alloc] init];
-                    NSString* unZipTo=[documents stringByAppendingPathComponent:@"download"];
-//                    NSFileManager* fileManager=[NSFileManager defaultManager];
-//                    [fileManager removeItemAtPath:unZipTo error:nil];
-//                    NSString *unZipTo = [temp stringByAppendingPathComponent:unziplocation];
-                    //
-                    //    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-                    //    NSString *documentPath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
-                    //NSString* zipFile = [documentPath stringByAppendingString:@"/images.zip"] ;
-                    // NSString* unZipTo = img_cache;//[documentPath stringByAppendingString:@"/images"] ;
-                    
-                    DebugLog(@"path: %@",unZipTo);
-                    if( [zip UnzipOpenFile:path Password:nil] ){
-                        BOOL result = [zip UnzipFileTo:unZipTo overWrite:YES];
-                        if( NO==result )
+                    [waitalert dismissViewControllerAnimated:false completion:^{
+                        if(download_data!=nil)
                         {
-                            //            int aaa=0;
-                            //解压失败
-                          
-                            [zip UnzipCloseFile];
-                            //文件损坏,删除文件重试
-                            
-                            
-                            NSFileManager* fileManager=[NSFileManager defaultManager];
-                            //debug
-                //            BOOL blDele= [fileManager removeItemAtPath:zipFile error:nil];
-                            [fileManager removeItemAtPath:path error:nil];
-                            [fileManager removeItemAtPath:unZipTo error:nil];
-                            
-                            [RAUtils message_alert:@"Can not unzip template file, please try download again." title:@"Warrning" controller:vc];
+                            NSString* file_name=[appDelegate.downloadurl lastPathComponent];
+                            NSString* path = [documents stringByAppendingPathComponent:file_name];
+                            [RAUtils saveData:download_data toPath:path];
                             
+                            ZipArchive* zip = [[ZipArchive alloc] init];
+                            NSString* unZipTo=[documents stringByAppendingPathComponent:@"download"];
+        //                    NSFileManager* fileManager=[NSFileManager defaultManager];
+        //                    [fileManager removeItemAtPath:unZipTo error:nil];
+        //                    NSString *unZipTo = [temp stringByAppendingPathComponent:unziplocation];
+                            //
+                            //    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+                            //    NSString *documentPath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
+                            //NSString* zipFile = [documentPath stringByAppendingString:@"/images.zip"] ;
+                            // NSString* unZipTo = img_cache;//[documentPath stringByAppendingString:@"/images"] ;
                             
+                            DebugLog(@"path: %@",unZipTo);
+                            if( [zip UnzipOpenFile:path Password:nil] ){
+                                BOOL result = [zip UnzipFileTo:unZipTo overWrite:YES];
+                                if( NO==result )
+                                {
+                                    //            int aaa=0;
+                                    //解压失败
+                                  
+                                    [zip UnzipCloseFile];
+                                    //文件损坏,删除文件重试
+                                    
+                                    
+                                    NSFileManager* fileManager=[NSFileManager defaultManager];
+                                    //debug
+                        //            BOOL blDele= [fileManager removeItemAtPath:zipFile error:nil];
+                                    [fileManager removeItemAtPath:path error:nil];
+                                    [fileManager removeItemAtPath:unZipTo error:nil];
+                                    
+                                    [RAUtils message_alert:@"Can not unzip template file, please try download again." title:@"Warrning" controller:vc];
+                                    
+                                    
+                                    
+                                    
+                                }
+                                else
+                                {
+                                    [zip UnzipCloseFile];
+                                    
+                                    
+                                    NSFileManager *fileManager = [NSFileManager defaultManager];
+                                    [fileManager removeItemAtPath:path error:nil];
+                                    [RAUtils message_alert:@"Update template file successful." title:@"Message" controller:vc];
+                                    
+        //                            [RADataProvider encrypt_scan_models];
+                                    NSMutableDictionary *templateDic = [NSMutableDictionary dictionary];
+                                    NSString* datetime= [RAUtils current_date_time];
+                                    templateDic[@"updatetime"]= datetime;
+                                    
+                                    
+                                    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
+                                    [userDefaults setValue:templateDic forKey:@"ScanTemplate"];
+                                    [userDefaults synchronize];
+                                    
+                                    
+                                    [RADataProvider load_scan_models];
+        //                            [self loadTemplate];
+                                    
+                                    
+                                }
+                                //[zip UnzipCloseFile];
+                            }
+                            else
+                            {
+                                //打开文件失败,通常是文件路径有问题或密码错误。
+                                [RAUtils message_alert:@"Can not unzip template file, please contact the Administrator." title:@"Warrning" controller:vc];
+                                
+                        //        NSFileManager *fileManager = [NSFileManager defaultManager];
+                        //        [fileManager removeItemAtPath:zipFile error:nil];
+                            }
                             
                             
+        //                    [iSalesDB cache_img:downloadimg_data filename:file_name saveTo:img_url];
+        //
+        //                    UIImage * img =[UIImage imageWithData:downloadimg_data];
+        //                    cell.imageView.image=img;
                         }
                         else
-                        {
-                            [zip UnzipCloseFile];
-                            
-                            
-                            NSFileManager *fileManager = [NSFileManager defaultManager];
-                            [fileManager removeItemAtPath:path error:nil];
-                            [RAUtils message_alert:@"Update template file successful." title:@"Message" controller:vc];
-                            
-//                            [RADataProvider encrypt_scan_models];
-                            NSMutableDictionary *templateDic = [NSMutableDictionary dictionary];
-                            NSString* datetime= [RAUtils current_date_time];
-                            templateDic[@"updatetime"]= datetime;
-                            
-                            
-                            NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
-                            [userDefaults setValue:templateDic forKey:@"ScanTemplate"];
-                            [userDefaults synchronize];
-                            
-                            
-                            [RADataProvider load_scan_models];
-//                            [self loadTemplate];
-                            
-                            
-                        }
-                        //[zip UnzipCloseFile];
-                    }
-                    else
-                    {
-                        //打开文件失败,通常是文件路径有问题或密码错误。
-                        [RAUtils message_alert:@"Can not unzip template file, please contact the Administrator." title:@"Warrning" controller:vc];
+                            [RAUtils message_alert:@"Can not update template file, you can update manually in the setting." title:@"Warrning" controller:vc];
+        //                    cell.imageView.image=[UIImage imageNamed:@"notfound_s"];
                         
-                //        NSFileManager *fileManager = [NSFileManager defaultManager];
-                //        [fileManager removeItemAtPath:zipFile error:nil];
-                    }
+                    }];
                     
                     
-//                    [iSalesDB cache_img:downloadimg_data filename:file_name saveTo:img_url];
-//
-//                    UIImage * img =[UIImage imageWithData:downloadimg_data];
-//                    cell.imageView.image=img;
-                }
-                else
-                    [RAUtils message_alert:@"Can not update template file, you can update manually in the setting." title:@"Warrning" controller:vc];
-//                    cell.imageView.image=[UIImage imageNamed:@"notfound_s"];
+                });
                 
             });
             
-        });
+            
+        }];
+        
         
+//        NSString* file_name=[appDelegate.downloadurl lastPathComponent];
+        
+    
         
 //        NSData* downloadimg_data = [NSData dataWithContentsOfURL:[NSURL URLWithString:appDelegate.downloadurl]];
 //        [RADataProvider downloadFileOffset:0 Param:nil from:appDelegate.downloadurl method:@"post" toPath:[documents stringByAppendingPathComponent:file_name] progressHandler:nil completionHandler:^(NSMutableDictionary *result) {