Files
YunTongJackYunTask/Reportapi/MyCode.Project.Repositories/BusiOrderGoodsDocInRepository.cs

144 lines
5.3 KiB
C#
Raw Normal View History

2025-10-28 19:18:39 +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-11-06 10:14:41 +08:00
using MyCode.Project.Domain.Message.Response.JackYun;
2025-10-28 19:18:39 +08:00
namespace MyCode.Project.Repositories
{
public class BusiOrderGoodsDocInRepository: Repository<BusiOrderGoodsDocIn>, IBusiOrderGoodsDocInRepository
{
public BusiOrderGoodsDocInRepository(MyCodeSqlSugarClient context) : base(context)
{ }
2025-11-06 18:12:17 +08:00
// SELECT
// -- 分组字段
// CONVERT(date, InOutDate2) AS 出入库日期,
// WarehouseCode AS 仓库编码,
// WarehouseName AS 仓库名称,
// GoodsNo AS 商品编码,
// GoodsName AS 商品名称,
// SkuName AS 规格,
// UnitName AS 单位,
// -- 合计数据
// SUM(Quantity) AS 总数量,
// SUM(BaceCurrencyCostAmount) AS 总入库金额,
// SUM(BaceCurrencyNoTaxAmount) AS 总本币无税金额,
// SUM(BaceCurrencyWithTaxAmount) AS 总本币含税金额,
// SUM(BaceCurrencyTaxAmount) AS 总本币税额,
// SUM(TransNoTaxAmount) AS 总原币无税金额,
// SUM(TransHasTaxAmount) AS 总原币含税金额,
// SUM(TransTaxAmount) AS 总原币税额,
2025-10-28 19:18:39 +08:00
2025-11-06 18:12:17 +08:00
// -- 计数统计
// COUNT(DISTINCT GoodsdocNo) AS 入库单数,
// COUNT(*) AS 明细行数
2025-10-28 19:18:39 +08:00
2025-11-06 10:14:41 +08:00
2025-11-06 18:12:17 +08:00
//FROM[dbo].[BusiOrderGoodsDocIn]
// WHERE Status IN(0) -- 根据业务需求调整状态筛选
// GROUP BY
// CONVERT(date, InOutDate2),
// WarehouseCode,
// WarehouseName,
// GoodsNo,
// GoodsName,
// SkuName,
// UnitName
//ORDER BY
// CONVERT(date, InOutDate2) DESC,
// WarehouseCode,
// GoodsNo;
#region GetPushGoodsDocInOrder()
2025-11-06 10:14:41 +08:00
/// <summary>
2025-11-06 18:12:17 +08:00
/// 获取合并后的吉客云采购入库单订单
2025-11-06 10:14:41 +08:00
/// </summary>
/// <returns></returns>
2025-11-06 18:12:17 +08:00
public List<BusiOrderGoodsDocInSummary> GetPushGoodsDocInOrder()
2025-11-06 10:14:41 +08:00
{
2025-11-18 18:44:31 +08:00
string sql = $@"SELECT
2025-11-06 18:12:17 +08:00
--
2025-11-24 16:06:01 +08:00
CONVERT(date, InOutDate2) AS InOutDate2,
[VendCustomerName], VendCode,
2025-11-06 18:12:17 +08:00
--
SUM(Quantity) AS Quantity ,-- ,
SUM(BaceCurrencyCostAmount) AS BaceCurrencyCostAmount,--,
SUM(BaceCurrencyNoTaxAmount) AS BaceCurrencyNoTaxAmount,--,
SUM(BaceCurrencyWithTaxAmount) AS BaceCurrencyWithTaxAmount,--,
SUM(BaceCurrencyTaxAmount) AS BaceCurrencyTaxAmount,-- ,
SUM(TransNoTaxAmount) AS TransNoTaxAmount,--,
SUM(TransHasTaxAmount) AS TransHasTaxAmount,--,
2025-11-18 18:44:31 +08:00
SUM(TransTaxAmount) AS TransTaxAmount,--,
2025-11-06 18:12:17 +08:00
--
COUNT(DISTINCT GoodsdocNo) AS ,
COUNT(*) AS
FROM [dbo].[BusiOrderGoodsDocIn]
WHERE Status IN (0) --
2025-11-21 16:21:38 +08:00
GROUP BY
2025-11-24 16:06:01 +08:00
CONVERT(date, InOutDate2) ,[VendCustomerName] ,VendCode
2025-11-06 18:12:17 +08:00
ORDER BY
2025-11-24 16:06:01 +08:00
InOutDate2 DESC ";
2025-11-06 18:12:17 +08:00
var list = this.SelectList<BusiOrderGoodsDocInSummary>(sql);
2025-11-06 10:14:41 +08:00
return list;
}
#endregion
2025-11-20 18:14:49 +08:00
// #region GetPushGoodsDocInOrder(获取合并后的吉客云采购入库单订单)
// /// <summary>
// /// 获取合并后的吉客云采购入库单订单
// /// </summary>
// /// <returns></returns>
// public List<BusiOrderGoodsDocInSummary> GetPushGoodsDocInOrder()
// {
// string sql = $@"SELECT
// -- 分组字段
// CONVERT(date, InOutDate2) AS InOutDate2,
// WarehouseCode AS WarehouseCode,
// WarehouseName AS WarehouseName,
// VendCode ,[ApplyCompanyName],[VendCustomerName],
// -- 合计数据
// SUM(Quantity) AS Quantity ,-- 总数量,
// SUM(BaceCurrencyCostAmount) AS BaceCurrencyCostAmount,--总入库金额,
// SUM(BaceCurrencyNoTaxAmount) AS BaceCurrencyNoTaxAmount,--总本币无税金额,
// SUM(BaceCurrencyWithTaxAmount) AS BaceCurrencyWithTaxAmount,--总本币含税金额,
// SUM(BaceCurrencyTaxAmount) AS BaceCurrencyTaxAmount,-- 总本币税额,
// SUM(TransNoTaxAmount) AS TransNoTaxAmount,--总原币无税金额,
// SUM(TransHasTaxAmount) AS TransHasTaxAmount,--总原币含税金额,
// SUM(TransTaxAmount) AS TransTaxAmount,--总原币税额,
// -- 计数统计
// COUNT(DISTINCT GoodsdocNo) AS 入库单数,
// COUNT(*) AS 明细行数
//FROM [dbo].[BusiOrderGoodsDocIn]
//WHERE Status IN (0) -- 根据业务需求调整状态筛选
//GROUP BY
// CONVERT(DATE, InOutDate2),
// WarehouseCode,
// WarehouseName,
// VendCode ,[ApplyCompanyName],[VendCustomerName]
//ORDER BY
// CONVERT(date, InOutDate2) DESC,
// WarehouseCode,
// VendCode ; ";
// var list = this.SelectList<BusiOrderGoodsDocInSummary>(sql);
// return list;
// }
// #endregion
2025-11-06 10:14:41 +08:00
}
2025-10-28 19:18:39 +08:00
}