Procházet zdrojové kódy

修改上传PDF数据,增加Params和UUID

Pen Li před 9 roky
rodič
revize
586e0651eb

binární
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 31 - 7
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -10185,9 +10185,9 @@
     [resultDictionary setObject:@"Regular Mode" forKey:@"mode"];
     
     NSString *tear_name = [self valueInParams:params key:@"pdfName"];
-    tear_name = [self translateSingleQuote:tear_name];
+    
     NSString *tear_note = [self valueInParams:params key:@"pdfNote"];
-    tear_note = [self translateSingleQuote:tear_note];
+    
     
     NSString *configureParams = [self valueInParams:params key:@"configureParams"];
     
@@ -10202,10 +10202,8 @@
         
     }
     
-    pdf_path = [self translateSingleQuote:pdf_path];
-    NSString *create_user = [self valueInParams:params key:@"user"];
-    create_user = [self translateSingleQuote:create_user];
     
+    NSString *create_user = [self valueInParams:params key:@"user"];
     NSString *product_ids = [self valueInParams:params key:@"product_ids"];
     NSString *item_ids = [self valueInParams:params key:@"item_ids"];
     
@@ -10214,6 +10212,7 @@
     NSString *sql = [NSString stringWithFormat:@"select product_id,ifnull(sheet_price,'null'),sheet_discount,ifnull(available_qty,'null'),percentage,item_id,line_note,percent from offline_portfolio where product_id in (%@);",product_ids];
     
     __block NSMutableDictionary *dic = [NSMutableDictionary dictionary];
+    __block NSMutableString *product_ids_string = [NSMutableString string]; // configure参数
     
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     
@@ -10238,6 +10237,8 @@
             price = [[self get_model_default_price:appDelegate.contact_id product_id:nil item_id:@(item_id) db:db] doubleValue];
         }
 */
+        [product_ids_string appendFormat:@"%@,",product_id_string];
+        
         int regular_price = [[params objectForKey:@"regular_price"] integerValue];
         NSString *regular_price_str = [self get_portfolio_price:appDelegate.contact_id item_id:item_id price:regular_price db:db];
         
@@ -10278,6 +10279,10 @@
     
     [iSalesDB close_db:db];
     
+    if (product_ids_string.length > 0) {
+        [product_ids_string deleteCharactersInRange:NSMakeRange(product_ids_string.length - 1, 1)];
+    }
+    
     if ([[resultDic objectForKey:@"result"] integerValue] != RESULT_TRUE) {
         
         [resultDictionary setObject:[resultDic objectForKey:@"result"] forKey:@"result"];
@@ -10286,7 +10291,7 @@
     }
     
     NSString *model_info = [RAUtils dict2string:dic];
-    model_info = [self translateSingleQuote:model_info];
+    
     
     
     // 创建PDF
@@ -10328,6 +10333,16 @@
     
     // 保存信息
     NSString *off_params = [RAUtils dict2string:params];
+    
+
+    configureParams = [configureParams stringByAppendingFormat:@"productIds=%@",product_ids_string];
+    
+    pdf_path = [self translateSingleQuote:pdf_path];
+    create_user = [self translateSingleQuote:create_user];
+    tear_note = [self translateSingleQuote:tear_note];
+    tear_name = [self translateSingleQuote:tear_name];
+    model_info = [self translateSingleQuote:model_info];
+    configureParams = [self translateSingleQuote:configureParams];
     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];
@@ -10422,6 +10437,8 @@
 //    NSString *user = [params objectForKey:@"user"];
     NSString *sql = [NSString stringWithFormat:@"insert into offline_portfolio (product_id,name,description,item_id) select * from (select p.product_id,p.name,p.description,p.item_id from product as p where p.product_id in (%@) and (select count(0) from offline_portfolio where product_id in (%@) and (is_delete is null or is_delete = 0)) = 0);",prodct_ids,prodct_ids];
     
+//    NSString *sql = @"delete from offline_portfolio;insert into offline_portfolio (product_id,name,description,item_id,fashion_id,available_qty,percent,percentage,sheet_price,sheet_discount,line_note)values(3715,'108237-318','Charlotte Fabric Chair, Cotton Cream',1054,4841,null,null,0,100.0,50.0,'Line Note');insert into offline_portfolio (product_id,name,description,item_id,fashion_id,available_qty,percent,percentage,sheet_price,sheet_discount,line_note)values(3716,'108237-318N','Charlotte Fabric Chair NWO Legs, Cotton Cream',1056,4842,null,null,0,77.0,10.0,'A O');";
+    
     int result = [iSalesDB execSql:sql];
     
     NSMutableDictionary *dic = [NSMutableDictionary dictionary];
@@ -10828,7 +10845,7 @@
         
     }
     
-    NSString *sqlQuery =[NSString stringWithFormat:@"select _id,tearsheets_id,pdf_path,create_user,tear_note,tear_name,model_info,createtime,modify_time from offline_pdf where %@",where];
+    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];
     
     
     [ret setValue:[NSNumber numberWithInt:AP_USER_NOT_AUTH ] forKey:@"result"];
@@ -10846,6 +10863,9 @@
         NSString *model_info = [self textAtColumn:6 statement:stmt];
         NSString *createtime = [self textAtColumn:7 statement:stmt];
         NSString *modifytime = [self textAtColumn:8 statement:stmt];
+        NSString *urlParams = [self textAtColumn:9 statement:stmt];
+        NSString *off_params = [self textAtColumn:10 statement:stmt];
+        NSString *uuid = [NSUUID UUID].UUIDString;
         
         [item setObject:[NSNumber numberWithInteger:_id] forKey:@"_id"];
         [item setObject:[NSNumber numberWithInteger:tearsheets_id] forKey:@"tearsheets_id"];
@@ -10856,6 +10876,10 @@
         [item setObject:model_info forKey:@"model_info"];
         [item setObject:createtime forKey:@"createtime"];
         [item setObject:modifytime forKey:@"modifytime"];
+        [item setObject:urlParams forKey:@"urlParams"];
+        [item setObject:off_params forKey:@"off_params"];
+        [item setObject:uuid forKey:@"pdf_token"];
+        
 
         [ret setObject:item forKey:[NSString stringWithFormat:@"item_%ld",(*count)++]];
         [ret setObject:[NSNumber numberWithInteger:RESULT_TRUE] forKey:@"result"];