Compare commits
No commits in common. "b17e1fcec8f13717102691605b3e191c2de2d256" and "3b5e6b4ef2307b1ba8bd198ec59fec82ebd76dff" have entirely different histories.
b17e1fcec8
...
3b5e6b4ef2
|
|
@ -1,42 +0,0 @@
|
|||
package com.nflg.qms.admin.controller.external;
|
||||
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.qo.ExemptMaterialCheckQO;
|
||||
import com.nflg.wms.common.pojo.vo.ExemptMaterialCheckVO;
|
||||
import com.nflg.wms.repository.service.IQmsExemptMaterialService;
|
||||
import com.nflg.wms.starter.BaseController;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 对外接口-物料信息
|
||||
* @folder 对外接口/物料信息
|
||||
*/
|
||||
@Validated
|
||||
@RestController
|
||||
@RequestMapping("/external/material")
|
||||
public class MaterialController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private IQmsExemptMaterialService exemptMaterialService;
|
||||
|
||||
/**
|
||||
* 批量判断物料是否免检
|
||||
* - 参数为供应商编号和物料编号的组合列表
|
||||
* - 根据系统中已审核、已启用且在有效期内的免检设置判断
|
||||
* - 返回每个组合的免检标志(exempt=true 表示免检)
|
||||
*/
|
||||
@PostMapping("batchCheckExempt")
|
||||
public ApiResult<List<ExemptMaterialCheckVO>> batchCheckExempt(
|
||||
@Valid @RequestBody @NotEmpty List<ExemptMaterialCheckQO> request) {
|
||||
return ApiResult.success(exemptMaterialService.batchCheckExempt(request));
|
||||
}
|
||||
}
|
||||
|
|
@ -224,18 +224,6 @@ public class IncomingInspectionTaskControllerService {
|
|||
.setTriggerTime(LocalDateTime.now())
|
||||
);
|
||||
}
|
||||
|
||||
// 9. 设置检测数量
|
||||
Integer total;
|
||||
if (Objects.equals(standard.getTestingMethodDictItemId(), dictionaryItemService.getIdByCode("InspectionStandardTestingMethod", "Full"))) {
|
||||
total = task.getInspectionQty();
|
||||
} else {
|
||||
total = getCountOfSampling(task.getId(), task.getInspectionQty(), standard);
|
||||
}
|
||||
incomingInspectionTaskService.lambdaUpdate()
|
||||
.set(QmsIncomingInspectionTask::getDetectionQty, total)
|
||||
.eq(QmsIncomingInspectionTask::getId, task.getId())
|
||||
.update();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -345,18 +333,6 @@ public class IncomingInspectionTaskControllerService {
|
|||
.setTriggerTime(LocalDateTime.now())
|
||||
);
|
||||
}
|
||||
|
||||
// 9. 设置检测数量
|
||||
Integer total;
|
||||
if (Objects.equals(standard.getTestingMethodDictItemId(), dictionaryItemService.getIdByCode("InspectionStandardTestingMethod", "Full"))) {
|
||||
total = task.getInspectionQty();
|
||||
} else {
|
||||
total = getCountOfSampling(task.getId(), task.getInspectionQty(), standard);
|
||||
}
|
||||
incomingInspectionTaskService.lambdaUpdate()
|
||||
.set(QmsIncomingInspectionTask::getDetectionQty, total)
|
||||
.eq(QmsIncomingInspectionTask::getId, task.getId())
|
||||
.update();
|
||||
}
|
||||
|
||||
private DictionaryItem getAql(Long id, List<DictionaryItem> aqls) {
|
||||
|
|
@ -545,7 +521,6 @@ public class IncomingInspectionTaskControllerService {
|
|||
public QmsIncomingInspectionTaskVO getDetail(Long id) {
|
||||
QmsIncomingInspectionTaskVO detail = incomingInspectionTaskService.getDetail(id);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(detail)).throwMessage("任务不存在");
|
||||
detail.setInspectedQty(incomingInspectionTaskService.getInspectedQty(id));
|
||||
return detail;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 免检物料判断 单条请求对象
|
||||
*/
|
||||
@Data
|
||||
public class ExemptMaterialCheckQO {
|
||||
|
||||
/**
|
||||
* 供应商编号
|
||||
*/
|
||||
@NotBlank(message = "供应商编号不能为空")
|
||||
private String supplierCode;
|
||||
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
@NotBlank(message = "物料编号不能为空")
|
||||
private String materialNo;
|
||||
}
|
||||
|
|
@ -66,10 +66,10 @@ public class ExternalIncomingInspectionApplyQO {
|
|||
private String factory;
|
||||
|
||||
/**
|
||||
* 送检数量(必填)
|
||||
* 检验数量(必填),即送检数量
|
||||
*/
|
||||
@NotNull(message = "送检数量不能为空")
|
||||
@Min(value = 1, message = "送检数量必须大于0")
|
||||
@NotNull(message = "检验数量不能为空")
|
||||
@Min(value = 1, message = "检验数量必须大于0")
|
||||
private Integer inspectionQty;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
package com.nflg.wms.common.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 免检物料判断 结果VO
|
||||
*/
|
||||
@Data
|
||||
public class ExemptMaterialCheckVO {
|
||||
|
||||
/**
|
||||
* 供应商编号
|
||||
*/
|
||||
private String supplierCode;
|
||||
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
private String materialNo;
|
||||
|
||||
/**
|
||||
* 是否免检:true=免检,false=非免检
|
||||
*/
|
||||
private Boolean exempt;
|
||||
}
|
||||
|
|
@ -103,7 +103,7 @@ public class QmsIncomingInspectionTaskVO {
|
|||
private Integer inspectionType;
|
||||
|
||||
/**
|
||||
* 送检数量
|
||||
* 检验数量
|
||||
*/
|
||||
private Integer inspectionQty;
|
||||
|
||||
|
|
@ -117,25 +117,6 @@ public class QmsIncomingInspectionTaskVO {
|
|||
*/
|
||||
private Integer unqualifiedQty;
|
||||
|
||||
/**
|
||||
* 检测数量
|
||||
*/
|
||||
private Integer detectionQty;
|
||||
|
||||
/**
|
||||
* 已检数量
|
||||
*/
|
||||
private Integer inspectedQty;
|
||||
|
||||
/**
|
||||
* 未检数量
|
||||
*/
|
||||
private Integer uninspectedQty;
|
||||
|
||||
public Integer getUninspectedQty() {
|
||||
return detectionQty - inspectedQty;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检验状态:0=待检,1=已检
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public class QmsIncomingInspectionTask implements Serializable {
|
|||
private Integer inspectionType;
|
||||
|
||||
/**
|
||||
* 送检数量
|
||||
* 检验数量,即送检数量
|
||||
*/
|
||||
private Integer inspectionQty;
|
||||
|
||||
|
|
@ -102,11 +102,6 @@ public class QmsIncomingInspectionTask implements Serializable {
|
|||
*/
|
||||
private Integer unqualifiedQty;
|
||||
|
||||
/**
|
||||
* 检测数量
|
||||
*/
|
||||
private Integer detectionQty;
|
||||
|
||||
/**
|
||||
* 检验状态:0=待检,1=检验中,2=已检
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ 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.ExemptMaterialCheckVO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsExemptMaterialVO;
|
||||
import com.nflg.wms.repository.entity.QmsExemptMaterial;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
|
@ -30,11 +29,4 @@ public interface QmsExemptMaterialMapper extends BaseMapper<QmsExemptMaterial> {
|
|||
* 按物料编号查询关联的供应商免检明细
|
||||
*/
|
||||
List<QmsExemptMaterialVO> detailByMaterial(@Param("materialNo") String materialNo);
|
||||
|
||||
/**
|
||||
* 批量查询有效免检物料(供应商编号+物料编号组合)
|
||||
* 仅返回审核通过、启用且在有效期内的记录
|
||||
*/
|
||||
List<ExemptMaterialCheckVO> batchCheckExempt(@Param("supplierCodes") List<String> supplierCodes,
|
||||
@Param("materialNos") List<String> materialNos);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,4 @@ public interface QmsIncomingInspectionTaskMapper extends BaseMapper<QmsIncomingI
|
|||
* 根据id查询任务详情
|
||||
*/
|
||||
QmsIncomingInspectionTaskVO getDetail(Long id);
|
||||
|
||||
Integer getInspectedQty(Long id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,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.ExemptMaterialCheckQO;
|
||||
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.ExemptMaterialCheckVO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsExemptMaterialVO;
|
||||
import com.nflg.wms.repository.entity.QmsExemptMaterial;
|
||||
|
||||
|
|
@ -46,10 +44,4 @@ public interface IQmsExemptMaterialService extends IService<QmsExemptMaterial> {
|
|||
* 审核免检物料
|
||||
*/
|
||||
void audit(QmsExemptMaterialAuditQO request);
|
||||
|
||||
/**
|
||||
* 批量判断物料是否免检
|
||||
* 根据供应商编号和物料编号判断,返回每个组合的免检标志
|
||||
*/
|
||||
List<ExemptMaterialCheckVO> batchCheckExempt(List<ExemptMaterialCheckQO> items);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,4 @@ public interface IQmsIncomingInspectionTaskService extends IService<QmsIncomingI
|
|||
* @return 任务详情
|
||||
*/
|
||||
QmsIncomingInspectionTaskVO getDetail(Long id);
|
||||
|
||||
Integer getInspectedQty(Long id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,11 +6,9 @@ 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.ExemptMaterialCheckQO;
|
||||
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.ExemptMaterialCheckVO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsExemptMaterialVO;
|
||||
import com.nflg.wms.common.util.StringUtil;
|
||||
import com.nflg.wms.common.util.UserUtil;
|
||||
|
|
@ -23,10 +21,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 免检物料 服务实现类
|
||||
|
|
@ -171,36 +166,4 @@ public class QmsExemptMaterialServiceImpl extends ServiceImpl<QmsExemptMaterialM
|
|||
}
|
||||
return LocalDateTime.parse(dateStr, DATE_FMT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExemptMaterialCheckVO> batchCheckExempt(List<ExemptMaterialCheckQO> items) {
|
||||
// 提取所有供应商编号和物料编号
|
||||
List<String> supplierCodes = items.stream()
|
||||
.map(ExemptMaterialCheckQO::getSupplierCode)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<String> materialNos = items.stream()
|
||||
.map(ExemptMaterialCheckQO::getMaterialNo)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 一次性查询所有有效免检组合
|
||||
List<ExemptMaterialCheckVO> exemptList = baseMapper.batchCheckExempt(supplierCodes, materialNos);
|
||||
|
||||
// 构建免检组合的快速查询集合,格式:supplierCode:materialNo
|
||||
Set<String> exemptSet = exemptList.stream()
|
||||
.map(v -> v.getSupplierCode() + ":" + v.getMaterialNo())
|
||||
.collect(Collectors.toCollection(HashSet::new));
|
||||
|
||||
// 构建返回结果
|
||||
List<ExemptMaterialCheckVO> result = new ArrayList<>(items.size());
|
||||
for (ExemptMaterialCheckQO item : items) {
|
||||
ExemptMaterialCheckVO vo = new ExemptMaterialCheckVO();
|
||||
vo.setSupplierCode(item.getSupplierCode());
|
||||
vo.setMaterialNo(item.getMaterialNo());
|
||||
vo.setExempt(exemptSet.contains(item.getSupplierCode() + ":" + item.getMaterialNo()));
|
||||
result.add(vo);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,9 +64,4 @@ public class QmsIncomingInspectionTaskServiceImpl extends ServiceImpl<QmsIncomin
|
|||
public QmsIncomingInspectionTaskVO getDetail(Long id) {
|
||||
return baseMapper.getDetail(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getInspectedQty(Long id) {
|
||||
return baseMapper.getInspectedQty(id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,27 +134,4 @@
|
|||
ORDER BY em.create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 批量查询有效免检物料(供应商编号+物料编号组合),仅返回审核通过、启用且在有效期内的记录 -->
|
||||
<select id="batchCheckExempt" resultType="com.nflg.wms.common.pojo.vo.ExemptMaterialCheckVO">
|
||||
SELECT
|
||||
us.supplier_code AS supplierCode,
|
||||
em.material_no AS materialNo
|
||||
FROM qms_exempt_material em
|
||||
INNER JOIN user_supplier us ON us.id = em.supplier_id
|
||||
WHERE em.audit_status = 1
|
||||
AND em.enable = true
|
||||
AND (
|
||||
em.exempt_mode = 0
|
||||
OR (em.exempt_mode = 1 AND em.valid_end_date IS NOT NULL AND em.valid_end_date >= NOW())
|
||||
)
|
||||
AND us.supplier_code IN
|
||||
<foreach collection="supplierCodes" item="code" open="(" separator="," close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
AND em.material_no IN
|
||||
<foreach collection="materialNos" item="no" open="(" separator="," close=")">
|
||||
#{no}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -215,8 +215,7 @@
|
|||
t.warehouse,
|
||||
t.storage_location,
|
||||
t.storage_days,
|
||||
t.callback_result,
|
||||
t.detection_qty
|
||||
t.callback_result
|
||||
FROM qms_incoming_inspection_task t
|
||||
LEFT JOIN qms_qc_material m ON t.material_id = m.id
|
||||
LEFT JOIN qms_inspection_standard s ON t.inspection_standard_id = s.id
|
||||
|
|
@ -224,9 +223,4 @@
|
|||
WHERE t.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getInspectedQty" resultType="java.lang.Integer">
|
||||
SELECT SUM(inspection_qty)
|
||||
FROM qms_incoming_inspection_task_record
|
||||
WHERE task_id=#{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue