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