原始BOM-反查
This commit is contained in:
parent
97c0b32dc3
commit
7baf801d81
|
|
@ -0,0 +1,31 @@
|
|||
package com.nflg.product.bomnew.config;
|
||||
|
||||
|
||||
import cn.hutool.core.thread.ThreadFactoryBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
@Configuration
|
||||
public class TaskPoolConfig {
|
||||
|
||||
|
||||
/**
|
||||
* 原始BOM-同步到正式表线程池
|
||||
* @return
|
||||
*/
|
||||
@Bean("syncOriginalBomToFormalPool")
|
||||
public ThreadPoolTaskExecutor searcherThreadPool() {
|
||||
ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
|
||||
taskExecutor.setCorePoolSize(10);
|
||||
taskExecutor.setMaxPoolSize(20);
|
||||
taskExecutor.setQueueCapacity(2000);
|
||||
taskExecutor.setKeepAliveSeconds(100);
|
||||
taskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
//设置线程池的线程名称,方便日志追踪
|
||||
taskExecutor.setThreadFactory(new ThreadFactoryBuilder().setNamePrefix("plm-searcher-thread-").build());
|
||||
return taskExecutor;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.nflg.product.bomnew.mapper.master;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewOriginalChildEntity;
|
||||
import com.nflg.product.bomnew.pojo.vo.ReverseReportVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -18,5 +19,25 @@ public interface BomNewOriginalChildMapper extends BaseMapper<BomNewOriginalChil
|
|||
|
||||
void delOriginalChildNotInRowIds(@Param("rowIds")List<Long> rowIds ,@Param("parentRowId") Long parentRowId);
|
||||
|
||||
List<Long> selectMaterialParent(@Param("drawingNo") String drawingNo) ;
|
||||
|
||||
|
||||
/**
|
||||
* 原始BOM-反查报表
|
||||
* @param drawingNos
|
||||
* @return
|
||||
*/
|
||||
List<ReverseReportVO> originalReverseReport(@Param("drawingNos") List<String> drawingNos);
|
||||
|
||||
/**
|
||||
* 原始BOM-反查报表
|
||||
* @param drawingNos
|
||||
* @return
|
||||
*/
|
||||
void delOriginalFormalBom(@Param("drawingNos") List<String> drawingNos);
|
||||
|
||||
/**
|
||||
* 原始BOM-同步到正式表
|
||||
* @param rowIds
|
||||
*/
|
||||
void syncOriginalBomToFormal(@Param("rowIds") List<Long> rowIds);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,9 +15,15 @@ import java.util.Objects;
|
|||
@Data
|
||||
public class ReverseReportVO {
|
||||
|
||||
@ApiModelProperty("bom-rowId(parent表)")
|
||||
private Long rowId;
|
||||
|
||||
@ApiModelProperty("层级")
|
||||
private String orderNumber;
|
||||
|
||||
@ApiModelProperty("图号")
|
||||
private String drawingNo;
|
||||
|
||||
@ApiModelProperty("物料编码")
|
||||
private String materialNo;
|
||||
|
||||
|
|
@ -48,6 +54,15 @@ public class ReverseReportVO {
|
|||
@ApiModelProperty(value = "版本过期时间=下个版本的创建时间")
|
||||
private LocalDateTime expireEndTime;
|
||||
|
||||
@ApiModelProperty("是否子级 0-否 1-是")
|
||||
private Integer childIs;
|
||||
|
||||
@ApiModelProperty("父级行ID")
|
||||
private Long parentRowId;
|
||||
|
||||
@ApiModelProperty("子级报表")
|
||||
private String childDrawingNo;
|
||||
|
||||
|
||||
public LocalDateTime getExpireEndTime(){
|
||||
return Objects.isNull(expireEndTime)? LocalDateTime.parse("9999-12-31 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")):expireEndTime;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.apache.commons.collections.map.LinkedMap;
|
||||
import org.bouncycastle.cert.dane.DANEEntry;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
|
@ -83,12 +84,14 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
@Resource
|
||||
BomNewOriginalMaterialUseService originalMaterialUseService;
|
||||
|
||||
@Resource
|
||||
@Qualifier( "syncOriginalBomToFormalPool")
|
||||
ThreadPoolTaskExecutor syncOriginalBomToFormalPool;
|
||||
|
||||
|
||||
|
||||
public Set<String> getParentDrawingNoByMaterialNo(List<String> drawingNos) {
|
||||
List<BomNewOriginalMaterialUseEntity> draringEnts = originalMaterialUseService.lambdaQuery().in(BomNewOriginalMaterialUseEntity::getDrawingNo, drawingNos).list();
|
||||
List<String[]> draringNosList = draringEnts.stream().map(u -> StrUtil.split(u.getParentDrawingNos(), ",") ).collect(Collectors.toList());
|
||||
public Set<String> getParentDrawingNoByMaterialNo(List<String> drawingNos) {
|
||||
List<BomNewOriginalMaterialUseEntity> draringEnts = originalMaterialUseService.lambdaQuery().in(BomNewOriginalMaterialUseEntity::getDrawingNo, drawingNos).list();
|
||||
List<String[]> draringNosList = draringEnts.stream().map(u -> StrUtil.split(u.getParentDrawingNos(), ",")).collect(Collectors.toList());
|
||||
List<String> draringNos = draringNosList.stream().flatMap(Arrays::stream).collect(Collectors.toList());
|
||||
Set<String> result = new HashSet<>();
|
||||
if (CollUtil.isNotEmpty(draringNos)) {
|
||||
|
|
@ -103,7 +106,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
finalRelSkuNo.addAll(Sets.newHashSet(StrUtil.split(k.getParentDrawingNos(), ",")));
|
||||
}
|
||||
});
|
||||
relSkuNo = finalRelSkuNo;
|
||||
relSkuNo = finalRelSkuNo;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
@ -141,10 +144,10 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
* @return 原始BOM列表
|
||||
*/
|
||||
public Page<BomOriginalListVO> getOriginalBomListPage(OriginalBomQuery query) {
|
||||
Page<BomOriginalListVO> result= new Page<>();
|
||||
Page<BomOriginalListVO> result = new Page<>();
|
||||
//物料编码搜索或图号搜索
|
||||
if (CollUtil.isNotEmpty(query.getMaterialNos()) || CollUtil.isNotEmpty(query.getDrawingNos())) {
|
||||
List<String> queryDrawingNos= new ArrayList<>();
|
||||
List<String> queryDrawingNos = new ArrayList<>();
|
||||
queryDrawingNos.addAll(query.getDrawingNos());
|
||||
if (CollUtil.isNotEmpty(query.getMaterialNos())) {
|
||||
List<String> drawingNos = this.getBaseMapper().getDrawingNoByMaterialNos(query.getMaterialNos());
|
||||
|
|
@ -165,7 +168,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
result = handSeachToTree(parents, childs);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
|
||||
result = this.getBaseMapper().getOriginalBomListPage(new Page<>(query.getPage(), query.getPageSize()), query, SessionUtil.getUserCode());
|
||||
materialMainService.intiMaterialInfo(result.getRecords());
|
||||
|
|
@ -174,8 +177,6 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 编辑时-暂存
|
||||
*
|
||||
|
|
@ -408,7 +409,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
originalCadParentService.getBaseMapper().delChildByParentRowIds(delRowIds);
|
||||
}
|
||||
|
||||
return convert.getImportErrorResult();
|
||||
return convert.getImportErrorResult();
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -421,7 +422,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
this.getBaseMapper().updateRootState_1();
|
||||
this.getBaseMapper().updateRootState_2();
|
||||
this.getBaseMapper().updateRootState_3();
|
||||
// this.compucteLevelNum();
|
||||
// this.compucteLevelNum();
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
|
|
@ -494,7 +495,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
public void convertToEBomDo(BomNewOriginalParentEntity parent, Long eBomRowId) throws ExecutionException, InterruptedException {
|
||||
//获取整颗树的BOM
|
||||
List<BomOriginalListVO> bomAllChildList = this.getBomTree(parent.getRowId());
|
||||
|
||||
|
||||
|
||||
BomOriginalListVO parentVO = Convert.convert(BomOriginalListVO.class, parent);
|
||||
parentVO.setEBomRowId(eBomRowId);
|
||||
|
|
@ -513,22 +514,44 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
//将原始BOM及子级转为已处理
|
||||
if (CollUtil.isNotEmpty(convert.getHasHandlerParentIds())) {
|
||||
this.getBaseMapper().updateBomState(OriginalEditStatusEnum.HANDLER_FINISHED.getValue(), OriginalStatusEnum.OVER_CONVERT.getValue(), convert.getHasHandlerParentIds());
|
||||
//原始BOM-同步到历史表
|
||||
CompletableFuture.runAsync(() -> {
|
||||
syncToFormal(convert.getHasHandlerParentIds());
|
||||
},syncOriginalBomToFormalPool );
|
||||
}
|
||||
|
||||
//记录子级BOM版本行ID
|
||||
List<BomNewOriginalChildEntity> originalChildEntities=new ArrayList<>();
|
||||
bomAllChildList.forEach(k->{
|
||||
BomNewOriginalChildEntity entChild=new BomNewOriginalChildEntity();
|
||||
List<BomNewOriginalChildEntity> originalChildEntities = new ArrayList<>();
|
||||
bomAllChildList.forEach(k -> {
|
||||
BomNewOriginalChildEntity entChild = new BomNewOriginalChildEntity();
|
||||
entChild.setRowId(k.getRowId());
|
||||
entChild.setBomVersionRowId(k.getBomRowId());
|
||||
originalChildEntities.add(entChild);
|
||||
});
|
||||
if(CollUtil.isNotEmpty(originalChildEntities)){
|
||||
if (CollUtil.isNotEmpty(originalChildEntities)) {
|
||||
originalChildService.updateBatchById(originalChildEntities);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步到历史正式表(只保留最新版)
|
||||
*/
|
||||
private void syncToFormal(List<Long> parentRowIds) {
|
||||
List<BomNewOriginalParentEntity> originalParents = this.getBaseMapper().selectBatchIds(parentRowIds);
|
||||
|
||||
List<String> drawingNos = originalParents.stream().distinct().map(u -> u.getDrawingNo()).collect(Collectors.toList());
|
||||
|
||||
if (CollUtil.isNotEmpty(drawingNos)) {
|
||||
//删除正式版中已有图号的BOM
|
||||
originalChildService.getBaseMapper().delOriginalFormalBom(drawingNos);
|
||||
//同步新的BOM版本
|
||||
originalChildService.getBaseMapper().syncOriginalBomToFormal(parentRowIds);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static ThreadLocal<Integer> rowNum = new ThreadLocal<>();
|
||||
|
||||
public static ThreadLocal<List<BomNewOriginalExcelDTO>> excelContextTL = new ThreadLocal<>();
|
||||
|
|
@ -558,7 +581,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
List<BomNewOriginalExcelDTO> noMaterialNoList = excelContext.stream().filter(u -> StrUtil.isBlank(u.getMaterialNo())).collect(Collectors.toList());
|
||||
materialMainService.initMaterialForDrawdingNo(noMaterialNoList, BomNewOriginalExcelDTO::getChartNo, BomNewOriginalExcelDTO::setMaterialNo, BomNewOriginalExcelDTO::setMaterialName);
|
||||
|
||||
List<ImportOriginalBomVO> errResult=new ArrayList<>();
|
||||
List<ImportOriginalBomVO> errResult = new ArrayList<>();
|
||||
//转换
|
||||
for (BomNewOriginalExcelDTO data : excelContext) {
|
||||
PlmBomToOriginalConvert convert = new PlmBomToOriginalConvert();
|
||||
|
|
@ -590,7 +613,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
data.setRowNum(rowNum.get());
|
||||
// data.setOrderNo(data.getLevelNo());
|
||||
data.setChartNo(StrUtil.trim(data.getChartNo()).replace("(", "(").replace(")", ")").replace(" ", ""));
|
||||
if(data.getChartNo().equals("无")){
|
||||
if (data.getChartNo().equals("无")) {
|
||||
data.setChartNo("");
|
||||
}
|
||||
rowNum.set(rowNum.get() + 1);
|
||||
|
|
|
|||
|
|
@ -1,18 +1,22 @@
|
|||
package com.nflg.product.bomnew.service.domain.ReverseReport;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.db.sql.SqlBuilder;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.nflg.product.bomnew.constant.ReportConstant;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewOriginalChildEntity;
|
||||
import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomOriginalListVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.ReverseReportVO;
|
||||
import com.nflg.product.bomnew.service.BomNewOriginalChildService;
|
||||
import com.nflg.product.bomnew.service.RedisService;
|
||||
import com.nflg.product.bomnew.util.ListCommonUtil;
|
||||
import lombok.Getter;
|
||||
import org.omg.CORBA.PRIVATE_MEMBER;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -27,36 +31,67 @@ public class OriginalBomQuery {
|
|||
/**
|
||||
* 报表结果
|
||||
*/
|
||||
private List<BomOriginalListVO> reportResult;
|
||||
@Getter
|
||||
private List<ReverseReportVO> reportResult = new ArrayList<>();
|
||||
|
||||
private RedisService redisService= SpringUtil.getBean(RedisService.class);
|
||||
private RedisService redisService = SpringUtil.getBean(RedisService.class);
|
||||
|
||||
private BomNewOriginalChildService originalChildService=SpringUtil.getBean(BomNewOriginalChildService.class);
|
||||
private BomNewOriginalChildService originalChildService = SpringUtil.getBean(BomNewOriginalChildService.class);
|
||||
|
||||
public OriginalBomQuery(ReverseReportQuery inQueryParam){
|
||||
this.queryParam=inQueryParam;
|
||||
public OriginalBomQuery(ReverseReportQuery inQueryParam) {
|
||||
this.queryParam = inQueryParam;
|
||||
}
|
||||
|
||||
|
||||
public void report(){
|
||||
if(queryParam.getQueryType().equals(ReportConstant.QueryTypeEnum.SINGLE.getValue())){
|
||||
public void report() {
|
||||
if (queryParam.getQueryType().equals(ReportConstant.QueryTypeEnum.SINGLE.getValue())) {
|
||||
singleLevelReport();
|
||||
} else {
|
||||
multipleLevelReport(ImmutableList.of(queryParam.getDrawingNo()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 单层报表
|
||||
*/
|
||||
public void singleLevelReport(){
|
||||
List<Long> parentRowIds = originalChildService.getBaseMapper().selectMaterialParent(queryParam.getDrawingNo());
|
||||
|
||||
|
||||
|
||||
public void singleLevelReport() {
|
||||
|
||||
reportResult = originalChildService.getBaseMapper().originalReverseReport(ImmutableList.of(queryParam.getDrawingNo()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
Map<String, List<ReverseReportVO>> resultMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 多层
|
||||
*/
|
||||
public void multipleLevelReport(List<String> drawingNos) {
|
||||
|
||||
List<ReverseReportVO> parentList = originalChildService.getBaseMapper().originalReverseReport(drawingNos);
|
||||
|
||||
if (CollUtil.isNotEmpty(parentList)) {
|
||||
drawingNos.forEach(k -> {
|
||||
List<ReverseReportVO> drawingParents = parentList.stream().filter(u -> u.getChildDrawingNo().equals(k)).collect(Collectors.toList());
|
||||
Map<String, List<ReverseReportVO>> nMap = ListCommonUtil.listGroupMap(drawingParents, ReverseReportVO::getDrawingNo);
|
||||
nMap.keySet().forEach(u->{
|
||||
if(resultMap.containsKey(k)) {
|
||||
nMap.get(u).addAll(resultMap.get(k));
|
||||
}
|
||||
resultMap.put(u, nMap.get(u));
|
||||
});
|
||||
resultMap.remove(k);
|
||||
});
|
||||
List<String> dawNos = parentList.stream().map(u -> u.getDrawingNo()).distinct().collect(Collectors.toList());
|
||||
multipleLevelReport(dawNos);
|
||||
}
|
||||
else {
|
||||
resultMap.forEach((k, v) -> {
|
||||
reportResult.addAll(v);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,47 +1,88 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nflg.product.bomnew.mapper.master.BomNewOriginalChildMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.nflg.product.bomnew.pojo.entity.BomNewOriginalChildEntity">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table t_bom_new_original_child -->
|
||||
<id column="row_id" property="rowId" jdbcType="BIGINT"/>
|
||||
<result column="parent_row_id" property="parentRowId" jdbcType="BIGINT"/>
|
||||
<result column="order_number" property="orderNumber" jdbcType="VARCHAR"/>
|
||||
<result column="drawing_no" property="drawingNo" jdbcType="VARCHAR"/>
|
||||
<result column="material_no" property="materialNo" jdbcType="VARCHAR"/>
|
||||
<result column="material_name" property="materialName" jdbcType="VARCHAR"/>
|
||||
<result column="material_desc" property="materialDesc" jdbcType="VARCHAR"/>
|
||||
<result column="unit_weight" property="unitWeight" jdbcType="DECIMAL"/>
|
||||
<result column="num" property="num" jdbcType="DECIMAL"/>
|
||||
<result column="total_weight" property="totalWeight" jdbcType="DECIMAL"/>
|
||||
<result column="remark" property="remark" jdbcType="VARCHAR"/>
|
||||
<result column="created_by" property="createdBy" jdbcType="VARCHAR"/>
|
||||
<result column="edit_status" property="editStatus" jdbcType="INTEGER"/>
|
||||
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="status" property="status" jdbcType="INTEGER"/>
|
||||
<result column="material_texture" property="materialTexture" jdbcType="VARCHAR"/>
|
||||
<result column="should_bom_exist" property="shouldBomExist" jdbcType="INTEGER"/>
|
||||
<result column="bom_version_row_id" property="bomVersionRowId" jdbcType="BIGINT" />
|
||||
</resultMap>
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table t_bom_new_original_child -->
|
||||
<id column="row_id" property="rowId" jdbcType="BIGINT"/>
|
||||
<result column="parent_row_id" property="parentRowId" jdbcType="BIGINT"/>
|
||||
<result column="order_number" property="orderNumber" jdbcType="VARCHAR"/>
|
||||
<result column="drawing_no" property="drawingNo" jdbcType="VARCHAR"/>
|
||||
<result column="material_no" property="materialNo" jdbcType="VARCHAR"/>
|
||||
<result column="material_name" property="materialName" jdbcType="VARCHAR"/>
|
||||
<result column="material_desc" property="materialDesc" jdbcType="VARCHAR"/>
|
||||
<result column="unit_weight" property="unitWeight" jdbcType="DECIMAL"/>
|
||||
<result column="num" property="num" jdbcType="DECIMAL"/>
|
||||
<result column="total_weight" property="totalWeight" jdbcType="DECIMAL"/>
|
||||
<result column="remark" property="remark" jdbcType="VARCHAR"/>
|
||||
<result column="created_by" property="createdBy" jdbcType="VARCHAR"/>
|
||||
<result column="edit_status" property="editStatus" jdbcType="INTEGER"/>
|
||||
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="status" property="status" jdbcType="INTEGER"/>
|
||||
<result column="material_texture" property="materialTexture" jdbcType="VARCHAR"/>
|
||||
<result column="should_bom_exist" property="shouldBomExist" jdbcType="INTEGER"/>
|
||||
<result column="bom_version_row_id" property="bomVersionRowId" jdbcType="BIGINT"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
row_id, parent_row_id, order_number, drawing_no, material_no, material_name, material_desc, unit_weight, num, total_weight ,remark,created_by,created_time ,edit_status ,material_texture ,should_bom_exist ,bom_version_row_id </sql>
|
||||
row_id, parent_row_id, order_number, drawing_no, material_no, material_name, material_desc, unit_weight, num,
|
||||
total_weight ,remark,created_by,created_time ,edit_status ,material_texture ,should_bom_exist
|
||||
,bom_version_row_id
|
||||
</sql>
|
||||
|
||||
|
||||
<delete id="delOriginalChildNotInRowIds">
|
||||
delete from t_bom_new_original_child where parent_row_id=#{parentRowId} and row_id not in
|
||||
delete from t_bom_new_original_child where parent_row_id=#{parentRowId} and row_id not in
|
||||
<foreach collection="rowIds" item="rowId" open="(" separator="," close=")">
|
||||
#{rowId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
<!--报表反查-->
|
||||
<select id="selectMaterialParent" resultType="java.lang.Long">
|
||||
|
||||
select parent_row_id parent_row_id from t_bom_new_original_child where drawing_no=#{drawingNo} and `status`=2
|
||||
<!--原始BOM-反查-->
|
||||
<select id="originalReverseReport" resultType="com.nflg.product.bomnew.pojo.vo.ReverseReportVO">
|
||||
select b.* , a.drawing_no as childDrawingNo from t_bom_new_original_child_formal a
|
||||
join t_bom_new_original_parent_formal b on a.parent_row_id=b.row_id
|
||||
where
|
||||
a.drawing_no in
|
||||
<foreach collection="drawingNos" item="drawingNo" open="(" separator="," close=")">
|
||||
#{drawingNo}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<!--删除-正式表中已有的BOM-->
|
||||
<delete id="delOriginalFormalBom">
|
||||
delete from t_bom_new_original_child_formal where parent_row_id in
|
||||
( select row_id from t_bom_new_original_parent_formal where drawing_no in
|
||||
<foreach collection="drawingNos" item="drawingNo" open="(" separator="," close=")">
|
||||
#{drawingNo}
|
||||
</foreach>
|
||||
);
|
||||
|
||||
delete from t_bom_new_original_parent_formal where drawing_no in
|
||||
<foreach collection="drawingNos" item="drawingNo" open="(" separator="," close=")">
|
||||
#{drawingNo}
|
||||
</foreach>
|
||||
);
|
||||
</delete>
|
||||
|
||||
<!--原始BOM-同步到正式表-->
|
||||
<insert id="syncOriginalBomToFormal">
|
||||
INSERT INTO `nflg`.`t_bom_new_original_parent_formal` (`row_id`, `batch_no`, `drawing_no`, `material_no`, `material_name`, `material_desc`, `current_version`, `num`, `root_is`, `user_root_is`, `bom_exist`, `should_bom_exist`, `last_version_is`, `material_texture`, `unit_weight`, `total_weight`, `devise_user_code`, `devise_name`, `status`, `edit_status`, `convert_to_ebom_time`, `dept_row_id`, `dept_name`, `source`, `remark`, `created_by`, `created_time`, `expire_end_time`, `level_num`)
|
||||
|
||||
select `row_id`, `batch_no`, `drawing_no`, `material_no`, `material_name`, `material_desc`, `current_version`, `num`, `root_is`, `user_root_is`, `bom_exist`, `should_bom_exist`, `last_version_is`, `material_texture`, `unit_weight`, `total_weight`, `devise_user_code`, `devise_name`, `status`, `edit_status`, `convert_to_ebom_time`, `dept_row_id`, `dept_name`, `source`, `remark`, `created_by`, `created_time`, `expire_end_time`, `level_num`
|
||||
from t_bom_new_original_parent where row_id in
|
||||
<foreach collection="rowIds" item="rowId" open="(" separator="," close=")">
|
||||
#{rowId}
|
||||
</foreach> ;
|
||||
|
||||
INSERT INTO `t_bom_new_original_child_formal` (`row_id`, `parent_row_id`, `order_number`, `drawing_no`, `material_no`, `material_name`, `material_desc`, `unit_weight`, `num`, `total_weight`, `remark`, `created_time`, `created_by`, `edit_status`, `status`, `material_texture`, `should_bom_exist`, `bom_version_row_id`)
|
||||
select `row_id`, `parent_row_id`, `order_number`, `drawing_no`, `material_no`, `material_name`, `material_desc`, `unit_weight`, `num`, `total_weight`, `remark`, `created_time`, `created_by`, `edit_status`, `status`, `material_texture`, `should_bom_exist`, `bom_version_row_id`
|
||||
from t_bom_new_original_child
|
||||
where parent_row_id in
|
||||
<foreach collection="rowIds" item="rowId" open="(" separator="," close=")">
|
||||
#{rowId}
|
||||
</foreach>;
|
||||
</insert>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue