|
@@ -14,6 +14,7 @@
|
|
|
#import "ZipArchive.h"
|
|
#import "ZipArchive.h"
|
|
|
#import "UIProgressView+AFNetworking.h"
|
|
#import "UIProgressView+AFNetworking.h"
|
|
|
#import "AFHTTPSessionManager.h"
|
|
#import "AFHTTPSessionManager.h"
|
|
|
|
|
+#import "AppDelegate.h"
|
|
|
|
|
|
|
|
@interface OLDataProvider ()
|
|
@interface OLDataProvider ()
|
|
|
|
|
|
|
@@ -9622,4 +9623,187 @@
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+#pragma mark - portfolio
|
|
|
|
|
+
|
|
|
|
|
++ (NSData *)offline_portfolioList:(NSMutableDictionary *)params {
|
|
|
|
|
+
|
|
|
|
|
+// {
|
|
|
|
|
+// "result": 2,
|
|
|
|
|
+// "min_ver": "160514",
|
|
|
|
|
+// "count": 1,
|
|
|
|
|
+// "can_see_price": true,
|
|
|
|
|
+// "item_0": {
|
|
|
|
|
+// "linenotes": "恢复肌肤就不会就附近",
|
|
|
|
|
+// "check": 1,
|
|
|
|
|
+// "product_id": "3732",
|
|
|
|
|
+// "available_qty": 787,
|
|
|
|
|
+// "description": "108237-SH-B\nCharlotte Fabric Chair Black Legs, Shark",
|
|
|
|
|
+// "item_id": "13405",
|
|
|
|
|
+// "fashion_id": "4858",
|
|
|
|
|
+// "img": "http://192.168.0.112:8080/site//u/NPD/20151211/108237-SH-B_2916_s.jpg",
|
|
|
|
|
+// "tear_sheet_discount": "20.00",
|
|
|
|
|
+// "tear_sheet_price": "3109.00"
|
|
|
|
|
+// },
|
|
|
|
|
+// "email_content": "",
|
|
|
|
|
+// "total_count": 1,
|
|
|
|
|
+// "mode": "Regular Mode"
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
|
|
+ int sort = [[params valueForKey:@"sort"] integerValue];
|
|
|
|
|
+ int offset = [[params valueForKey:@"offset"] integerValue];
|
|
|
|
|
+ int limit = [[params valueForKey:@"limit"] integerValue];
|
|
|
|
|
+
|
|
|
|
|
+ NSString *orderBy = @"";
|
|
|
|
|
+ switch (sort) {
|
|
|
|
|
+ case 0:{
|
|
|
|
|
+ orderBy = @"modifytime desc";
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 1:{
|
|
|
|
|
+ orderBy = @"modifytime asc";
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 2:{
|
|
|
|
|
+ orderBy = @"name asc";
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 3:{
|
|
|
|
|
+ orderBy = @"name desc";
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 4:{
|
|
|
|
|
+ orderBy = @"description asc";
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ default:
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ NSString *sql = [NSString stringWithFormat:@"select product_id,name,description,sheet_price,sheet_discount,available_qty,percentage,item_id,fashion_id,img,line_note,percent from offline_portfolio order by %@ limit %d offset %d;",orderBy,limit,offset];
|
|
|
|
|
+
|
|
|
|
|
+ __block NSMutableDictionary *dic = [NSMutableDictionary dictionary];
|
|
|
|
|
+
|
|
|
|
|
+ [iSalesDB jk_query:sql completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container, long *count) {
|
|
|
|
|
+
|
|
|
|
|
+ [dic setValue:[NSNumber numberWithInteger:RESULT_TRUE] forKey:@"result"];
|
|
|
|
|
+
|
|
|
|
|
+ int product_id = sqlite3_column_int(stmt, 0);
|
|
|
|
|
+ NSString *product_id_string = [NSString stringWithFormat:@"%d",product_id];
|
|
|
|
|
+ NSString *name = [self textAtColumn:1 statement:stmt];
|
|
|
|
|
+ NSString *description = [self textAtColumn:2 statement:stmt];
|
|
|
|
|
+ double price = sqlite3_column_double(stmt, 3);
|
|
|
|
|
+ double discount = sqlite3_column_double(stmt,4);
|
|
|
|
|
+ int qty = sqlite3_column_int(stmt, 5);
|
|
|
|
|
+ int percentage = sqlite3_column_int(stmt, 6);
|
|
|
|
|
+ int item_id = sqlite3_column_int(stmt, 7);
|
|
|
|
|
+ int fashion_id = sqlite3_column_int(stmt, 8);
|
|
|
|
|
+ NSString *img_path = [self textAtColumn:9 statement:stmt];
|
|
|
|
|
+ NSString *line_note = [self textAtColumn:10 statement:stmt];
|
|
|
|
|
+ double percent = sqlite3_column_double(stmt, 11);
|
|
|
|
|
+
|
|
|
|
|
+ NSMutableDictionary *item = @{
|
|
|
|
|
+ @"linenotes": line_note,
|
|
|
|
|
+ @"check": @(1),
|
|
|
|
|
+ @"product_id": product_id_string,
|
|
|
|
|
+ @"available_qty": @(qty),
|
|
|
|
|
+ @"available_percent" : @(percent),
|
|
|
|
|
+ @"description": description,
|
|
|
|
|
+ @"item_id": [NSString stringWithFormat:@"%d",item_id],
|
|
|
|
|
+ @"fashion_id": [NSString stringWithFormat:@"%d",fashion_id],
|
|
|
|
|
+ @"img": img_path,
|
|
|
|
|
+ @"tear_sheet_discount": [NSString stringWithFormat:@"%f",discount],
|
|
|
|
|
+ @"tear_sheet_price": [NSString stringWithFormat:@"%f",price]
|
|
|
|
|
+ }.mutableCopy;
|
|
|
|
|
+ if (percentage) {
|
|
|
|
|
+ [item removeObjectForKey:@"available_qty"];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ [item removeObjectForKey:@"available_percent"];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ [dic setObject:item forKey:[NSString stringWithFormat:@"item_%ld",*count]];
|
|
|
|
|
+ [dic setValue:[NSNumber numberWithLong:++(*count)] forKey:@"count"];
|
|
|
|
|
+
|
|
|
|
|
+ } failure:^(NSMutableDictionary *container, NSString *err_msg) {
|
|
|
|
|
+
|
|
|
|
|
+ [dic setValue:[NSNumber numberWithInteger:RESULT_FALSE] forKey:@"result"];
|
|
|
|
|
+
|
|
|
|
|
+ [dic setValue:[NSNumber numberWithInteger:0] forKey:@"count"];
|
|
|
|
|
+ }];
|
|
|
|
|
+
|
|
|
|
|
+ AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
|
|
|
|
+
|
|
|
|
|
+ [dic setValue:[NSNumber numberWithBool:appDelegate.can_see_price] forKey:@"can_see_price"];
|
|
|
|
|
+ [dic setValue:@"" forKey:@"emial_content"];
|
|
|
|
|
+ [dic setValue:[dic objectForKey:@"count"] forKey:@"total_count"];
|
|
|
|
|
+ [dic setValue:@"Regular Mode" forKey:@"mode"];
|
|
|
|
|
+
|
|
|
|
|
+ return [RAUtils dict2data:dic];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
++ (NSData *)offline_direct_save_TearSheet:(NSMutableDictionary *)params {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ return nil;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
++ (NSData *)offline_pdfList:(NSMutableDictionary *)params {
|
|
|
|
|
+
|
|
|
|
|
+ int offset = [[params valueForKey:@"offset"] integerValue];
|
|
|
|
|
+ int limit = [[params valueForKey:@"limit"] integerValue];
|
|
|
|
|
+ NSString *keyword = [params valueForKey:@"keyWord"];
|
|
|
|
|
+
|
|
|
|
|
+ NSString *where = @"";
|
|
|
|
|
+ if (keyword.length) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ NSString *sql = [NSString stringWithFormat:@"select tear_name,tear_note,createtime,create_user,pdf_path,tearsheets_id from offline_pdf %@ order by createtime desc;",where];
|
|
|
|
|
+
|
|
|
|
|
+ __block NSMutableDictionary *dic = [NSMutableDictionary dictionary];
|
|
|
|
|
+
|
|
|
|
|
+ [iSalesDB jk_query:sql completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container, long *count) {
|
|
|
|
|
+
|
|
|
|
|
+ NSString *name = [self textAtColumn:0 statement:stmt];
|
|
|
|
|
+ NSString *note = [self textAtColumn:1 statement:stmt];
|
|
|
|
|
+ NSString *time = [self textAtColumn:2 statement:stmt];
|
|
|
|
|
+ NSString *user = [self textAtColumn:3 statement:stmt];
|
|
|
|
|
+ NSString *patch = [self textAtColumn:4 statement:stmt];
|
|
|
|
|
+
|
|
|
|
|
+ time = [self changeDateTimeFormate:time];
|
|
|
|
|
+ time = [time stringByAppendingString:@" PST"];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ int sheet_id = sqlite3_column_int(stmt, 0);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ NSMutableDictionary *item = @{
|
|
|
|
|
+ @"tearsheetsId": @(sheet_id),
|
|
|
|
|
+ @"pdf_path": patch,
|
|
|
|
|
+ @"create_time": time,
|
|
|
|
|
+ @"create_user": user,
|
|
|
|
|
+ @"tear_note": note,
|
|
|
|
|
+ @"tear_name": name
|
|
|
|
|
+ }.mutableCopy;
|
|
|
|
|
+
|
|
|
|
|
+ [dic setObject:item forKey:[NSString stringWithFormat:@"item_%ld",*count]];
|
|
|
|
|
+ [dic setValue:[NSNumber numberWithLong:++(*count)] forKey:@"count"];
|
|
|
|
|
+
|
|
|
|
|
+ } failure:^(NSMutableDictionary *container, NSString *err_msg) {
|
|
|
|
|
+ [dic setValue:[NSNumber numberWithInteger:RESULT_FALSE] forKey:@"result"];
|
|
|
|
|
+
|
|
|
|
|
+ [dic setValue:[NSNumber numberWithInteger:0] forKey:@"count"];
|
|
|
|
|
+ }];
|
|
|
|
|
+
|
|
|
|
|
+ [dic setValue:@"Regular Mode" forKey:@"mode"];
|
|
|
|
|
+
|
|
|
|
|
+ return [RAUtils dict2data:dic];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
@end
|
|
@end
|