فهرست منبع

增加Availability标签,修复Cart编辑全选删除失败。

Pen Li 9 سال پیش
والد
کامیت
0667d1d192

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


+ 3 - 0
RedAnt ERP Mobile/common/CommonEditor/CommonEditorCellModel.h

@@ -22,4 +22,7 @@
 @property (strong, nonatomic) IBOutlet StrikethroughLabel *labelOldPrice;
 @property (strong, nonatomic) IBOutlet UIButton *buttonBundle;
 @property (strong, nonatomic) NSDictionary* bundle_item;
+@property (strong, nonatomic) IBOutlet UILabel *avalibilityLabel;
+
+
 @end

+ 9 - 1
RedAnt ERP Mobile/common/CommonEditor/CommonEditorViewController.m

@@ -156,7 +156,7 @@
         
         NSMutableDictionary *urgencyDic = [NSMutableDictionary dictionary];
 
-        NSLog(@"timer start....");
+        DebugLog(@"timer start....");
         
         [urgencyDic setValue:weakSelf.content_data_download forKey:[NSString stringWithFormat:@"%@_restored_data",self.class_name]];
         
@@ -3976,6 +3976,14 @@
                 
             }
             
+            NSString *availability = [item_json objectForKey:@"quantity_available"];
+            NSString *available_str = @"Available Now";
+            if ([availability integerValue] > 0) {
+                available_str = @"Available Now";
+            } else {
+                available_str = @"In Production";
+            }
+            cell.avalibilityLabel.text = available_str;
             
             NSString* img_url = [item_json valueForKey:@"img_url"];
             NSString* description = [item_json valueForKey:@"description"];

+ 42 - 14
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -6230,7 +6230,7 @@
 
             
             itemjson[@"Subtotal"] = [NSString stringWithFormat:@"%.2f",subTotal];
-            NSLog(@"item unite price: %@ \n discount: %f item count: %d subTotal: %f",Price,discount,item_count,subTotal);
+//            NSLog(@"item unite price: %@ \n discount: %f item count: %d subTotal: %f",Price,discount,item_count,subTotal);
            
             
             ret[[NSString stringWithFormat:@"item_%ld",(*count)++]]=itemjson;
@@ -6349,20 +6349,28 @@
 //    sqlite3 *db1 = [iSalesDB get_db];
     
     if (so_id) {
-        NSString *modelSql = [NSString stringWithFormat:@"select c.product_id,c.price,c.discount,c.item_count,c.line_note,m.name,m.description,c.item_id,m.stockUom,c._id from (select _id,product_id,decrypt(str_price) as price,discount,item_count,line_note,item_id from offline_cart where so_no='%@') c left join product m on c.product_id=m.product_id",so_id];
+//        NSString *modelSql = [NSString stringWithFormat:@"select c.product_id,c.price,c.discount,c.item_count,c.line_note,m.name,m.description,c.item_id,m.stockUom,c._id from (select _id,product_id,decrypt(str_price) as price,discount,item_count,line_note,item_id from offline_cart where so_no='%@') c left join product m on c.product_id=m.product_id",so_id];
+        
+        NSString *modelSql = [NSString stringWithFormat:@"select product_id,price,discount,item_count,item_id from (select product_id,decrypt(str_price) as price,discount,item_count,item_id from offline_cart where so_no='%@');",so_id];
         
         
         AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
         
         [iSalesDB jk_query:modelSql db:db1 close:NO completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container, long *count) {
             
+            
             NSMutableDictionary* itemjson = [[NSMutableDictionary alloc] init];
             
             int product_id = sqlite3_column_int(stmt, 0);
             
             char *str_price = (char*)sqlite3_column_text(stmt, 1);
             
-            int item_id = sqlite3_column_int(stmt, 7);
+            int discount = sqlite3_column_int(stmt, 2);
+            int item_count = sqlite3_column_int(stmt, 3);
+            
+//            int item_id = sqlite3_column_int(stmt, 7);
+            
+            int item_id = sqlite3_column_int(stmt, 4);
             
             NSString* Price=nil;
             if(str_price==nil)
@@ -6380,8 +6388,7 @@
             }
             
             
-            int discount = sqlite3_column_int(stmt, 2);
-            int item_count = sqlite3_column_int(stmt, 3);
+            
             
             
             itemjson[@"combine"]=[self model_bundle:item_id db:db1 compute_part:false];
@@ -6412,6 +6419,7 @@
             
             allItemPrice += subTotal;
             
+
         }];
         
         
@@ -6456,7 +6464,6 @@
 
 +(NSData*) offline_orderlist :(NSMutableDictionary *) params
 {
-    NSLog(@"order list: %@",params);
     NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];
     
     int limit = [[params valueForKey:@"limit"] intValue];
