Compare commits
2 Commits
afe72bbce9
...
aea418d78c
| Author | SHA1 | Date |
|---|---|---|
|
|
aea418d78c | |
|
|
34a33118f9 |
|
|
@ -10,7 +10,6 @@ import com.nflg.wms.common.pojo.PageData;
|
|||
import com.nflg.wms.common.pojo.dto.QmsInspectionItemExportDTO;
|
||||
import com.nflg.wms.common.pojo.dto.QmsInspectionItemImportDTO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsInspectionItemAddQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsInspectionItemDetailAddQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsInspectionItemSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsInspectionItemUpdateQO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsInspectionItemDetailsVO;
|
||||
|
|
@ -55,7 +54,7 @@ public class QmsInspectionItemController extends BaseController {
|
|||
// ==================== 主表 CRUD ====================
|
||||
|
||||
/**
|
||||
* 新增检测项(同时插入一条明细)
|
||||
* 新增检测项(同时插入明细)
|
||||
*/
|
||||
@Transactional
|
||||
@PostMapping("add")
|
||||
|
|
@ -77,7 +76,7 @@ public class QmsInspectionItemController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 修改检测项
|
||||
* 修改检测项(主表 + 明细列表全量替换)
|
||||
*/
|
||||
@Transactional
|
||||
@PostMapping("update")
|
||||
|
|
@ -86,30 +85,6 @@ public class QmsInspectionItemController extends BaseController {
|
|||
return ApiResult.success();
|
||||
}
|
||||
|
||||
// ==================== 明细操作 ====================
|
||||
|
||||
/**
|
||||
* 明细新增
|
||||
*/
|
||||
@Transactional
|
||||
@PostMapping("addDetail")
|
||||
public ApiResult<Void> addDetail(@Valid @RequestBody QmsInspectionItemDetailAddQO qo) {
|
||||
inspectionItemService.addDetail(qo);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 明细删除(批量)
|
||||
*
|
||||
* @param detailIds 明细ID列表
|
||||
*/
|
||||
@Transactional
|
||||
@PostMapping("deleteDetails")
|
||||
public ApiResult<Void> deleteDetails(@RequestBody List<Long> detailIds) {
|
||||
inspectionItemService.deleteDetails(detailIds);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
// ==================== 查询 ====================
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,12 +3,14 @@ package com.nflg.qms.admin.controller;
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.PageData;
|
||||
import com.nflg.wms.common.pojo.qo.QmsMaterialsByUserQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsQualityInspectorAddQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsQualityInspectorSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsQualityInspectorStatusQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsQualityInspectorTransferQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsQualityInspectorUpdateQO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsQualityInspectorDetailVO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsQualityInspectorMaterialVO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsQualityInspectorVO;
|
||||
import com.nflg.wms.repository.service.IQmsQualityInspectorService;
|
||||
import com.nflg.wms.starter.BaseController;
|
||||
|
|
@ -18,6 +20,8 @@ import jakarta.validation.constraints.NotNull;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 质检人员管理
|
||||
*/
|
||||
|
|
@ -109,4 +113,14 @@ public class QmsQualityInspectorController extends BaseController {
|
|||
qualityInspectorService.cancelTransfer(userId);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 按当前登录用户查询绑定的物料列表(支持物料编号/类别/描述过滤)
|
||||
*
|
||||
* @param qo 查询参数(materialNo/materialCategoryCode/materialDesc可选)
|
||||
*/
|
||||
@PostMapping("materialsByUser")
|
||||
public ApiResult<List<QmsQualityInspectorMaterialVO>> materialsByUser(@RequestBody QmsMaterialsByUserQO qo) {
|
||||
return ApiResult.success(qualityInspectorService.getMaterialsByUserId(qo.getMaterialNo(), qo.getMaterialCategoryCode(), qo.getMaterialDesc()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@ import com.nflg.wms.common.pojo.qo.EnableQO;
|
|||
import com.nflg.wms.common.pojo.qo.QmsSupplierSqeSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsSetSupplierQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsSetUserQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsUserMaterialsQO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsSupplierSqeMapVO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsUserSupplierVO;
|
||||
import com.nflg.wms.repository.service.IQmsSupplierSqeMapService;
|
||||
import com.nflg.wms.starter.BaseController;
|
||||
import jakarta.annotation.Resource;
|
||||
|
|
@ -16,6 +18,8 @@ import jakarta.validation.constraints.NotNull;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 供应商-用户 关联管理
|
||||
*/
|
||||
|
|
@ -75,4 +79,14 @@ public class QmsSupplierSqeController extends BaseController {
|
|||
supplierSqeMapService.deleteById(id);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 按当前登录用户查询关联的供应商列表(支持供应商过滤)
|
||||
*
|
||||
* @param qo 查询参数(supplierCode/supplierName可选)
|
||||
*/
|
||||
@PostMapping("supplierByUser")
|
||||
public ApiResult<List<QmsUserSupplierVO>> supplierByUser(@RequestBody QmsUserMaterialsQO qo) {
|
||||
return ApiResult.success(supplierSqeMapService.getSuppliersByUserId(qo.getSupplierCode(), qo.getSupplierName()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 新增检测项参数(同时创建主表和一条明细)
|
||||
* 新增检测项参数(主表 + 多条明细)
|
||||
*/
|
||||
@Data
|
||||
public class QmsInspectionItemAddQO {
|
||||
|
|
@ -34,6 +38,18 @@ public class QmsInspectionItemAddQO {
|
|||
@NotBlank(message = "检测项编号不能为空")
|
||||
private String inspectionNo;
|
||||
|
||||
/**
|
||||
* 明细列表(必传,至少一条)
|
||||
*/
|
||||
@NotEmpty(message = "明细列表不能为空")
|
||||
@Valid
|
||||
private List<DetailQO> details;
|
||||
|
||||
/**
|
||||
* 明细参数
|
||||
*/
|
||||
@Data
|
||||
public static class DetailQO {
|
||||
/**
|
||||
* 检测标准(必传)
|
||||
*/
|
||||
|
|
@ -50,4 +66,5 @@ public class QmsInspectionItemAddQO {
|
|||
*/
|
||||
@NotNull(message = "判定类型不能为空")
|
||||
private Integer determinationType;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 修改检测项参数
|
||||
* 修改检测项参数(主表 + 明细列表全量替换)
|
||||
*/
|
||||
@Data
|
||||
public class QmsInspectionItemUpdateQO {
|
||||
|
|
@ -36,7 +40,18 @@ public class QmsInspectionItemUpdateQO {
|
|||
private String inspectionNo;
|
||||
|
||||
/**
|
||||
* 检测标准(可选,修改对应的明细)
|
||||
* 明细列表(可选,传入则全量替换原有明细)
|
||||
*/
|
||||
@Valid
|
||||
private List<DetailQO> details;
|
||||
|
||||
/**
|
||||
* 明细参数
|
||||
*/
|
||||
@Data
|
||||
public static class DetailQO {
|
||||
/**
|
||||
* 检测标准(必传)
|
||||
*/
|
||||
private String testStandard;
|
||||
|
||||
|
|
@ -46,12 +61,8 @@ public class QmsInspectionItemUpdateQO {
|
|||
private String legend;
|
||||
|
||||
/**
|
||||
* 判定类型:0=目视,1=量具(可选)
|
||||
* 判定类型:0=目视,1=量具(必传)
|
||||
*/
|
||||
private Integer determinationType;
|
||||
|
||||
/**
|
||||
* 明细表ID(可选,若传入则更新指定明细,否则更新第一条明细)
|
||||
*/
|
||||
private Long detailId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 按用户查询绑定物料参数
|
||||
*/
|
||||
@Data
|
||||
public class QmsMaterialsByUserQO {
|
||||
|
||||
/**
|
||||
* 物料编号(精确,可选)
|
||||
*/
|
||||
private String materialNo;
|
||||
|
||||
/**
|
||||
* 物料类别编码(精确,可选)
|
||||
*/
|
||||
private String materialCategoryCode;
|
||||
|
||||
/**
|
||||
* 物料描述(模糊,可选)
|
||||
*/
|
||||
private String materialDesc;
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 按用户查询供应商列表参数
|
||||
*/
|
||||
@Data
|
||||
public class QmsUserMaterialsQO {
|
||||
|
||||
/**
|
||||
* 供应商编号(精确,可选)
|
||||
*/
|
||||
private String supplierCode;
|
||||
|
||||
/**
|
||||
* 供应商名称(模糊,可选)
|
||||
*/
|
||||
private String supplierName;
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.nflg.wms.common.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户关联的供应商信息
|
||||
*/
|
||||
@Data
|
||||
public class QmsUserSupplierVO {
|
||||
|
||||
/**
|
||||
* 关联记录ID(qms_supplier_sqe_map.id)
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 供应商ID
|
||||
*/
|
||||
private Long supplierId;
|
||||
|
||||
/**
|
||||
* 供应商编号
|
||||
*/
|
||||
private String supplierCode;
|
||||
|
||||
/**
|
||||
* 供应商名称
|
||||
*/
|
||||
private String supplierName;
|
||||
|
||||
/**
|
||||
* 启用状态:true=启用,false=禁用
|
||||
*/
|
||||
private Boolean enable;
|
||||
}
|
||||
|
|
@ -32,6 +32,23 @@ public interface QmsQualityInspectorMapper extends BaseMapper<QmsQualityInspecto
|
|||
*/
|
||||
List<QmsQualityInspectorMaterialVO> getMaterialsByUserId(@Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 按 userId 查询关联物料列表(支持供应商过滤)
|
||||
*/
|
||||
List<QmsQualityInspectorMaterialVO> getMaterialsByUserIdWithSupplier(
|
||||
@Param("userId") Long userId,
|
||||
@Param("supplierCode") String supplierCode,
|
||||
@Param("supplierName") String supplierName);
|
||||
|
||||
/**
|
||||
* 按 userId 查询绑定物料列表(支持物料编号/类别/描述过滤)
|
||||
*/
|
||||
List<QmsQualityInspectorMaterialVO> getMaterialsByUserIdWithFilter(
|
||||
@Param("userId") Long userId,
|
||||
@Param("materialNo") String materialNo,
|
||||
@Param("materialCategoryCode") String materialCategoryCode,
|
||||
@Param("materialDesc") String materialDesc);
|
||||
|
||||
/**
|
||||
* 按 userId 查询关联物料类别列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -4,10 +4,14 @@ 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.QmsSupplierSqeSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsUserMaterialsQO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsSupplierSqeMapVO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsUserSupplierVO;
|
||||
import com.nflg.wms.repository.entity.QmsSupplierSqeMap;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 供应商-用户关联 Mapper 接口
|
||||
|
|
@ -22,4 +26,12 @@ public interface QmsSupplierSqeMapMapper extends BaseMapper<QmsSupplierSqeMap> {
|
|||
* 分页查询关联表(JOIN 供应商/user/user_interior/position,支持动态过滤)
|
||||
*/
|
||||
IPage<QmsSupplierSqeMapVO> searchMap(@Param("request") QmsSupplierSqeSearchQO request, Page<QmsSupplierSqeMapVO> page);
|
||||
|
||||
/**
|
||||
* 按 userId 查询关联的供应商列表(支持供应商过滤)
|
||||
*/
|
||||
List<QmsUserSupplierVO> getSuppliersByUserId(
|
||||
@Param("userId") Long userId,
|
||||
@Param("supplierCode") String supplierCode,
|
||||
@Param("supplierName") String supplierName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import com.nflg.wms.common.pojo.PageData;
|
|||
import com.nflg.wms.common.pojo.dto.QmsInspectionItemExportDTO;
|
||||
import com.nflg.wms.common.pojo.dto.QmsInspectionItemImportDTO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsInspectionItemAddQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsInspectionItemDetailAddQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsInspectionItemSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsInspectionItemUpdateQO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsInspectionItemDetailsVO;
|
||||
|
|
@ -20,7 +19,7 @@ import java.util.List;
|
|||
public interface IQmsInspectionItemService extends IService<QmsInspectionItem> {
|
||||
|
||||
/**
|
||||
* 新增(同时插入主表和一条明细)
|
||||
* 新增(主表 + 多条明细)
|
||||
*/
|
||||
void add(QmsInspectionItemAddQO qo);
|
||||
|
||||
|
|
@ -30,20 +29,10 @@ public interface IQmsInspectionItemService extends IService<QmsInspectionItem> {
|
|||
void delete(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 修改(主表字段动态更新,明细字段同时更新第一条明细)
|
||||
* 修改(主表 + 明细列表全量替换)
|
||||
*/
|
||||
void update(QmsInspectionItemUpdateQO qo);
|
||||
|
||||
/**
|
||||
* 明细新增
|
||||
*/
|
||||
void addDetail(QmsInspectionItemDetailAddQO qo);
|
||||
|
||||
/**
|
||||
* 明细删除(批量)
|
||||
*/
|
||||
void deleteDetails(List<Long> detailIds);
|
||||
|
||||
/**
|
||||
* 分页查询检测项
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,14 +2,18 @@ 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.QmsMaterialsByUserQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsQualityInspectorAddQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsQualityInspectorSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsQualityInspectorTransferQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsQualityInspectorUpdateQO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsQualityInspectorDetailVO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsQualityInspectorMaterialVO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsQualityInspectorVO;
|
||||
import com.nflg.wms.repository.entity.QmsQualityInspector;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 质检人员物料关系 服务类
|
||||
|
|
@ -59,4 +63,9 @@ public interface IQmsQualityInspectorService extends IService<QmsQualityInspecto
|
|||
* 取消转办(将该质检人所有记录的转办人清空)
|
||||
*/
|
||||
void cancelTransfer(Long userId);
|
||||
|
||||
/**
|
||||
* 按 userId 查询当前用户绑定的物料列表(支持物料编号/类别/描述过滤)
|
||||
*/
|
||||
List<QmsQualityInspectorMaterialVO> getMaterialsByUserId(String materialNo, String materialCategoryCode, String materialDesc);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@ 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.QmsSupplierSqeSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsUserMaterialsQO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsSupplierSqeMapVO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsUserSupplierVO;
|
||||
import com.nflg.wms.repository.entity.QmsSupplierSqeMap;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -42,4 +44,9 @@ public interface IQmsSupplierSqeMapService extends IService<QmsSupplierSqeMap> {
|
|||
* 删除单条供应商-用户关联(启用状态下不允许删除)
|
||||
*/
|
||||
void deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 按 userId 查询该用户关联的供应商列表(支持供应商过滤)
|
||||
*/
|
||||
List<QmsUserSupplierVO> getSuppliersByUserId(String supplierCode, String supplierName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ public class QmsInspectionItemServiceImpl extends ServiceImpl<QmsInspectionItemM
|
|||
String operator = UserUtil.getUserName();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
// 保存主表
|
||||
QmsInspectionItem item = new QmsInspectionItem()
|
||||
.setMaterialTypeId(qo.getMaterialTypeId())
|
||||
.setDetectionType(qo.getDetectionType())
|
||||
|
|
@ -67,13 +68,16 @@ public class QmsInspectionItemServiceImpl extends ServiceImpl<QmsInspectionItemM
|
|||
.setUpdateTime(now);
|
||||
save(item);
|
||||
|
||||
// 批量保存明细
|
||||
for (QmsInspectionItemAddQO.DetailQO detailQO : qo.getDetails()) {
|
||||
QmsInspectionItemDetails detail = new QmsInspectionItemDetails()
|
||||
.setInspectionItemId(item.getId())
|
||||
.setTestStandard(qo.getTestStandard())
|
||||
.setLegend(qo.getLegend())
|
||||
.setDeterminationType(qo.getDeterminationType());
|
||||
.setTestStandard(detailQO.getTestStandard())
|
||||
.setLegend(detailQO.getLegend())
|
||||
.setDeterminationType(detailQO.getDeterminationType());
|
||||
detailsService.save(detail);
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== 删除(批量,同时删除明细) ====================
|
||||
|
||||
|
|
@ -109,6 +113,7 @@ public class QmsInspectionItemServiceImpl extends ServiceImpl<QmsInspectionItemM
|
|||
String operator = UserUtil.getUserName();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
// 更新主表
|
||||
var updater = lambdaUpdate().eq(QmsInspectionItem::getId, qo.getId());
|
||||
if (Objects.nonNull(qo.getMaterialTypeId())) {
|
||||
updater.set(QmsInspectionItem::getMaterialTypeId, qo.getMaterialTypeId());
|
||||
|
|
@ -126,55 +131,23 @@ public class QmsInspectionItemServiceImpl extends ServiceImpl<QmsInspectionItemM
|
|||
.set(QmsInspectionItem::getUpdateTime, now)
|
||||
.update();
|
||||
|
||||
// 明细更新逻辑
|
||||
boolean hasDetailChange = Objects.nonNull(qo.getTestStandard()) || Objects.nonNull(qo.getLegend())
|
||||
|| Objects.nonNull(qo.getDeterminationType());
|
||||
if (hasDetailChange) {
|
||||
// 传入了明细字段,必须同时传入 detailId
|
||||
if (Objects.isNull(qo.getDetailId())) {
|
||||
throw new NflgException(STATE.BusinessError, "修改明细内容时,明细表ID(detailId)不能为空");
|
||||
}
|
||||
var detailUpdater = detailsService.lambdaUpdate()
|
||||
.eq(QmsInspectionItemDetails::getId, qo.getDetailId());
|
||||
if (Objects.nonNull(qo.getTestStandard()) && !qo.getTestStandard().isEmpty()) {
|
||||
detailUpdater.set(QmsInspectionItemDetails::getTestStandard, qo.getTestStandard());
|
||||
}
|
||||
if (Objects.nonNull(qo.getLegend())) {
|
||||
detailUpdater.set(QmsInspectionItemDetails::getLegend, qo.getLegend());
|
||||
}
|
||||
if (Objects.nonNull(qo.getDeterminationType())) {
|
||||
detailUpdater.set(QmsInspectionItemDetails::getDeterminationType, qo.getDeterminationType());
|
||||
}
|
||||
detailUpdater.update();
|
||||
}
|
||||
}
|
||||
// 如果传入了明细列表,全量替换原有明细
|
||||
if (qo.getDetails() != null && !qo.getDetails().isEmpty()) {
|
||||
// 删除原有所有明细
|
||||
detailsService.lambdaUpdate()
|
||||
.eq(QmsInspectionItemDetails::getInspectionItemId, qo.getId())
|
||||
.remove();
|
||||
|
||||
// ==================== 明细新增 ====================
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void addDetail(QmsInspectionItemDetailAddQO qo) {
|
||||
QmsInspectionItem item = getById(qo.getInspectionItemId());
|
||||
if (Objects.isNull(item)) {
|
||||
throw new NflgException(STATE.BusinessError, "检测项不存在");
|
||||
}
|
||||
// 批量插入新明细
|
||||
for (QmsInspectionItemUpdateQO.DetailQO detailQO : qo.getDetails()) {
|
||||
QmsInspectionItemDetails detail = new QmsInspectionItemDetails()
|
||||
.setInspectionItemId(qo.getInspectionItemId())
|
||||
.setTestStandard(qo.getTestStandard())
|
||||
.setLegend(qo.getLegend())
|
||||
.setDeterminationType(qo.getDeterminationType());
|
||||
.setInspectionItemId(qo.getId())
|
||||
.setTestStandard(detailQO.getTestStandard())
|
||||
.setLegend(detailQO.getLegend())
|
||||
.setDeterminationType(detailQO.getDeterminationType());
|
||||
detailsService.save(detail);
|
||||
}
|
||||
|
||||
// ==================== 明细删除 ====================
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void deleteDetails(List<Long> detailIds) {
|
||||
if (detailIds == null || detailIds.isEmpty()) {
|
||||
throw new NflgException(STATE.BusinessError, "明细ID列表不能为空");
|
||||
}
|
||||
detailsService.removeByIds(detailIds);
|
||||
}
|
||||
|
||||
// ==================== 分页查询 ====================
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ 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.QmsMaterialsByUserQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsQualityInspectorAddQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsQualityInspectorSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsQualityInspectorTransferQO;
|
||||
|
|
@ -304,4 +305,10 @@ public class QmsQualityInspectorServiceImpl extends ServiceImpl<QmsQualityInspec
|
|||
.set(QmsQualityInspector::getUpdateTime, LocalDateTime.now())
|
||||
.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QmsQualityInspectorMaterialVO> getMaterialsByUserId(String materialNo, String materialCategoryCode, String materialDesc) {
|
||||
Long userId = UserUtil.getUserId();
|
||||
return baseMapper.getMaterialsByUserIdWithFilter(userId, materialNo, materialCategoryCode, materialDesc);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.nflg.wms.common.constant.STATE;
|
|||
import com.nflg.wms.common.exception.NflgException;
|
||||
import com.nflg.wms.common.pojo.qo.QmsSupplierSqeSearchQO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsSupplierSqeMapVO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsUserSupplierVO;
|
||||
import com.nflg.wms.common.util.UserUtil;
|
||||
import com.nflg.wms.repository.entity.QmsSupplierSqeMap;
|
||||
import com.nflg.wms.repository.mapper.QmsSupplierSqeMapMapper;
|
||||
|
|
@ -122,4 +123,10 @@ public class QmsSupplierSqeMapServiceImpl extends ServiceImpl<QmsSupplierSqeMapM
|
|||
}
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QmsUserSupplierVO> getSuppliersByUserId(String supplierCode, String supplierName) {
|
||||
Long userId = UserUtil.getUserId();
|
||||
return baseMapper.getSuppliersByUserId(userId, supplierCode, supplierName);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,6 +74,64 @@
|
|||
ORDER BY qi.id ASC
|
||||
</select>
|
||||
|
||||
<!-- 按 userId 查询关联物料列表(支持供应商过滤) -->
|
||||
<select id="getMaterialsByUserIdWithSupplier" resultType="com.nflg.wms.common.pojo.vo.QmsQualityInspectorMaterialVO">
|
||||
SELECT
|
||||
qi.id,
|
||||
qi.material_id,
|
||||
m.material_no,
|
||||
m.material_category_code,
|
||||
m.material_category_code_path_name AS material_category_name,
|
||||
m.material_desc AS material_name,
|
||||
m.material_specifications,
|
||||
m.material_texture,
|
||||
m.is_standard_maintained AS material_status
|
||||
FROM qms_quality_inspector qi
|
||||
LEFT JOIN qms_qc_material m ON m.id = qi.material_id
|
||||
LEFT JOIN qms_coa_review cr ON cr.material_id = m.id
|
||||
LEFT JOIN user_supplier us ON us.id = cr.supplier_id
|
||||
WHERE qi.user_id = #{userId}
|
||||
AND qi.material_id IS NOT NULL
|
||||
<if test="supplierCode != null and supplierCode != ''">
|
||||
AND us.supplier_code = #{supplierCode}
|
||||
</if>
|
||||
<if test="supplierName != null and supplierName != ''">
|
||||
AND us.supplier_name LIKE CONCAT('%', #{supplierName}, '%')
|
||||
</if>
|
||||
GROUP BY qi.id, qi.material_id, m.material_no, m.material_category_code,
|
||||
m.material_category_code_path_name, m.material_desc,
|
||||
m.material_specifications, m.material_texture, m.is_standard_maintained
|
||||
ORDER BY qi.id ASC
|
||||
</select>
|
||||
|
||||
<!-- 按 userId 查询绑定物料列表(支持物料编号/类别/描述过滤) -->
|
||||
<select id="getMaterialsByUserIdWithFilter" resultType="com.nflg.wms.common.pojo.vo.QmsQualityInspectorMaterialVO">
|
||||
SELECT
|
||||
qi.id,
|
||||
qi.material_id,
|
||||
m.material_no,
|
||||
m.material_category_code,
|
||||
m.material_category_code_path_name AS material_category_name,
|
||||
m.material_desc AS material_name,
|
||||
m.material_specifications,
|
||||
m.material_texture,
|
||||
m.is_standard_maintained AS material_status
|
||||
FROM qms_quality_inspector qi
|
||||
LEFT JOIN qms_qc_material m ON m.id = qi.material_id
|
||||
WHERE qi.user_id = #{userId}
|
||||
AND qi.material_id IS NOT NULL
|
||||
<if test="materialNo != null and materialNo != ''">
|
||||
AND m.material_no = #{materialNo}
|
||||
</if>
|
||||
<if test="materialCategoryCode != null and materialCategoryCode != ''">
|
||||
AND m.material_category_code = #{materialCategoryCode}
|
||||
</if>
|
||||
<if test="materialDesc != null and materialDesc != ''">
|
||||
AND m.material_desc LIKE CONCAT('%', #{materialDesc}, '%')
|
||||
</if>
|
||||
ORDER BY qi.id ASC
|
||||
</select>
|
||||
|
||||
<!-- 按 userId 查询关联物料类别列表(JOIN qms_qc_material 取类别名称) -->
|
||||
<select id="getCategoriesByUserId" resultType="com.nflg.wms.common.pojo.vo.QmsQualityInspectorCategoryVO">
|
||||
SELECT DISTINCT ON (qi.material_category_code)
|
||||
|
|
|
|||
|
|
@ -37,4 +37,24 @@
|
|||
ORDER BY qssm.id DESC
|
||||
</select>
|
||||
|
||||
<!-- 按 userId 查询关联的供应商列表(支持供应商过滤) -->
|
||||
<select id="getSuppliersByUserId" resultType="com.nflg.wms.common.pojo.vo.QmsUserSupplierVO">
|
||||
SELECT
|
||||
qssm.id,
|
||||
qssm.supplier_id,
|
||||
us.supplier_code,
|
||||
us.supplier_name,
|
||||
qssm.enable
|
||||
FROM qms_supplier_sqe_map qssm
|
||||
LEFT JOIN user_supplier us ON us.id = qssm.supplier_id
|
||||
WHERE qssm.user_id = #{userId}
|
||||
<if test="supplierCode != null and supplierCode != ''">
|
||||
AND us.supplier_code = #{supplierCode}
|
||||
</if>
|
||||
<if test="supplierName != null and supplierName != ''">
|
||||
AND us.supplier_name ilike concat('%', #{supplierName}, '%')
|
||||
</if>
|
||||
ORDER BY qssm.id ASC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue