// // const.h // RedAnt ERP Mobile // // Created by Ray on 14-6-20. // Copyright (c) 2014年 United Software Applications, Inc. All rights reserved. // //#define DEBUGLOG 1 //#ifdef DEBUGLOG // #ifdef DEBUG // // #define DebugLog( s, ... ) fprintf(stderr,"%s\n",[[NSString stringWithFormat:s, ##__VA_ARGS__] UTF8String])// //#define DebugLog( s, ... ) fprintf(stderr, "<%p %s:(%d)> %s \n", self, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent]UTF8String], __LINE__, [[NSString stringWithFormat:(s), ##__VA_ARGS__]UTF8String] ) // //#define blockDebugLog( s, ... ) fprintf(stderr, "<%p %s:(%d)> %s \n",weakself, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent]UTF8String], __LINE__, [[NSString stringWithFormat:(s), ##__VA_ARGS__]UTF8String] ) // // #else // #define DebugLog( s, ... ) // // #define blockDebugLog( s, ... ) // #endif //#else // #define DebugLog( s, ... ) // // #define blockDebugLog( s, ... ) //#endif #define DEPRECATED(_version) __attribute__((deprecated)) #ifndef RedAnt_ERP_Mobile_const_h #define RedAnt_ERP_Mobile_const_h #define COLOR(R,G,B,A) [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:A] // OFFLINE ORDER #define OOC_OFFLINE_CONTACT 0 #define OOC_ONLINE_CONTACT 1 #define OOC_CREATE_ORDER 10 #define DBNAME @"iSales.db" #define CYCLESCROLL_STOPTIMMER @"CycleScroll stop timer" #define URL_REMOTE 1 #define URL_LOCAL 0 #define URL_NONE 2 #define URL_RESTORE 3 #define URL_FILE 4 #define RETRY_DELAY 15 //offline getting data retry delay. #define DOWNLOAD_RETRY_TIMES 5 //retry times for single download. #define REQUEST_DOWNLOAD_RETRY_TIMES 240 //retry times for single download.40==60 min #define REFRESH_NONE 0 #define REFRESH_VIEW 1 #define REFRESH_DATA 2 #define RESULT_BARCODE_ERROR -50 #define AP_USER_NOT_EXIST 0 #define AP_USER_NOT_AUTH 1 #define AP_USER_AUTH 2 #define AP_SESSION_EXPIRED 4 #define AP_MESSAGE_NEW 5 #define AP_MESSAGE_NONE 6 //#define OFFLINE_MODE true #define OFFLINE_ARRAY_SEPARATOR @";" #define OFFLINE_IMG_TYPE_CATEGORY 1 #define OFFLINE_IMG_TYPE_DETAIL 0 #define RESULT_FALSE 0 #define RESULT_NO_RESPONSE 1 #define RESULT_TRUE 2 #define RESULT_NO_EMAIL_ADDRESS 3 #define RESULT_NET_SERVER_ERR -1 #define RESULT_NET_ERROR -3 #define RESULT_NET_NOTAVAILABLE -4 #define RESULT_ERROR -5 #define RESULT_LOCALFILE_ERROR -7 #define RESULT_USERAUTH_ERROR -9 #define RESULT_UPDATE_USERAUTH_ERROR -11 #define RESULT_SESSION_EXPIRED -13 #define RESULT_VER_LOW -15 #define RESULT_BACKEND_CRASH -20 #define RESULT_RESPONSE_ERROR -30 #define RESULT_TIMEOUT 99 #define RESULT_LOGIN_DEVICE -18 #define RESULT_NO_MODEL 8 #define CATEGORY_VIEWTYPE_SMALL 0 #define CATEGORY_VIEWTYPE_LARGE 1 #define CATEGORY_VIEWTYPE_CUSTOM 2 #define CATEGORY_VIEWTYPE_LIST 3 #define MSG_NET_NOTAVAILABLE @"No available network, please check your network setting." #define MSG_NET_ERROR @"Net Error. Cannot connect to server for now. Please retry later." #define MSG_USERAUTH_ERROR @"Username or password is incorrect.Please check." #define MSG_VER_LOW @"Current App version is out of date, please update to the latest version." #define MSG_ERROR @"Connection failed with Server, please email your IT Admin."//@"Some error occured on server." #define MSG_SUCCESS @"Success." #define MSG_LOGIN_DEVICE @"You are currently signed in on another device. Please check." #define MSG_TIMEOUT @"Request timeout." #define MSG_OFFLINE_SUBMIT @"Offline order will be submitted when you login online mode and sync with server." #define TITLE_OFFLINE_SUBMIT @"Offline Submit" #define EMAIL_MATCHES @"\\w[-\\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\\.)+[A-Za-z]{2,14}" #define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0] #define USER_ROLE_CUSTOMER 0 #define USER_ROLE_EMPLOYEE 1 #define USER_ROLE_UNKNOWN 2 // 如何处理commoneditor action 类型调用的返回值 #define ACTION_SAVE_DATA 0 #define ACTION_FILL_SECTION 1 //#define JSON_TIMEOUT 60 #ifndef dispatch_queue_async_safe #define dispatch_queue_async_safe(queue, block)\ if (strcmp(dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL), dispatch_queue_get_label(queue)) == 0) {\ block();\ } else {\ dispatch_async(queue, block);\ } #endif #ifndef dispatch_main_async_safe #define dispatch_main_async_safe(block) dispatch_queue_async_safe(dispatch_get_main_queue(), block) #endif #endif