Merge remote-tracking branch 'origin/DM/PBOM-锁定-临时'
This commit is contained in:
commit
44fa650a5b
|
|
@ -12,9 +12,7 @@ import com.google.common.collect.Sets;
|
|||
import com.mzt.logapi.context.LogRecordContext;
|
||||
import com.mzt.logapi.starter.annotation.LogRecord;
|
||||
import com.nflg.product.base.core.api.BaseApi;
|
||||
import com.nflg.product.bomnew.constant.EBomConstant;
|
||||
import com.nflg.product.bomnew.constant.PBomEditStatusEnum;
|
||||
import com.nflg.product.bomnew.constant.PBomStatusEnum;
|
||||
import com.nflg.product.bomnew.constant.*;
|
||||
import com.nflg.product.bomnew.pojo.dto.*;
|
||||
import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
|
||||
|
|
@ -190,10 +188,11 @@ public class PBomApi extends BaseApi {
|
|||
@LogRecord(success = "PBom-编辑-提交,物料编码:{{#bom.materialNo}}-版本:{{#bom.currentVersion}},操作结果:{{#_ret}}", bizNo = "{{#param.bomRowId}}",type = "PBom-编辑-提交")
|
||||
public ResultVO<Boolean> editSubmit(@Valid @RequestBody EditPBomParamDTO param){
|
||||
if (CollUtil.isNotEmpty(param.getChildList())) {
|
||||
//检查物料编码是否存在
|
||||
bomNewPbomParentService.checkMaterialNo(param.getChildList());
|
||||
//检查物料编码是否存在 (排除T项)
|
||||
List<BomNewPbomParentVO> noTBom = param.getChildList().stream().filter(u -> !BomConstant.PROJECT_TYPE_TEMPORARY.equals(u.getProjectType())).collect(Collectors.toList());
|
||||
bomNewPbomParentService.checkMaterialNo(noTBom);
|
||||
//检查物料是否被冻结
|
||||
materialMainService.checkMaterialFreeze(param.getChildList());
|
||||
materialMainService.checkMaterialFreeze(noTBom);
|
||||
}
|
||||
bomNewPbomParentService.editSave(param, PBomEditStatusEnum.HANDLER_FINISHED);
|
||||
return ResultVO.success(true);
|
||||
|
|
@ -491,4 +490,14 @@ public class PBomApi extends BaseApi {
|
|||
};
|
||||
return ResultVO.success(true);
|
||||
}
|
||||
|
||||
@PostMapping("lockOrUnLock")
|
||||
@ApiOperation("PBOM-锁定OR解锁")
|
||||
public ResultVO<Boolean> lock(@RequestBody LockParamDTO paramDTO){
|
||||
VUtils.isTure(CollUtil.isEmpty( paramDTO.getBomRowIds())).throwMessage("请选择要锁定的行");
|
||||
VUtils.isTure(Objects.isNull(paramDTO.getLockState())).throwMessage("锁定状态不能为空");
|
||||
VUtils.isTure(!ImmutableList.of(0,1).contains(paramDTO.getLockState())).throwMessage("锁定状态只能是0或1");
|
||||
bomNewPbomParentService.lock(paramDTO);
|
||||
return ResultVO.success(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.nflg.product.bomnew.mapper.master;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.product.bomnew.pojo.dto.LockParamDTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||
|
|
@ -86,4 +87,6 @@ public interface BomNewPbomParentMapper extends BaseMapper<BomNewPbomParentEntit
|
|||
* @return
|
||||
*/
|
||||
List<String> getPBomExistMaterialInChildForWorkList(@Param("materialNo")String materialNo);
|
||||
|
||||
void lock(@Param("paramDTO")LockParamDTO paramDTO , @Param("lockUserName") String lockUserName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package com.nflg.product.bomnew.pojo.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pbom-锁定参数
|
||||
*/
|
||||
@Data
|
||||
public class LockParamDTO {
|
||||
@ApiModelProperty("pbom-版本行ID")
|
||||
private List<Long> bomRowIds;
|
||||
|
||||
@ApiModelProperty("锁定状态:0-解锁 1-锁定")
|
||||
private Integer lockState; ;
|
||||
}
|
||||
|
|
@ -382,6 +382,18 @@ public class BomNewPbomParentEntity implements Serializable {
|
|||
@ApiModelProperty(value = "异常状态:1=正常、2=冻结/完全弃用异常、3=递归异常、4=数据不完整异常、5=超级物料异常、6=重复异常")
|
||||
private Integer exceptionStatus;
|
||||
|
||||
@TableField(value = "lock_1020_state")
|
||||
@ApiModelProperty(value = "是否锁定(1020),锁定时ebom转直接跳过")
|
||||
private Integer lock1020State;
|
||||
|
||||
@TableField(value = "lock_user_name")
|
||||
@ApiModelProperty(value = "锁定人")
|
||||
private String lockUserName;
|
||||
|
||||
@TableField(value = "lock_time")
|
||||
@ApiModelProperty(value = "锁定时间")
|
||||
private LocalDateTime lockTime;
|
||||
|
||||
private static final long serialVersionUID = -31999878274445137L;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.nflg.product.bomnew.pojo.vo;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.nflg.product.bomnew.util.MyStrUtil;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
|
@ -352,6 +353,17 @@ public class BomNewPbomParentVO extends BaseMaterialVO implements Serializable {
|
|||
@ApiModelProperty(value = "异常状态:1=正常、2=冻结/完全弃用异常、3=递归异常、4=数据不完整异常、5=超级物料异常、6=重复异常 7=物料主数据不存在 8=项目类别为空 9=项目赋值异常(父级物料的项目类型为Q时,子级中不能存在项目类别为Q的物料) 10=项目赋值异常(当父级物料的项目类型为F时,子级中不能存在项目类型为F的物料) 11=未填写变更原因和技术通知单 12=数量需要用户确认 13=项目类型需要用户确认")
|
||||
private Integer exceptionStatus=1;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "是否锁定(1020),锁定时ebom转直接跳过")
|
||||
private Integer lock1020State;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "锁定人")
|
||||
private String lockUserName;
|
||||
|
||||
@ApiModelProperty(value = "锁定时间")
|
||||
private LocalDateTime lockTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -390,6 +390,9 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
&& parentEntity.getStatus() >= PBomStatusEnum.PUBLISH.getValue()) {
|
||||
child.setStatus(PBomStatusEnum.BORROWED_PARTS.getValue());
|
||||
}
|
||||
child.setLock1020State(parentEntity.getLock1020State());
|
||||
child.setLockUserName(parentEntity.getLockUserName());
|
||||
child.setLockTime(parentEntity.getLockTime());
|
||||
} else { //无BOM-版本时 确定版本号
|
||||
//child.setSource(Objects.nonNull(parent) ? parent.getSource() : EBomSourceEnum.FROM_BOM.getValue());
|
||||
child.setBomRowId(0L);
|
||||
|
|
@ -528,9 +531,24 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
List<String> fieldList = Lists.newArrayList("projectType","materialNo","drawingNo","num","unitWeight","remark");
|
||||
childList.forEach(u -> {
|
||||
u.setParentRowId(paramDTO.getBomRowId());
|
||||
if(u.getRowId() == null){
|
||||
if(u.getRowId() == null || u.getRowId()<=0){
|
||||
u.setRowId(IdWorker.getId());
|
||||
u.setSourceStatus(PbomSourceStatusEnum.PBOM.getValue());
|
||||
u.setFacCode(parent.getFacCode());
|
||||
//新增T项
|
||||
if (StrUtil.equals(BomConstant.PROJECT_TYPE_TEMPORARY, u.getProjectType(), true)) {
|
||||
String id = RandomUtil.randomNumbers(9);
|
||||
u.setMaterialNo(BomConstant.PROJECT_TYPE_TEMPORARY + id);
|
||||
u.setDrawingNo(BomConstant.PROJECT_TYPE_TEMPORARY + id);
|
||||
if (StrUtil.isBlank(u.getMaterialUnit())) {
|
||||
u.setMaterialUnit("PC");
|
||||
}
|
||||
if(Objects.isNull(u.getNum())){
|
||||
u.setNum(new BigDecimal(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
BomNewPbomChildEntity oChild = childMap.get(u.getRowId());
|
||||
//判断是否有变更记录
|
||||
|
|
@ -2422,4 +2440,12 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* pbom-锁定
|
||||
* @param paramDTO
|
||||
*/
|
||||
public void lock(LockParamDTO paramDTO){
|
||||
this.getBaseMapper().lock(paramDTO,SessionUtil.getRealName());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,7 +181,9 @@ public abstract class EBomToPbomBase {
|
|||
.eq(BomNewPbomParentEntity::getMaterialNo, parentVo.getMaterialNo())
|
||||
.eq(BomNewPbomParentEntity::getFacCode, facCode).last(" order by current_version desc limit 1").one();
|
||||
|
||||
|
||||
if(EBomConstant.XIAN_TAO_FACTORY_CODE_1020.equals(facCode) && Objects.nonNull(oldParent) && oldParent.getLock1020State()==1){
|
||||
return null;
|
||||
}
|
||||
if (Objects.isNull(oldParent)) {
|
||||
return buildParentEntity(parentVo, facCode, oldParent, StrUtil.isBlank(parentVo.getCurrentVersion())? VersionUtil.getNextVersion(""):parentVo.getCurrentVersion());
|
||||
|
||||
|
|
|
|||
|
|
@ -184,6 +184,9 @@ public abstract class FormalEBomToPbomBase {
|
|||
.eq(BomNewPbomParentEntity::getMaterialNo, parentVo.getMaterialNo())
|
||||
.eq(BomNewPbomParentEntity::getFacCode, facCode).last(" order by current_version desc limit 1").one();
|
||||
|
||||
if(EBomConstant.XIAN_TAO_FACTORY_CODE_1020.equals(facCode) && Objects.nonNull(oldParent) && oldParent.getLock1020State()==1){
|
||||
return null;
|
||||
}
|
||||
|
||||
if (Objects.isNull(oldParent)) {
|
||||
return buildParentEntity(parentVo, facCode, oldParent, StrUtil.isBlank(parentVo.getCurrentVersion())? VersionUtil.getNextVersion(""):parentVo.getCurrentVersion());
|
||||
|
|
|
|||
|
|
@ -50,6 +50,9 @@
|
|||
<result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="ebom_version" property="ebomVersion" jdbcType="VARCHAR"/>
|
||||
<result column="exception_status" property="exceptionStatus" jdbcType="INTEGER"/>
|
||||
<result column="lock_1020_state" property="lock1020State" jdbcType="INTEGER"/>
|
||||
<result column="lock_user_name" property="lockUserName" jdbcType="VARCHAR"/>
|
||||
<result column="lock_time" property="lockTime" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
|
|
@ -59,7 +62,7 @@
|
|||
should_bom_exist, super_material_status, bom_exist, last_version_is, edit_status, status, user_root_is,
|
||||
virtual_package_is, source_row_id, devise_user_code, devise_name,technology_user_code,technology_user_name, created_by, created_time, created_job,
|
||||
release_time, release_user_name,last_convert_mbom_user_name,last_convert_mbom_time, expire_end_time, remark, dept_name, level_num, change_desc, notice_nums,
|
||||
order_no, modify_time,ebom_version,exception_status
|
||||
order_no, modify_time,ebom_version,exception_status,lock_1020_state,lock_user_name,lock_time
|
||||
</sql>
|
||||
|
||||
<sql id="whr">
|
||||
|
|
@ -386,7 +389,12 @@
|
|||
</select>
|
||||
|
||||
|
||||
|
||||
<update id="lock">
|
||||
update t_bom_new_pbom_parent set lock_1020_state=#{paramDTO.lockState} , lock_user_name=#{lockUserName}, lock_time=now() where row_id in
|
||||
<foreach collection="paramDTO.bomRowIds" open="(" close=")" separator="," item="item">
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue