Browse Source

实现方法:offline_cartremove : 和 offline_cartsetprice : 修改itemjson[@"cart_item_id"]=[NSNumber numberWithInt:_id].stringValue;

Pen Li 9 năm trước cách đây
mục cha
commit
ceff08197c

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


+ 56 - 4
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -1754,7 +1754,7 @@
             itemjson[@"cuft"]=[NSNumber numberWithDouble:cuft];
             itemjson[@"weight"]=[NSNumber numberWithDouble:weight];
             itemjson[@"carton"]=[NSNumber numberWithInt:carton];
-            itemjson[@"cart_item_id"]=[NSNumber numberWithInt:_id];
+            itemjson[@"cart_item_id"]=[NSNumber numberWithInt:_id].stringValue;
             itemjson[@"check"]=@"true";
             itemjson[@"product_id"]=[NSNumber numberWithInt:product_id].stringValue;
             itemjson[@"count"]=[NSNumber numberWithInt:item_count];
@@ -5503,18 +5503,70 @@
     
     return [RAUtils dict2data:dic];
 }
+
+#pragma mark cart delete
+
 +(NSData*) offline_cartremove :(NSMutableDictionary *) params
 {
+//    cartItemId = 548;
+//    orderCode = MOB1608110001;
+    
+    NSString *_id = [self valueInParams:params key:@"cartItemId"];
+    NSString *orderCode = [self valueInParams:params key:@"MOB1608110001"];
     
-    return nil;
+    NSString *sql = [NSString stringWithFormat:@"delete from offline_cart where _id = %@ and so_no = '%@';",_id,orderCode];
+    int ret = [iSalesDB execSql:sql];
+    
+    
+    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
+    [dic setValue:[NSNumber numberWithInteger:ret] forKey:@"result"];
+    [dic setValue:@"Regular Mode" forKey:@"mode"];
+    [dic setValue:@"160409" forKey:@"min_ver"];
+    
+    return [RAUtils dict2data:dic];
 }
 +(NSData*) offline_cartsetprice :(NSMutableDictionary *) params
 {
-    return nil;
+    DebugLog(@"cart set price params: %@",params);
+//    "cartitem_id" = 1;
+//    discount = "0.000000";
+//    "item_note" = "";
+//     price = "269.000000";
+    
+    NSString *_id = [self valueInParams:params key:@"cartitem_id"];
+    NSString *notes = [self valueInParams:params key:@"item_note"];
+    NSString *discount = [self valueInParams:params key:@"discount"];
+    NSString *price = [self valueInParams:params key:@"discount"];
+    price = [self translateSingleQuote:[AESCrypt fastencrypt:price]];
+    
+    NSString *sql = [NSString stringWithFormat:@"update offline_cart set str_price = '%@',discount = %f where _id = %@",price,discount.doubleValue,_id];
+    
+    int ret = [iSalesDB execSql:sql];
+    
+    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
+    [dic setValue:[NSNumber numberWithInteger:ret] forKey:@"result"];
+    [dic setValue:@"Regular Mode" forKey:@"mode"];
+    [dic setValue:@"160409" forKey:@"min_ver"];
+    
+    return [RAUtils dict2data:dic];
+    
 }
 +(NSData*) offline_cartsetlnotes :(NSMutableDictionary *) params
 {
-    return nil;
+    NSString *_id = [self valueInParams:params key:@"cartitem_id"];
+    NSString *notes = [self valueInParams:params key:@"notes"];
+    notes = [self translateSingleQuote:notes];
+    
+    NSString *sql = [NSString stringWithFormat:@"update offline_cart set line_note = '%@' where _id = %@",notes,_id];
+    
+    int ret = [iSalesDB execSql:sql];
+    
+    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
+    [dic setValue:[NSNumber numberWithInteger:ret] forKey:@"result"];
+    [dic setValue:@"Regular Mode" forKey:@"mode"];
+    [dic setValue:@"160409" forKey:@"min_ver"];
+    
+    return [RAUtils dict2data:dic];
 }