一次合格,抛光品仓库统计逻辑修改

This commit is contained in:
2025-06-16 11:22:40 +08:00
parent e0afea26c2
commit ffb6157d7f
4 changed files with 353 additions and 290 deletions

View File

@@ -316,11 +316,10 @@ namespace ZR.Service.mes.wms
foreach (WmPolishInventoryDto item in list)
{
//TODO 20250408 盘点时间修正(三个时间比对)
WmPolishRecord minCheckRecord =
wmPolishRecords
.Where(o => o.Partnumber == item.Partnumber && o.ChangeType == 3)
.OrderByDescending(o => o.ActionTime)
.FirstOrDefault();
WmPolishRecord minCheckRecord = wmPolishRecords
.Where(o => o.Partnumber == item.Partnumber && o.ChangeType == 3)
.OrderByDescending(o => o.ActionTime)
.FirstOrDefault();
DateTime minCheckRecordTime = DateTime.MinValue;
int minCheckRecordQuantity = 0;
if (minCheckRecord != null)
@@ -363,7 +362,10 @@ namespace ZR.Service.mes.wms
item.CreatedTime = checkTime;
}
list = list.Where(it => it.RealQuantity != 0 || it.Quantity != 0)
list = list.WhereIF(
string.IsNullOrEmpty(parm.Partnumber),
it => it.RealQuantity != 0 || it.Quantity != 0
)
.Where(it => !string.IsNullOrEmpty(it.Partnumber))
.DistinctBy(it => it.Partnumber)
.OrderBy(it => it.RealQuantity)
@@ -726,6 +728,7 @@ namespace ZR.Service.mes.wms
throw new Exception(e.Message);
}
}
// 盘点
public int DoWmPolishStocktaking(WmPolishInventory parm)
{
@@ -737,17 +740,17 @@ namespace ZR.Service.mes.wms
{
Context.Ado.BeginTran();
// 检查是否存在库中
/* WmPolishInventory polishInventory = Context
.Queryable<WmPolishInventory>()
.Where(it => it.Id == parm.Id)
.Where(it => it.Status == 1)
.First();
if (polishInventory == null)
{
Context.Ado.RollbackTran();
throw new Exception("盘点记录不存在" + parm.Id);
}
Context.Updateable(parm).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();*/
/* WmPolishInventory polishInventory = Context
.Queryable<WmPolishInventory>()
.Where(it => it.Id == parm.Id)
.Where(it => it.Status == 1)
.First();
if (polishInventory == null)
{
Context.Ado.RollbackTran();
throw new Exception("盘点记录不存在" + parm.Id);
}
Context.Updateable(parm).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();*/
// 已有则新增记录
string code = !string.IsNullOrEmpty(parm.WorkOrder)
? parm.WorkOrder
@@ -828,14 +831,10 @@ namespace ZR.Service.mes.wms
//TODO 20250408 新导出逻辑
// 构建导出数据
WmPolishInventoryQueryDto queryParams = new()
{
PageSize = 10000,
PageNum = 1
};
WmPolishInventoryQueryDto queryParams = new() { PageSize = 10000, PageNum = 1 };
// 构建导出数据
List<WmPolishInventoryExportDto> exportDto = GetListNew(queryParams).Result
.Select(it =>
List<WmPolishInventoryExportDto> exportDto = GetListNew(queryParams)
.Result.Select(it =>
{
return new WmPolishInventoryExportDto
{
@@ -901,7 +900,6 @@ namespace ZR.Service.mes.wms
/// <returns></returns>
public (string, object, object) ImportExcel(List<WmPolishInventoryExportDto> importList)
{
List<WmPolishInventory> wmPolishInventorylist = importList
.Select(it => new WmPolishInventory
{