原始BOM列表
This commit is contained in:
parent
3c889a00dc
commit
4559cef867
|
|
@ -72,12 +72,13 @@ public class OriginalBomApi extends BaseApi {
|
||||||
|
|
||||||
public ResultVO<Boolean> pullFromPlm() {
|
public ResultVO<Boolean> pullFromPlm() {
|
||||||
|
|
||||||
originalParentService.pullFromPlm(SessionUtil.getUserCode());
|
originalParentService.pullFromPlm("QHI17062100");
|
||||||
|
|
||||||
//计算树的层级数
|
//计算树的层级数
|
||||||
CompletableFuture.runAsync(()->{
|
CompletableFuture.runAsync(()->{
|
||||||
try {
|
try {
|
||||||
originalParentService.compucteLevelNum();
|
originalParentService.compucteLevelNum();
|
||||||
|
originalParentService.getBaseMapper().updateRootState();
|
||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ import java.util.List;
|
||||||
public interface BomNewOriginalParentMapper extends BaseMapper<BomNewOriginalParentEntity> {
|
public interface BomNewOriginalParentMapper extends BaseMapper<BomNewOriginalParentEntity> {
|
||||||
|
|
||||||
|
|
||||||
Page<BomOriginalListVO> getOriginalBomListPage(Page<BomOriginalListVO> page, @Param("query")OriginalBomQuery query);
|
Page<BomOriginalListVO> getOriginalBomListPage(Page<BomOriginalListVO> page, @Param("query")OriginalBomQuery query ,@Param("userCode") String userCode);
|
||||||
|
|
||||||
List<BomOriginalListVO> getParentChild(@Param("rowId") Long rowId);
|
List<BomOriginalListVO> getParentChild(@Param("rowId") Long rowId);
|
||||||
|
|
||||||
|
|
@ -29,4 +29,9 @@ public interface BomNewOriginalParentMapper extends BaseMapper<BomNewOriginalPar
|
||||||
void delBatch(@Param("rowIds") List<Long> rowIds);
|
void delBatch(@Param("rowIds") List<Long> rowIds);
|
||||||
|
|
||||||
void updateBomState(@Param("status") Integer status ,@Param("rowIds") List<Long> rowIds);
|
void updateBomState(@Param("status") Integer status ,@Param("rowIds") List<Long> rowIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新是否根节点状态
|
||||||
|
*/
|
||||||
|
void updateRootState();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,10 @@ public class BomNewOriginalChildEntity implements Serializable {
|
||||||
@ApiModelProperty("备注")
|
@ApiModelProperty("备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
@TableField(value = "created_by")
|
||||||
|
@ApiModelProperty("创建人")
|
||||||
|
private String createdBy;
|
||||||
|
|
||||||
public BigDecimal getTotalWeight() {
|
public BigDecimal getTotalWeight() {
|
||||||
return NumberUtil.mul(this.getUnitWeight(), this.num);
|
return NumberUtil.mul(this.getUnitWeight(), this.num);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
||||||
* @return 原始BOM列表
|
* @return 原始BOM列表
|
||||||
*/
|
*/
|
||||||
public Page<BomOriginalListVO> getOriginalBomListPage(OriginalBomQuery query) {
|
public Page<BomOriginalListVO> getOriginalBomListPage(OriginalBomQuery query) {
|
||||||
return this.getBaseMapper().getOriginalBomListPage(new Page<>(query.getPage(), query.getPageSize()), query);
|
return this.getBaseMapper().getOriginalBomListPage(new Page<>(query.getPage(), query.getPageSize()), query,SessionUtil.getUserCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,7 @@ public abstract class BaseConvert {
|
||||||
childEntity.setMaterialDesc(material.getMaterialDesc());
|
childEntity.setMaterialDesc(material.getMaterialDesc());
|
||||||
childEntity.setUnitWeight(material.getWeight());
|
childEntity.setUnitWeight(material.getWeight());
|
||||||
childEntity.setNum(Convert.toBigDecimal(material.getQty()) );
|
childEntity.setNum(Convert.toBigDecimal(material.getQty()) );
|
||||||
|
childEntity.setCreatedBy(parent.getCreatedBy());
|
||||||
this.resultChild.add(childEntity);
|
this.resultChild.add(childEntity);
|
||||||
return childEntity;
|
return childEntity;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,8 @@ public class PlmBomToOriginalConvert extends BaseConvert {
|
||||||
// BOM结构不相同
|
// BOM结构不相同
|
||||||
if (!isSame(getBomChild(originalBom.getRowId()), Convert.toList(BomNewOriginalChildEntity.class, childs))) {
|
if (!isSame(getBomChild(originalBom.getRowId()), Convert.toList(BomNewOriginalChildEntity.class, childs))) {
|
||||||
BomNewOriginalParentEntity parentEntity = buildParentEntity(parent, originalBom.getCurrentVersion());
|
BomNewOriginalParentEntity parentEntity = buildParentEntity(parent, originalBom.getCurrentVersion());
|
||||||
|
originalBom.setLastVersionIs(0);
|
||||||
|
this.resultParent.add(originalBom);
|
||||||
handlerChild(parentEntity);
|
handlerChild(parentEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,12 @@
|
||||||
<result column="num" property="num" jdbcType="DECIMAL"/>
|
<result column="num" property="num" jdbcType="DECIMAL"/>
|
||||||
<result column="total_weight" property="totalWeight" jdbcType="DECIMAL"/>
|
<result column="total_weight" property="totalWeight" jdbcType="DECIMAL"/>
|
||||||
<result column="remark" property="remark" jdbcType="VARCHAR"/>
|
<result column="remark" property="remark" jdbcType="VARCHAR"/>
|
||||||
|
<result column="created_by" property="createdBy" jdbcType="VARCHAR"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
row_id, parent_row_id, order_number, drawing_no, material_no, material_name, material_desc, unit_weight, num, total_weight </sql>
|
row_id, parent_row_id, order_number, drawing_no, material_no, material_name, material_desc, unit_weight, num, total_weight ,remark,created_by </sql>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
<select id="getOriginalBomListPage" resultType="com.nflg.product.bomnew.pojo.vo.BomOriginalListVO">
|
<select id="getOriginalBomListPage" resultType="com.nflg.product.bomnew.pojo.vo.BomOriginalListVO">
|
||||||
select * , 0 as parentRowId , row_id as bomRowId
|
select * , 0 as parentRowId , row_id as bomRowId
|
||||||
from t_bom_new_original_parent
|
from t_bom_new_original_parent
|
||||||
where (root_is | user_root_is) = 1
|
where (root_is =1 or ( user_root_is=1 and created_by=#{userCode}) )
|
||||||
<include refid="whr"/>
|
<include refid="whr"/>
|
||||||
order by user_root_is desc
|
order by user_root_is desc
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -111,5 +111,21 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="updateRootState">
|
||||||
|
update t_bom_new_original_parent a join (
|
||||||
|
select a.row_id from t_bom_new_original_parent a
|
||||||
|
left join t_bom_new_original_child b
|
||||||
|
on a.drawing_no=b.drawing_no
|
||||||
|
where a.last_version_is=1 and b.row_id is null ) t on a.row_id=t.row_id set a.root_is=1;
|
||||||
|
|
||||||
|
|
||||||
|
update t_bom_new_original_parent a join (
|
||||||
|
select a.row_id from t_bom_new_original_parent a
|
||||||
|
left join t_bom_new_original_child b
|
||||||
|
on a.drawing_no=b.drawing_no and a.created_by=b.created_by
|
||||||
|
where a.last_version_is=1 and b.row_id is null ) t on a.row_id=t.row_id set a.user_root_is=1;
|
||||||
|
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue