|
|
@@ -296,6 +296,9 @@
|
|
|
sqlite3_close(db);
|
|
|
// int aaa = 0;
|
|
|
}
|
|
|
+
|
|
|
+ [self deleteResultFields];
|
|
|
+
|
|
|
return YES;
|
|
|
|
|
|
|
|
|
@@ -637,4 +640,54 @@
|
|
|
return fields;
|
|
|
}
|
|
|
|
|
|
++ (NSString *)getDisplayFieldsForFunction:(NSString *)function withUser:(NSString *)user limit:(NSUInteger)limit {
|
|
|
+
|
|
|
+ if (!function || !user) {
|
|
|
+ return @"";
|
|
|
+ }
|
|
|
+
|
|
|
+ NSString *sql = [NSString stringWithFormat:@"select name from fields_info where function_name='%@' and user='%@' and behavior=%d and show=1 order by priority,aname limit %lu",function, user,BEHAVIOR_RESULT, limit];
|
|
|
+
|
|
|
+ __block NSString* fields = @"";
|
|
|
+ [self jk_sync_query:sql completion:^(sqlite3_stmt *stmt, long *count) {
|
|
|
+
|
|
|
+ NSString *name = [[NSString alloc] initWithUTF8String:(char *)sqlite3_column_text(stmt, 0)];
|
|
|
+ fields = [fields stringByAppendingFormat:@"%@,",name];
|
|
|
+
|
|
|
+
|
|
|
+ } failure:^(NSString *err_msg) {
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+ if (fields.length > 0) {
|
|
|
+ fields=[fields substringToIndex: fields.length-1];
|
|
|
+ }
|
|
|
+ return fields;
|
|
|
+}
|
|
|
+
|
|
|
+// 数据库初始化完成之后或数据库更新之后删除
|
|
|
++ (void)deleteResultFields {
|
|
|
+
|
|
|
+ NSString *key = @"delete_result_fields";
|
|
|
+ BOOL delete = [[NSUserDefaults standardUserDefaults] boolForKey:key];
|
|
|
+ if (!delete) {
|
|
|
+
|
|
|
+ NSString *booking_sql = @"delete from fields_info where behavior = 1 and function_name = 'Ocean Booking' and name in ('booking_no','shipper','consignee','po_no','f_etd,m_eta','place_of_receipt_uncode','place_of_delivery_uncode');";
|
|
|
+
|
|
|
+ NSString *bl_sql = @"delete from fields_info where behavior = 1 and function_name = 'Ocean B/L info.' and name in ('last_status_315_code','shipper,consignee','h_bol,etd','eta,po_no','place_of_receipt_un','place_of_delivery_un');";
|
|
|
+
|
|
|
+ NSString *cn_sql = @"delete from fields_info where behavior = 1 and function_name = 'Container detail' and name in ('shipper','consignee','ctnr','file_no','po_no','etd','eta','fport_of_loading_un','mport_of_discharge_un');";
|
|
|
+
|
|
|
+ sqlite3 *db = [self get_db];
|
|
|
+
|
|
|
+ [self execSql:booking_sql db:db];
|
|
|
+ [self execSql:bl_sql db:db];
|
|
|
+ [self execSql:cn_sql db:db];
|
|
|
+
|
|
|
+ sqlite3_close(db);
|
|
|
+
|
|
|
+ [[NSUserDefaults standardUserDefaults] setValue:@(YES) forKey:key];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
@end
|