Commit 5e98bd18 authored by 黄奎's avatar 黄奎

页面修改

parent 8f743aad
...@@ -3,6 +3,7 @@ using System.Collections.Generic; ...@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Mall.AOP.CustomerAttribute;
using Mall.Common; using Mall.Common;
using Mall.Common.API; using Mall.Common.API;
using Mall.Common.Enum; using Mall.Common.Enum;
...@@ -8623,9 +8624,10 @@ namespace Mall.Module.Product ...@@ -8623,9 +8624,10 @@ namespace Mall.Module.Product
/// </summary> /// </summary>
/// <param name="demodel"></param> /// <param name="demodel"></param>
/// <returns></returns> /// <returns></returns>
public string SetOrderSendGoods(RB_Goods_OrderExpress_Extend demodel) [TransactionCallHandler]
public virtual bool SetOrderSendGoods(RB_Goods_OrderExpress_Extend demodel,out string message)
{ {
var trans = goods_OrderExpressRepository.DbTransaction; message = "";
try try
{ {
if (demodel.Id > 0) if (demodel.Id > 0)
...@@ -8633,14 +8635,17 @@ namespace Mall.Module.Product ...@@ -8633,14 +8635,17 @@ namespace Mall.Module.Product
var omodel = goods_OrderRepository.GetEntity(demodel.OrderId); var omodel = goods_OrderRepository.GetEntity(demodel.OrderId);
if (omodel == null) if (omodel == null)
{ {
return "订单不存在"; message= "订单不存在";
return false;
} }
if (omodel.OrderStatus >= Common.Enum.Goods.OrderStatusEnum.Received) if (omodel.OrderStatus >= Common.Enum.Goods.OrderStatusEnum.Received)
{ {
return "已收货无法修改物流信息"; message= "已收货无法修改物流信息";
return false;
} }
//修改物流信息 //修改物流信息
Dictionary<string, object> keyValues = new Dictionary<string, object>() { Dictionary<string, object> keyValues = new Dictionary<string, object>()
{
{ nameof(RB_Goods_OrderExpress.ExpressId),demodel.ExpressId}, { nameof(RB_Goods_OrderExpress.ExpressId),demodel.ExpressId},
{ nameof(RB_Goods_OrderExpress.Type),demodel.Type}, { nameof(RB_Goods_OrderExpress.Type),demodel.Type},
{ nameof(RB_Goods_OrderExpress.PostCode),demodel.PostCode}, { nameof(RB_Goods_OrderExpress.PostCode),demodel.PostCode},
...@@ -8648,24 +8653,28 @@ namespace Mall.Module.Product ...@@ -8648,24 +8653,28 @@ namespace Mall.Module.Product
{ nameof(RB_Goods_OrderExpress.Remark),demodel.Remark}, { nameof(RB_Goods_OrderExpress.Remark),demodel.Remark},
{ nameof(RB_Goods_OrderExpress.UpdateDate),demodel.UpdateDate}, { nameof(RB_Goods_OrderExpress.UpdateDate),demodel.UpdateDate},
}; };
List<WhereHelper> wheres = new List<WhereHelper>() { List<WhereHelper> wheres = new List<WhereHelper>()
new WhereHelper(){ {
new WhereHelper()
{
FiledName=nameof(RB_Goods_OrderExpress.Id), FiledName=nameof(RB_Goods_OrderExpress.Id),
FiledValue=demodel.Id, FiledValue=demodel.Id,
OperatorEnum=OperatorEnum.Equal OperatorEnum=OperatorEnum.Equal
}, },
new WhereHelper(){ new WhereHelper()
{
FiledName=nameof(RB_Goods_OrderExpress.TenantId), FiledName=nameof(RB_Goods_OrderExpress.TenantId),
FiledValue=demodel.TenantId, FiledValue=demodel.TenantId,
OperatorEnum=OperatorEnum.Equal OperatorEnum=OperatorEnum.Equal
}, },
new WhereHelper(){ new WhereHelper()
{
FiledName=nameof(RB_Goods_OrderExpress.MallBaseId), FiledName=nameof(RB_Goods_OrderExpress.MallBaseId),
FiledValue=demodel.MallBaseId, FiledValue=demodel.MallBaseId,
OperatorEnum=OperatorEnum.Equal OperatorEnum=OperatorEnum.Equal
}, },
}; };
bool flag = goods_OrderExpressRepository.Update(keyValues, wheres, trans); bool flag = goods_OrderExpressRepository.Update(keyValues, wheres);
if (flag) if (flag)
{ {
goods_LogRepository.Insert(new RB_Goods_Log() goods_LogRepository.Insert(new RB_Goods_Log()
...@@ -8677,17 +8686,18 @@ namespace Mall.Module.Product ...@@ -8677,17 +8686,18 @@ namespace Mall.Module.Product
SourceId = demodel.OrderId, SourceId = demodel.OrderId,
TenantId = demodel.TenantId, TenantId = demodel.TenantId,
Type = 1 Type = 1
}, trans); });
} }
goods_OrderExpressRepository.DBSession.Commit(); message= flag ? "" : "保存失败";
return flag ? "" : "保存失败"; return flag;
} }
else else
{ {
var dlist = goods_OrderDetailRepository.GetOrderDetailList(new RB_Goods_OrderDetail_Extend() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, OrderId = demodel.OrderId }); var dlist = goods_OrderDetailRepository.GetOrderDetailList(new RB_Goods_OrderDetail_Extend() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, OrderId = demodel.OrderId });
if (demodel.OrderDetailIdList.Where(x => !dlist.Select(y => y.Id).Contains(x)).Any()) if (demodel.OrderDetailIdList.Where(x => !dlist.Select(y => y.Id).Contains(x)).Any())
{ {
return "传递的订单明细Id有误,请核实后再试"; message= "传递的订单明细Id有误,请核实后再试";
return false;
} }
//验证商品是否已创建快递信息 //验证商品是否已创建快递信息
var erlist = goods_ExpressRelevanceRepository.GetList(new RB_Goods_ExpressRelevance_Extend() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, OrderId = demodel.OrderId }); var erlist = goods_ExpressRelevanceRepository.GetList(new RB_Goods_ExpressRelevance_Extend() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, OrderId = demodel.OrderId });
...@@ -8695,10 +8705,11 @@ namespace Mall.Module.Product ...@@ -8695,10 +8705,11 @@ namespace Mall.Module.Product
{ {
if (erlist.Where(x => x.OrderDetailId == item).Any()) if (erlist.Where(x => x.OrderDetailId == item).Any())
{ {
return "传递的订单明细Id:" + item + ",已绑定物流信息无法再次绑定"; message= "传递的订单明细Id:" + item + ",已绑定物流信息无法再次绑定";
return false;
} }
} }
int Id = goods_OrderExpressRepository.Insert(demodel, trans); int Id = goods_OrderExpressRepository.Insert(demodel);
if (Id > 0) if (Id > 0)
{ {
foreach (var item in demodel.OrderDetailIdList) foreach (var item in demodel.OrderDetailIdList)
...@@ -8713,7 +8724,7 @@ namespace Mall.Module.Product ...@@ -8713,7 +8724,7 @@ namespace Mall.Module.Product
OrderId = demodel.OrderId, OrderId = demodel.OrderId,
TenantId = demodel.TenantId, TenantId = demodel.TenantId,
UpdateDate = demodel.UpdateDate UpdateDate = demodel.UpdateDate
}, trans); });
} }
goods_LogRepository.Insert(new RB_Goods_Log() goods_LogRepository.Insert(new RB_Goods_Log()
{ {
...@@ -8724,22 +8735,25 @@ namespace Mall.Module.Product ...@@ -8724,22 +8735,25 @@ namespace Mall.Module.Product
SourceId = demodel.OrderId, SourceId = demodel.OrderId,
TenantId = demodel.TenantId, TenantId = demodel.TenantId,
Type = 1 Type = 1
}, trans); });
//判断商品是否已全部绑定快递, 是的话需要更新商品状态为已发货 //判断商品是否已全部绑定快递, 是的话需要更新商品状态为已发货
if (erlist.Select(x => x.OrderDetailId).Distinct().Count() + demodel.OrderDetailIdList.Distinct().Count() == dlist.Count()) if (erlist.Select(x => x.OrderDetailId).Distinct().Count() + demodel.OrderDetailIdList.Distinct().Count() == dlist.Count())
{ {
Dictionary<string, object> keyValues = new Dictionary<string, object>() { Dictionary<string, object> keyValues = new Dictionary<string, object>()
{
{ nameof(RB_Goods_Order.OrderStatus),OrderStatusEnum.WaitReceiving}, { nameof(RB_Goods_Order.OrderStatus),OrderStatusEnum.WaitReceiving},
{ nameof(RB_Goods_Order.DeliveryTime),DateTime.Now}, { nameof(RB_Goods_Order.DeliveryTime),DateTime.Now},
}; };
List<WhereHelper> wheres = new List<WhereHelper>() { List<WhereHelper> wheres = new List<WhereHelper>()
new WhereHelper(){ {
new WhereHelper()
{
FiledName=nameof(RB_Goods_Order.OrderId), FiledName=nameof(RB_Goods_Order.OrderId),
FiledValue=demodel.OrderId, FiledValue=demodel.OrderId,
OperatorEnum=OperatorEnum.Equal OperatorEnum=OperatorEnum.Equal
} }
}; };
bool oflag = goods_OrderRepository.Update(keyValues, wheres, trans); bool oflag = goods_OrderRepository.Update(keyValues, wheres);
if (oflag) if (oflag)
{ {
goods_LogRepository.Insert(new RB_Goods_Log() goods_LogRepository.Insert(new RB_Goods_Log()
...@@ -8751,7 +8765,7 @@ namespace Mall.Module.Product ...@@ -8751,7 +8765,7 @@ namespace Mall.Module.Product
SourceId = demodel.OrderId, SourceId = demodel.OrderId,
TenantId = demodel.TenantId, TenantId = demodel.TenantId,
Type = 1 Type = 1
}, trans); });
} }
var omodel = goods_OrderRepository.GetEntity(demodel.OrderId); var omodel = goods_OrderRepository.GetEntity(demodel.OrderId);
...@@ -8784,17 +8798,16 @@ namespace Mall.Module.Product ...@@ -8784,17 +8798,16 @@ namespace Mall.Module.Product
} }
} }
} }
goods_OrderExpressRepository.DBSession.Commit(); message= Id > 0 ? "" : "保存失败";
return Id > 0 ? "" : "保存失败"; return Id > 0;
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LogHelper.Write(ex, ""); LogHelper.Write(ex, "SetOrderSendGoods");
goods_OrderExpressRepository.DBSession.Rollback(); message= "保存失败";
return "保存失败"; return false;
} }
} }
/// <summary> /// <summary>
......
...@@ -19,6 +19,7 @@ using Mall.Common.Enum.Goods; ...@@ -19,6 +19,7 @@ using Mall.Common.Enum.Goods;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Json; using Microsoft.Extensions.Configuration.Json;
using Mall.AOP;
namespace Mall.WebApi.Controllers.MallBase namespace Mall.WebApi.Controllers.MallBase
{ {
...@@ -41,7 +42,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -41,7 +42,7 @@ namespace Mall.WebApi.Controllers.MallBase
} }
private readonly OrderModule orderModule = new OrderModule(); private readonly OrderModule orderModule = AOPHelper.CreateAOPObject<OrderModule>();
private readonly MiniProgramMsgModule miniProgramMsgModule = new MiniProgramMsgModule(); private readonly MiniProgramMsgModule miniProgramMsgModule = new MiniProgramMsgModule();
#region 订单列表 #region 订单列表
...@@ -773,15 +774,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -773,15 +774,8 @@ namespace Mall.WebApi.Controllers.MallBase
demodel.CreateDate = DateTime.Now; demodel.CreateDate = DateTime.Now;
demodel.UpdateDate = DateTime.Now; demodel.UpdateDate = DateTime.Now;
string msg = orderModule.SetOrderSendGoods(demodel); var flag= orderModule.SetOrderSendGoods(demodel,out string msg);
if (msg == "") return flag ? ApiResult.Success() : ApiResult.Failed(msg);
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed(msg);
}
} }
/// <summary> /// <summary>
......
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