Inventory.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using TempDbToUfida.OpenApi;
  7. using WangToTempDb;
  8. namespace YlInit
  9. {
  10. public class Inventory : IProcess
  11. {
  12. public void Process()
  13. {
  14. DateTime dt1, dt2, dt3;
  15. dt1 = new DateTime(2017, 5, 1);
  16. dt2 = dt1.AddDays(30);
  17. dt3 = DateTime.Now.AddMinutes(-10);
  18. int i = 0;
  19. //增加条件
  20. if (dt2.Subtract(dt3).TotalDays <=30&&dt2>=dt3)
  21. {
  22. __Process(dt1, dt3);
  23. }
  24. while (dt2 < dt3 )
  25. {
  26. __Process(dt1, dt2);
  27. dt1 = dt2.AddSeconds(1);
  28. dt2 = dt1.AddDays(30);
  29. if (dt2 > dt3)
  30. {
  31. dt2 = dt3;
  32. __Process(dt1, dt2);
  33. //dt3 = dt2.AddDays(-10);
  34. }
  35. }
  36. DownLoadInventory download = new DownLoadInventory();
  37. download.DownLoad();
  38. }
  39. private void __Process(DateTime dt1, DateTime dt2)
  40. {
  41. Dictionary<string, string> args = new Dictionary<string, string>();
  42. args["start_time"] = dt1.ToString("yyyy-MM-dd HH:mm:ss");
  43. args["end_time"] = dt2.ToString("yyyy-MM-dd HH:mm:ss");
  44. InventoryUpLoad upload = new InventoryUpLoad();
  45. upload.UpLoad(args);
  46. }
  47. }
  48. }