@@ -6506,11 +6513,14 @@
     
     NSString*     sqlQuery=[NSString stringWithFormat:@"SELECT o._id,o.so_id,o.status,o.sales_rep,o.create_by,decrypt(c.company_name),o.create_time,o.total_price,o.customer_contact,o.erpOrderStatus,o.order_id is null from offline_order o left join offline_contact c on o.customer_cid=c.contact_id where %@ order by o.create_time desc limit %d offset %d" ,where, limit, offset];
     
-    DebugLog(@"order list sql: %@",sqlQuery);
+//    DebugLog(@"order list sql: %@",sqlQuery);
     
     sqlite3 *db = [iSalesDB get_db];
     sqlite3_stmt * statement;
     
+    [iSalesDB execSql:@"BEGIN TRANSACTION" db:db];
+    
+
     
     if (sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil) == SQLITE_OK)
     {
@@ -6518,7 +6528,7 @@
         int count=0;
         while (sqlite3_step(statement) == SQLITE_ROW)
         {
-            
+           
             
             
             NSMutableDictionary* item=[[NSMutableDictionary alloc]init];
@@ -6553,11 +6563,14 @@
             if(create_time==nil)
                 create_time= "";
             NSString *nscreate_time= [[NSString alloc]initWithUTF8String:create_time];
-            DebugLog(@"time: %@",nscreate_time);
+
             nscreate_time = [self changeDateTimeFormate:nscreate_time]; // 与在线统一
 //            double total_price = sqlite3_column_double(statement, 7);
+
             double total_price = [self orderTotalPrice:[NSString stringWithUTF8String:soid] db:db close:NO];
             
+            
+            
             NSString *customer_contact = [self textAtColumn:8 statement:statement];
             
             NSString* nsstatus = [self orderStatus:status erpStatus:erpStatus];
@@ -6596,6 +6609,8 @@
             ret[[NSString stringWithFormat:@"item_%d",count]]= item;
             count++;
             
+           
+            
         }
         
         ret[@"count"]= [NSNumber numberWithInt:count];
@@ -6610,12 +6625,16 @@
         
     }
     
+   
+    
+    
     int total_count = [iSalesDB get_recordcount:db table:@"offline_order o left join offline_contact c on o.customer_cid=c.contact_id" where:where];
     
     ret[@"total_count"] = [NSNumber numberWithInteger:total_count];
     
+    [iSalesDB execSql:@"END TRANSACTION" db:db];
     [iSalesDB close_db:db];
-    NSLog(@"order list return");
+
     return [RAUtils dict2data:ret];
 }
 
@@ -6648,8 +6667,10 @@
     NSString *_id = [self valueInParams:params key:@"cartItemId"];
    
     NSString *orderCode = [self valueInParams:params key:@"orderCode"];
+    
+    _id = [NSString stringWithFormat:@"(%@)",_id];
 
-    NSString *sql = [NSString stringWithFormat:@"select product_id,item_count,item_id from offline_cart where so_no = '%@' and _id = %@;",orderCode,_id];
+    NSString *sql = [NSString stringWithFormat:@"select product_id,item_count,item_id from offline_cart where so_no = '%@' and _id in %@;",orderCode,_id];
     sqlite3 *db = [iSalesDB get_db];
     
     __block NSString *product_id = nil;
@@ -6679,7 +6700,8 @@
     [dic setValue:[NSNumber numberWithInteger:wish_count] forKey:@"wish_count"];
     
     // 删除
-    NSString *deleteSql = [NSString stringWithFormat:@"delete from offline_cart where _id = %@;",_id];
+    
+    NSString *deleteSql = [NSString stringWithFormat:@"delete from offline_cart where _id in %@;",_id];
     [iSalesDB execSql:deleteSql db:db];
     
     [iSalesDB close_db:db];
@@ -6697,7 +6719,9 @@
     NSString *_id = [self valueInParams:params key:@"cartItemId"];
     NSString *orderCode = [self valueInParams:params key:@"orderCode"];
     
-    NSString *sql = [NSString stringWithFormat:@"delete from offline_cart where _id = %@ and so_no = '%@';",_id,orderCode];
+    _id = [NSString stringWithFormat:@"(%@)",_id];
+    
+    NSString *sql = [NSString stringWithFormat:@"delete from offline_cart where so_no = '%@' and _id in %@ ;",orderCode,_id];
     int ret = [iSalesDB execSql:sql];
     
     
@@ -7511,7 +7535,7 @@
     __block int TotalCarton = 0;
     __block double payments = 0;
     
-    NSString *sql = [NSString stringWithFormat:@"select c.item_id,c.item_count,m.stockUom,c.price,c.discount,m.name,m.description,c.line_note from (select _id,product_id,decrypt(str_price) as price,discount,item_count,line_note,item_id from offline_cart where so_no='%@') c left join product m on c.product_id=m.product_id;",orderCode];
+    NSString *sql = [NSString stringWithFormat:@"select c.item_id,c.item_count,m.stockUom,c.price,c.discount,m.name,m.description,c.line_note,m.availability from (select _id,product_id,decrypt(str_price) as price,discount,item_count,line_note,item_id from offline_cart where so_no='%@') c left join product m on c.product_id=m.product_id;",orderCode];
     
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     
@@ -7557,6 +7581,9 @@
         // line note
         NSString *line_note = [self textAtColumn:7 statement:stmt];
         
+        int avaulability = sqlite3_column_int(stmt, 8);
+        
+        
         // img
         NSString *img = [self item_image:[NSString stringWithFormat:@"%@",[NSNumber numberWithInt:item_id]] db:db];
         
@@ -7588,6 +7615,7 @@
         [model_dic setValue:[NSString stringWithFormat:@"%.2f",subTotal] forKey:@"total_price"];
         [model_dic setValue:Price forKey:@"unit_price"];
         [model_dic setValue:[NSString stringWithFormat:@"%.2f",discount] forKey:@"discount"];
+        [model_dic setValue:[NSNumber numberWithInt:avaulability] forKey:@"quantity_available"];
         if (combine) {
             [model_dic setValue:combine forKey:@"combine"];
         }

+ 20 - 12
RedAnt ERP Mobile/iSales-NPD/Base.lproj/Main.storyboard

@@ -6458,28 +6458,22 @@ Email: redantsupport@united-us.net</string>
                                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                     <nil key="highlightedColor"/>
                                                 </label>
-                                                <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="x9999" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="PId-iu-lS8">
-                                                    <rect key="frame" x="622" y="75" width="126" 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" text="Masert pack:9999" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Hpw-xR-Jfy">
+                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Masert pack:9999" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Hpw-xR-Jfy">
                                                     <rect key="frame" x="461" y="15" width="142" height="21"/>
                                                     <autoresizingMask key="autoresizingMask" flexibleMinX="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="calibratedRGB"/>
                                                     <nil key="highlightedColor"/>
                                                 </label>
-                                                <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="$1234567.00" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="iUj-CY-YFb" customClass="StrikethroughLabel">
-                                                    <rect key="frame" x="481" y="45" width="102" height="21"/>
+                                                <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="$1234567.00" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="iUj-CY-YFb" customClass="StrikethroughLabel">
+                                                    <rect key="frame" x="461" y="45" width="102" height="21"/>
                                                     <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
                                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                     <color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
                                                     <nil key="highlightedColor"/>
                                                 </label>
-                                                <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Discount 99.99% off" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="axN-Co-LwC">
-                                                    <rect key="frame" x="454" y="75" width="156" height="21"/>
+                                                <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Discount 99.99% off" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="axN-Co-LwC">
+                                                    <rect key="frame" x="571" y="44" width="83" height="21"/>
                                                     <autoresizingMask key="autoresizingMask" flexibleMinX="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="calibratedRGB"/>
@@ -6506,9 +6500,23 @@ Email: redantsupport@united-us.net</string>
                                                         <action selector="onClickBundle:" destination="aNn-5E-yfU" eventType="touchUpInside" id="tU2-w2-q2j"/>
                                                     </connections>
                                                 </button>
+                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="avalibility: in product" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="ZPj-Qo-MRR">
+                                                    <rect key="frame" x="461" y="75" width="179" height="21"/>
+                                                    <autoresizingMask key="autoresizingMask" flexibleMinX="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="calibratedRGB"/>
+                                                    <nil key="highlightedColor"/>
+                                                </label>
+                                                <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="x9999" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="PId-iu-lS8">
+                                                    <rect key="frame" x="648" y="75" width="100" height="21"/>
+                                                    <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
+                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                    <nil key="highlightedColor"/>
+                                                </label>
                                             </subviews>
                                         </tableViewCellContentView>
                                         <connections>
+                                            <outlet property="avalibilityLabel" destination="ZPj-Qo-MRR" id="8MM-w5-yyz"/>
                                             <outlet property="buttonBundle" destination="JFB-43-DMy" id="31w-VI-Jbb"/>
                                             <outlet property="imgModel" destination="Joe-9c-mhx" id="20F-Pm-VIZ"/>
                                             <outlet property="labelCount" destination="PId-iu-lS8" id="XM1-6w-SlF"/>
@@ -6866,7 +6874,7 @@ Email: redantsupport@united-us.net</string>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                         <prototypes>
                             <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="Ebw-26-5Ud">
-                                <rect key="frame" x="0.0" y="86" width="768" height="44"/>
+                                <rect key="frame" x="0.0" y="22" width="768" height="44"/>
                                 <autoresizingMask key="autoresizingMask"/>
                                 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Ebw-26-5Ud" id="gop-RV-8fg">
                                     <rect key="frame" x="0.0" y="0.0" width="768" height="43"/>