fix(ebom): 优化31码生成虚拟包
This commit is contained in:
parent
e1f093023d
commit
2fe03c4e80
|
|
@ -124,8 +124,7 @@ public class EbomV2Api extends BaseApi {
|
|||
*/
|
||||
@PostMapping("generateVirtualPackage")
|
||||
@ApiOperation("生成发货包(31编码专用)")
|
||||
public ResultVO<Boolean> generateVirtualPackage(@RequestBody GenerateVirtualPackageQuery query) {
|
||||
ebomParentService.generateVirtualPackageV2(query);
|
||||
return ResultVO.success();
|
||||
public ResultVO<List<OperationErrorMsgVO>> generateVirtualPackage(@RequestBody GenerateVirtualPackageQuery query) {
|
||||
return ResultVO.success(ebomParentService.generateVirtualPackageV2(query));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
package com.nflg.product.bomnew.api.user;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.nflg.product.bomnew.client.MaterialMainClient;
|
||||
import com.nflg.product.bomnew.pojo.dto.MaterialUpdateBillDTO;
|
||||
import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO;
|
||||
import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1DTO;
|
||||
import com.nflg.product.bomnew.pojo.vo.MaterialMainVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO;
|
||||
import com.nflg.product.bomnew.service.SapOpUtilService;
|
||||
import io.swagger.annotations.Api;
|
||||
|
|
@ -33,6 +37,30 @@ public class TestApi {
|
|||
@Resource
|
||||
SapOpUtilService sapOpUtilService;
|
||||
|
||||
@Resource
|
||||
private MaterialMainClient materialMainClient;
|
||||
|
||||
@GetMapping("materialUpdateBill")
|
||||
@ApiOperation("物料变更申请单测试")
|
||||
public ResultVO testMaterialUpdateBill() {
|
||||
String materialNo = "1100014371";
|
||||
ResultVO<MaterialMainVO> result = materialMainClient.selectByMaterialNo(materialNo);
|
||||
if (result.getState() != 200) {
|
||||
return result;
|
||||
}
|
||||
MaterialMainVO vo = result.getData();
|
||||
MaterialUpdateBillDTO dto = Convert.convert(MaterialUpdateBillDTO.class, vo);
|
||||
dto.setOpEnum(1);
|
||||
String newMateria = vo.getDrawingNo() + RandomUtil.randomNumbers(5);
|
||||
dto.setDrawingNo(newMateria);
|
||||
dto.setMaterialDesc(newMateria);
|
||||
dto.setMaterialName(newMateria);
|
||||
dto.setOldMaterialDesc(vo.getMaterialDesc());
|
||||
dto.setOldMaterialState(vo.getMaterialState());
|
||||
dto.setOldCategoryCode(vo.getMaterialCategoryCode());
|
||||
return materialMainClient.addMaterialUpdateBillEntity(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* sap接口测试
|
||||
* @return
|
||||
|
|
|
|||
|
|
@ -1,14 +1,19 @@
|
|||
package com.nflg.product.bomnew.client;
|
||||
|
||||
|
||||
import com.nflg.product.bomnew.config.FeignClientConfiguration;
|
||||
import com.nflg.product.bomnew.pojo.dto.MaterialMainDTO;
|
||||
import com.nflg.product.bomnew.pojo.dto.MaterialUpdateBillDTO;
|
||||
import com.nflg.product.bomnew.pojo.vo.MaterialMainVO;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import nflg.product.common.vo.ResultVO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@FeignClient(value = "material")
|
||||
@FeignClient(value = "material", configuration = FeignClientConfiguration.class)
|
||||
public interface MaterialMainClient {
|
||||
|
||||
|
||||
|
|
@ -17,4 +22,11 @@ public interface MaterialMainClient {
|
|||
|
||||
ResultVO<String> addMaterialMainEntity(@RequestBody MaterialMainDTO paramDto);
|
||||
|
||||
@GetMapping("main/selectByMaterialNo")
|
||||
@ApiOperation("通过物料编码查询物料详情")
|
||||
ResultVO<MaterialMainVO> selectByMaterialNo(@RequestParam("materialNo") String materialNo);
|
||||
|
||||
@PostMapping("materialUpdateBillEntity/add")
|
||||
@ApiOperation("申请物料")
|
||||
ResultVO<Boolean> addMaterialUpdateBillEntity(@RequestBody MaterialUpdateBillDTO paramDto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
package com.nflg.product.bomnew.config;
|
||||
|
||||
import com.nflg.product.base.core.config.fillter.HttpInterceptor;
|
||||
import feign.RequestInterceptor;
|
||||
import feign.RequestTemplate;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author 曹鹏飞
|
||||
* @date 2024/5/18 10:39:30
|
||||
*/
|
||||
@Configuration
|
||||
public class FeignClientConfiguration {
|
||||
|
||||
@Bean
|
||||
public RequestInterceptor requestInterceptor() {
|
||||
return new RequestInterceptor() {
|
||||
@Override
|
||||
public void apply(RequestTemplate template) {
|
||||
System.out.println(HttpInterceptor.getAuthorization());
|
||||
template.header("Authorization", HttpInterceptor.getAuthorization());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
package com.nflg.product.bomnew.pojo.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 曹鹏飞
|
||||
* @date 2024/5/18 09:36:10
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MaterialUpdateBillDTO implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
@ApiModelProperty(value = "物料编码")
|
||||
@NotNull(message = "物料编码不能为空")
|
||||
private String materialNo;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "物料名称")
|
||||
@NotNull(message = "物料名称不能为空")
|
||||
private String materialName;
|
||||
|
||||
/**
|
||||
* 图号
|
||||
*/
|
||||
@ApiModelProperty(value = "图号")
|
||||
private String drawingNo;
|
||||
|
||||
/**
|
||||
* 新描述
|
||||
*/
|
||||
@ApiModelProperty(value = "新描述")
|
||||
private String materialDesc;
|
||||
|
||||
/**
|
||||
* 新描述
|
||||
*/
|
||||
@ApiModelProperty(value = "新描述(简写)")
|
||||
private String shortMaterialDesc;
|
||||
|
||||
/**
|
||||
* 新分类编码
|
||||
*/
|
||||
@ApiModelProperty(value = "新分类编码")
|
||||
private String materialCategoryCode;
|
||||
|
||||
/**
|
||||
* 新物料状态
|
||||
*/
|
||||
@ApiModelProperty(value = "新物料状态")
|
||||
private Integer materialState;
|
||||
|
||||
/**
|
||||
* 新分类名称树
|
||||
*/
|
||||
@ApiModelProperty(value = "新分类名称树")
|
||||
private String newCategoryNameTree;
|
||||
|
||||
/**
|
||||
* 物料旧描述
|
||||
*/
|
||||
@ApiModelProperty(value = "物料旧描述")
|
||||
private String oldMaterialDesc;
|
||||
|
||||
/**
|
||||
* 旧分类编码
|
||||
*/
|
||||
@ApiModelProperty(value = "旧分类编码(细分类)")
|
||||
private String oldCategoryCode;
|
||||
|
||||
/**
|
||||
* 旧分类名称树
|
||||
*/
|
||||
@ApiModelProperty(value = "旧分类名称树(如:采购物料/原材料/板材)")
|
||||
private String oldCategoryNameTree;
|
||||
|
||||
|
||||
/**
|
||||
* 旧物料状态 1:激活(正常) 2:禁止采购 3:售后专用 4:冻结(禁用) 5:完全弃用
|
||||
*/
|
||||
@ApiModelProperty(value = "旧物料状态 1:激活(正常) 2:禁止采购 3:售后专用 4:冻结(禁用) 5:完全弃用")
|
||||
private Integer oldMaterialState;
|
||||
|
||||
/**
|
||||
* 旧物料状态名称
|
||||
*/
|
||||
@ApiModelProperty(value = "旧物料状态名称")
|
||||
private String oldMaterialStateName;
|
||||
|
||||
|
||||
/**
|
||||
* 新物料状态名称
|
||||
*/
|
||||
@ApiModelProperty(value = "新物料状态名称")
|
||||
private String newMaterialStateName;
|
||||
|
||||
/**
|
||||
* 替代物料
|
||||
*/
|
||||
@ApiModelProperty(value = "替代物料")
|
||||
private String replaceMaterialNo;
|
||||
|
||||
/**
|
||||
* 变更 原因
|
||||
*/
|
||||
@ApiModelProperty(value = "变更 原因")
|
||||
private String updateResion;
|
||||
|
||||
private List<Long> rowIds;
|
||||
|
||||
private Integer opEnum;
|
||||
|
||||
@ApiModelProperty(value = "申请部门")
|
||||
private String applyDeptName;
|
||||
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 项目类别:F、Q、L
|
||||
*/
|
||||
@ApiModelProperty(value = "项目类别:F、Q、L")
|
||||
private String projectType;
|
||||
|
||||
/**
|
||||
* 是否一次性使用物料 0:否1:是
|
||||
*/
|
||||
@TableField(value = "reuse_of_once_state")
|
||||
@ApiModelProperty(value = "是否一次性使用物料 0:否1:是")
|
||||
private Integer reuseOfOnceState;
|
||||
|
||||
/**
|
||||
* 新英文描述
|
||||
*/
|
||||
@ApiModelProperty(value = "新英文描述")
|
||||
private String materialDescEn;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
package com.nflg.product.bomnew.service;
|
||||
|
||||
import com.nflg.product.bomnew.pojo.query.GenerateVirtualPackageQuery;
|
||||
|
||||
/**
|
||||
* @author 曹鹏飞
|
||||
* @date 2024/5/15 09:55:12
|
||||
*/
|
||||
public class BomNewEbomGenerateVirtualPackageServiceFor21Impl implements IBomNewEbomGenerateVirtualPackageService {
|
||||
|
||||
@Override
|
||||
public void generate(GenerateVirtualPackageQuery query) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -6,16 +6,21 @@ import cn.hutool.core.util.StrUtil;
|
|||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||
import com.nflg.product.bomnew.client.MaterialMainClient;
|
||||
import com.nflg.product.bomnew.constant.EBomSourceEnum;
|
||||
import com.nflg.product.bomnew.constant.OriginalConstant;
|
||||
import com.nflg.product.bomnew.constant.ProjectTypeInputTypeEnum;
|
||||
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
|
||||
import com.nflg.product.bomnew.pojo.dto.AddVirtrualMaterialDTO;
|
||||
import com.nflg.product.bomnew.pojo.dto.MaterialUpdateBillDTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.query.GenerateVirtualPackageQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.ChildListForGenerateVirtualPackageVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.MaterialMainVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import nflg.product.common.vo.ResultVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -38,14 +43,18 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
|||
|
||||
private final BomNewEbomParentService ebomParentService = SpringUtil.getBean(BomNewEbomParentService.class);
|
||||
private final BomNewEbomChildService ebomChildService = SpringUtil.getBean(BomNewEbomChildService.class);
|
||||
|
||||
private final MaterialMainClient materialMainClient = SpringUtil.getBean(MaterialMainClient.class);
|
||||
private final MaterialService materialService = SpringUtil.getBean(MaterialService.class);
|
||||
|
||||
private final List<BomNewEbomChildEntity> children = new ArrayList<>();
|
||||
private final List<BomNewEbomParentEntity> parents = new ArrayList<>();
|
||||
private final List<Long> childRowIdsForDel = new ArrayList<>();
|
||||
|
||||
private final List<OperationErrorMsgVO> errorMsgList = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void generate(GenerateVirtualPackageQuery query) {
|
||||
public List<OperationErrorMsgVO> generate(GenerateVirtualPackageQuery query) {
|
||||
BomNewEbomParentEntity root = ebomParentService.getById(query.getParentRowId());
|
||||
VUtils.isTure(Objects.isNull(root)).throwMessage("无效的数据");
|
||||
|
||||
|
|
@ -88,6 +97,8 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
|||
});
|
||||
|
||||
save();
|
||||
|
||||
return errorMsgList;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
|
@ -104,12 +115,8 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
|||
}
|
||||
|
||||
private void selected1020Cancel1010(BomNewEbomParentEntity root, BomNewEbomChildEntity child, ChildListForGenerateVirtualPackageVO old) {
|
||||
if (old.isHasGenerated1010()) {
|
||||
if (old.isHasGenerated1010() && old.isHasGenerated1020()) {
|
||||
buildDelVirtualPackage(root, child, false);
|
||||
}
|
||||
if (!old.isHasGenerated1020()) {
|
||||
build1020VirtualPackage(root, true, child);
|
||||
} else {
|
||||
String dnMaking = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.MAKING_PACKAGE, true);
|
||||
BomNewEbomParentEntity p = ebomParentService.lambdaQuery()
|
||||
.eq(BomNewEbomParentEntity::getDrawingNo, dnMaking)
|
||||
|
|
@ -125,15 +132,151 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
|||
child.setParentRowId(p.getRowId());
|
||||
child.setModifyTime(LocalDateTime.now());
|
||||
children.add(child);
|
||||
} else if (!old.isHasGenerated1010() && !old.isHasGenerated1020()) {
|
||||
build1020VirtualPackage(root, true, child);
|
||||
} else if (old.isHasGenerated1010()) {
|
||||
//处理发货包
|
||||
String oldDrawingNo = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.DELIVERY_PACKAGE, false);
|
||||
String newDrawingNo = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.DELIVERY_PACKAGE, true);
|
||||
BomNewEbomParentEntity fp = ebomParentService.lambdaQuery()
|
||||
.eq(BomNewEbomParentEntity::getDrawingNo, newDrawingNo)
|
||||
.one();
|
||||
if (Objects.nonNull(fp)) {
|
||||
buildVirtualPackage(true, root.getRowId(), root, child, VirtualPackageTypeEnum.DELIVERY_PACKAGE, child.getOrderNumber());
|
||||
String dnMaking = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.MAKING_PACKAGE, true);
|
||||
BomNewEbomParentEntity zp = ebomParentService.lambdaQuery()
|
||||
.eq(BomNewEbomParentEntity::getDrawingNo, dnMaking)
|
||||
.one();
|
||||
if (Objects.isNull(zp)) {
|
||||
BomNewEbomChildEntity c = ebomChildService.lambdaQuery()
|
||||
.eq(BomNewEbomChildEntity::getDrawingNo, dnMaking)
|
||||
.one();
|
||||
zp = buildVirtualPackage(ebomParentService.lambdaQuery()
|
||||
.eq(BomNewEbomParentEntity::getDrawingNo, buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.DELIVERY_PACKAGE, true))
|
||||
.one(), c);
|
||||
}
|
||||
//挂载物料
|
||||
child.setParentRowId(zp.getRowId());
|
||||
child.setModifyTime(LocalDateTime.now());
|
||||
children.add(child);
|
||||
} else {
|
||||
fp = updateParentVirtualPackage(oldDrawingNo, newDrawingNo);
|
||||
updateChildVirtualPackage(root.getRowId(), oldDrawingNo, newDrawingNo);
|
||||
//处理直发包
|
||||
oldDrawingNo = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE, false);
|
||||
newDrawingNo = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE, true);
|
||||
updateChildVirtualPackage(fp.getRowId(), oldDrawingNo, newDrawingNo);
|
||||
//处理制作包
|
||||
oldDrawingNo = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.MAKING_PACKAGE, false);
|
||||
newDrawingNo = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.MAKING_PACKAGE, true);
|
||||
BomNewEbomParentEntity zp = updateParentVirtualPackage(oldDrawingNo, newDrawingNo);
|
||||
updateChildVirtualPackage(fp.getRowId(), oldDrawingNo, newDrawingNo);
|
||||
//挂载物料
|
||||
child.setParentRowId(zp.getRowId());
|
||||
child.setModifyTime(LocalDateTime.now());
|
||||
children.add(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private BomNewEbomParentEntity updateParentVirtualPackage(String oldDrawingNo, String newDrawingNo) {
|
||||
BomNewEbomParentEntity p = ebomParentService.lambdaQuery()
|
||||
.eq(BomNewEbomParentEntity::getDrawingNo, newDrawingNo)
|
||||
.one();
|
||||
if (Objects.isNull(p)) {
|
||||
p = ebomParentService.lambdaQuery()
|
||||
.eq(BomNewEbomParentEntity::getDrawingNo, oldDrawingNo)
|
||||
.one();
|
||||
p.setDrawingNo(newDrawingNo);
|
||||
p.setMaterialDesc(newDrawingNo);
|
||||
p.setMaterialName(newDrawingNo);
|
||||
parents.add(p);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
private void updateChildVirtualPackage(Long parentRowId, String oldDrawingNo, String newDrawingNo) {
|
||||
BomNewEbomChildEntity c = ebomChildService.lambdaQuery()
|
||||
.eq(BomNewEbomChildEntity::getParentRowId, parentRowId)
|
||||
.eq(BomNewEbomChildEntity::getDrawingNo, oldDrawingNo)
|
||||
.one();
|
||||
addMaterialUpdateBillEntity(c.getMaterialNo(), newDrawingNo);
|
||||
c.setDrawingNo(newDrawingNo);
|
||||
c.setMaterialDesc(newDrawingNo);
|
||||
c.setMaterialName(newDrawingNo);
|
||||
children.add(c);
|
||||
}
|
||||
|
||||
private void addMaterialUpdateBillEntity(String materialNo, String newDrawingNo) {
|
||||
ResultVO<MaterialMainVO> result = materialMainClient.selectByMaterialNo(materialNo);
|
||||
if (result.getState() != 200) {
|
||||
errorMsgList.add(OperationErrorMsgVO.create(materialNo, result.getMsg()));
|
||||
return;
|
||||
}
|
||||
MaterialMainVO vo = result.getData();
|
||||
MaterialUpdateBillDTO dto = Convert.convert(MaterialUpdateBillDTO.class, vo);
|
||||
dto.setOpEnum(1);
|
||||
dto.setDrawingNo(newDrawingNo);
|
||||
dto.setMaterialDesc(newDrawingNo);
|
||||
dto.setMaterialName(newDrawingNo);
|
||||
dto.setOldMaterialDesc(vo.getMaterialDesc());
|
||||
dto.setOldMaterialState(vo.getMaterialState());
|
||||
dto.setOldCategoryCode(vo.getMaterialCategoryCode());
|
||||
dto.setUpdateResion("发货包工厂切换");
|
||||
ResultVO<Boolean> result1 = materialMainClient.addMaterialUpdateBillEntity(dto);
|
||||
if (result1.getState() != 200) {
|
||||
errorMsgList.add(OperationErrorMsgVO.create(materialNo, result1.getMsg()));
|
||||
}
|
||||
}
|
||||
|
||||
private void selected1010Cancel1020(BomNewEbomParentEntity root, BomNewEbomChildEntity child, ChildListForGenerateVirtualPackageVO old) {
|
||||
if (old.isHasGenerated1020()) {
|
||||
if (old.isHasGenerated1010() && old.isHasGenerated1020()) {
|
||||
buildDelVirtualPackage(root, child, true);
|
||||
}
|
||||
if (!old.isHasGenerated1010()) {
|
||||
} else if (!old.isHasGenerated1010() && !old.isHasGenerated1020()) {
|
||||
build1010VirtualPackage(root, child);
|
||||
} else if (old.isHasGenerated1020()) {
|
||||
buildDelVirtualPackage(root, child, true);
|
||||
//处理发货包
|
||||
String oldDrawingNo = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.DELIVERY_PACKAGE, true);
|
||||
String newDrawingNo = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.DELIVERY_PACKAGE, false);
|
||||
BomNewEbomParentEntity fp = ebomParentService.lambdaQuery()
|
||||
.eq(BomNewEbomParentEntity::getDrawingNo, newDrawingNo)
|
||||
.one();
|
||||
if (Objects.nonNull(fp)) {
|
||||
buildVirtualPackage(true, root.getRowId(), root, child, VirtualPackageTypeEnum.DELIVERY_PACKAGE, child.getOrderNumber());
|
||||
String dnMaking = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.MAKING_PACKAGE, true);
|
||||
BomNewEbomParentEntity zp = ebomParentService.lambdaQuery()
|
||||
.eq(BomNewEbomParentEntity::getDrawingNo, dnMaking)
|
||||
.one();
|
||||
if (Objects.isNull(zp)) {
|
||||
BomNewEbomChildEntity c = ebomChildService.lambdaQuery()
|
||||
.eq(BomNewEbomChildEntity::getDrawingNo, dnMaking)
|
||||
.one();
|
||||
zp = buildVirtualPackage(ebomParentService.lambdaQuery()
|
||||
.eq(BomNewEbomParentEntity::getDrawingNo, buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.DELIVERY_PACKAGE, true))
|
||||
.one(), c);
|
||||
}
|
||||
//挂载物料
|
||||
child.setParentRowId(zp.getRowId());
|
||||
child.setModifyTime(LocalDateTime.now());
|
||||
children.add(child);
|
||||
} else {
|
||||
fp = updateParentVirtualPackage(oldDrawingNo, newDrawingNo);
|
||||
updateChildVirtualPackage(root.getRowId(), oldDrawingNo, newDrawingNo);
|
||||
//处理直发包
|
||||
oldDrawingNo = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE, true);
|
||||
newDrawingNo = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE, false);
|
||||
updateChildVirtualPackage(fp.getRowId(), oldDrawingNo, newDrawingNo);
|
||||
//处理制作包
|
||||
oldDrawingNo = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.MAKING_PACKAGE, true);
|
||||
newDrawingNo = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.MAKING_PACKAGE, false);
|
||||
BomNewEbomParentEntity zp = updateParentVirtualPackage(oldDrawingNo, newDrawingNo);
|
||||
updateChildVirtualPackage(fp.getRowId(), oldDrawingNo, newDrawingNo);
|
||||
//挂载物料
|
||||
child.setParentRowId(zp.getRowId());
|
||||
child.setModifyTime(LocalDateTime.now());
|
||||
children.add(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
|
||||
List<BomNewEbomParentVO> parentChild = this.getBaseMapper().getParentChild(rowId);
|
||||
//排除项目类别的赋值
|
||||
materialMainService.intiMaterialInfoInPattern(parentChild, "^21 | ^31", EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
//materialMainService.intiMaterialInfoInPattern(parentChild, "^21 | ^31", EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
if (CollUtil.isNotEmpty(parentChild)) {
|
||||
List<String> materialNos = parentChild.stream().map(BaseMaterialVO::getMaterialNo).filter(StrUtil::isNotBlank).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(materialNos)) {
|
||||
|
|
@ -2354,9 +2354,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
.update();
|
||||
}
|
||||
|
||||
public void generateVirtualPackageV2(GenerateVirtualPackageQuery query) {
|
||||
public List<OperationErrorMsgVO> generateVirtualPackageV2(GenerateVirtualPackageQuery query) {
|
||||
IBomNewEbomGenerateVirtualPackageService service = new BomNewEbomGenerateVirtualPackageServiceFor31Impl();
|
||||
service.generate(query);
|
||||
return service.generate(query);
|
||||
}
|
||||
|
||||
public ListForGenerateVirtualPackageVO getListForGenerateVirtualPackage(Long bomRowId) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
package com.nflg.product.bomnew.service;
|
||||
|
||||
import com.nflg.product.bomnew.pojo.query.GenerateVirtualPackageQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 曹鹏飞
|
||||
|
|
@ -8,5 +11,5 @@ import com.nflg.product.bomnew.pojo.query.GenerateVirtualPackageQuery;
|
|||
*/
|
||||
public interface IBomNewEbomGenerateVirtualPackageService {
|
||||
|
||||
void generate(GenerateVirtualPackageQuery query);
|
||||
List<OperationErrorMsgVO> generate(GenerateVirtualPackageQuery query);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import java.nio.charset.StandardCharsets;
|
|||
public class HttpInterceptor implements HandlerInterceptor {
|
||||
|
||||
private static final String CHARSET = StandardCharsets.UTF_8.name();
|
||||
private static final ThreadLocal<String> currentAuthorization = new ThreadLocal<>();
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
|
||||
|
|
@ -36,6 +37,7 @@ public class HttpInterceptor implements HandlerInterceptor {
|
|||
// body = String.valueOf(chars);
|
||||
// }
|
||||
log.info("HttpRecord Request,url:" + request.getRequestURL() + ",method:" + request.getMethod());
|
||||
currentAuthorization.set(request.getHeader("Authorization"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -43,5 +45,15 @@ public class HttpInterceptor implements HandlerInterceptor {
|
|||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) {
|
||||
//String body = response.getContentType().contains("json") ? response.getOutputStream().toString() : "内容无法显示(" + response.getContentType() + ")";
|
||||
log.info("HttpRecord Response,url:" + request.getRequestURL() + ",status:" + response.getStatus());
|
||||
removeAuthorization();
|
||||
}
|
||||
|
||||
private void removeAuthorization() {
|
||||
log.debug("已清除当前线程的Authorization");
|
||||
currentAuthorization.remove();
|
||||
}
|
||||
|
||||
public static String getAuthorization() {
|
||||
return currentAuthorization.get();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue