Merge branch 'feature/DM/nflg-bom' of http://112.74.186.154:3000/nflj/nflg_project into feature/DM/nflg-bom

This commit is contained in:
jing's 2024-01-01 21:15:18 +08:00
commit cf1662caae
22 changed files with 940 additions and 393 deletions

View File

@ -1,19 +1,30 @@
package com.nflg.product.bomnew.api.user;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.nflg.product.base.core.api.BaseApi;
import com.nflg.product.bomnew.constant.PBomEditStatusEnum;
import com.nflg.product.bomnew.pojo.dto.EditPBomDelDTO;
import com.nflg.product.bomnew.pojo.dto.EditPBomParamDTO;
import com.nflg.product.bomnew.pojo.dto.TechnologyPackageParam;
import com.nflg.product.bomnew.pojo.entity.BomNewTechnologyPackageTypeEntity;
import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery;
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
import com.nflg.product.bomnew.pojo.vo.BomNewTechnologyPackageTypeVO;
import com.nflg.product.bomnew.service.BomNewPbomParentService;
import com.nflg.product.bomnew.service.BomNewTechnologyPackageTypeService;
import com.nflg.product.bomnew.util.VUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import nflg.product.common.vo.ResultVO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
/**
* t_bom_new_pbom_parent 表控制层
@ -22,7 +33,7 @@ import javax.annotation.Resource;
* @author makejava
* @since 2024-01-01 10:39:57
*/
@Api(tags = "接口")
@Api(tags = "PBom接口")
@RestController
@RequestMapping("pbom")
public class PBomApi extends BaseApi {
@ -33,18 +44,100 @@ public class PBomApi extends BaseApi {
@Resource
private BomNewPbomParentService bomNewPbomParentService;
/**
* 分页查询所有数据
*
* @param query Query 查询实体
* @return 所有数据
*/
@PostMapping("selectBomNewPbomParentEntityPageByCondition")
@ApiOperation("auto-按字段条件分页查询")
public ResultVO<IPage<BomNewPbomParentVO>> selectBomNewPbomParentEntityPageByCondition(@RequestBody BomNewPbomParentQuery query) {
@Resource
private BomNewTechnologyPackageTypeService technologyPackageTypeService;
@PostMapping("workDetailsListByPage")
@ApiOperation("PBom工作列表")
public ResultVO<IPage<BomNewPbomParentVO>> workDetailsListByPage(@RequestBody BomNewPbomParentQuery query) {
return ResultVO.success(bomNewPbomParentService.workDetailsListByPage(query));
}
@PostMapping("releaseListByPage")
@ApiOperation("PBom已发布工作列表")
public ResultVO<IPage<BomNewPbomParentVO>> releaseListByPage(@RequestBody BomNewPbomParentQuery query) {
return ResultVO.success();
}
@GetMapping("getChild")
@ApiOperation("获取子级")
public ResultVO<List<BomNewPbomParentVO>> getChild(@RequestParam("bomRowId") Long bomRowId){
return ResultVO.success(bomNewPbomParentService.getChild(bomRowId));
}
@PostMapping("editStaging")
@ApiOperation("编辑-暂存")
public ResultVO<Boolean> editStaging(@Valid @RequestBody EditPBomParamDTO param){
bomNewPbomParentService.editSave(param,PBomEditStatusEnum.HANDLER_TEMP);
return ResultVO.success(true);
}
@PostMapping("editSubmit")
@ApiOperation("编辑-提交")
public ResultVO<Boolean> editSubmit(@Valid @RequestBody EditPBomParamDTO param){
bomNewPbomParentService.editSave(param, PBomEditStatusEnum.HANDLER_FINISHED);
return ResultVO.success(true);
}
@PostMapping("editDel")
@ApiOperation("编辑-删除")
public ResultVO<Boolean> editDel(@Valid @RequestBody EditPBomDelDTO param){
VUtils.isTure(CollUtil.isEmpty(param.getRowIdList())).throwMessage("请选择要删除的数据行");
bomNewPbomParentService.editDel(param);
return ResultVO.success(true);
}
@PostMapping("setVirtualPart")
@ApiOperation("编辑-设置虚拟件")
public ResultVO<Boolean> setVirtualPart(@RequestBody List<Long> rowIdList){
VUtils.isTure(CollUtil.isEmpty(rowIdList)).throwMessage("请选择要设置虚拟件的行");
bomNewPbomParentService.setVirtualPart(rowIdList);
return ResultVO.success(true);
}
@GetMapping("editExport")
@ApiOperation("编辑-导出Excel")
public void editExport(@RequestParam("bomRowId") Long bomRowId, HttpServletResponse response) throws IOException {
bomNewPbomParentService.editExport(bomRowId,response);
}
@PostMapping("insertTechnologyPackage")
@ApiOperation("编辑-插入工艺包")
public ResultVO<Boolean> insertTechnologyPackage(@Valid @RequestBody TechnologyPackageParam packageParam){
return ResultVO.success(true);
}
@GetMapping("getTechnologyPackageList")
@ApiOperation("编辑-获取工艺包类型")
public ResultVO<List<BomNewTechnologyPackageTypeEntity> > getTechnologyPackageList(){
return ResultVO.success(technologyPackageTypeService.getBaseMapper().selectList(null));
}
@PostMapping("createTechnologyPackage")
@ApiOperation("编辑-创建虚拟包")
public ResultVO<BaseMaterialVO> createTechnologyPackage(TechnologyPackageParam packageParam) throws IOException {
return ResultVO.success( bomNewPbomParentService.createTechnologyPackage(packageParam));
}
}

View File

@ -0,0 +1,18 @@
package com.nflg.product.bomnew.constant;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum PBomEditStatusEnum implements ValueEnum<Integer>{
//1=待处理2=暂存 3=已处理
HANDLER_CREATED(1,"待处理"),
HANDLER_TEMP(2,"暂存"),
HANDLER_FINISHED(3,"已处理");
private final Integer value;
private final String description;
}

View File

@ -7,10 +7,12 @@ import lombok.Getter;
@AllArgsConstructor
public enum PBomStatusEnum implements ValueEnum<Integer>{
//1=EBOM生成2=暂存当编辑时状态改为暂存3=已发布
EBOM_GENERATE(1,"EBOM生成"),
TEMP_SAVE(2,"暂存"),
PUBLISH(3,"已发布");
//1=待发布 2=待分配工厂 3=已分配工厂 4=已发布
WAIT_PUBLISH(1,"待发布"),
WAIT_FACTORY(2,"待分配工厂"),
FACTORY_CONFIRM(3,"已分配工厂"),
PUBLISH(4,"已发布"),
BORROWED_PARTS(5, "借用件");

View File

@ -3,6 +3,9 @@ package com.nflg.product.bomnew.mapper.master;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* t_bom_new_pbom_child 表数据库访问层
@ -12,4 +15,8 @@ import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity;
* @since 2024-01-01 10:39:51
*/
public interface BomNewPbomChildMapper extends BaseMapper<BomNewPbomChildEntity> {
void delByRowId(@Param("rowIds")List<Long> rowIds);
void setVirtualPart(@Param("rowIds") List<Long> rowIds);
}

View File

@ -2,7 +2,13 @@ package com.nflg.product.bomnew.mapper.master;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery;
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* t_bom_new_pbom_parent 表数据库访问层
@ -12,4 +18,8 @@ import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
* @since 2024-01-01 10:39:58
*/
public interface BomNewPbomParentMapper extends BaseMapper<BomNewPbomParentEntity> {
Page<BomNewPbomParentVO> workDetailsListByPage(Page<BomNewPbomParentQuery> page, @Param("query") BomNewPbomParentQuery query , @Param("userFac") String userFac);
List<BomNewPbomParentVO> getParentChild(@Param("parentRowId") Long parentRowId);
}

View File

@ -0,0 +1,15 @@
package com.nflg.product.bomnew.mapper.master;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nflg.product.bomnew.pojo.entity.BomNewTechnologyPackageTypeEntity;
/**
* t_bom_new_technology_package_type 表数据库访问层
* 工艺包类型
*
* @author makejava
* @since 2024-01-01 17:24:58
*/
public interface BomNewTechnologyPackageTypeMapper extends BaseMapper<BomNewTechnologyPackageTypeEntity> {
}

View File

@ -37,6 +37,8 @@ public interface MaterialMainMapper extends BaseMapper<MaterialMainEntity> {
List<String> getUserPost(@Param("userRowId") Long userRowId);
Integer getUserMultiplantFacRoleCount(@Param("userRowId") Long userRowId);
}

View File

@ -0,0 +1,24 @@
package com.nflg.product.bomnew.pojo.dto;
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* 编辑-PBOM时 删除参数
*/
@Data
public class EditPBomDelDTO {
@ApiModelProperty("Bom行ID")
@NotNull(message = "Bom行ID不能为空")
private Long bomRowId;
@ApiModelProperty("子节点rowId列表")
List<Long> rowIdList;
}

View File

@ -0,0 +1,25 @@
package com.nflg.product.bomnew.pojo.dto;
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* 编辑-PBOM时 保存参数
*/
@Data
public class EditPBomParamDTO {
@ApiModelProperty("Bom行ID")
@NotNull(message = "Bom行ID不能为空")
private Long bomRowId;
@ApiModelProperty("子节点列表")
List<BomNewPbomParentVO> childList;
}

View File

@ -0,0 +1,36 @@
package com.nflg.product.bomnew.pojo.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* 插入工艺包参数
*/
@Data
public class TechnologyPackageParam {
@ApiModelProperty("bom行ID")
@NotNull(message = "bom行ID不能为空")
private Long bomRowId;
@ApiModelProperty("虚拟包层次 0-上级 1-下级")
@NotNull(message = "虚拟包层次不能为空")
private Integer levelBelong;
@ApiModelProperty("工艺包物料编码")
private String technologyPackageMaterialNo;
@ApiModelProperty("工艺包类型rowId(创建工艺包时用)")
private Long technologyPackageTypeRowId;
@ApiModelProperty("子级rowId列表")
private List<Long> rowIds;
}

View File

@ -0,0 +1,55 @@
package com.nflg.product.bomnew.pojo.entity;
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;
/**
* t_bom_new_technology_package_type
* 工艺包类型
*
* @author makejava
* @since 2024-01-01 17:24:58
*/
@Data
@Accessors(chain = true)
@ApiModel(value="com-nflg-product-bomnew-pojo-new-entity-BomNewTechnologyPackageTypeEntity")
@TableName(value = "t_bom_new_technology_package_type")
public class BomNewTechnologyPackageTypeEntity implements Serializable {
/**
* 主键
*/
@TableId(value = "row_id", type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private Long rowId;
/**
* 类型名称
*/
@TableField(value = "type_name")
@ApiModelProperty(value = "类型名称")
private String typeName;
/**
* 图号后缀
*/
@TableField(value = "drawing_no_suffix")
@ApiModelProperty(value = "图号后缀")
private String drawingNoSuffix;
/**
* 备注
*/
@TableField(value = "remark")
@ApiModelProperty(value = "备注")
private String remark;
private static final long serialVersionUID = 749385441704901887L;
}

View File

@ -23,17 +23,10 @@ import java.time.LocalDate;
public class BomNewPbomParentQuery implements Serializable {
/**
* 主键行ID-雪花
* 物料编码
*/
@ApiModelProperty(value = "主键行ID-雪花")
private Long rowId;
/**
* 批号-来自plm-临时
*/
@ApiModelProperty(value = "批号-来自plm-临时")
private String batchNo;
@ApiModelProperty(value = "物料编码")
private String materialNo;
/**
* 图号
*/
@ -46,269 +39,11 @@ public class BomNewPbomParentQuery implements Serializable {
@ApiModelProperty(value = "工厂编码")
private String facCode;
/**
* 物料编码
*/
@ApiModelProperty(value = "物料编码")
private String materialNo;
@ApiModelProperty(value = "开始时间")
private String startDate;
/**
* 排序号
*/
@ApiModelProperty(value = "排序号")
private String orderNumber;
/**
* 物料名称
*/
@ApiModelProperty(value = "物料名称")
private String materialName;
/**
* 物料描述
*/
@ApiModelProperty(value = "物料描述")
private String materialDesc;
/**
* 材质材料
*/
@ApiModelProperty(value = "材质,材料")
private String materialTexture;
/**
* 单位
*/
@ApiModelProperty(value = "单位")
private String materialUnit;
/**
* 单重
*/
@ApiModelProperty(value = "单重")
private BigDecimal unitWeight;
/**
* 总重
*/
@ApiModelProperty(value = "总重")
private BigDecimal totalWeight;
/**
* 版本号
*/
@ApiModelProperty(value = "版本号")
private String currentVersion;
/**
* 数量
*/
@ApiModelProperty(value = "数量")
private BigDecimal num;
/**
* 项目类别
*/
@ApiModelProperty(value = "项目类别")
private String projectType;
/**
* 是否跟节点 0- 1-
*/
@ApiModelProperty(value = "是否跟节点 0-否 1-是")
private Integer rootIs;
/**
* 是否应该有BOM 0- 1-
*/
@ApiModelProperty(value = "是否应该有BOM 0-否 1-是")
private Integer shouldBomExist;
/**
* 超级物料 0- 1-
*/
@ApiModelProperty(value = "超级物料 0-否 1-是")
private Integer superMaterialStatus;
/**
* 是否有BOM: 0- 1-
*/
@ApiModelProperty(value = "是否有BOM: 0-否 1-是")
private Integer bomExist;
/**
* 是否最新版0- 1-
*/
@ApiModelProperty(value = "是否最新版0-否 1-是")
private Integer lastVersionIs;
/**
* 1=待处理2=暂存 3=已处理
*/
@ApiModelProperty(value = "1=待处理、2=暂存 3=已处理")
private Integer editStatus;
/**
* BOM状态1=待发布 2=待分配工厂 3=已分配工厂 4=已发布
*/
@ApiModelProperty(value = "BOM状态1=待发布 2=待分配工厂 3=已分配工厂 4=已发布")
private Integer status;
/**
* 是否用户跟节点 0- 1-
*/
@ApiModelProperty(value = "是否用户跟节点 0-否 1-是")
private Integer userRootIs;
/**
* 是否虚拟包 0- 1-
*/
@ApiModelProperty(value = "是否虚拟包 0-否 1-是")
private Integer virtualPackageIs;
/**
* 来源行ID(EBOM中的行ID)
*/
@ApiModelProperty(value = "来源行ID(EBOM中的行ID)")
private Long sourceRowId;
/**
* 设计人员编码
*/
@ApiModelProperty(value = "设计人员编码")
private String deviseUserCode;
/**
* 设计人员名称
*/
@ApiModelProperty(value = "设计人员名称")
private String deviseName;
/**
* 创建人编码
*/
@ApiModelProperty(value = "创建人编码")
private String createdBy;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private LocalDateTime createdTime;
/**
* 开始创建时间
*/
@ApiModelProperty(value = "创建时间开始时间")
private LocalDateTime createdTimeStart;
/**
* 结束创建时间
*/
@ApiModelProperty(value = "创建时间结束时间")
private LocalDateTime createdTimeEnd;
/**
* 创建人员所属岗位 0-设计人员 1-工艺人员 2-其他
*/
@ApiModelProperty(value = "创建人员所属岗位 0-设计人员 1-工艺人员 2-其他")
private Integer createdJob;
/**
* 发布时间
*/
@ApiModelProperty(value = "发布时间")
private LocalDateTime releaseTime;
/**
* 开始发布时间
*/
@ApiModelProperty(value = "发布时间开始时间")
private LocalDateTime releaseTimeStart;
/**
* 结束发布时间
*/
@ApiModelProperty(value = "发布时间结束时间")
private LocalDateTime releaseTimeEnd;
/**
* 发布人
*/
@ApiModelProperty(value = "发布人")
private String releaseUserName;
/**
* 版本过期时间=下个版本的创建时间
*/
@ApiModelProperty(value = "版本过期时间=下个版本的创建时间")
private LocalDateTime expireEndTime;
/**
* 开始版本过期时间=下个版本的创建时间
*/
@ApiModelProperty(value = "版本过期时间=下个版本的创建时间开始时间")
private LocalDateTime expireEndTimeStart;
/**
* 结束版本过期时间=下个版本的创建时间
*/
@ApiModelProperty(value = "版本过期时间=下个版本的创建时间结束时间")
private LocalDateTime expireEndTimeEnd;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String remark;
/**
* 设计维护部门名称
*/
@ApiModelProperty(value = "设计维护部门名称")
private String deptName;
/**
* bom树的高度
*/
@ApiModelProperty(value = "bom树的高度")
private Integer levelNum;
/**
* 升版说明
*/
@ApiModelProperty(value = "升版说明")
private String changeDesc;
/**
* 通知单号
*/
@ApiModelProperty(value = "通知单号")
private String noticeNums;
/**
* 订单号
*/
@ApiModelProperty(value = "订单号")
private String orderNo;
/**
* 修改时间
*/
@ApiModelProperty(value = "修改时间")
private LocalDateTime modifyTime;
/**
* 开始修改时间
*/
@ApiModelProperty(value = "修改时间开始时间")
private LocalDateTime modifyTimeStart;
/**
* 结束修改时间
*/
@ApiModelProperty(value = "修改时间结束时间")
private LocalDateTime modifyTimeEnd;
@ApiModelProperty(value = "结束时间")
private String endDate;
/**
* 设置每页显示条数

View File

@ -0,0 +1,145 @@
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 org.ttzero.excel.annotation.ExcelColumn;
import javax.validation.Valid;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Objects;
/**
* pom编辑导出Excel模版
*/
@Data
@Accessors(chain = true)
public class BomNewPbomEditExcelVO implements Serializable {
@ExcelColumn(value = "排序号")
private String orderNumber;
@ExcelColumn(value = "项目类别")
private String projectType;
@ExcelColumn(value = "物料编码")
private String materialNo;
@ExcelColumn(value = "版本号")
private String currentVersion;
@ExcelColumn(value = "图号")
private String drawingNo;
@ExcelColumn(value = "物料描述")
private String materialDesc;
@ExcelColumn(value = "数量")
private BigDecimal num;
@ExcelColumn(value = "单位")
private String materialUnit;
@ExcelColumn(value = "总重")
private BigDecimal totalWeight;
private Integer bomExist;
@ExcelColumn(value = "有无下级")
private String bomExistName;
public String getBomExistName() {
return bomExist.equals(1)? "" : "";
}
private Integer superMaterialStatus;
@ExcelColumn(value = "是否超级物料")
private Integer superMaterialStatusName;
public String getSuperMaterialStatusName() {
return superMaterialStatus.equals(1)? "" : "";
}
@ExcelColumn(value = "物料分类")
private String categoryName;
private Integer virtualPartIs;
@ExcelColumn(value = "是否虚拟件")
private String virtualPartIsName;
public String getVirtualPartIsName() {
return virtualPartIs.equals(1)? "" : "";
}
@ExcelColumn(value = "创建时间")
private LocalDateTime createdTime;
@ExcelColumn(value = "更新时间")
private LocalDateTime modifyTime;
@ExcelColumn(value = "生效日期")
private LocalDateTime effectStartTime;
public LocalDateTime getEffectStartTime() {
return createdTime;
}
@ExcelColumn(value = "有效至")
private LocalDateTime expireEndTime;
@ApiModelProperty("物料状态 1:激活 2:禁止采购 3:售后专用 4:冻结 5:完全弃用")
private Integer materialState;
@ExcelColumn(value = "物料状态")
private String materialStateName;
private String[] materialStateNameArr= {"","激活","禁止采购","售后专用","冻结","完全弃用"};
@ExcelColumn(value = "物料状态")
public String getMaterialStateName() {
return materialState==null?"": materialStateNameArr[materialState];
}
@ApiModelProperty("BOM状态1=待发布 2=待分配工厂 3=已分配工厂 4=已发布")
public Integer status;
private String[] statusNameArr= {"","待发布","待分配工厂","已分配工厂","已发布"};
@ExcelColumn(value = "BOM状态")
public String statusName() {
return status==null?"": statusNameArr[status];
}
@ExcelColumn(value = "设计人员")
private String deviseName;
@ExcelColumn(value = "设计部门")
private String deptName;
@ExcelColumn(value = "升版说明")
private String changeDesc;
@ExcelColumn(value = "备注")
private String remark;
private static final long serialVersionUID = 1L;
}

View File

@ -20,25 +20,28 @@ import java.time.LocalDate;
@Data
@Accessors(chain = true)
@ApiModel(value="com-nflg-product-bomnew-pojo-new-vo-BomNewPbomParentEntityVO")
public class BomNewPbomParentVO implements Serializable {
public class BomNewPbomParentVO extends BaseMaterialVO implements Serializable {
/**
* 主键行ID-雪花
*/
@ApiModelProperty(value = "主键行ID-雪花")
private Long rowId;
private Long rowId=0L;
@ApiModelProperty("Bom行ID")
private Long bomRowId=0L;
@ApiModelProperty("父级行id")
private Long parentRowId=0L;
/**
* 批号-来自plm-临时
*/
@ApiModelProperty(value = "批号-来自plm-临时")
private String batchNo;
/**
* 图号
*/
@ApiModelProperty(value = "图号")
private String drawingNo;
/**
* 工厂编码
@ -46,11 +49,7 @@ public class BomNewPbomParentVO implements Serializable {
@ApiModelProperty(value = "工厂编码")
private String facCode;
/**
* 物料编码
*/
@ApiModelProperty(value = "物料编码")
private String materialNo;
/**
* 排序号
@ -58,29 +57,8 @@ public class BomNewPbomParentVO implements Serializable {
@ApiModelProperty(value = "排序号")
private String orderNumber;
/**
* 物料名称
*/
@ApiModelProperty(value = "物料名称")
private String materialName;
/**
* 物料描述
*/
@ApiModelProperty(value = "物料描述")
private String materialDesc;
/**
* 材质材料
*/
@ApiModelProperty(value = "材质,材料")
private String materialTexture;
/**
* 单位
*/
@ApiModelProperty(value = "单位")
private String materialUnit;
/**
* 单重
@ -106,11 +84,7 @@ public class BomNewPbomParentVO implements Serializable {
@ApiModelProperty(value = "数量")
private BigDecimal num;
/**
* 项目类别
*/
@ApiModelProperty(value = "项目类别")
private String projectType;
/**
* 是否跟节点 0- 1-
@ -262,5 +236,13 @@ public class BomNewPbomParentVO implements Serializable {
@ApiModelProperty(value = "修改时间")
private LocalDateTime modifyTime;
@ApiModelProperty("生产工厂")
private String productionFactoryCode;
@ApiModelProperty("是否虚拟件 0-否 1-是")
private Integer virtualPartIs;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,48 @@
package com.nflg.product.bomnew.pojo.vo;
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;
/**
* t_bom_new_technology_package_type
* 工艺包类型
*
* @author makejava
* @since 2024-01-01 17:25:00
*/
@Data
@Accessors(chain = true)
@ApiModel(value="com-nflg-product-bomnew-pojo-new-vo-BomNewTechnologyPackageTypeEntityVO")
public class BomNewTechnologyPackageTypeVO implements Serializable {
/**
* 主键
*/
@ApiModelProperty(value = "主键")
private Long rowId;
/**
* 类型名称
*/
@ApiModelProperty(value = "类型名称")
private String typeName;
/**
* 图号后缀
*/
@ApiModelProperty(value = "图号后缀")
private String drawingNoSuffix;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String remark;
private static final long serialVersionUID = 1L;
}

View File

@ -1,10 +1,45 @@
package com.nflg.product.bomnew.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil;
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.bomnew.constant.OriginalConstant;
import com.nflg.product.bomnew.constant.PBomEditStatusEnum;
import com.nflg.product.bomnew.constant.PBomStatusEnum;
import com.nflg.product.bomnew.mapper.master.BomNewPbomParentMapper;
import com.nflg.product.bomnew.pojo.dto.EditPBomDelDTO;
import com.nflg.product.bomnew.pojo.dto.EditPBomParamDTO;
import com.nflg.product.bomnew.pojo.dto.TechnologyPackageParam;
import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewTechnologyPackageTypeEntity;
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery;
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
import com.nflg.product.bomnew.pojo.vo.BomNewPbomEditExcelVO;
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
import com.nflg.product.bomnew.util.EecExcelUtil;
import com.nflg.product.bomnew.util.ListCommonUtil;
import com.nflg.product.bomnew.util.MaterialshouldBomExistUtil;
import com.nflg.product.bomnew.util.VUtils;
import org.apache.tomcat.util.http.ResponseUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.ttzero.excel.entity.Workbook;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
@ -16,4 +51,213 @@ import org.springframework.stereotype.Service;
@Service
public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper, BomNewPbomParentEntity> {
@Resource
UserRoleService userRoleService;
@Resource
MaterialMainService materialMainService;
@Resource
BomNewPbomChildService pbomChildService;
@Resource
BomNewTechnologyPackageTypeService technologyPackageTypeService;
@Resource
MaterialService materialService;
/**
* pbom-工作列表
*
* @param query
* @return
*/
public IPage<BomNewPbomParentVO> workDetailsListByPage(BomNewPbomParentQuery query) {
Page<BomNewPbomParentVO> result = this.getBaseMapper().workDetailsListByPage(new Page<>(query.getPage(), query.getPageSize()), query, userRoleService.getUserFactory());
materialMainService.intiMaterialInfo(result.getRecords(), "material", "materialTexture", "projectType");
return result;
}
public List<BomNewPbomParentVO> getChild(Long rowId) {
List<BomNewPbomParentVO> parentChild = this.getBaseMapper().getParentChild(rowId);
BomNewPbomParentEntity parent = this.getById(rowId);
if (CollUtil.isNotEmpty(parentChild)) {
materialMainService.intiMaterialInfo(parentChild, "material", "materialTexture", "projectType");
List<String> materialNos = parentChild.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
if (CollUtil.isNotEmpty(materialNos)) {
List<BomNewPbomParentEntity> list = this.lambdaQuery().in(BomNewPbomParentEntity::getMaterialNo, materialNos).eq(BomNewPbomParentEntity::getLastVersionIs, 1).list();
Map<String, BomNewPbomParentEntity> bomListMap = ListCommonUtil.listToMap(list, BomNewPbomParentEntity::getMaterialNo);
for (BomNewPbomParentVO child : parentChild) {
if (bomListMap.containsKey(child.getMaterialNo())) {
BomNewPbomParentEntity parentEntity = bomListMap.get(child.getMaterialNo());
child.setCurrentVersion(parentEntity.getCurrentVersion());
child.setStatus(parentEntity.getStatus());
child.setEditStatus(parentEntity.getEditStatus());
child.setDeviseName(parentEntity.getDeviseName());
child.setDeviseUserCode(parentEntity.getDeviseUserCode());
child.setCreatedTime(parentEntity.getCreatedTime());
child.setBomRowId(parentEntity.getRowId());
child.setLevelNum(parentEntity.getLevelNum());
child.setDeptName(parentEntity.getDeptName());
child.setChangeDesc(parentEntity.getChangeDesc());
child.setOrderNo(parentEntity.getOrderNo());
child.setSourceRowId(parentEntity.getSourceRowId());
child.setBomExist(parentEntity.getBomExist());
child.setShouldBomExist(parentEntity.getShouldBomExist());
child.setVirtualPackageIs(parentEntity.getVirtualPackageIs());
if (parentEntity.getStatus().equals(PBomStatusEnum.PUBLISH.getValue())) {
child.setStatus(PBomStatusEnum.BORROWED_PARTS.getValue());
}
} else { //无BOM-版本时 确定版本号
//child.setSource(Objects.nonNull(parent) ? parent.getSource() : EBomSourceEnum.FROM_BOM.getValue());
child.setDeviseUserCode(parent.getDeviseUserCode());
child.setDeviseName(parent.getDeviseName());
child.setDeptName(parent.getDeptName());
child.setStatus(parent.getStatus());
child.setEditStatus(parent.getEditStatus());
child.setVirtualPackageIs(parent.getVirtualPackageIs());
if (MaterialshouldBomExistUtil.checkShouldBomExist(child)) {
child.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
child.setStatus(parent.getStatus());
}
}
}
}
}
return parentChild;
}
/**
* 编辑暂存
*
* @param paramDTO
*/
@Transactional(rollbackFor = Exception.class)
public void editSave(EditPBomParamDTO paramDTO, PBomEditStatusEnum editStatus) {
BomNewPbomParentEntity parent = this.getById(paramDTO.getBomRowId());
VUtils.isTure(Objects.isNull(parent)).throwMessage("参数错误该BOM不存在");
List<BomNewPbomChildEntity> childList = Convert.toList(BomNewPbomChildEntity.class, paramDTO.getChildList());
childList.forEach(u -> {
u.setParentRowId(paramDTO.getBomRowId());
});
pbomChildService.saveOrUpdateBatch(childList);
parent.setEditStatus(editStatus.getValue());
this.updateById(parent);
}
/**
* 编辑-
* 机加工件分类代码以200301开头只可以删除它的下级,
* 辅助物料100310201021 ) 可以删除
*
* @param paramDTO
* @param paramDTO
*/
@Transactional(rollbackFor = Exception.class)
public void editDel(EditPBomDelDTO paramDTO) {
BomNewPbomParentEntity parent = this.getById(paramDTO.getBomRowId());
VUtils.isTure(Objects.isNull(parent)).throwMessage("参数bomRowId错误该BOM不存在");
BomNewPbomParentVO parentVO = Convert.convert(BomNewPbomParentVO.class, parent);
materialMainService.intiMaterialInfo(ImmutableList.of(parentVO));
List<BomNewPbomChildEntity> childList = pbomChildService.getBaseMapper().selectBatchIds(paramDTO.getRowIdList());
List<BomNewPbomParentVO> childListVO = Convert.toList(BomNewPbomParentVO.class, childList);
materialMainService.intiMaterialInfo(childListVO);
// 机加工件 的子级可直接删除
if (parentVO.getMaterialCategoryCode().startsWith("200301")) {
pbomChildService.getBaseMapper().delByRowId(paramDTO.getRowIdList());
return;
}
//删除辅助物料
List<BomNewPbomParentVO> noDelList = childListVO.stream().filter(u -> !u.getMaterialCategoryCode().startsWith("1003") && !u.getMaterialCategoryCode().startsWith("1020") && !u.getMaterialCategoryCode().startsWith("1021")).collect(Collectors.toList());
VUtils.isTure(CollUtil.isNotEmpty(noDelList)).throwMessage("非机加工件的子级只能删除辅助物料,以下物料为非辅助物料:" + StrUtil.join(",", noDelList));
pbomChildService.getBaseMapper().delByRowId(paramDTO.getRowIdList());
}
/**
* 设置虚拟件
*
* @param rowIdList
*/
@Transactional(rollbackFor = Exception.class)
public void setVirtualPart(List<Long> rowIdList) {
pbomChildService.getBaseMapper().setVirtualPart(rowIdList);
}
/**
* 编辑-导出EXCEL
* @param bomRowId
* @param response
*/
public void editExport(Long bomRowId, HttpServletResponse response) throws IOException {
EecExcelUtil.setResponseExcelHeader(response,"缺价物料列表");
List<BomNewPbomParentVO> child = this.getChild(bomRowId);
List<BomNewPbomEditExcelVO> result = Convert.toList(BomNewPbomEditExcelVO.class, child);
new Workbook().addSheet(result).writeTo(response.getOutputStream());
}
/**
* 创建工艺包
* @param packageParam
* @return
*/
public BaseMaterialVO createTechnologyPackage(TechnologyPackageParam packageParam) throws IOException {
VUtils.isTure(Objects.isNull(packageParam.getTechnologyPackageTypeRowId())).throwMessage("请选择工艺包类型");
BomNewTechnologyPackageTypeEntity technologyPackageTypeEntity = technologyPackageTypeService.getById(packageParam.getTechnologyPackageTypeRowId());
//单条物料
String drawingNo="";
String materialName="";
String materialDesc="";
BomNewPbomParentVO result=null;
if(packageParam.getRowIds().size()==1){
BomNewPbomChildEntity child = pbomChildService.getById(packageParam.getRowIds().get(0));
result=Convert.convert(BomNewPbomParentVO.class,child);
}
else {
BomNewPbomParentEntity parent=this.getById(packageParam.getBomRowId());
result=Convert.convert(BomNewPbomParentVO.class,parent);
}
materialMainService.intiMaterialInfo(ImmutableList.of(result) );
VUtils.isTure(StrUtil.isBlank(result.getMaterialCategoryCode()) || !result.getMaterialCategoryCode().startsWith("20") ).throwMessage("插入工艺包的物料需时制作物料");
drawingNo=StrUtil.join("", result.getDrawingNo(),technologyPackageTypeEntity.getDrawingNoSuffix());
// 检查改图号是否已存在主数据中
List<MaterialMainEntity> materials = materialMainService.lambdaQuery().eq(MaterialMainEntity::getDrawingNo, drawingNo).list();
if(CollUtil.isNotEmpty(materials)){
return Convert.convert(BaseMaterialVO.class,materials.get(0));
}
materialName=StrUtil.join("",result.getMaterialName(),technologyPackageTypeEntity.getRemark());
materialDesc=StrUtil.join(" ",materialName,drawingNo);
String materialNo = materialService.addMaterial(drawingNo, materialName, materialDesc, "");
return materialMainService.getMaterialBaseInfo(ImmutableList.of(materialNo)).get(0);
}
}

View File

@ -0,0 +1,19 @@
package com.nflg.product.bomnew.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nflg.product.bomnew.mapper.master.BomNewTechnologyPackageTypeMapper;
import com.nflg.product.bomnew.pojo.entity.BomNewTechnologyPackageTypeEntity;
import org.springframework.stereotype.Service;
/**
* t_bom_new_technology_package_type 表服务实现类
* 工艺包类型
*
* @author makejava
* @since 2024-01-01 17:24:58
*/
@Service
public class BomNewTechnologyPackageTypeService extends ServiceImpl<BomNewTechnologyPackageTypeMapper, BomNewTechnologyPackageTypeEntity> {
}

View File

@ -51,4 +51,18 @@ public class UserRoleService {
// return 1;
return technician()? UserJobEnum.ENGINEER.getValue():UserJobEnum.DESIGNER.getValue();
}
/**
* 获取用户工厂
* 多工厂权限时返回空
* @return
*/
public String getUserFactory(){
Integer userMultiplantFacRoleCount = materialMainService.getBaseMapper().getUserMultiplantFacRoleCount(SessionUtil.getRowId());
if(userMultiplantFacRoleCount>0){
return "";
}else {
return SessionUtil.getFullDeptName().contains("仙桃公司")?"1020":"1010";
}
}
}

View File

@ -37,4 +37,18 @@
<!--@mbg.generated-->
row_id, parent_row_id, identity_no, fac_code, order_number, drawing_no, material_no, material_name, material_desc, material_texture, material_unit, material_category_code, unit_weight, num, total_weight, project_type, production_factory_code, set_production_factory_time, super_material_status, virtual_part_is, created_by, created_time, modify_time, source_row_id, remark, source_parent_material_no </sql>
<delete id="delByRowId">
delete from t_bom_new_pbom_child where row_id in
<foreach collection="rowIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<update id="setVirtualPart">
update t_bom_new_pbom_child set virtual_part_is=IF(virtual_part_is=1,0,1) where row_id in
<foreach collection="rowIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</update>
</mapper>

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nflg.product.bomnew.mapper.master.BomNewPbomParentMapper">
<resultMap id="BaseResultMap" type="com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity">
<!--@mbg.generated-->
<!--@Table t_bom_new_pbom_parent -->
@ -49,6 +48,43 @@
<sql id="Base_Column_List">
<!--@mbg.generated-->
row_id, batch_no, drawing_no, fac_code, material_no, order_number, material_name, material_desc, material_texture, material_unit, unit_weight, total_weight, current_version, num, project_type, root_is, should_bom_exist, super_material_status, bom_exist, last_version_is, edit_status, status, user_root_is, virtual_package_is, source_row_id, devise_user_code, devise_name, created_by, created_time, created_job, release_time, release_user_name, expire_end_time, remark, dept_name, level_num, change_desc, notice_nums, order_no, modify_time </sql>
row_id, batch_no, drawing_no, fac_code, material_no, order_number, material_name, material_desc,
material_texture, material_unit, unit_weight, total_weight, current_version, num, project_type, root_is,
should_bom_exist, super_material_status, bom_exist, last_version_is, edit_status, status, user_root_is,
virtual_package_is, source_row_id, devise_user_code, devise_name, created_by, created_time, created_job,
release_time, release_user_name, expire_end_time, remark, dept_name, level_num, change_desc, notice_nums,
order_no, modify_time
</sql>
<sql id="whr">
<if test="query.facCode!= null">
and fac_code = #{query.facCode}
</if>
<if test="query.materialNo!= null">
and material_no = #{query.materialNo}
</if>
<if test="query.drawingNo!= null">
and drawing_no = #{query.drawingNo}
</if>
<if test="query.startDate!= null and query.endDate!=null">
and created_time between #{query.startDate} and #{query.endDate}
</if>
</sql>
<!--获取工作列表-->
<select id="workDetailsListByPage" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO">
select * , row_id as bomRowId
from t_bom_new_pbom_parent where root_is=1
<if test="userFac!=null and userFac!=''">
and fac_code=#{userFac}
</if>
<include refid="whr"/>
order by created_time desc
</select>
<select id="getParentChild" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO">
select * from t_bom_new_pbom_child where parent_row_id=#{parentRowId}
</select>
</mapper>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nflg.product.bomnew.mapper.master.BomNewTechnologyPackageTypeMapper">
<resultMap id="BaseResultMap" type="com.nflg.product.bomnew.pojo.entity.BomNewTechnologyPackageTypeEntity">
<!--@mbg.generated-->
<!--@Table t_bom_new_technology_package_type -->
<id column="row_id" property="rowId" jdbcType="BIGINT"/>
<result column="type_name" property="typeName" jdbcType="VARCHAR"/>
<result column="drawing_no_suffix" property="drawingNoSuffix" jdbcType="VARCHAR"/>
<result column="remark" property="remark" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
row_id, type_name, drawing_no_suffix, remark </sql>
</mapper>

View File

@ -130,4 +130,9 @@
SELECT distinct b.post_name from t_authority_role_user a
join t_authority_role_post b on a.role_row_id=b.role_row_id where a.user_row_id=#{userRowId}
</select>
<select id="getUserMultiplantFacRoleCount" resultType="java.lang.Integer">
select COUNT(1) from t_authority_role_user a join t_authority_role b on a.role_row_id=b.row_id
where user_row_id=#{userRowId} and b.multiplant_factory_state=1 and b.enable_state=1
</select>
</mapper>