const.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. //
  2. // const.h
  3. // RedAnt ERP Mobile
  4. //
  5. // Created by Ray on 14-6-20.
  6. // Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
  7. //
  8. //#define DEBUGLOG 1
  9. //#ifdef DEBUGLOG
  10. // #ifdef DEBUG
  11. // // #define DebugLog( s, ... ) fprintf(stderr,"%s\n",[[NSString stringWithFormat:s, ##__VA_ARGS__] UTF8String])//
  12. //#define DebugLog( s, ... ) fprintf(stderr, "<%p %s:(%d)> %s \n", self, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent]UTF8String], __LINE__, [[NSString stringWithFormat:(s), ##__VA_ARGS__]UTF8String] )
  13. //
  14. //#define blockDebugLog( s, ... ) fprintf(stderr, "<%p %s:(%d)> %s \n",weakself, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent]UTF8String], __LINE__, [[NSString stringWithFormat:(s), ##__VA_ARGS__]UTF8String] )
  15. //
  16. // #else
  17. // #define DebugLog( s, ... )
  18. //
  19. // #define blockDebugLog( s, ... )
  20. // #endif
  21. //#else
  22. // #define DebugLog( s, ... )
  23. //
  24. // #define blockDebugLog( s, ... )
  25. //#endif
  26. #define DEPRECATED(_version) __attribute__((deprecated))
  27. #ifndef RedAnt_ERP_Mobile_const_h
  28. #define RedAnt_ERP_Mobile_const_h
  29. #define COLOR(R,G,B,A) [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:A]
  30. // OFFLINE ORDER
  31. #define OOC_OFFLINE_CONTACT 0
  32. #define OOC_ONLINE_CONTACT 1
  33. #define OOC_CREATE_ORDER 10
  34. #define DBNAME @"iSales.db"
  35. #define CYCLESCROLL_STOPTIMMER @"CycleScroll stop timer"
  36. #define URL_REMOTE 1
  37. #define URL_LOCAL 0
  38. #define URL_NONE 2
  39. #define URL_RESTORE 3
  40. #define URL_FILE 4
  41. #define RETRY_DELAY 15 //offline getting data retry delay.
  42. #define DOWNLOAD_RETRY_TIMES 5 //retry times for single download.
  43. #define REQUEST_DOWNLOAD_RETRY_TIMES 240 //retry times for single download.40==60 min
  44. #define REFRESH_NONE 0
  45. #define REFRESH_VIEW 1
  46. #define REFRESH_DATA 2
  47. #define RESULT_BARCODE_ERROR -50
  48. #define AP_USER_NOT_EXIST 0
  49. #define AP_USER_NOT_AUTH 1
  50. #define AP_USER_AUTH 2
  51. #define AP_SESSION_EXPIRED 4
  52. #define AP_MESSAGE_NEW 5
  53. #define AP_MESSAGE_NONE 6
  54. //#define OFFLINE_MODE true
  55. #define OFFLINE_ARRAY_SEPARATOR @";"
  56. #define OFFLINE_IMG_TYPE_CATEGORY 1
  57. #define OFFLINE_IMG_TYPE_DETAIL 0
  58. #define RESULT_FALSE 0
  59. #define RESULT_NO_RESPONSE 1
  60. #define RESULT_TRUE 2
  61. #define RESULT_NO_EMAIL_ADDRESS 3
  62. #define RESULT_NET_SERVER_ERR -1
  63. #define RESULT_NET_ERROR -3
  64. #define RESULT_NET_NOTAVAILABLE -4
  65. #define RESULT_ERROR -5
  66. #define RESULT_LOCALFILE_ERROR -7
  67. #define RESULT_USERAUTH_ERROR -9
  68. #define RESULT_UPDATE_USERAUTH_ERROR -11
  69. #define RESULT_SESSION_EXPIRED -13
  70. #define RESULT_VER_LOW -15
  71. #define RESULT_BACKEND_CRASH -20
  72. #define RESULT_RESPONSE_ERROR -30
  73. #define RESULT_TIMEOUT 99
  74. #define RESULT_LOGIN_DEVICE -18
  75. #define RESULT_NO_MODEL 8
  76. #define CATEGORY_VIEWTYPE_SMALL 0
  77. #define CATEGORY_VIEWTYPE_LARGE 1
  78. #define CATEGORY_VIEWTYPE_CUSTOM 2
  79. #define CATEGORY_VIEWTYPE_LIST 3
  80. #define MSG_NET_NOTAVAILABLE @"No available network, please check your network setting."
  81. #define MSG_NET_ERROR @"Net Error. Cannot connect to server for now. Please retry later."
  82. #define MSG_USERAUTH_ERROR @"Username or password is incorrect.Please check."
  83. #define MSG_VER_LOW @"Current App version is out of date, please update to the latest version."
  84. #define MSG_ERROR @"Connection failed with Server, please email your IT Admin."//@"Some error occured on server."
  85. #define MSG_SUCCESS @"Success."
  86. #define MSG_LOGIN_DEVICE @"You are currently signed in on another device. Please check."
  87. #define MSG_TIMEOUT @"Request timeout."
  88. #define MSG_OFFLINE_SUBMIT @"Offline order will be submitted when you login online mode and sync with server."
  89. #define TITLE_OFFLINE_SUBMIT @"Offline Submit"
  90. #define EMAIL_MATCHES @"\\w[-\\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\\.)+[A-Za-z]{2,14}"
  91. #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]
  92. #define USER_ROLE_CUSTOMER 0
  93. #define USER_ROLE_EMPLOYEE 1
  94. #define USER_ROLE_UNKNOWN 2
  95. // 如何处理commoneditor action 类型调用的返回值
  96. #define ACTION_SAVE_DATA 0
  97. #define ACTION_FILL_SECTION 1
  98. //#define JSON_TIMEOUT 60
  99. #ifndef dispatch_queue_async_safe
  100. #define dispatch_queue_async_safe(queue, block)\
  101. if (strcmp(dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL), dispatch_queue_get_label(queue)) == 0) {\
  102. block();\
  103. } else {\
  104. dispatch_async(queue, block);\
  105. }
  106. #endif
  107. #ifndef dispatch_main_async_safe
  108. #define dispatch_main_async_safe(block) dispatch_queue_async_safe(dispatch_get_main_queue(), block)
  109. #endif
  110. #endif