免检物料

This commit is contained in:
zhangke 2026-04-11 15:58:31 +08:00
parent e01ab6e094
commit c3c6bccc56
20 changed files with 1132 additions and 4 deletions

View File

@ -0,0 +1,138 @@
package com.nflg.qms.admin.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nflg.wms.common.pojo.ApiResult;
import com.nflg.wms.common.pojo.PageData;
import com.nflg.wms.common.pojo.qo.*;
import com.nflg.wms.common.pojo.vo.QmsExemptMaterialVO;
import com.nflg.wms.common.util.VUtil;
import com.nflg.wms.repository.entity.QmsExemptMaterial;
import com.nflg.wms.repository.entity.QmsQcMaterial;
import com.nflg.wms.repository.entity.UserSupplier;
import com.nflg.wms.repository.service.IQmsExemptMaterialService;
import com.nflg.wms.repository.service.IQmsQcMaterialService;
import com.nflg.wms.repository.service.IUserSupplierService;
import com.nflg.wms.starter.BaseController;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
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 java.util.List;
import java.util.Objects;
/**
* 免检物料管理
*/
@RestController
@RequestMapping("/exemptMaterial")
public class QmsExemptMaterialController extends BaseController {
@Resource
private IQmsExemptMaterialService exemptMaterialService;
@Resource
private IUserSupplierService userSupplierService;
@Resource
private IQmsQcMaterialService qcMaterialService;
/**
* 分页查询免检物料列表
*/
@PostMapping("search")
public ApiResult<PageData<QmsExemptMaterialVO>> search(@Valid @RequestBody QmsExemptMaterialSearchQO request) {
return ApiResult.success(exemptMaterialService.search(request));
}
/**
* 保存免检物料新增/编辑
*/
@PostMapping("save")
public ApiResult<Void> save(@RequestBody QmsExemptMaterialSaveQO request) {
exemptMaterialService.saveExemptMaterial(request);
return ApiResult.success();
}
/**
* 按供应商ID查询免检物料明细
*/
@PostMapping("detailBySupplier")
public ApiResult<List<QmsExemptMaterialVO>> detailBySupplier(@RequestBody QmsExemptMaterialDetailBySupplierQO request) {
return ApiResult.success(exemptMaterialService.detailBySupplier(request.getSupplierId()));
}
/**
* 按物料编号查询免检物料明细
*/
@PostMapping("detailByMaterial")
public ApiResult<List<QmsExemptMaterialVO>> detailByMaterial(@RequestBody QmsExemptMaterialDetailByMaterialQO request) {
return ApiResult.success(exemptMaterialService.detailByMaterial(request.getMaterialNo()));
}
/**
* 分页搜索供应商列表供选择弹窗使用
*/
@PostMapping("supplierList")
public ApiResult<PageData<UserSupplier>> supplierList(@RequestBody SupplierListSelectQO request) {
LambdaQueryWrapper<UserSupplier> wrapper = new LambdaQueryWrapper<>();
if (request.getKeyword() != null && !request.getKeyword().isEmpty()) {
wrapper.and(w -> w.like(UserSupplier::getSupplierCode, request.getKeyword())
.or().like(UserSupplier::getSupplierName, request.getKeyword()));
}
wrapper.orderByDesc(UserSupplier::getCreateTime);
IPage<UserSupplier> result = userSupplierService.page(new Page<>(request.getPage(), request.getPageSize()), wrapper);
return ApiResult.success(result);
}
/**
* 分页搜索质检物料列表供选择弹窗使用
*/
@PostMapping("materialList")
public ApiResult<PageData<QmsQcMaterial>> materialList(@RequestBody MaterialListSelectQO request) {
LambdaQueryWrapper<QmsQcMaterial> wrapper = new LambdaQueryWrapper<>();
if (request.getKeyword() != null && !request.getKeyword().isEmpty()) {
wrapper.and(w -> w.like(QmsQcMaterial::getMaterialNo, request.getKeyword())
.or().like(QmsQcMaterial::getMaterialDesc, request.getKeyword()));
}
wrapper.orderByDesc(QmsQcMaterial::getCreateTime);
IPage<QmsQcMaterial> result = qcMaterialService.page(new Page<>(request.getPage(), request.getPageSize()), wrapper);
return ApiResult.success(result);
}
/**
* 启用/禁用切换
*/
@PostMapping("toggleEnable")
public ApiResult<Void> toggleEnable(@RequestBody ToggleEnableQO request) {
exemptMaterialService.toggleEnable(request.getId(), request.getEnableStatus());
return ApiResult.success();
}
/**
* 审核免检物料
*/
@PostMapping("audit")
public ApiResult<Void> audit(@RequestBody QmsExemptMaterialAuditQO request) {
exemptMaterialService.audit(request);
return ApiResult.success();
}
/**
* 删除免检物料
*/
@PostMapping("delete")
public ApiResult<Void> delete(@RequestBody @NotNull List<Long> ids) {
//如果当前数据是审核状态的时候则不允许删除
boolean hasAudited = exemptMaterialService.listByIds(ids).stream()
.anyMatch(m -> m.getAuditStatus() != null && m.getAuditStatus() == 1);
VUtil.trueThrowBusinessError(hasAudited).throwMessage("此数据已审核,不能删除");
exemptMaterialService.removeByIds(ids);
return ApiResult.success();
}
}

View File

@ -0,0 +1,15 @@
package com.nflg.wms.common.pojo.qo;
import com.nflg.wms.common.pojo.qo.PageQO;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 质检物料列表查询选择弹窗用
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class MaterialListSelectQO extends PageQO {
private String keyword;
}

View File

@ -0,0 +1,25 @@
package com.nflg.wms.common.pojo.qo;
import lombok.Data;
/**
* 免检物料审核请求
*/
@Data
public class QmsExemptMaterialAuditQO {
/**
* 免检物料ID
*/
private Long id;
/**
* 审核结果true 通过false 驳回
*/
private Boolean pass;
/**
* 驳回原因驳回时必填
*/
private String rejectReason;
}

View File

@ -0,0 +1,12 @@
package com.nflg.wms.common.pojo.qo;
import lombok.Data;
/**
* 按物料查询免检物料明细 请求
*/
@Data
public class QmsExemptMaterialDetailByMaterialQO {
private String materialNo;
}

View File

@ -0,0 +1,12 @@
package com.nflg.wms.common.pojo.qo;
import lombok.Data;
/**
* 按供应商查询免检物料明细 请求
*/
@Data
public class QmsExemptMaterialDetailBySupplierQO {
private Long supplierId;
}

View File

@ -0,0 +1,76 @@
package com.nflg.wms.common.pojo.qo;
import lombok.Data;
import java.util.List;
/**
* 免检物料 保存请求对象
*/
@Data
public class QmsExemptMaterialSaveQO {
/**
* 供应商ID按供应商模式时使用
*/
private Long supplierId;
/**
* 物料编号按物料模式时使用
*/
private String materialNo;
/**
* 头部免检模式0 永久1 周期
*/
private Integer exemptMode;
/**
* 头部有效期开始日期
*/
private String validStartDate;
/**
* 头部有效期结束日期
*/
private String validEndDate;
/**
* 明细列表
*/
private List<Item> items;
@Data
public static class Item {
/**
* 已有记录ID编辑时使用
*/
private Long id;
/**
* 物料编号按供应商模式时每行的物料
*/
private String materialNo;
/**
* 供应商ID按物料模式时每行的供应商
*/
private Long supplierId;
/**
* 免检模式0 永久1 周期
*/
private Integer exemptMode;
/**
* 有效期开始日期
*/
private String validStartDate;
/**
* 有效期结束日期
*/
private String validEndDate;
}
}

View File

