|
|
@ -24,8 +24,10 @@ import jnpf.permission.entity.UserEntity;
|
|
|
|
import jnpf.service.YysBillMaterialService;
|
|
|
|
import jnpf.service.YysBillMaterialService;
|
|
|
|
import jnpf.service.YysSubsetMaterialService;
|
|
|
|
import jnpf.service.YysSubsetMaterialService;
|
|
|
|
import jnpf.util.*;
|
|
|
|
import jnpf.util.*;
|
|
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
import org.apache.commons.collections4.MapUtils;
|
|
|
|
import org.apache.commons.collections4.MapUtils;
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
@ -46,6 +48,7 @@ import java.util.stream.Collectors;
|
|
|
|
* 日期: 2024-08-08
|
|
|
|
* 日期: 2024-08-08
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Service
|
|
|
|
@Service
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
public class YysBillMaterialServiceImpl extends ServiceImpl<YysBillMaterialMapper, YysBillMaterialEntity> implements YysBillMaterialService {
|
|
|
|
public class YysBillMaterialServiceImpl extends ServiceImpl<YysBillMaterialMapper, YysBillMaterialEntity> implements YysBillMaterialService {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private GeneraterSwapUtil generaterSwapUtil;
|
|
|
|
private GeneraterSwapUtil generaterSwapUtil;
|
|
|
@ -338,12 +341,14 @@ public class YysBillMaterialServiceImpl extends ServiceImpl<YysBillMaterialMappe
|
|
|
|
if (CollectionUtils.isEmpty(query)) {
|
|
|
|
if (CollectionUtils.isEmpty(query)) {
|
|
|
|
return "远程母件物料信息为空";
|
|
|
|
return "远程母件物料信息为空";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
log.info("母件物料信息,{}", query);
|
|
|
|
//过滤出同步过的
|
|
|
|
//过滤出同步过的
|
|
|
|
query = query.stream().filter(obj -> !syncList.contains(obj.getAutoId())).collect(Collectors.toList());
|
|
|
|
query = query.stream().filter(obj -> !syncList.contains(obj.getAutoId())).collect(Collectors.toList());
|
|
|
|
//子件物料
|
|
|
|
//子件物料
|
|
|
|
RowMapper<SyncSubsetMaterial> subMapper = new BeanPropertyRowMapper<>(SyncSubsetMaterial.class);
|
|
|
|
RowMapper<SyncSubsetMaterial> subMapper = new BeanPropertyRowMapper<>(SyncSubsetMaterial.class);
|
|
|
|
String subsetSql = "select * from v_bom_opcomponent_rpt";
|
|
|
|
String subsetSql = "select * from v_bom_opcomponent_rpt";
|
|
|
|
List<SyncSubsetMaterial> subsetMaterials = this.jdbcTemplate.query(subsetSql, subMapper);
|
|
|
|
List<SyncSubsetMaterial> subsetMaterials = this.jdbcTemplate.query(subsetSql, subMapper);
|
|
|
|
|
|
|
|
log.info("子件物料信息,{}", subsetMaterials);
|
|
|
|
Map<String, List<SyncSubsetMaterial>> subsetCollect = Maps.newHashMap();
|
|
|
|
Map<String, List<SyncSubsetMaterial>> subsetCollect = Maps.newHashMap();
|
|
|
|
if (CollectionUtils.isNotEmpty(subsetMaterials)) {
|
|
|
|
if (CollectionUtils.isNotEmpty(subsetMaterials)) {
|
|
|
|
subsetCollect = subsetMaterials.stream().collect(Collectors.groupingBy(SyncSubsetMaterial::getBomId));
|
|
|
|
subsetCollect = subsetMaterials.stream().collect(Collectors.groupingBy(SyncSubsetMaterial::getBomId));
|
|
|
@ -352,6 +357,7 @@ public class YysBillMaterialServiceImpl extends ServiceImpl<YysBillMaterialMappe
|
|
|
|
RowMapper<MaterialInformationSync> materialMapper = new BeanPropertyRowMapper<>(MaterialInformationSync.class);
|
|
|
|
RowMapper<MaterialInformationSync> materialMapper = new BeanPropertyRowMapper<>(MaterialInformationSync.class);
|
|
|
|
String materialSql = "select * from dbo.Inventory";
|
|
|
|
String materialSql = "select * from dbo.Inventory";
|
|
|
|
List<MaterialInformationSync> informationSyncs = this.jdbcTemplate.query(materialSql, materialMapper);
|
|
|
|
List<MaterialInformationSync> informationSyncs = this.jdbcTemplate.query(materialSql, materialMapper);
|
|
|
|
|
|
|
|
log.info("物料表数据,{}", informationSyncs);
|
|
|
|
Map<String, MaterialInformationSync> materialCollect = Maps.newHashMap();
|
|
|
|
Map<String, MaterialInformationSync> materialCollect = Maps.newHashMap();
|
|
|
|
if (CollectionUtils.isNotEmpty(informationSyncs)) {
|
|
|
|
if (CollectionUtils.isNotEmpty(informationSyncs)) {
|
|
|
|
materialCollect = informationSyncs.stream().collect(Collectors.toMap(MaterialInformationSync::getCInvCode, Function.identity()));
|
|
|
|
materialCollect = informationSyncs.stream().collect(Collectors.toMap(MaterialInformationSync::getCInvCode, Function.identity()));
|
|
|
@ -364,7 +370,7 @@ public class YysBillMaterialServiceImpl extends ServiceImpl<YysBillMaterialMappe
|
|
|
|
yysBillMaterialEntity.setPieceId(material.getBomId());
|
|
|
|
yysBillMaterialEntity.setPieceId(material.getBomId());
|
|
|
|
if (MapUtils.isNotEmpty(materialCollect) && materialCollect.containsKey(material.getInvCode())) {
|
|
|
|
if (MapUtils.isNotEmpty(materialCollect) && materialCollect.containsKey(material.getInvCode())) {
|
|
|
|
MaterialInformationSync sync = materialCollect.get(material.getInvCode());
|
|
|
|
MaterialInformationSync sync = materialCollect.get(material.getInvCode());
|
|
|
|
yysBillMaterialEntity.setPieceName(sync.getCInvName());
|
|
|
|
yysBillMaterialEntity.setPieceName(StringUtils.isEmpty(sync.getCInvName()) ? "无" : sync.getCInvName());
|
|
|
|
yysBillMaterialEntity.setModels(sync.getEInvStd());
|
|
|
|
yysBillMaterialEntity.setModels(sync.getEInvStd());
|
|
|
|
yysBillMaterialEntity.setUnit(sync.getCComUnitCode());
|
|
|
|
yysBillMaterialEntity.setUnit(sync.getCComUnitCode());
|
|
|
|
}
|
|
|
|
}
|
|
|
|