导入导出
This commit is contained in:
@@ -27,7 +27,7 @@ namespace DOAN.Service.BZFM.IBZFMService
|
||||
/// </summary>
|
||||
/// <param name="material"></param>
|
||||
/// <returns></returns>
|
||||
ImportResultDto Importmaterial(List<MmMaterial> material);
|
||||
ImportResultDto Importmaterial(List<MmMaterialExcelDto> material);
|
||||
|
||||
public PagedInfo<MmMaterial> SelectMaterialList(MmMaterialQueryDto material, PagerInfo pager);
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace DOAN.Service.BZFM
|
||||
/// </summary>
|
||||
/// <param name="material"></param>
|
||||
/// <returns></returns>
|
||||
public ImportResultDto Importmaterial(List<MmMaterial> material)
|
||||
public ImportResultDto Importmaterial(List<MmMaterialExcelDto> material)
|
||||
{
|
||||
// normalize and set defaults, do not overwrite provided values
|
||||
material.ForEach(x =>
|
||||
@@ -140,13 +140,10 @@ namespace DOAN.Service.BZFM
|
||||
{
|
||||
x.MaterialName = x.MaterialName.Trim();
|
||||
}
|
||||
x.Remark = x.Remark.IsEmpty() ? "数据导入" : x.Remark;
|
||||
x.Description = x.Description.IsEmpty() ? "数据导入" : x.Description;
|
||||
});
|
||||
var x = Context.Storageable(material)
|
||||
.SplitInsert(it => !it.Any())
|
||||
.SplitIgnore(it => it.Item.MaterialCode == GlobalConstant.AdminRole)
|
||||
.SplitError(x => x.Item.MaterialCode.IsEmpty(), "物料编码不能为空")
|
||||
.SplitError(x => !Tools.CheckUserName(x.Item.MaterialCode), "物料编码不符合规范")
|
||||
.WhereColumns(it => new { it.Id, it.MaterialCode })//如果不是主键可以这样实现(多字段it=>new{it.x1,it.x2})
|
||||
.ToStorage();
|
||||
var result = x.AsInsertable.ExecuteCommand();//插入可插入部分;
|
||||
|
||||
Reference in New Issue
Block a user