Commit c47fd47c authored by liudong1993's avatar liudong1993

订单取消调整

parent 9cbc38ea
...@@ -5875,7 +5875,8 @@ namespace Mall.Module.Product ...@@ -5875,7 +5875,8 @@ namespace Mall.Module.Product
TripSTime = item.TripSTime, TripSTime = item.TripSTime,
UseDay = item.UseDay, UseDay = item.UseDay,
InsuranceMoney = item.InsuranceMoney, InsuranceMoney = item.InsuranceMoney,
InsuranceCostMoney = item.InsuranceCostMoney InsuranceCostMoney = item.InsuranceCostMoney,
InsuranceFinanceId = 0
}, trans); }, trans);
item.Id = detailId; item.Id = detailId;
if (detailId > 0 && SatisfiedGoodsList.Any()) if (detailId > 0 && SatisfiedGoodsList.Any())
...@@ -5900,12 +5901,13 @@ namespace Mall.Module.Product ...@@ -5900,12 +5901,13 @@ namespace Mall.Module.Product
}, trans); }, trans);
} }
} }
if (IsSDGoods == false)
//更新商品数量 {
Dictionary<string, object> keyValues = new Dictionary<string, object>() { //更新商品数量
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Goods.InventoryNum),item.InventoryNum-(item.Number??0)} { nameof(RB_Goods.InventoryNum),item.InventoryNum-(item.Number??0)}
}; };
List<WhereHelper> wheres = new List<WhereHelper>() { List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){ new WhereHelper(){
FiledName=nameof(RB_Goods.Id), FiledName=nameof(RB_Goods.Id),
FiledValue=item.GoodsId, FiledValue=item.GoodsId,
...@@ -5922,16 +5924,16 @@ namespace Mall.Module.Product ...@@ -5922,16 +5924,16 @@ namespace Mall.Module.Product
OperatorEnum=OperatorEnum.Equal OperatorEnum=OperatorEnum.Equal
} }
}; };
bool flagg = goodsRepository.Update(keyValues, wheres, trans); bool flagg = goodsRepository.Update(keyValues, wheres, trans);
if (flagg) if (flagg)
{
if (!string.IsNullOrEmpty(item.SpecificationSort) && item.SpeciPriceId > 0)
{ {
//更新规格价格库存 if (!string.IsNullOrEmpty(item.SpecificationSort) && item.SpeciPriceId > 0)
Dictionary<string, object> keyValuesp = new Dictionary<string, object>() { {
//更新规格价格库存
Dictionary<string, object> keyValuesp = new Dictionary<string, object>() {
{ nameof(RB_Goods_SpecificationPrice.InventoryNum),item.InventoryNum-(item.Number??0)} { nameof(RB_Goods_SpecificationPrice.InventoryNum),item.InventoryNum-(item.Number??0)}
}; };
List<WhereHelper> wheresp = new List<WhereHelper>() { List<WhereHelper> wheresp = new List<WhereHelper>() {
new WhereHelper(){ new WhereHelper(){
FiledName=nameof(RB_Goods_SpecificationPrice.Id), FiledName=nameof(RB_Goods_SpecificationPrice.Id),
FiledValue=item.SpeciPriceId, FiledValue=item.SpeciPriceId,
...@@ -5953,19 +5955,20 @@ namespace Mall.Module.Product ...@@ -5953,19 +5955,20 @@ namespace Mall.Module.Product
OperatorEnum=OperatorEnum.Equal OperatorEnum=OperatorEnum.Equal
} }
}; };
goods_SpecificationPriceRepository.Update(keyValuesp, wheresp, trans); goods_SpecificationPriceRepository.Update(keyValuesp, wheresp, trans);
}
//记录日志
goods_LogRepository.Insert(new RB_Goods_Log()
{
Id = 0,
Type = 2,
SourceId = item.GoodsId,
Content = "新增订单,Key:" + item.SpecificationSort + ",商品库存减少:" + item.Number,
CreateDate = DateTime.Now,
MallBaseId = demodel.MallBaseId,
TenantId = demodel.TenantId
}, trans);
} }
//记录日志
goods_LogRepository.Insert(new RB_Goods_Log()
{
Id = 0,
Type = 2,
SourceId = item.GoodsId,
Content = "新增订单,Key:" + item.SpecificationSort + ",商品库存减少:" + item.Number,
CreateDate = DateTime.Now,
MallBaseId = demodel.MallBaseId,
TenantId = demodel.TenantId
}, trans);
} }
#region 更新司导商品预约时间 #region 更新司导商品预约时间
...@@ -8690,18 +8693,87 @@ namespace Mall.Module.Product ...@@ -8690,18 +8693,87 @@ namespace Mall.Module.Product
}; };
goods_SpecificationPriceRepository.Update(keyValues2, wheres2, trans); goods_SpecificationPriceRepository.Update(keyValues2, wheres2, trans);
} }
//更新商品表库存 if (item.OrderType == OrderTypeEnum.SDGoods)
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() { {
//更新商品可预定日期
var tdlist = goods_TargetDateRepository.GetList(new RB_Goods_TargetDate_Extend() { GoodsId = item.GoodsId ?? 0, StartTime = item.TripSTime.Value.ToString("yyyy-MM-dd"), EndTime = item.TripETime.Value.ToString("yyyy-MM-dd") });
if (item.CarType == GuideCarGoodsTypeEnum.Line && item.IsSpell == 1)
{
//只调整第一天的 其他天 直接表示已预订了
var fristModel = tdlist.Where(x => x.Date == Convert.ToDateTime(item.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) - (item.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, trans);
if ((fristModel.ReserveNum) - (item.Number ?? 0) <= 0)
{
//其他的直接改未预定
foreach (var qitem in tdlist.Where(x => x.Date != Convert.ToDateTime(item.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=qitem.Id,
OperatorEnum=OperatorEnum.Equal
}
};
goods_TargetDateRepository.Update(keyValues2, wheres2, trans);
}
}
}
}
else
{
//直接回滚所有的日期 为可预定
foreach (var qitem 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=qitem.Id,
OperatorEnum=OperatorEnum.Equal
}
};
goods_TargetDateRepository.Update(keyValues1, wheres1, trans);
}
}
}
else
{
//更新商品表库存
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_Goods.InventoryNum), (gmodel.InventoryNum??0)+(item.Number??0)} { nameof(RB_Goods.InventoryNum), (gmodel.InventoryNum??0)+(item.Number??0)}
}; };
List<WhereHelper> wheres1 = new List<WhereHelper>() { List<WhereHelper> wheres1 = new List<WhereHelper>() {
new WhereHelper(){ new WhereHelper(){
FiledName=nameof(RB_Goods.Id), FiledName=nameof(RB_Goods.Id),
FiledValue=gmodel.Id, FiledValue=gmodel.Id,
OperatorEnum=OperatorEnum.Equal OperatorEnum=OperatorEnum.Equal
} }
}; };
goodsRepository.Update(keyValues1, wheres1, trans); goodsRepository.Update(keyValues1, wheres1, trans);
}
goods_LogRepository.Insert(new RB_Goods_Log() goods_LogRepository.Insert(new RB_Goods_Log()
{ {
Id = 0, Id = 0,
...@@ -10700,6 +10772,7 @@ namespace Mall.Module.Product ...@@ -10700,6 +10772,7 @@ namespace Mall.Module.Product
x.FreeShippingRemarks, x.FreeShippingRemarks,
x.SmallShopsCostPrice, x.SmallShopsCostPrice,
CouponMoney = x.CouponMoney ?? 0, CouponMoney = x.CouponMoney ?? 0,
InsuranceMoney = x.InsuranceMoney ?? 0,
IntegralMoney = x.IntegralMoney ?? 0, IntegralMoney = x.IntegralMoney ?? 0,
IntegralNumber = x.IntegralNumber ?? 0, IntegralNumber = x.IntegralNumber ?? 0,
}) })
......
...@@ -252,7 +252,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -252,7 +252,8 @@ namespace Mall.WebApi.Controllers.MallBase
y.Final_Price, y.Final_Price,
y.Number, y.Number,
y.IsComment, y.IsComment,
y.FreeShippingRemarks y.FreeShippingRemarks,
InsuranceMoney = y.InsuranceMoney ?? 0
}), }),
x.OrderStatus, x.OrderStatus,
OrderStatusName = x.OrderStatus.GetEnumName(), OrderStatusName = x.OrderStatus.GetEnumName(),
......
...@@ -132,6 +132,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -132,6 +132,8 @@ namespace Mall.WebApi.Controllers.MallBase
y.YFMoney, y.YFMoney,
y.PayMoney, y.PayMoney,
CouponMoney = y.CouponMoney ?? 0, CouponMoney = y.CouponMoney ?? 0,
InsuranceMoney = y.InsuranceMoney ?? 0,
InsuranceCostMoney = y.InsuranceCostMoney ?? 0,
IntegralMoney = y.IntegralMoney ?? 0, IntegralMoney = y.IntegralMoney ?? 0,
IntegralNumber = y.IntegralNumber ?? 0, IntegralNumber = y.IntegralNumber ?? 0,
SFinanceList = y.FinanceList.Where(z => z.Type == 1).Select(z => new SFinanceList = y.FinanceList.Where(z => z.Type == 1).Select(z => new
......
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