Эх сурвалжийг харах

HMLG scan order 1.26
bug fix

Ray Zhang 3 жил өмнө
parent
commit
e09a37ed8a

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

@@ -2519,7 +2519,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				CURRENT_PROJECT_VERSION = 51890;
+				CURRENT_PROJECT_VERSION = 51921;
 				DEVELOPMENT_TEAM = HXWLAA5YN5;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -2536,7 +2536,7 @@
 					"$(PROJECT_DIR)/ScanApiSDK-10.2.227-2/lib",
 					"$(PROJECT_DIR)/GoogleAnalytics/GoogleAnalytics/Libraries",
 				);
-				MARKETING_VERSION = 1.25;
+				MARKETING_VERSION = 1.26;
 				OTHER_LDFLAGS = (
 					"$(inherited)",
 					"-ObjC",
@@ -2563,7 +2563,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				CURRENT_PROJECT_VERSION = 51890;
+				CURRENT_PROJECT_VERSION = 51921;
 				DEVELOPMENT_TEAM = HXWLAA5YN5;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -2580,7 +2580,7 @@
 					"$(PROJECT_DIR)/ScanApiSDK-10.2.227-2/lib",
 					"$(PROJECT_DIR)/GoogleAnalytics/GoogleAnalytics/Libraries",
 				);
-				MARKETING_VERSION = 1.25;
+				MARKETING_VERSION = 1.26;
 				OTHER_LDFLAGS = (
 					"$(inherited)",
 					"-ObjC",

+ 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

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

@@ -1871,14 +1871,17 @@
             AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
             
             
-            NSString *orderdir = [OLDataProvider getScanPath];
+//            NSString *orderdir = [OLDataProvider getScanPath];
+            NSString *userdir = [OLDataProvider getUserPath];
+            NSMutableDictionary* orderitem =self.content_data[indexPath.row];
+            NSString* ordercode =orderitem[@"order_code"];
+            NSString *orderdir = [userdir stringByAppendingPathComponent:ordercode];
             //        NSMutableDictionary* order= [[RAUtils dictfromfile:[orderdir stringByAppendingPathComponent:@"order.json"]] mutableCopy];
             NSMutableDictionary* cart= [[RAUtils dictfromfile:[orderdir stringByAppendingPathComponent:@"cart.json"]] mutableCopy];
             
             if([appDelegate.available_price_group containsObject:cart[@"price_group"]] && [RADataProvider all_price_group][cart[@"price_group"]]!=nil)
             {
-                NSMutableDictionary* orderitem =self.content_data[indexPath.row];
-                NSString* ordercode =orderitem[@"order_code"];
+
                 appDelegate.order_code = ordercode;
                 
                 [appDelegate setUser:orderitem[@"create_by"]];
@@ -1935,8 +1938,8 @@
             {
                 //价格组不存在 询问刷新
                 
-                NSString * title =@"Price has changes";
-                NSString* message = @"Continue open order will replace all price with new setting";
+                NSString * title =@"Price Has Changed";
+                NSString* message = @"Shopping cart items will show updated prices. ";
                 UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
                 //block代码块取代了delegate
                 
@@ -1992,7 +1995,7 @@
                     
                     
         #ifdef RA_NOTIFICATION
-                    [ActiveViewController Notify:@"CartViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
+                    [ActiveViewController Notify:@"CartViewController" Message:RA_NOTIFICATION_CART_REFRESH];
         #else
                     
                     
@@ -2009,7 +2012,7 @@
 
                 }];
                 
-                UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
+                UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Close" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
                     DebugLog(@"Cancel");
                     return;
                 }];

+ 1 - 1
RedAnt ERP Mobile/common/Functions/camscan/ScannerViewController.m

@@ -243,7 +243,7 @@
     {
 //        self.scan_val = @"[[\"1111\",\"name0\",\"description\",\"10.1 X 20.2 X 30.3\",\"2\",\"12.34\",\"VIET\",\"VCSF\",\"May\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\"],[\"2222\",\"name1\",\"description\",\"10.1 X 20.2 X 30.3\",\"2\",\"12.34\",\"VIET\",\"VCSF\",\"May\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\"]]";
         
-        self.scan_val =@"[\"1430K-1CK*\",\"1430K-1EK*\",\"1000A70WH\",\"1002A70BK\"]";// @"[\"1002A70BK\"]";// 
+        self.scan_val =@"[\"1430K-1CK*\",\"1430K-1EK*\",\"5477N-40\",\"1002A70BK\"]";// @"[\"1002A70BK\"]";// 
         [self addtocart];
     }
 

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

@@ -1770,6 +1770,7 @@
     UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Change Price Type" message:nil preferredStyle:UIAlertControllerStyleAlert];
     UIAlertAction *action1 = [UIAlertAction actionWithTitle:price_group[@"price_0"][@"display"] style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
 
+        self.btnBulkDiscount.hidden = true;
 //        self.btnPrice.titleLabel.text = @"FOB CTNR";
         [self.btnPrice setTitle: price_group[@"price_0"][@"display"] forState:UIControlStateNormal];
         RASingleton.sharedInstance.price_type=0;
@@ -1778,9 +1779,11 @@
             for(int i=0;i<count;i++)
             {
                 NSMutableDictionary* item = [section[[NSString stringWithFormat:@"item_%d",i]] mutableCopy];
-                item[@"price"]= item[@"price0"];
-                item[@"unit_price"]= item[@"price0"];
-                item[@"erp_unit_price"]= item[@"price0"];
+                item[@"price"]=item[ price_group[@"price_0"][@"name"]];
+                item[@"unit_price"]= item[price_group[@"price_0"][@"name"]];
+                item[@"erp_unit_price"]= item[price_group[@"price_0"][@"name"]];
+                item[@"discount"]=@(0);
+                item[@"note"]=@"";
                 section[[NSString stringWithFormat:@"item_%d",i]] = item;
             }
         RASingleton.sharedInstance.scan_cart[@"section_0"]  = section;
@@ -1793,6 +1796,7 @@
     }];
     UIAlertAction *action2 = [UIAlertAction actionWithTitle:price_group[@"price_1"][@"display"] style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
 
+        self.btnBulkDiscount.hidden = false;
         [self.btnPrice setTitle: price_group[@"price_1"][@"display"] forState:UIControlStateNormal];
         RASingleton.sharedInstance.price_type=1;
         NSMutableDictionary* section = [RASingleton.sharedInstance.scan_cart[@"section_0"] mutableCopy];
@@ -1804,14 +1808,14 @@
                 NSString * unit_price;
    
                 if(item [@"net_price"])
-                    unit_price=item[@"price3"];
+                    unit_price=item[price_group[@"price_3"][@"name"]];
                 else if(item [@"special_price"])
                 {
-                    unit_price= item[@"price2"];
+                    unit_price= item[price_group[@"price_2"][@"name"]];
                 }
                 else
                 {
-                    unit_price= item[@"price1"];
+                    unit_price= item[price_group[@"price_1"][@"name"]];
                 }
 
                 if([unit_price isEqualToString:@"N/A"])
@@ -1849,8 +1853,8 @@
             for(int i=0;i<count;i++)
             {
                 NSMutableDictionary* item = [section[[NSString stringWithFormat:@"item_%d",i]] mutableCopy];
-                item[@"price"]= item[@"price2"];
-                item[@"unit_price"]= item[@"price2"];
+                item[@"price"]= item[price_group[@"price_2"][@"name"]];
+                item[@"unit_price"]= item[price_group[@"price_2"][@"name"]];
                 section[[NSString stringWithFormat:@"item_%d",i]] = item;
             }
         RASingleton.sharedInstance.scan_cart[@"section_0"]  = section;
@@ -3808,7 +3812,7 @@
     };
  //   cell.delegate=self;
  //   cell.from=indexPath;
-    
+    NSDictionary* price_group = [RADataProvider get_price_group:appDelegate.price_group];
     
     if(RASingleton.sharedInstance.price_type==1&&([item_json[@"net_price"] boolValue]||[item_json[@"special_price"] boolValue]||discount>0))
     {
@@ -3818,7 +3822,7 @@
             cell.labelOldPrice.hidden = false;
 //            if([item_json[@"special_price"] boolValue])
 //            {
-            cell.labelOldPrice.text=[RAConvertor currencyNumber:[item_json[@"price1"] doubleValue]];//[NSString stringWithFormat:@"%.2f",[item_json[@"price1"] doubleValue]];
+            cell.labelOldPrice.text=[RAConvertor currencyNumber:[item_json[price_group[@"price_1"][@"name"]] doubleValue]];//[NSString stringWithFormat:@"%.2f",[item_json[@"price1"] doubleValue]];
 //            }
 //            else
 //            {

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

@@ -3012,7 +3012,7 @@ if(stockUom==0)
     
     NSString *cartpath = [orderdir stringByAppendingPathComponent:@"cart.json"];
     
-    
+    cart[@"price_group"] = appDelegate.price_group;
     
     [RAUtils dicttofile:cartpath dict:cart];
 }

+ 4 - 1
RedAnt ERP Mobile/common/NotificationNameCenter.h

@@ -33,7 +33,10 @@ UIKIT_EXTERN  NSString  *RA_NOTIFICATION_CLEAR_DATA;///<清空数据
 //UIKIT_EXTERN  NSString  *RA_NOTIFICATION_SHOW_PRICE;///<隐藏价格
 //UIKIT_EXTERN  NSString  *RA_NOTIFICATION_HIDE_PRICE;///<显示价格
 UIKIT_EXTERN  NSString  *RA_NOTIFICATION_UPDATE_PRICE;///<刷新价格显示
