Commit 08c56eec authored by liudong1993's avatar liudong1993

定时器 取消订单

parent 9fe65747
...@@ -6281,7 +6281,7 @@ namespace Mall.Module.Product ...@@ -6281,7 +6281,7 @@ namespace Mall.Module.Product
{ {
continue; continue;
} }
if (string.IsNullOrEmpty(item.SpecificationSort)) if (string.IsNullOrEmpty(item.SpecificationSort) || item.OrderType == OrderTypeEnum.SDGoods)
{ {
if (gmodel.IsCustomSpecification == 1) if (gmodel.IsCustomSpecification == 1)
{ {
...@@ -8794,7 +8794,7 @@ namespace Mall.Module.Product ...@@ -8794,7 +8794,7 @@ namespace Mall.Module.Product
{ {
continue; continue;
} }
if (string.IsNullOrEmpty(item.SpecificationSort)) if (string.IsNullOrEmpty(item.SpecificationSort) || item.OrderType == OrderTypeEnum.SDGoods)
{ {
if (gmodel.IsCustomSpecification == 1) if (gmodel.IsCustomSpecification == 1)
{ {
...@@ -9121,7 +9121,7 @@ namespace Mall.Module.Product ...@@ -9121,7 +9121,7 @@ namespace Mall.Module.Product
{ {
continue; continue;
} }
if (string.IsNullOrEmpty(item.SpecificationSort)) if (string.IsNullOrEmpty(item.SpecificationSort) || item.OrderType == OrderTypeEnum.SDGoods)
{ {
if (gmodel.IsCustomSpecification == 1) if (gmodel.IsCustomSpecification == 1)
{ {
......
...@@ -135,6 +135,10 @@ namespace Mall.WindowsService.Module ...@@ -135,6 +135,10 @@ namespace Mall.WindowsService.Module
/// vip购买仓储层 /// vip购买仓储层
/// </summary> /// </summary>
private static readonly RB_Vip_BuyRepository vipBuyRepository = new RB_Vip_BuyRepository(); private static readonly RB_Vip_BuyRepository vipBuyRepository = new RB_Vip_BuyRepository();
/// <summary>
/// 商品可预定日期
/// </summary>
private static readonly RB_Goods_TargetDateRepository goods_TargetDateRepository = new RB_Goods_TargetDateRepository();
#region 收入 #region 收入
...@@ -450,7 +454,7 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A ...@@ -450,7 +454,7 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
{ {
continue; continue;
} }
if (string.IsNullOrEmpty(ditem.SpecificationSort)) if (string.IsNullOrEmpty(ditem.SpecificationSort) || ditem.OrderType == OrderTypeEnum.SDGoods)
{ {
if (gmodel.IsCustomSpecification == 1) if (gmodel.IsCustomSpecification == 1)
{ {
...@@ -481,6 +485,75 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A ...@@ -481,6 +485,75 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
}; };
goods_SpecificationPriceRepository.Update(keyValues2, wheres2); goods_SpecificationPriceRepository.Update(keyValues2, wheres2);
} }
if (ditem.OrderType == OrderTypeEnum.SDGoods)
{
//更新商品可预定日期
var tdlist = goods_TargetDateRepository.GetList(new RB_Goods_TargetDate_Extend() { GoodsId = ditem.GoodsId ?? 0, StartTime = ditem.TripSTime.Value.ToString("yyyy-MM-dd"), EndTime = ditem.TripETime.Value.ToString("yyyy-MM-dd") });
if (ditem.CarType == GuideCarGoodsTypeEnum.Line && ditem.IsSpell == 1)
{
//只调整第一天的 其他天 直接表示已预订了
var fristModel = tdlist.Where(x => x.Date == Convert.ToDateTime(ditem.TripSTime.Value.ToString("yyyy-MM-dd"))).FirstOrDefault();
//第一条更新数量 如果OK咯 更新已预定
if (fristModel != null)
{
Dictionary<string, object> keyValues1 = new Dictionary<string, object>
{
{ nameof(RB_Goods_TargetDate.IsReserve), 1 },
{ nameof(RB_Goods_TargetDate.ReserveNum), (fristModel.ReserveNum) - (ditem.Number ?? 0) }
};
List<WhereHelper> wheres1 = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Goods_TargetDate.Id),
FiledValue=fristModel.Id,
OperatorEnum=OperatorEnum.Equal
}
};
goods_TargetDateRepository.Update(keyValues1, wheres1);
if ((fristModel.ReserveNum) - (ditem.Number ?? 0) <= 0)
{
//其他的直接改未预定
foreach (var q1item in tdlist.Where(x => x.Date != Convert.ToDateTime(ditem.TripSTime.Value.ToString("yyyy-MM-dd")) && x.IsReserve == 2))
{
Dictionary<string, object> keyValues2 = new Dictionary<string, object>() {
{ nameof(RB_Goods_TargetDate.IsReserve),1},
{ nameof(RB_Goods_TargetDate.ReserveNum),0},
};
List<WhereHelper> wheres2 = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Goods_TargetDate.Id),
FiledValue=q1item.Id,
OperatorEnum=OperatorEnum.Equal
}
};
goods_TargetDateRepository.Update(keyValues2, wheres2);
}
}
}
}
else
{
//直接回滚所有的日期 为可预定
foreach (var q1item in tdlist)
{
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_Goods_TargetDate.IsReserve),1},
{ nameof(RB_Goods_TargetDate.ReserveNum),0},
};
List<WhereHelper> wheres1 = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Goods_TargetDate.Id),
FiledValue=q1item.Id,
OperatorEnum=OperatorEnum.Equal
}
};
goods_TargetDateRepository.Update(keyValues1, wheres1);
}
}
}
else
{
//更新商品表库存 //更新商品表库存
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() { Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_Goods_Extend.InventoryNum), (gmodel.InventoryNum??0)+(ditem.Number??0)} { nameof(RB_Goods_Extend.InventoryNum), (gmodel.InventoryNum??0)+(ditem.Number??0)}
...@@ -493,6 +566,7 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A ...@@ -493,6 +566,7 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
} }
}; };
goodsRepository.Update(keyValues1, wheres1); goodsRepository.Update(keyValues1, wheres1);
}
goods_LogRepository.Insert(new Mall.Model.Entity.Product.RB_Goods_Log() goods_LogRepository.Insert(new Mall.Model.Entity.Product.RB_Goods_Log()
{ {
Id = 0, Id = 0,
......
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