|
|
@ -28,6 +28,7 @@ import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
@ -247,25 +248,62 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService {
|
|
|
|
|
|
|
|
|
|
|
|
List<MesPullingOrderPartInfo> resultList = mesPullingOrderPartInfoRepository.findByHqlWherePage(packBean, pager);
|
|
|
|
List<MesPullingOrderPartInfo> resultList = mesPullingOrderPartInfoRepository.findByHqlWherePage(packBean, pager);
|
|
|
|
if (!CollectionUtils.isEmpty(resultList)) {
|
|
|
|
if (!CollectionUtils.isEmpty(resultList)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, List<MesPartPullDetail>> pullCodePartMap = null;
|
|
|
|
|
|
|
|
List<MesPullingOrderInfo> pullingOrderInfoList = null;
|
|
|
|
|
|
|
|
Map<String, List<MesPullingOrderInfo>> pullingOrderInfoMap = null;
|
|
|
|
|
|
|
|
Map<String, List<MesCustomerCarModel>> customerCarModelMap = null;
|
|
|
|
|
|
|
|
|
|
|
|
//查拉动单明细对应的拉动组规则
|
|
|
|
//查拉动单明细对应的拉动组规则
|
|
|
|
DdlPackBean packBeanDetail = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
List list = (resultList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getPullCode()))).map(MesPullingOrderPartInfo::getPullCode).collect(Collectors.toList())).stream().filter(o -> !StringUtils.isEmpty(o)).distinct().collect(Collectors.toList());
|
|
|
|
DdlPreparedPack.getInPackList(resultList.stream().map(MesPullingOrderPartInfo::getPullCode).collect(Collectors.toList()), "pullCode", packBeanDetail);
|
|
|
|
if (!CollectionUtils.isEmpty(list)) {
|
|
|
|
List<MesPartPullDetail> mesPartPullDetails = mesPartPullDetailRDao.findByHqlWhere(packBeanDetail);
|
|
|
|
DdlPackBean packBeanDetail = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
if (!CollectionUtils.isEmpty(mesPartPullDetails)) {
|
|
|
|
DdlPreparedPack.getInPackList(list, "pullCode", packBeanDetail);
|
|
|
|
Map<String, List<MesPartPullDetail>> pullCodePartMap = mesPartPullDetails.stream().collect(Collectors.groupingBy(a -> a.getPullCode() + "=" + a.getPartNo()));
|
|
|
|
List<MesPartPullDetail> mesPartPullDetails = mesPartPullDetailRDao.findByHqlWhere(packBeanDetail);
|
|
|
|
for (MesPullingOrderPartInfo partInfo : resultList) {
|
|
|
|
pullCodePartMap = CollectionUtils.isEmpty(mesPartPullDetails) ? null :
|
|
|
|
if (!CollectionUtils.isEmpty(pullCodePartMap.get(partInfo.getPullCode() + "=" + partInfo.getPartNo()))) {
|
|
|
|
mesPartPullDetails.stream().filter(o -> null != o).collect(Collectors.groupingBy(o -> new StringJoiner(MesPcnExtConstWords.AND).add(o.getPullCode()).add(o.getPartNo()).toString()));
|
|
|
|
MesPartPullDetail mesPartPullDetail = pullCodePartMap.get(partInfo.getPullCode() + "=" + partInfo.getPartNo()).get(0);
|
|
|
|
}
|
|
|
|
partInfo.setScanValidationType(StringUtil.isEmpty(mesPartPullDetail.getScanValidationType()) ? 10 : mesPartPullDetail.getScanValidationType());
|
|
|
|
|
|
|
|
partInfo.setRuleValidation(StringUtil.isEmpty(mesPartPullDetail.getRuleValidation()) ? "" : mesPartPullDetail.getRuleValidation());
|
|
|
|
list = resultList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getPullingOrderNo()))).map(MesPullingOrderPartInfo::getPullingOrderNo).collect(Collectors.toList());
|
|
|
|
if (Objects.isNull(mesPartPullDetail.getScanValidationType()) || mesPartPullDetail.getScanValidationType() == MesExtEnumUtil.PART_PULL_DETAIL_SCAN_VALIDATION_TYPE.UN_VALIDATE.getValue()) {
|
|
|
|
if (!CollectionUtils.isEmpty(list)) {
|
|
|
|
partInfo.setColor(MesExtEnumUtil.PART_PULL_DETAIL_COLOR.WHITE.getCode());
|
|
|
|
packBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
} else if (partInfo.getColor() == MesExtEnumUtil.PART_PULL_DETAIL_COLOR.WHITE.getCode()) {
|
|
|
|
DdlPreparedPack.getInPackList(list, "pullingOrderNo", packBean);
|
|
|
|
partInfo.setColor(MesExtEnumUtil.PART_PULL_DETAIL_COLOR.RED.getCode());
|
|
|
|
pullingOrderInfoList = mesPullingOrderInfoRepository.findByHqlWhere(packBean);
|
|
|
|
}
|
|
|
|
pullingOrderInfoMap = CollectionUtils.isEmpty(pullingOrderInfoList) ? null :
|
|
|
|
|
|
|
|
pullingOrderInfoList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesPullingOrderInfo::getPullingOrderNo));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(pullingOrderInfoList)) {
|
|
|
|
|
|
|
|
list = (pullingOrderInfoList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getCarModelCode()))).map(MesPullingOrderInfo::getCarModelCode).collect(Collectors.toList())).stream().filter(o -> !StringUtils.isEmpty(o)).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
packBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
|
|
|
|
DdlPreparedPack.getInPackList(list, MesPcnExtConstWords.CAR_MODEL_CODE, packBean);
|
|
|
|
|
|
|
|
List<MesCustomerCarModel> customerCarModelList = carModelRepository.findByHqlWhere(packBean);
|
|
|
|
|
|
|
|
customerCarModelMap = CollectionUtils.isEmpty(customerCarModelList) ? null :
|
|
|
|
|
|
|
|
customerCarModelList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesCustomerCarModel::getCarModelCode));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String key;
|
|
|
|
|
|
|
|
for (MesPullingOrderPartInfo partInfo : resultList) {
|
|
|
|
|
|
|
|
key = new StringJoiner(MesPcnExtConstWords.AND).add(partInfo.getPullCode()).add(partInfo.getPartNo()).toString();
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(pullCodePartMap) && pullCodePartMap.containsKey(key)) {
|
|
|
|
|
|
|
|
MesPartPullDetail mesPartPullDetail = pullCodePartMap.get(key).get(0);
|
|
|
|
|
|
|
|
partInfo.setScanValidationType(StringUtil.isEmpty(mesPartPullDetail.getScanValidationType()) ? 10 : mesPartPullDetail.getScanValidationType());
|
|
|
|
|
|
|
|
partInfo.setRuleValidation(StringUtil.isEmpty(mesPartPullDetail.getRuleValidation()) ? MesPcnExtConstWords.EMPTY : mesPartPullDetail.getRuleValidation());
|
|
|
|
|
|
|
|
if (Objects.isNull(mesPartPullDetail.getScanValidationType()) || mesPartPullDetail.getScanValidationType().compareTo(MesExtEnumUtil.PART_PULL_DETAIL_SCAN_VALIDATION_TYPE.UN_VALIDATE.getValue()) == 0) {
|
|
|
|
|
|
|
|
partInfo.setColor(MesExtEnumUtil.PART_PULL_DETAIL_COLOR.WHITE.getCode());
|
|
|
|
|
|
|
|
} else if (partInfo.getColor() == MesExtEnumUtil.PART_PULL_DETAIL_COLOR.WHITE.getCode()) {
|
|
|
|
|
|
|
|
partInfo.setColor(MesExtEnumUtil.PART_PULL_DETAIL_COLOR.RED.getCode());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(pullingOrderInfoMap) && pullingOrderInfoMap.containsKey(partInfo.getPullingOrderNo())) {
|
|
|
|
|
|
|
|
partInfo.setCarModelCode(pullingOrderInfoMap.get(partInfo.getPullingOrderNo()).get(0).getCarModelCode());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(partInfo.getCarModelCode()) && !CollectionUtils.isEmpty(customerCarModelMap) && customerCarModelMap.containsKey(partInfo.getCarModelCode())) {
|
|
|
|
|
|
|
|
partInfo.setCarModelName(customerCarModelMap.get(partInfo.getCarModelCode()).get(0).getCarModelName());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return new ListPager<>(resultList, pager);
|
|
|
|
return new ListPager<>(resultList, pager);
|
|
|
|
}
|
|
|
|
}
|
|
|
|