|
@@ -18,6 +18,8 @@ import com.platform.dao.dto.sqarepartmanage.SparePartInfoDTO;
|
|
|
import com.platform.dao.dto.sqarepartmanage.SparePartUsedDTO;
|
|
|
import com.platform.dao.dto.store.StoreDTO;
|
|
|
import com.platform.dao.entity.check.CheckJob;
|
|
|
+import com.platform.dao.entity.firm.FirmProducer;
|
|
|
+import com.platform.dao.entity.sb.SbInfo;
|
|
|
import com.platform.dao.entity.sb.SbModel;
|
|
|
import com.platform.dao.entity.sb.SbModelSpareBom;
|
|
|
import com.platform.dao.entity.sqarepartmanage.SparePartInfo;
|
|
@@ -28,6 +30,7 @@ import com.platform.dao.entity.upms.SysFile;
|
|
|
import com.platform.dao.enums.*;
|
|
|
import com.platform.dao.mapper.check.CheckJobMapper;
|
|
|
import com.platform.dao.mapper.check.CheckStandardSpareMapper;
|
|
|
+import com.platform.dao.mapper.firm.FirmProducerMapper;
|
|
|
import com.platform.dao.mapper.sb.SbInfoMapper;
|
|
|
import com.platform.dao.mapper.sb.SbModelMapper;
|
|
|
import com.platform.dao.mapper.sb.SbModelSpareBomMapper;
|
|
@@ -38,7 +41,10 @@ import com.platform.dao.mapper.store.SpareStoreMapper;
|
|
|
import com.platform.dao.mapper.store.StoreMapper;
|
|
|
import com.platform.dao.mapper.upms.SysFileMapper;
|
|
|
import com.platform.dao.util.CustomExcelImportUtil;
|
|
|
+import com.platform.dao.util.ExcelUtil;
|
|
|
import com.platform.dao.util.MessageTemplateUtil;
|
|
|
+import com.platform.dao.vo.export.sb.ExportSbInfoVO;
|
|
|
+import com.platform.dao.vo.export.sqarepartmanage.ExportSparePartInfoVO;
|
|
|
import com.platform.dao.vo.query.check.CheckStandardSpareVO;
|
|
|
import com.platform.dao.vo.query.sparepartmanage.SparePartInfoVO;
|
|
|
import com.platform.dao.vo.sb.SbInfoVO;
|
|
@@ -92,6 +98,7 @@ public class SparePartInfoServiceImpl extends BaseServiceImpl<SparePartInfoMappe
|
|
|
private CheckJobMapper checkJobMapper;
|
|
|
private CheckStandardSpareMapper checkStandardSpareMapper;
|
|
|
private CheckStandardService checkStandardService;
|
|
|
+ private FirmProducerMapper firmProducerMapper;
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -937,7 +944,41 @@ public class SparePartInfoServiceImpl extends BaseServiceImpl<SparePartInfoMappe
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String importListByAdd(MultipartFile file) {
|
|
|
- int addNum = 0;
|
|
|
+ List<SparePartInfo> spareList = null;
|
|
|
+ List<SpareType> typeList = spareTypeMapper.selectAll();
|
|
|
+ try{
|
|
|
+ List<ExportSparePartInfoVO> list = ExcelUtil.importExcel(file.getInputStream(), ExportSparePartInfoVO.class, 1);
|
|
|
+ if(CollectionUtil.isNotEmpty(list)){
|
|
|
+ spareList = new ArrayList<>();
|
|
|
+ for(ExportSparePartInfoVO importVO : list){
|
|
|
+ SparePartInfo info = BeanConverterUtil.copyObjectProperties(importVO,SparePartInfo.class);
|
|
|
+ // typeName
|
|
|
+ for (SpareType type : typeList) {
|
|
|
+ if (type.getName().equals(info.getTypeName())) {
|
|
|
+ info.setTypeId(type.getId());
|
|
|
+ info.setParentTypeId(type.getParentId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 生产厂商
|
|
|
+ if(StringUtils.isNotBlank(info.getProducerName())){
|
|
|
+ FirmProducer firmProducer = new FirmProducer();
|
|
|
+ firmProducer.setName(info.getProducerName().trim());
|
|
|
+ firmProducer = firmProducerMapper.selectOne(firmProducer);
|
|
|
+ if(firmProducer != null){
|
|
|
+ info.setProducerId(firmProducer.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ info.setId(IdGeneratorUtils.getObjectId());
|
|
|
+ spareList.add(info);
|
|
|
+ }
|
|
|
+ mapper.insertListforComplex(spareList);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new BusinessException(e.getMessage());
|
|
|
+ }
|
|
|
+ return "总计新增导入:" + (spareList.size());
|
|
|
+ /*int addNum = 0;
|
|
|
List<String> modelExist = new ArrayList<String>();
|
|
|
List<SparePartInfoVO> addItems = new ArrayList<SparePartInfoVO>();
|
|
|
List<String> modelError = new ArrayList<String>();
|
|
@@ -971,7 +1012,7 @@ public class SparePartInfoServiceImpl extends BaseServiceImpl<SparePartInfoMappe
|
|
|
item.setTypeId(item.getChildTypeId());
|
|
|
} else {
|
|
|
item.setTypeId(item.getMiddleTypeId());
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
// 设置型号bom
|
|
|
/*boolean findModel = false;
|
|
@@ -1037,7 +1078,7 @@ public class SparePartInfoServiceImpl extends BaseServiceImpl<SparePartInfoMappe
|
|
|
}*/
|
|
|
|
|
|
// 设置库存,还是从库存里面走,但是如果名称一样怎么办,还是需要从这里走
|
|
|
- SpareStore spareStore = new SpareStore();
|
|
|
+ /*SpareStore spareStore = new SpareStore();
|
|
|
spareStore.setSpareId(item.getId());
|
|
|
spareStore.setId(IdGeneratorUtils.getObjectId());
|
|
|
spareStore.setStoreId(item.getStoreId());
|
|
@@ -1059,12 +1100,12 @@ public class SparePartInfoServiceImpl extends BaseServiceImpl<SparePartInfoMappe
|
|
|
addItemsReal = BeanConverterUtil.copyListProperties(addItems, SparePartInfo.class);
|
|
|
mapper.insertListforComplex(addItemsReal);
|
|
|
}
|
|
|
- /* if(!CollectionUtils.isEmpty(addSbModelItems)){
|
|
|
+ *//* if(!CollectionUtils.isEmpty(addSbModelItems)){
|
|
|
sbModelMapper.insertListforComplex(addSbModelItems);
|
|
|
}
|
|
|
if(!CollectionUtils.isEmpty(bomList)){
|
|
|
sbModelSpareBomMapper.insertListforComplex(bomList);
|
|
|
- }*/
|
|
|
+ }*//*
|
|
|
if (!CollectionUtils.isEmpty(spareStoreList)) {
|
|
|
spareStoreMapper.insertListforComplex(spareStoreList);
|
|
|
}
|
|
@@ -1072,7 +1113,7 @@ public class SparePartInfoServiceImpl extends BaseServiceImpl<SparePartInfoMappe
|
|
|
return "总计新增导入:" + (addItems.size());
|
|
|
} catch (Exception e) {
|
|
|
throw new BusinessException(e.getMessage());
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
|
|
|
@Override
|