فهرست منبع

修改UWA category,category menu,categoryfilter等功能,把category 替换为 collections
新增ERP Mobile model detail数据访问接口,并修改相关调用。
新增ERP Mobile search数据访问接口,并修改相关调用。
新增ERP Mobile search数据访问接口,相关调用还没有加上。

Ray Zhang 6 سال پیش
والد
کامیت
8fc5ce8acb

+ 1 - 1
Apex Mobile/Apex Mobile/RANetwork.m

@@ -1822,7 +1822,7 @@
     //        return RESULT_NET_ERROR;
     
     
-    __block long ver = 0;
+     long ver = 0;
     NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
     
 

+ 12 - 12
RedAnt ERP Mobile/common/ERP_Mobile_Search.storyboard

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
     <device id="ipad9_7" orientation="portrait" layout="fullscreen" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15510"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -396,7 +396,7 @@
                                         </connections>
                                     </button>
                                     <label hidden="YES" opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0 Items" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ut9-y4-tAP">
-                                        <rect key="frame" x="15" y="12" width="180" height="21"/>
+                                        <rect key="frame" x="15" y="11.5" width="180" height="21"/>
                                         <constraints>
                                             <constraint firstAttribute="width" constant="180" id="4RW-YO-WMw"/>
                                             <constraint firstAttribute="height" constant="21" id="R6W-E6-hpr"/>
@@ -481,13 +481,13 @@
                                 </items>
                             </toolbar>
                             <label hidden="YES" opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Cannot get data from server.
Tap to try again." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9wz-xR-dz8">
-                                <rect key="frame" x="262" y="489" width="244" height="46"/>
+                                <rect key="frame" x="262" y="489.5" width="244" height="45.5"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="19"/>
                                 <color key="textColor" red="0.33333333329999998" green="0.33333333329999998" blue="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <nil key="highlightedColor"/>
                             </label>
                             <activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" animating="YES" style="whiteLarge" translatesAutoresizingMaskIntoConstraints="NO" id="G9n-cr-BZw">
-                                <rect key="frame" x="366" y="494" width="37" height="37"/>
+                                <rect key="frame" x="365.5" y="493.5" width="37" height="37"/>
                                 <color key="color" red="0.59999999999999998" green="0.40000000000000002" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                             </activityIndicatorView>
                         </subviews>
@@ -882,7 +882,7 @@
                                         <nil key="highlightedColor"/>
                                     </label>
                                     <label hidden="YES" opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0 Items" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="91B-3m-MPI">
-                                        <rect key="frame" x="356" y="12" width="57" height="21"/>
+                                        <rect key="frame" x="355.5" y="11.5" width="57" height="21"/>
                                         <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                         <color key="textColor" red="0.59999999999999998" green="0.40000000000000002" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                         <nil key="highlightedColor"/>
@@ -1015,13 +1015,13 @@
                                 </items>
                             </toolbar>
                             <label hidden="YES" opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Cannot get data from server.
Tap to try again." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="423-YP-V6q">
-                                <rect key="frame" x="262" y="489" width="244" height="46"/>
+                                <rect key="frame" x="262" y="489.5" width="244" height="45.5"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="19"/>
                                 <color key="textColor" red="0.33333333329999998" green="0.33333333329999998" blue="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <nil key="highlightedColor"/>
                             </label>
                             <activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="whiteLarge" translatesAutoresizingMaskIntoConstraints="NO" id="wIZ-01-YqU">
-                                <rect key="frame" x="366" y="494" width="37" height="37"/>
+                                <rect key="frame" x="365.5" y="493.5" width="37" height="37"/>
                                 <color key="color" red="0.59999999999999998" green="0.40000000000000002" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                             </activityIndicatorView>
                         </subviews>
@@ -1713,7 +1713,7 @@
                                         </connections>
                                     </button>
                                     <label hidden="YES" opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="99999 Items" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hzj-7S-cNi">
-                                        <rect key="frame" x="425" y="12" width="100" height="21"/>
+                                        <rect key="frame" x="425" y="11.5" width="100" height="21"/>
                                         <constraints>
                                             <constraint firstAttribute="width" constant="100" id="Tf2-xl-Dkl"/>
                                             <constraint firstAttribute="height" constant="21" id="iGr-lq-P56"/>
@@ -1723,7 +1723,7 @@
                                         <nil key="highlightedColor"/>
                                     </label>
                                     <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Category&gt;some type&gt;some subtype" lineBreakMode="headTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LHu-yy-RWe">
-                                        <rect key="frame" x="8" y="12" width="397" height="21"/>
+                                        <rect key="frame" x="8" y="11.5" width="397" height="21"/>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="21" id="qig-MF-8ue"/>
                                         </constraints>
@@ -1847,11 +1847,11 @@
                                 </items>
                             </toolbar>
                             <activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" animating="YES" style="whiteLarge" translatesAutoresizingMaskIntoConstraints="NO" id="WTH-xD-Oln">
-                                <rect key="frame" x="366" y="494" width="37" height="37"/>
+                                <rect key="frame" x="365.5" y="493.5" width="37" height="37"/>
                                 <color key="color" red="0.59999999999999998" green="0.40000000000000002" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                             </activityIndicatorView>
                             <label hidden="YES" opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Cannot get data from server.
Tap to try again." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CYf-aH-yiE">
-                                <rect key="frame" x="262" y="489" width="244" height="46"/>
+                                <rect key="frame" x="262" y="489.5" width="244" height="45.5"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="19"/>
                                 <color key="textColor" red="0.33333333329999998" green="0.33333333329999998" blue="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <nil key="highlightedColor"/>

+ 6 - 18
RedAnt ERP Mobile/common/Functions/MainViewController.m

@@ -1138,21 +1138,12 @@
     
 }
 - (void)switchToItemSearch:(NSString* )coverttype {
-    //    NSString* ttt =[@"Category" stringByAppendingString:[self categoryString:categoryid node:self.categoryMenu level:0]];
-    
-    
-    //  UIApplication * app = [UIApplication sharedApplication];
-    //  AppDelegate *appDelegate = (AppDelegate *)[app delegate];
+
     
     self.itemSearchViewController.default_filter = nil;
     self.itemSearchViewController.covertype = coverttype;
     self.itemSearchViewController.saved_covertype = coverttype;
     
-//    self.categoryViewController.p_available = nil;
-//    self.categoryViewController.p_price = nil;
-//    self.categoryViewController.p_QTY = nil;
-//    self.categoryViewController.p_bestseller = nil;
-//    [self.itemSearchViewController reload_container_getdata:true];
     
     
     self.itemSearchViewController.p_available = nil;
@@ -1165,12 +1156,6 @@
     [self.itemSearchViewController reload_container_getdata:true];
 #endif
     
-    //    .categoryString = [@"Category" stringByAppendingString:[self categoryString:categoryid node:appDelegate.categoryMenu level:0]];
-    //    self.categoryViewController.cagegoryLabel.text =self.categoryViewController.categoryString;
-    //    //   NSString* sss =[@"Category" stringByAppendingString:[self categoryString:categoryid node:appDelegate.categoryMenu level:0]];
-    //    self.categoryViewController.categoryid = categoryid ;
-    //    [self.itemSearchViewController reload];
-    //    [self.itemSearchViewController showCategory];
     if([self.current_VC isKindOfClass:[ItemSearchViewController class]])
         
         return;
@@ -1194,10 +1179,13 @@
     
     UIApplication * app = [UIApplication sharedApplication];
     AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-//    NSString* aaa =[@"Category" stringByAppendingString:[self categoryString:categoryid node:appDelegate.categoryMenu level:0]];;
+    #if defined(BUILD_UWAVER)
+    self.categoryViewController.categoryString = [@"Collections" stringByAppendingString:[self categoryString:categoryid node:appDelegate.categoryMenu level:0]];
+#else
     self.categoryViewController.categoryString = [@"Category" stringByAppendingString:[self categoryString:categoryid node:appDelegate.categoryMenu level:0]];
+#endif
+    
     self.categoryViewController.cagegoryLabel.text =self.categoryViewController.categoryString;
-    //   NSString* sss =[@"Category" stringByAppendingString:[self categoryString:categoryid node:appDelegate.categoryMenu level:0]];
     self.categoryViewController.categoryid = categoryid ;
     self.categoryViewController.loadall=false;
 //    self.categoryViewController.collectionview

+ 10 - 0
RedAnt ERP Mobile/common/Functions/category/CategorySearchFilterViewController.m

@@ -174,6 +174,10 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     
+#ifdef BUILD_UWAVER
+    self.title=@"Collections Filter";
+#endif
+    
     [self initCheckedCategory];
     
     CGRect rect_tframe = CGRectMake(0,0,self.treeContainer.frame.size.width,self.treeContainer.frame.size.height);
@@ -209,7 +213,13 @@
     UILabel *CategoryLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 5.5, self.view.frame.size.width, 33)];
     CategoryLabel.textColor=UIColorFromRGB(frontcolor);
     //    CategoryLabel.backgroundColor = [UIColor redColor];
+    #ifdef BUILD_UWAVER
+        CategoryLabel.text=NSLocalizedString(@" Collections", nil);
+#else
     CategoryLabel.text=NSLocalizedString(@" Category", nil);
+    #endif
+
+    
     //    [CategoryLabel sizeToFit];
     
     self.treeView.treeHeaderView = CategoryLabel;

+ 15 - 1
RedAnt ERP Mobile/common/Functions/category/CategoryViewController.m

@@ -239,7 +239,7 @@
     
     filterVC.OkClick =^(NSString *ids,NSString* modelname,NSString* modeldescrip,NSString* available,NSString* QTY,NSString* alert,NSString* price,NSString* bestseller)
     {
-#if defined(BUILD_NPD) || defined(BUILD_USAI) || defined(BUILD_UWAVER)
+#if defined(BUILD_NPD) || defined(BUILD_USAI)
         NSArray *idArr = [ids componentsSeparatedByString:@","];
         if (idArr.count == 1) {
             self.categoryString = [@"Category" stringByAppendingString:[self categoryString:ids node:menu level:0]];
@@ -266,6 +266,20 @@
         self.categoryid = ids;
 #endif
         
+#if defined(BUILD_UWAVER)
+        
+                NSArray *idArr = [ids componentsSeparatedByString:@","];
+                if (idArr.count == 1) {
+                    self.categoryString = [@"Collections" stringByAppendingString:[self categoryString:ids node:menu level:0]];
+                } else {
+                    self.categoryString = @"Collections>Multiple Category>";
+                }
+                
+                self.cagegoryLabel.text =self.categoryString;
+                
+                self.categoryid = ids;
+#endif
+        
 #if defined(BUILD_HOMER) || defined(BUILD_GATIT)
         NSArray *idArr = [ids componentsSeparatedByString:@","];
         if (idArr.count == 1) {

+ 149 - 0
RedAnt ERP Mobile/common/Functions/modelDetail/DetailViewController.m

@@ -123,6 +123,155 @@ dispatch_async(dispatch_get_main_queue(), ^{
     
     //self.detailTable.hidden=true;
     
+    
+    [RANetwork request_modeldetail:self.product_id model_name:self.model_name category_id:self.category_id use_name:self.use_model_name groupName:self.groupName completionHandler:^(NSMutableDictionary *result) {
+        NSMutableDictionary* detail_json=result;
+        
+        [self.mum stopAnimating];
+#ifdef BUILD_UWAVER
+        self.navigationItem.rightBarButtonItem.enabled = true;
+#endif
+        self.groupName = nil;
+        if([[detail_json valueForKey:@"result"] intValue]==2)
+        {
+            
+            self.detail_data = [detail_json mutableCopy];
+            self.product_id = [NSString stringWithFormat:@"%d",[[detail_json valueForKey:@"product_id"] intValue] ];
+            NSMutableDictionary* imgsection = [[detail_json objectForKey:@"img_section"] mutableCopy];
+            //          AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+            if(/*appDelegate.user_type==USER_ROLE_CUSTOMER*/true)
+                self.quantity =[[imgsection valueForKey:@"stockUom"] intValue];
+            else
+                self.quantity =1;
+            
+            if(self.quantity==0)
+                self.quantity=1;
+            self.step=self.quantity;
+            [self.detailTable reloadData];
+            
+            //
+            self.detailTable.hidden = false;
+            
+            NSString* model_name = self.detail_data[@"img_section"][@"model_name"];
+            
+            NSString* img_url = self.detail_data[@"img_section"][@"model_s_img"];
+            
+            NSMutableDictionary* images=[self.detail_data[@"img_section"][@"images"] mutableCopy];
+            NSMutableDictionary* videos=[self.detail_data[@"img_section"][@"videos"] mutableCopy];
+            
+            NSMutableDictionary* contents = [NSMutableDictionary new];
+            int count = 0;
+            
+            {
+                for(int ic=0;ic<[videos[@"count"] intValue];ic++)
+                {
+                    NSString* videocode = videos[[NSString stringWithFormat:@"video_%d",ic]];
+                    
+                    
+                    //                         NSString*   path=[[NSBundle mainBundle] pathForResource:@"play" ofType:@"jpg"];
+                    //
+                    //                        NSMutableDictionary* item =[@{@"type":@"video",@"is_localfile":@(true),@"l":path,@"s":path} mutableCopy];
+                    //
+                    //                        contents[[NSString stringWithFormat:@"item_%d",count]]=item ;
+                    //                        count++;
+                    
+                    NSMutableDictionary* item =[@{@"type":@"video",@"code":videocode} mutableCopy];
+                    
+                    contents[[NSString stringWithFormat:@"item_%d",count]]=item;
+                    count++;
+                }
+            }
+            
+            {
+                for(int ic=0;ic<[images[@"img_count"] intValue];ic++)
+                {
+                    NSMutableDictionary* item = [images[[NSString stringWithFormat:@"img_%d",ic]] mutableCopy];
+                    item[@"type"]=@"image";
+                    contents[[NSString stringWithFormat:@"item_%d",count]]=item;
+                    count++;
+                }
+                //#ifndef BUILD_HOMER
+#if !defined(BUILD_HOMER) && !defined(BUILD_GATIT)
+                // homer 要求去掉qrcode 2017/12/20
+                NSString* qrpath = [ImageUtils generateQRCodeFile:model_name width:350 height:350];
+                //                    UIImage* qrimg=[QRCodeGenerator qrImageForString:model_name imageSize:350];
+                if(qrpath!=nil)
+                {
+                    NSMutableDictionary* item =[@{@"type":@"image",@"is_localfile":@(true),@"l":qrpath,@"s":qrpath} mutableCopy];
+                    
+                    contents[[NSString stringWithFormat:@"item_%d",count]]=item ;
+                    count++;
+                }
+#endif
+            }
+            
+            
+            
+            
+            contents[@"count"]=@(count);
+            imgsection[@"stack_contents"]=contents;
+            self.detail_data[@"img_section"]=imgsection;
+            //                self.detail_data[@"img_section"][@"stack_contents"]=contents;
+            
+            NSMutableDictionary* item = [[NSMutableDictionary alloc]init];
+            [item setValue:self.product_id forKey:@"product_id"];
+            [item setValue:self.category_id forKey:@"category"];
+            [item setValue:model_name forKey:@"fash_name"];
+            [item setValue:img_url forKey:@"picture_path"];
+            
+            [CartUtils add_recent_model:item];
+            
+            NSUInteger ii[2] = {0,0};
+            
+            [self.detailTable  scrollToRowAtIndexPath:[NSIndexPath indexPathWithIndexes:ii length:2] atScrollPosition:UITableViewScrollPositionTop animated:YES];
+            
+            
+            //                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+            //                int count=[appDelegate.recent_model[@"count"] intValue];
+            //                bool bexist = false;
+            //                for(int i=0;i<count;i++)
+            //                {
+            //                    NSMutableDictionary * mitem= appDelegate.recent_model[[NSString stringWithFormat:@"item_%d",i]];
+            //                    if([mitem[@"product_id"] isEqualToString:self.product_id])
+            //                    {
+            //                        bexist=true;
+            //                        break;
+            //                    }
+            //                }
+            //
+            //                if(!bexist)
+            //                {
+            //                [appDelegate.recent_model setObject:item forKey:[NSString stringWithFormat:@"item_%d",count]];
+            //                appDelegate.recent_model[@"count"]=[NSString stringWithFormat:@"%d",count+1];
+            //                }
+            
+            self.groupName = [detail_json objectForKey:@"groupName"];
+        }
+        else
+            if([[detail_json valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
+            {
+                self.detailTable.hidden = true;
+                self.label_net_err.hidden=false;
+            }
+            else if([[detail_json valueForKey:@"result"] intValue]==RESULT_NO_MODEL)
+            {
+                self.detailTable.hidden = true;
+                [RAUtils message_alert:[detail_json valueForKey:@"err_msg"] title:@"Model Detail"/*@"Loading Model Detail Failed."*/ controller:self] ;
+                if(self.ispush)
+                    [ self.navigationController popViewControllerAnimated:true];
+            }
+            else
+            {
+                [RAUtils message_alert:[detail_json valueForKey:@"err_msg"] title:@"Model Detail"/*@"Loading Model Detail Failed."*/ controller:self] ;
+            }
+        
+        self.isrefreshing=false;
+        
+        
+    }];
+    
+    return;
+    
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
         
         NSMutableDictionary* detail_json = [[RANetwork request_ItemDetail:self.product_id model_name:self.model_name category_id:self.category_id use_name:self.use_model_name groupName:self.groupName] mutableCopy];

+ 107 - 0
RedAnt ERP Mobile/common/Functions/search+itemsearch/SearchViewController.m

@@ -1193,6 +1193,60 @@
         
         self.isrefreshing=true;
         
+        [RANetwork request_search:self.offset limit:20 keywords:self.keywords matchfull:self.loadmore_matchfull completionHandler:^(NSMutableDictionary *result) {
+            NSMutableDictionary* category_more=result;
+            
+            [self.mum stopAnimating];
+            self.isrefreshing=false;
+            if (self.dataOperationQueue.operationCount > 1) {
+                return;
+            }
+            
+            NSDictionary* more_items=[category_more objectForKey:@"items"];
+            if([[category_more valueForKey:@"result"] intValue]==2)
+            {
+                //  self.category_data = category_data;
+                NSMutableDictionary* items_json= [[self.category_data objectForKey:@"items"] mutableCopy];
+                
+                int count =[[more_items valueForKey:@"count"] intValue];
+                for(int i=0;i<count;i++)
+                {
+                    
+                    NSDictionary * item_json = [more_items objectForKey:[NSString stringWithFormat:@"item_%d",i]];
+                    [items_json setObject:item_json forKey:[NSString stringWithFormat:@"item_%ld",i+self.offset]];
+                    
+                    
+                }
+                long newcount=[[[self.category_data objectForKey:@"items"] valueForKey:@"count"] intValue]+count;
+                [items_json setValue: [NSString stringWithFormat:@"%ld",newcount] forKey:@"count"];
+                [self.category_data setObject:items_json forKey:@"items"];
+                self.offset+=count;
+                if(count<20)
+                {
+                    self.loadall=true;
+                    
+                }
+                //            NSDictionary * item_json = [self.category_data objectForKey:@"items"];
+                
+                
+                
+                
+                //        DebugLog(@"%@",self.category_data);
+                
+                [self.collectionview reloadData];
+                
+            }
+            else
+            {
+                [RAUtils message_alert:[category_more valueForKey:@"err_msg"] title:@"Search" controller:self] ;
+            }
+            self.isrefreshing=false;
+            
+            
+        }];
+        
+        return;
+        
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
         
 
@@ -1325,6 +1379,59 @@
         self.mum.hidden = false;
         [self.mum startAnimating];
         self.loadmore_matchfull = self.switch_matchfull.isOn;
+        [RANetwork request_search:0 limit:20 keywords:self.keywords
+                        matchfull:self.loadmore_matchfull completionHandler:^(NSMutableDictionary *result) {
+            NSMutableDictionary* category_data=result;
+            
+            
+            [self.mum stopAnimating];
+            self.isrefreshing=false;
+            if (self.dataOperationQueue.operationCount > 1) {
+                return;
+            }
+            
+            self.category_data = [category_data mutableCopy];
+            [self.collectionview reloadData];
+            
+            if([[category_data valueForKey:@"result"] intValue]==2)
+            {
+                self.collectionview.hidden=false;
+                NSDictionary * item_json = [self.category_data objectForKey:@"items"];
+                self.offset =[[item_json valueForKey:@"count"] intValue];
+                
+                int total = [[self.category_data valueForKey:@"item_total_count"]intValue];
+                
+                if(total<2)
+                {
+                    self.labelTotal.text = [NSString stringWithFormat:@"Total %d item",total];
+                    if(total==1)
+                    {
+                        NSDictionary * detail_item = [item_json objectForKey:@"item_0"];
+                        NSString* detail_id=    [detail_item valueForKey:@"product_id"] ;
+                        
+                        [self showDetailat:detail_id category_id:nil name:[detail_item objectForKey:@"fash_name"] index:0];
+                    }
+                }
+                else
+                    self.labelTotal.text = [NSString stringWithFormat:@"Total %d items",total];
+            }
+            else if([[category_data valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
+            {
+                self.collectionview.hidden=true;
+                self.label_net_err.hidden=false;
+            }
+            else
+            {
+                [RAUtils message_alert:[category_data valueForKey:@"err_msg"] title:@"Search" controller:self] ;
+            }
+            
+            self.isrefreshing=false;
+
+            
+        }];
+        
+        return;
+        
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
         
         NSDictionary* category_data=[RANetwork Search:0 limit:20 keywords:self.keywords matchfull:self.loadmore_matchfull];

+ 4 - 0
RedAnt ERP Mobile/common/categoryMenu_RATree/RAViewController.m

@@ -136,6 +136,10 @@
 {
   [super viewDidLoad];
     
+#ifdef BUILD_UWAVER
+    self.title=@"Collection Selection";
+#endif
+    
     if(self.categoryMenu==nil)
     {
         self.notification_refreshLevel=NotificationRefreshLevelView;

+ 4 - 1
RedAnt ERP Mobile/common/data_provider/RANetwork.h

@@ -192,5 +192,8 @@ extern NSString *const ScreenCodeOfflineSync;
 // 新接口逐步替换以前的网络请求,2020
 +(void)request_home:(int) price_template customid:(int) customid completionHandler:(resultHandler)result;
 +(void)request_category:(resultHandler)result;
-+(void)request_categorylist: (NSString*) category customid:(int) customid price_template:(int) price_template sort:(int) sort_by filter:(NSString*) filter keyword:(NSString*) keyword  offset:(long) offset limit:(long) limit alert:(NSString*)alert qty:(NSString*)qty available:(NSString*)available price:(NSString*)price bestseller:(NSString*)bestseller modelname:(NSString*) modelname modeldescrip:(NSString*)modeldescrip  completionHandler:(resultHandler)result;
++(void)request_categorylist: (NSString*) category customid:(int) customid price_template:(int) price_template sort:(int) sort_by filter:(NSString*) filter keyword:(NSString*) keyword  offset:(long) offset limit:(long) limit alert:(NSString*)alert qty:(NSString*)qty available:(NSString*)available price:(NSString*)price bestseller:(NSString*)bestseller modelname:(NSString*) modelname modeldescrip:(NSString*)modeldescrip completionHandler:(resultHandler)result;
++(void)request_modeldetail: (NSString* ) item_id model_name:(NSString*) model_name category_id:(NSString*) category_id use_name :(bool) use_name groupName:(NSString *)groupName completionHandler:(resultHandler)result;
+
++(void)request_search:(long ) offset limit :(long)limit keywords :(NSString*) keywords matchfull:(bool)matchfull completionHandler:(resultHandler)result;
 @end

+ 402 - 1
RedAnt ERP Mobile/common/data_provider/RANetwork.m

@@ -5062,7 +5062,7 @@ repeat:
 //    NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
 //    return jsobj;
 }
-+(void)request_categorylist: (NSString*) category customid:(int) customid price_template:(int) price_template sort:(int) sort_by filter:(NSString*) filter keyword:(NSString*) keyword  offset:(long) offset limit:(long) limit alert:(NSString*)alert qty:(NSString*)qty available:(NSString*)available price:(NSString*)price bestseller:(NSString*)bestseller modelname:(NSString*) modelname modeldescrip:(NSString*)modeldescrip  completionHandler:(resultHandler)result
++(void)request_categorylist: (NSString*) category customid:(int) customid price_template:(int) price_template sort:(int) sort_by filter:(NSString*) filter keyword:(NSString*) keyword  offset:(long) offset limit:(long) limit alert:(NSString*)alert qty:(NSString*)qty available:(NSString*)available price:(NSString*)price bestseller:(NSString*)bestseller modelname:(NSString*) modelname modeldescrip:(NSString*)modeldescrip completionHandler:(resultHandler)result
 {
     
     
@@ -5147,4 +5147,405 @@ repeat:
 //    return jsobj;
 //
 }
+
++(void)request_modeldetail: (NSString* ) item_id model_name:(NSString*) model_name category_id:(NSString*) category_id use_name :(bool) use_name groupName:(NSString *)groupName completionHandler:(resultHandler)result
+{
+    
+    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
+     AppDelegate *appDelegate = nil;
+    
+        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(appDelegate.order_code!=nil)
+        [params setValue:appDelegate.order_code forKey:@"orderCode"];
+    //    [params setValue:[NSString stringWithFormat:@"%d",price_template]  forKey:@"price_template"];
+    //    [params setValue:[NSString stringWithFormat:@"%d",customid]  forKey:@"custom_id"];
+    if(use_name)
+        [params setValue:model_name  forKey:@"product_name"];
+    else
+        [params setValue:item_id  forKey:@"product_id"];
+    
+    
+    [params setValue:category_id  forKey:@"category"];
+    
+    [params setObject:ScreenCodeModelInfo forKey:kScreenName];
+    [params setObject:@"Open A Model" forKey:kAction];
+    if (model_name) {
+        NSDictionary *extra = @{@"ModelName" : model_name};
+        [params setObject:extra forKey:kExtra];
+    }
+    
+    if (groupName.length > 0) {
+        [params setObject:groupName forKey:@"groupName"];
+    }
+    
+    
+    if(appDelegate.offline_mode)
+    {
+                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+            NSMutableDictionary* json = [[OLDataProvider offline_model:params] mutableCopy];
+            dispatch_async(dispatch_get_main_queue(), ^{
+                result(json);
+            });
+        });
+        
+        return;
+
+    }
+    [self request_interface:URL_ITEM_DETAIL parameters:params err_record_url:nil completionHandler:result retry:0];
+    
+//
+//    if(appDelegate.offline_mode)
+//        return [OLDataProvider offline_model:params];
+//
+//    if(![self IsNetworkAvailable])
+//        return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
+//
+//    NSData* json=[self get_json:URL_ITEM_DETAIL parameters:params];
+//    if(json==nil)
+//        return nil;
+//    NSError *error=nil;
+//    NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+//    return jsobj;
+}
++(void)request_search:(long ) offset limit :(long)limit keywords :(NSString*) keywords matchfull:(bool)matchfull completionHandler:(resultHandler)result
+{
+    
+    
+    
+    
+    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
+    AppDelegate *appDelegate = nil;
+    
+        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(appDelegate.order_code!=nil)
+        [params setValue:appDelegate.order_code forKey:@"orderCode"];
+    //    [params setValue:[NSString stringWithFormat:@"%d",price_template]  forKey:@"price_template"];
+    //    [params setValue:[NSString stringWithFormat:@"%d",customid]  forKey:@"custom_id"];
+    //    [params setValue:[NSString stringWithFormat:@"%@",category]  forKey:@"category"];
+    //    [params setValue:[NSString stringWithFormat:@"%d",sort_by]  forKey:@"sort_by"];
+    //    [params setValue:filter forKey:@"filter"];
+    [params setValue:keywords forKey:@"keyword"];
+    
+    [params setValue:[NSString stringWithFormat:@"%ld",limit]  forKey:@"limit"];
+    [params setValue:[NSString stringWithFormat:@"%ld",offset]  forKey:@"offset"];
+    if(matchfull)
+        [params setValue:@"true"  forKey:@"exactMatch"];
+    else
+        [params setValue:@"false"  forKey:@"exactMatch"];
+    
+    [params setObject:ScreenCodeSearch forKey:kScreenName];
+    if (keywords) {
+        [params setObject:@"Search" forKey:kAction];
+    }
+
+    if(appDelegate.offline_mode)
+    {
+                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+            NSMutableDictionary* json = [[OLDataProvider offline_search:params] mutableCopy];
+            dispatch_async(dispatch_get_main_queue(), ^{
+                result(json);
+            });
+        });
+        
+        return;
+
+    }
+    [self request_interface:URL_SEARCH parameters:params err_record_url:nil completionHandler:result retry:0];
+//    if(appDelegate.offline_mode)
+//    {
+//        return [OLDataProvider offline_search:params];
+//    }
+//    if(![self IsNetworkAvailable])
+//        return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
+//
+//    NSData* json=[self get_json:URL_SEARCH parameters:params];
+//    if(json==nil)
+//        return nil;
+//    NSError *error=nil;
+//    NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+//    return jsobj;
+}
++(void)request_login: (NSString*) user password:(NSString*) password completionHandler:(resultHandler)result
+{
+    
+    //    if(![ApexMobileNetwork IsHostAvailable:URL_UPDATE_AUTH])
+    //        return RESULT_NET_ERROR;
+    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+    long ver =[defaults integerForKey:[NSString stringWithFormat:@"%@_Auth_InfoVer",user]];
+    
+    
+    
+    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
+    AppDelegate *appDelegate = nil;
+    
+        appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
+    
+    if(appDelegate.duid !=nil)
+        [params setValue:appDelegate.duid forKey:@"udid"];
+    [params setValue:@"handset_login" forKey:@"action"];
+    //    [headers setValue:[NSString stringWithFormat:@"%d",dataLength] forKey:@"Content-Length"];
+    
+    [params setValue:user forKey:@"user"];
+    [params setValue:password forKey:@"password"];
+    [params setValue:[NSString stringWithFormat:@"%ld",ver]  forKey:@"auth_ver"];
+#ifdef TEST
+    [params setValue:@"true" forKey:@"is_debug"];
+#else
+    [params setValue:@"false" forKey:@"is_debug"];
+#endif
+    
+    [params setObject:ScreenCodeLoginView forKey:kScreenName];
+    [params setObject:@"Login" forKey:kAction];
+    
+    
+    if(appDelegate.offline_mode)
+    {
+        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+            
+            NSMutableDictionary* json = [[RAConvertor data2dict:[OLDataProvider offline_login:params]] mutableCopy];
+            int ret = [self parse_logininfo:json user:user password:password] ;
+            
+            
+            NSMutableDictionary * retjson = [NSMutableDictionary new];
+            
+            retjson[@"result"]= [NSNumber numberWithInt:ret];
+            
+            
+            
+            
+            dispatch_async(dispatch_get_main_queue(), ^{
+                result(retjson);
+            });
+        });
+        
+        return;
+        
+    }
+    [self request_interface:URL_UPDATE_AUTH parameters:params err_record_url:nil completionHandler:^(NSMutableDictionary *chresult) {
+       int ret = [self parse_logininfo:chresult user:user password:password] ;
+        
+        
+        NSMutableDictionary * retjson = [NSMutableDictionary new];
+        
+        retjson[@"result"]= [NSNumber numberWithInt:ret];
+        
+        result(retjson);
+        
+        
+    } retry:0];
+    
+    
+//
+//    NSData* json= nil;
+//    if(appDelegate.offline_mode)
+//    {
+//        json= [OLDataProvider offline_login:params] ;
+//
+//    }
+//    else
+//    {
+//        if(![self IsNetworkAvailable])
+//            return RESULT_NET_NOTAVAILABLE;
+//        json =[self get_json:URL_UPDATE_AUTH parameters:params];
+//
+//    }
+//
+//    if(json==nil)
+//        return RESULT_NET_ERROR;
+//
+//    int ret = [self parse_authinfo:json user:user password:password];
+//    DebugLog(@"parse_authinfo return %d ",ret);
+//
+//
+//    return ret;
+//
+    
+}
++(int)parse_logininfo : (NSMutableDictionary *) jsobj user:(NSString*) user password:(NSString*) password
+{
+//    DebugLog(@"parse_authinfo");
+//    NSError *error=nil;
+//
+//    NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+    if(jsobj)
+    {
+        
+        __block AppDelegate *appDelegate = nil;
+        
+        dispatch_sync(dispatch_get_main_queue(), ^{
+            //some UI methods ej
+            appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
+        });
+        int result = [[jsobj valueForKey:@"result"] intValue];
+        
+        if (result<0)
+            return result;
+        if(result!=AP_USER_AUTH&& result!=9)
+        {
+            
+            
+            DebugLog(@"USER NOT AUTHORIZED CODE=%d ",result);
+//            [appDelegate Logout];
+            if(result==8)
+            {
+                return RESULT_LOGIN_DEVICE;
+            }
+            return RESULT_FALSE;
+            
+        }
+        NSDictionary* objheader = [jsobj objectForKey:@"header"];
+        
+        NSString* required_ver=[jsobj objectForKey:@"min_ver"] ;
+        user=[objheader objectForKey:@"username"] ;
+        DebugLog(@"required_ver=%@ ",required_ver);
+        //        NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary];
+        //        NSString* versionNum =[infoDict valueForKey:@"CFBundleVersion"];
+        //        versionNum = [NSString stringWithFormat:@"A%@",versionNum];
+        int ibadge = [[objheader valueForKey:@"badge"] intValue];
+        
+        //        if([ibadge isEqual:[NSNull null]])
+        //            strbadge=@"0";
+        //        if(ibadge==nil)
+        //            ibadge=@"0";
+        //        if([strbadge isEqualToString:@"null"])
+        //            strbadge=@"0";
+//        app.applicationIconBadgeNumber = ibadge;//[strbadge intValue];
+        
+        //  BOOL bigger = [appDelegate.build compare:required_ver] ;
+        if([appDelegate.build intValue]<[required_ver intValue])
+            return RESULT_VER_LOW;
+        //        appDelegate.sessionid = [objheader valueForKey:@"sessionid"];
+        appDelegate.user = user;
+        appDelegate.password = password;
+        appDelegate.user_type = [[objheader valueForKey:@"user_type"] intValue];
+        appDelegate.user_icon =[objheader valueForKey:@"user_img"] ;
+        appDelegate.bLogin = true;
+        appDelegate.customer_type = [[objheader valueForKey:@"customer_login_type"] integerValue];
+        
+        
+        
+        if(appDelegate.user_type==USER_ROLE_CUSTOMER)
+        {
+            appDelegate.customerInfo = [[objheader objectForKeyedSubscript:@"customerInfo"] mutableCopy];
+            appDelegate.contact_id = [objheader valueForKey:@"contact_id"];
+//            appDelegate.order_code =[objheader valueForKey:@"orderCode"];
+//            appDelegate.order_status =[[objheader valueForKey:@"orderStatus"] intValue];
+//            [appDelegate SetSo:[objheader valueForKey:@"soId"]];
+        }
+        NSString* mode =[jsobj valueForKey:@"mode"] ;
+        [appDelegate SetMode:mode];
+        
+        
+        appDelegate.cart_count = [[objheader valueForKey:@"cart_count"] intValue];
+        appDelegate.wish_count =[[objheader valueForKey:@"wish_count"] intValue];
+        appDelegate.port_count =[[objheader valueForKey:@"portfolio_count"] intValue];
+        
+        [appDelegate update_count_mark];
+        
+        
+        
+        appDelegate.can_show_price =[[objheader valueForKey:@"can_show_price"] boolValue];
+        appDelegate.can_see_price =[[objheader valueForKey:@"can_see_price"] boolValue];
+        appDelegate.can_create_portfolio =[[objheader valueForKey:@"can_create_portfolio"] boolValue];
+        appDelegate.can_create_order =[[objheader valueForKey:@"can_create_order"] boolValue];
+        
+        appDelegate.can_cancel_order =[[objheader valueForKey:@"can_cancel_order"] boolValue];
+        appDelegate.can_set_cart_price =[[objheader valueForKey:@"can_set_cart_price"] boolValue];
+        appDelegate.can_delete_order =[[objheader valueForKey:@"can_delete_order"] boolValue];
+        appDelegate.can_update_contact_info =[[objheader valueForKey:@"can_update_contact_info"] boolValue];
+        appDelegate.can_submit_order =[[objheader valueForKey:@"can_submit_order"] boolValue];
+        appDelegate.can_set_tearsheet_price =[[objheader valueForKey:@"can_set_tearsheet_price"] boolValue];
+        
+        appDelegate.save_order_logout =[[objheader valueForKey:@"save_order_logout"] boolValue];
+        appDelegate.submit_order_logout =[[objheader valueForKey:@"submit_order_logout"] boolValue];
+        
+        appDelegate.alert_sold_in_quantities = [[objheader valueForKey:@"alert_sold_in_quantities"] boolValue];
+        
+        appDelegate.can_create_backorder = [[objheader valueForKey:@"can_create_backorder"] boolValue];
+        
+        appDelegate.ipad_perm =[objheader valueForKey:@"ipad_perm"] ;
+        
+        NSString* strfilter = [objheader valueForKey:@"statusFilter"] ;
+        
+        
+        
+        appDelegate.OrderFilter= [[RAConvertor string2dict:strfilter] mutableCopy];
+        
+        
+        [appDelegate set_main_button_panel];
+        
+        if(appDelegate.user_type==USER_ROLE_CUSTOMER) {
+        
+            // shop order status filter
+            NSString *shopOrderStatusFilterStr = [objheader valueForKey:@"shopOrderFilter"] ;
+            [Singleton sharedInstance].shop_order_status_filter = [[RAConvertor string2dict:shopOrderStatusFilterStr] mutableCopy];
+            // Sales order status filter
+            NSString *salesOrderStatusFilterStr = [objheader valueForKey:@"purchaseOrderFilter"] ;
+            [Singleton sharedInstance].sales_order_status_filter = [[RAConvertor string2dict:salesOrderStatusFilterStr] mutableCopy];
+            
+            // specialInstruction
+            [Singleton sharedInstance].specialInstruction = [objheader valueForKey:@"specialInstruction"];
+            
+            //-价格类型
+            [Singleton sharedInstance].npd_shop_price_type = [[objheader valueForKey:@"price_type"] integerValue];
+            
+            // 权限
+            [Singleton sharedInstance].permissions_price_setting = [[objheader valueForKey:@"can_set_price_formula"] boolValue];
+            [Singleton sharedInstance].permissions_edit_order = [[objheader valueForKey:@"can_place_order"] boolValue];
+
+            [Singleton sharedInstance].permissions_submit_order = [[objheader valueForKey:@"can_submit_order"] boolValue];
+
+            [Singleton sharedInstance].permissions_merge_order = [[objheader valueForKey:@"can_merge_order"] boolValue];
+            
+            [Singleton sharedInstance].deliveryString = [objheader valueForKey:@"delivery_price"];
+            [[Singleton sharedInstance] resetGlobalLock];
+            [Singleton sharedInstance].customer_can_see_sales_Order = [[objheader valueForKey:@"can_see_salesorder"] boolValue];
+            [Singleton sharedInstance].customerInfo = [objheader objectForKeyedSubscript:@"customerInfo"];
+        }
+        
+        //        DebugLog(@"sessionid=%@ ",appDelegate.sessionid);
+        //        if ([[objheader valueForKey:@"update"] boolValue]==false)
+        //        {
+        //            // no update on the server;
+        //            return RESULT_TRUE;
+        //        }
+        //        int Auth_InfoVer = [[objheader valueForKey:@"ver"] intValue];
+        //        NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+        //        [defaults removeObjectForKey:[NSString stringWithFormat:@"%@_Auth_InfoVer",user]];
+        //       [defaults setInteger:Auth_InfoVer forKey:[NSString stringWithFormat:@"%@_Auth_InfoVer",user]];
+        //        [defaults synchronize];
+        //
+        //        NSDictionary* objfuncs = [jsobj objectForKey:@"functions"];
+        //        NSArray* keys= [objfuncs allKeys];
+        
+        
+        /*
+         
+         db.setTransactionSuccessful();
+         db.endTransaction();
+         */
+        return RESULT_TRUE;
+        
+    }
+    //    NSDictionary *weatherInfo = [jsobj objectForKey:@"weatherinfo"];
+    //    txtView.text = [NSString stringWithFormat:@"今天是 %@  %@  %@  的天气状况是:%@  %@ ",[weatherInfo objectForKey:@"date_y"],[weatherInfo objectForKey:@"week"],[weatherInfo objectForKey:@"city"], [weatherInfo objectForKey:@"weather1"], [weatherInfo objectForKey:@"temp1"]];
+    //      DebugLog(@"weatherInfo字典里面的内容为--》%@", weatherDic );
+    
+    
+    
+    return RESULT_USERAUTH_ERROR;
+}
+
 @end