feat(material): 添加物料质检周期功能
- 移除外部库存检验申请中的储位必填验证 - 在MaterialController中新增物料质检周期查询接口 - 创建MaterialInspectionCycleVO数据传输对象 - 在QmsQcMaterial实体中添加质检周期字段 - 在QmsQcMaterialAddQO和QmsQcMaterialUpdateQO中添加质检周期参数验证 - 更新QmsQcMaterialControllerService中的增改方法以处理质检周期数据 - 创建QmsService用于定时任务获取物料质检周期数据
This commit is contained in:
parent
6cfc3ed92a
commit
97a3dcf1f4
|
|
@ -3,17 +3,18 @@ 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.common.pojo.vo.MaterialInspectionCycleVO;
|
||||
import com.nflg.wms.repository.entity.QmsQcMaterial;
|
||||
import com.nflg.wms.repository.service.IQmsExemptCategoryService;
|
||||
import com.nflg.wms.repository.service.IQmsExemptMaterialService;
|
||||
import com.nflg.wms.repository.service.IQmsQcMaterialService;
|
||||
import com.nflg.wms.starter.BaseController;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import org.checkerframework.common.reflection.qual.GetClass;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
|
@ -34,6 +35,9 @@ public class MaterialController extends BaseController {
|
|||
@Resource
|
||||
private IQmsExemptCategoryService exemptCategoryService;
|
||||
|
||||
@Resource
|
||||
private IQmsQcMaterialService qcMaterialService;
|
||||
|
||||
/**
|
||||
* 批量判断物料是否免检
|
||||
* - 参数为供应商编号和物料编号的组合列表
|
||||
|
|
@ -69,4 +73,19 @@ public class MaterialController extends BaseController {
|
|||
|
||||
return ApiResult.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物料质检周期
|
||||
*/
|
||||
@GetMapping("getMaterialInspectionCycle")
|
||||
public ApiResult<List<MaterialInspectionCycleVO>> getMaterialInspectionCycle() {
|
||||
return ApiResult.success(
|
||||
qcMaterialService.lambdaQuery()
|
||||
.select(QmsQcMaterial::getMaterialNo, QmsQcMaterial::getInspectionCycle1, QmsQcMaterial::getInspectionCycle2, QmsQcMaterial::getInspectionCycle3)
|
||||
.list()
|
||||
.stream()
|
||||
.map(qcMaterial -> new MaterialInspectionCycleVO(qcMaterial.getMaterialNo(), qcMaterial.getInspectionCycle1(), qcMaterial.getInspectionCycle2(), qcMaterial.getInspectionCycle3()))
|
||||
.toList()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,6 +163,9 @@ public class QmsQcMaterialControllerService {
|
|||
.setMaterialSpecifications(request.getMaterialSpecifications())
|
||||
.setValidityPeriod(request.getValidityPeriod())
|
||||
.setIsStandardMaintained(request.getIsStandardMaintained() != null ? request.getIsStandardMaintained() : false)
|
||||
.setInspectionCycle1(request.getInspectionCycle1())
|
||||
.setInspectionCycle2(request.getInspectionCycle2())
|
||||
.setInspectionCycle3(request.getInspectionCycle3())
|
||||
.setCreatedType(0)
|
||||
.setCreateBy(userId)
|
||||
.setCreateByName(operator)
|
||||
|
|
@ -247,6 +250,9 @@ public class QmsQcMaterialControllerService {
|
|||
.set(QmsQcMaterial::getUpdateBy, userId)
|
||||
.set(QmsQcMaterial::getUpdateByName, operator)
|
||||
.set(QmsQcMaterial::getUpdateTime, now)
|
||||
.set(QmsQcMaterial::getInspectionCycle1, request.getInspectionCycle1())
|
||||
.set(QmsQcMaterial::getInspectionCycle2, request.getInspectionCycle2())
|
||||
.set(QmsQcMaterial::getInspectionCycle3, request.getInspectionCycle3())
|
||||
.update();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ public class ExternalInventoryInspectionApplyQO {
|
|||
/**
|
||||
* 所属储位(必填)
|
||||
*/
|
||||
@NotBlank(message = "所属储位不能为空")
|
||||
private String storageLocation;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
|
@ -65,4 +66,22 @@ public class QmsQcMaterialAddQO {
|
|||
* 规则是否已维护:false=未维护,true=已维护
|
||||
*/
|
||||
private Boolean isStandardMaintained;
|
||||
|
||||
/**
|
||||
* 质检周期1(单位为月)
|
||||
*/
|
||||
@NotNull(message = "质检周期1不能为空")
|
||||
private Integer inspectionCycle1;
|
||||
|
||||
/**
|
||||
* 质检周期2(单位为月)
|
||||
*/
|
||||
@NotNull(message = "质检周期2不能为空")
|
||||
private Integer inspectionCycle2;
|
||||
|
||||
/**
|
||||
* 质检周期3(单位为月)
|
||||
*/
|
||||
@NotNull(message = "质检周期3不能为空")
|
||||
private Integer inspectionCycle3;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,4 +70,22 @@ public class QmsQcMaterialUpdateQO {
|
|||
* 规则是否已维护:false=未维护,true=已维护
|
||||
*/
|
||||
private Boolean isStandardMaintained;
|
||||
|
||||
/**
|
||||
* 质检周期1(单位为月)
|
||||
*/
|
||||
@NotNull(message = "质检周期1不能为空")
|
||||
private Integer inspectionCycle1;
|
||||
|
||||
/**
|
||||
* 质检周期2(单位为月)
|
||||
*/
|
||||
@NotNull(message = "质检周期2不能为空")
|
||||
private Integer inspectionCycle2;
|
||||
|
||||
/**
|
||||
* 质检周期3(单位为月)
|
||||
*/
|
||||
@NotNull(message = "质检周期3不能为空")
|
||||
private Integer inspectionCycle3;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
package com.nflg.wms.common.pojo.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class MaterialInspectionCycleVO {
|
||||
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
private String materialNo;
|
||||
|
||||
/**
|
||||
* 质检周期1(单位为月)
|
||||
*/
|
||||
private Integer inspectionCycle1;
|
||||
|
||||
/**
|
||||
* 质检周期2(单位为月)
|
||||
*/
|
||||
private Integer inspectionCycle2;
|
||||
|
||||
/**
|
||||
* 质检周期3(单位为月)
|
||||
*/
|
||||
private Integer inspectionCycle3;
|
||||
}
|
||||
|
|
@ -125,4 +125,19 @@ public class QmsQcMaterial implements Serializable {
|
|||
* 修改人名称
|
||||
*/
|
||||
private String updateByName;
|
||||
|
||||
/**
|
||||
* 质检周期1(单位为月)
|
||||
*/
|
||||
private Integer inspectionCycle1;
|
||||
|
||||
/**
|
||||
* 质检周期2(单位为月)
|
||||
*/
|
||||
private Integer inspectionCycle2;
|
||||
|
||||
/**
|
||||
* 质检周期3(单位为月)
|
||||
*/
|
||||
private Integer inspectionCycle3;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,65 @@
|
|||
package com.nflg.wms.scheduled.service;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.qo.*;
|
||||
import com.nflg.wms.common.pojo.vo.ExemptMaterialCheckVO;
|
||||
import com.nflg.wms.common.pojo.vo.MaterialInspectionCycleVO;
|
||||
import com.nflg.wms.common.util.VUtil;
|
||||
import com.nflg.wms.repository.entity.WmsInProduceOrderItem;
|
||||
import com.nflg.wms.repository.entity.WmsInventory;
|
||||
import com.nflg.wms.repository.entity.WmsOutProduce;
|
||||
import com.nflg.wms.repository.entity.WmsQrCodeMaster;
|
||||
import com.nflg.wms.repository.service.IWmsInventoryService;
|
||||
import com.nflg.wms.repository.service.IWmsOutProduceService;
|
||||
import com.nflg.wms.repository.service.IWmsQrCodeMasterService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class QmsService {
|
||||
|
||||
@Resource
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
@Value("${qms.host}")
|
||||
private String qmsHost;
|
||||
|
||||
@Value("${qms.material.inspectionCycle.url}")
|
||||
private String materialInspectionCycleUrl;
|
||||
|
||||
/**
|
||||
* 获取物料检测周期
|
||||
*/
|
||||
public List<MaterialInspectionCycleVO> getMaterialInspectionCycle(){
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
HttpEntity<QmsPdiTaskRecordAddQO> requestEntity = new HttpEntity<>(headers);
|
||||
|
||||
ResponseEntity<ApiResult<List<MaterialInspectionCycleVO>>> response = restTemplate.exchange(
|
||||
qmsHost + materialInspectionCycleUrl,
|
||||
HttpMethod.POST,
|
||||
requestEntity,
|
||||
new ParameterizedTypeReference<ApiResult<List<MaterialInspectionCycleVO>>>() {
|
||||
}
|
||||
);
|
||||
|
||||
VUtil.trueThrowBusinessError(
|
||||
Objects.isNull(response.getBody()) || response.getBody().getCode() != 200
|
||||
).throwMessage("查询物料质检周期失败:" + response.getBody().getMessage());
|
||||
return response.getBody().getResult();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue