zss
2023-08-31 fa40e09b66af9d17b6d2dda1a3d4687ad72bf668
标准BOM(展示+添加)
已添加15个文件
已修改23个文件
1420 ■■■■■ 文件已修改
standard-server/src/main/java/com/yuanchu/mom/controller/MaterialController.java 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/controller/MbomController.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/controller/ProductController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/controller/SpecificationsController.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/controller/StandardController.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/controller/TechniqueController.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/controller/TechnologyController.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/mapper/MaterialMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/mapper/MbomMapper.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/mapper/ProductMapper.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/mapper/TechniqueMapper.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/mapper/TechnologyMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/pojo/Material.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/pojo/Mbom.java 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/pojo/Product.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/pojo/Technique.java 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/pojo/dto/MaterialDto.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/pojo/dto/SpecificationsDto.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/pojo/dto/StandardDto.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/MaterialService.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/MbomService.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/ProductService.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/SpecificationsService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/StandardService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/TechniqueService.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/TechnologyService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/impl/MaterialServiceImpl.java 136 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/impl/MbomServiceImpl.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/impl/ProductServiceImpl.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/impl/SpecificationsServiceImpl.java 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/impl/StandardServiceImpl.java 132 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/impl/TechniqueServiceImpl.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/impl/TechnologyServiceImpl.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/resources/mapper/MaterialMapper.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/resources/mapper/MbomMapper.xml 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/resources/mapper/ProductMapper.xml 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/resources/mapper/TechniqueMapper.xml 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/resources/mapper/TechnologyMapper.xml 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/controller/MaterialController.java
@@ -1,15 +1,19 @@
package com.yuanchu.mom.controller;
import com.yuanchu.mom.service.MaterialService;
import com.yuanchu.mom.pojo.dto.MaterialDto;
import com.yuanchu.mom.service.*;
import com.yuanchu.mom.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@Api(tags = "技术管理-->标准MOM-->左侧五级树展示")
import javax.annotation.Resource;
@Api(tags = "技术管理-->标准BOM")
@RestController
@RequestMapping("/material")
public class MaterialController {
@@ -17,10 +21,78 @@
    @Autowired
    private MaterialService materialService;
    @Resource
    TechnologyService technologyService;
    @Resource
    ProductService productService;
    @Resource
    MbomService mbomService;
    @Resource
    TechniqueService techniqueService;
    @ApiOperation(value = "左侧五级树展示")
    @GetMapping("/selectTreeByMaterial")
    public Result selectTreeByMaterial(){
        return Result.success(materialService.selectTreeByMaterial());
    }
    @ApiOperation("(1,2级)新增-->物料,标准,型号")
    @PostMapping("/add")
    public Result<?> addMaterial(@Validated @RequestBody MaterialDto materialDto) {
        materialService.addMaterial(materialDto);
        return Result.success("添加物料【" + materialDto.getName() + "】成功");
    }
    @ApiOperation(value = "右侧数据展示-->选择版本")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "specificationsId", value = "型号id", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "type", value = "类型(0:工艺路线;1:技术指标;2:物料清单;3:生产工艺)", dataTypeClass = Integer.class, required = true)
    })
    @GetMapping("/selectVersion")
    public Result selectVersion(Integer type, Integer specificationsId) {
        switch (type) {
            case 0:
                //工艺路线
                return Result.success(technologyService.selectVerByTec(specificationsId));
            case 1:
                //技术指标
                return Result.success(productService.selectVerByPro(specificationsId));
            case 2:
                //物料清单
                return Result.success(mbomService.selectVerByMbom(specificationsId));
            case 3:
                //生产工艺
                return Result.success(techniqueService.selectVerByTeq(specificationsId));
        }
        return Result.fail("没有该类型!");
    }
    @ApiOperation(value = "右侧数据展示")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "specificationsId", value = "型号id", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "type", value = "类型(0:工艺路线;1:技术指标;2:物料清单;3:生产工艺)", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "version", value = "版本(默认最新)", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "message", value = "搜索内容", dataTypeClass = String.class)
    })
    @GetMapping("/selectAll")
    public Result selectAll(Integer specificationsId, Integer type, Integer version,String message) {
        switch (type) {
            case 0:
                //工艺路线
                return Result.success(technologyService.selectAllTec(specificationsId, version,message));
            case 1:
                //技术指标
                return Result.success(productService.selectAllPro(specificationsId, version,message));
            case 2:
                //物料清单
                return Result.success(mbomService.selectAllMbom(specificationsId, version,message));
            case 3:
                //生产工艺
                return Result.success(techniqueService.selectAllTeq(specificationsId, version,message));
        }
        return Result.fail("没有该类型!");
    }
}
standard-server/src/main/java/com/yuanchu/mom/controller/MbomController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,25 @@
package com.yuanchu.mom.controller;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.yuanchu.mom.service.MbomService;
/**
 * æ ‡å‡†BOM-物料清单表(Mbom)表控制层
 *
 * @author zss
 * @since 2023-08-31 11:58:23
 */
@Api(tags = "技术管理-->标准BOM-->物料清单")
@RestController
@RequestMapping("/mbom")
public class MbomController {
    @Autowired
    private MbomService mbomService;
}
standard-server/src/main/java/com/yuanchu/mom/controller/ProductController.java
@@ -14,7 +14,7 @@
import java.util.List;
@Api(tags = "技术管理-->标准MOM-->项目模块")
@Api(tags = "技术管理-->标准BOM-->技术指标(检验项目)")
@RestController
@RequestMapping("/product")
public class ProductController {
@@ -22,14 +22,4 @@
    @Autowired
    private ProductService productService;
    @ApiOperation(value = "项目表格二级树")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "project", value = "项目", dataTypeClass = String.class),
            @ApiImplicitParam(name = "specifications", value = "型号ID", dataTypeClass = String.class, required = true)
    })
    @GetMapping("/selectTreeByMaterial")
    public Result<?> selectTreeProduct(String specifications, String project){
        List<ProductDto> map = productService.selectTreeProduct(specifications, project);
        return Result.success(map);
    }
}
standard-server/src/main/java/com/yuanchu/mom/controller/SpecificationsController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,37 @@
package com.yuanchu.mom.controller;
import com.yuanchu.mom.pojo.dto.SpecificationsDto;
import com.yuanchu.mom.pojo.dto.StandardDto;
import com.yuanchu.mom.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.yuanchu.mom.service.SpecificationsService;
/**
 * åž‹å·è¡¨(Specifications)表控制层
 *
 * @author zss
 * @since 2023-08-31 09:35:56
 */
@Api(tags = "技术管理-->标准BOM")
@RestController
@RequestMapping("/specifications")
public class SpecificationsController {
    @Autowired
    private SpecificationsService specificationsService;
    @ApiOperation("(4级)新增-->型号")
    @PostMapping("/add")
    public Result<?> addSpecifications(@Validated @RequestBody SpecificationsDto specificationsDto) {
        specificationsService.addSpecifications(specificationsDto);
        return Result.fail("添加型号【"+ specificationsDto.getSpecifications() +"】成功!");
    }
}
standard-server/src/main/java/com/yuanchu/mom/controller/StandardController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,37 @@
package com.yuanchu.mom.controller;
import com.yuanchu.mom.pojo.dto.MaterialDto;
import com.yuanchu.mom.pojo.dto.StandardDto;
import com.yuanchu.mom.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.yuanchu.mom.service.StandardService;
/**
 * æ ‡å‡†è¡¨(Standard)表控制层
 *
 * @author zss
 * @since 2023-08-31 09:35:38
 */
@Api(tags = "技术管理-->标准BOM")
@RestController
@RequestMapping("/standard")
public class StandardController {
    @Autowired
    private StandardService standardService;
    @ApiOperation("(3级)新增-->标准,型号")
    @PostMapping("/add")
    public Result<?> addStandard(@Validated @RequestBody StandardDto standardDto) {
        standardService.addStandard(standardDto);
        return Result.fail("添加标准【"+ standardDto.getStandard() +"】成功!");
    }
}
standard-server/src/main/java/com/yuanchu/mom/controller/TechniqueController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,25 @@
package com.yuanchu.mom.controller;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.yuanchu.mom.service.TechniqueService;
/**
 * æ ‡å‡†BOM-生产工艺表(Technique)表控制层
 *
 * @author zss
 * @since 2023-08-31 11:57:52
 */
@Api(tags = "技术管理-->标准BOM-->生产工艺")
@RestController
@RequestMapping("/technique")
public class TechniqueController {
    @Autowired
    private TechniqueService techniqueService;
}
standard-server/src/main/java/com/yuanchu/mom/controller/TechnologyController.java
@@ -24,7 +24,7 @@
 * @author æ±Ÿè‹éµ·é›ç½‘络科技有限公司
 * @since 2023-07-31
 */
@Api(tags = "技术管理-->标准MOM-->工艺路线")
@Api(tags = "技术管理-->标准BOM-->工艺路线")
@RestController
@RequestMapping("/technology")
public class TechnologyController {
@@ -32,14 +32,5 @@
    @Autowired
    private TechnologyService technologyService;
    @ApiOperation(value = "选择工艺路线出现的表格查询")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "technologyName", value = "工艺名称", dataTypeClass = String.class),
            @ApiImplicitParam(name = "specificationId", value = "规格ID", dataTypeClass = String.class,required = true)
    })
    @GetMapping("/select")
    public Result<?> selectTechnology(String technologyName, String specificationId){
        List<Map<String, Object>> map = technologyService.selectTechnology(technologyName);
        return Result.success(map);
    }
}
standard-server/src/main/java/com/yuanchu/mom/mapper/MaterialMapper.java
@@ -24,6 +24,9 @@
    //根据物料名称和物料编码查询物料id,规格信息和型号信息
    List<Map> selectIdByCoNa(String name, String code);
    //根据标准id查询物料
    Material selFath(Integer id);
}
standard-server/src/main/java/com/yuanchu/mom/mapper/MbomMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
package com.yuanchu.mom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yuanchu.mom.pojo.Mbom;
import java.util.List;
import java.util.Map;
/**
 * æ ‡å‡†BOM-物料清单表(Mbom)表数据库访问层
 *
 * @author zss
 * @since 2023-08-31 11:58:23
 */
public interface MbomMapper extends BaseMapper<Mbom> {
    //根据型号id查询所有版本
    List<Integer> selectVerByMbom(Integer specificationsId);
    //右侧数据展示-->物料清单
    List<Map<String, Object>> selectAllMbom(Integer specificationsId, Integer version,String message);
}
standard-server/src/main/java/com/yuanchu/mom/mapper/ProductMapper.java
@@ -15,7 +15,14 @@
*/
public interface ProductMapper extends BaseMapper<Product> {
    List<ProductDto> selectTreeProduct(String specifications, String project);
    //根据型号id查询项目(技术指标)
    List<Map<String, Object>> selectProductList(Integer specificationsId);
    //根据型号id查询所有版本
    List<Integer> selectVerByPro(Integer specificationsId);
    //右侧数据展示-->技术指标(检验项目)
    List<Map<String, Object>> selectAllPro(Integer specificationsId, Integer version,String message);
}
standard-server/src/main/java/com/yuanchu/mom/mapper/TechniqueMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
package com.yuanchu.mom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yuanchu.mom.pojo.Technique;
import java.util.List;
import java.util.Map;
/**
 * æ ‡å‡†BOM-生产工艺表(Technique)表数据库访问层
 *
 * @author zss
 * @since 2023-08-31 11:57:52
 */
public interface TechniqueMapper extends BaseMapper<Technique> {
    //根据型号id查询所有版本
    List<Integer> selectVerByTeq(Integer specificationsId);
    //右侧数据展示-->生产工艺
    List<Map<String, Object>> selectAllTeq(Integer specificationsId, Integer version,String message);
}
standard-server/src/main/java/com/yuanchu/mom/mapper/TechnologyMapper.java
@@ -3,6 +3,9 @@
import com.yuanchu.mom.pojo.Technology;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import java.util.Map;
/**
 * <p>
 *  Mapper æŽ¥å£
@@ -13,4 +16,9 @@
 */
public interface TechnologyMapper extends BaseMapper<Technology> {
    //根据型号id查询版本
    List<Integer> selectVerByTec(Integer specificationsId);
    //右侧数据展示-->工艺路线
    List<Map<String, Object>> selectAllTec(Integer specificationsId, Integer version,String message);
}
standard-server/src/main/java/com/yuanchu/mom/pojo/Material.java
@@ -7,6 +7,7 @@
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
/**
@@ -42,21 +43,21 @@
     **/
    private Integer father;
    @ApiModelProperty(value = "逻辑删除 æ­£å¸¸>=1,删除<=0", hidden = true)
    private Integer state;
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间", hidden = true)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新时间", hidden = true)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date updateTime;
    @ApiModelProperty(value = "乐观锁", hidden = true)
    @Version
    //版本
    private Integer version;
    @TableField(exist = false)
standard-server/src/main/java/com/yuanchu/mom/pojo/Mbom.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,89 @@
package com.yuanchu.mom.pojo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.Date;
import java.io.Serializable;
/**
 * æ ‡å‡†BOM-物料清单表(Mbom)表实体类
 *
 * @author zss
 * @since 2023-08-31 11:58:24
 */
@Data
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("mbom")
public class Mbom implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * id
     **/
    @TableId(type = IdType.AUTO)
    private Integer id;
    /**
     * å…³è” å·¥è‰ºè·¯çº¿id
     **/
    private Integer technologyId;
    /**
     * åŽŸææ–™åç§°
     **/
    private String name;
    /**
     * å•位
     **/
    private String unit;
    /**
     * æ•°é‡
     **/
    private Integer num;
    /**
     * ä¾›åº”商
     **/
    private String supplier;
    /**
     * è´¨é‡è¿½æº¯å·
     **/
    private String qualityTraceability;
    /**
     * (原材料的)规格型号
     **/
    private String specifications;
    /**
     * ç‰ˆæœ¬
     **/
    private Integer version;
    @ApiModelProperty(value = "逻辑删除 æ­£å¸¸>=1,删除<=0", hidden = true)
    private Integer state;
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间", hidden = true)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新时间", hidden = true)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date updateTime;
}
standard-server/src/main/java/com/yuanchu/mom/pojo/Product.java
@@ -48,27 +48,25 @@
    private String internal;
    @ApiModelProperty(value = "逻辑删除 æ­£å¸¸>=1,删除<=0", hidden = true)
    @TableLogic(value = "1", delval = "0")
    private Integer state;
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间", hidden = true)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新时间", hidden = true)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date updateTime;
    @ApiModelProperty(value = "乐观锁", hidden = true)
    @Version
    //版本
    private Integer version;
    /**
     * å…³è” åž‹å·id
     * å…³è” å·¥è‰ºè·¯çº¿id
     */
    private Integer specificationsId;
    private Integer technologyId;
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
standard-server/src/main/java/com/yuanchu/mom/pojo/Technique.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,79 @@
package com.yuanchu.mom.pojo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.Date;
import java.io.Serializable;
/**
 * æ ‡å‡†BOM-生产工艺表(Technique)表实体类
 *
 * @author zss
 * @since 2023-08-31 11:57:53
 */
@Data
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("technique")
public class Technique implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * id
     **/
    @TableId(type = IdType.AUTO)
    private Integer id;
    /**
     * å…³è” å·¥è‰ºè·¯çº¿id
     **/
    private Integer technologyId;
    /**
     * è®¾å¤‡åç§°
     **/
    private String device;
    /**
     * æ£€éªŒé¡¹ç›®(父类)
     **/
    private String productFather;
    /**
     * å•位
     **/
    private String unit;
    /**
     * æŒ‡æ ‡(子类项目)
     **/
    private String product;
    /**
     * ç‰ˆæœ¬
     **/
    private Integer version;
    @ApiModelProperty(value = "逻辑删除 æ­£å¸¸>=1,删除<=0", hidden = true)
    private Integer state;
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间", hidden = true)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新时间", hidden = true)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date updateTime;
}
standard-server/src/main/java/com/yuanchu/mom/pojo/dto/MaterialDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,33 @@
package com.yuanchu.mom.pojo.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@Data
//标准BOM新增参数(1,2级新增)
public class MaterialDto {
    @JsonSerialize
    @NotNull(message = "类型(成品半成品)不能为空")
    private Integer type;
    @JsonSerialize
    @NotNull(message = "产品大类(4大类)不能为空")
    private Integer father;
    @JsonSerialize
    @NotBlank(message = "物料名称不能为空")
    private String name;
    @JsonSerialize
    @NotBlank(message = "标准不能为空")
    private String standard;
    @JsonSerialize
    @NotBlank(message = "型号不能为空")
    private String specifications;
}
standard-server/src/main/java/com/yuanchu/mom/pojo/dto/SpecificationsDto.java
@@ -1,15 +1,22 @@
package com.yuanchu.mom.pojo.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
class SpecificationsDto {
//标准BOM新增参数(4级新增)
public class SpecificationsDto {
    @JsonSerialize
    @NotNull(message = "标准id不能为空")
    private Integer id;
    private String name;
    private String code = "[4]";
    @JsonSerialize
    @NotBlank(message = "型号不能为空")
    private String specifications;
}
standard-server/src/main/java/com/yuanchu/mom/pojo/dto/StandardDto.java
@@ -1,17 +1,26 @@
package com.yuanchu.mom.pojo.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
class StandardDto {
//标准BOM新增参数(3级新增)
public class StandardDto {
    @JsonSerialize
    @NotNull(message = "物料id不能为空")
    private Integer id;
    private String name;
    @JsonSerialize
    @NotBlank(message = "标准不能为空")
    private String standard;
    private String code = "[3]";
    List<SpecificationsDto> children;
    @JsonSerialize
    @NotBlank(message = "型号不能为空")
    private String specifications;
}
standard-server/src/main/java/com/yuanchu/mom/service/MaterialService.java
@@ -2,6 +2,7 @@
import com.yuanchu.mom.pojo.Material;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yuanchu.mom.pojo.dto.MaterialDto;
import java.util.List;
import java.util.Map;
@@ -21,6 +22,13 @@
    List<Map<String,Object>> selectTreeByMaterial();
    /**
     * (1,2级)新增-->物料,标准,型号
     * @param materialDto
     * @return
     */
    void addMaterial(MaterialDto materialDto);
    /**
     * æ ¹æ®ç‰©æ–™åç§°æŸ¥è¯¢ç‰©æ–™id和物料编码
     * @param name
     * @return
@@ -34,8 +42,9 @@
     * @return
     */
    List<Map> selectIdByCoNa(String name, String code);
    /**
     * æ£€éªŒæ¨¡å—-->OMS管理-->成品检验-->新增(项目名称下拉框:Id与名称,编码)
     * æ£€éªŒæ¨¡å—-->QMS管理-->成品检验-->新增(项目名称下拉框:Id与名称,编码)
     */
    List<Map<String, Object>> selectMaterialIdAndNameAndCode();
@@ -44,4 +53,5 @@
     * @return
     */
    List<Material> selectMaterial();
}
standard-server/src/main/java/com/yuanchu/mom/service/MbomService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,32 @@
package com.yuanchu.mom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yuanchu.mom.pojo.Mbom;
import java.util.List;
import java.util.Map;
/**
 * æ ‡å‡†BOM-物料清单表(Mbom)表服务接口
 *
 * @author zss
 * @since 2023-08-31 11:58:23
 */
public interface MbomService extends IService<Mbom> {
    /**
     * æ ¹æ®åž‹å·id查询所有版本
     * @param specificationsId
     * @return
     */
    List<Integer> selectVerByMbom(Integer specificationsId);
    /**
     *右侧数据展示-->物料清单
     * @param specificationsId
     * @param version
     * @return
     */
    List<Map<String,Object>> selectAllMbom(Integer specificationsId, Integer version,String message);
}
standard-server/src/main/java/com/yuanchu/mom/service/ProductService.java
@@ -14,7 +14,25 @@
*/
public interface ProductService extends IService<Product> {
    List<ProductDto> selectTreeProduct(String specifications, String project);
    /**
     * æ ¹æ®åž‹å·id查询项目(技术指标)
     * @param specificationsId
     * @return
     */
    List<Map<String, Object>> selectProductList(Integer specificationsId);
    /**
     * æ ¹æ®åž‹å·id查询版本
     * @param specificationsId
     * @return
     */
    List<Integer> selectVerByPro(Integer specificationsId);
    /**
     *右侧数据展示-->技术指标(检验项目)
     * @param specificationsId
     * @param version
     * @return
     */
    List<Map<String,Object>> selectAllPro(Integer specificationsId, Integer version,String message);
}
standard-server/src/main/java/com/yuanchu/mom/service/SpecificationsService.java
@@ -4,6 +4,7 @@
import com.yuanchu.mom.pojo.Material;
import com.yuanchu.mom.pojo.Specifications;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yuanchu.mom.pojo.dto.SpecificationsDto;
import java.util.List;
@@ -30,4 +31,11 @@
     * æ£€éªŒæ¨¡å—-->OMS管理-->成品检验-->新增(需要规格型号的Id与名称)
     */
    List<Map<String, Object>> selectSpecificationIdAndName(Integer materialId);
    /**
     *   (4级)新增-->型号
     * @param specificationsDto
     */
    void addSpecifications(SpecificationsDto specificationsDto);
}
standard-server/src/main/java/com/yuanchu/mom/service/StandardService.java
@@ -2,6 +2,7 @@
import com.yuanchu.mom.pojo.Standard;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yuanchu.mom.pojo.dto.StandardDto;
/**
* @author Administrator
@@ -10,4 +11,9 @@
*/
public interface StandardService extends IService<Standard> {
    /**
     * (3级)新增-->标准,型号
     * @param standardDto
     */
    void addStandard(StandardDto standardDto);
}
standard-server/src/main/java/com/yuanchu/mom/service/TechniqueService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,32 @@
package com.yuanchu.mom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yuanchu.mom.pojo.Technique;
import java.util.List;
import java.util.Map;
/**
 * æ ‡å‡†BOM-生产工艺表(Technique)表服务接口
 *
 * @author zss
 * @since 2023-08-31 11:57:53
 */
public interface TechniqueService extends IService<Technique> {
    /**
     * æ ¹æ®åž‹å·id查询所有版本
     * @param specificationsId
     * @return
     */
    List<Integer> selectVerByTeq(Integer specificationsId);
    /**
     * å³ä¾§æ•°æ®å±•示-->生产工艺
     * @param specificationsId
     * @param version
     * @return
     */
    List<Map<String,Object>> selectAllTeq(Integer specificationsId, Integer version,String message);
}
standard-server/src/main/java/com/yuanchu/mom/service/TechnologyService.java
@@ -16,5 +16,17 @@
 */
public interface TechnologyService extends IService<Technology> {
    List<Map<String, Object>> selectTechnology(String technologyName);
    /**
     * æ ¹æ®åž‹å·id查询版本
     * @return
     */
    List<Integer> selectVerByTec(Integer specificationsId);
    /**
     * å³ä¾§æ•°æ®å±•示-->工艺路线
     * @param specificationsId åž‹å·id
     * @param version ç‰ˆæœ¬
     * @return
     */
    List<Map<String,Object>> selectAllTec(Integer specificationsId, Integer version,String message);
}
standard-server/src/main/java/com/yuanchu/mom/service/impl/MaterialServiceImpl.java
@@ -3,14 +3,19 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.mom.pojo.Material;
import com.yuanchu.mom.service.MaterialService;
import com.yuanchu.mom.mapper.MaterialMapper;
import com.yuanchu.mom.mapper.*;
import com.yuanchu.mom.pojo.*;
import com.yuanchu.mom.pojo.dto.MaterialDto;
import com.yuanchu.mom.service.*;
import com.yuanchu.mom.utils.MyUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * @author Administrator
@@ -18,11 +23,43 @@
 * @createDate 2023-07-26 15:52:50
 */
@Service
public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material>
        implements MaterialService {
public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> implements MaterialService {
    @Resource
    MaterialMapper materialMapper;
    @Resource
    StandardMapper standardMapper;
    @Resource
    SpecificationsMapper specificationsMapper;
    @Resource
    TechnologyService technologyService;
    @Resource
    TechnologyTemplateMapper technologyTemplateMapper;
    @Resource
    ProductService productService;
    @Resource
    TechnicalModelMapper technicalModelMapper;
    @Resource
    MbomService mbomService;
    @Resource
    MbomModelMapper mbomModelMapper;
    @Resource
    TechniqueService techniqueService;
    @Resource
    TechniqueModelMapper techniqueModelMapper;
    @Resource
    DeviceMapper deviceMapper;
    //标准MOM-->左侧五级树展示
    @Override
@@ -30,6 +67,95 @@
        return materialMapper.selectTreeByMaterial();
    }
    //(1,2级)新增-->物料,标准,型号
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void addMaterial(MaterialDto materialDto) {
        /*新增物料表*/
        Material material = new Material();
        material.setCode(MyUtil.getTimeSixNumberCode("ML", "ML"));
        material.setName(materialDto.getName());
        material.setType(materialDto.getType());
        material.setFather(materialDto.getFather());
        materialMapper.insert(material);
        /*新增标准表*/
        Standard standard = new Standard();
        standard.setName(materialDto.getStandard());
        standard.setMaterial_id(material.getId());
        standardMapper.insert(standard);
        /*新增型号表*/
        Specifications specifications = new Specifications();
        specifications.setName(materialDto.getSpecifications());
        specifications.setStandardId(standard.getId());
        specificationsMapper.insert(specifications);
        /*新增标准BOM-->工艺路线(批量添加)*/
        List<TechnologyTemplate> technologyTemplateList = technologyTemplateMapper.selectList(Wrappers.<TechnologyTemplate>query().eq("type", materialDto.getFather()));
        List<Technology> technologyList = technologyTemplateList.stream().map(technologyTemplate -> {
            Technology technology = new Technology();
            technology.setSpecificationsId(specifications.getId());
            technology.setFather(technologyTemplate.getFather());
            technology.setName(technologyTemplate.getName());
            technology.setDeviceGroup(technologyTemplate.getDeviceGroup());
            return technology;
        }).collect(Collectors.toList());
        technologyService.saveBatch(technologyList);
        /*新增标准BOM-->技术指标(批量添加)*/
        //新增的工艺路线id集合
        List<Integer> technologyIds = technologyList.stream().map(Technology::getId).collect(Collectors.toList());
        //基础数据中工艺路线id集合
        List<Integer> techTemIds = technologyTemplateList.stream().map(TechnologyTemplate::getId).collect(Collectors.toList());
        //两者长度一定一样
        List<Product> productList = new ArrayList<>();
        for (int i = 0; i < technologyIds.size(); i++) {
            List<TechnicalModel> technicalModelList = technicalModelMapper.selectList(Wrappers.<TechnicalModel>query().eq("tech_tem_id", techTemIds.get(i)));
            for (TechnicalModel technicalModel : technicalModelList) {
                Product product = new Product();
                product.setFather(technicalModel.getFather());
                product.setName(technicalModel.getName());
                product.setUnit(technicalModel.getUnit());
                product.setTechnologyId(technologyIds.get(i));
                productList.add(product);
            }
        }
        productService.saveBatch(productList);
        /*新增标准BOM-->物料清单(批量添加)*/
        List<Mbom> mbomList = new ArrayList<>();
        for (int i = 0; i < technologyIds.size(); i++) {
            List<MbomModel> mbomModelList = mbomModelMapper.selectList(Wrappers.<MbomModel>query().eq("tech_tem_id", techTemIds.get(i)));
            for (MbomModel mbomModel : mbomModelList) {
                Mbom mbom = new Mbom();
                mbom.setUnit(mbomModel.getUnit());
                mbom.setName(mbomModel.getName());
                mbom.setSupplier(mbomModel.getSupplier());
                mbom.setQualityTraceability(mbomModel.getQualityTraceability());
                mbom.setSpecifications(mbomModel.getSpecifications());
                mbom.setTechnologyId(technologyIds.get(i));
                mbomList.add(mbom);
            }
        }
        mbomService.saveBatch(mbomList);
        /*新增标准BOM-->生产工艺(批量添加)*/
        List<Technique> techniqueList = new ArrayList<>();
        for (int i = 0; i < technologyIds.size(); i++) {
            List<TechniqueModel> techniqueModelList = techniqueModelMapper.selectList(Wrappers.<TechniqueModel>query().eq("tech_tem_id", techTemIds.get(i)));
            for (TechniqueModel techniqueModel : techniqueModelList) {
                //查询设备名称
                Device device = deviceMapper.selectById(techniqueModel.getDeviceId());
                //查询基础生产工艺中每个设备的具体项目
                TechnicalModel technicalModel = technicalModelMapper.selectById(techniqueModel.getTechnicalModelId());
                Technique technique = new Technique();
                technique.setTechnologyId(technologyIds.get(i));
                technique.setDevice(device.getName());
                technique.setProductFather(technicalModel.getFather());
                technique.setProduct(technicalModel.getName());
                technique.setUnit(technicalModel.getUnit());
                techniqueList.add(technique);
            }
        }
        techniqueService.saveBatch(techniqueList);
    }
    //检验模块-->QMS管理-->成品检验-->新增(项目名称下拉框:Id与名称,编码)
    @Override
    public List<Map<String, Object>> selectMaterialIdAndNameAndCode() {
        LambdaQueryWrapper<Material> wrapper = new LambdaQueryWrapper<>();
standard-server/src/main/java/com/yuanchu/mom/service/impl/MbomServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,37 @@
package com.yuanchu.mom.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.mom.mapper.MbomMapper;
import com.yuanchu.mom.pojo.Mbom;
import com.yuanchu.mom.service.MbomService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
 * æ ‡å‡†BOM-物料清单表(Mbom)表服务实现类
 *
 * @author zss
 * @since 2023-08-31 11:58:24
 */
@Service
public class MbomServiceImpl extends ServiceImpl<MbomMapper, Mbom> implements MbomService {
    @Resource
    MbomMapper mbomMapper;
    //根据型号id查询所有版本
    @Override
    public List<Integer> selectVerByMbom(Integer specificationsId) {
        return mbomMapper.selectVerByMbom(specificationsId);
    }
    //右侧数据展示-->物料清单
    @Override
    public List<Map<String, Object>> selectAllMbom(Integer specificationsId, Integer version,String message) {
        return mbomMapper.selectAllMbom(specificationsId,version,message);
    }
}
standard-server/src/main/java/com/yuanchu/mom/service/impl/ProductServiceImpl.java
@@ -23,17 +23,22 @@
    @Resource
    private ProductMapper productMapper;
    @Override
    public List<ProductDto> selectTreeProduct(String specifications, String project) {
        return productMapper.selectTreeProduct(specifications, project);
    }
    //根据型号id查询项目(技术指标)
    @Override
    public List<Map<String, Object>> selectProductList(Integer specificationsId) {
        LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Product::getSpecificationsId, specificationsId);
        wrapper.select(Product::getName, Product::getFather, Product::getRequired, Product::getInternal, Product::getUnit);
        return productMapper.selectMaps(wrapper);
        return productMapper.selectProductList(specificationsId);
    }
    //根据型号id查询所有版本
    @Override
    public List<Integer> selectVerByPro(Integer specificationsId) {
        return productMapper.selectVerByPro(specificationsId);
    }
    //右侧数据展示-->技术指标(检验项目)
    @Override
    public List<Map<String, Object>> selectAllPro(Integer specificationsId, Integer version,String message) {
        return productMapper.selectAllPro(specificationsId,version,message);
    }
}
standard-server/src/main/java/com/yuanchu/mom/service/impl/SpecificationsServiceImpl.java
@@ -3,18 +3,21 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.mom.mapper.SpecificationsMapper;
import com.yuanchu.mom.pojo.Specifications;
import com.yuanchu.mom.service.SpecificationsService;
import com.yuanchu.mom.mapper.*;
import com.yuanchu.mom.pojo.*;
import com.yuanchu.mom.pojo.dto.SpecificationsDto;
import com.yuanchu.mom.service.*;
import com.yuanchu.mom.utils.MyUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * @author Administrator
@@ -22,14 +25,120 @@
 * @createDate 2023-07-26 16:01:49
 */
@Service
public class SpecificationsServiceImpl extends ServiceImpl<SpecificationsMapper, Specifications>
        implements SpecificationsService {
public class SpecificationsServiceImpl extends ServiceImpl<SpecificationsMapper, Specifications> implements SpecificationsService {
    @Resource
    private SpecificationsMapper specificationsMapper;
    MaterialMapper materialMapper;
    @Resource
    SpecificationsMapper specificationsMapper;
    @Resource
    TechnologyService technologyService;
    @Resource
    TechnologyTemplateMapper technologyTemplateMapper;
    @Resource
    ProductService productService;
    @Resource
    TechnicalModelMapper technicalModelMapper;
    @Resource
    MbomService mbomService;
    @Resource
    MbomModelMapper mbomModelMapper;
    @Resource
    TechniqueService techniqueService;
    @Resource
    TechniqueModelMapper techniqueModelMapper;
    @Resource
    DeviceMapper deviceMapper;
    //(4级)新增-->型号
    @Override
    public void addSpecifications(SpecificationsDto specificationsDto) {
        /*新增型号表*/
        Specifications specifications = new Specifications();
        specifications.setStandardId(specificationsDto.getId());
        specifications.setName(specificationsDto.getSpecifications());
        specificationsMapper.insert(specifications);
        /*新增标准BOM-->工艺路线(批量添加)*/
        //根据标准id查询物料大类
        Material material = materialMapper.selFath(specificationsDto.getId());
        List<TechnologyTemplate> technologyTemplateList = technologyTemplateMapper.selectList(Wrappers.<TechnologyTemplate>query().eq("type", material.getFather()));
        List<Technology> technologyList = technologyTemplateList.stream().map(technologyTemplate -> {
            Technology technology = new Technology();
            technology.setSpecificationsId(specifications.getId());
            technology.setFather(technologyTemplate.getFather());
            technology.setName(technologyTemplate.getName());
            technology.setDeviceGroup(technologyTemplate.getDeviceGroup());
            return technology;
        }).collect(Collectors.toList());
        technologyService.saveBatch(technologyList);
        /*新增标准BOM-->技术指标(批量添加)*/
        //新增的工艺路线id集合
        List<Integer> technologyIds = technologyList.stream().map(Technology::getId).collect(Collectors.toList());
        //基础数据中工艺路线id集合
        List<Integer> techTemIds = technologyTemplateList.stream().map(TechnologyTemplate::getId).collect(Collectors.toList());
        //两者长度一定一样
        List<Product> productList = new ArrayList<>();
        for (int i = 0; i < technologyIds.size(); i++) {
            List<TechnicalModel> technicalModelList = technicalModelMapper.selectList(Wrappers.<TechnicalModel>query().eq("tech_tem_id", techTemIds.get(i)));
            for (TechnicalModel technicalModel : technicalModelList) {
                Product product = new Product();
                product.setFather(technicalModel.getFather());
                product.setName(technicalModel.getName());
                product.setUnit(technicalModel.getUnit());
                product.setTechnologyId(technologyIds.get(i));
                productList.add(product);
            }
        }
        productService.saveBatch(productList);
        /*新增标准BOM-->物料清单(批量添加)*/
        List<Mbom> mbomList = new ArrayList<>();
        for (int i = 0; i < technologyIds.size(); i++) {
            List<MbomModel> mbomModelList = mbomModelMapper.selectList(Wrappers.<MbomModel>query().eq("tech_tem_id", techTemIds.get(i)));
            for (MbomModel mbomModel : mbomModelList) {
                Mbom mbom = new Mbom();
                mbom.setUnit(mbomModel.getUnit());
                mbom.setName(mbomModel.getName());
                mbom.setSupplier(mbomModel.getSupplier());
                mbom.setQualityTraceability(mbomModel.getQualityTraceability());
                mbom.setSpecifications(mbomModel.getSpecifications());
                mbom.setTechnologyId(technologyIds.get(i));
                mbomList.add(mbom);
            }
        }
        mbomService.saveBatch(mbomList);
        /*新增标准BOM-->生产工艺(批量添加)*/
        List<Technique> techniqueList = new ArrayList<>();
        for (int i = 0; i < technologyIds.size(); i++) {
            List<TechniqueModel> techniqueModelList = techniqueModelMapper.selectList(Wrappers.<TechniqueModel>query().eq("tech_tem_id", techTemIds.get(i)));
            for (TechniqueModel techniqueModel : techniqueModelList) {
                //查询设备名称
                Device device = deviceMapper.selectById(techniqueModel.getDeviceId());
                //查询基础生产工艺中每个设备的具体项目
                TechnicalModel technicalModel = technicalModelMapper.selectById(techniqueModel.getTechnicalModelId());
                Technique technique = new Technique();
                technique.setTechnologyId(technologyIds.get(i));
                technique.setDevice(device.getName());
                technique.setProductFather(technicalModel.getFather());
                technique.setProduct(technicalModel.getName());
                technique.setUnit(technicalModel.getUnit());
                techniqueList.add(technique);
            }
        }
        techniqueService.saveBatch(techniqueList);
    }
    /**
     * æ£€éªŒæ¨¡å—-->OMS管理-->成品检验-->新增(需要规格型号的Id与名称)
     * æ£€éªŒæ¨¡å—-->QMS管理-->成品检验-->新增(需要规格型号的Id与名称)
     */
    @Override
    public List<Map<String, Object>> selectSpecificationIdAndName(Integer materialId) {
standard-server/src/main/java/com/yuanchu/mom/service/impl/StandardServiceImpl.java
@@ -1,10 +1,18 @@
package com.yuanchu.mom.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.mom.pojo.Standard;
import com.yuanchu.mom.service.StandardService;
import com.yuanchu.mom.mapper.StandardMapper;
import com.yuanchu.mom.mapper.*;
import com.yuanchu.mom.pojo.*;
import com.yuanchu.mom.pojo.dto.StandardDto;
import com.yuanchu.mom.service.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
 * @author Administrator
@@ -14,6 +22,124 @@
@Service
public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> implements StandardService {
    @Resource
    MaterialMapper materialMapper;
    @Resource
    StandardMapper standardMapper;
    @Resource
    SpecificationsMapper specificationsMapper;
    @Resource
    TechnologyService technologyService;
    @Resource
    TechnologyTemplateMapper technologyTemplateMapper;
    @Resource
    ProductService productService;
    @Resource
    TechnicalModelMapper technicalModelMapper;
    @Resource
    MbomService mbomService;
    @Resource
    MbomModelMapper mbomModelMapper;
    @Resource
    TechniqueService techniqueService;
    @Resource
    TechniqueModelMapper techniqueModelMapper;
    @Resource
    DeviceMapper deviceMapper;
    //(3级)新增-->标准,型号
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void addStandard(StandardDto standardDto) {
        /*新增标准表*/
        Standard standard = new Standard();
        standard.setMaterial_id(standardDto.getId());
        standard.setName(standardDto.getStandard());
        standardMapper.insert(standard);
        /*新增型号表*/
        Specifications specifications = new Specifications();
        specifications.setStandardId(standard.getId());
        specifications.setName(standardDto.getSpecifications());
        specificationsMapper.insert(specifications);
        /*新增标准BOM-->工艺路线(批量添加)*/
        //查询物料的大类(根据物料id)
        Material material = materialMapper.selectById(standardDto.getId());
        List<TechnologyTemplate> technologyTemplateList = technologyTemplateMapper.selectList(Wrappers.<TechnologyTemplate>query().eq("type", material.getFather()));
        List<Technology> technologyList = technologyTemplateList.stream().map(technologyTemplate -> {
            Technology technology = new Technology();
            technology.setSpecificationsId(specifications.getId());
            technology.setFather(technologyTemplate.getFather());
            technology.setName(technologyTemplate.getName());
            technology.setDeviceGroup(technologyTemplate.getDeviceGroup());
            return technology;
        }).collect(Collectors.toList());
        technologyService.saveBatch(technologyList);
        /*新增标准BOM-->技术指标(批量添加)*/
        //新增的工艺路线id集合
        List<Integer> technologyIds = technologyList.stream().map(Technology::getId).collect(Collectors.toList());
        //基础数据中工艺路线id集合
        List<Integer> techTemIds = technologyTemplateList.stream().map(TechnologyTemplate::getId).collect(Collectors.toList());
        //两者长度一定一样
        List<Product> productList = new ArrayList<>();
        for (int i = 0; i < technologyIds.size(); i++) {
            List<TechnicalModel> technicalModelList = technicalModelMapper.selectList(Wrappers.<TechnicalModel>query().eq("tech_tem_id", techTemIds.get(i)));
            for (TechnicalModel technicalModel : technicalModelList) {
                Product product = new Product();
                product.setFather(technicalModel.getFather());
                product.setName(technicalModel.getName());
                product.setUnit(technicalModel.getUnit());
                product.setTechnologyId(technologyIds.get(i));
                productList.add(product);
            }
        }
        productService.saveBatch(productList);
        /*新增标准BOM-->物料清单(批量添加)*/
        List<Mbom> mbomList = new ArrayList<>();
        for (int i = 0; i < technologyIds.size(); i++) {
            List<MbomModel> mbomModelList = mbomModelMapper.selectList(Wrappers.<MbomModel>query().eq("tech_tem_id", techTemIds.get(i)));
            for (MbomModel mbomModel : mbomModelList) {
                Mbom mbom = new Mbom();
                mbom.setUnit(mbomModel.getUnit());
                mbom.setName(mbomModel.getName());
                mbom.setSupplier(mbomModel.getSupplier());
                mbom.setQualityTraceability(mbomModel.getQualityTraceability());
                mbom.setSpecifications(mbomModel.getSpecifications());
                mbom.setTechnologyId(technologyIds.get(i));
                mbomList.add(mbom);
            }
        }
        mbomService.saveBatch(mbomList);
        /*新增标准BOM-->生产工艺(批量添加)*/
        List<Technique> techniqueList = new ArrayList<>();
        for (int i = 0; i < technologyIds.size(); i++) {
            List<TechniqueModel> techniqueModelList = techniqueModelMapper.selectList(Wrappers.<TechniqueModel>query().eq("tech_tem_id", techTemIds.get(i)));
            for (TechniqueModel techniqueModel : techniqueModelList) {
                //查询设备名称
                Device device = deviceMapper.selectById(techniqueModel.getDeviceId());
                //查询基础生产工艺中每个设备的具体项目
                TechnicalModel technicalModel = technicalModelMapper.selectById(techniqueModel.getTechnicalModelId());
                Technique technique = new Technique();
                technique.setTechnologyId(technologyIds.get(i));
                technique.setDevice(device.getName());
                technique.setProductFather(technicalModel.getFather());
                technique.setProduct(technicalModel.getName());
                technique.setUnit(technicalModel.getUnit());
                techniqueList.add(technique);
            }
        }
        techniqueService.saveBatch(techniqueList);
    }
}
standard-server/src/main/java/com/yuanchu/mom/service/impl/TechniqueServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,37 @@
package com.yuanchu.mom.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.mom.mapper.TechniqueMapper;
import com.yuanchu.mom.pojo.Technique;
import com.yuanchu.mom.service.TechniqueService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
 * æ ‡å‡†BOM-生产工艺表(Technique)表服务实现类
 *
 * @author zss
 * @since 2023-08-31 11:57:53
 */
@Service
public class TechniqueServiceImpl extends ServiceImpl<TechniqueMapper, Technique> implements TechniqueService {
    @Resource
    TechniqueMapper techniqueMapper;
    //根据型号id查询所有版本
    @Override
    public List<Integer> selectVerByTeq(Integer specificationsId) {
        return techniqueMapper.selectVerByTeq(specificationsId);
    }
    //右侧数据展示-->生产工艺
    @Override
    public List<Map<String, Object>> selectAllTeq(Integer specificationsId, Integer version,String message) {
        return techniqueMapper.selectAllTeq(specificationsId,version,message);
    }
}
standard-server/src/main/java/com/yuanchu/mom/service/impl/TechnologyServiceImpl.java
@@ -24,15 +24,18 @@
public class TechnologyServiceImpl extends ServiceImpl<TechnologyMapper, Technology> implements TechnologyService {
    @Resource
    private TechnologyMapper technologyMapper;
    TechnologyMapper technologyMapper;
    //根据型号id查询版本
    @Override
    public List<Map<String, Object>> selectTechnology(String technologyName) {
        LambdaQueryWrapper<Technology> wrapper = new LambdaQueryWrapper<>();
        if (!ObjectUtils.isEmpty(technologyName)){
            wrapper.like(Technology::getName, technologyName);
    public List<Integer> selectVerByTec(Integer specificationsId) {
        return technologyMapper.selectVerByTec(specificationsId);
        }
        wrapper.select(Technology::getId, Technology::getName, Technology::getDeviceGroup, Technology::getFather);
        return technologyMapper.selectMaps(wrapper);
    //右侧数据展示-->工艺路线
    @Override
    public List<Map<String, Object>> selectAllTec(Integer specificationsId, Integer version,String message) {
        return technologyMapper.selectAllTec(specificationsId,version,message);
    }
}
standard-server/src/main/resources/mapper/MaterialMapper.xml
@@ -36,7 +36,8 @@
               sp.id   spid, #五级型号id
               sp.name spname #五级型号名
        from (select type, id, name,father from mom_ocean.material where state = 1) m
                 left join (select id, name, material_id from mom_ocean.standard where state = 1) s on m.id = s.material_id
                 left join (select id, name, material_id from mom_ocean.standard where state = 1) s
                           on m.id = s.material_id
                 left join (select id, name, standard_id from mom_ocean.specifications where state = 1) sp
                           on sp.standard_id = s.id
    </select>
@@ -60,4 +61,15 @@
          and m.name = #{name}
          and code = #{code}
    </select>
    <!--根据标准id查询物料-->
    <select id="selFath" resultType="com.yuanchu.mom.pojo.Material">
        select *
        from mom_ocean.material
        where state = 1
          and id = (select material_id
                    from mom_ocean.standard
                    where standard.state = 1
                      and standard.id = #{id})
    </select>
</mapper>
standard-server/src/main/resources/mapper/MbomMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,49 @@
<?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.yuanchu.mom.mapper.MbomMapper">
    <!--根据型号id查询所有版本-->
    <select id="selectVerByMbom" resultType="java.lang.Integer">
        select distinct version
        from mom_ocean.mbom
        where state = 1
          and technology_id in (select id
                                from mom_ocean.technology
                                where technology.state = 1
                                  and specifications_id = #{specificationsId})
        order by version desc
    </select>
    <!--右侧数据展示 ç‰©æ–™æ¸…单-->
    <resultMap id="oneMap" type="map">
        <id property="father" column="father"/>
        <collection property="children" resultMap="twoMap" javaType="List"/>
    </resultMap>
    <resultMap id="twoMap" type="map">
        <id property="tname" column="tname"/>
        <collection property="children" resultMap="threeMap" javaType="List"/>
    </resultMap>
    <resultMap id="threeMap" type="map">
        <id property="id" column="mid"/>
        <result property="mname" column="mname"/>
        <result property="specifications" column="specifications"/>
        <result property="unit" column="unit"/>
        <result property="num" column="num"/>
    </resultMap>
    <select id="selectAllMbom" resultMap="oneMap">
        select m.id mid,
               m.name mname,
               unit,
               num,
               specifications,
               t.name tname,
               father
        from mom_ocean.mbom m
                 left join mom_ocean.technology t on m.technology_id = t.id
        where m.state = 1
          and m.version = #{version}
          and specifications_id = #{specificationsId}
        <if test="message!=null and message!=''">
            and m.name like concat('%',#{message},'%')
        </if>
    </select>
</mapper>
standard-server/src/main/resources/mapper/ProductMapper.xml
@@ -3,42 +3,69 @@
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yuanchu.mom.mapper.ProductMapper">
    <!--根据型号id查询项目(技术指标)-->
    <select id="selectProductList" resultType="java.util.Map">
        select name,
               father,
               unit,
               required,
               internal
        from mom_ocean.product
        where state = 1
          and technology_id in (select id
                                from mom_ocean.technology
                                where technology.state = 1
                                  and specifications_id = #{specificationsId})
    </select>
    <resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.Product">
            <id property="id" column="id" jdbcType="INTEGER"/>
            <result property="name" column="name" jdbcType="VARCHAR"/>
            <result property="father" column="father" jdbcType="VARCHAR"/>
            <result property="unit" column="unit" jdbcType="VARCHAR"/>
            <result property="required" column="required" jdbcType="VARCHAR"/>
            <result property="internal" column="internal" jdbcType="VARCHAR"/>
            <result property="state" column="state" jdbcType="INTEGER"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
            <result property="version" column="version" jdbcType="INTEGER"/>
            <result property="specificationsId" column="specifications_id" jdbcType="INTEGER"/>
    <!--根据型号id查询所有版本-->
    <select id="selectVerByPro" resultType="java.lang.Integer">
        select distinct version
        from mom_ocean.product
        where state = 1
          and technology_id in (select id
                                from mom_ocean.technology
                                where technology.state = 1
                                  and specifications_id = #{specificationsId})
        order by version desc
    </select>
    <!--右侧数据展示 æŠ€æœ¯æŒ‡æ ‡(检验项目)-->
    <resultMap id="oneMap" type="map">
        <id property="tfather" column="tfather"/>
        <collection property="children" resultMap="twoMap" javaType="List"/>
    </resultMap>
    <resultMap id="selectTreeProduct" type="ProductDto">
        <id property="father" column="father" jdbcType="VARCHAR"/>
        <collection property="children" resultMap="productDto2ListMap"/>
    <resultMap id="twoMap" type="map">
        <id property="tname" column="tname"/>
        <collection property="children" resultMap="threeMap" javaType="List"/>
    </resultMap>
    <resultMap id="productDto2ListMap" type="ProductDto2">
        <id property="id" column="id" jdbcType="INTEGER"/>
        <result property="name" column="name" jdbcType="VARCHAR"/>
        <result property="unit" column="unit" jdbcType="VARCHAR"/>
        <result property="required" column="required" jdbcType="VARCHAR"/>
        <result property="internal" column="internal" jdbcType="VARCHAR"/>
        <result property="state" column="state" jdbcType="INTEGER"/>
    <resultMap id="threeMap" type="map">
        <id property="pfather" column="pfather"/>
        <collection property="children" resultMap="fourMap" javaType="List"/>
    </resultMap>
    <select id="selectTreeProduct" resultMap="selectTreeProduct">
        SELECT p.id, p.`name`, IFNULL(p.`father`,p.`name`) father, p.`unit`, p.`required`, p.`internal`
        FROM product p
        where p.specifications_id = #{specifications}
          <if test="project != null and project != ''">
              AND p.father like concat('%',#{project},'%')
    <resultMap id="fourMap" type="map">
        <id property="pid" column="pid"/>
        <result property="pname" column="pname"/>
        <result property="unit" column="unit"/>
        <result property="required" column="required"/>
        <result property="internal" column="internal"/>
    </resultMap>
    <select id="selectAllPro" resultMap="oneMap">
        select p.id     pid,
               p.name   pname,
               p.father pfather,
               unit,
               required,
               internal,
               t.father tfather,
               t.name   tname
        from mom_ocean.product p
                 left join mom_ocean.technology t on p.technology_id = t.id
        where p.state = 1
          and p.version = #{version}
          and specifications_id = #{specificationsId}
        <if test="message!=null and message!=''">
            and p.name like concat('%',#{message},'%')
          </if>
        and p.state = 1
    </select>
</mapper>
standard-server/src/main/resources/mapper/TechniqueMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,49 @@
<?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.yuanchu.mom.mapper.TechniqueMapper">
    <!--根据型号id查询所有版本-->
    <select id="selectVerByTeq" resultType="java.lang.Integer">
        select distinct version
        from mom_ocean.technique
        where state = 1
          and technology_id in (select id
                                from mom_ocean.technology
                                where technology.state = 1
                                  and specifications_id = #{specificationsId})
        order by version desc
    </select>
    <!--右侧数据展示 ç”Ÿäº§å·¥è‰º-->
    <resultMap id="oneMap" type="map">
        <id property="father" column="father"/>
        <collection property="children" resultMap="twoMap" javaType="List"/>
    </resultMap>
    <resultMap id="twoMap" type="map">
        <id property="name" column="name"/>
        <collection property="children" resultMap="threeMap" javaType="List"/>
    </resultMap>
    <resultMap id="threeMap" type="map">
        <id property="tqid" column="tqid"/>
        <result property="device" column="device"/>
        <result property="productFather" column="product_father"/>
        <result property="product" column="product"/>
        <result property="unit" column="unit"/>
    </resultMap>
    <select id="selectAllTeq" resultMap="oneMap">
        select tq.id tqid,
               device,
               product_father,
               product,
               unit,
               name,
               father
        from mom_ocean.technique tq
                 left join mom_ocean.technology tc on tq.technology_id = tc.id
        where tq.state = 1
          and specifications_id = #{specificationsId}
          and tq.version = #{version}
        <if test="message!=null and message!=''">
            and device like concat('%',#{message},'%')
        </if>
    </select>
</mapper>
standard-server/src/main/resources/mapper/TechnologyMapper.xml
@@ -1,5 +1,38 @@
<?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.yuanchu.mom.mapper.TechnologyMapper">
    <!--根据型号id查询版本-->
    <select id="selectVerByTec" resultType="java.lang.Integer">
        select distinct version
        from mom_ocean.technology
        where state = 1
          and specifications_id = #{specificationsId}
        order by version desc
    </select>
    <!--右侧数据展示 å·¥è‰ºè·¯çº¿-->
    <resultMap id="selectAllTecMap" type="map">
        <id property="father" column="father"/>
        <collection property="children" resultMap="selectAllTecMaps" javaType="List"/>
    </resultMap>
    <resultMap id="selectAllTecMaps" type="map">
        <id property="id" column="id"/>
        <result property="name" column="name"/>
        <result property="dg" column="dg"/>
        <result property="pq" column="pq"/>
    </resultMap>
    <select id="selectAllTec" resultMap="selectAllTecMap">
        select id,
        name,
        father,
        device_group dg,
        production_quota pq
        from mom_ocean.technology
        where state = 1
        and specifications_id = #{specificationsId}
        and version = #{version}
        <if test="message!=null and message!=''">
            and father like concat('%',#{message},'%')
        </if>
    </select>
</mapper>