移动破编辑

This commit is contained in:
jing's 2024-01-14 21:24:55 +08:00
parent c5d312ee85
commit 334174a757
11 changed files with 372 additions and 172 deletions

View File

@ -1,19 +1,19 @@
package com.nflg.product.bomnew.api.user;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.digest.MD5;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.nflg.product.base.core.api.BaseApi;
import com.nflg.product.base.core.conmon.util.SessionUtil;
import com.nflg.product.base.core.exception.NflgBusinessException;
import com.nflg.product.bomnew.constant.OptionalBomConstant;
import com.nflg.product.bomnew.pojo.dto.OptionalEbomConfigDTO;
import com.nflg.product.bomnew.pojo.dto.OptionalEbomMainDTO;
import com.nflg.product.bomnew.pojo.dto.OptionalEbomMainDelDTO;
import com.nflg.product.bomnew.pojo.dto.OptionalEbomSubmitEditDTO;
import com.nflg.product.bomnew.pojo.dto.*;
import com.nflg.product.bomnew.pojo.query.OptionalEbomConfigListQuery;
import com.nflg.product.bomnew.pojo.query.OptionalEbomMainListQuery;
import com.nflg.product.bomnew.pojo.query.OptionalMbomMaterialListQuery;
import com.nflg.product.bomnew.pojo.query.OptionalMbomMaterialQuery;
import com.nflg.product.bomnew.pojo.vo.*;
import com.nflg.product.bomnew.service.OptionalEbomConfigService;
import com.nflg.product.bomnew.service.OptionalEbomImportChildService;
@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
*
@ -84,9 +85,66 @@ public class OptionalMbomApi extends BaseApi {
}
@PostMapping("queryMaterial")
@ApiOperation("查询物料")
public ResultVO< OptionalMbomMaterialListVO > queryMaterial(@RequestBody OptionalMbomMaterialQuery query ) {
if(Objects.isNull(query.getRowId())){
throw new NflgBusinessException(STATE.Error, "rowId不能为空" );
}
if(Objects.isNull(query.getMaterialNo()) || Objects.isNull(query.getDrawingNo()) ){
throw new NflgBusinessException(STATE.Error, "物料或图号不能同时为空" );
}
return ResultVO.success(this.optionalMbomMaterialService.queryMaterial(query));
}
@PostMapping("delete")
@ApiOperation("删除物料")
public ResultVO<Boolean > deleteMaterial(@RequestBody List<Long> rowIds ) {
if(CollectionUtil.isEmpty(rowIds)){
throw new NflgBusinessException(STATE.Error, "选择删除的行" );
}
this.optionalMbomMaterialService.deleteMaterial(rowIds);
return ResultVO.success(true);
}
@PostMapping("add")
@ApiOperation("添加物料")
public ResultVO<Boolean > addMaterial(@RequestBody OptionalMbomMaterialAddDTO dto ) {
if(Objects.isNull(dto.getRowId())){
throw new NflgBusinessException(STATE.Error, "rowId不能为空" );
}
if(CollectionUtil.isEmpty(dto.getDatas())){
throw new NflgBusinessException(STATE.Error, "选择提交的物料" );
}
this.optionalMbomMaterialService.addMaterial(dto);
return ResultVO.success(true);
}
@GetMapping("list")
@ApiOperation("编辑的物料列表")
public ResultVO<List<OptionalMbomMaterialListVO> > list(@ApiParam("行Id") @RequestParam("rowId") Long rowId) {
if(Objects.isNull(rowId)){
throw new NflgBusinessException(STATE.Error, "选择行操作" );
}
return ResultVO.success( this.optionalMbomMaterialService.list(rowId));
}
}

View File

@ -86,5 +86,43 @@ public class OptionalBomConstant {
}
@AllArgsConstructor
@Getter
public enum CategoryTypeEnum {
//物料归类1 整机发货 2 整机制作 3 电控发货 4 电控制作 5 机械部分 6 机械部分下物料 7 手动录入
TYPE_1(1, "整机发货" ),
TYPE_2(2, "整机制作" ),
TYPE_3(3, "电控发货" ),
TYPE_4(4, "电控制作" ),
TYPE_5(5, "机械部分" ),
TYPE_6(6, "机械部分下物料" ),
TYPE_7(7, "手动录入" ) ;
private final Integer value;
private final String description;
}
@AllArgsConstructor
@Getter
public enum ExistStatusEnum {
//是否在机械部分存在物料(1 不存在 -1存在)
S_ADD(1, "增加" ),
S_DEL(-1, "删除" ) ;
private final Integer value;
private final String description;
}
}

View File

@ -0,0 +1,37 @@
package com.nflg.product.bomnew.pojo.dto;
import com.nflg.product.bomnew.pojo.vo.OptionalMbomMaterialListVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.List;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@ApiModel("添加物料")
@Accessors(chain = true)
public class OptionalMbomMaterialAddDTO implements Serializable {
/**
* 主键
*/
@ApiModelProperty(value = "主键")
private Long rowId;
@ApiModelProperty(value = "上层id")
private Long parentRowId;
/**
* 上层id
*/
@ApiModelProperty(value = "根id")
private Long rootRowId;
@ApiModelProperty(value = "根id")
private List<OptionalMbomMaterialListVO> datas;
}

View File

@ -1,74 +0,0 @@
package com.nflg.product.bomnew.pojo.dto;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import lombok.Data;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
import java.time.LocalDate;
import java.util.Date;
@Data
@ApiModel("mbom发布生成的物料信息")
@Accessors(chain = true)
public class OptionalMbomMaterialDTO implements Serializable {
/**
* 主键
*/
@ApiModelProperty(value = "主键")
private Long rowId;
@ApiModelProperty(value = "上层id")
private Long parentRowId;
/**
* 上层id
*/
@ApiModelProperty(value = "根id")
private Long rootRowId;
/**
* 物料编码
*/
@ApiModelProperty(value = "物料编码")
private String materialNo;
/**
* 物料名
*/
@ApiModelProperty(value = "物料名")
private String materialName;
/**
* 物料描述
*/
@ApiModelProperty(value = "物料描述")
private String materialDesc;
/**
* 图号
*/
@ApiModelProperty(value = "图号")
private String drawingNo;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String remak;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private String createdTime;
/**
* 操作人编码
*/
@ApiModelProperty(value = "操作人编码")
private String createdBy;
}

View File

@ -81,6 +81,11 @@ public class OptionalMbomMaterialEntity implements Serializable {
@ApiModelProperty(value = "创建时间")
private String createdTime;
@TableField(value = "dept_name")
@ApiModelProperty(value = "部门")
private String deptName;
/**
* 操作人编码
@ -89,5 +94,17 @@ public class OptionalMbomMaterialEntity implements Serializable {
@ApiModelProperty(value = "操作人编码")
private String createdBy;
@TableField(value = "real_name")
@ApiModelProperty(value = "操作人")
private String realName;
@TableField(value = "category_type")
@ApiModelProperty(value = "归类1 整机发货 2整机制作 3电控发货 4电控制作 5机械部分 6机械部分下物料 7手动录入")
private Integer categoryType;
@TableField(value = "exist_status")
@ApiModelProperty(value = "是否在机械部分存在物料(1 增加 -1 删除)")
private Integer existStatus;
}

View File

@ -21,54 +21,20 @@ import java.util.Date;
@ApiModel("mbom发布生成的物料信息")
@Accessors(chain = true)
public class OptionalMbomMaterialQuery implements Serializable {
/**
* 主键
*/
@ApiModelProperty(value = "主键")
@ApiModelProperty(value = "编辑行id")
private Long rowId;
@ApiModelProperty(value = "上层id")
private Long parentRowId;
/**
* 上层id
*/
@ApiModelProperty(value = "根id")
private Long rootRowId;;
/**
* 物料编码
*/
@ApiModelProperty(value = "物料编码")
private String materialNo;
/**
* 物料名
*/
@ApiModelProperty(value = "物料名")
private String materialName;
/**
* 物料描述
*/
@ApiModelProperty(value = "物料描述")
private String materialDesc;
/**
* 图号
*/
@ApiModelProperty(value = "图号")
private String drawingNo;
/**
* 备注
* 物料编码
*/
@ApiModelProperty(value = "备注")
private String remak;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date createdTime;
/**
* 操作人编码
*/
@ApiModelProperty(value = "操作人编码")
private String createdBy;
@ApiModelProperty(value = "物料编码")
private String materialNo;
}

View File

@ -1,6 +1,7 @@
package com.nflg.product.bomnew.pojo.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -29,26 +30,7 @@ public class OptionalMbomMaterialListVO extends BaseMaterialVO {
*/
@ApiModelProperty(value = "根id")
private Long rootRowId;
/**
* 物料编码
*/
// @ApiModelProperty(value = "物料编码")
// private String materialNo;
/**
* 物料名
*/
// @ApiModelProperty(value = "物料名")
// private String materialName;
/**
* 物料描述
*/
// @ApiModelProperty(value = "物料描述")
// private String materialDesc;
/**
* 图号
*/
// @ApiModelProperty(value = "图号")
// private String drawingNo;
/**
* 备注
*/
@ -99,6 +81,16 @@ public class OptionalMbomMaterialListVO extends BaseMaterialVO {
private String realName;
@ApiModelProperty(value = "归类1 整机发货 2整机制作 3电控发货 4电控制作 5机械部分 6机械部分下物料 7手动录入")
private Integer categoryType;
@ApiModelProperty(value = "是否在机械部分存在物料(1 增加 -1 删除)")
private Integer existStatus;
private List<OptionalMbomMaterialListVO> childNodes = Collections.emptyList();
}

View File

@ -1177,7 +1177,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
BomNewEbomParentVO baseMaterialVO = new BomNewEbomParentVO();
BeanUtil.copyProperties(materialMainEntity, baseMaterialVO);
// baseMaterialVO.setCreatedBy(SessionUtil.getUserCode());
baseMaterialVO.setRowId(null);
baseMaterialVO.setExceptionStatus(materialMainEntity.getMaterialState());
return baseMaterialVO;
}
@ -1408,13 +1408,16 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
List<BomNewEbomParentVO> tmp1 = dto.getDatas().stream().filter(item -> (Objects.nonNull(item.getRowId()) && item.getRowId() > 0)).collect(Collectors.toList());
//相同rowid 不同物料号
List<BomNewEbomParentVO> union = tmp1.stream().filter(u->{
List<BomNewEbomParentVO> unionEdit = tmp1.stream().filter(u->{
return childList.stream().filter(e->
Objects.equals(u.getRowId(),e.getRowId() )
&& !Objects.equals(u.getMaterialNo(),e.getMaterialNo())
).count()>0;
}).collect(Collectors.toList());
//相同rowid 相同物料号
List<BomNewEbomParentVO> union2 = tmp1.stream().filter(u->{
return childList.stream().filter(e->
@ -1424,14 +1427,15 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}).collect(Collectors.toList());
Map<Long,List<BomNewEbomParentVO>> groupList=childList.stream().collect(Collectors.groupingBy(BomNewEbomParentVO::getRowId));
// Map<Long,List<BomNewEbomParentVO>> groupUnionEdit=unionEdit.stream().collect(Collectors.groupingBy(BomNewEbomParentVO::getRowId));
List<BomNewEbomParentVO> tmp2 = dto.getDatas().stream().filter(item -> Objects.isNull(item.getRowId()) || item.getRowId() == 0).collect(Collectors.toList());
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(tmp2, "");
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(union, "");
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(tmp2, "projectType");
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(unionEdit, "projectType");
@ -1446,21 +1450,18 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(union2, ignore);
List<BomNewEbomParentVO> returnList=new ArrayList<>();
Map<Long,List<BomNewEbomParentVO>> groupList=childList.stream().collect(Collectors.groupingBy(BomNewEbomParentVO::getRowId));
if(CollectionUtil.isNotEmpty(union)){
union.forEach(item->{
if(item.getMaterialUnit().contains("KG")){
item.setUnitWeight(null);
}else{
// if(StrUtil.isNotBlank(item.getMaterialUnit())) {
// item.setUnitWeight(NumberUtil.toBigDecimal(item.getMaterialUnit().toString()));
// }
}
if(CollectionUtil.isNotEmpty(unionEdit)){
unionEdit.forEach(item->{
// if(item.getMaterialUnit().contains("KG")){
// item.setUnitWeight(null);
// }else{
//// if(StrUtil.isNotBlank(item.getMaterialUnit())) {
//// item.setUnitWeight(NumberUtil.toBigDecimal(item.getMaterialUnit().toString()));
//// }
// }
item.setTotalWeight(NumberUtil.mul(item.getUnitWeight(), item.getNum()));
@ -1468,7 +1469,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
BeanUtil.copyProperties(groupList.get(item.getRowId()).get(0),item);
}
});
returnList.addAll(union);
returnList.addAll(unionEdit);
}
if(CollectionUtil.isNotEmpty(union2)){
@ -1494,11 +1495,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
// vo.setUnitWeight(vo.getMaterialWeight());
// }
if(vo.getMaterialUnit().contains("KG")){
vo.setUnitWeight(null);
}else{
// vo.setUnitWeight(NumberUtil.toBigDecimal( vo.getMaterialUnit() ));
}
// if(vo.getMaterialUnit().contains("KG")){
// vo.setUnitWeight(null);
// }else{
// // vo.setUnitWeight(NumberUtil.toBigDecimal( vo.getMaterialUnit() ));
// }
vo.setTotalWeight(NumberUtil.mul(vo.getUnitWeight(), vo.getNum()));
@ -1511,7 +1512,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
List<BomNewEbomParentVO> checkBom = new ArrayList<>();
checkBom.addAll(union);
checkBom.addAll(unionEdit);
checkBom.addAll(union2);
checkBom.addAll(tmp2);
checkBom.add(dto.getParent());

View File

@ -1,29 +1,45 @@
package com.nflg.product.bomnew.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.TypeReference;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.ImmutableList;
import com.nflg.product.base.core.conmon.util.SessionUtil;
import com.nflg.product.base.core.exception.NflgBusinessException;
import com.nflg.product.base.core.vo.PageVO;
import com.nflg.product.bomnew.constant.OptionalBomConstant;
import com.nflg.product.bomnew.mapper.master.OptionalMbomMaterialMapper;
import com.nflg.product.bomnew.pojo.dto.OptionalMbomMaterialAddDTO;
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
import com.nflg.product.bomnew.pojo.entity.OptionalMbomMaterialEntity;
import com.nflg.product.bomnew.pojo.query.BomNewEbomMaterialQuery;
import com.nflg.product.bomnew.pojo.query.OptionalMbomMaterialListQuery;
import com.nflg.product.bomnew.pojo.query.OptionalMbomMaterialQuery;
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
import com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO;
import com.nflg.product.bomnew.pojo.vo.OptionalMbomMaterialListVO;
import com.nflg.product.bomnew.pojo.vo.OptionalMbomMaterialVO;
import nflg.product.common.constant.STATE;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -100,7 +116,133 @@ public class OptionalMbomMaterialService extends ServiceImpl<OptionalMbomMateria
}
public List<OptionalMbomMaterialListVO> list(Long rowId){
QueryWrapper<OptionalMbomMaterialEntity> queryWrapper =new QueryWrapper<>();
queryWrapper.lambda().eq(OptionalMbomMaterialEntity::getRowId,rowId);
OptionalMbomMaterialEntity parentRow=this.getOne(queryWrapper);
if (parentRow==null){
throw new NflgBusinessException(STATE.Error, StrUtil.format("{} 数据未查询到",rowId));
}
if(!Objects.equals(parentRow.getCategoryType(),OptionalBomConstant.CategoryTypeEnum.TYPE_2.getValue())){
throw new NflgBusinessException(STATE.Error, "制作包物料才允许编辑");
}
QueryWrapper<OptionalMbomMaterialEntity> queryWrapper2 =new QueryWrapper<>();
queryWrapper2.lambda().eq(OptionalMbomMaterialEntity::getParentRowId,rowId);
queryWrapper2.lambda().in(OptionalMbomMaterialEntity::getCategoryType,Arrays.asList(
OptionalBomConstant.CategoryTypeEnum.TYPE_7.getValue())
);
List<OptionalMbomMaterialEntity> entityList=this.list(queryWrapper2);
List<OptionalMbomMaterialListVO> voList= Convert.convert(new TypeReference<List<OptionalMbomMaterialListVO>>(){
},entityList);
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(voList);
return voList;
}
public OptionalMbomMaterialListVO queryMaterial(OptionalMbomMaterialQuery query) {
List<MaterialMainEntity> materialMainList = null;
if (StringUtils.isNotEmpty(query.getMaterialNo())) {
materialMainList = materialMainService.lambdaQuery().eq(MaterialMainEntity::getMaterialNo, query.getMaterialNo()).list();
if (CollUtil.isEmpty(materialMainList)) {
throw new NflgBusinessException(STATE.Error, StrUtil.format("{} 物料编码的物料信息不存在", query.getMaterialNo()));
}
if (CollUtil.isNotEmpty(materialMainList) && materialMainList.size() > 1) {
throw new NflgBusinessException(STATE.Error, StrUtil.format("同时存在{}多条相同物料编码的物料信息", query.getMaterialNo()));
}
} else if (StringUtils.isNotEmpty(query.getDrawingNo())) {
materialMainList = materialMainService.lambdaQuery().eq(MaterialMainEntity::getDrawingNo, query.getDrawingNo()).list();
if (CollUtil.isEmpty(materialMainList)) {
throw new NflgBusinessException(STATE.Error, StrUtil.format("{} 图号的物料信息不存在", query.getDrawingNo()));
}
if (CollUtil.isNotEmpty(materialMainList) && materialMainList.size() > 1) {
throw new NflgBusinessException(STATE.Error, StrUtil.format("同时存在多条 {} 图号的物料信息", query.getDrawingNo()));
}
}
if (CollUtil.isNotEmpty(materialMainList)) {
MaterialMainEntity materialMainEntity = materialMainList.get(0);
OptionalMbomMaterialListVO baseMaterialVO = new OptionalMbomMaterialListVO();
BeanUtil.copyProperties(materialMainEntity, baseMaterialVO);
baseMaterialVO.setRowId(null);
QueryWrapper<OptionalMbomMaterialEntity> queryWrapper1=new QueryWrapper<>();
queryWrapper1.lambda().eq(OptionalMbomMaterialEntity::getRowId,query.getRowId());
OptionalMbomMaterialEntity editRow=this.getOne(queryWrapper1);
if(editRow==null){
throw new NflgBusinessException(STATE.Error,"未查询到编辑数据");
}
//当前机械部分是否包含
QueryWrapper<OptionalMbomMaterialEntity> queryWrapper2=new QueryWrapper<>();
queryWrapper2.lambda().eq(OptionalMbomMaterialEntity::getRootRowId,editRow.getRootRowId());
queryWrapper2.lambda().eq(OptionalMbomMaterialEntity::getMaterialNo,materialMainEntity.getMaterialNo());
queryWrapper2.lambda().in(OptionalMbomMaterialEntity::getCategoryType, Arrays.asList(OptionalBomConstant.CategoryTypeEnum.TYPE_6.getValue()));
List<OptionalMbomMaterialEntity> repeatList=this.list(queryWrapper2);
baseMaterialVO.setCategoryType(OptionalBomConstant.CategoryTypeEnum.TYPE_7.getValue()) ;
baseMaterialVO.setCreatedBy(SessionUtil.getUserCode());
baseMaterialVO.setRealName(SessionUtil.getRealName());
baseMaterialVO.setDeptName(SessionUtil.getDepartName());
baseMaterialVO.setCreatedTime(DateUtil.now());
if(CollectionUtil.isNotEmpty(repeatList)){
baseMaterialVO.setExistStatus(OptionalBomConstant.ExistStatusEnum.S_DEL.getValue());
}else{
baseMaterialVO.setExistStatus(OptionalBomConstant.ExistStatusEnum.S_ADD.getValue());
}
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(ImmutableList.of(baseMaterialVO));
return baseMaterialVO;
}
throw new NflgBusinessException(STATE.Error, "未查询到相关物料信息");
}
public void deleteMaterial(List<Long> rowIds) {
QueryWrapper<OptionalMbomMaterialEntity> delete=new QueryWrapper<>();
delete.lambda().in(OptionalMbomMaterialEntity::getRowId,rowIds);
delete.lambda().eq(OptionalMbomMaterialEntity::getCategoryType,OptionalBomConstant.CategoryTypeEnum.TYPE_7.getValue());
this.remove(delete);
}
public void addMaterial(OptionalMbomMaterialAddDTO dto) {
OptionalMbomMaterialEntity parentRow=getById(dto.getRowId());
if(parentRow==null){
throw new NflgBusinessException(STATE.Error,"添加的数据未查询到父节点");
}
List<OptionalMbomMaterialEntity> entityList=Convert.convert(new TypeReference<List<OptionalMbomMaterialEntity>>(){
},dto.getDatas());
entityList.forEach(item->{
item.setParentRowId(dto.getRowId());
item.setRootRowId(parentRow.getRootRowId());
item.setCreatedTime(DateUtil.now());
item.setCreatedBy(SessionUtil.getUserCode());
item .setRealName(SessionUtil.getRealName());
item .setDeptName(SessionUtil.getDepartName());
item.setCategoryType(OptionalBomConstant.CategoryTypeEnum.TYPE_7.getValue()) ;
});
this.saveOrUpdateBatch(entityList);
}

View File

@ -161,12 +161,14 @@ public class PublishMaterialService {
String sendMaterialName = goodsDesc.concat("(发货)");
sendPack.setRowId(IdWorker.getId());
sendPack.setCreatedBy(SessionUtil.getUserCode());
sendPack.setRealName(SessionUtil.getRealName());
sendPack.setDeptName(SessionUtil.getDepartName());
sendPack.setCreatedTime(DateUtil.now());
sendPack.setMaterialName(sendMaterialName);
sendPack.setMaterialDesc(sendMaterialName);
sendPack.setRootRowId(rootRowId);
sendPack.setMaterialNo("");//申请物料号
sendPack.setCategoryType(OptionalBomConstant.CategoryTypeEnum.TYPE_1.getValue());
try {
String data = materialService.addMaterial("", sendPack.getMaterialName(), OptionalBomConstant.PublishMaterialEnum.OTHER.getCategory());
// ResultVO<String> resultVO = JSON.parseObject(data, new com.alibaba.fastjson.TypeReference<ResultVO<String>>(){});
@ -191,14 +193,15 @@ public class PublishMaterialService {
String makeMaterialName = goodsDesc.concat("(制作)");
makePack.setRowId(IdWorker.getId());
makePack.setCreatedBy(SessionUtil.getUserCode());
makePack.setRealName(SessionUtil.getRealName());
makePack.setDeptName(SessionUtil.getDepartName());
makePack.setMaterialName(makeMaterialName);
makePack.setMaterialDesc(makeMaterialName);
makePack.setParentRowId(sendPack.getRowId()); //父级
makePack.setRootRowId(rootRowId);
makePack.setCreatedTime(DateUtil.now());
makePack.setMaterialNo("");//申请物料号
makePack.setCategoryType(OptionalBomConstant.CategoryTypeEnum.TYPE_2.getValue());
try {
String data = materialService.addMaterial("", makePack.getMaterialName(), OptionalBomConstant.PublishMaterialEnum.OTHER.getCategory());
@ -262,18 +265,20 @@ public class PublishMaterialService {
//物料名称和物料描述=机型+流水号+NF(机械部分)
//图号=机型+流水号+NF
String drawingNo =StrUtil.format("{}{}",desc.getDeviceNo(), OrderNoUtil.orderNo2Str(desc.getSerialNo())).concat("NF");
String drawingNo =StrUtil.format("{}-{}",desc.getDeviceNo(), OrderNoUtil.orderNo2Str(desc.getSerialNo())).concat("-NF");
String materialName=drawingNo.concat("(机械部分)");
material.setRowId(IdWorker.getId());
material.setDrawingNo(drawingNo);
material.setParentRowId(parentId);
material.setRootRowId(rootRowId);
material.setCreatedBy(SessionUtil.getUserCode());
material.setRealName(SessionUtil.getRealName());
material .setDeptName(SessionUtil.getDepartName());
material.setCreatedTime(DateUtil.now());
material.setMaterialName(materialName);
material.setMaterialDesc(materialName);
material.setMaterialNo("");//申请物料号
material.setCategoryType(OptionalBomConstant.CategoryTypeEnum.TYPE_5.getValue());
try {
String data = materialService.addMaterial(material.getDrawingNo(), material.getMaterialName(), OptionalBomConstant.PublishMaterialEnum.MACHINE.getCategory());
@ -316,6 +321,9 @@ public class PublishMaterialService {
material.setParentRowId(parentId);
material.setRootRowId(rootRowId);
material.setCreatedBy(SessionUtil.getUserCode());
material.setRealName(SessionUtil.getRealName());
material.setDeptName(SessionUtil.getDepartName());
material.setCategoryType(OptionalBomConstant.CategoryTypeEnum.TYPE_5.getValue());
material.setCreatedTime(DateUtil.now());
}
@ -329,9 +337,13 @@ public class PublishMaterialService {
optionConvertList.forEach(item -> {
item.setRowId(null);
item.setCreatedBy(SessionUtil.getUserCode());
item.setRealName(SessionUtil.getRealName());
item.setDeptName(SessionUtil.getDepartName());
item.setCreatedTime(DateUtil.now());
item.setRootRowId(rootRowId);
item.setParentRowId(material.getRowId());
item.setCategoryType(OptionalBomConstant.CategoryTypeEnum.TYPE_6.getValue());
materialList.add(item);
});
@ -362,12 +374,14 @@ public class PublishMaterialService {
makePack.setRowId(IdWorker.getId());
makePack.setParentRowId(parentId);
makePack.setCreatedBy(SessionUtil.getUserCode());
makePack .setRealName(SessionUtil.getRealName());
makePack .setDeptName(SessionUtil.getDepartName());
makePack.setCreatedTime(DateUtil.now());
makePack.setMaterialName(makeMaterialName);
makePack.setMaterialDesc(makeMaterialName);
makePack.setRootRowId(rootRowId);
makePack.setMaterialNo("");//申请物料号
makePack.setCategoryType(OptionalBomConstant.CategoryTypeEnum.TYPE_4.getValue());
try {
String data = materialService.addMaterial("", makePack.getMaterialName(), OptionalBomConstant.PublishMaterialEnum.OTHER.getCategory());
@ -395,11 +409,14 @@ public class PublishMaterialService {
sendPack.setRowId(IdWorker.getId());
sendPack.setParentRowId(makePack.getRowId());
sendPack.setCreatedBy(SessionUtil.getUserCode());
sendPack .setRealName(SessionUtil.getRealName());
sendPack.setDeptName(SessionUtil.getDepartName());
sendPack.setCreatedTime(DateUtil.now());
sendPack.setMaterialName(sendMaterialName);
sendPack.setMaterialDesc(sendMaterialName);
sendPack.setRootRowId(rootRowId);
sendPack.setMaterialNo("");//申请物料号
sendPack.setCategoryType(OptionalBomConstant.CategoryTypeEnum.TYPE_3.getValue());
try {
String data = materialService.addMaterial("", sendPack.getMaterialName(), OptionalBomConstant.PublishMaterialEnum.OTHER.getCategory());
// ResultVO<String> resultVO = JSON.parseObject(data, new com.alibaba.fastjson.TypeReference<ResultVO<String>>(){});

View File

@ -13,6 +13,12 @@
<result property="remak" column="remak" jdbcType="VARCHAR"/>
<result property="createdTime" column="created_time" jdbcType="VARCHAR"/>
<result property="createdBy" column="created_by" jdbcType="VARCHAR"/>
<result property="realName" column="real_name" jdbcType="VARCHAR"/>
<result property="deptName" column="dept_name" jdbcType="VARCHAR"/>
<result column="categoryType" property="category_type" jdbcType="INTEGER"/>
<result column="existStatus" property="exist_status" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List" >
row_id,parent_row_id,level_row_id,material_no,material_name,material_desc,drawing_no,remak,created_time,created_by,