Ver Fonte

hmlg scan order 1.10,修复1.08,1.09测试发现的bug

Ray Zhang há 3 anos atrás
pai
commit
39a29381ff

+ 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 = 51261;
+				CURRENT_PROJECT_VERSION = 51285;
 				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.09;
+				MARKETING_VERSION = 1.10;
 				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 = 51261;
+				CURRENT_PROJECT_VERSION = 51285;
 				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.09;
+				MARKETING_VERSION = 1.10;
 				OTHER_LDFLAGS = (
 					"$(inherited)",
 					"-ObjC",

+ 1 - 1
RedAnt ERP Mobile/HMLG Scan Order.xcodeproj/xcuserdata/ruizhang.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -7,7 +7,7 @@
 		<key>HMLG Scan Order.xcscheme_^#shared#^_</key>
 		<dict>
 			<key>orderHint</key>
-			<integer>6</integer>
+			<integer>7</integer>
 		</dict>
 	</dict>
 </dict>

+ 3 - 2
RedAnt ERP Mobile/HMLG Scan Order/ScanListCell.m

@@ -248,11 +248,12 @@
     
     
 
-    
-    
+  
     
     
     NSString * mpack=_modelJson[@"stockUom"];
+    if([mpack isEqualToString:@"N/A"])
+        mpack=@"1";
     _modelJson[@"count"]=_modelJson[@"stockUom"];
     _modelJson[@"cuft"] = @([mpack intValue]* [unit_cuft doubleValue]);
     _modelJson[@"subtotal_price"] = @([mpack intValue]* [cell_price doubleValue]);

+ 1 - 1
RedAnt ERP Mobile/HMLG Scan Order/ScanOrderModelListViewController.m

@@ -73,7 +73,7 @@
 //            dimension = @"N/A";
         
         NSString * mpack=jitem[@"stockUom"];
-        if(mpack.length==0)
+        if(mpack.length==0||[mpack isEqualToString:@"N/A"])
             mpack = @"1";
         
         NSString * unit_cuft=jitem[@"unit_cuft"];

+ 1 - 1
RedAnt ERP Mobile/HMLG Scan Order/config.h

@@ -17,7 +17,7 @@
 #define RA_NOTIFICATION
 
 # ifdef DEBUG
-#define test_server
+//#define test_server
 # endif
 
 #define exception_switch 1

+ 2 - 1
RedAnt ERP Mobile/common/AES/AESCrypt.m

@@ -99,7 +99,8 @@
 }
 +(NSString *)AES128Decrypt:(NSString *)encryptText key:(NSString*) gkey
 {
-    
+    if(encryptText==nil)
+        return nil;
     NSString* gIv = nil;
     char keyPtr[kCCKeySizeAES128 + 1];
     memset(keyPtr, 0, sizeof(keyPtr));

+ 3 - 3
RedAnt ERP Mobile/common/Functions/OLO/ScanOrderListViewController.m

@@ -1743,7 +1743,7 @@
             }
             cell.labelprice.frame = price_frame;
             cell.label_so.text=so;
-            cell.labelprice.text=[RAConvertor currencyNumber:(price.floatValue)];//price;
+            cell.labelprice.text=price;//[RAConvertor currencyNumber:(price.floatValue)];//price;
             cell.label_date.text=purchase_time;
             cell.label_contact.text=customer_name;
             cell.label_model.hidden = false;
@@ -1956,8 +1956,8 @@
             NSMutableDictionary* orderitem =self.submit_content_data[indexPath.row];
             NSString* ordercode =orderitem[@"order_code"];
             
-                        NSString *orderdir = [OLDataProvider getScanOrderPath];
-            orderdir = [orderdir stringByAppendingPathComponent:ordercode];
+            NSString *orderdir = [OLDataProvider getScanOrderPathByCode:ordercode];
+//            orderdir = [orderdir stringByAppendingPathComponent:ordercode];
             NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
             CreateOrderViewController * orderinfoVC = [[CreateOrderViewController alloc] initWithNibName:@"CommonEditor.iPad" bundle:nil];
 

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

@@ -2533,7 +2533,7 @@
     
     
     NSString* subtotal = [RAConvertor currencyNumber:self.total];//[NSString stringWithFormat:@"$%@",];
-    NSString* subcuft = [NSString stringWithFormat:@"%.2f ft³",self.total_cuft];
+    NSString* subcuft = [NSString stringWithFormat:@"%.2f",self.total_cuft];
     NSString* subcarton = [NSString stringWithFormat:@"%d",self.total_carton];
     NSString* subweight = [NSString stringWithFormat:@"%.2f lbs",self.total_weight];
     NSString* surcharge = [RAConvertor currencyNumber:self.surcharge];//[NSString stringWithFormat:@"$%@",];
@@ -3811,7 +3811,7 @@
          //[self.itemListTable setEditing:false animated:YES];
         
         
-        UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Delete confirm" message:@"Are you sure remove model from cart?" preferredStyle:UIAlertControllerStyleAlert];
+        UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Confirm Deletion" message:@"Are you sure to delete this model?" preferredStyle:UIAlertControllerStyleAlert];
          
          
       

+ 1 - 0
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.h

@@ -168,4 +168,5 @@ typedef void(^resultHandler)(NSMutableDictionary *result);
 +(void) moveScanTemp2Order;
 +(void) guestLogin;
 +(NSString*) getScanOrderPath;
++(NSString*) getScanOrderPathByCode:(NSString*) order_code;
 @end

+ 45 - 1
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -2102,6 +2102,40 @@
         //        }
     }
 }
++(NSString*) getScanOrderPathByCode:(NSString*) order_code
+{
+    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+    NSString *documents = [paths objectAtIndex:0];
+    
+    NSDictionary *addressDic = [[NSUserDefaults standardUserDefaults] valueForKey:@"ScanAddress"];
+    
+    NSString* servername = addressDic[@"name"];
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    NSString* user = appDelegate.user;
+    NSString* orderpath = [documents stringByAppendingPathComponent:servername];
+    orderpath = [orderpath stringByAppendingPathComponent:user];
+    orderpath = [orderpath stringByAppendingPathComponent:order_code];
+    BOOL bdir=YES;
+    NSFileManager* fileManager = [NSFileManager defaultManager];
+    if(!  [fileManager fileExistsAtPath:orderpath isDirectory:&bdir])
+    {
+        
+        NSError *error = nil;
+        bool bsuccess=[fileManager createDirectoryAtPath:orderpath withIntermediateDirectories:YES attributes:nil error:&error];
+        
+        if(!bsuccess)
+            DebugLog(@"Create cache folder failed");
+        
+        //        if(bsuccess)
+        //        {
+        //            sqlite3 *db = [self get_db];
+        //
+        //            [self execSql:[NSString stringWithFormat:@"insert into img_cache(name) values('%@')",name] db:db];
+        //            [iSalesDB close_db:db];
+        //        }
+    }
+    return orderpath;
+}
 +(NSString*) getScanOrderPath
 {
     NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
@@ -2376,6 +2410,16 @@
 
         s+=msurcharge;
     }
