-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
public override WebResponseContent Import(List<IFormFile> files)
{
//导入保存前处理(可以对list设置新的值)
ImportOnExecuting = (List<Ware_ProductionKanban> list) =>
{
var productIds = list.Select(x => x.ProductName).Distinct().ToList();
foreach (var item in productIds)
{
Base_Product defectItemExtendData = (Base_Product)_productRepository.FindAsIQueryable(x => x.ProductName == item);
if (defectItemExtendData == null)
{
Base_Product extendData = new Base_Product();
extendData.ProductName = item;
extendData.ProductCode = GetProductCode(1);
extendData.WhetherQuality = 1;
extendData.ProductAttribute = "selfControl";
_productRepository.Add(extendData, true);
}
}
// 获取已存在的产品ID列表
for (int i = 0; i < list.Count; i++)
{
if (string.IsNullOrWhiteSpace(list[i].WorkOrderNumber))
list[i].WorkOrderNumber = GetPurchaseOrderCode(1);
if (i > 0)
{
list[i].WorkOrderNumber = GetPurchaseOrderCode(i + 1);
}
list[i].AuditStatus = 0;
}
return webResponse.OK();
};
//导入后处理(已经写入到数据库了)
ImportOnExecuted = (List<Ware_ProductionKanban> list) =>
{
return webResponse.OK();
};
return base.Import(files);
}
怎么解决
Metadata
Metadata
Assignees
Labels
No labels