Common.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using TempDbToUfida;
  7. using WangToTempDb;
  8. using YiLvRunFrom.Dal;
  9. namespace YiLvRunFrom.BLL
  10. {
  11. public class Common
  12. {
  13. public static void WangToMiddle(IUpLoad upload,string entityStr)
  14. {
  15. IUpLoad uploadTwo = null;
  16. bool flagflag = false;
  17. if (entityStr == "销售出库")
  18. {
  19. uploadTwo = new DispatchListSendUpLoad();
  20. flagflag = true;
  21. }
  22. Dictionary<string, string> args = new Dictionary<string, string>();
  23. DateTime dt1, dt2, dt3;
  24. dt1 = TimeDal.GetLastTime(entityStr);// '2019-08-26 00:00:00' // '2019-08-27 19:00:00'
  25. dt2 = dt1.AddDays(1);
  26. dt3 = DateTime.Now.AddMinutes(-10);//// '2019-08-27 20:00:00' // '2019-08-27 20:00:00'
  27. bool flag = true;
  28. if (dt2.Subtract(dt3).TotalDays <= 1 && dt2 >= dt3)
  29. {
  30. args["start_time"] = dt1.ToString("yyyy-MM-dd HH:mm:ss");
  31. args["end_time"] = dt3.ToString("yyyy-MM-dd HH:mm:ss");
  32. if (entityStr.Equals("采购入库"))
  33. {
  34. args["status"] = "60";
  35. }
  36. upload.UpLoad(args);
  37. if (flagflag)
  38. {
  39. uploadTwo.UpLoad(args);
  40. }
  41. else if (entityStr == "其他入库")
  42. {
  43. IUpLoad iupThree = new StockinUpLoad();
  44. args.Add("status", "60");
  45. args.Add("order_type", "2");
  46. iupThree.UpLoad(args);
  47. args.Remove("status");
  48. args.Remove("order_type");
  49. }
  50. TimeDal.SetLastTime(args["end_time"], entityStr);
  51. }
  52. while (dt2 < dt3 && flag)
  53. {
  54. args["start_time"] = dt1.ToString("yyyy-MM-dd HH:mm:ss");
  55. args["end_time"] = dt2.ToString("yyyy-MM-dd HH:mm:ss");
  56. if (entityStr.Equals("采购入库"))
  57. {
  58. args["status"] = "60";
  59. }
  60. upload.UpLoad(args);
  61. if (flagflag)
  62. {
  63. uploadTwo.UpLoad(args);
  64. }
  65. else if (entityStr == "其他入库")
  66. {
  67. IUpLoad iupThree = new StockinUpLoad();
  68. args.Add("status", "60");
  69. args.Add("order_type", "2");
  70. iupThree.UpLoad(args);
  71. args.Remove("status");
  72. args.Remove("order_type");
  73. }
  74. TimeDal.SetLastTime(args["end_time"], entityStr);
  75. dt1 = dt2.AddSeconds(1);
  76. dt2 = dt1.AddDays(1);
  77. if (dt2 > dt3)
  78. {
  79. args["start_time"] = dt1.ToString("yyyy-MM-dd HH:mm:ss");
  80. args["end_time"] = dt3.ToString("yyyy-MM-dd HH:mm:ss");
  81. if (entityStr.Equals("采购入库"))
  82. {
  83. args["status"] = "60";
  84. }
  85. upload.UpLoad(args);
  86. if (flagflag)
  87. {
  88. uploadTwo.UpLoad(args);
  89. }
  90. else if (entityStr == "其他入库")
  91. {
  92. IUpLoad iupThree = new StockinUpLoad();
  93. args.Add("status", "60");
  94. args.Add("order_type", "2");
  95. iupThree.UpLoad(args);
  96. args.Remove("status");
  97. args.Remove("order_type");
  98. }
  99. TimeDal.SetLastTime(args["end_time"], entityStr);
  100. dt2 = dt3;
  101. flag = false;
  102. }
  103. }
  104. }
  105. }
  106. }