73 lines
2.9 KiB
C#
Raw Normal View History

2025-07-07 20:02:36 +08:00
using MyCode.Project.Repositories.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MyCode.Project.Domain.Message;
using MyCode.Project.Domain.Model;
using MyCode.Project.Domain.Repositories;
using MyCode.Project.Infrastructure.Common;
using MyCode.Project.Infrastructure.Search;
2025-07-14 20:39:36 +08:00
using MyCode.Project.Domain.Message.Response.JackYun;
2025-07-07 20:02:36 +08:00
namespace MyCode.Project.Repositories
{
public class JackOrdersItemRepository: Repository<JackOrdersItem>, IJackOrdersItemRepository
{
public JackOrdersItemRepository(MyCodeSqlSugarClient context) : base(context)
{ }
2025-07-14 20:39:36 +08:00
#region GetPushOrder()
/// <summary>
/// 获取合并后的吉客云订单
/// </summary>
/// <returns></returns>
public List<PushOrderListResp> GetPushOrder()
{
string sql = $@"
SELECT [shopCode], [shopName], [shopId], [warehouseName], [warehouseCode],
[status], CONVERT(NVARCHAR(30),[consignTime],23) [consignTime],
[goodsNo], [goodsId],SUM([sellTotal]) [sellTotal],
2025-08-11 17:32:59 +08:00
SUM([sellCount]) [sellCount], SUM([shareFavourableAfterFee]) AS [divideSellTotal],
2025-07-21 18:03:24 +08:00
[barcode], [TradeType] ,[warehouseId],Unit
2025-07-14 20:39:36 +08:00
FROM [JackOrders] a WITH (NOLOCK)
LEFT JOIN [dbo].[JackOrdersItem] b WITH (NOLOCK)
ON a.id = b.JackOrdersId
2025-10-17 17:54:23 +08:00
WHERE a.status = 0 and TradeType in (1,7)
2025-07-21 18:03:24 +08:00
GROUP BY [shopCode],[shopName], [shopId], [warehouseName], [warehouseCode], [status], CONVERT(NVARCHAR(30),[consignTime],23) ,[goodsNo], [goodsId], [barcode] ,[warehouseId], [TradeType],Unit";
2025-07-14 20:39:36 +08:00
var list = this.SelectList<PushOrderListResp>(sql);
return list;
}
#endregion
2025-07-07 20:02:36 +08:00
2025-10-17 17:54:23 +08:00
#region GetPushOrder()
/// <summary>
/// 获取合并后的吉客云订单
/// </summary>
/// <returns></returns>
public List<PushOrderListResp> GetPushReturnOrder()
{
string sql = $@"
SELECT [shopCode], [shopName], [shopId], [warehouseName], [warehouseCode],
[status], CONVERT(NVARCHAR(30),[consignTime],23) [consignTime],
[goodsNo], [goodsId],SUM([sellTotal]*-1) [sellTotal],
SUM([sellCount]*-1) [sellCount], SUM([ShareShouldReturnFee]*-1) AS [divideSellTotal],
[barcode], [TradeType] ,[warehouseId],Unit
FROM [JackOrders] a WITH (NOLOCK)
LEFT JOIN [dbo].[ReturnChangeGoodsDetail] b WITH (NOLOCK)
ON a.id = b.JackOrdersId
WHERE a.status = 0 and [TradeType]=8
GROUP BY [shopCode],[shopName], [shopId], [warehouseName], [warehouseCode], [status], CONVERT(NVARCHAR(30),[consignTime],23) ,[goodsNo],
[goodsId], [barcode] ,[warehouseId], [TradeType],Unit
ORDER BY [shopCode],[consignTime] desc,[TradeType]
";
var list = this.SelectList<PushOrderListResp>(sql);
return list;
}
#endregion
2025-07-14 20:39:36 +08:00
}
2025-07-07 20:02:36 +08:00
}