using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using TempDbToUfida; using WangToTempDb; using YiLvRunFrom.Dal; namespace YiLvRunFrom.BLL { public class Common { public static void WangToMiddle(IUpLoad upload,string entityStr) { IUpLoad uploadTwo = null; bool flagflag = false; if (entityStr == "销售出库") { uploadTwo = new DispatchListSendUpLoad(); flagflag = true; } Dictionary args = new Dictionary(); DateTime dt1, dt2, dt3; dt1 = TimeDal.GetLastTime(entityStr);// '2019-08-26 00:00:00' // '2019-08-27 19:00:00' dt2 = dt1.AddDays(1); dt3 = DateTime.Now.AddMinutes(-10);//// '2019-08-27 20:00:00' // '2019-08-27 20:00:00' bool flag = true; if (dt2.Subtract(dt3).TotalDays <= 1 && dt2 >= dt3) { args["start_time"] = dt1.ToString("yyyy-MM-dd HH:mm:ss"); args["end_time"] = dt3.ToString("yyyy-MM-dd HH:mm:ss"); if (entityStr.Equals("采购入库")) { args["status"] = "60"; } upload.UpLoad(args); if (flagflag) { uploadTwo.UpLoad(args); } else if (entityStr == "其他入库") { IUpLoad iupThree = new StockinUpLoad(); args.Add("status", "60"); args.Add("order_type", "2"); iupThree.UpLoad(args); args.Remove("status"); args.Remove("order_type"); } TimeDal.SetLastTime(args["end_time"], entityStr); } while (dt2 < dt3 && flag) { args["start_time"] = dt1.ToString("yyyy-MM-dd HH:mm:ss"); args["end_time"] = dt2.ToString("yyyy-MM-dd HH:mm:ss"); if (entityStr.Equals("采购入库")) { args["status"] = "60"; } upload.UpLoad(args); if (flagflag) { uploadTwo.UpLoad(args); } else if (entityStr == "其他入库") { IUpLoad iupThree = new StockinUpLoad(); args.Add("status", "60"); args.Add("order_type", "2"); iupThree.UpLoad(args); args.Remove("status"); args.Remove("order_type"); } TimeDal.SetLastTime(args["end_time"], entityStr); dt1 = dt2.AddSeconds(1); dt2 = dt1.AddDays(1); if (dt2 > dt3) { args["start_time"] = dt1.ToString("yyyy-MM-dd HH:mm:ss"); args["end_time"] = dt3.ToString("yyyy-MM-dd HH:mm:ss"); if (entityStr.Equals("采购入库")) { args["status"] = "60"; } upload.UpLoad(args); if (flagflag) { uploadTwo.UpLoad(args); } else if (entityStr == "其他入库") { IUpLoad iupThree = new StockinUpLoad(); args.Add("status", "60"); args.Add("order_type", "2"); iupThree.UpLoad(args); args.Remove("status"); args.Remove("order_type"); } TimeDal.SetLastTime(args["end_time"], entityStr); dt2 = dt3; flag = false; } } } } }