add:产线叫料单
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
package org.nl.wms.pdm_manage.controller;
|
||||
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.pdm_manage.service.IPdmBomCallMaterialService;
|
||||
import org.nl.wms.pdm_manage.service.dao.PdmBomCallMaterial;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产线叫料 控制层
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-08-14
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/bomCallMaterial")
|
||||
@Slf4j
|
||||
public class BomCallMaterialController {
|
||||
|
||||
@Autowired
|
||||
private IPdmBomCallMaterialService iPdmBomCallMaterialService;
|
||||
|
||||
@GetMapping
|
||||
@Log("分页查询")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(iPdmBomCallMaterialService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增叫料单")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody PdmBomCallMaterial dto) {
|
||||
iPdmBomCallMaterialService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改叫料单")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody PdmBomCallMaterial dto) {
|
||||
iPdmBomCallMaterialService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除叫料单")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
iPdmBomCallMaterialService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.nl.wms.pdm_manage.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.MapOf;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生产枚举类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-08-14
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum BomEnum {
|
||||
|
||||
// 叫料单状态
|
||||
CALL_BOM_STATUS(MapOf.of("生成", "1", "叫料中", "2", "叫料完成", "3"
|
||||
, "退料中", "4", "完成", "5"
|
||||
)),
|
||||
|
||||
;
|
||||
|
||||
private Map<String, String> code;
|
||||
|
||||
public String code(String desc) {
|
||||
String code = this.getCode().get(desc);
|
||||
if (StringUtils.isNotEmpty(code)) {
|
||||
return code;
|
||||
}
|
||||
throw new BadRequestException(this.name() + "对应类型" + desc + "未定义");
|
||||
}
|
||||
|
||||
public String check(String code) {
|
||||
for (Map.Entry<String, String> entry : this.getCode().entrySet())
|
||||
if (entry.getValue().equals("code")) {
|
||||
return entry.getValue();
|
||||
}
|
||||
throw new BadRequestException(this.name() + "对应类型" + code + "未定义");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.nl.wms.pdm_manage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.pdm_manage.service.dao.PdmBomCallMaterial;
|
||||
import org.nl.wms.pdm_manage.service.dto.PdmBomCallMaterialDto;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产线叫料单 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-08-14
|
||||
*/
|
||||
public interface IPdmBomCallMaterialService extends IService<PdmBomCallMaterial> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param whereJson : {查询参数}
|
||||
* @param page : 分页对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
IPage<PdmBomCallMaterialDto> queryAll(Map whereJson, PageQuery page);
|
||||
|
||||
/**
|
||||
* 新增叫料单
|
||||
*
|
||||
* @param dto 实体类
|
||||
*/
|
||||
void create(PdmBomCallMaterial dto);
|
||||
|
||||
/**
|
||||
* 修改叫料单
|
||||
*
|
||||
* @param dto 实体类
|
||||
*/
|
||||
void update(PdmBomCallMaterial dto);
|
||||
|
||||
/**
|
||||
* 删除叫料单
|
||||
* @param ids id集合
|
||||
*/
|
||||
void delete(Set<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package org.nl.wms.pdm_manage.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产线叫料单
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-08-14
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("pdm_bom_callmaterial")
|
||||
public class PdmBomCallMaterial implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 工单标识
|
||||
*/
|
||||
@TableId(value = "bom_id")
|
||||
private String bom_id;
|
||||
|
||||
/**
|
||||
* 物料标识
|
||||
*/
|
||||
private String material_id;
|
||||
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
private String device_code;
|
||||
|
||||
/**
|
||||
* 叫料重量
|
||||
*/
|
||||
private BigDecimal call_qty;
|
||||
|
||||
/**
|
||||
* 实际重量
|
||||
*/
|
||||
private BigDecimal real_qty;
|
||||
|
||||
/**
|
||||
* 工单状态
|
||||
*/
|
||||
private String bom_status;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建人名称
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private String confirm_time;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.nl.wms.pdm_manage.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.pdm_manage.service.dao.PdmBomCallMaterial;
|
||||
import org.nl.wms.pdm_manage.service.dto.PdmBomCallMaterialDto;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产线叫料单 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-08-14
|
||||
*/
|
||||
public interface PdmBomCallMaterialMapper extends BaseMapper<PdmBomCallMaterial> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页条件
|
||||
* @param whereJson 查询条件
|
||||
* @return IPage<PdmBomCallMaterialDto>
|
||||
*/
|
||||
IPage<PdmBomCallMaterialDto> queryAllByPage(Page<PdmBomCallMaterialDto> page, @Param("param") Map whereJson);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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="org.nl.wms.pdm_manage.service.dao.mapper.PdmBomCallMaterialMapper">
|
||||
|
||||
<select id="queryAllByPage" resultType="org.nl.wms.pdm_manage.service.dto.PdmBomCallMaterialDto">
|
||||
SELECT
|
||||
bom.*,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
mater.material_spec
|
||||
FROM
|
||||
pdm_bom_callmaterial bom
|
||||
INNER JOIN md_me_materialbase mater ON mater.material_id = bom.material_id
|
||||
<where>
|
||||
1 = 1
|
||||
<if test="param.material_code != null and param.material_code != ''">
|
||||
AND
|
||||
(mater.material_code LIKE #{param.material_code} or
|
||||
mater.material_name LIKE #{param.material_code} )
|
||||
</if>
|
||||
|
||||
<if test="param.device_code != null and param.device_code != ''">
|
||||
AND
|
||||
bom.device_code LIKE #{param.device_code}
|
||||
</if>
|
||||
|
||||
<if test="param.bom_status != null and param.bom_status != ''">
|
||||
AND
|
||||
bom.bom_status = #{param.bom_status}
|
||||
</if>
|
||||
|
||||
|
||||
</where>
|
||||
ORDER BY bom.create_time Desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,32 @@
|
||||
package org.nl.wms.pdm_manage.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nl.wms.pdm_manage.service.dao.PdmBomCallMaterial;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产线叫料单dto
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-08-14
|
||||
*/
|
||||
@Data
|
||||
public class PdmBomCallMaterialDto extends PdmBomCallMaterial {
|
||||
|
||||
/**
|
||||
* 物料标批次
|
||||
*/
|
||||
private String material_spec;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
private String material_code;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
private String material_name;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package org.nl.wms.pdm_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.pdm_manage.enums.BomEnum;
|
||||
import org.nl.wms.pdm_manage.service.IPdmBomCallMaterialService;
|
||||
import org.nl.wms.pdm_manage.service.dao.PdmBomCallMaterial;
|
||||
import org.nl.wms.pdm_manage.service.dao.mapper.PdmBomCallMaterialMapper;
|
||||
import org.nl.wms.pdm_manage.service.dto.PdmBomCallMaterialDto;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产线叫料单 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-08-14
|
||||
*/
|
||||
@Service
|
||||
public class PdmBomCallMaterialServiceImpl extends ServiceImpl<PdmBomCallMaterialMapper, PdmBomCallMaterial> implements IPdmBomCallMaterialService {
|
||||
|
||||
@Override
|
||||
public IPage<PdmBomCallMaterialDto> queryAll(Map whereJson, PageQuery page) {
|
||||
return this.baseMapper.queryAllByPage(new Page<>(page.getPage() + 1, page.getSize()),
|
||||
whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void create(PdmBomCallMaterial dto) {
|
||||
dto.setBom_id(IdUtil.getStringId());
|
||||
dto.setBom_status(BomEnum.CALL_BOM_STATUS.code("生成"));
|
||||
dto.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
dto.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
dto.setCreate_time(DateUtil.now());
|
||||
this.save(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void update(PdmBomCallMaterial dto) {
|
||||
this.updateById(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(Set<String> ids) {
|
||||
this.baseMapper.deleteBatchIds(ids);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user