Просмотр исходного кода

1.修改UWAVER Create Hang Tag。

Pen Li 7 лет назад
Родитель
Сommit
851c70a56a

+ 64 - 2
RedAnt ERP Mobile/common/Functions/modelDetail/DetailHeaderCell.m

@@ -22,6 +22,7 @@
 
 
 #import "ContentPreviewController.h"
 #import "ContentPreviewController.h"
 #import "DetailViewController.h"
 #import "DetailViewController.h"
+#import "RAPDFViewController.h"
 
 
 
 
 @implementation DetailHeaderCell
 @implementation DetailHeaderCell
@@ -94,8 +95,69 @@
 
 
 }
 }
 - (IBAction)create_HangTag:(id)sender {
 - (IBAction)create_HangTag:(id)sender {
-            UIViewController *vc= [RAUtils getViewController:self];
-    [RAUtils message_alert:@"" title:@"hang tag" controller:vc];
+    
+    DetailViewController *vc= (DetailViewController *)[RAUtils getViewController:self];
+    
+    NSString *catelog_name = [NSString stringWithFormat:@"%@ Hang Tag",vc.groupName];
+    
+    UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Processing"];
+    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+        
+        NSDictionary* editor_json = [RANetwork request_hangTag:vc.groupName];
+        
+        dispatch_async(dispatch_get_main_queue(), ^{
+            [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+            
+            
+            if([[editor_json valueForKey:@"result"] intValue]==2)
+            {
+                
+                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+                
+                NSString* url = [editor_json valueForKey:@"pdf_path"];
+                bool isLocalFile = [[editor_json valueForKey:@"isLocalFile"] boolValue];
+                RAPDFViewController *ViewController = [vc.storyboard instantiateViewControllerWithIdentifier:@"RAPDFViewController"];
+                ViewController.url = url;
+                ViewController.canSave = true;
+                ViewController.isLocalfile=isLocalFile;
+                
+                ViewController.filename = [NSString stringWithFormat:@"%@.pdf",[TextUtils legalFilename:catelog_name]];
+
+                
+                NSString* company=    [appDelegate.customerInfo valueForKey:@"customer_name"];
+                
+                if(company==nil)
+                    company=@"";
+                
+                NSString* customer_email=    [appDelegate.customerInfo valueForKey:@"customer_email"];
+                
+                
+                NSMutableArray* send_to = [[NSMutableArray alloc]init];
+                if(customer_email.length>0)
+                {
+                    send_to=[[customer_email componentsSeparatedByString:NSLocalizedString(@";", nil)] mutableCopy];
+                }
+                ViewController.mail_to = send_to;
+                
+                NSString* subject;
+                
+                subject =catelog_name;
+                
+                ViewController.mail_subject = subject;
+                
+                ViewController.hidenavi = false;
+                [vc.navigationController pushViewController:ViewController animated:YES];
+                
+            }
+            else
+            {
+                [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Create Hang Tag" controller:vc];
+            }
+            
+        });
+    });
+    
+    
 }
 }
 - (IBAction)add_toPortfolio:(id)sender {
 - (IBAction)add_toPortfolio:(id)sender {
     
     

+ 3 - 0
RedAnt ERP Mobile/common/Functions/modelDetail/DetailViewController.h

@@ -41,4 +41,7 @@
 
 
 @property (strong, nonatomic) IBOutlet UIActivityIndicatorView *mum;
 @property (strong, nonatomic) IBOutlet UIActivityIndicatorView *mum;
 -(void) reload;
 -(void) reload;
+
+@property (nonatomic,copy) NSString *groupName;///<UWAVER Group Name
+
 @end
 @end

+ 4 - 2
RedAnt ERP Mobile/common/Functions/modelDetail/DetailViewController.m

@@ -127,7 +127,7 @@ dispatch_async(dispatch_get_main_queue(), ^{
         dispatch_async(dispatch_get_main_queue(), ^{
         dispatch_async(dispatch_get_main_queue(), ^{
             [self.mum stopAnimating];
             [self.mum stopAnimating];
           
           
-            
+            self.groupName = nil;
             if([[detail_json valueForKey:@"result"] intValue]==2)
             if([[detail_json valueForKey:@"result"] intValue]==2)
             {
             {
                 
                 
@@ -240,7 +240,8 @@ dispatch_async(dispatch_get_main_queue(), ^{
 //                [appDelegate.recent_model setObject:item forKey:[NSString stringWithFormat:@"item_%d",count]];
 //                [appDelegate.recent_model setObject:item forKey:[NSString stringWithFormat:@"item_%d",count]];
 //                appDelegate.recent_model[@"count"]=[NSString stringWithFormat:@"%d",count+1];
 //                appDelegate.recent_model[@"count"]=[NSString stringWithFormat:@"%d",count+1];
 //                }
 //                }
-
+                
+                self.groupName = [detail_json objectForKey:@"groupName"];
             }
             }
             else
             else
                 if([[detail_json valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
                 if([[detail_json valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
@@ -1087,6 +1088,7 @@ self.isrefreshing=false;
 #else
 #else
         NSString *CellIdentifier = @"DetailHeaderCell";
         NSString *CellIdentifier = @"DetailHeaderCell";
         DetailHeaderCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
         DetailHeaderCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
+        cell.btn_hangtag.hidden = !appDelegate.bLogin;
 #endif
 #endif
         
         
         
         

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

@@ -184,4 +184,6 @@ extern NSString *const ScreenCodeOfflineSync;
 
 
 + (NSDictionary *)movetobackorder:(NSString *)cart_item_id;
 + (NSDictionary *)movetobackorder:(NSString *)cart_item_id;
 
 
++ (NSDictionary*)request_hangTag:(NSString *)group;
+
 @end
 @end

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

@@ -4555,4 +4555,46 @@ repeat:
     return @{@"result" : @(RESULT_FALSE)};
     return @{@"result" : @(RESULT_FALSE)};
 }
 }
 
 
++ (NSDictionary*)request_hangTag:(NSString *)group {
+    
+#ifdef URL_UWAVER
+    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    if(appDelegate.user!=nil)
+        [params setValue:appDelegate.user forKey:@"user"];
+    if(appDelegate.contact_id!=nil)
+        [params setValue:appDelegate.contact_id forKey:@"contactId"];
+    if(appDelegate.password!=nil)
+        [params setValue:appDelegate.password forKey:@"password"];
+    
+    if (group) {
+        [params setValue:group forKey:@"groupName"];
+    }
+    
+    [params setObject:ScreenCodeModelInfo forKey:kScreenName];
+    
+    NSData* json = nil;
+    if(appDelegate.offline_mode)
+    {
+        json = [OLDataProvider offline_portfolioList:params];
+    } else {
+        if(![self IsNetworkAvailable])
+            return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
+        
+        json = [self get_json:URL_CREATE_HANG_TAG parameters:params];
+    }
+    
+    
+    if(json==nil)
+        return nil;
+    NSError *error=nil;
+    NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+    int result = [[jsobj valueForKey:@"result"] intValue];
+    
+    return jsobj;
+#else
+    return nil;
+#endif
+}
+
 @end
 @end

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

@@ -52,6 +52,7 @@
 #ifdef test_server
 #ifdef test_server
 
 
 //------------------- chen server-----------------------
 //------------------- chen server-----------------------
+#define  URL_CREATE_HANG_TAG @"http://192.168.0.133:8080/site_uwa/isales_uwa/getUWAPriceTablePdf.htm"
 #define  URL_BACK_ORDER_PREVIEW  @"http://192.168.0.133:8080/site_uwa/isales_uwa/cartDeliveryBackOrderReview.htm"
 #define  URL_BACK_ORDER_PREVIEW  @"http://192.168.0.133:8080/site_uwa/isales_uwa/cartDeliveryBackOrderReview.htm"
 #define  URL_MOVE_TO_BACK_ORDER @"http://192.168.0.133:8080/site_uwa/isales_uwa/moveToBackOrder.htm"
 #define  URL_MOVE_TO_BACK_ORDER @"http://192.168.0.133:8080/site_uwa/isales_uwa/moveToBackOrder.htm"
 
 
@@ -316,6 +317,8 @@
 
 
 #define  URL_BACK_ORDER_PREVIEW  @"https://central.united-us.com/demo/shopping/isales_uwa/cartDeliveryBackOrderReview.htm"
 #define  URL_BACK_ORDER_PREVIEW  @"https://central.united-us.com/demo/shopping/isales_uwa/cartDeliveryBackOrderReview.htm"
 
 
+#define  URL_CREATE_HANG_TAG @"https://central.united-us.com/demo/shopping/isales_uwa/getUWAPriceTablePdf.htm"
+
 #endif
 #endif
 
 
 #endif
 #endif