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

Recant mobile

增加query setting
Ray Zhang 8 лет назад
Родитель
Сommit
4ddadd0cb6

BIN
RA Image/RA Image.xcodeproj/project.xcworkspace/xcuserdata/ray.xcuserdatad/UserInterfaceState.xcuserstate


+ 1 - 0
RA Image/RA Image/PopModeViewController.m

@@ -95,6 +95,7 @@
                              @"mode":self.name,
                              @"barcode":self.barcode,
                              @"_operate":@"valid_upload",
+                             @"_action":@"handset_new",
                              @"platform":@"ios"
                              } mutableCopy];
     [self verify:params];

+ 10 - 0
RedAnt Mobile/RedAnt Mobile.xcodeproj/project.pbxproj

@@ -89,6 +89,8 @@
 		7197D41F1FBD2EA60063EFBB /* LineView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7197D41E1FBD2EA60063EFBB /* LineView.m */; };
 		7197D4211FBEADCB0063EFBB /* orderdetail.json in Resources */ = {isa = PBXBuildFile; fileRef = 7197D4201FBEADCB0063EFBB /* orderdetail.json */; };
 		71CB70B41FA1CCDB009FDCB7 /* server.json in Resources */ = {isa = PBXBuildFile; fileRef = 71CB70B31FA1CCDB009FDCB7 /* server.json */; };
+		71E925CB1FDA688E0037F017 /* query_setting.json in Resources */ = {isa = PBXBuildFile; fileRef = 71E925CA1FDA688E0037F017 /* query_setting.json */; };
+		71E925CE1FDA6C0D0037F017 /* SearchSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71E925CD1FDA6C0D0037F017 /* SearchSettingViewController.m */; };
 		71E9F6C81F8C5CCB0052C78E /* NetworkUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 71E9F6C61F8C5CCA0052C78E /* NetworkUtils.m */; };
 		71F3A9A21F5F8E22001036C8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 71F3A9A11F5F8E22001036C8 /* main.m */; };
 		71F3A9A51F5F8E22001036C8 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 71F3A9A41F5F8E22001036C8 /* AppDelegate.m */; };
@@ -304,6 +306,9 @@
 		71CB70B01FA1BA5E009FDCB7 /* data.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = data.json; sourceTree = "<group>"; };
 		71CB70B11FA1BA5E009FDCB7 /* layout.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = layout.json; sourceTree = "<group>"; };
 		71CB70B31FA1CCDB009FDCB7 /* server.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = server.json; sourceTree = "<group>"; };
+		71E925CA1FDA688E0037F017 /* query_setting.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = query_setting.json; sourceTree = "<group>"; };
+		71E925CC1FDA6C0D0037F017 /* SearchSettingViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SearchSettingViewController.h; sourceTree = "<group>"; };
+		71E925CD1FDA6C0D0037F017 /* SearchSettingViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SearchSettingViewController.m; sourceTree = "<group>"; };
 		71E9F6C61F8C5CCA0052C78E /* NetworkUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = NetworkUtils.m; path = ../../common/NetworkUtils.m; sourceTree = "<group>"; };
 		71E9F6C71F8C5CCA0052C78E /* NetworkUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = NetworkUtils.h; path = ../../common/NetworkUtils.h; sourceTree = "<group>"; };
 		71F3A99D1F5F8E22001036C8 /* RedAnt Mobile.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "RedAnt Mobile.app"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -825,6 +830,8 @@
 			children = (
 				7197D4061FB57E270063EFBB /* SearchViewController.h */,
 				7197D4071FB57E270063EFBB /* SearchViewController.m */,
+				71E925CC1FDA6C0D0037F017 /* SearchSettingViewController.h */,
+				71E925CD1FDA6C0D0037F017 /* SearchSettingViewController.m */,
 			);
 			name = search;
 			sourceTree = "<group>";
@@ -871,6 +878,7 @@
 				7197D4091FB58E530063EFBB /* search_ui.json */,
 				7197D41B1FBD1CD60063EFBB /* kv.json */,
 				7197D4201FBEADCB0063EFBB /* orderdetail.json */,
+				71E925CA1FDA688E0037F017 /* query_setting.json */,
 			);
 			name = "fake data";
 			sourceTree = "<group>";
@@ -1241,6 +1249,7 @@
 				42973AD61FBA8F4A00A3C164 /* Phone_Range_Cell.xib in Resources */,
 				42DFAE7D1F9B2D02009AFCCC /* Phone_TextView_Cell.xib in Resources */,
 				71F3AA0D1F61151D001036C8 /* commoneditor.phone.xib in Resources */,
+				71E925CB1FDA688E0037F017 /* query_setting.json in Resources */,
 				71FF602B1FA802AB00C5523A /* loginUI.json in Resources */,
 				71F3AA5A1F624A88001036C8 /* signature.storyboard in Resources */,
 				4221EF9F1FA81E150026E1EC /* RAPredefQuery.storyboard in Resources */,
@@ -1295,6 +1304,7 @@
 				716780321FCC095D00FE2784 /* TakePhotoPreviewController.m in Sources */,
 				42973AD71FBA8F4A00A3C164 /* CommonEditorRangeCell.m in Sources */,
 				7102C13B1FCC0FF70062A67A /* ImageUtils.m in Sources */,
+				71E925CE1FDA6C0D0037F017 /* SearchSettingViewController.m in Sources */,
 				7102C1411FCD46DE0062A67A /* RootModeCell.m in Sources */,
 				42D64CD21FD12BCF003F49F9 /* PhotoCell.m in Sources */,
 				71F3A9EE1F5FA557001036C8 /* mztools.c in Sources */,

+ 48 - 1
RedAnt Mobile/RedAnt Mobile/Base.lproj/Main.storyboard

@@ -34,13 +34,26 @@
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dbw-1x-pdX">
-                                                    <rect key="frame" x="10" y="0.0" width="365" height="39.5"/>
+                                                    <rect key="frame" x="10" y="0.0" width="365" height="40"/>
                                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                     <nil key="textColor"/>
                                                     <nil key="highlightedColor"/>
                                                 </label>
+                                                <button opaque="NO" contentMode="scaleAspectFit" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageSizeForAccessibilityContentSizeCategory="YES" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="JHV-Bq-B92">
+                                                    <rect key="frame" x="328" y="4" width="32" height="32"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="width" constant="32" id="6bW-aU-peh"/>
+                                                        <constraint firstAttribute="height" constant="32" id="veJ-RH-vPo"/>
+                                                    </constraints>
+                                                    <state key="normal" backgroundImage="setting"/>
+                                                    <connections>
+                                                        <action selector="onSearchSettingClick:" destination="BYZ-38-t0r" eventType="touchUpInside" id="BeP-g0-BcU"/>
+                                                    </connections>
+                                                </button>
                                             </subviews>
                                             <constraints>
+                                                <constraint firstItem="JHV-Bq-B92" firstAttribute="centerY" secondItem="0xv-T2-kkQ" secondAttribute="centerY" id="63I-xQ-ZTJ"/>
+                                                <constraint firstAttribute="trailing" secondItem="JHV-Bq-B92" secondAttribute="trailing" constant="15" id="6KY-rP-Esc"/>
                                                 <constraint firstAttribute="trailing" secondItem="dbw-1x-pdX" secondAttribute="trailing" id="Uth-IV-FRY"/>
                                                 <constraint firstAttribute="bottom" secondItem="dbw-1x-pdX" secondAttribute="bottom" id="ZED-OB-kBf"/>
                                                 <constraint firstItem="dbw-1x-pdX" firstAttribute="leading" secondItem="0xv-T2-kkQ" secondAttribute="leading" constant="10" id="duh-Bk-yhC"/>
@@ -49,6 +62,7 @@
                                         </tableViewCellContentView>
                                         <connections>
                                             <outlet property="modeNameLabel" destination="dbw-1x-pdX" id="INi-W8-tYE"/>
+                                            <outlet property="settingBtn" destination="JHV-Bq-B92" id="laS-sw-7v9"/>
                                         </connections>
                                     </tableViewCell>
                                 </prototypes>
@@ -523,6 +537,39 @@
             </objects>
             <point key="canvasLocation" x="3490" y="831"/>
         </scene>
+        <!--Search Setting View Controller-->
+        <scene sceneID="E9O-Od-evq">
+            <objects>
+                <viewController storyboardIdentifier="SearchSettingViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="HjQ-EP-gNK" customClass="SearchSettingViewController" sceneMemberID="viewController">
+                    <layoutGuides>
+                        <viewControllerLayoutGuide type="top" id="zdM-Fo-koS"/>
+                        <viewControllerLayoutGuide type="bottom" id="Jdj-vV-b20"/>
+                    </layoutGuides>
+                    <view key="view" contentMode="scaleToFill" id="uBt-Sj-ydk">
+                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ck2-Kk-2s6" customClass="CommonEditorTableContainerView">
+                                <rect key="frame" x="0.0" y="20" width="375" height="647"/>
+                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                            </view>
+                        </subviews>
+                        <color key="backgroundColor" red="0.87941224090000003" green="0.87941224090000003" blue="0.87941224090000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                        <constraints>
+                            <constraint firstItem="Jdj-vV-b20" firstAttribute="top" secondItem="Ck2-Kk-2s6" secondAttribute="bottom" id="FKm-vA-EME"/>
+                            <constraint firstItem="Ck2-Kk-2s6" firstAttribute="leading" secondItem="uBt-Sj-ydk" secondAttribute="leading" id="pHZ-Ph-6xe"/>
+                            <constraint firstAttribute="trailing" secondItem="Ck2-Kk-2s6" secondAttribute="trailing" id="usV-iH-5fi"/>
+                            <constraint firstItem="Ck2-Kk-2s6" firstAttribute="top" secondItem="zdM-Fo-koS" secondAttribute="bottom" id="wHZ-AT-GS8"/>
+                        </constraints>
+                    </view>
+                    <connections>
+                        <outlet property="tableContainer" destination="Ck2-Kk-2s6" id="N28-Ec-lK0"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="Kla-18-rXP" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="-804" y="856"/>
+        </scene>
     </scenes>
     <resources>
         <image name="check_1" width="24" height="24"/>

+ 1 - 0
RedAnt Mobile/RedAnt Mobile/RAModeCell.h

@@ -14,5 +14,6 @@
 //@property (nonatomic,strong) RAModel *model;
 @property (nonatomic,strong) NSMutableDictionary *modeinfo;
 
+@property (weak, nonatomic) IBOutlet UIButton *settingBtn;
 
 @end

+ 11 - 0
RedAnt Mobile/RedAnt Mobile/RAModeCell.m

@@ -30,6 +30,17 @@
 -(void)setModeinfo:(NSMutableDictionary *)modeinfo
 {
     _modeinfo = modeinfo;
+    
+    if([modeinfo[@"type"] isEqualToString:@"query"])
+    {
+        self.settingBtn.hidden=false;
+    }
+    else
+    {
+        self.settingBtn.hidden=true;
+    }
+    
+    
 //    self.modeNameLabel.text = modeinfo[@"name"];
     [self setMode:modeinfo[@"name"] desc:modeinfo[@"description"]];
 }

+ 19 - 1
RedAnt Mobile/RedAnt Mobile/RAModeListViewController.m

@@ -18,7 +18,7 @@
 #import "ModelModeViewController.h"
 #import "PopModeViewController.h"
 #import "RootViewController.h"
