const.h 4.0 KB

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