This commit is contained in:
2025-10-17 18:28:49 +08:00
parent 52e8ae5b40
commit ea4d9ee0f0

View File

@@ -1,4 +1,5 @@
using Infrastructure.Attribute;
using JinianNet.JNTemplate;
using SqlSugar;
using System;
using System.Linq;
@@ -517,21 +518,29 @@ namespace ZR.Service.mes.wms
}
#endregion
// 批量插入到 wm_polish_record 表
//如果有这个时间段的数据,要删除
List<WmPolishRecord> delwmPolishRecords = Context
.Queryable<WmPolishRecord>()
.Where(it => it.Code == "自动")
.Where(it => it.ActionTime >= parm.StartTime)
.ToList();
Context.Deleteable(delwmPolishRecords).ExecuteCommand();
if (wmPolishRecords.Any())
try
{
Context.Insertable(wmPolishRecords).ExecuteCommand();
Context.Ado.BeginTran();
// 批量插入到 wm_polish_record 表
//如果有这个时间段的数据,要删除
Context.Deleteable<WmPolishRecord>()
.Where(it => it.Code == "自动")
.Where(it => it.ActionTime >= parm.StartTime)
.ExecuteCommand();
if (wmPolishRecords.Any())
{
Context.Fastest<WmPolishRecord>().BulkCopy(wmPolishRecords);
//Context.Insertable(wmPolishRecords).ExecuteCommand();
}
Context.Ado.CommitTran();
return wmPolishRecords.Count; // 返回插入的记录数
}
catch (Exception)
{
Context.Ado.RollbackTran();
throw;
}
return wmPolishRecords.Count; // 返回插入的记录数
}
}
}