feat: 电气专用bom功能
This commit is contained in:
parent
c220cbe8bd
commit
2154ac2599
|
|
@ -30,6 +30,13 @@ public class BomNewDQbomChildEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "主键-雪花")
|
@ApiModelProperty(value = "主键-雪花")
|
||||||
private Long rowId;
|
private Long rowId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 层次
|
||||||
|
*/
|
||||||
|
@TableField(value = "level")
|
||||||
|
@ApiModelProperty(value = "层次")
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 父行ID
|
* 父行ID
|
||||||
*/
|
*/
|
||||||
|
|
@ -72,6 +79,34 @@ public class BomNewDQbomChildEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "物料编码")
|
@ApiModelProperty(value = "物料编码")
|
||||||
private String materialNo;
|
private String materialNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料名称
|
||||||
|
*/
|
||||||
|
@TableField(value = "material_name")
|
||||||
|
@ApiModelProperty(value = "物料名称")
|
||||||
|
private String materialName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 材质
|
||||||
|
*/
|
||||||
|
@TableField(value = "material_texture")
|
||||||
|
@ApiModelProperty(value = "材质")
|
||||||
|
private String materialTexture;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
@TableField(value = "material_unit")
|
||||||
|
@ApiModelProperty(value = "单位")
|
||||||
|
private String materialUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单重
|
||||||
|
*/
|
||||||
|
@TableField(value = "unit_weight")
|
||||||
|
@ApiModelProperty(value = "单重")
|
||||||
|
private BigDecimal unitWeight;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数量
|
* 数量
|
||||||
*/
|
*/
|
||||||
|
|
@ -101,6 +136,13 @@ public class BomNewDQbomChildEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "异常标记")
|
@ApiModelProperty(value = "异常标记")
|
||||||
private String exceptionTag;
|
private String exceptionTag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号
|
||||||
|
*/
|
||||||
|
@TableField(value = "current_version")
|
||||||
|
@ApiModelProperty(value = "版本号")
|
||||||
|
private String currentVersion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -30,13 +30,6 @@ public class BomNewDQbomParentEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "主键-雪花")
|
@ApiModelProperty(value = "主键-雪花")
|
||||||
private Long rowId;
|
private Long rowId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 层次
|
|
||||||
*/
|
|
||||||
@TableField(value = "level")
|
|
||||||
@ApiModelProperty(value = "层次")
|
|
||||||
private Integer level;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图号
|
* 图号
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
package com.nflg.product.bomnew.pojo.vo;
|
package com.nflg.product.bomnew.pojo.vo;
|
||||||
|
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewDQbomParentEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomNewDQbomChildEntity;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 曹鹏飞
|
* @author 曹鹏飞
|
||||||
|
|
@ -16,17 +16,12 @@ import java.math.BigDecimal;
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@ApiModel(value = "com-nflg-product-bomnew-pojo-new-vo-BomNewDQbomSaveVO")
|
@ApiModel(value = "com-nflg-product-bomnew-pojo-new-vo-BomNewDQbomSaveVO")
|
||||||
public class BomNewDQbomSaveVO extends BomNewDQbomParentEntity implements Serializable {
|
public class BomNewDQbomSaveVO extends BomNewDQbomChildEntity implements Serializable {
|
||||||
|
|
||||||
/**
|
@ApiModelProperty("物料BOM版本ID")
|
||||||
* 排序号
|
private Long bomRowId = 0L;
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "排序号")
|
|
||||||
private String orderNumber;
|
|
||||||
|
|
||||||
/**
|
@NotNull
|
||||||
* 数量
|
@ApiModelProperty("物料bom行ID")
|
||||||
*/
|
private Long childBomRowId;
|
||||||
@ApiModelProperty(value = "数量")
|
|
||||||
private BigDecimal num;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,8 +93,10 @@ public class DQBomService {
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void save(BomNewDQbomSaveQuery query) {
|
public void save(BomNewDQbomSaveQuery query) {
|
||||||
BomNewDQbomParentEntity parent = query.getParent();
|
BomNewDQbomParentEntity parent = query.getParent();
|
||||||
|
BomNewDQbomChildEntity child;
|
||||||
|
|
||||||
List<BomNewDQbomParentEntity> liParents = new ArrayList<>();
|
List<BomNewDQbomParentEntity> liParents = new ArrayList<>();
|
||||||
|
List<BomNewDQbomChildEntity> liChildren = new ArrayList<>();
|
||||||
|
|
||||||
if (Objects.isNull(parent.getRowId())) {
|
if (Objects.isNull(parent.getRowId())) {
|
||||||
//新增父级节点
|
//新增父级节点
|
||||||
|
|
@ -106,7 +108,6 @@ public class DQBomService {
|
||||||
VUtils.isTure(CollUtil.isEmpty(query.getChildren())).throwMessage("新添加的bom必须有子级");
|
VUtils.isTure(CollUtil.isEmpty(query.getChildren())).throwMessage("新添加的bom必须有子级");
|
||||||
|
|
||||||
parent.setRowId(IdWorker.getId());
|
parent.setRowId(IdWorker.getId());
|
||||||
parent.setLevel(1);
|
|
||||||
parent.setBomExist(1);
|
parent.setBomExist(1);
|
||||||
parent.setCreatedBy(SessionUtil.getUserCode());
|
parent.setCreatedBy(SessionUtil.getUserCode());
|
||||||
parent.setStatus(DQBomStatusEnum.WAIT_CONVERT.getValue());
|
parent.setStatus(DQBomStatusEnum.WAIT_CONVERT.getValue());
|
||||||
|
|
@ -131,12 +132,15 @@ public class DQBomService {
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
parent.setBomExist(1);
|
parent.setBomExist(1);
|
||||||
parent.setModifyTime(LocalDateTime.now());
|
parent.setModifyTime(LocalDateTime.now());
|
||||||
|
|
||||||
|
child =
|
||||||
}
|
}
|
||||||
//处理child
|
//处理child
|
||||||
List<BomNewDQbomChildEntity> children = Convert.toList(BomNewDQbomChildEntity.class, query.getChildren());
|
List<BomNewDQbomChildEntity> children = Convert.toList(BomNewDQbomChildEntity.class, query.getChildren());
|
||||||
for (int index = 0, count = children.size(); index < count; index++) {
|
for (int index = 0, count = children.size(); index < count; index++) {
|
||||||
BomNewDQbomChildEntity c = children.get(index);
|
BomNewDQbomChildEntity c = children.get(index);
|
||||||
c.setRowId(IdWorker.getId());
|
c.setRowId(IdWorker.getId());
|
||||||
|
c.setLevel(parent.getLevel() + 1);
|
||||||
c.setParentRowId(parent.getRowId());
|
c.setParentRowId(parent.getRowId());
|
||||||
c.setIdentityNo(c.getParentRowId() + "_" + c.getRowId());
|
c.setIdentityNo(c.getParentRowId() + "_" + c.getRowId());
|
||||||
c.setOrderNumber(StrUtil.padPre(String.valueOf(index + 1), 3, '0'));
|
c.setOrderNumber(StrUtil.padPre(String.valueOf(index + 1), 3, '0'));
|
||||||
|
|
@ -144,7 +148,8 @@ public class DQBomService {
|
||||||
c.setCreatedBy(SessionUtil.getUserCode());
|
c.setCreatedBy(SessionUtil.getUserCode());
|
||||||
c.setCreatedName(SessionUtil.getRealName());
|
c.setCreatedName(SessionUtil.getRealName());
|
||||||
}
|
}
|
||||||
dQBomChildService.saveBatch(children);
|
liChildren.addAll(children);
|
||||||
|
dQBomChildService.saveBatch(liChildren);
|
||||||
//处理parent
|
//处理parent
|
||||||
List<BomNewDQbomParentEntity> parents = Convert.toList(BomNewDQbomParentEntity.class, query.getChildren());
|
List<BomNewDQbomParentEntity> parents = Convert.toList(BomNewDQbomParentEntity.class, query.getChildren());
|
||||||
List<String> materialNos = dQBomParentService.lambdaQuery()
|
List<String> materialNos = dQBomParentService.lambdaQuery()
|
||||||
|
|
@ -162,7 +167,6 @@ public class DQBomService {
|
||||||
p.setRowId(IdWorker.getId());
|
p.setRowId(IdWorker.getId());
|
||||||
p.setCreatedBy(SessionUtil.getUserCode());
|
p.setCreatedBy(SessionUtil.getUserCode());
|
||||||
p.setStatus(DQBomStatusEnum.WAIT_CONVERT.getValue());
|
p.setStatus(DQBomStatusEnum.WAIT_CONVERT.getValue());
|
||||||
p.setLevel(parent.getLevel() + 1);
|
|
||||||
p.setRootIs(0);
|
p.setRootIs(0);
|
||||||
p.setUserRootIs(0);
|
p.setUserRootIs(0);
|
||||||
p.setBomExist(0);
|
p.setBomExist(0);
|
||||||
|
|
|
||||||
|
|
@ -85,16 +85,16 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getChildren" resultType="com.nflg.product.bomnew.pojo.vo.DQbomExcelVO">
|
<select id="getChildren" resultType="com.nflg.product.bomnew.pojo.vo.DQbomExcelVO">
|
||||||
SELECT p.level,
|
SELECT c.level,
|
||||||
p.material_no,
|
c.material_no,
|
||||||
p.drawing_no,
|
c.drawing_no,
|
||||||
p.material_name,
|
c.material_name,
|
||||||
p.material_texture,
|
c.material_texture,
|
||||||
c.num,
|
c.num,
|
||||||
p.material_unit,
|
ifnull(p.material_unit, c.material_unit) material_unit,
|
||||||
c.project_type,
|
c.project_type,
|
||||||
p.current_version,
|
ifnull(p.current_version, c.current_version) current_version,
|
||||||
p.unit_weight,
|
ifnull(p.unit_weight, c.unit_weight) unit_weight,
|
||||||
c.remark
|
c.remark
|
||||||
FROM t_bom_new_dqbom_child c
|
FROM t_bom_new_dqbom_child c
|
||||||
LEFT JOIN t_bom_new_dqbom_parent p ON c.material_no = p.material_no AND c.parent_row_id = 0
|
LEFT JOIN t_bom_new_dqbom_parent p ON c.material_no = p.material_no AND c.parent_row_id = 0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue