Sfoglia il codice sorgente

PDF同步增加tearsheet——id

Pen Li 9 anni fa
parent
commit
7cf7f82eb3

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


+ 16 - 17
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -10291,7 +10291,7 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
         NSString *line_note = [self textAtColumn:6 statement:stmt];
         NSString *line_note = [self textAtColumn:6 statement:stmt];
         double percent = sqlite3_column_double(stmt, 7);
         double percent = sqlite3_column_double(stmt, 7);
         
         
-        NSString *price_null = [self textAtColumn:3 statement:stmt];
+        NSString *price_null = [self textAtColumn:1 statement:stmt];
 /*        if ([price_null isEqualToString:@"null"]) {
 /*        if ([price_null isEqualToString:@"null"]) {
             price = [[self get_model_default_price:appDelegate.contact_id product_id:nil item_id:@(item_id) db:db] doubleValue];
             price = [[self get_model_default_price:appDelegate.contact_id product_id:nil item_id:@(item_id) db:db] doubleValue];
         }
         }
@@ -10415,7 +10415,7 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
     configureParams = [self translateSingleQuote:configureParams];
     configureParams = [self translateSingleQuote:configureParams];
     off_params = [self translateSingleQuote:off_params];
     off_params = [self translateSingleQuote:off_params];
     
     
-    NSString *save_pdf_sql = [NSString stringWithFormat:@"insert into offline_pdf (tearsheets_id,pdf_path,create_user,tear_note,tear_name,model_info,configureParams,is_local,off_params) values ((select ifnull(max(tearsheets_id),0) from offline_pdf) + 1,'%@','%@','%@','%@','%@','%@',1,'%@');",pdf_path,create_user,tear_note,tear_name,model_info,configureParams,off_params];
+    NSString *save_pdf_sql = [NSString stringWithFormat:@"insert into offline_pdf (pdf_path,create_user,tear_note,tear_name,model_info,configureParams,is_local,off_params) values ('%@','%@','%@','%@','%@','%@',1,'%@');",pdf_path,create_user,tear_note,tear_name,model_info,configureParams,off_params];
     
     
     if (tear_sheet_id) {
     if (tear_sheet_id) {
         int _id = [tear_sheet_id integerValue];
         int _id = [tear_sheet_id integerValue];
@@ -10555,17 +10555,10 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
     [dic setObject:[params objectForKey:@"product_ids"] forKey:@"product_ids"];
     [dic setObject:[params objectForKey:@"product_ids"] forKey:@"product_ids"];
     [dic setObject:[params objectForKey:@"item_ids"] forKey:@"item_ids"];
     [dic setObject:[params objectForKey:@"item_ids"] forKey:@"item_ids"];
     
     
+    // Regurlar Price
     NSMutableDictionary *section1 = [[dic objectForKey:@"section_1"] mutableCopy];
     NSMutableDictionary *section1 = [[dic objectForKey:@"section_1"] mutableCopy];
     NSMutableDictionary *price = [[section1 objectForKey:@"item_2"] mutableCopy];
     NSMutableDictionary *price = [[section1 objectForKey:@"item_2"] mutableCopy];
     __block NSMutableDictionary *cadedate = [NSMutableDictionary dictionary];
     __block NSMutableDictionary *cadedate = [NSMutableDictionary dictionary];
-//    {
-//        "count": 6,
-//        "val_1": {
-//            "value": "West Wholesale Price",
-//            "value_id": 17
-//        },
-//        
-//    }
     __block long val_count = 0;
     __block long val_count = 0;
     NSString *sql = @"select name,type,order_by from price order by order_by";
     NSString *sql = @"select name,type,order_by from price order by order_by";
     [iSalesDB jk_query:sql completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container, long *count) {
     [iSalesDB jk_query:sql completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container, long *count) {
@@ -10780,7 +10773,7 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
         return [RAUtils dict2data:dic];
         return [RAUtils dict2data:dic];
     }
     }
     
     
-    NSString *is_local_sql = [NSString stringWithFormat:@"select is_local,pdf_path from offline_pdf where tearsheets_id = %d and create_user = '%@';",tearsheetsId,[self translateSingleQuote:user]];
+    NSString *is_local_sql = [NSString stringWithFormat:@"select is_local,pdf_path from offline_pdf where _id = %d and create_user = '%@';",tearsheetsId,[self translateSingleQuote:user]];
     
     
     __block int is_local = 0;
     __block int is_local = 0;
     __block NSString *path = @"";
     __block NSString *path = @"";
@@ -10790,10 +10783,10 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
         path = [self textAtColumn:1 statement:stmt];
         path = [self textAtColumn:1 statement:stmt];
     }];
     }];
     
     
-    NSString *sql = [NSString stringWithFormat:@"update offline_pdf set is_delete = 1 where tearsheets_id = %d and create_user = '%@';",tearsheetsId,[self translateSingleQuote:user]];
+    NSString *sql = [NSString stringWithFormat:@"update offline_pdf set is_delete = 1 where _id = %d and create_user = '%@';",tearsheetsId,[self translateSingleQuote:user]];
     
     
     if (is_local == 1) {
     if (is_local == 1) {
-        sql = [NSString stringWithFormat:@"delete from offline_pdf where tearsheets_id = %d and create_user = '%@';",tearsheetsId,[self translateSingleQuote:user]];
+        sql = [NSString stringWithFormat:@"delete from offline_pdf where _id = %d and create_user = '%@';",tearsheetsId,[self translateSingleQuote:user]];
         
         
         // 删除文件
         // 删除文件
         [self offline_removePDFWithName:path];
         [self offline_removePDFWithName:path];
@@ -10930,11 +10923,11 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
     
     
     if (ver!=nil) {
     if (ver!=nil) {
         
         
-        where=@"is_dirty=1 and is_local = 1";
+        where=@"is_dirty=1";
         
         
     }
     }
-    
-    NSString *sqlQuery =[NSString stringWithFormat:@"select _id,tearsheets_id,pdf_path,create_user,tear_note,tear_name,model_info,createtime,modify_time,configureParams,off_params from offline_pdf where %@",where];
+#warning Price is not correct
+    NSString *sqlQuery =[NSString stringWithFormat:@"select _id,ifnull(tearsheets_id,'null'),pdf_path,create_user,tear_note,tear_name,model_info,createtime,modify_time,configureParams,off_params,is_delete from offline_pdf where %@",where];
     
     
     
     
     [ret setValue:[NSNumber numberWithInt:AP_USER_NOT_AUTH ] forKey:@"result"];
     [ret setValue:[NSNumber numberWithInt:AP_USER_NOT_AUTH ] forKey:@"result"];
@@ -10955,9 +10948,14 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
         NSString *urlParams = [self textAtColumn:9 statement:stmt];
         NSString *urlParams = [self textAtColumn:9 statement:stmt];
         NSString *off_params = [self textAtColumn:10 statement:stmt];
         NSString *off_params = [self textAtColumn:10 statement:stmt];
         NSString *uuid = [NSUUID UUID].UUIDString;
         NSString *uuid = [NSUUID UUID].UUIDString;
+        int is_delete = sqlite3_column_int(stmt, 11);
+        NSString *tearsheet_id_null = [self textAtColumn:1 statement:stmt];
+        
         
         
         [item setObject:[NSNumber numberWithInteger:_id] forKey:@"_id"];
         [item setObject:[NSNumber numberWithInteger:_id] forKey:@"_id"];
-        [item setObject:[NSNumber numberWithInteger:tearsheets_id] forKey:@"tearsheets_id"];
+        if (![tearsheet_id_null isEqualToString:@"null"]) {
+            [item setObject:[NSNumber numberWithInteger:tearsheets_id] forKey:@"tearsheets_id"];
+        }
         [item setObject:pdf_path forKey:@"pdf_path"];
         [item setObject:pdf_path forKey:@"pdf_path"];
         [item setObject:create_user forKey:@"create_user"];
         [item setObject:create_user forKey:@"create_user"];
         [item setObject:tear_note forKey:@"tear_note"];
         [item setObject:tear_note forKey:@"tear_note"];
@@ -10968,6 +10966,7 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
         [item setObject:urlParams forKey:@"urlParams"];
         [item setObject:urlParams forKey:@"urlParams"];
         [item setObject:off_params forKey:@"off_params"];
         [item setObject:off_params forKey:@"off_params"];
         [item setObject:uuid forKey:@"pdf_token"];
         [item setObject:uuid forKey:@"pdf_token"];
+        [item setObject:[NSNumber numberWithInt:is_delete] forKey:@"is_delete"];
         
         
         NSDictionary *off_Params_dic = [RAUtils string2dict:off_params];
         NSDictionary *off_Params_dic = [RAUtils string2dict:off_params];
         [item setObject:[off_Params_dic objectForKey:@"product_ids"] forKey:@"product_ids"];
         [item setObject:[off_Params_dic objectForKey:@"product_ids"] forKey:@"product_ids"];