Commit 8a54e55d authored by liudong1993's avatar liudong1993

自动收货

parent cefd9bc9
......@@ -904,6 +904,19 @@ GROUP BY od.GoodsId,o.OrderId
string sql = $@"SELECT OrderId,UserId,OrderNo,OrderSource,CouponsIds FROM rb_goods_order where TenantId ={t} and MallBaseId ={m} and `Status`=0 and OrderStatus =1 and DATE_ADD(CreateDate,INTERVAL {cancelTime} MINUTE) < '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";
return Get<RB_Goods_Order_Extend>(sql).ToList();
}
/// <summary>
/// 获取可自动收货的订单列表
/// </summary>
/// <param name="day"></param>
/// <param name="t"></param>
/// <param name="m"></param>
/// <returns></returns>
public List<RB_Goods_Order_Extend> GetCanReceivingOrderList(int day, int t, int m)
{
string sql = $@"SELECT OrderId,UserId,OrderNo,OrderSource,CouponsIds FROM rb_goods_order where TenantId ={t} and MallBaseId ={m} and `Status`=0 and OrderStatus =3 and DATE_ADD(DeliveryTime,INTERVAL {day} DAY) < '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";
return Get<RB_Goods_Order_Extend>(sql).ToList();
}
#endregion
}
}
......@@ -43,5 +43,24 @@ namespace Mall.WindowsService.Helper
Interlocked.Exchange(ref inTimer, 0);
}
}
/// <summary>
/// 自动收货订单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void AutoReceivingOrder(object sender, System.Timers.ElapsedEventArgs e)
{
if (Interlocked.Exchange(ref inTimer, 1) == 0)
{
if (DateTime.Now.Hour == 1)
{
LogHelper.Write("AutoReceivingOrder=====Start");
Module.FinanceModule.AutoReceivingOrder();
LogHelper.Write("AutoReceivingOrder=====End");
Interlocked.Exchange(ref inTimer, 0);
}
}
}
}
}
This diff is collapsed.
......@@ -13,6 +13,7 @@ namespace Mall.WindowsService
{
System.Timers.Timer timer1; //计时器
private System.Timers.Timer timer2; //订单取消计时器
private System.Timers.Timer timer3; //订单自动收货计时器
public WindowsService()
{
......@@ -39,6 +40,18 @@ namespace Mall.WindowsService
timer2.Enabled = true;
#endregion
#region 订单自动完成定时器
timer3 = new System.Timers.Timer();
timer2 = new System.Timers.Timer
{
Interval = 1000 * (60 * 60) //60分钟调用一次
};
timer3.Elapsed += new System.Timers.ElapsedEventHandler(helper.AutoReceivingOrder);
timer3.Enabled = true;
#endregion
}
protected override void OnStop()
......@@ -47,6 +60,7 @@ namespace Mall.WindowsService
Helper.LogHelper.Write("主服务停止运行......");
this.timer1.Enabled = false;
this.timer2.Enabled = false;
this.timer3.Enabled = false;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment