Commit d12c7ed5 authored by 吴春's avatar 吴春

修改订单统计

parent dabb85e5
......@@ -1652,6 +1652,10 @@ left join rb_lineteam E on E.LtID=C.LineteamId
where += $@" AND A.{nameof(RB_Travel_Order.Income)}>0";
}
}
if (userInfo==null)
{
userInfo = new UserInfo();
}
string sql = $@"
SELECT
SUM(CASE WHEN IFNULL(A.CommissionSharePeople,0)!={(int)model.CreateBy} AND A.OrderState!={(int)SellOrderStatusEnum.Cancel} THEN IFNULL(A.PreferPrice,0) else 0 END) AS SumPreferPrice
......@@ -1684,14 +1688,14 @@ SUM(CASE WHEN IFNULL(A.CommissionSharePeople,0)!={(int)model.CreateBy} AND A.Ord
,SUM(CASE WHEN IFNULL(A.CommissionSharePeople,0)!={(int)model.CreateBy} AND A.OrderState!={(int)SellOrderStatusEnum.Cancel} THEN (IFNULL(A.PreferPrice,0)-IFNULL(A.Income,0)+IFNULL(A.Refund,0)-IFNULL(A.PlatformTax,0)-IFNULL(A.DiscountMoney,0)-IFNULL(A.RedEnvelopeMoney,0)) ELSE 0 END) AS DueinMoney
,SUM(CASE WHEN IFNULL(A.CommissionSharePeople,0)!={(int)model.CreateBy} AND A.OrderSource={(int)OrderSourceEnum.Internal} THEN 1 ELSE 0 END) AS InteriorNum
,SUM(CASE WHEN IFNULL(A.CommissionSharePeople,0)!={(int)model.CreateBy} AND A.OrderSource in ({(int)OrderSourceEnum.B2B},{(int)OrderSourceEnum.WAP}) THEN 1 ELSE 0 END) AS B2BNum
{((userInfo?.SimpleEasy ?? 0) == 1 ? " from ( SELECT A.* " : "")}
{((userInfo != null && (userInfo?.SimpleEasy ?? 0) == 1) ? " from ( SELECT A.* " : "")}
from rb_travel_order AS A
LEFT JOIN rb_travel_price as B ON A.TCID=B.TCID
LEFT JOIN rb_travel_config AS C ON c.ID=B.ConfigID
left join rb_line D on D.LineID=C.LineId
left join rb_lineteam E on E.LtID=C.LineteamId
{((userInfo?.SimpleEasy ?? 0) == 1 ? " left JOIN rb_appoint_op aop on aop.OrderId=a.OrderId and aop.ResourceType=10" : "")}
{where} {((userInfo?.SimpleEasy ?? 0) == 1 ? " GROUP BY a.OrderId ) as A " : "")} ";
{((userInfo != null && (userInfo?.SimpleEasy ?? 0) == 1) ? " left JOIN rb_appoint_op aop on aop.OrderId=a.OrderId and aop.ResourceType=10" : "")}
{where} {((userInfo != null && (userInfo?.SimpleEasy ?? 0) == 1) ? " GROUP BY a.OrderId ) as A " : "")} ";
return Get<RB_Travel_Order_Extend>(sql).FirstOrDefault();
}
......
......@@ -10851,11 +10851,11 @@ namespace REBORN.Services.SellService
if (!string.IsNullOrWhiteSpace(isMyOrderStr))
{
isMyOrder = parm.GetInt("IsMyOrder", 1);
if (isMyOrder == 1)//自己的订单
{
OrderInfo.CreateBy = userInfo.EmployeeId;
OrderInfo.BranchId = userInfo.RB_Branch_id;
}
}
if (isMyOrder == 1)//自己的订单
{
OrderInfo.CreateBy = userInfo.EmployeeId;
OrderInfo.BranchId = userInfo.RB_Branch_id;
}
else
{
......@@ -11205,7 +11205,7 @@ namespace REBORN.Services.SellService
JObject parm = JObject.Parse(request.msg.ToString());
UserInfo userInfo = CacheManager.User.RbUserCache.GetUserLoginInfo(request.uid);
RB_Travel_Order_Extend OrderInfo = JsonConvert.DeserializeObject<RB_Travel_Order_Extend>(request.msg.ToString());
// OrderInfo.CreateBy = userInfo.EmployeeId;
OrderInfo.RB_Group_Id = userInfo.RB_Group_id;
OrderInfo.OutBranchId = -1;
string isMyOrderStr = parm.GetStringValue("IsMyOrder");
......@@ -11213,16 +11213,17 @@ namespace REBORN.Services.SellService
if (!string.IsNullOrWhiteSpace(isMyOrderStr))
{
isMyOrder = parm.GetInt("IsMyOrder", 1);
if (isMyOrder == 1)//自己的订单
{
OrderInfo.RB_Branch_Id = userInfo.RB_Branch_id;
OrderInfo.CreateBy = userInfo.EmployeeId;
}
}
if (isMyOrder == 1)//自己的订单
{
OrderInfo.BranchId = userInfo.RB_Branch_id;
OrderInfo.CreateBy = userInfo.EmployeeId;
}
else
{
int empBranchId = parm.GetInt("RB_Branch_Id", -1);
OrderInfo.BranchId = empBranchId;
OrderInfo.CreateBy = OrderInfo?.CreateBy ?? 0;
}
var model = sellOrderModule.GetTravelOrderListStatistics_V2(OrderInfo, userInfo, isMyOrder: isMyOrder) ?? new RB_Travel_Order_Extend();
return ApiResult.Success("", 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