Browse Source

1.修改NPD Cart,增加Move To Back Order。

Pen Li 8 năm trước cách đây
mục cha
commit
11291be8cf

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

@@ -2528,6 +2528,37 @@
     noteRowAction.backgroundColor = [UIColor lightGrayColor];
 
 
+    UITableViewRowAction *move2BackAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Move to Back Order" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
+        
+        NSDictionary *item_json = [self itemJsonAtIndexPath:indexPath];
+        NSString* cart_item_id = [item_json valueForKey:@"cart_item_id"];
+        
+        
+        UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Move To Back Order"];
+        
+        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+            
+            NSDictionary* return_json = [RANetwork movetobackorder:cart_item_id];
+            
+            dispatch_async(dispatch_get_main_queue(), ^{
+                
+                [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+                
+                if([[return_json valueForKey:@"result"] intValue]==2) {
+                    
+                    [self reload_data];
+                    
+                } // if 2
+                else {
+                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Move To Back Order" controller:self] ;
+                }
+                
+            }); // main
+            
+        }); // global
+        
+        
+    }];
     
     
     
@@ -2554,6 +2585,14 @@
         if (condition) {
             [arr addObject:notifyMeAction];
         }
+
+        NSDictionary *section_json = [self jsonAtSection:indexPath.section];
+        BOOL available = [[section_json objectForKey:@"available"] boolValue]; // available list
+        
+        if (self.back_order_flag && available) {
+            [arr addObject:move2BackAction];
+        }
+        
 #endif
         
 #if defined(BUILD_HOMER) || defined(BUILD_GATIT)

+ 16 - 0
RedAnt ERP Mobile/common/Functions/order/RAOrderEditorViewController.m

@@ -13,6 +13,7 @@
 #import "CreditCardEditorViewController.h"
 #import "JKTimerManager.h"
 #import "RAOrderPreviewController.h"
+#import "CommonEditorCellModel.h"
 
 
 
@@ -429,6 +430,21 @@ static const int totalPage = 3;
 
 #pragma mark - Override
 
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+    
+    UITableViewCell *cell = [super tableView:tableView cellForRowAtIndexPath:indexPath];
+    
+    NSDictionary* item_json =((NSMutableArray*)self.content_data_control[indexPath.section])[indexPath.row];
+    NSString* control = [item_json valueForKey:@"control"];
+    
+    if([control isEqualToString:@"model"]) {
+        ((CommonEditorCellModel *)cell).avalibilityLabel.hidden = YES;
+    }
+    
+    return cell;
+    
+}
+
 - (void)download_success {
     
     NSString *title = [self.content_data_download objectForKey:@"title"];

+ 2 - 0
RedAnt ERP Mobile/common/data_provider/RANetwork.h

@@ -182,4 +182,6 @@ extern NSString *const ScreenCodeOfflineSync;
 
 + (NSDictionary *)quoteWishlist2EmailAddr:(NSString *)addr;
 
++ (NSDictionary *)movetobackorder:(NSString *)cart_item_id;
+
 @end

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

@@ -4513,4 +4513,40 @@ repeat:
     return @{@"result" : @(RESULT_FALSE)};
 }
 
++ (NSDictionary *)movetobackorder:(NSString *)cart_item_id {
+    
+    if (cart_item_id == nil || cart_item_id.length < 1) {
+        return @{@"result" : @(RESULT_FALSE),@"err_msg" : @"invalided product"};
+    }
+    
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    
+    NSMutableDictionary* dic = [[NSMutableDictionary alloc] init];
+    if(appDelegate.user!=nil)
+        [dic setValue:appDelegate.user forKey:@"user"];
+    
+    if(appDelegate.password!=nil)
+        [dic setValue:appDelegate.password forKey:@"password"];
+    
+    [dic setValue:cart_item_id forKey:@"orderitem_id"];
+    [dic setValue:appDelegate.order_code forKey:@"order_code"];
+    
+    [dic setObject:ScreenCodeCart forKey:kScreenName];
+    
+    if(![self IsNetworkAvailable])
+        return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
+    
+    NSData *json = [RANetwork get_json:URL_MOVE_TO_BACK_ORDER parameters:dic];
+    
+    if(json!=nil)
+    {
+        NSError *error=nil;
+        NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+        
+        return jsobj;
+    }
+    
+    return @{@"result" : @(RESULT_FALSE)};
+}
+
 @end

+ 18 - 0
RedAnt ERP Mobile/iSales-NPD.xcodeproj/project.pbxproj

@@ -26,6 +26,8 @@
 		4289805D1E249375005F1BD8 /* UIColor+JK_HEX.m in Sources */ = {isa = PBXBuildFile; fileRef = 4289805C1E249375005F1BD8 /* UIColor+JK_HEX.m */; };
 		428980721E24B1E9005F1BD8 /* Singleton.m in Sources */ = {isa = PBXBuildFile; fileRef = 428980711E24B1E9005F1BD8 /* Singleton.m */; };
 		4289809E1E24B526005F1BD8 /* JKTimerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4289809D1E24B526005F1BD8 /* JKTimerManager.m */; };
+		4295AE1C1FE74D46007BE365 /* CommonEditorAutoCompleteView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4295AE1A1FE74D46007BE365 /* CommonEditorAutoCompleteView.m */; };
+		4295AE1D1FE74D46007BE365 /* CommonEditorAutoCompleteView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4295AE1B1FE74D46007BE365 /* CommonEditorAutoCompleteView.xib */; };
 		42969C021D52F31C00FF190A /* editContact.json in Resources */ = {isa = PBXBuildFile; fileRef = 42969C011D52F31C00FF190A /* editContact.json */; };
 		42A225331D6E7D1D00235B62 /* placeOrderTemplate.json in Resources */ = {isa = PBXBuildFile; fileRef = 42A225321D6E7D1D00235B62 /* placeOrderTemplate.json */; };
 		42A51BF41D62F60300F13667 /* more_info.html in Resources */ = {isa = PBXBuildFile; fileRef = 42A51BF31D62F60300F13667 /* more_info.html */; };
@@ -324,6 +326,9 @@
 		428980711E24B1E9005F1BD8 /* Singleton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Singleton.m; path = common/Singleton.m; sourceTree = SOURCE_ROOT; };
 		4289809C1E24B526005F1BD8 /* JKTimerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JKTimerManager.h; sourceTree = "<group>"; };
 		4289809D1E24B526005F1BD8 /* JKTimerManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JKTimerManager.m; sourceTree = "<group>"; };
+		4295AE191FE74D46007BE365 /* CommonEditorAutoCompleteView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommonEditorAutoCompleteView.h; path = ../../common/customUI/commoneditor/CommonEditorAutoCompleteView.h; sourceTree = "<group>"; };
+		4295AE1A1FE74D46007BE365 /* CommonEditorAutoCompleteView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CommonEditorAutoCompleteView.m; path = ../../common/customUI/commoneditor/CommonEditorAutoCompleteView.m; sourceTree = "<group>"; };
+		4295AE1B1FE74D46007BE365 /* CommonEditorAutoCompleteView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = CommonEditorAutoCompleteView.xib; path = ../../common/customUI/commoneditor/CommonEditorAutoCompleteView.xib; sourceTree = "<group>"; };
 		42969C011D52F31C00FF190A /* editContact.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = editContact.json; sourceTree = "<group>"; };
 		42A225321D6E7D1D00235B62 /* placeOrderTemplate.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = placeOrderTemplate.json; sourceTree = "<group>"; };
 		42A51BF31D62F60300F13667 /* more_info.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = more_info.html; sourceTree = "<group>"; };
@@ -904,6 +909,16 @@
 			path = common/JKTimer;
 			sourceTree = SOURCE_ROOT;
 		};
+		4295AE181FE74D26007BE365 /* AutoComplete */ = {
+			isa = PBXGroup;
+			children = (
+				4295AE191FE74D46007BE365 /* CommonEditorAutoCompleteView.h */,
+				4295AE1A1FE74D46007BE365 /* CommonEditorAutoCompleteView.m */,
+				4295AE1B1FE74D46007BE365 /* CommonEditorAutoCompleteView.xib */,
+			);
+			name = AutoComplete;
+			sourceTree = "<group>";
+		};
 		42BEAB2D1FA1D23A0024D647 /* EnumSelectAndSort */ = {
 			isa = PBXGroup;
 			children = (
@@ -1828,6 +1843,7 @@
 		71DF74311C5757C800F2789C /* CommonUI */ = {
 			isa = PBXGroup;
 			children = (
+				4295AE181FE74D26007BE365 /* AutoComplete */,
 				42D3A4981EFA6D36007A54C1 /* PhotoList */,
 				71BF32FA1EFA1C0700842CB4 /* youtube player */,
 				4289800E1E24924D005F1BD8 /* sort */,
@@ -2003,6 +2019,7 @@
 				718E71091DE7CEA20035D1FF /* so.json in Resources */,
 				42A225331D6E7D1D00235B62 /* placeOrderTemplate.json in Resources */,
 				7141DD3D1C5726B700F7DF59 /* softScanBeep.wav in Resources */,
+				4295AE1D1FE74D46007BE365 /* CommonEditorAutoCompleteView.xib in Resources */,
 				7141DD341C57269B00F7DF59 /* include in Resources */,
 				7141DD601C5747CE00F7DF59 /* LICENSE in Resources */,
 				71D01ADD1E08CB1C006620CE /* signature.storyboard in Resources */,
@@ -2147,6 +2164,7 @@
 				7162A59C1C58733400AB630E /* OrderDetailPriceCell.m in Sources */,
 				715850461CF6F0E500856B20 /* DefaultAppearance.m in Sources */,
 				71DF74301C57572600F2789C /* RAUtils.m in Sources */,
+				4295AE1C1FE74D46007BE365 /* CommonEditorAutoCompleteView.m in Sources */,
 				7162A5B61C58738600AB630E /* SCShapeView.m in Sources */,
 				71CB70751F99DF02009FDCB7 /* FileCache.m in Sources */,
 				7162A54A1C58719D00AB630E /* RATreeView+UIScrollView.m in Sources */,

+ 3 - 0
RedAnt ERP Mobile/iSales-NPD/config.h

@@ -48,6 +48,7 @@
 
 //------------------- chen server-----------------------
 #define  URL_BACK_ORDER_PREVIEW  @"http://192.168.0.133:8080/site/isales/cartDeliveryBackOrderReview.htm"
+#define  URL_MOVE_TO_BACK_ORDER @"http://192.168.0.133:8080/site/isales/moveToBackOrder.htm"
 
 #define  URL_UPDATE_AUTH  @"http://192.168.0.133:8080/site/isales/login.htm"
 #define  URL_LOGOUT  @"http://192.168.0.133:8080/site/isales/loginOut.htm"
@@ -306,6 +307,8 @@
 
 #define URL_BLOG @"https://www.newpacificdirect.com/blog"
 
+#define  URL_MOVE_TO_BACK_ORDER @"https://www.newpacificdirect.com/isales/moveToBackOrder.htm"
+
 #define  URL_BACK_ORDER_PREVIEW  @"https://www.newpacificdirect.com/isales/cartDeliveryBackOrderReview.htm"
 
 #endif