+    
+    NSMutableDictionary* section =RASingleton.sharedInstance.scan_cart[@"section_0"];
+    int order_qty=0;
+    for(int c=0;c<[section[@"count"] intValue];c++)
+    {
+        NSDictionary* item = section[[NSString stringWithFormat:@"item_%d",c]];
+        order_qty+=[item[@"count"] intValue];
+        
+    }
+//    orderitem[@"model_count"] =[ NSString stringWithFormat:@"%@",order_qty];
 //    int newcount = 0;
     for(int i=0;i<count;i++)
     {
@@ -2383,7 +2427,7 @@
         if([item[@"order_code"] isEqualToString: order_code ])
         {
             item[@"price"] = [NSString stringWithFormat:@"%.2f",p+s];
-            item[@"model_count"] =[ NSString stringWithFormat:@"%@",RASingleton.sharedInstance.scan_cart[@"section_0"][@"count"] ];
+            item[@"model_count"] =[ NSString stringWithFormat:@"%d",order_qty];//RASingleton.sharedInstance.scan_cart[@"section_0"][@"count"] ];
             orderlist[[NSString stringWithFormat:@"item_%d",i]] = item;
         }
        

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

@@ -1485,6 +1485,7 @@
     NSMutableDictionary* orderitem = [NSMutableDictionary new];
     orderitem[@"create_by"] = appDelegate.user;
     orderitem[@"price"] = upparams[@"totalPrice"];
+//    NSString* 
     orderitem[@"customer_name"] = upparams[@"customer_contact"];
     orderitem[@"purchase_time"] = [RAUtils current_date_time];
     if(self.fail_submit)
@@ -1492,7 +1493,15 @@
     else
         orderitem[@"order_status"] = @"Saved Order";
     orderitem[@"order_code"] = appDelegate.order_code;
-    orderitem[@"model_count"] =[ NSString stringWithFormat:@"%@",RASingleton.sharedInstance.scan_cart[@"section_0"][@"count"] ];
+    NSMutableDictionary* section =RASingleton.sharedInstance.scan_cart[@"section_0"];
+    int order_qty=0;
+    for(int c=0;c<[section[@"count"] intValue];c++)
+    {
+        NSDictionary* item = section[[NSString stringWithFormat:@"item_%d",c]];
+        order_qty+=[item[@"count"] intValue];
+        
+    }
+    orderitem[@"model_count"] =[ NSString stringWithFormat:@"%d",order_qty];//RASingleton.sharedInstance.scan_cart[@"section_0"][@"count"] ];
     
     
     int count = [orderlist[@"count"] intValue];
@@ -1550,7 +1559,7 @@
 
         [self scanSave:upparams];
         
-        [RAUtils message_alert:@"Save Successful" title:@"Message" controller:self action_handler:^(UIAlertAction * _Nonnull action) {
+        [RAUtils message_alert:@"Save Successfully" title:@"Message" controller:self action_handler:^(UIAlertAction * _Nonnull action) {
             [self.navigationController popViewControllerAnimated:true];
         } completion:nil];
         return;
@@ -3547,7 +3556,9 @@
                     self.content_data_download[@"readonly"]=@1;
                 }
                 [self scanSave:upparams];
-                NSString* company = upparams[@"customer_name"];
+                NSString* company = upparams[@"customer_cid"];
+                if(company.length==0)
+                    company = upparams[@"customer_name"];
                 [OLDataProvider save2submitScanOrder:soid company:company];
                 [appDelegate closeOrder];
                 RASingleton.sharedInstance.scan_cart = nil;

+ 1 - 1
RedAnt ERP Mobile/iSales-CONTRAST.xcodeproj/xcuserdata/ruizhang.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -7,7 +7,7 @@
 		<key>iSales-CONTRAST.xcscheme_^#shared#^_</key>
 		<dict>
 			<key>orderHint</key>
-			<integer>1</integer>
+			<integer>8</integer>
 		</dict>
 		<key>iSales-USAI.xcscheme_^#shared#^_</key>
 		<dict>

+ 1 - 1
common/RAConvertor.h

@@ -24,6 +24,6 @@
 +(NSDictionary*) string2dict:(NSString*) str;
 +(NSString*) dict2string:(id) dict;
 +(NSString*) currencyNumber:(float) num;
-
++(NSString*) separateNumber:(float) num;
 
 @end

+ 23 - 0
common/RAConvertor.m

@@ -119,11 +119,32 @@ begin:
     NSArray *array = [NSKeyedUnarchiver unarchiveObjectWithData:data];
     return array;
 }
++(NSString*) separateNumber:(float) num
+{
+    NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
+    [formatter setNumberStyle:NSNumberFormatterDecimalStyle];
+    NSString *groupingSeparator = [[NSLocale currentLocale] objectForKey:NSLocaleGroupingSeparator];
+//    [formatter setCurrencySymbol:@"$"];
+    [formatter setGroupingSeparator:groupingSeparator];
+    [formatter setGroupingSize:3];
+    [formatter setAlwaysShowsDecimalSeparator:NO];
+    [formatter setUsesGroupingSeparator:YES];
+
+    
+    NSString *formattedString = [formatter stringFromNumber:[NSNumber numberWithFloat:num]];
+    return formattedString;
+}
+
 +(NSString*) currencyNumber:(float) num
 {
+    
+    
+    
+//    [self separateNumber:1234.56];
     NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
     [formatter setNumberStyle:NSNumberFormatterCurrencyStyle];
     NSString *groupingSeparator = [[NSLocale currentLocale] objectForKey:NSLocaleGroupingSeparator];
+    [formatter setCurrencySymbol:@"$"];
     [formatter setGroupingSeparator:groupingSeparator];
     [formatter setGroupingSize:3];
     [formatter setAlwaysShowsDecimalSeparator:NO];
@@ -132,6 +153,8 @@ begin:
     
     NSString *formattedString = [formatter stringFromNumber:[NSNumber numberWithFloat:num]];
     return formattedString;
+    
+
 }
 +(NSData*) dict2data:(NSDictionary*) dict
 {