|
|
@ -7,14 +7,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.win.framework.common.exception.util.ServiceExceptionUtil; |
|
|
|
import com.win.framework.common.pojo.CustomConditions; |
|
|
|
import com.win.framework.common.pojo.PageResult; |
|
|
|
import com.win.module.eam.controller.item.vo.ItemBaseVO; |
|
|
|
import com.win.module.eam.controller.itemaccounts.vo.*; |
|
|
|
import com.win.module.eam.controller.transaction.vo.TransactionCreateReqVO; |
|
|
|
import com.win.module.eam.convert.itemaccounts.ItemAccountsConvert; |
|
|
|
import com.win.module.eam.dal.dataobject.devicemaintenancejob.DeviceMaintenanceJobMainDO; |
|
|
|
import com.win.module.eam.dal.dataobject.item.ItemDO; |
|
|
|
import com.win.module.eam.dal.dataobject.itemaccounts.ItemAccountsDO; |
|
|
|
import com.win.module.eam.dal.dataobject.iteminlocation.ItemInLocationDO; |
|
|
|
import com.win.module.eam.dal.dataobject.itemlocationreplace.ItemLocationReplaceDO; |
|
|
|
import com.win.module.eam.dal.dataobject.itemnewturnin.ItemNewTurnInDO; |
|
|
|
import com.win.module.eam.dal.dataobject.location.LocationDO; |
|
|
@ -39,6 +36,7 @@ import java.util.ArrayList; |
|
|
|
import java.util.Collection; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
|
|
|
|
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; |
|
|
|
import static com.win.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
|
|
@ -344,14 +342,24 @@ public class ItemAccountsServiceImpl implements ItemAccountsService { |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public List<ItemAccountsImportExcelVO> importItemAccountsList(List<ItemAccountsImportExcelVO> datas, Integer mode, boolean updatePart) { |
|
|
|
public List<ItemAccountsErrorVO> importItemAccountsList(List<ItemAccountsImportExcelVO> datas, Integer mode, boolean updatePart) { |
|
|
|
//备件编号+库位编码+类型唯一
|
|
|
|
if (CollUtil.isEmpty(datas)) { |
|
|
|
throw exception(ITEM_NEW_TURN_IN_IMPORT_LIST_IS_EMPTY);//导入数据不能为空
|
|
|
|
} |
|
|
|
AtomicInteger count = new AtomicInteger(); |
|
|
|
List<TransactionCreateReqVO> list = new ArrayList<>(); |
|
|
|
List<ItemAccountsImportExcelVO> errorList = new ArrayList<>(); |
|
|
|
List<ItemAccountsErrorVO> errorList = new ArrayList<>(); |
|
|
|
datas.forEach(item -> { |
|
|
|
count.getAndIncrement(); |
|
|
|
if(item.getItemNumber()==null|| item.getItemNumber().trim().isEmpty() || item.getLocationNumber()==null|| item.getLocationNumber().trim().isEmpty() || item.getType()==null|| item.getType().trim().isEmpty()){//备件号为空
|
|
|
|
ItemAccountsErrorVO convert = ItemAccountsConvert.INSTANCE.convert(item); |
|
|
|
convert.setImportStatus("失败"); |
|
|
|
convert.setImportRemark("数据为空"); |
|
|
|
convert.setRowNumber(String.valueOf(count)); |
|
|
|
errorList.add(convert); |
|
|
|
return; |
|
|
|
} |
|
|
|
//判断该备件是否在备件基础数据中无则报错
|
|
|
|
QueryWrapper<ItemDO> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("number",item.getItemNumber()); |
|
|
@ -361,6 +369,7 @@ public class ItemAccountsServiceImpl implements ItemAccountsService { |
|
|
|
ItemAccountsErrorVO convert = ItemAccountsConvert.INSTANCE.convert(item); |
|
|
|
convert.setImportStatus("失败"); |
|
|
|
convert.setImportRemark("该备件在基础数据中不存在"); |
|
|
|
convert.setRowNumber(String.valueOf(count)); |
|
|
|
errorList.add(convert); |
|
|
|
return; |
|
|
|
} |
|
|
@ -370,6 +379,7 @@ public class ItemAccountsServiceImpl implements ItemAccountsService { |
|
|
|
ItemAccountsErrorVO convert = ItemAccountsConvert.INSTANCE.convert(item); |
|
|
|
convert.setImportStatus("失败"); |
|
|
|
convert.setImportRemark("该库位在基础数据中不存在"); |
|
|
|
convert.setRowNumber(String.valueOf(count)); |
|
|
|
errorList.add(convert); |
|
|
|
return; |
|
|
|
} |
|
|
@ -379,6 +389,7 @@ public class ItemAccountsServiceImpl implements ItemAccountsService { |
|
|
|
ItemAccountsErrorVO convert = ItemAccountsConvert.INSTANCE.convert(item); |
|
|
|
convert.setImportStatus("失败"); |
|
|
|
convert.setImportRemark("该库位已存在其他类型数据"); |
|
|
|
convert.setRowNumber(String.valueOf(count)); |
|
|
|
errorList.add(convert); |
|
|
|
return; |
|
|
|
} |
|
|
@ -387,6 +398,7 @@ public class ItemAccountsServiceImpl implements ItemAccountsService { |
|
|
|
ItemAccountsErrorVO convert = ItemAccountsConvert.INSTANCE.convert(item); |
|
|
|
convert.setImportStatus("失败"); |
|
|
|
convert.setImportRemark("数据为空"); |
|
|
|
convert.setRowNumber(String.valueOf(count)); |
|
|
|
errorList.add(convert); |
|
|
|
} |
|
|
|
ItemAccountsDO itemAccountsDO = validateItemAndTypeAndLocation(item.getItemNumber(), item.getType(), item.getLocationNumber());//查询重复数据
|
|
|
@ -455,6 +467,7 @@ public class ItemAccountsServiceImpl implements ItemAccountsService { |
|
|
|
ItemAccountsErrorVO convert = ItemAccountsConvert.INSTANCE.convert(item); |
|
|
|
convert.setImportStatus("失败"); |
|
|
|
convert.setImportRemark("数据错误"); |
|
|
|
convert.setRowNumber(String.valueOf(count)); |
|
|
|
errorList.add(convert); |
|
|
|
} |
|
|
|
}); |
|
|
|