|
|
|
|
@ -12,7 +12,6 @@ import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
|
import org.springblade.desk.dashboard.feign.IPartClient; |
|
|
|
|
import org.springblade.desk.dashboard.pojo.entity.DsPartEntity; |
|
|
|
|
import org.springblade.desk.dashboard.pojo.entity.DsPartRelationEntity; |
|
|
|
|
import org.springblade.desk.order.pojo.entity.YieldOrder; |
|
|
|
|
import org.springblade.desk.produce.pojo.entity.WorkOrder; |
|
|
|
|
import org.springblade.wms.excel.StOtherReceiptRecordExcel; |
|
|
|
|
@ -21,12 +20,10 @@ import org.springblade.wms.pojo.dto.InitStockDTO; |
|
|
|
|
import org.springblade.wms.pojo.entity.*; |
|
|
|
|
import org.springblade.wms.pojo.vo.StOtherReceiptRecordVO; |
|
|
|
|
import org.springblade.wms.service.*; |
|
|
|
|
import org.springblade.wms.wrapper.StOtherReceiptRecordWrapper; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.function.Function; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
@ -289,7 +286,6 @@ public class StOtherReceiptRecordServiceImpl extends BaseServiceImpl<StOtherRece |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public StStockInoutRecord getGlassCakeByWoCode(String woCode, String goodsCode) { |
|
|
|
|
List<StOtherReceiptRecord> list = baseMapper.selectByWoCode(woCode); |
|
|
|
|
|
|
|
|
|
WorkOrder workOrder = baseMapper.getByWoCode(woCode); |
|
|
|
|
if (workOrder == null) { |
|
|
|
|
@ -310,42 +306,17 @@ public class StOtherReceiptRecordServiceImpl extends BaseServiceImpl<StOtherRece |
|
|
|
|
if (partOne == null) { |
|
|
|
|
throw new RuntimeException("根据零件编号【" + workOrder.getPartCode() + "】未查询到零件信息"); |
|
|
|
|
} |
|
|
|
|
List<DsPartRelationEntity> partRelationEntityList = partClient.getSubPart(partOne.getId()); |
|
|
|
|
|
|
|
|
|
List<DsPartEntity> glassCakePartList = new ArrayList<>(); |
|
|
|
|
if (!CollectionUtils.isEmpty(partRelationEntityList)) { |
|
|
|
|
// 步骤1:提取所有非空的childPartId并去重(避免null和重复ID,减少查询压力)
|
|
|
|
|
List<Long> childPartIdList = partRelationEntityList.stream() |
|
|
|
|
.map(DsPartRelationEntity::getChildPartId) // 提取子件ID
|
|
|
|
|
.filter(Objects::nonNull) // 过滤null的ID
|
|
|
|
|
.distinct() // 去重,避免重复查询
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
// 步骤2:批量查询DS_PART表(一次SQL,性能最优)
|
|
|
|
|
if (!CollectionUtils.isEmpty(childPartIdList)) { |
|
|
|
|
// 调用dsPartService的批量查询方法(根据ID列表查DS_PART)
|
|
|
|
|
List<DsPartEntity> allChildPartList = partClient.batchParts(childPartIdList); |
|
|
|
|
|
|
|
|
|
// 步骤3:筛选出IS_CLASS_CAKE为"玻璃饼"的记录(核心过滤)
|
|
|
|
|
if (!CollectionUtils.isEmpty(allChildPartList)) { |
|
|
|
|
glassCakePartList = allChildPartList.stream() |
|
|
|
|
.filter(part -> Boolean.TRUE.equals(part.getIsGlassCake())) |
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
StStockInoutRecord inoutRecord = new StStockInoutRecord(); |
|
|
|
|
if (!CollectionUtils.isEmpty(glassCakePartList)) { |
|
|
|
|
DsPartEntity targetPart = glassCakePartList.stream() |
|
|
|
|
.filter(part -> goodsCode.equals(part.getPartCode())) |
|
|
|
|
.findFirst() |
|
|
|
|
.orElse(null); |
|
|
|
|
|
|
|
|
|
inoutRecord.setPrintMark(Boolean.valueOf(targetPart.getIsPrint())); |
|
|
|
|
inoutRecord.setPowderWeight(String.valueOf(targetPart.getPowderWeight())); |
|
|
|
|
inoutRecord.setMaterialNo(targetPart.getMaterial()); |
|
|
|
|
inoutRecord.setThickness(String.valueOf(targetPart.getFormingThickness())); |
|
|
|
|
if ("1".equals(partOne.getIsGlassCake())) { |
|
|
|
|
if (goodsCode.equals(partOne.getPartCode())) { |
|
|
|
|
inoutRecord.setPrintMark(partOne.getIsPrint()); |
|
|
|
|
inoutRecord.setPowderWeight(String.valueOf(partOne.getPowderWeight())); |
|
|
|
|
inoutRecord.setMaterialNo(partOne.getMaterial()); |
|
|
|
|
inoutRecord.setThickness(String.valueOf(partOne.getFormingThickness())); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
throw new RuntimeException("零件编号【" + workOrder.getPartCode() + "】不是玻璃饼,不允许操作"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(inoutRecord)) { |
|
|
|
|
|