-
+#import "SearchSettingViewController.h"
 @interface RAModeListViewController () <UITableViewDelegate,UITableViewDataSource>
 
 @property (weak, nonatomic) IBOutlet UITableView *modeTableView;
@@ -303,6 +303,24 @@
     [self.navigationController pushViewController:vc animated:YES];
 }
 
+- (IBAction)onSearchSettingClick:(id)sender {
+    
+    UIView* v=(UIView*)sender;
+    RAModeCell *cell = (RAModeCell*)v.superview.superview;
+//    NSIndexPath* indexPath=[self.modeTableView indexPathForCell:(UITableViewCell*)v.superview.superview];
+        NSMutableDictionary* modeinfo= cell.modeinfo;
+    
+    SearchSettingViewController *queryVC = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"SearchSettingViewController"];
+    
+    queryVC.params = [NSMutableDictionary new];
+    queryVC.params[@"query_id"]=modeinfo[@"query_id"];
+    queryVC.params[@"title"]=[NSString stringWithFormat:@"%@ setting",modeinfo[@"name"]];
+    queryVC.request_url = [RANetwork get_url:URL_QUERY_SETTIING];
+    queryVC.url_type = URL_REMOTE;
+    
+
+    [self.navigationController pushViewController:queryVC animated:YES];
+}
 
 
 @end

+ 2 - 0
RedAnt Mobile/RedAnt Mobile/RANetwork.h

@@ -25,4 +25,6 @@
 + (NSDictionary *)getModelManufacture:(NSString *)model;
 
 +(NSString*) get_url:(NSString*) interface;
++(NSDictionary*)query_setting:(NSString*) request_url params:(NSMutableDictionary*)params;
++(NSDictionary*)save_querysetting : (NSMutableDictionary*) params;
 @end

+ 56 - 5
RedAnt Mobile/RedAnt Mobile/RANetwork.m

@@ -74,6 +74,29 @@
     NSDictionary *resultDic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
     return resultDic;
 }
++(NSDictionary*)save_querysetting : (NSMutableDictionary*) params
+{
+    
+#ifdef FAKE_DATA
+    NSString *Path =nil;
+    Path=[[NSBundle mainBundle] pathForResource:@"predef_query.json" ofType:nil];
+    
+    NSData* data1 = [NSData dataWithContentsOfFile:Path];
+    return [[NSJSONSerialization JSONObjectWithData:data1 options:NSJSONReadingMutableContainers error:nil] mutableCopy];
+#endif
+    
+    
+    params[ @"_action"]=@"ant_mobile";
+    params[ @"_operate"]=@"save_searchsetting";
+    
+    
+    // params[@"_operate"]=@"valid_upload";
+    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+    
+    NSData *data = [self get_json:[self get_url:URL_SAVE_QUERY_SETTIING] parameters:params file:nil];
+    NSDictionary *resultDic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
+    return resultDic;
+}
 +(NSString*)download_query : (NSString*) url
 {
     
@@ -207,7 +230,7 @@
     } decrypt_handler:^NSMutableDictionary *(NSMutableDictionary *jsobj) {
         
         NSString* base64str = jsobj[@"str"];
-        NSString* decryptstr=[AESCrypt AES128Decrypt:base64str key:@"usai2010"];
+        NSString* decryptstr=[AESCrypt AES128Decrypt:base64str key:@"Usai2010"];
         jsobj=[[RAConvertor string2dict:decryptstr] mutableCopy];
         return jsobj;
     }];
@@ -223,9 +246,9 @@
 +(NSMutableDictionary*) prepare_addtional_params:(NSMutableDictionary* ) params
 {
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    if(appDelegate.user!=nil)
+    if(appDelegate.user!=nil && params[@"user"] == nil)
         [params setValue:[AESCrypt AES128Encrypt:appDelegate.user key:@"Usai2010"] forKey:@"user"];
-    if(appDelegate.password!=nil)
+    if(appDelegate.password!=nil&& params[@"pwd"] == nil)
         [params setValue:[AESCrypt AES128Encrypt:appDelegate.password key:@"Usai2010"] forKey:@"pwd"];
     
     
@@ -325,6 +348,34 @@
     return [self request_Editor:request_url params:params];
 }
 
+
++(NSDictionary*)query_setting:(NSString*) request_url params:(NSMutableDictionary*)params
+{
+#ifdef FAKE_DATA
+    
+    NSString *Path = [[NSBundle mainBundle] pathForResource:@"query_setting.json" ofType:nil];
+    
+    NSData* data1 = [NSData dataWithContentsOfFile:Path];
+    return [[NSJSONSerialization JSONObjectWithData:data1 options:NSJSONReadingMutableContainers error:nil] mutableCopy];
+#endif
+    
+    
+    
+    
+    params[ @"_action"]=@"ant_mobile";
+    params[ @"_operate"]=@"search_setting";
+    
+    
+    // params[@"_operate"]=@"valid_upload";
+    //    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+    
+    //    NSData *data = [self get_json:[self get_url:URL_QUERY_UI] parameters:params file:nil];
+    //    NSDictionary *resultDic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
+    //    return resultDic;
+    
+    return [self request_Editor:request_url params:params];
+}
+
 +(NSDictionary*)require_orderdetail:(NSString*) request_url params:(NSMutableDictionary*)params
 {
     
@@ -342,8 +393,8 @@
 {
     //    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    if(appDelegate.user!=nil)
-        [params setValue:appDelegate.user forKey:@"user"];
+//    if(appDelegate.user!=nil)
+//        [params setValue:appDelegate.user forKey:@"user"];
     
     
     //    if(![appDelegate.order_customer_id isEqualToString: appDelegate.contact_id]&& appDelegate.order_customer_id!=nil)

+ 13 - 0
RedAnt Mobile/RedAnt Mobile/SearchSettingViewController.h

@@ -0,0 +1,13 @@
+//
+//  SearchSettingViewController.h
+//  RedAnt Mobile
+//
+//  Created by Ray on 08/12/2017.
+//  Copyright © 2017 Ray. All rights reserved.
+//
+
+#import "CommonEditorViewController.h"
+
+@interface SearchSettingViewController : CommonEditorViewController
+
+@end

+ 101 - 0
RedAnt Mobile/RedAnt Mobile/SearchSettingViewController.m

@@ -0,0 +1,101 @@
+//
+//  SearchSettingViewController.m
+//  RedAnt Mobile
+//
+//  Created by Ray on 08/12/2017.
+//  Copyright © 2017 Ray. All rights reserved.
+//
+
+#import "SearchSettingViewController.h"
+#import "RANetwork.h"
+#import "RAUtils.h"
+@interface SearchSettingViewController ()
+
+@end
+
+@implementation SearchSettingViewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+    
+    UIBarButtonItem *searchItem = [[UIBarButtonItem alloc] initWithTitle:@"Save" style:UIBarButtonItemStylePlain target:self action:@selector(RBItemClick:)];
+    
+    self.navigationItem.rightBarButtonItems = @[searchItem];
+}
+
+- (void)RBItemClick:(UIBarButtonItem *)item {
+    
+    //    self.content_data_download[@"hidden_params"];
+    
+    
+    
+    
+    NSMutableDictionary* upparams = [self check_cancommit:false];
+    
+    [upparams addEntriesFromDictionary:self.content_data_download[@"hidden_params"]];
+    
+    upparams[@"query_id"]=self.params[@"query_id"];
+    
+    
+    
+        
+            
+            __weak typeof(self) weakSelf = self;
+            dispatch_async(dispatch_get_global_queue(0, 0), ^{
+                NSDictionary *contentDic = [RANetwork save_querysetting:upparams];
+                NSInteger result = [[contentDic objectForKey:@"result"] integerValue];
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    if (weakSelf) {
+                        __strong typeof(weakSelf) strongSelf = weakSelf;
+                        if (result == RESULT_TRUE) {
+                            [self.navigationController popViewControllerAnimated:false];
+                        } else {
+                            [RAUtils message_alert:[contentDic objectForKey:@"err_msg"] title:@"Warning" controller:strongSelf];
+                        }
+                        
+                    }
+                    
+                });
+            });
+        
+    
+    
+    
+//
+////    NSArray* criteria = [RAConvertor Dict2KVArray:upparams trim:true];
+//
+//
+//    NSMutableDictionary* result_params = [NSMutableDictionary new];
+//    result_params[@"criteria"] = [RAConvertor dict2string:criteria];//criteria;
+//    result_params[@"query_id"]=self.params[@"query_id"];
+//    result_params[@"title"]=self.params[@"title"];
+//    ResultViewController *preQueryVC = [[UIStoryboard storyboardWithName:@"Result" bundle:nil] instantiateViewControllerWithIdentifier:@"ResultViewController"];
+//    [preQueryVC setQueryParams: result_params];
+//
+//    [self.navigationController pushViewController:preQueryVC animated:YES];
+    
+
+    
+}
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+/*
+#pragma mark - Navigation
+
+// In a storyboard-based application, you will often want to do a little preparation before navigation
+- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
+    // Get the new view controller using [segue destinationViewController].
+    // Pass the selected object to the new view controller.
+}
+*/
+#pragma mark Request Editor
+-(NSDictionary*)request_Editor:(NSString*) request_url params:(NSMutableDictionary*)params
+{
+    return [RANetwork query_setting:request_url params:params];
+}
+@end

+ 9 - 121
RedAnt Mobile/RedAnt Mobile/commoneditor.phone.xib

@@ -1,17 +1,18 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina4_7" orientation="portrait">
         <adaptation id="fullscreen"/>
     </device>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="testViewController">
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="CommonEditorViewController">
             <connections>
-                <outlet property="tableview" destination="ebs-zF-tTp" id="j9o-X2-e4k"/>
+                <outlet property="tableContainer" destination="3nr-Ke-uFN" id="2IU-qL-9C8"/>
+                <outlet property="view" destination="iN0-l3-epB" id="3cd-nX-kjn"/>
             </connections>
         </placeholder>
         <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
@@ -19,127 +20,14 @@
             <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <subviews>
-                <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="ebs-zF-tTp">
+                <view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3nr-Ke-uFN" customClass="CommonEditorTableContainerView">
                     <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
-                    <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
-                </tableView>
+                    <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
+                    <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                </view>
             </subviews>
             <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-            <constraints>
-                <constraint firstItem="ebs-zF-tTp" firstAttribute="height" secondItem="iN0-l3-epB" secondAttribute="height" id="AWK-NW-Ya6"/>
-                <constraint firstItem="ebs-zF-tTp" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="ony-jt-ZMf"/>
-                <constraint firstItem="ebs-zF-tTp" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="p54-jI-qTD"/>
-                <constraint firstItem="ebs-zF-tTp" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="pux-ts-RIc"/>
-            </constraints>
             <point key="canvasLocation" x="24.5" y="52.5"/>
         </view>
