ERPCommonConst.h 4.4 KB

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