退回等调整

This commit is contained in:
jing's 2024-01-06 21:25:17 +08:00
parent b29fdd0baf
commit 5119f698b6
15 changed files with 471 additions and 221 deletions

View File

@ -1,5 +1,7 @@
package com.nflg.product.bomnew.api.user; package com.nflg.product.bomnew.api.user;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -9,13 +11,18 @@ import com.nflg.product.bomnew.constant.FactoryCodeEnum;
import com.nflg.product.bomnew.constant.MBomConstantEnum; import com.nflg.product.bomnew.constant.MBomConstantEnum;
import com.nflg.product.bomnew.constant.ValueEnum; import com.nflg.product.bomnew.constant.ValueEnum;
import com.nflg.product.bomnew.pojo.dto.BomNewMBomChildDTO; import com.nflg.product.bomnew.pojo.dto.BomNewMBomChildDTO;
import com.nflg.product.bomnew.pojo.dto.BomNewMbomApplyBackMaterialDTO;
import com.nflg.product.bomnew.pojo.query.BomNewMbomBackMaterialQuery;
import com.nflg.product.bomnew.pojo.query.BomNewMbomParentQuery; import com.nflg.product.bomnew.pojo.query.BomNewMbomParentQuery;
import com.nflg.product.bomnew.pojo.vo.BomNewMbomBackMaterialVO;
import com.nflg.product.bomnew.pojo.vo.BomNewMbomDetailVO; import com.nflg.product.bomnew.pojo.vo.BomNewMbomDetailVO;
import com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO; import com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO;
import com.nflg.product.bomnew.pojo.vo.BomNewMbomParentVO; import com.nflg.product.bomnew.pojo.vo.BomNewMbomParentVO;
import com.nflg.product.bomnew.service.BomNewMbomBackMaterialService;
import com.nflg.product.bomnew.service.BomNewMbomDetailService; import com.nflg.product.bomnew.service.BomNewMbomDetailService;
import com.nflg.product.bomnew.service.BomNewMbomParentService; import com.nflg.product.bomnew.service.BomNewMbomParentService;
import com.nflg.product.bomnew.util.EnumUtils; import com.nflg.product.bomnew.util.EnumUtils;
import com.nflg.product.bomnew.util.VUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
@ -47,6 +54,9 @@ public class MBomApi extends BaseApi {
@Resource @Resource
private BomNewMbomDetailService bomNewMbomDetailService; private BomNewMbomDetailService bomNewMbomDetailService;
@Resource
private BomNewMbomBackMaterialService bomNewMbomBackMaterialService;
/** /**
* 分页查询所有数据 * 分页查询所有数据
@ -91,7 +101,7 @@ public class MBomApi extends BaseApi {
@PostMapping("superSaterialList") @PostMapping("superSaterialList")
@ApiOperation("设置超级物料列表") @ApiOperation("设置超级物料列表")
public ResultVO<List<BomNewMbomDetailVO>> superSaterialList(@RequestParam(value = "rowId") Long rowId) { public ResultVO<List<BomNewMbomMiddleVO>> superSaterialList(@RequestParam(value = "rowId") Long rowId) {
if (Objects.isNull(rowId)) { if (Objects.isNull(rowId)) {
throw new NflgBusinessException(STATE.ParamErr, "选择行后操作"); throw new NflgBusinessException(STATE.ParamErr, "选择行后操作");
} }
@ -116,6 +126,42 @@ public class MBomApi extends BaseApi {
bomNewMbomDetailService.superSaterialStatusTag(rowId, status); bomNewMbomDetailService.superSaterialStatusTag(rowId, status);
return ResultVO.success(true); return ResultVO.success(true);
} }
@PostMapping("backListPage")
@ApiOperation("退回列表")
public ResultVO<Page<BomNewMbomBackMaterialVO>> backListPage(@RequestBody BomNewMbomBackMaterialQuery query){
return ResultVO.success(bomNewMbomBackMaterialService.backListPage(query));
}
@PostMapping("applyBack")
@ApiOperation("申请退回")
public ResultVO<Boolean> applyBack(@RequestBody BomNewMbomApplyBackMaterialDTO dto){
VUtils.isTure(CollectionUtil.isEmpty(dto.getRowIds())).throwMessage("选择申请退回数据");
bomNewMbomBackMaterialService.applyBack(dto);
return ResultVO.success(true);
}
@PostMapping("rejectBack")
@ApiOperation("申请驳回")
public ResultVO<Boolean> rejectBack(@RequestBody List<Long> rowIds){
VUtils.isTure(CollectionUtil.isEmpty(rowIds)).throwMessage("选择驳回的数据");
bomNewMbomBackMaterialService.rejectBack(rowIds);
return ResultVO.success(true);
}
@PostMapping("confirmBack")
@ApiOperation("确认退回")
public ResultVO<Boolean> confirmBack(@RequestBody List<Long> rowIds){
VUtils.isTure(CollectionUtil.isEmpty(rowIds)).throwMessage("选择确认的数据");
bomNewMbomBackMaterialService.confirmBack(rowIds);
return ResultVO.success(true);
}
} }

View File

@ -31,7 +31,18 @@ public class MBomConstantEnum {
} }
@AllArgsConstructor
@Getter
public enum MBomBackStatusEnum implements ValueEnum<Integer> {
//状态 0-待处理 1-已处理 2- 驳回
APPLY_0(0, "待处理"),
DEAL_1 (1, "已处理"),
REJECT_2 (2, "驳回"),
;
private final Integer value;
private final String description;
}
} }

View File

@ -1,7 +1,13 @@
package com.nflg.product.bomnew.mapper.master; package com.nflg.product.bomnew.mapper.master;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nflg.product.bomnew.pojo.entity.BomNewMbomBackMaterialEntity; import com.nflg.product.bomnew.pojo.entity.BomNewMbomBackMaterialEntity;
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
import com.nflg.product.bomnew.pojo.query.BomNewMbomBackMaterialQuery;
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
import com.nflg.product.bomnew.pojo.vo.BomNewMbomBackMaterialVO;
import org.apache.ibatis.annotations.Param;
/** /**
* t_bom_new_mbom_back_material 表数据库访问层 * t_bom_new_mbom_back_material 表数据库访问层
@ -11,4 +17,11 @@ import com.nflg.product.bomnew.pojo.entity.BomNewMbomBackMaterialEntity;
* @since 2024-01-01 10:53:12 * @since 2024-01-01 10:53:12
*/ */
public interface BomNewMbomBackMaterialMapper extends BaseMapper<BomNewMbomBackMaterialEntity> { public interface BomNewMbomBackMaterialMapper extends BaseMapper<BomNewMbomBackMaterialEntity> {
Page<BomNewMbomBackMaterialVO> getListPage(Page<BomNewMbomBackMaterialVO> page, @Param("query") BomNewMbomBackMaterialQuery query );
} }

View File

@ -0,0 +1,34 @@
package com.nflg.product.bomnew.pojo.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;
/**
* t_bom_new_mbom_back_material
* ebom-退回物料列表
*
* @author makejava
* @since 2024-01-01 10:53:15
*/
@Data
@Accessors(chain = true)
@ApiModel(value="com-nflg-product-bomnew-pojo-new-dto-BomNewMbomApplyBackMaterialDTO")
public class BomNewMbomApplyBackMaterialDTO implements Serializable {
/**
*
*/
@ApiModelProperty(value = "退回对象")
private List<BomNewMbomBackMaterialDTO> rowIds;
@ApiModelProperty(value = "退回原因")
private String reasonMsg;
}

View File

@ -28,52 +28,34 @@ public class BomNewMbomBackMaterialDTO implements Serializable {
private Long rowId; private Long rowId;
/** /**
* 退回的row_id(和ebom表row_id 关联) *
*/ */
@ApiModelProperty(value = "退回的row_id(和ebom表row_id 关联)") @ApiModelProperty(value = "bomRowId")
private Long sourceId; private Long bomRowId;
/** /**
* 退回人名称 * 退回人名称
*/ */
@ApiModelProperty(value = "退回人名称") // @ApiModelProperty(value = "退回人名称")
private String backUserName; // private String backUserName;
//
/** // /**
* 退回人工号 // * 退回人工号
*/ // */
@ApiModelProperty(value = "退回人工号") // @ApiModelProperty(value = "退回人工号")
private String backUserCode; // private String backUserCode;
//
/** //
* 状态 0-待处理 1-已处理 // /**
*/ // * 确认人工号
@ApiModelProperty(value = "状态 0-待处理 1-已处理") // */
private Integer status; // @ApiModelProperty(value = "确认人工号")
// private String confirmUserCode;
/** //
* 确认人工号 // /**
*/ // * 确认人名称
@ApiModelProperty(value = "确认人工号") // */
private String confirmUserCode; // @ApiModelProperty(value = "确认人名称")
// private String confirmUserName;
/**
* 确认人名称
*/
@ApiModelProperty(value = "确认人名称")
private String confirmUserName;
/**
* 确认时间
*/
@ApiModelProperty(value = "确认时间")
private LocalDateTime confirmTime;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private LocalDateTime createdTime;
private static final long serialVersionUID = 1L;
} }

View File

@ -1,17 +1,21 @@
package com.nflg.product.bomnew.pojo.entity; package com.nflg.product.bomnew.pojo.entity;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalDate; import java.time.LocalDate;
/** /**
* t_bom_new_mbom_back_material * t_bom_new_mbom_back_material
* ebom-退回物料列表 * ebom-退回物料列表
* *
* @author makejava * @author makejava
@ -19,22 +23,22 @@ import java.time.LocalDate;
*/ */
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@ApiModel(value="com-nflg-product-bomnew-pojo-new-entity-BomNewMbomBackMaterialEntity") @ApiModel(value = "com-nflg-product-bomnew-pojo-new-entity-BomNewMbomBackMaterialEntity")
@TableName(value = "t_bom_new_mbom_back_material") @TableName(value = "t_bom_new_mbom_back_material")
public class BomNewMbomBackMaterialEntity implements Serializable { public class BomNewMbomBackMaterialEntity implements Serializable {
/** /**
* 主键行ID * 主键行ID
*/ */
@TableId(value = "row_id", type = IdType.ASSIGN_ID) @TableId(value = "row_id", type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键行ID") @ApiModelProperty(value = "主键行ID")
private Long rowId; private Long rowId;
/** /**
* 退回的row_id(和ebom表row_id 关联) * 退回的row_id(和ebom表row_id 关联)
*/ */
@TableField(value = "source_row_id") @TableField(value = "source_row_id")
@ApiModelProperty(value = "退回的row_id pbom表") @ApiModelProperty(value = "退回的row_id pbom表")
private Long sourceRowId; private Long sourceRowId;
@TableField(value = "detail_row_id") @TableField(value = "detail_row_id")
@ -49,52 +53,57 @@ public class BomNewMbomBackMaterialEntity implements Serializable {
/** /**
* 退回人名称 * 退回人名称
*/ */
@TableField(value = "back_user_name") @TableField(value = "back_user_name")
@ApiModelProperty(value = "退回人名称") @ApiModelProperty(value = "退回人名称")
private String backUserName; private String backUserName;
/** /**
* 退回人工号 * 退回人工号
*/ */
@TableField(value = "back_user_code") @TableField(value = "back_user_code")
@ApiModelProperty(value = "退回人工号") @ApiModelProperty(value = "退回人工号")
private String backUserCode; private String backUserCode;
/** /**
* 状态 0-待处理 1-已处理 * 状态 0-待处理 1-已处理
*/ */
@TableField(value = "status") @TableField(value = "back_status")
@ApiModelProperty(value = "状态 0-待处理 1-已处理") @ApiModelProperty(value = "状态 0-待处理 1-已处理 2- 驳回")
private Integer status; private Integer backStatus;
/** /**
* 确认人工号 * 确认人工号
*/ */
@TableField(value = "confirm_user_code") @TableField(value = "confirm_user_code")
@ApiModelProperty(value = "确认人工号") @ApiModelProperty(value = "确认人工号")
private String confirmUserCode; private String confirmUserCode;
/** /**
* 确认人名称 * 确认人名称
*/ */
@TableField(value = "confirm_user_name") @TableField(value = "confirm_user_name")
@ApiModelProperty(value = "确认人名称") @ApiModelProperty(value = "确认人名称")
private String confirmUserName; private String confirmUserName;
/** /**
* 确认时间 * 确认时间
*/ */
@TableField(value = "confirm_time") @TableField(value = "confirm_time")
@ApiModelProperty(value = "确认时间") @ApiModelProperty(value = "确认时间")
private LocalDateTime confirmTime; private LocalDateTime confirmTime;
/** /**
* 创建时间 * 创建时间
*/ */
@TableField(value = "created_time") @TableField(value = "created_time")
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private LocalDateTime createdTime; private LocalDateTime createdTime;
@TableField(value = "reason_msg")
@ApiModelProperty(value = "退回原因")
private String reasonMsg;
private static final long serialVersionUID = -35414988190486329L; private static final long serialVersionUID = -35414988190486329L;
} }

View File

@ -19,97 +19,46 @@ import java.time.LocalDate;
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@ApiModel(value="com-nflg-product-bomnew-pojo-new-query-BomNewMbomBackMaterialEntityQuery") @ApiModel(value="com-nflg-product-bomnew-pojo-new-query-BomNewMbomBackMaterialEntityQuery")
public class BomNewMbomBackMaterialQuery implements Serializable { public class BomNewMbomBackMaterialQuery extends BasePageQuery implements Serializable {
/** /**
* 主键行ID * 图号
*/ */
@ApiModelProperty(value = "主键行ID") @ApiModelProperty(value = "图号")
private Long rowId; private String drawingNo;
/** /**
* 退回的row_id(和ebom表row_id 关联) * 物料编码
*/
@ApiModelProperty(value = "退回的row_id(和ebom表row_id 关联)")
private Long sourceId;
/**
* 退回人名称
*/
@ApiModelProperty(value = "退回人名称")
private String backUserName;
/**
* 退回人工号
*/
@ApiModelProperty(value = "退回人工号")
private String backUserCode;
/**
* 状态 0-待处理 1-已处理
*/
@ApiModelProperty(value = "状态 0-待处理 1-已处理")
private Integer status;
/**
* 确认人工号
*/
@ApiModelProperty(value = "确认人工号")
private String confirmUserCode;
/**
* 确认人名称
*/
@ApiModelProperty(value = "确认人名称")
private String confirmUserName;
/**
* 确认时间
*/
@ApiModelProperty(value = "确认时间")
private LocalDateTime confirmTime;
/**
* 开始确认时间
*/
@ApiModelProperty(value = "确认时间开始时间")
private LocalDateTime confirmTimeStart;
/**
* 结束确认时间
*/
@ApiModelProperty(value = "确认时间结束时间")
private LocalDateTime confirmTimeEnd;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private LocalDateTime createdTime;
/**
* 开始创建时间
*/
@ApiModelProperty(value = "创建时间开始时间")
private LocalDateTime createdTimeStart;
/**
* 结束创建时间
*/
@ApiModelProperty(value = "创建时间结束时间")
private LocalDateTime createdTimeEnd;
/**
* 设置每页显示条数
*/ */
@ApiModelProperty(value = "设置每页显示条数") @ApiModelProperty(value = "物料编码")
private Long pageSize = 20L; private String materialNo;
/** /**
* 当前页 * 订单号
*/ */
@ApiModelProperty(value = "当前页") @ApiModelProperty(value = "订单号")
private Long page = 1L; private String orderNo;
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "开始时间")
private String startDate;
/**
*
*/
@ApiModelProperty(value = "结束时间")
private String endDate;
} }

View File

@ -19,19 +19,11 @@ import java.time.LocalDate;
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@ApiModel(value="com-nflg-product-bomnew-pojo-new-vo-BomNewMbomBackMaterialEntityVO") @ApiModel(value="com-nflg-product-bomnew-pojo-new-vo-BomNewMbomBackMaterialEntityVO")
public class BomNewMbomBackMaterialVO implements Serializable { public class BomNewMbomBackMaterialVO extends BomNewMbomMiddleVO {
/**
* 主键行ID
*/
@ApiModelProperty(value = "主键行ID")
private Long rowId;
/**
* 退回的row_id(和ebom表row_id 关联)
*/
@ApiModelProperty(value = "退回的row_id(和ebom表row_id 关联)")
private Long sourceId;
/** /**
* 退回人名称 * 退回人名称
@ -45,11 +37,11 @@ public class BomNewMbomBackMaterialVO implements Serializable {
@ApiModelProperty(value = "退回人工号") @ApiModelProperty(value = "退回人工号")
private String backUserCode; private String backUserCode;
/** // /**
* 状态 0-待处理 1-已处理 // * 状态 0-待处理 1-已处理
*/ // */
@ApiModelProperty(value = "状态 0-待处理 1-已处理") // @ApiModelProperty(value = "状态 0-待处理 1-已处理")
private Integer status; // private Integer status;
/** /**
* 确认人工号 * 确认人工号
@ -69,11 +61,7 @@ public class BomNewMbomBackMaterialVO implements Serializable {
@ApiModelProperty(value = "确认时间") @ApiModelProperty(value = "确认时间")
private LocalDateTime confirmTime; private LocalDateTime confirmTime;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private LocalDateTime createdTime;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -20,7 +20,7 @@ import java.time.LocalDate;
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@ApiModel(value="com-nflg-product-bomnew-pojo-new-vo-BomNewMbomDetailEntityVO") @ApiModel(value="com-nflg-product-bomnew-pojo-new-vo-BomNewMbomDetailEntityVO")
public class BomNewMbomDetailVO implements Serializable { public class BomNewMbomDetailVO implements Serializable {
/** /**
* 主键行ID-雪花 * 主键行ID-雪花

View File

@ -1,5 +1,8 @@
package com.nflg.product.bomnew.pojo.vo; package com.nflg.product.bomnew.pojo.vo;
import cn.hutool.core.util.StrUtil;
import com.nflg.product.bomnew.constant.FactoryCodeEnum;
import com.nflg.product.bomnew.util.EnumUtils;
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;
@ -58,7 +61,17 @@ public class BomNewMbomMiddleVO extends BaseMaterialVO implements Serializable {
*/ */
@ApiModelProperty(value = "工厂编码") @ApiModelProperty(value = "工厂编码")
private String facCode; private String facCode;
@ApiModelProperty(value = "工厂名")
private String facName;
public String getFacName(){
if(StrUtil.isNotBlank(facCode)){
return EnumUtils.getEnumDescription(FactoryCodeEnum.class,facCode);
}
return "";
}
/** /**
@ -214,6 +227,8 @@ public class BomNewMbomMiddleVO extends BaseMaterialVO implements Serializable {
return 0; return 0;
} }
@ApiModelProperty(value = "状态 0-待处理 1-已处理 2- 驳回")
private Integer backStatus;
private List<BomNewMbomMiddleVO> childNodes = Collections.emptyList(); private List<BomNewMbomMiddleVO> childNodes = Collections.emptyList();

View File

@ -1,11 +1,31 @@
package com.nflg.product.bomnew.service; package com.nflg.product.bomnew.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nflg.product.base.core.conmon.util.SessionUtil;
import com.nflg.product.base.core.exception.NflgBusinessException;
import com.nflg.product.bomnew.constant.MBomConstantEnum;
import com.nflg.product.bomnew.mapper.master.BomNewMbomBackMaterialMapper; import com.nflg.product.bomnew.mapper.master.BomNewMbomBackMaterialMapper;
import com.nflg.product.bomnew.pojo.dto.BomNewMbomApplyBackMaterialDTO;
import com.nflg.product.bomnew.pojo.dto.BomNewMbomBackMaterialDTO;
import com.nflg.product.bomnew.pojo.entity.BomNewMbomBackMaterialEntity; import com.nflg.product.bomnew.pojo.entity.BomNewMbomBackMaterialEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewMbomDetailEntity;
import com.nflg.product.bomnew.pojo.query.BomNewMbomBackMaterialQuery;
import com.nflg.product.bomnew.pojo.query.BomNewMbomParentQuery;
import com.nflg.product.bomnew.pojo.vo.BomNewMbomBackMaterialVO;
import nflg.product.common.constant.STATE;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* t_bom_new_mbom_back_material 表服务实现类 * t_bom_new_mbom_back_material 表服务实现类
@ -17,4 +37,128 @@ import org.springframework.stereotype.Service;
@Service @Service
public class BomNewMbomBackMaterialService extends ServiceImpl<BomNewMbomBackMaterialMapper, BomNewMbomBackMaterialEntity> { public class BomNewMbomBackMaterialService extends ServiceImpl<BomNewMbomBackMaterialMapper, BomNewMbomBackMaterialEntity> {
public Page<BomNewMbomBackMaterialVO> backListPage(BomNewMbomBackMaterialQuery query) {
Page<BomNewMbomBackMaterialVO> page = this.getBaseMapper().getListPage(new Page<>(query.getPage(), query.getPageSize()), query);
return page;
}
/**
* 驳回
* @param rowIds
*/
public void rejectBack(List<Long> rowIds ){
QueryWrapper<BomNewMbomBackMaterialEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().in(BomNewMbomBackMaterialEntity::getRowId,rowIds);
queryWrapper.lambda().eq(BomNewMbomBackMaterialEntity::getBackStatus, MBomConstantEnum.MBomBackStatusEnum.REJECT_2.getValue());
List<BomNewMbomBackMaterialEntity> backList=getBaseMapper().selectList(queryWrapper);
if(CollectionUtil.isNotEmpty(backList)){
throw new NflgBusinessException(STATE.BusinessError,"选择数据存在已驳回不能重复驳回");
}
List<BomNewMbomBackMaterialEntity> updateList=new ArrayList<>();
rowIds.forEach(id->{
BomNewMbomBackMaterialEntity bean=new BomNewMbomBackMaterialEntity();
bean.setRowId(id);
bean.setBackStatus(MBomConstantEnum.MBomBackStatusEnum.REJECT_2.getValue());
bean.setConfirmTime(LocalDateTime.now());
bean.setConfirmUserCode(SessionUtil.getUserCode());
bean.setConfirmUserName(SessionUtil.getUserName());
updateList.add(bean);
});
if(CollectionUtil.isNotEmpty(updateList)){
this.updateBatchById(updateList);
}
}
/**
* 退回
*
*/
public void applyBack(BomNewMbomApplyBackMaterialDTO dto ){
List<BomNewMbomBackMaterialDTO> rowIds=dto.getRowIds();
//是否存在退回
List<Long> backRowId=rowIds.stream().map(BomNewMbomBackMaterialDTO::getRowId).collect(Collectors.toList());
QueryWrapper<BomNewMbomBackMaterialEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().in(BomNewMbomBackMaterialEntity::getDetailRowId,backRowId);
List<BomNewMbomBackMaterialEntity> backList=getBaseMapper().selectList(queryWrapper);
if(CollectionUtil.isNotEmpty(backList)){
throw new NflgBusinessException(STATE.BusinessError,"选择数据已申请退回");
}
QueryWrapper<BomNewMbomDetailEntity> queryWrapper2=new QueryWrapper<>();
queryWrapper2.lambda().in(BomNewMbomDetailEntity::getRowId,backRowId);
List<BomNewMbomDetailEntity> list= SpringUtil.getBean(BomNewMbomDetailService.class).list(queryWrapper2);
if(CollectionUtil.isNotEmpty(list)){
List<BomNewMbomBackMaterialEntity> saveBackList=new ArrayList<>();
list.forEach(item->{
BomNewMbomBackMaterialEntity beanBack=new BomNewMbomBackMaterialEntity();
beanBack.setBomRowId(item.getBomRowId());
beanBack.setDetailRowId(item.getRowId());
beanBack.setSourceRowId(item.getSourceRowId());
beanBack.setBackStatus(MBomConstantEnum.MBomBackStatusEnum.APPLY_0.getValue());
beanBack.setBackUserName(SessionUtil.getRealName());
beanBack.setBackUserCode(SessionUtil.getUserCode());
beanBack.setCreatedTime(LocalDateTime.now());
beanBack.setReasonMsg(dto.getReasonMsg());
saveBackList.add(beanBack);
});
this.saveBatch(saveBackList);
}
}
/**
* 确认退回
* @param rowIds
*/
public void confirmBack(List<Long> rowIds ){
QueryWrapper<BomNewMbomBackMaterialEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().in(BomNewMbomBackMaterialEntity::getRowId,rowIds);
List<BomNewMbomBackMaterialEntity> backList=getBaseMapper().selectList(queryWrapper);
Map<Integer,List<BomNewMbomBackMaterialEntity>> groupBackMap=backList.stream().collect(Collectors.groupingBy(BomNewMbomBackMaterialEntity::getBackStatus));
if(CollectionUtil.isNotEmpty(groupBackMap.get(MBomConstantEnum.MBomBackStatusEnum.DEAL_1.getValue()))){
throw new NflgBusinessException(STATE.BusinessError,"选择数据存在已确认退回");
}
if(CollectionUtil.isNotEmpty(groupBackMap.get(MBomConstantEnum.MBomBackStatusEnum.REJECT_2.getValue()))){
throw new NflgBusinessException(STATE.BusinessError,"选择数据存在已驳回");
}
List<BomNewMbomBackMaterialEntity> updateList=new ArrayList<>();
rowIds.forEach(id->{
BomNewMbomBackMaterialEntity bean=new BomNewMbomBackMaterialEntity();
bean.setRowId(id);
bean.setBackStatus(MBomConstantEnum.MBomBackStatusEnum.DEAL_1.getValue());
bean.setConfirmTime(LocalDateTime.now());
bean.setConfirmUserCode(SessionUtil.getUserCode());
bean.setConfirmUserName(SessionUtil.getUserName());
updateList.add(bean);
});
if(CollectionUtil.isNotEmpty(updateList)){
this.updateBatchById(updateList);
}
}
} }

View File

@ -15,6 +15,7 @@ import com.nflg.product.bomnew.mapper.master.BomNewMbomDetailMapper;
import com.nflg.product.bomnew.pojo.entity.BomNewMbomDetailEntity; import com.nflg.product.bomnew.pojo.entity.BomNewMbomDetailEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewMbomParentEntity; import com.nflg.product.bomnew.pojo.entity.BomNewMbomParentEntity;
import com.nflg.product.bomnew.pojo.vo.BomNewMbomDetailVO; import com.nflg.product.bomnew.pojo.vo.BomNewMbomDetailVO;
import com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO;
import nflg.product.common.constant.STATE; import nflg.product.common.constant.STATE;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -33,33 +34,25 @@ import java.util.Objects;
public class BomNewMbomDetailService extends ServiceImpl<BomNewMbomDetailMapper, BomNewMbomDetailEntity> { public class BomNewMbomDetailService extends ServiceImpl<BomNewMbomDetailMapper, BomNewMbomDetailEntity> {
/** public List<BomNewMbomMiddleVO> superSaterialList(Long rowId) {
* 退回
* @param rowId
*/
public void back(List<Long> rowId){
BomNewMbomParentEntity parent = SpringUtil.getBean(BomNewMbomParentService.class).getById(rowId);
QueryWrapper<BomNewMbomDetailEntity> queryWrapper = new QueryWrapper<>();
if (parent != null) {
queryWrapper.lambda().eq(BomNewMbomDetailEntity::getBomRowId, rowId);
queryWrapper.lambda().eq(BomNewMbomDetailEntity::getParentRowId, 0l);
} else {
queryWrapper.lambda().eq(BomNewMbomDetailEntity::getParentRowId, rowId);
}
List<BomNewMbomDetailEntity> list = this.list(queryWrapper);
List<BomNewMbomMiddleVO> voList = Convert.convert(new TypeReference<List<BomNewMbomMiddleVO>>() {
}, list);
return voList;
} }
public List<BomNewMbomDetailVO> superSaterialList(Long rowId){
QueryWrapper<BomNewMbomDetailEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(BomNewMbomDetailEntity::getParentRowId,rowId);
List<BomNewMbomDetailEntity> list= this.list(queryWrapper);
List<BomNewMbomDetailVO> voList= Convert.convert(new TypeReference<List<BomNewMbomDetailVO>>() {
} ,list);
return voList;
}
/** /**
* 超级物料标签 * 超级物料标签
* <p> * <p>
@ -77,7 +70,7 @@ public List<BomNewMbomDetailVO> superSaterialList(Long rowId){
} }
BomNewMbomParentEntity parentEntity = SpringUtil.getBean(BomNewMbomParentService.class).getById(entity.getBomRowId()); BomNewMbomParentEntity parentEntity = SpringUtil.getBean(BomNewMbomParentService.class).getById(entity.getBomRowId());
if (parentEntity == null) { if (parentEntity == null) {
throw new NflgBusinessException(STATE.Error, "数据不存在"); throw new NflgBusinessException(STATE.Error, "顶层数据不存在");
} }
if (Objects.equals(MBomConstantEnum.MBomStatusEnum.PUB_SAP.getValue(), parentEntity.getStatus())) { if (Objects.equals(MBomConstantEnum.MBomStatusEnum.PUB_SAP.getValue(), parentEntity.getStatus())) {
@ -96,13 +89,13 @@ public List<BomNewMbomDetailVO> superSaterialList(Long rowId){
//当前数据已是超级物料 //当前数据已是超级物料
if (Objects.equals(MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue(), entity.getSuperMaterialStatus())) { if (Objects.equals(MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue(), entity.getSuperMaterialStatus())) {
throw new NflgBusinessException(STATE.Error, StrUtil.format("物料{}已为超级物料", entity.getMaterialNo())); throw new NflgBusinessException(STATE.Error, StrUtil.format("选择行物料{}已为超级物料", entity.getMaterialNo()));
} }
//parentRowId 空情况 //parentRowId 空情况
if (entity.getParentRowId() == null) { if (Objects.isNull(entity.getParentRowId()) || entity.getParentRowId().longValue() == 0) {
QueryWrapper<BomNewMbomDetailEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<BomNewMbomDetailEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().isNull(BomNewMbomDetailEntity::getParentRowId) queryWrapper.lambda().eq(BomNewMbomDetailEntity::getParentRowId, 0l)
.eq(BomNewMbomDetailEntity::getSuperMaterialStatus, MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue()); .eq(BomNewMbomDetailEntity::getSuperMaterialStatus, MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue());
List<BomNewMbomDetailEntity> list = this.list(queryWrapper); List<BomNewMbomDetailEntity> list = this.list(queryWrapper);
if (CollectionUtil.isNotEmpty(list)) { if (CollectionUtil.isNotEmpty(list)) {
@ -117,7 +110,7 @@ public List<BomNewMbomDetailVO> superSaterialList(Long rowId){
throw new NflgBusinessException(STATE.Error, "数据异常联系管理员"); throw new NflgBusinessException(STATE.Error, "数据异常联系管理员");
} }
if (!Objects.equals(MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue(), parentDetail.getSuperMaterialStatus())) { if (!Objects.equals(MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue(), parentDetail.getSuperMaterialStatus())) {
throw new NflgBusinessException(STATE.Error, "父级不为超级物料,不能设置子级为超级物料"); throw new NflgBusinessException(STATE.Error, "父级不为超级物料,子级不能设置为超级物料");
} }
//check 同级不能多个超级物料 //check 同级不能多个超级物料
QueryWrapper<BomNewMbomDetailEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<BomNewMbomDetailEntity> queryWrapper = new QueryWrapper<>();

View File

@ -2,6 +2,7 @@ package com.nflg.product.bomnew.service;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nflg.product.bomnew.constant.MBomConstantEnum; import com.nflg.product.bomnew.constant.MBomConstantEnum;
@ -37,6 +38,7 @@ public class BomNewMbomParentService extends ServiceImpl<BomNewMbomParentMapper,
public Page<BomNewMbomMiddleVO> workListPage(BomNewMbomParentQuery query) { public Page<BomNewMbomMiddleVO> workListPage(BomNewMbomParentQuery query) {
query.setStatus(MBomConstantEnum.MBomStatusEnum.UNPUB_SAP.getValue()); query.setStatus(MBomConstantEnum.MBomStatusEnum.UNPUB_SAP.getValue());
query.setFacCode(SpringUtil.getBean(UserRoleService.class).getUserFactory());
return listPage(query); return listPage(query);
} }
@ -48,7 +50,7 @@ public class BomNewMbomParentService extends ServiceImpl<BomNewMbomParentMapper,
page = this.getBaseMapper().indexListPage(new Page<>(query.getPage(), query.getPageSize()), query); page = this.getBaseMapper().indexListPage(new Page<>(query.getPage(), query.getPageSize()), query);
if (CollectionUtil.isNotEmpty(page.getRecords())) { if (CollectionUtil.isNotEmpty(page.getRecords())) {
List<BomNewMbomMiddleVO> indexList = page.getRecords().stream().collect(Collectors.toList()); List<BomNewMbomMiddleVO> indexList = page.getRecords().stream().collect(Collectors.toList());
;
page.getRecords().clear(); page.getRecords().clear();
for (BomNewMbomMiddleVO item : for (BomNewMbomMiddleVO item :
indexList) { indexList) {
@ -68,12 +70,16 @@ public class BomNewMbomParentService extends ServiceImpl<BomNewMbomParentMapper,
//不是通过物料或图号搜索 //不是通过物料或图号搜索
page = this.getBaseMapper().getMBomListPage(new Page<>(query.getPage(), query.getPageSize()), query); page = this.getBaseMapper().getMBomListPage(new Page<>(query.getPage(), query.getPageSize()), query);
return page; return page;
} }
public Page<BomNewMbomMiddleVO> formalListPage(BomNewMbomParentQuery query) { public Page<BomNewMbomMiddleVO> formalListPage(BomNewMbomParentQuery query) {
query.setStatus(MBomConstantEnum.MBomStatusEnum.PUB_SAP.getValue()); query.setStatus(MBomConstantEnum.MBomStatusEnum.PUB_SAP.getValue());
query.setFacCode(SpringUtil.getBean(UserRoleService.class).getUserFactory());
return listPage(query); return listPage(query);
} }
@ -86,6 +92,8 @@ public class BomNewMbomParentService extends ServiceImpl<BomNewMbomParentMapper,
parent.setBomRowId(parent.getRowId()); parent.setBomRowId(parent.getRowId());
} }
Long _rowId = dto.getRowId(); Long _rowId = dto.getRowId();
if (Objects.equals(dto.getRowId(), dto.getBomRowId())) { if (Objects.equals(dto.getRowId(), dto.getBomRowId())) {
_rowId = 0l; _rowId = 0l;

View File

@ -12,19 +12,69 @@
<result column="bom_row_id" property="bomRowId" jdbcType="BIGINT"/> <result column="bom_row_id" property="bomRowId" jdbcType="BIGINT"/>
<result column="detail_row_id" property="detailRowId" jdbcType="BIGINT"/> <result column="detail_row_id" property="detailRowId" jdbcType="BIGINT"/>
<result column="back_user_name" property="backUserName" jdbcType="VARCHAR"/> <result column="back_user_name" property="backUserName" jdbcType="VARCHAR"/>
<result column="back_user_code" property="backUserCode" jdbcType="VARCHAR"/> <result column="back_user_code" property="backUserCode" jdbcType="VARCHAR"/>
<result column="status" property="status" jdbcType="INTEGER"/> <result column="back_status" property="backStatus" jdbcType="INTEGER"/>
<result column="confirm_user_code" property="confirmUserCode" jdbcType="VARCHAR"/> <result column="confirm_user_code" property="confirmUserCode" jdbcType="VARCHAR"/>
<result column="confirm_user_name" property="confirmUserName" jdbcType="VARCHAR"/> <result column="confirm_user_name" property="confirmUserName" jdbcType="VARCHAR"/>
<result column="confirm_time" property="confirmTime" jdbcType="TIMESTAMP"/> <result column="confirm_time" property="confirmTime" jdbcType="TIMESTAMP"/>
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP"/> <result column="created_time" property="createdTime" jdbcType="TIMESTAMP"/>
<result column="reason_msg" property="reasonMsg" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
<!--@mbg.generated--> <!--@mbg.generated-->
row_id, source_id, back_user_name, back_user_code, status, confirm_user_code, confirm_user_name, confirm_time, created_time </sql> row_id, source_id, back_user_name, back_user_code, status, confirm_user_code, confirm_user_name, confirm_time, created_time </sql>
<select id="getListPage" resultType="com.nflg.product.bomnew.pojo.vo.BomNewMbomBackMaterialVO">
select t1.*, t2.drawing_no,
t2. fac_code,
t2.material_no,
t2. material_name,
t2.material_desc,
t2.material_texture,
t2.material_unit,
t2.unit_weight,
t2.total_weight,
t2.num,
t2.project_type,
t2.super_material_status,
t2.virtual_part_is,
t2.remark,
t3.order_no
from t_bom_new_mbom_back_material as t1
left join t_bom_new_mbom_detail t2
on t1.detail_row_id=t2.row_id
left join t_bom_new_mbom_parent t3
on t1.bom_row_id=t3.row_id
order by t1.back_status asc,t1.created_time desc
<where>
<if test="query.drawingNo!=null and query.drawingNo!=''">
and t2.drawing_no=#{query.drawingNo}
</if>
<if test="query.materialNo!=null and query.materialNo!=''">
and t2.material_no=#{query.materialNo}
</if>
<if test="query.orderNo!=null and query.orderNo!=''">
and t3.order_no=#{query.orderNo}
</if>
<if test="query.startDate!=null and query.startDate!='' and query.endDate!=null and query.endDate!=''">
<![CDATA[ and t1.created_time >= #{query.startDate} and t1.created_time <=#{query.endDate}]]>
</if>
</where>
</select>
</mapper> </mapper>

View File

@ -81,8 +81,8 @@
<select id="getMBomListPage" resultType="com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO"> <select id="getMBomListPage" resultType="com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO">
select * from t_bom_new_mbom_parent select t1.*,t1.row_id as bomRowId ,(SELECT count(1) from t_bom_new_mbom_detail where parent_row_id=0 and bom_row_id=t1.row_id) as bom_exist from t_bom_new_mbom_parent t1
where `status`=#{query.status} where t1.`status`=#{query.status} and t1.last_version_is=1
<include refid="whrMore"/> <include refid="whrMore"/>
<if test="query.status!=null and query.status==3"> <if test="query.status!=null and query.status==3">
@ -112,7 +112,7 @@
</select> </select>
<select id="getParentById" resultType="com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO"> <select id="getParentById" resultType="com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO">
select t1.*,(SELECT count(1) from t_bom_new_mbom_detail where parent_row_id=t1.row_id) as bom_exist select t1.*,(SELECT count(1) from t_bom_new_mbom_detail where parent_row_id=0 and bom_row_id=t1.row_id) as bom_exist
from t_bom_new_mbom_parent as t1 from t_bom_new_mbom_parent as t1
where t1.row_id = #{rowId} where t1.row_id = #{rowId}
@ -121,20 +121,28 @@
<select id="indexListPage" resultType="com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO"> <select id="indexListPage" resultType="com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO">
SELECT max(row_id) row_id ,bom_row_id from t_bom_new_mbom_detail GROUP BY bom_row_id SELECT max(t1.row_id) as row_id ,t1.bom_row_id from t_bom_new_mbom_detail t1 left JOIN
where `status`=#{query.status} t_bom_new_mbom_parent t2
on t1.bom_row_id=t2.row_id
where t1.bom_row_id=t2.row_id and t2.last_version_is=1
<if test="query.facCode!=null and query.facCode!=''">
and t1.fac_code=#{query.facCode}
</if>
<if test="query.drawingNo!=null and query.drawingNo!=''"> <if test="query.drawingNo!=null and query.drawingNo!=''">
and drawing_no=#{query.drawingNo} and t1.drawing_no like concat ('',#{query.drawingNo},'%')
</if> </if>
<if test="query.materialNo!=null and query.materialNo!=''"> <if test="query.materialNo!=null and query.materialNo!=''">
and material_no=#{query.materialNo} and t1.material_no=#{query.materialNo}
</if> </if>
GROUP BY t1.bom_row_id
</select> </select>
<select id="searchList" resultType="com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO"> <select id="searchList" resultType="com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO">
<![CDATA[ <![CDATA[
SELECT t2.*,(SELECT count(1) from t_bom_new_mbom_detail where parent_id=t2.row_id) as bom_exist SELECT t2.*,(SELECT count(1) from t_bom_new_mbom_detail where parent_row_id=t2.row_id) as bom_exist
FROM FROM
( (
SELECT SELECT