IcsFromERPJob
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.4 KiB

4 months ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace ICSSoft.FromERP
  6. {
  7. public class ConstWorkPoint
  8. {
  9. public const string WorkPoint = "6000";
  10. public const string Muser = "job";
  11. public const string Musername = "job";
  12. }
  13. public class Common
  14. {
  15. public static decimal TurnDecimal(decimal? deci)
  16. {
  17. decimal result = 0;
  18. if (!string.IsNullOrEmpty(deci.ToString()))
  19. {
  20. result = decimal.Parse(deci.ToString());
  21. }
  22. return result;
  23. }
  24. public static string CreateNo()
  25. {
  26. Random random = new Random();
  27. string strRandom = random.Next(1000, 10000).ToString(); //生成编号
  28. string code = DateTime.Now.ToString("yyyyMMddHHmmss") + strRandom;//形如
  29. return code;
  30. }
  31. /// <summary>
  32. /// 将c# DateTime时间格式转换为Unix时间戳格式
  33. /// </summary>
  34. /// <param name="time">时间</param>
  35. /// <returns>long</returns>
  36. public static long ConvertDateTimeToInt(System.DateTime time)
  37. {
  38. System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1, 0, 0, 0, 0));
  39. long t = (time.Ticks - startTime.Ticks) / 10000; //除10000调整为13位
  40. return t;
  41. }
  42. }
  43. }