Merge remote-tracking branch '惠信/feature/NoScanning' into feature/NoScanning
# Conflicts: # nflg-qms-admin/src/main/java/com/nflg/qms/admin/service/WmsIncomingInspectionTaskCallbackService.java # nflg-wms-admin/src/main/java/com/nflg/wms/admin/service/QmsService.java
This commit is contained in:
commit
cd62c739e1
|
|
@ -161,6 +161,7 @@ public class QmsQcMaterialControllerService {
|
||||||
.setMaterialName(request.getMaterialName())
|
.setMaterialName(request.getMaterialName())
|
||||||
.setMaterialTexture(request.getMaterialTexture())
|
.setMaterialTexture(request.getMaterialTexture())
|
||||||
.setMaterialSpecifications(request.getMaterialSpecifications())
|
.setMaterialSpecifications(request.getMaterialSpecifications())
|
||||||
|
.setValidityPeriod(request.getValidityPeriod())
|
||||||
.setIsStandardMaintained(request.getIsStandardMaintained() != null ? request.getIsStandardMaintained() : false)
|
.setIsStandardMaintained(request.getIsStandardMaintained() != null ? request.getIsStandardMaintained() : false)
|
||||||
.setCreatedType(0)
|
.setCreatedType(0)
|
||||||
.setCreateBy(userId)
|
.setCreateBy(userId)
|
||||||
|
|
@ -234,6 +235,9 @@ public class QmsQcMaterialControllerService {
|
||||||
if (request.getMaterialSpecifications() != null) {
|
if (request.getMaterialSpecifications() != null) {
|
||||||
updateChain.set(QmsQcMaterial::getMaterialSpecifications, request.getMaterialSpecifications());
|
updateChain.set(QmsQcMaterial::getMaterialSpecifications, request.getMaterialSpecifications());
|
||||||
}
|
}
|
||||||
|
if (request.getValidityPeriod() != null) {
|
||||||
|
updateChain.set(QmsQcMaterial::getValidityPeriod, request.getValidityPeriod());
|
||||||
|
}
|
||||||
// 更新规则是否已维护
|
// 更新规则是否已维护
|
||||||
if (request.getIsStandardMaintained() != null) {
|
if (request.getIsStandardMaintained() != null) {
|
||||||
updateChain.set(QmsQcMaterial::getIsStandardMaintained, request.getIsStandardMaintained());
|
updateChain.set(QmsQcMaterial::getIsStandardMaintained, request.getIsStandardMaintained());
|
||||||
|
|
@ -360,6 +364,7 @@ public class QmsQcMaterialControllerService {
|
||||||
.setMaterialName(dto.getMaterialName())
|
.setMaterialName(dto.getMaterialName())
|
||||||
.setMaterialTexture(dto.getMaterialTexture())
|
.setMaterialTexture(dto.getMaterialTexture())
|
||||||
.setMaterialSpecifications(dto.getMaterialSpecifications())
|
.setMaterialSpecifications(dto.getMaterialSpecifications())
|
||||||
|
.setValidityPeriod(dto.getValidityPeriod())
|
||||||
.setIsStandardMaintained(false)
|
.setIsStandardMaintained(false)
|
||||||
.setCreatedType(0)
|
.setCreatedType(0)
|
||||||
.setCreateBy(userId)
|
.setCreateBy(userId)
|
||||||
|
|
@ -380,6 +385,7 @@ public class QmsQcMaterialControllerService {
|
||||||
.set(QmsQcMaterial::getMaterialName, dto.getMaterialName())
|
.set(QmsQcMaterial::getMaterialName, dto.getMaterialName())
|
||||||
.set(QmsQcMaterial::getMaterialTexture, dto.getMaterialTexture())
|
.set(QmsQcMaterial::getMaterialTexture, dto.getMaterialTexture())
|
||||||
.set(QmsQcMaterial::getMaterialSpecifications, dto.getMaterialSpecifications())
|
.set(QmsQcMaterial::getMaterialSpecifications, dto.getMaterialSpecifications())
|
||||||
|
.set(QmsQcMaterial::getValidityPeriod, dto.getValidityPeriod())
|
||||||
.set(QmsQcMaterial::getUpdateBy, userId)
|
.set(QmsQcMaterial::getUpdateBy, userId)
|
||||||
.set(QmsQcMaterial::getUpdateByName, operator)
|
.set(QmsQcMaterial::getUpdateByName, operator)
|
||||||
.set(QmsQcMaterial::getUpdateTime, now)
|
.set(QmsQcMaterial::getUpdateTime, now)
|
||||||
|
|
@ -435,7 +441,8 @@ public class QmsQcMaterialControllerService {
|
||||||
.setDrawingNoVer("示例版本号")
|
.setDrawingNoVer("示例版本号")
|
||||||
.setMaterialName("示例物料名称")
|
.setMaterialName("示例物料名称")
|
||||||
.setMaterialTexture("示例材质")
|
.setMaterialTexture("示例材质")
|
||||||
.setMaterialSpecifications("示例规格");
|
.setMaterialSpecifications("示例规格")
|
||||||
|
.setValidityPeriod((short) 12);
|
||||||
|
|
||||||
EecExcelUtil.export("质检物料导入模板", "质检物料导入模板", List.of(example), response);
|
EecExcelUtil.export("质检物料导入模板", "质检物料导入模板", List.of(example), response);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,11 @@ import com.nflg.wms.common.util.VUtil;
|
||||||
import com.nflg.wms.repository.entity.QmsIncomingInspectionTask;
|
import com.nflg.wms.repository.entity.QmsIncomingInspectionTask;
|
||||||
import com.nflg.wms.repository.entity.QmsIncomingInspectionTaskRecord;
|
import com.nflg.wms.repository.entity.QmsIncomingInspectionTaskRecord;
|
||||||
import com.nflg.wms.repository.entity.QmsIssueTicket;
|
import com.nflg.wms.repository.entity.QmsIssueTicket;
|
||||||
|
import com.nflg.wms.repository.entity.WmsInventory;
|
||||||
import com.nflg.wms.repository.service.IQmsIncomingInspectionTaskRecordService;
|
import com.nflg.wms.repository.service.IQmsIncomingInspectionTaskRecordService;
|
||||||
import com.nflg.wms.repository.service.IQmsIncomingInspectionTaskService;
|
import com.nflg.wms.repository.service.IQmsIncomingInspectionTaskService;
|
||||||
import com.nflg.wms.repository.service.IQmsIssueTicketService;
|
import com.nflg.wms.repository.service.IQmsIssueTicketService;
|
||||||
|
import com.nflg.wms.repository.service.IWmsInventoryService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
|
@ -46,6 +48,9 @@ public class WmsIncomingInspectionTaskCallbackService {
|
||||||
@Resource
|
@Resource
|
||||||
private IQmsIssueTicketService issueTicketService;
|
private IQmsIssueTicketService issueTicketService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IWmsInventoryService inventoryService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 向WMS系统发送来料检验任务回调
|
* 向WMS系统发送来料检验任务回调
|
||||||
*/
|
*/
|
||||||
|
|
@ -139,6 +144,14 @@ public class WmsIncomingInspectionTaskCallbackService {
|
||||||
boolean callbackResult = true;
|
boolean callbackResult = true;
|
||||||
try {
|
try {
|
||||||
wmsApiService.post(inventoryUrl, qo, "库存检验任务回调WMS");
|
wmsApiService.post(inventoryUrl, qo, "库存检验任务回调WMS");
|
||||||
|
inventoryService.lambdaUpdate()
|
||||||
|
.set(WmsInventory::getDetectionStatus, (short) 2)
|
||||||
|
.set(WmsInventory::getDetectionResults, taskVO.getInspectionResult())
|
||||||
|
.eq(WmsInventory::getMaterialNo, taskVO.getMaterialNo())
|
||||||
|
.eq(WmsInventory::getFactoryNo, taskVO.getFactory())
|
||||||
|
.eq(WmsInventory::getWarehouseNo, taskVO.getWarehouse())
|
||||||
|
.eq(WmsInventory::getBinLocation, taskVO.getStorageLocation())
|
||||||
|
.update();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
callbackResult = false;
|
callbackResult = false;
|
||||||
throw new NflgException(STATE.BusinessError, "调用WMS接口失败:" + e.getMessage());
|
throw new NflgException(STATE.BusinessError, "调用WMS接口失败:" + e.getMessage());
|
||||||
|
|
@ -190,10 +203,10 @@ public class WmsIncomingInspectionTaskCallbackService {
|
||||||
*/
|
*/
|
||||||
private void process(QmsIncomingInspectionTaskVO taskVO, Short processingResult) {
|
private void process(QmsIncomingInspectionTaskVO taskVO, Short processingResult) {
|
||||||
switch (taskVO.getInspectionType()) {
|
switch (taskVO.getInspectionType()) {
|
||||||
case 1:
|
case 0:
|
||||||
incoming(taskVO,processingResult);
|
incoming(taskVO,processingResult);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 1:
|
||||||
inventory(taskVO,processingResult);
|
inventory(taskVO,processingResult);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.nflg.wms.admin.repository.InventoryCheckTaskScanRecordResitory;
|
import com.nflg.wms.admin.repository.InventoryCheckTaskScanRecordResitory;
|
||||||
|
import com.nflg.wms.admin.service.QmsService;
|
||||||
import com.nflg.wms.common.constant.STATE;
|
import com.nflg.wms.common.constant.STATE;
|
||||||
import com.nflg.wms.common.pojo.ApiResult;
|
import com.nflg.wms.common.pojo.ApiResult;
|
||||||
import com.nflg.wms.common.pojo.PageData;
|
import com.nflg.wms.common.pojo.PageData;
|
||||||
|
|
@ -59,6 +60,9 @@ public class InventoryController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private IWmsQrCodeMasterService qrCodeMasterService;
|
private IWmsQrCodeMasterService qrCodeMasterService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private QmsService qmsService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 库存查看
|
* 库存查看
|
||||||
*
|
*
|
||||||
|
|
@ -69,6 +73,17 @@ public class InventoryController extends BaseController {
|
||||||
return ApiResult.success(inventoryService.search(request));
|
return ApiResult.success(inventoryService.search(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发起库存检测任务
|
||||||
|
*
|
||||||
|
* @param request 库存检测申请参数
|
||||||
|
*/
|
||||||
|
@PostMapping("detection/apply")
|
||||||
|
public ApiResult<Void> applyInventoryDetection(@Valid @RequestBody InventoryDetectionApplyQO request) {
|
||||||
|
qmsService.pushInventoryInspection(request);
|
||||||
|
return ApiResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存库存盘点任务
|
* 保存库存盘点任务
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,103 @@
|
||||||
|
package com.nflg.wms.admin.schedule;
|
||||||
|
|
||||||
|
import com.nflg.wms.admin.service.QmsService;
|
||||||
|
import com.nflg.wms.common.pojo.qo.InventoryDetectionApplyQO;
|
||||||
|
import com.nflg.wms.repository.entity.QmsQcMaterial;
|
||||||
|
import com.nflg.wms.repository.entity.WmsInventory;
|
||||||
|
import com.nflg.wms.repository.service.IQmsQcMaterialService;
|
||||||
|
import com.nflg.wms.repository.service.IWmsInventoryService;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存物料过期自动发起检测任务
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class InventoryExpirationInspectionScheduledTask {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IWmsInventoryService inventoryService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IQmsQcMaterialService qcMaterialService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private QmsService qmsService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每天凌晨1点检查库存物料是否过期
|
||||||
|
*/
|
||||||
|
@Scheduled(cron = "0 0 1 * * ?")
|
||||||
|
public void applyExpiredInventoryInspection() {
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
List<WmsInventory> inventories = inventoryService.lambdaQuery()
|
||||||
|
.gt(WmsInventory::getNum, BigDecimal.ZERO)
|
||||||
|
.isNotNull(WmsInventory::getCreateTime)
|
||||||
|
.eq(WmsInventory::getDetectionStatus, (short) 0)
|
||||||
|
.list();
|
||||||
|
if (inventories.isEmpty()) {
|
||||||
|
log.info("库存物料过期检测任务执行完成:无待检查库存");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<String> materialNos = inventories.stream()
|
||||||
|
.map(WmsInventory::getMaterialNo)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
if (materialNos.isEmpty()) {
|
||||||
|
log.info("库存物料过期检测任务执行完成:待检查库存均无物料编号");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, QmsQcMaterial> materialMap = qcMaterialService.lambdaQuery()
|
||||||
|
.in(QmsQcMaterial::getMaterialNo, materialNos)
|
||||||
|
.orderByDesc(QmsQcMaterial::getId)
|
||||||
|
.list()
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.toMap(QmsQcMaterial::getMaterialNo, Function.identity(), (first, ignored) -> first));
|
||||||
|
|
||||||
|
int applied = 0;
|
||||||
|
int skipped = 0;
|
||||||
|
int failed = 0;
|
||||||
|
for (WmsInventory inventory : inventories) {
|
||||||
|
QmsQcMaterial material = materialMap.get(inventory.getMaterialNo());
|
||||||
|
if (Objects.isNull(material) || Objects.isNull(material.getValidityPeriod())) {
|
||||||
|
skipped++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
LocalDateTime expiredTime = inventory.getCreateTime().plusMonths(material.getValidityPeriod());
|
||||||
|
if (!expiredTime.isBefore(now)) {
|
||||||
|
skipped++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
InventoryDetectionApplyQO request = new InventoryDetectionApplyQO();
|
||||||
|
request.setInventoryId(inventory.getId());
|
||||||
|
request.setInspectionQty(inventory.getNum().intValue());
|
||||||
|
request.setStorageDays(Math.max(1, (int) ChronoUnit.DAYS.between(inventory.getCreateTime(), now)));
|
||||||
|
try {
|
||||||
|
qmsService.pushInventoryInspection(request);
|
||||||
|
applied++;
|
||||||
|
} catch (Exception ex) {
|
||||||
|
failed++;
|
||||||
|
log.error("库存物料过期检测任务发起失败,库存ID:{}", inventory.getId(), ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.info("库存物料过期检测任务执行完成:检查库存数={},发起检测数={},跳过数={},失败数={}",
|
||||||
|
inventories.size(), applied, skipped, failed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,13 @@ import com.nflg.wms.common.pojo.qo.ExemptMaterialCheckQO;
|
||||||
import com.nflg.wms.common.pojo.qo.ExternalIncomingInspectionApplyQO;
|
import com.nflg.wms.common.pojo.qo.ExternalIncomingInspectionApplyQO;
|
||||||
import com.nflg.wms.common.pojo.qo.QmsCoaReportCheckQO;
|
import com.nflg.wms.common.pojo.qo.QmsCoaReportCheckQO;
|
||||||
import com.nflg.wms.common.pojo.vo.ExemptMaterialCheckVO;
|
import com.nflg.wms.common.pojo.vo.ExemptMaterialCheckVO;
|
||||||
|
import com.nflg.wms.common.pojo.qo.ExternalInventoryInspectionApplyQO;
|
||||||
|
import com.nflg.wms.common.pojo.qo.InventoryDetectionApplyQO;
|
||||||
import com.nflg.wms.common.util.VUtil;
|
import com.nflg.wms.common.util.VUtil;
|
||||||
|
import com.nflg.wms.repository.entity.WmsInventory;
|
||||||
|
import com.nflg.wms.repository.entity.WmsQrCodeMaster;
|
||||||
|
import com.nflg.wms.repository.service.IWmsInventoryService;
|
||||||
|
import com.nflg.wms.repository.service.IWmsQrCodeMasterService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
|
@ -17,9 +23,11 @@ import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
@ -27,9 +35,17 @@ import java.util.Objects;
|
||||||
@Component
|
@Component
|
||||||
public class QmsService {
|
public class QmsService {
|
||||||
|
|
||||||
|
private static final DateTimeFormatter INVENTORY_INSPECTION_REQUEST_NO_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMddHH");
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private RestTemplate restTemplate;
|
private RestTemplate restTemplate;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IWmsInventoryService inventoryService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IWmsQrCodeMasterService qrCodeMasterService;
|
||||||
|
|
||||||
@Value("${qms.host}")
|
@Value("${qms.host}")
|
||||||
private String qmsHost;
|
private String qmsHost;
|
||||||
|
|
||||||
|
|
@ -121,4 +137,65 @@ public class QmsService {
|
||||||
).throwMessage("检测是否已提交COA报告失败:" + response.getBody().getMessage());
|
).throwMessage("检测是否已提交COA报告失败:" + response.getBody().getMessage());
|
||||||
return response.getBody().getResult();
|
return response.getBody().getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void pushInventoryInspection(InventoryDetectionApplyQO request) {
|
||||||
|
WmsInventory inventory = inventoryService.getById(request.getInventoryId());
|
||||||
|
VUtil.trueThrowBusinessError(Objects.isNull(inventory)).throwMessage("未找到对应库存");
|
||||||
|
VUtil.trueThrowBusinessError(Objects.equals(inventory.getDetectionStatus(), (short) 1))
|
||||||
|
.throwMessage("该库存正在检测中,不能重复发起检测任务");
|
||||||
|
VUtil.trueThrowBusinessError(
|
||||||
|
Objects.isNull(inventory.getNum())
|
||||||
|
|| BigDecimal.valueOf(request.getInspectionQty()).compareTo(inventory.getNum()) > 0
|
||||||
|
).throwMessage("检验数量不能大于库存数量");
|
||||||
|
|
||||||
|
ExternalInventoryInspectionApplyQO apply = new ExternalInventoryInspectionApplyQO();
|
||||||
|
apply.setRequestNo(generateInventoryInspectionRequestNo(request.getInventoryId()));
|
||||||
|
apply.setMaterialNo(inventory.getMaterialNo());
|
||||||
|
apply.setFactory(inventory.getFactoryNo());
|
||||||
|
apply.setInspectionQty(request.getInspectionQty());
|
||||||
|
apply.setWarehouse(inventory.getWarehouseNo());
|
||||||
|
apply.setStorageLocation(inventory.getBinLocation());
|
||||||
|
apply.setStorageDays(request.getStorageDays());
|
||||||
|
|
||||||
|
List<String> qrCodes = qrCodeMasterService.lambdaQuery()
|
||||||
|
.select(WmsQrCodeMaster::getBarcodeCode)
|
||||||
|
.eq(WmsQrCodeMaster::getMaterialCode, apply.getMaterialNo())
|
||||||
|
.eq(WmsQrCodeMaster::getFactoryCode, apply.getFactory())
|
||||||
|
.eq(WmsQrCodeMaster::getStorageLocation, apply.getWarehouse())
|
||||||
|
.eq(WmsQrCodeMaster::getBinLocation, apply.getStorageLocation())
|
||||||
|
.list()
|
||||||
|
.stream()
|
||||||
|
.map(WmsQrCodeMaster::getBarcodeCode)
|
||||||
|
.toList();
|
||||||
|
log.info("推送库存检测申请到QMS:申请参数={},关联二维码={}",
|
||||||
|
JSONUtil.toJsonStr(apply), JSONUtil.toJsonStr(qrCodes));
|
||||||
|
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
HttpEntity<ExternalInventoryInspectionApplyQO> requestEntity = new HttpEntity<>(apply, headers);
|
||||||
|
|
||||||
|
ResponseEntity<ApiResult<Void>> response = restTemplate.exchange(
|
||||||
|
qmsUrl + "/external/incoming-inspection-task/inventory-apply",
|
||||||
|
HttpMethod.POST,
|
||||||
|
requestEntity,
|
||||||
|
new ParameterizedTypeReference<ApiResult<Void>>() {}
|
||||||
|
);
|
||||||
|
|
||||||
|
ApiResult<Void> body = response.getBody();
|
||||||
|
log.info("推送库存检测申请到QMS结果:{},{}",
|
||||||
|
response.getStatusCode().value(), JSONUtil.toJsonStr(body));
|
||||||
|
VUtil.trueThrowBusinessError(Objects.isNull(body) || body.getCode() != 200)
|
||||||
|
.throwMessage("推送库存检测申请到QMS失败:" + (Objects.isNull(body) ? "无响应内容" : body.getMessage()));
|
||||||
|
|
||||||
|
boolean inventoryUpdated = inventoryService.lambdaUpdate()
|
||||||
|
.set(WmsInventory::getDetectionStatus, (short) 1)
|
||||||
|
.set(WmsInventory::getDetectionResults, null)
|
||||||
|
.eq(WmsInventory::getId, request.getInventoryId())
|
||||||
|
.update();
|
||||||
|
VUtil.trueThrowBusinessError(!inventoryUpdated).throwMessage("未找到对应库存,无法更新检测状态");
|
||||||
|
}
|
||||||
|
|
||||||
|
private String generateInventoryInspectionRequestNo(Long inventoryId) {
|
||||||
|
return LocalDateTime.now().format(INVENTORY_INSPECTION_REQUEST_NO_FORMATTER) + inventoryId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -65,6 +65,12 @@ public class QmsQcMaterialExportDTO {
|
||||||
@ExcelColumn("物料规格")
|
@ExcelColumn("物料规格")
|
||||||
private String materialSpecifications;
|
private String materialSpecifications;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validity period in months.
|
||||||
|
*/
|
||||||
|
@ExcelColumn("有效周期(月)")
|
||||||
|
private Short validityPeriod;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 规则是否已维护
|
* 规则是否已维护
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,12 @@ public class QmsQcMaterialImportDTO {
|
||||||
@ExcelColumn("物料规格")
|
@ExcelColumn("物料规格")
|
||||||
private String materialSpecifications;
|
private String materialSpecifications;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validity period in months.
|
||||||
|
*/
|
||||||
|
@ExcelColumn("有效周期(月)")
|
||||||
|
private Short validityPeriod;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 错误信息
|
* 错误信息
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.nflg.wms.common.pojo.qo;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.Min;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WMS发起库存检测申请
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class InventoryDetectionApplyQO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存ID
|
||||||
|
*/
|
||||||
|
@NotNull(message = "库存ID不能为空")
|
||||||
|
private Long inventoryId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检验数量
|
||||||
|
*/
|
||||||
|
@NotNull(message = "检验数量不能为空")
|
||||||
|
@Min(value = 1, message = "检验数量必须大于0")
|
||||||
|
private Integer inspectionQty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 存储时长(单位:天)
|
||||||
|
*/
|
||||||
|
@NotNull(message = "存储时长不能为空")
|
||||||
|
@Min(value = 1, message = "存储时长必须大于0")
|
||||||
|
private Integer storageDays;
|
||||||
|
}
|
||||||
|
|
@ -24,4 +24,14 @@ public class InventorySearchQO extends PageQO {
|
||||||
* 库存地点编号
|
* 库存地点编号
|
||||||
*/
|
*/
|
||||||
private String warehouseNo;
|
private String warehouseNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测状态:0=未检测,1=检测中,2=已检测
|
||||||
|
*/
|
||||||
|
private Short detectionStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测结果
|
||||||
|
*/
|
||||||
|
private Boolean detectionResults;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,11 @@ public class QmsQcMaterialAddQO {
|
||||||
*/
|
*/
|
||||||
private String materialSpecifications;
|
private String materialSpecifications;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validity period in months.
|
||||||
|
*/
|
||||||
|
private Short validityPeriod;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 规则是否已维护:false=未维护,true=已维护
|
* 规则是否已维护:false=未维护,true=已维护
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,11 @@ public class QmsQcMaterialSearchQO extends PageQO {
|
||||||
*/
|
*/
|
||||||
private String materialSpecifications;
|
private String materialSpecifications;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validity period in months.
|
||||||
|
*/
|
||||||
|
private Short validityPeriod;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 规则是否已维护(精确匹配):false=未维护,true=已维护
|
* 规则是否已维护(精确匹配):false=未维护,true=已维护
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,11 @@ public class QmsQcMaterialUpdateQO {
|
||||||
*/
|
*/
|
||||||
private String materialSpecifications;
|
private String materialSpecifications;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validity period in months.
|
||||||
|
*/
|
||||||
|
private Short validityPeriod;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 规则是否已维护:false=未维护,true=已维护
|
* 规则是否已维护:false=未维护,true=已维护
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -43,4 +43,14 @@ public class InventoryVO {
|
||||||
* 序列号
|
* 序列号
|
||||||
*/
|
*/
|
||||||
private String serialNo;
|
private String serialNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测状态:0=未检测,1=检测中,2=已检测
|
||||||
|
*/
|
||||||
|
private Short detectionStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测结果:true=合格,false=不合格,null=无结果
|
||||||
|
*/
|
||||||
|
private Boolean detectionResults;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,11 @@ public class QmsQcMaterialVO {
|
||||||
*/
|
*/
|
||||||
private String materialSpecifications;
|
private String materialSpecifications;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validity period in months.
|
||||||
|
*/
|
||||||
|
private Short validityPeriod;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 规则是否已维护:false=未维护,true=已维护
|
* 规则是否已维护:false=未维护,true=已维护
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,11 @@ public class QmsQcMaterial implements Serializable {
|
||||||
*/
|
*/
|
||||||
private String materialSpecifications;
|
private String materialSpecifications;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validity period in months.
|
||||||
|
*/
|
||||||
|
private Short validityPeriod;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 规则是否已维护:false=未维护,true=已维护
|
* 规则是否已维护:false=未维护,true=已维护
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -96,4 +96,14 @@ public class WmsInventory implements Serializable {
|
||||||
* 储位
|
* 储位
|
||||||
*/
|
*/
|
||||||
private String binLocation;
|
private String binLocation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测状态:0=未检测,1=检测中,2=已检测
|
||||||
|
*/
|
||||||
|
private Short detectionStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测结果:true=合格,false=不合格
|
||||||
|
*/
|
||||||
|
private Boolean detectionResults;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -135,12 +135,16 @@ public class WmsInventoryServiceImpl extends ServiceImpl<WmsInventoryMapper, Wms
|
||||||
.setBinLocation(item.getBinLocation())
|
.setBinLocation(item.getBinLocation())
|
||||||
.setNum(inventory.stream().map(InventoryInDTO::getNum).reduce(BigDecimal.ZERO, BigDecimal::add))
|
.setNum(inventory.stream().map(InventoryInDTO::getNum).reduce(BigDecimal.ZERO, BigDecimal::add))
|
||||||
.setSort(item.getOrder())
|
.setSort(item.getOrder())
|
||||||
|
.setDetectionStatus((short) 0)
|
||||||
|
.setDetectionResults(null)
|
||||||
// .setCreateBy(UserUtil.getUserName())
|
// .setCreateBy(UserUtil.getUserName())
|
||||||
.setCreateTime(LocalDateTime.now());
|
.setCreateTime(LocalDateTime.now());
|
||||||
forAdd.add(info);
|
forAdd.add(info);
|
||||||
} else {
|
} else {
|
||||||
info.setNum(info.getNum().add(inventory.stream().map(InventoryInDTO::getNum).reduce(BigDecimal.ZERO, BigDecimal::add)));
|
info.setNum(info.getNum().add(inventory.stream().map(InventoryInDTO::getNum).reduce(BigDecimal.ZERO, BigDecimal::add)));
|
||||||
info.setSort(item.getOrder());
|
info.setSort(item.getOrder());
|
||||||
|
info.setDetectionStatus((short) 0);
|
||||||
|
info.setDetectionResults(null);
|
||||||
// info.setUpdateBy(UserUtil.getUserName());
|
// info.setUpdateBy(UserUtil.getUserName());
|
||||||
info.setUpdateTime(LocalDateTime.now());
|
info.setUpdateTime(LocalDateTime.now());
|
||||||
forUpdate.add(info);
|
forUpdate.add(info);
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
material_name,
|
material_name,
|
||||||
material_texture,
|
material_texture,
|
||||||
material_specifications,
|
material_specifications,
|
||||||
|
validity_period,
|
||||||
is_standard_maintained,
|
is_standard_maintained,
|
||||||
created_type,
|
created_type,
|
||||||
create_by_name,
|
create_by_name,
|
||||||
|
|
@ -69,6 +70,9 @@
|
||||||
<if test="request.materialSpecifications != null and request.materialSpecifications != ''">
|
<if test="request.materialSpecifications != null and request.materialSpecifications != ''">
|
||||||
AND material_specifications ilike concat('%', #{request.materialSpecifications}, '%')
|
AND material_specifications ilike concat('%', #{request.materialSpecifications}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="request.validityPeriod != null">
|
||||||
|
AND validity_period = #{request.validityPeriod}
|
||||||
|
</if>
|
||||||
<if test="request.isStandardMaintained != null">
|
<if test="request.isStandardMaintained != null">
|
||||||
AND is_standard_maintained = #{request.isStandardMaintained}
|
AND is_standard_maintained = #{request.isStandardMaintained}
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -109,6 +113,7 @@
|
||||||
<when test="request.sortField == 'materialName'">material_name</when>
|
<when test="request.sortField == 'materialName'">material_name</when>
|
||||||
<when test="request.sortField == 'materialTexture'">material_texture</when>
|
<when test="request.sortField == 'materialTexture'">material_texture</when>
|
||||||
<when test="request.sortField == 'materialSpecifications'">material_specifications</when>
|
<when test="request.sortField == 'materialSpecifications'">material_specifications</when>
|
||||||
|
<when test="request.sortField == 'validityPeriod'">validity_period</when>
|
||||||
<when test="request.sortField == 'isStandardMaintained'">is_standard_maintained</when>
|
<when test="request.sortField == 'isStandardMaintained'">is_standard_maintained</when>
|
||||||
<when test="request.sortField == 'createdType'">created_type</when>
|
<when test="request.sortField == 'createdType'">created_type</when>
|
||||||
<when test="request.sortField == 'createByName'">create_by_name</when>
|
<when test="request.sortField == 'createByName'">create_by_name</when>
|
||||||
|
|
@ -145,6 +150,7 @@
|
||||||
material_name,
|
material_name,
|
||||||
material_texture,
|
material_texture,
|
||||||
material_specifications,
|
material_specifications,
|
||||||
|
validity_period,
|
||||||
CASE WHEN is_standard_maintained THEN '是' ELSE '否' END AS is_standard_maintained,
|
CASE WHEN is_standard_maintained THEN '是' ELSE '否' END AS is_standard_maintained,
|
||||||
CASE created_type WHEN 0 THEN '人工操作' WHEN 1 THEN '系统同步' ELSE '未知' END AS created_type,
|
CASE created_type WHEN 0 THEN '人工操作' WHEN 1 THEN '系统同步' ELSE '未知' END AS created_type,
|
||||||
create_by_name,
|
create_by_name,
|
||||||
|
|
@ -189,6 +195,9 @@
|
||||||
<if test="request.materialSpecifications != null and request.materialSpecifications != ''">
|
<if test="request.materialSpecifications != null and request.materialSpecifications != ''">
|
||||||
AND material_specifications ilike concat('%', #{request.materialSpecifications}, '%')
|
AND material_specifications ilike concat('%', #{request.materialSpecifications}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="request.validityPeriod != null">
|
||||||
|
AND validity_period = #{request.validityPeriod}
|
||||||
|
</if>
|
||||||
<if test="request.isStandardMaintained != null">
|
<if test="request.isStandardMaintained != null">
|
||||||
AND is_standard_maintained = #{request.isStandardMaintained}
|
AND is_standard_maintained = #{request.isStandardMaintained}
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -229,6 +238,7 @@
|
||||||
<when test="request.sortField == 'materialName'">material_name</when>
|
<when test="request.sortField == 'materialName'">material_name</when>
|
||||||
<when test="request.sortField == 'materialTexture'">material_texture</when>
|
<when test="request.sortField == 'materialTexture'">material_texture</when>
|
||||||
<when test="request.sortField == 'materialSpecifications'">material_specifications</when>
|
<when test="request.sortField == 'materialSpecifications'">material_specifications</when>
|
||||||
|
<when test="request.sortField == 'validityPeriod'">validity_period</when>
|
||||||
<when test="request.sortField == 'isStandardMaintained'">is_standard_maintained</when>
|
<when test="request.sortField == 'isStandardMaintained'">is_standard_maintained</when>
|
||||||
<when test="request.sortField == 'createdType'">created_type</when>
|
<when test="request.sortField == 'createdType'">created_type</when>
|
||||||
<when test="request.sortField == 'createByName'">create_by_name</when>
|
<when test="request.sortField == 'createByName'">create_by_name</when>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<select id="search" resultType="com.nflg.wms.common.pojo.vo.InventoryVO">
|
<select id="search" resultType="com.nflg.wms.common.pojo.vo.InventoryVO">
|
||||||
SELECT i."id",i.material_no,i.factory_no,i.warehouse_no,i.bin_location as binNo,i.num,i.batch_no as batchNumber
|
SELECT i."id",i.material_no,i.factory_no,i.warehouse_no,i.bin_location as binNo,i.num,i.batch_no as batchNumber
|
||||||
,i.serial_no as serialNo
|
,i.serial_no as serialNo,i.detection_status,i.detection_results
|
||||||
FROM wms_inventory i
|
FROM wms_inventory i
|
||||||
LEFT JOIN dictionary_item di ON di."value"=i.factory_no
|
LEFT JOIN dictionary_item di ON di."value"=i.factory_no
|
||||||
LEFT JOIN wms_warehouse wh ON wh.factory_id=di."id" and i.warehouse_no=wh.no
|
LEFT JOIN wms_warehouse wh ON wh.factory_id=di."id" and i.warehouse_no=wh.no
|
||||||
|
|
@ -21,6 +21,12 @@
|
||||||
<if test="request.batchNo != null and request.batchNo!=''">
|
<if test="request.batchNo != null and request.batchNo!=''">
|
||||||
AND i.batch_no= #{request.batchNo}
|
AND i.batch_no= #{request.batchNo}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="request.detectionStatus != null">
|
||||||
|
AND i.detection_status = #{request.detectionStatus}
|
||||||
|
</if>
|
||||||
|
<if test="request.detectionResults != null">
|
||||||
|
AND i.detection_results = #{request.detectionResults}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by i.id desc
|
order by i.id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue