Merge branch 'refs/heads/feature/DM/nflg-bom-dq' into dev
This commit is contained in:
commit
58f062e8bf
|
|
@ -7,13 +7,11 @@ import com.google.common.collect.ImmutableList;
|
|||
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.pojo.query.BomExceptionQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.BomNewDQbomPageQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.BomNewDQbomQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.BomNewDQbomSaveQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomDQbomEditDetailVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewDQbomVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.DQbomExcelVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.*;
|
||||
import com.nflg.product.bomnew.service.DQBomImportService;
|
||||
import com.nflg.product.bomnew.service.DQBomService;
|
||||
import com.nflg.product.bomnew.util.EecExcelUtil;
|
||||
|
|
@ -227,4 +225,15 @@ public class DQBomApi extends BaseApi {
|
|||
public ResultVO<BomDQbomEditDetailVO> editDetail(@Valid @RequestParam("rowId") @NotNull Long rowId, @Valid @RequestParam("bomRowId") @NotNull Long bomRowId) {
|
||||
return ResultVO.success(dQBomService.editDetail(rowId, bomRowId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取节点异常状态
|
||||
* @param query query
|
||||
* @return 节点异常状态
|
||||
*/
|
||||
@PostMapping("getBomException")
|
||||
@ApiOperation("获取节点异常状态")
|
||||
public ResultVO<List<BomExceptionVO>> getBomException(@Valid @RequestBody @NotEmpty List<BomExceptionQuery> query) {
|
||||
return ResultVO.success(dQBomService.getBomException(query));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
package com.nflg.product.bomnew.pojo.query;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author 曹鹏飞
|
||||
* @date 2024/4/24 14:24:21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "com-nflg-product-bomnew-pojo-new-query-BomExceptionQuery")
|
||||
public class BomExceptionQuery implements Serializable {
|
||||
|
||||
/**
|
||||
* bomRowId
|
||||
*/
|
||||
@ApiModelProperty(value = "bomRowId", required = true)
|
||||
@NotNull
|
||||
protected Long bomRowId;
|
||||
|
||||
/**
|
||||
* rowId
|
||||
*/
|
||||
@ApiModelProperty(value = "rowId", required = true)
|
||||
@NotNull
|
||||
protected Long rowId;
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.nflg.product.bomnew.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author 曹鹏飞
|
||||
* @date 2024/4/24 13:32:57
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "com-nflg-product-bomnew-pojo-new-vo-BomExceptionVO")
|
||||
public class BomExceptionVO implements Serializable {
|
||||
|
||||
/**
|
||||
* bom行编号
|
||||
*/
|
||||
@ApiModelProperty(value = "bom行编号")
|
||||
public Long bomRowId;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
@ApiModelProperty(value = "物料编码")
|
||||
public String materialNo;
|
||||
|
||||
/**
|
||||
* 异常状态
|
||||
* @see com.nflg.product.bomnew.constant.EBomExceptionStatusEnum
|
||||
*/
|
||||
@ApiModelProperty(value = "异常状态")
|
||||
private Integer exceptionStatus = -1;
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.nflg.product.bomnew.service;
|
|||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
|
|
@ -144,7 +145,7 @@ public class DQBomImportService {
|
|||
//BomNewDQbomParentEntity oldParent = dQBomParentService.getLatestByMaterialNo(parent.getMaterialNo());
|
||||
boolean isSame = true;
|
||||
if (Objects.isNull(oldParent)) {
|
||||
return isSame;
|
||||
return false;
|
||||
}
|
||||
isSame = Objects.equals(parent.getMaterialUnit(), oldParent.getMaterialUnit())
|
||||
&& NumberUtil.equals(parent.getNum(), oldParent.getNum())
|
||||
|
|
@ -182,14 +183,14 @@ public class DQBomImportService {
|
|||
log.debug("checkInconsistentData,entity:" + JsonUtil.toJson(child));
|
||||
List<BomNewDQbomVO> oldChildren = dQBomChildService.getBom(parentRowId, child.getMaterialNo());
|
||||
boolean isSame = true;
|
||||
if (CollUtil.isEmpty(oldChildren)) return isSame;
|
||||
if (CollUtil.isEmpty(oldChildren)) return false;
|
||||
BomNewDQbomVO oldChild;
|
||||
if (oldChildren.size() == 1) {
|
||||
oldChild = oldChildren.get(0);
|
||||
} else {
|
||||
oldChild = oldChildren.stream().filter(c -> Objects.equals(c.getOrderNumber(), child.getOrderNumber())).findFirst().orElse(null);
|
||||
if (Objects.isNull(oldChild)) {
|
||||
return isSame;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
isSame = Objects.equals(child.getMaterialUnit(), oldChild.getMaterialUnit())
|
||||
|
|
@ -370,7 +371,7 @@ public class DQBomImportService {
|
|||
|
||||
dQbomExcelVO.setRowNum(rowNum.get());
|
||||
if (dQbomExcelVO.getProjectType().equals("T")) {
|
||||
long id = System.currentTimeMillis();
|
||||
String id = RandomUtil.randomNumbers(9);
|
||||
dQbomExcelVO.setMaterialNo(BomConstant.NO_TEMPORARY_PREFIX + id);
|
||||
dQbomExcelVO.setDrawingNo(BomConstant.NO_TEMPORARY_PREFIX + id);
|
||||
if (StrUtil.isBlank(dQbomExcelVO.getMaterialUnit())) {
|
||||
|
|
|
|||
|
|
@ -20,13 +20,11 @@ import com.nflg.product.bomnew.pojo.entity.BomNewDQbomChildEntity;
|
|||
import com.nflg.product.bomnew.pojo.entity.BomNewDQbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.query.BomExceptionQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.BomNewDQbomPageQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.BomNewDQbomQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.BomNewDQbomSaveQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomDQbomEditDetailVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewDQbomVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.DQbomExcelVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.*;
|
||||
import com.nflg.product.bomnew.util.BomUtil;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import com.nflg.product.bomnew.util.VersionUtil;
|
||||
|
|
@ -252,15 +250,17 @@ public class DQBomService {
|
|||
//修改数据
|
||||
// VUtils.isTure(!SessionUtil.getUserCode().equals(parent.getCreatedBy())).throwMessage("不能修改他人的数据");
|
||||
|
||||
if (CollUtil.isEmpty(query.getChildren())) {
|
||||
dQBomChildService.deleteAllChildren(parent.getRowId());
|
||||
return query;
|
||||
}
|
||||
//删除
|
||||
dQBomChildService.deleteAllChildren(parent.getRowId());
|
||||
parent.setBomExist(1);
|
||||
parent.setModifyTime(LocalDateTime.now());
|
||||
dQBomParentService.updateById(parent);
|
||||
if (CollUtil.isEmpty(query.getChildren())) {
|
||||
//dQBomChildService.deleteAllChildren(parent.getRowId());
|
||||
parent.setBomExist(0);
|
||||
dQBomParentService.saveOrUpdate(parent);
|
||||
return query;
|
||||
}
|
||||
parent.setBomExist(1);
|
||||
dQBomParentService.saveOrUpdate(parent);
|
||||
}
|
||||
//处理child
|
||||
List<BomNewDQbomChildEntity> children = Convert.toList(BomNewDQbomChildEntity.class, query.getChildren());
|
||||
|
|
@ -270,6 +270,9 @@ public class DQBomService {
|
|||
c.setRowId(IdWorker.getId());
|
||||
c.setCreatedBy(SessionUtil.getUserCode());
|
||||
c.setCreatedName(SessionUtil.getRealName());
|
||||
String id = RandomUtil.randomNumbers(9);
|
||||
c.setMaterialNo(BomConstant.NO_TEMPORARY_PREFIX + id);
|
||||
c.setDrawingNo(BomConstant.NO_TEMPORARY_PREFIX + id);
|
||||
} else {
|
||||
c.setModifyTime(LocalDateTime.now());
|
||||
}
|
||||
|
|
@ -397,15 +400,23 @@ public class DQBomService {
|
|||
}
|
||||
|
||||
public BomDQbomEditDetailVO editDetail(Long rowId, Long bomRowId) {
|
||||
VUtils.isTure(Objects.isNull(rowId) && Objects.isNull(bomRowId)).throwMessage("无效的数据");
|
||||
|
||||
BomDQbomEditDetailVO vo = new BomDQbomEditDetailVO();
|
||||
BomNewDQbomParentEntity parent = dQBomParentService.getById(bomRowId);
|
||||
BomNewDQbomChildEntity child = dQBomChildService.getById(rowId);
|
||||
VUtils.isTure(Objects.isNull(parent) && Objects.isNull(child)).throwMessage("无效的数据");
|
||||
if (!Objects.isNull(parent)) {
|
||||
if (bomRowId == 0) {
|
||||
BomNewDQbomChildEntity child = dQBomChildService.getById(rowId);
|
||||
BomNewDQbomVO p = Convert.convert(BomNewDQbomVO.class, child);
|
||||
p.setRootIs(0);
|
||||
p.setUserRootIs(0);
|
||||
p.setRowId(IdWorker.getId());
|
||||
p.setCreatedTime(LocalDateTime.now());
|
||||
p.setCreatedBy(SessionUtil.getUserCode());
|
||||
p.setModifyTime(null);
|
||||
vo.setParent(p);
|
||||
} else {
|
||||
BomNewDQbomParentEntity parent = dQBomParentService.getById(bomRowId);
|
||||
vo.setParent(Convert.convert(BomNewDQbomVO.class, parent));
|
||||
vo.setDatas(getChild(bomRowId));
|
||||
} else if (!Objects.isNull(child)) {
|
||||
vo.setParent(Convert.convert(BomNewDQbomVO.class, child));
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
|
@ -571,4 +582,34 @@ public class DQBomService {
|
|||
if (StrUtil.isBlank(version2)) return -1;
|
||||
return Integer.parseInt(version1.substring(1)) - Integer.parseInt(version2.substring(1));
|
||||
}
|
||||
|
||||
public List<BomExceptionVO> getBomException(List<BomExceptionQuery> query) {
|
||||
List<BomExceptionVO> datas = new ArrayList<>();
|
||||
for (int index = 0, count = query.size(); index < count; index++) {
|
||||
BomExceptionQuery bom = query.get(index);
|
||||
if (index == 0) {
|
||||
checkException(bom.getBomRowId());
|
||||
|
||||
BomNewDQbomParentEntity parent = dQBomParentService.getById(bom.getBomRowId());
|
||||
BomExceptionVO vo = new BomExceptionVO();
|
||||
vo.setBomRowId(bom.getBomRowId());
|
||||
vo.setMaterialNo(parent.getMaterialNo());
|
||||
vo.setExceptionStatus(parent.getExceptionStatus());
|
||||
datas.add(vo);
|
||||
} else {
|
||||
BomExceptionVO vo = new BomExceptionVO();
|
||||
vo.setBomRowId(bom.getBomRowId());
|
||||
BomNewDQbomChildEntity child = dQBomChildService.getById(bom.getRowId());
|
||||
vo.setMaterialNo(child.getMaterialNo());
|
||||
if (Objects.equals(child.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())) {
|
||||
BomNewDQbomParentEntity parent = dQBomParentService.getById(bom.getBomRowId());
|
||||
vo.setExceptionStatus(parent.getExceptionStatus());
|
||||
} else {
|
||||
vo.setExceptionStatus(child.getExceptionStatus());
|
||||
}
|
||||
}
|
||||
}
|
||||
return datas;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
<!--分页获取数据-->
|
||||
<select id="getPageList" resultType="com.nflg.product.bomnew.pojo.vo.BomNewDQbomVO">
|
||||
SELECT
|
||||
ifnull(c.row_id,p.row_id) row_id,
|
||||
ifnull(c.row_id,0) row_id,
|
||||
p.row_id bomRowId,
|
||||
p.created_by bomCreateBy,
|
||||
p.*
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.nflg.product.bomnew.service.test;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
|
|
@ -142,4 +143,9 @@ public class OtherTest {
|
|||
public void test16() {
|
||||
System.out.println("下一个版本:" + VersionUtil.getNextVersionForSmallVersion("A00"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test17() {
|
||||
System.out.println("T" + RandomUtil.randomNumbers(9));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue