修改了background代码!!!!import 修改了库存日志数据库,前端修改,添加库存日志导出功能
This commit is contained in:
@@ -17,6 +17,11 @@ namespace DOAN.Service.PBL.IService
|
||||
Inventorylog AddInventorylog(Inventorylog parm);
|
||||
int UpdateInventorylog(Inventorylog parm);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 导出日志信息
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public List<Inventorylog> ExportInventorylog(InventorylogExportDto model);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,11 @@ namespace DOAN.Service.PBL.IService
|
||||
Storagelocation AddStoragelocation(Storagelocation parm);
|
||||
int UpdateStoragelocation(Storagelocation parm);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取零件号库存
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
List<StoragelocationPartNumberGroupDto> GetPartNumberList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ using DOAN.Model.PBL.Dto;
|
||||
using DOAN.Model.PBL;
|
||||
using DOAN.Repository;
|
||||
using DOAN.Service.PBL.IService;
|
||||
using Aliyun.OSS;
|
||||
using System;
|
||||
|
||||
|
||||
namespace DOAN.Service.PBL
|
||||
@@ -82,5 +84,47 @@ namespace DOAN.Service.PBL
|
||||
|
||||
return predicate;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导出库存日志
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public List<Inventorylog> ExportInventorylog(InventorylogExportDto model)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 将字符串类型的 StartTime 和 EndTime 转换为 DateTime 类型
|
||||
if (!DateTime.TryParse(model.StartTime, out DateTime startTime))
|
||||
{
|
||||
throw new ArgumentException("开始时间格式无效。");
|
||||
}
|
||||
|
||||
if (!DateTime.TryParse(model.EndTime, out DateTime endTime))
|
||||
{
|
||||
throw new ArgumentException("结束时间格式无效。");
|
||||
}
|
||||
|
||||
// 设置开始时间为当天的开始时间(00:00:00)
|
||||
startTime = startTime.Date;
|
||||
|
||||
// 设置结束时间为当天的结束时间(23:59:59)
|
||||
endTime = endTime.Date.AddDays(1).AddTicks(-1);
|
||||
|
||||
// 查询符合条件的库存日志
|
||||
var response = Queryable()
|
||||
.Where(it => it.CreatedTime >= startTime && it.CreatedTime <= endTime)
|
||||
.OrderBy(it => it.CreatedTime)
|
||||
.ToList();
|
||||
|
||||
return response;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 记录异常信息(可以使用日志框架如 NLog 或 Serilog)
|
||||
Console.WriteLine($"导出库存日志异常: {ex.Message}\n堆栈跟踪: {ex.StackTrace}");
|
||||
throw; // 或者返回空列表或其他适当的响应
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,6 +65,22 @@ namespace DOAN.Service.PBL
|
||||
return Update(model, true);
|
||||
}
|
||||
|
||||
public List<StoragelocationPartNumberGroupDto> GetPartNumberList()
|
||||
{
|
||||
var response = Queryable()
|
||||
.GroupBy(it=>it.Partnumber)
|
||||
.OrderBy(it=>it.RackCode)
|
||||
.Select(it=>new StoragelocationPartNumberGroupDto()
|
||||
{
|
||||
RackCode = SqlFunc.AggregateMax(it.RackCode),
|
||||
Partnumber = SqlFunc.AggregateMax( it.Partnumber),
|
||||
PackageNum = SqlFunc.AggregateSum(it.PackageNum) ?? 0
|
||||
})
|
||||
.ToList();
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询导出表达式
|
||||
/// </summary>
|
||||
@@ -79,5 +95,7 @@ namespace DOAN.Service.PBL
|
||||
|
||||
return predicate;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user