-
+///<
+///<
+///<
+UIKIT_EXTERN  NSString  *RA_NOTIFICATION_CART_REFRESH; // 刷新购物车价格组 -- scan order app
 //UIKIT_EXTERN  NSString  *RA_NOTIFICATION_SCANNER_DECODE;///<扫码返回结果
 
 

+ 1 - 0
RedAnt ERP Mobile/common/data_provider/RADataProvider.m

@@ -435,6 +435,7 @@ NSDate * ddate =[dateFormatter dateFromString:@"2022-07-27"];
 //
         NSMutableDictionary* pg = [self all_price_group];
         appDelegate.price_group=pg[@"default"];
+        appDelegate.available_price_group = @[appDelegate.price_group];
       
     }
     

+ 5 - 0
RedAnt ERP Mobile/common/data_provider/RANetwork.m

@@ -10399,6 +10399,11 @@ NSString *const ScreenCodeOfflineSync = @"Offline Sync Screen";
 //
 //
 //        [appDelegate update_count_mark];
+    if(RASingleton.sharedInstance.price_type==0)
+    {
+        result(RASingleton.sharedInstance.scan_cart);
+        return;
+    }
 NSMutableDictionary* section = [RASingleton.sharedInstance.scan_cart[@"section_0"] mutableCopy];
     int count = [section[@"count"] intValue];
     for(int i=0;i<count;i++)

+ 2 - 0
common/RAUtils.m

@@ -78,6 +78,8 @@
 
 +(NSDictionary* )copyDict:(NSDictionary* ) source
 {
+    if(source==nil)
+        return nil;
     return [RAConvertor data2dict:[RAConvertor dict2data:source]];
 }
 

+ 2 - 2
common/customUI/commoneditor/CommonEditorViewController.m

@@ -30,7 +30,7 @@
 #import "CommonEditorCellImg.h"
 #import "RAConvertor.h"
 
-//#import "AFHTTPSessionManager.h"
+
 //#import "NetworkUtils.h"
 #import "config.h"
 #import "CustomIOSAlertView.h"
@@ -6177,7 +6177,7 @@ if(!self.alert.isBeingDismissed)
     if([item_json[@"autocomplete"] boolValue])
     {
         self.autocompleteView.hidden = true;
-        self.autocompleteView.params = nil;
+//        self.autocompleteView.params = nil;
     }
     [self textfieldSetValue:indexPath value:textField.text];
     //    NSMutableDictionary* section_json=nil;

+ 30 - 12
common/customUI/commoneditor/CommonEditorWebCell.m

@@ -8,7 +8,9 @@
 
 #import "CommonEditorWebCell.h"
 
-@interface CommonEditorWebCell() <UIWebViewDelegate>
+//@interface CommonEditorWebCell() <UIWebViewDelegate>
+
+@interface CommonEditorWebCell() <WKNavigationDelegate>
 
 @end
 
@@ -48,6 +50,11 @@
     self.webview.scrollView.bounces=NO;
     self.webview.scrollView.directionalLockEnabled = true;
     
+    self.webview.navigationDelegate = self;
+    if (@available(iOS 11, *)) {
+        self.webview.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
+    }
+    
 //    [self addObserver:self forKeyPath:@"self.webview.scrollView.frame" options:NSKeyValueObservingOptionNew context:nil];
 }
 
@@ -63,21 +70,32 @@
     
     
 //    return;
-    NSString *h_str = [self.webview stringByEvaluatingJavaScriptFromString:@"document.body.scrollHeight;"];
-    float h = [h_str floatValue];
+    [self.webview evaluateJavaScript:@"document.body.scrollHeight;" completionHandler:^(id _Nullable fitHeight, NSError * _Nullable error) {
+//        NSString *h_str = [self.webview stringByEvaluatingJavaScriptFromString:@"document.body.scrollHeight;"];
+        
+        NSString *h_str =fitHeight;
+        float h = [h_str floatValue];
+        
+        if (self.webDelegate) {
+            [self.webDelegate commonEditorWebCell:self didChangeContentHeight:h];
+        }
+    }];
     
-    if (self.webDelegate) {
-        [self.webDelegate commonEditorWebCell:self didChangeContentHeight:h];
-    }
-}
 
-- (void)webViewDidFinishLoad:(UIWebView *)webView {
-    
+}
+- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
+{
     [self updateContentHeight];
+        
+    
 }
-
-- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
+//- (void)webViewDidFinishLoad:(UIWebView *)webView {
+//    
 //    [self updateContentHeight];
-}
+//}
+
+//- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
+////    [self updateContentHeight];
+//}
 
 @end