@ -0,0 +1,62 @@
package com.nflg.wms.common.pojo.qo;
import lombok.Data;
import java.time.LocalDate;
/**
* 免检物料 列表查询参数
*/
@Data
public class QmsExemptMaterialSearchQO extends PageQO {
/**
* 供应商编码或名称模糊搜索
*/
private String supplier;
/**
* 物料编码
*/
private String materialNo;
/**
* 免检模式0 永久1 周期
*/
private Integer exemptMode;
/**
* 审核状态0 待审核1 已审核2 已驳回
*/
private Integer auditStatus;
/**
* 启用状态false 禁用true 启用
*/
private Boolean enableStatus;
/**
* 有效开始日期 - 起始
*/
private LocalDate validStartDateBegin;
/**
* 有效开始日期 - 结束
*/
private LocalDate validStartDateEnd;
/**
* 有效结束日期 - 起始
*/
private LocalDate validEndDateBegin;
/**
* 有效结束日期 - 结束
*/
private LocalDate validEndDateEnd;
/**
* 有效状态0 已过期1 有效中
*/
private Integer validStatus;
}

View File

@ -0,0 +1,15 @@
package com.nflg.wms.common.pojo.qo;
import com.nflg.wms.common.pojo.qo.PageQO;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 供应商列表查询选择弹窗用
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class SupplierListSelectQO extends PageQO {
private String keyword;
}

View File

@ -0,0 +1,13 @@
package com.nflg.wms.common.pojo.qo;
import lombok.Data;
/**
* 启用/禁用切换请求
*/
@Data
public class ToggleEnableQO {
private Long id;
private Boolean enableStatus;
}

View File

@ -0,0 +1,107 @@
package com.nflg.wms.common.pojo.vo;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 免检物料 列表VO
*/
@Data
public class QmsExemptMaterialVO {
/**
* 免检物料ID
*/
private Long id;
/**
* 供应商ID
*/
private Long supplierId;
/**
* 供应商编码
*/
private String supplierCode;
/**
* 供应商名称
*/
private String supplierName;
/**
* 物料编号
*/
private String materialNo;
/**
* 物料描述
*/
private String materialDesc;
/**
* 审核状态0 待审核1 已审核2 已驳回
*/
private Integer auditStatus;
/**
* 驳回原因
*/
private String rejectReason;
/**
* 启用状态false 禁用true 启用
*/
private Boolean enableStatus;
/**
* 免检模式0 永久1 周期
*/
private Integer exemptMode;
/**
* 有效期开始日期
*/
private LocalDateTime validStartDate;
/**
* 有效期结束日期
*/
private LocalDateTime validEndDate;
/**
* 是否有效0 已过期1 有效中
*/
private Integer validStatus;
/**
* 审核人
*/
private String auditorName;
/**
* 审核时间
*/
private LocalDateTime auditTime;
/**
* 创建人名称
*/
private String createByName;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 修改人名称
*/
private String updateByName;
/**
* 修改时间
*/
private LocalDateTime updateTime;
}

View File

@ -0,0 +1,115 @@
package com.nflg.wms.repository.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 免检物料
* </p>
*/
@Getter
@Setter
@ToString
@Accessors(chain = true)
@TableName("qms_exempt_material")
public class QmsExemptMaterial implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.ASSIGN_ID)
private Long id;
/**
* 物料编号关联qms_qc_material表的material_no
*/
private String materialNo;
/**
* 供应商ID关联qms_supplier_sqe_map表的supplier_id
*/
private Long supplierId;
/**
* 审核状态0 待审核1 已审核2 已驳回
*/
private Integer auditStatus;
/**
* 启用状态false 禁用true 启用
*/
private Boolean enableStatus;
/**
* 免检模式0 永久1 周期
*/
private Integer exemptMode;
/**
* 有效期开始日期
*/
private LocalDateTime validStartDate;
/**
* 有效期结束日期
*/
private LocalDateTime validEndDate;
/**
* 审核人ID
*/
private Long auditorId;
/**
* 审核人
*/
private String auditorName;
/**
* 审核时间
*/
private LocalDateTime auditTime;
/**
* 驳回原因
*/
private String rejectReason;
/**
* 创建人ID
*/
private Long createBy;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 创建人名称
*/
private String createByName;
/**
* 修改时间
*/
private LocalDateTime updateTime;
/**
* 修改人ID
*/
private Long updateBy;
/**
* 修改人名称
*/
private String updateByName;
}

View File

@ -0,0 +1,120 @@
package com.nflg.wms.repository.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 来料检测质检任务的抽样检测类型调整表
* </p>
*/
@Getter
@Setter
@ToString
@Accessors(chain = true)
@TableName("qms_qc_material")
public class QmsQcMaterial implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.ASSIGN_ID)
private Long id;
/**
* 物料编号
*/
private String materialNo;
/**
* 物料描述
*/
private String materialDesc;
/**
* 描述是否变更 false 未变更true 已变更
*/
private Boolean materialDescIsUpgrade;
/**
* 物料类别
*/
private String materialCategoryCode;
/**
* 物料类别全路径名称
*/
private String materialCategoryCodePathName;
/**
* 物料图号
*/
private String drawingNo;
/**
* 图号版本号
*/
private String drawingNoVer;
/**
* 物料名称
*/
private String materialName;
/**
* 物料材质
*/
private String materialTexture;
/**
* 物料规格
*/
private String materialSpecifications;
/**
* 规则是否已维护; false 未维护true 已维护
*/
private Boolean isStandardMaintained;
/**
* 创建方式 0 人工操作1 系统同步
*/
private Integer createdType;
/**
* 创建人ID
*/
private Long createBy;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 创建人名称
*/
private String createByName;
/**
* 修改时间
*/
private LocalDateTime updateTime;
/**
* 修改人ID
*/
private Long updateBy;
/**
* 修改人名称
*/
private String updateByName;
}

View File

@ -0,0 +1,32 @@
package com.nflg.wms.repository.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nflg.wms.common.pojo.qo.QmsExemptMaterialSearchQO;
import com.nflg.wms.common.pojo.vo.QmsExemptMaterialVO;
import com.nflg.wms.repository.entity.QmsExemptMaterial;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 免检物料 Mapper 接口
*/
public interface QmsExemptMaterialMapper extends BaseMapper<QmsExemptMaterial> {
/**
* 分页查询免检物料列表JOIN 供应商表和质检物料表
*/
IPage<QmsExemptMaterialVO> search(@Param("request") QmsExemptMaterialSearchQO request, Page<QmsExemptMaterialVO> page);
/**
* 按供应商ID查询关联的免检物料明细
*/
List<QmsExemptMaterialVO> detailBySupplier(@Param("supplierId") Long supplierId);
/**
* 按物料编号查询关联的供应商免检明细
*/
List<QmsExemptMaterialVO> detailByMaterial(@Param("materialNo") String materialNo);
}

View File

@ -0,0 +1,10 @@
package com.nflg.wms.repository.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nflg.wms.repository.entity.QmsQcMaterial;
/**
* 质检物料 Mapper 接口
*/
public interface QmsQcMaterialMapper extends BaseMapper<QmsQcMaterial> {
}

View File

@ -0,0 +1,47 @@
package com.nflg.wms.repository.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.nflg.wms.common.pojo.qo.QmsExemptMaterialAuditQO;
import com.nflg.wms.common.pojo.qo.QmsExemptMaterialSaveQO;
import com.nflg.wms.common.pojo.qo.QmsExemptMaterialSearchQO;
import com.nflg.wms.common.pojo.vo.QmsExemptMaterialVO;
import com.nflg.wms.repository.entity.QmsExemptMaterial;
import java.util.List;
/**
* 免检物料 服务类
*/
public interface IQmsExemptMaterialService extends IService<QmsExemptMaterial> {
/**
* 分页查询免检物料列表
*/
IPage<QmsExemptMaterialVO> search(QmsExemptMaterialSearchQO request);
/**
* 保存免检物料新增/编辑
*/
void saveExemptMaterial(QmsExemptMaterialSaveQO request);
/**
* 按供应商ID查询免检物料明细
*/
List<QmsExemptMaterialVO> detailBySupplier(Long supplierId);
/**
* 按物料编号查询免检物料明细
*/
List<QmsExemptMaterialVO> detailByMaterial(String materialNo);
/**
* 启用/禁用切换
*/
void toggleEnable(Long id, Boolean enableStatus);
/**
* 审核免检物料
*/
void audit(QmsExemptMaterialAuditQO request);
}

View File

@ -0,0 +1,10 @@
package com.nflg.wms.repository.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.nflg.wms.repository.entity.QmsQcMaterial;
/**
* 质检物料 服务类
*/
public interface IQmsQcMaterialService extends IService<QmsQcMaterial> {
}

View File

@ -0,0 +1,169 @@
package com.nflg.wms.repository.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.nflg.wms.common.constant.STATE;
import com.nflg.wms.common.exception.NflgException;
import com.nflg.wms.common.pojo.qo.QmsExemptMaterialAuditQO;
import com.nflg.wms.common.pojo.qo.QmsExemptMaterialSaveQO;
import com.nflg.wms.common.pojo.qo.QmsExemptMaterialSearchQO;
import com.nflg.wms.common.pojo.vo.QmsExemptMaterialVO;
import com.nflg.wms.common.util.StringUtil;
import com.nflg.wms.common.util.UserUtil;
import com.nflg.wms.repository.entity.QmsExemptMaterial;
import com.nflg.wms.repository.mapper.QmsExemptMaterialMapper;
import com.nflg.wms.repository.service.IQmsExemptMaterialService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
/**
* 免检物料 服务实现类
*/
@Service
public class QmsExemptMaterialServiceImpl extends ServiceImpl<QmsExemptMaterialMapper, QmsExemptMaterial>
implements IQmsExemptMaterialService {
private static final DateTimeFormatter DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
@Override
public IPage<QmsExemptMaterialVO> search(QmsExemptMaterialSearchQO request) {
return baseMapper.search(request, new Page<>(request.getPage(), request.getPageSize()));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void saveExemptMaterial(QmsExemptMaterialSaveQO request) {
if (request.getItems() == null || request.getItems().isEmpty()) {
throw new NflgException(STATE.BusinessError, "明细列表不能为空");
}
Long userId = UserUtil.getUserId();
String userName = UserUtil.getUserName();
LocalDateTime now = LocalDateTime.now();
List<QmsExemptMaterial> toSave = new ArrayList<>();
for (QmsExemptMaterialSaveQO.Item item : request.getItems()) {
// 确定 supplierId materialNo
Long supplierId = item.getSupplierId() != null ? item.getSupplierId() : request.getSupplierId();
String materialNo = item.getMaterialNo() != null ? item.getMaterialNo() : request.getMaterialNo();
if (supplierId == null || materialNo == null || materialNo.isEmpty()) {
throw new NflgException(STATE.BusinessError, "供应商和物料编号不能为空");
}
// 唯一性校验(material_no + supplier_id)
LambdaQueryWrapper<QmsExemptMaterial> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(QmsExemptMaterial::getMaterialNo, materialNo)
.eq(QmsExemptMaterial::getSupplierId, supplierId);
if (item.getId() != null) {
wrapper.ne(QmsExemptMaterial::getId, item.getId());
}
long count = this.count(wrapper);
if (count > 0) {
throw new NflgException(STATE.BusinessError, "物料编号[" + materialNo + "]与该供应商的免检记录已存在");
}
QmsExemptMaterial entity;
if (item.getId() != null) {
entity = this.getById(item.getId());
if (entity == null) {
throw new NflgException(STATE.BusinessError, "记录不存在ID" + item.getId());
}
entity.setUpdateBy(userId);
entity.setUpdateByName(userName);
entity.setUpdateTime(now);
} else {
entity = new QmsExemptMaterial();
entity.setSupplierId(supplierId);
entity.setMaterialNo(materialNo);
entity.setAuditStatus(0);
entity.setEnableStatus(true);
entity.setCreateBy(userId);
entity.setCreateByName(userName);
entity.setCreateTime(now);
entity.setUpdateBy(userId);
entity.setUpdateByName(userName);
entity.setUpdateTime(now);
}
entity.setExemptMode(item.getExemptMode());
if (item.getValidStartDate() != null && !item.getValidStartDate().isEmpty()) {
entity.setValidStartDate(parseDate(item.getValidStartDate()));
} else {
entity.setValidStartDate(null);
}
if (item.getValidEndDate() != null && !item.getValidEndDate().isEmpty()) {
entity.setValidEndDate(parseDate(item.getValidEndDate()));
} else {
entity.setValidEndDate(null);
}
toSave.add(entity);
}
this.saveOrUpdateBatch(toSave);
}
@Override
public List<QmsExemptMaterialVO> detailBySupplier(Long supplierId) {
return baseMapper.detailBySupplier(supplierId);
}
@Override
public List<QmsExemptMaterialVO> detailByMaterial(String materialNo) {
return baseMapper.detailByMaterial(materialNo);
}
@Override
public void toggleEnable(Long id, Boolean enableStatus) {
QmsExemptMaterial entity = this.getById(id);
if (entity == null) {
throw new NflgException(STATE.BusinessError, "记录不存在");
}
entity.setEnableStatus(enableStatus);
entity.setUpdateBy(UserUtil.getUserId());
entity.setUpdateByName(UserUtil.getUserName());
entity.setUpdateTime(LocalDateTime.now());
this.updateById(entity);
}
@Override
public void audit(QmsExemptMaterialAuditQO request) {
QmsExemptMaterial entity = this.getById(request.getId());
if (entity == null) {
throw new NflgException(STATE.BusinessError, "记录不存在");
}
if (Boolean.TRUE.equals(request.getPass())) {
entity.setAuditStatus(1);
entity.setRejectReason("");
} else {
if (request.getRejectReason() == null || request.getRejectReason().trim().isEmpty()) {
throw new NflgException(STATE.BusinessError, "驳回时必须填写驳回原因");
}
entity.setAuditStatus(2);
entity.setRejectReason(request.getRejectReason());
}
entity.setAuditorId(UserUtil.getUserId());
entity.setAuditorName(UserUtil.getUserName());
entity.setAuditTime(LocalDateTime.now());
entity.setUpdateBy(UserUtil.getUserId());
entity.setUpdateByName(UserUtil.getUserName());
entity.setUpdateTime(LocalDateTime.now());
this.updateById(entity);
}
private LocalDateTime parseDate(String dateStr) {
if (dateStr.length() == 10) {
dateStr = dateStr + " 00:00:00";
}
return LocalDateTime.parse(dateStr, DATE_FMT);
}
}

View File

@ -0,0 +1,15 @@
package com.nflg.wms.repository.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nflg.wms.repository.entity.QmsQcMaterial;
import com.nflg.wms.repository.mapper.QmsQcMaterialMapper;
import com.nflg.wms.repository.service.IQmsQcMaterialService;
import org.springframework.stereotype.Service;
/**
* 质检物料 服务实现类
*/
@Service
public class QmsQcMaterialServiceImpl extends ServiceImpl<QmsQcMaterialMapper, QmsQcMaterial>
implements IQmsQcMaterialService {
}

View File

@ -0,0 +1,137 @@
<?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.wms.repository.mapper.QmsExemptMaterialMapper">
<!-- 分页查询免检物料列表JOIN 供应商表和质检物料表 -->
<select id="search" resultType="com.nflg.wms.common.pojo.vo.QmsExemptMaterialVO">
SELECT
em.id,
em.supplier_id,
us.supplier_code,
us.supplier_name,
em.material_no,
qm.material_desc,
em.audit_status,
em.enable_status,
em.exempt_mode,
em.valid_start_date,
em.valid_end_date,
em.reject_reason,
CASE
WHEN em.exempt_mode = 0 THEN 1
WHEN em.exempt_mode = 1 AND em.valid_end_date IS NOT NULL AND em.valid_end_date &gt;= NOW() THEN 1
ELSE 0
END AS valid_status,
em.auditor_name,
em.audit_time,
em.create_by_name,
em.create_time,
em.update_by_name,
em.update_time
FROM qms_exempt_material em
LEFT JOIN user_supplier us ON us.id = em.supplier_id
LEFT JOIN qms_qc_material qm ON qm.material_no = em.material_no
<where>
<if test="request.supplier != null and request.supplier != ''">
AND (us.supplier_code ILIKE CONCAT('%', #{request.supplier}, '%')
OR us.supplier_name ILIKE CONCAT('%', #{request.supplier}, '%'))
</if>
<if test="request.materialNo != null and request.materialNo != ''">
AND em.material_no ILIKE CONCAT('%', #{request.materialNo}, '%')
</if>
<if test="request.exemptMode != null">
AND em.exempt_mode = #{request.exemptMode}
</if>
<if test="request.auditStatus != null">
AND em.audit_status = #{request.auditStatus}
</if>
<if test="request.enableStatus != null">
AND em.enable_status = #{request.enableStatus}
</if>
<if test="request.validStartDateBegin != null">
AND em.valid_start_date &gt;= #{request.validStartDateBegin}
</if>
<if test="request.validStartDateEnd != null">
AND em.valid_start_date &lt;= #{request.validStartDateEnd}
</if>
<if test="request.validEndDateBegin != null">
AND em.valid_end_date &gt;= #{request.validEndDateBegin}
</if>
<if test="request.validEndDateEnd != null">
AND em.valid_end_date &lt;= #{request.validEndDateEnd}
</if>
<if test="request.validStatus != null and request.validStatus == 1">
AND (em.exempt_mode = 0 OR (em.exempt_mode = 1 AND em.valid_end_date IS NOT NULL AND em.valid_end_date &gt;= NOW()))
</if>
<if test="request.validStatus != null and request.validStatus == 0">
AND em.exempt_mode = 1 AND (em.valid_end_date IS NULL OR em.valid_end_date &lt; NOW())
</if>
</where>
ORDER BY em.create_time DESC
</select>
<!-- 按供应商查询关联的免检物料明细 -->
<select id="detailBySupplier" resultType="com.nflg.wms.common.pojo.vo.QmsExemptMaterialVO">
SELECT
em.id,
em.supplier_id,
us.supplier_code,
us.supplier_name,
em.material_no,
qm.material_desc,
em.audit_status,
em.enable_status,
em.exempt_mode,
em.valid_start_date,
em.valid_end_date,
CASE
WHEN em.exempt_mode = 0 THEN 1
WHEN em.exempt_mode = 1 AND em.valid_end_date IS NOT NULL AND em.valid_end_date &gt;= NOW() THEN 1
ELSE 0
END AS valid_status,
em.auditor_name,
em.audit_time,
em.create_by_name,
em.create_time,
em.update_by_name,
em.update_time
FROM qms_exempt_material em
LEFT JOIN user_supplier us ON us.id = em.supplier_id
LEFT JOIN qms_qc_material qm ON qm.material_no = em.material_no
WHERE em.supplier_id = #{supplierId}
ORDER BY em.create_time DESC
</select>
<!-- 按物料查询关联的供应商免检明细 -->
<select id="detailByMaterial" resultType="com.nflg.wms.common.pojo.vo.QmsExemptMaterialVO">
SELECT
em.id,
em.supplier_id,
us.supplier_code,
us.supplier_name,
em.material_no,
qm.material_desc,
em.audit_status,
em.enable_status,
em.exempt_mode,
em.valid_start_date,
em.valid_end_date,
CASE
WHEN em.exempt_mode = 0 THEN 1
WHEN em.exempt_mode = 1 AND em.valid_end_date IS NOT NULL AND em.valid_end_date &gt;= NOW() THEN 1
ELSE 0
END AS valid_status,
em.auditor_name,
em.audit_time,
em.create_by_name,
em.create_time,
em.update_by_name,
em.update_time
FROM qms_exempt_material em
LEFT JOIN user_supplier us ON us.id = em.supplier_id
LEFT JOIN qms_qc_material qm ON qm.material_no = em.material_no
WHERE em.material_no = #{materialNo}
ORDER BY em.create_time DESC
</select>
</mapper>

View File

@ -33,6 +33,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<maven.test.skip>true</maven.test.skip>
<lombok.version>1.18.38</lombok.version>
<spring-cloud.version>2023.0.1</spring-cloud.version>
<spring-cloud-alibaba.version>2023.0.1.0</spring-cloud-alibaba.version>
@ -240,10 +241,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.2</version>
<configuration>
<includes>
<include>**/**.java</include>
</includes>
<excludedGroups>org.junit.vintage</excludedGroups>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>