-        <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="CommonEditorCellSwitch" id="HlW-4i-fdR">
-            <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
-            <autoresizingMask key="autoresizingMask"/>
-            <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="HlW-4i-fdR" id="Lg3-Dd-1na">
-                <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
-                <autoresizingMask key="autoresizingMask"/>
-                <subviews>
-                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="B1u-pi-BD9">
-                        <rect key="frame" x="0.0" y="11" width="42" height="21"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
-                        <nil key="textColor"/>
-                        <nil key="highlightedColor"/>
-                    </label>
-                    <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="R18-X7-Y6a">
-                        <rect key="frame" x="326" y="6" width="51" height="31"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                    </switch>
-                </subviews>
-            </tableViewCellContentView>
-            <point key="canvasLocation" x="-441" y="-37"/>
-        </tableViewCell>
-        <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="CommonEditorCellModel" rowHeight="160" id="v06-Df-Jhg" customClass="CommonEditorCellModel">
-            <rect key="frame" x="0.0" y="0.0" width="782" height="160"/>
-            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-            <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="v06-Df-Jhg" id="ZZU-4e-UmO">
-                <rect key="frame" x="0.0" y="0.0" width="782" height="160"/>
-                <autoresizingMask key="autoresizingMask"/>
-                <subviews>
-                    <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="qop-S8-vuX">
-                        <rect key="frame" x="20" y="20" width="100" height="100"/>
-                        <autoresizingMask key="autoresizingMask"/>
-                    </imageView>
-                    <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="name&amp;description" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VIR-Xu-Swb">
-                        <rect key="frame" x="127" y="15" width="323" height="81"/>
-                        <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
-                        <nil key="highlightedColor"/>
-                    </label>
-                    <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="1234567.00" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fwu-l4-QV6">
-                        <rect key="frame" x="634" y="45" width="127" height="21"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
-                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
-                        <nil key="highlightedColor"/>
-                    </label>
-                    <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="x9999" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GNW-Ul-rH8">
-                        <rect key="frame" x="634" y="75" width="127" height="21"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
-                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
-                        <nil key="highlightedColor"/>
-                    </label>
-                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Masert pack:9999" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vkD-X8-tj9">
-                        <rect key="frame" x="461" y="15" width="142" height="21"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
-                        <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                        <nil key="highlightedColor"/>
-                    </label>
-                    <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="$1234567.00" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BjA-W7-8R0" customClass="StrikethroughLabel">
-                        <rect key="frame" x="481" y="45" width="102" height="21"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
-                        <color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                        <nil key="highlightedColor"/>
-                    </label>
-                    <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Discount 99.99% off" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PUi-AQ-jUe">
-                        <rect key="frame" x="454" y="75" width="156" height="21"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
-                        <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                        <nil key="highlightedColor"/>
-                    </label>
-                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Price ($)" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BbQ-oI-PtK">
-                        <rect key="frame" x="622" y="15" width="126" height="21"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
-                        <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                        <nil key="highlightedColor"/>
-                    </label>
-                    <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="123456789.00" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hLz-ET-xoZ">
-                        <rect key="frame" x="634" y="106" width="127" height="21"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
-                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
-                        <nil key="highlightedColor"/>
-                    </label>
-                    <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6mg-nb-gdN">
-                        <rect key="frame" x="128" y="102" width="482" height="30"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                        <state key="normal" title="Button"/>
-                        <connections>
-                            <action selector="onClickBundle:" destination="v06-Df-Jhg" eventType="touchUpInside" id="n76-JD-xTP"/>
-                        </connections>
-                    </button>
-                </subviews>
-            </tableViewCellContentView>
-            <connections>
-                <outlet property="buttonBundle" destination="6mg-nb-gdN" id="cvi-RN-tl9"/>
-                <outlet property="imgModel" destination="qop-S8-vuX" id="YE3-On-XRv"/>
-                <outlet property="labelCount" destination="GNW-Ul-rH8" id="1Yv-Rg-EU6"/>
-                <outlet property="labelDescription" destination="VIR-Xu-Swb" id="7Yd-5Z-NDh"/>
-                <outlet property="labelDiscount" destination="PUi-AQ-jUe" id="kP7-Ft-0yQ"/>
-                <outlet property="labelMasterPack" destination="vkD-X8-tj9" id="JVT-Cm-uTI"/>
-                <outlet property="labelOldPrice" destination="BjA-W7-8R0" id="x5Y-me-e5t"/>
-                <outlet property="labelTotalPrice" destination="hLz-ET-xoZ" id="4DJ-3O-HsV"/>
-                <outlet property="labelUnitPrice" destination="fwu-l4-QV6" id="JnQ-vx-jHk"/>
-            </connections>
-            <point key="canvasLocation" x="-435" y="-406"/>
-        </tableViewCell>
     </objects>
 </document>

+ 2 - 0
RedAnt Mobile/RedAnt Mobile/config.h

@@ -40,6 +40,8 @@
 #define URL_LOGIN @"wm_postgresql/index.php"
 #define URL_QUERY @""
 #define URL_QUERY_UI @""
+#define URL_QUERY_SETTIING @""
+#define URL_SAVE_QUERY_SETTIING @""
 #define  URL_REQUIRE_SERVER  @"http://192.168.0.155/wm_postgresql/ant_mobile_company_valid.php"
 #define URL_KV_DETAIL @""
 #define URL_ORDER_DETAIL @""

+ 119 - 0
RedAnt Mobile/RedAnt Mobile/query_setting.json

@@ -0,0 +1,119 @@
+
+{
+    "result": 2,
+    "section_count": 1,
+    "section_1": {
+        "count": 2,
+        "title": "Setting",
+        "item_0": {
+            "aname": "Fields",
+            "name": "fields",
+            "sort": true,
+            "control": "enum",
+            "single_select": "false",
+            "cadedate": {
+                "count": 9,
+                "val_0": {
+                    "value_id": "location",
+                    "check": 1,
+                    "value": "Location"
+                },
+                "val_1": {
+                    "value_id": "customer",
+                    "check": 1,
+                    "value": "Customer"
+                },
+                "val_2": {
+                    "value_id": "customer_name",
+                    "check": 1,
+                    "value": "Customer Name"
+                },
+                "val_3": {
+                    "value_id": "order_discount",
+                    "check": 1,
+                    "value": "Order Discount"
+                },
+                "val_4": {
+                    "value_id": "sales_discount",
+                    "check": 1,
+                    "value": "Sales Discount"
+                },
+                "val_5": {
+                    "value_id": "field5",
+                    "check": 0,
+                    "value": "field5"
+                },
+                "val_6": {
+                    "value_id": "field6",
+                    "check": 0,
+                    "value": "field6"
+                },
+                "val_7": {
+                    "value_id": "field7",
+                    "check": 0,
+                    "value": "field7"
+                },
+                "val_8": {
+                    "value_id": "field8",
+                    "check": 0,
+                    "value": "field8"
+                }
+            }
+        },
+        "item_1": {
+            "aname": "criteria",
+            "name": "criteria",
+            "sort": true,
+            "control": "enum",
+            "single_select": "false",
+            "cadedate": {
+                "count": 9,
+                "val_0": {
+                    "value_id": "location",
+                    "check": 1,
+                    "value": "Location"
+                },
+                "val_1": {
+                    "value_id": "customer",
+                    "check": 1,
+                    "value": "Customer"
+                },
+                "val_2": {
+                    "value_id": "customer_name",
+                    "check": 1,
+                    "value": "Customer Name"
+                },
+                "val_3": {
+                    "value_id": "order_discount",
+                    "check": 1,
+                    "value": "Order Discount"
+                },
+                "val_4": {
+                    "value_id": "sales_discount",
+                    "check": 1,
+                    "value": "Sales Discount"
+                },
+                "val_5": {
+                    "value_id": "field5",
+                    "check": 0,
+                    "value": "field5"
+                },
+                "val_6": {
+                    "value_id": "field6",
+                    "check": 0,
+                    "value": "field6"
+                },
+                "val_7": {
+                    "value_id": "field7",
+                    "check": 0,
+                    "value": "field7"
+                },
+                "val_8": {
+                    "value_id": "field8",
+                    "check": 0,
+                    "value": "field8"
+                }
+            }
+        }
+    }
+}