Pen Li 9 лет назад
Родитель
Сommit
0d225ca068

BIN
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 1 - 0
RedAnt ERP Mobile/common/Functions/offline/SelectOrderTableViewCell.h

@@ -11,5 +11,6 @@
 @interface SelectOrderTableViewCell : UITableViewCell
 @property (strong, nonatomic) IBOutlet UILabel *labelsoid;
 @property (strong, nonatomic) IBOutlet UILabel *labelcompany;
+@property (strong, nonatomic) IBOutlet UIButton *checkedButton;
 
 @end

+ 4 - 0
RedAnt ERP Mobile/common/Functions/offline/SelectOrderTableViewCell.m

@@ -20,6 +20,10 @@
     [super setSelected:selected animated:animated];
 
     // Configure the view for the selected state
+    
+//    self.selected = NO;
+//    self.checkedButton.selected = !self.checkedButton.selected;
+    
 }
 
 @end

+ 127 - 8
RedAnt ERP Mobile/common/Functions/offline/SelectUploadOrderViewController.m

@@ -7,8 +7,16 @@
 //
 
 #import "SelectUploadOrderViewController.h"
+#import "iSalesDB.h"
+#import <sqlite3.h>
+#import "SelectOrderTableViewCell.h"
 
-@interface SelectUploadOrderViewController ()
+@interface SelectUploadOrderViewController ()<UITableViewDataSource,UITableViewDelegate>
+
+@property (nonatomic,strong) NSMutableArray<NSDictionary *> *sync_data;
+
+@property (strong, nonatomic) IBOutlet UITableView *syncDataTableView;
+@property (strong, nonatomic) IBOutlet UIButton *uploadButton;
 
 @end
 
@@ -17,6 +25,10 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     // Do any additional setup after loading the view.
+    
+//    self.syncDataTableView.delegate = self;
+//    self.syncDataTableView.dataSource = self;
+    
 }
 
 - (void)didReceiveMemoryWarning {
@@ -24,14 +36,121 @@
     // Dispose of any resources that can be recreated.
 }
 
-/*
-#pragma mark - Navigation
+- (NSMutableArray<NSDictionary *> *)sync_data {
+    if (!_sync_data) {
+        _sync_data = [NSMutableArray array];
+        
+        NSString *sql = @"select decrypt(c.company_name),o.so_id,o.sync_data from (select so_id,sync_data,customer_cid from offline_order  where sync_data not null) as o join offline_contact as c on c.contact_id = o.customer_cid ;";
+        [iSalesDB jk_query:sql completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container, long *count) {
+            
+            const char *cn = (char *)sqlite3_column_text(stmt,0);
+            if (cn == NULL) {
+                cn = "";
+            }
+            const char *_id = (char *)sqlite3_column_text(stmt,1);
+            if (_id == NULL) {
+                _id = "";
+            }
+            const char *data = (char *)sqlite3_column_text(stmt,2);
+            if (data == NULL) {
+                data = "";
+            }
+            
+            NSString *company_name = [NSString stringWithUTF8String:cn];
+            NSString *so_id = [NSString stringWithUTF8String:_id];
+            NSString *sync_data_str = [NSString stringWithUTF8String:data];
+            
+            NSDictionary *dic = [@{
+                                  @"check" : @(1),
+                                  @"company_name" : company_name,
+                                  @"so_id" : so_id,
+                                  @"sync_data" : sync_data_str
+                                  } mutableCopy];
+            [_sync_data addObject:dic];
+            
+            
+        }];
+        
+    }
+    return _sync_data;
+}
 
-// 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.
+- (IBAction)uploadButtonClicked:(UIButton *)sender {
+    
+    NSMutableArray *uploadArray = [NSMutableArray array];
+    
+    for (NSDictionary *dic in self.sync_data) {
+    
+        int check = [dic[@"check"] integerValue];
+        NSString *so_id = dic[@"so_id"];
+        
+        if (check == 0) {
+            [uploadArray addObject:so_id];
+        }
+        
+    }
+    
+    if (self.returnValue) {
+        self.returnValue(uploadArray);
+    }
+    
 }
-*/
+
+#pragma mark - dataSource
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
+    return 1;
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+    return self.sync_data.count;
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+    
+    SelectOrderTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SelectOrderTableViewCell" forIndexPath:indexPath];
+    
+    NSDictionary *dic = [self.sync_data objectAtIndex:indexPath.row];
+    int check = [dic[@"check"] integerValue];
+    NSString *so_id = dic[@"so_id"];
+    NSString *company_name = dic[@"company_name"];
+    
+    if (check)
+        cell.checkedButton.selected = YES;
+    
+    cell.labelsoid.text = so_id;
+    cell.labelcompany.text = company_name;
+    
+    
+    return cell;
+}
+
+#pragma mark - delegate
+
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
+    return 44;
+}
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+    
+    SelectOrderTableViewCell *cell = (SelectOrderTableViewCell *)[tableView cellForRowAtIndexPath:indexPath];
+    
+    cell.selected = NO;
+    cell.checkedButton.selected = !cell.checkedButton.selected;
+    
+    NSMutableDictionary *dic = (NSMutableDictionary *)[self.sync_data objectAtIndex:indexPath.row];
+    int check = [dic[@"check"] integerValue];
+   
+    if (cell.checkedButton.selected) {
+        check = 1;
+    } else {
+        check = 0;
+    }
+    [dic setValue:[NSNumber numberWithInteger:check] forKey:@"check"];
+    
+}
+
+//- (BOOL
+
 
 @end

Разница между файлами не показана из-за своего большого размера
+ 144 - 144
RedAnt ERP Mobile/iSales-NPD/Base.lproj/Main.storyboard


+ 29 - 6
RedAnt ERP Mobile/iSales-NPD/Base.lproj/OLM.storyboard

@@ -203,14 +203,20 @@
                                             <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" id="AIn-eK-sCn">
-                                                    <rect key="frame" x="8" y="15" width="202" height="21"/>
+                                                    <rect key="frame" x="48" y="15" width="202" height="21"/>
                                                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                     <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
                                                     <nil key="highlightedColor"/>
                                                 </label>
+                                                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="hrK-DY-RbO">
+                                                    <rect key="frame" x="10" y="15" width="21" height="21"/>
+                                                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                                    <state key="normal" image="check_0_24"/>
+                                                    <state key="selected" image="check_1_24"/>
+                                                </button>
                                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="v9S-8N-eqS">
-                                                    <rect key="frame" x="247" y="15" width="513" height="21"/>
+                                                    <rect key="frame" x="381" y="15" width="341" height="21"/>
                                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                     <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
@@ -219,24 +225,41 @@
                                             </subviews>
                                         </tableViewCellContentView>
                                         <connections>
+                                            <outlet property="checkedButton" destination="hrK-DY-RbO" id="AcK-F0-dz8"/>
                                             <outlet property="labelcompany" destination="v9S-8N-eqS" id="99v-V9-l2l"/>
                                             <outlet property="labelsoid" destination="AIn-eK-sCn" id="YQb-1w-FW8"/>
                                         </connections>
                                     </tableViewCell>
                                 </prototypes>
+                                <connections>
+                                    <outlet property="dataSource" destination="c5p-Fv-SY7" id="qBy-XV-eut"/>
+                                    <outlet property="delegate" destination="c5p-Fv-SY7" id="65r-OG-6ds"/>
+                                </connections>
                             </tableView>
-                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="NKA-5N-u0m">
-                                <rect key="frame" x="654" y="974" width="81" height="30"/>
+                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="NKA-5N-u0m">
+                                <rect key="frame" x="612" y="974" width="156" height="30"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                                <state key="normal" title="Button"/>
+                                <state key="normal" image="btn_ok"/>
+                                <connections>
+                                    <action selector="uploadButtonClicked:" destination="c5p-Fv-SY7" eventType="touchUpInside" id="wGz-Je-4TB"/>
+                                </connections>
                             </button>
                         </subviews>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                     </view>
+                    <connections>
+                        <outlet property="syncDataTableView" destination="lRS-dn-XTu" id="dKZ-Ur-9t3"/>
+                        <outlet property="uploadButton" destination="NKA-5N-u0m" id="jdB-LB-0Bf"/>
+                    </connections>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="krm-rW-vWy" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="2762" y="754"/>
+            <point key="canvasLocation" x="2719" y="677"/>
         </scene>
     </scenes>
+    <resources>
+        <image name="btn_ok" width="102" height="30"/>
+        <image name="check_0_24" width="24" height="24"/>
+        <image name="check_1_24" width="24" height="24"/>
+    </resources>
 </document>

Некоторые файлы не были показаны из-за большого количества измененных файлов