feat:物料准备检定校准接口
This commit is contained in:
@@ -37,9 +37,13 @@ public class MaterialInventoryOutboundRespVO {
|
|||||||
private LocalDateTime applyTime;
|
private LocalDateTime applyTime;
|
||||||
|
|
||||||
@Schema(description = "物料名称", example = "硫酸")
|
@Schema(description = "物料名称", example = "硫酸")
|
||||||
@ExcelProperty("试剂名称")
|
@ExcelProperty("物料名称")
|
||||||
private String productName;
|
private String productName;
|
||||||
|
|
||||||
|
@Schema(description = "物料编码")
|
||||||
|
@ExcelProperty("物料编码")
|
||||||
|
private String productCode;
|
||||||
|
|
||||||
@Schema(description = "申请部门")
|
@Schema(description = "申请部门")
|
||||||
@ExcelProperty("消耗部门")
|
@ExcelProperty("消耗部门")
|
||||||
private String applyDepartment;
|
private String applyDepartment;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.zt.plat.module.qms.resource.material.controller.vo;
|
|||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -121,6 +122,14 @@ public class MaterialLifecycleDetailRespVO {
|
|||||||
@ExcelProperty("已完成数量")
|
@ExcelProperty("已完成数量")
|
||||||
private Long finishedCount;
|
private Long finishedCount;
|
||||||
|
|
||||||
|
@Schema(description = "合格/通过数量", example = "15772")
|
||||||
|
@ExcelProperty("合格/通过数量")
|
||||||
|
private BigDecimal qualifiedCount;
|
||||||
|
|
||||||
|
@Schema(description = "不合格/拒绝数量", example = "15772")
|
||||||
|
@ExcelProperty("不合格/拒绝数量")
|
||||||
|
private BigDecimal unqualifiedCount;
|
||||||
|
|
||||||
@Schema(description = "明细操作类型,【字典】【jy_material_lifecycle_detail_bsn_type】", example = "1")
|
@Schema(description = "明细操作类型,【字典】【jy_material_lifecycle_detail_bsn_type】", example = "1")
|
||||||
@ExcelProperty("明细操作类型,【字典】【jy_material_lifecycle_detail_bsn_type】")
|
@ExcelProperty("明细操作类型,【字典】【jy_material_lifecycle_detail_bsn_type】")
|
||||||
private String businessType;
|
private String businessType;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.zt.plat.module.qms.resource.material.controller.vo;
|
package com.zt.plat.module.qms.resource.material.controller.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -33,6 +34,12 @@ public class MaterialLifecycleDetailSaveReqVO {
|
|||||||
@Schema(description = "影响数量", example = "15772")
|
@Schema(description = "影响数量", example = "15772")
|
||||||
private BigDecimal influenceCount;
|
private BigDecimal influenceCount;
|
||||||
|
|
||||||
|
@Schema(description = "合格/通过数量", example = "15772")
|
||||||
|
private BigDecimal qualifiedCount;
|
||||||
|
|
||||||
|
@Schema(description = "不合格/拒绝数量", example = "15772")
|
||||||
|
private BigDecimal unqualifiedCount;
|
||||||
|
|
||||||
@Schema(description = "明细操作类型,【字典】【jy_material_lifecycle_detail_bsn_type】", example = "1")
|
@Schema(description = "明细操作类型,【字典】【jy_material_lifecycle_detail_bsn_type】", example = "1")
|
||||||
private String businessType;
|
private String businessType;
|
||||||
|
|
||||||
|
|||||||
@@ -20,14 +20,18 @@ public class MaterialConsumeStatisticsExportVO {
|
|||||||
@ExcelProperty("日期")
|
@ExcelProperty("日期")
|
||||||
private LocalDate applyTime;
|
private LocalDate applyTime;
|
||||||
|
|
||||||
@Schema(description = "物料名称", example = "硫酸")
|
|
||||||
@ExcelProperty("试剂名称")
|
|
||||||
private String productName;
|
|
||||||
|
|
||||||
@Schema(description = "申请部门")
|
@Schema(description = "申请部门")
|
||||||
@ExcelProperty("消耗部门")
|
@ExcelProperty("消耗部门")
|
||||||
private String applyDepartment;
|
private String applyDepartment;
|
||||||
|
|
||||||
|
@Schema(description = "物料名称", example = "硫酸")
|
||||||
|
@ExcelProperty("物料试剂名称")
|
||||||
|
private String productName;
|
||||||
|
|
||||||
|
@Schema(description = "物料编码")
|
||||||
|
@ExcelProperty("物料试剂编码")
|
||||||
|
private String productCode;
|
||||||
|
|
||||||
@Schema(description = "申请部门id", example = "845")
|
@Schema(description = "申请部门id", example = "845")
|
||||||
private Long applyDepartmentId;
|
private Long applyDepartmentId;
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,16 @@ public class MaterialLifecycleDetailDO extends BusinessBaseDO {
|
|||||||
*/
|
*/
|
||||||
@TableField("INFL_CNT")
|
@TableField("INFL_CNT")
|
||||||
private BigDecimal influenceCount;
|
private BigDecimal influenceCount;
|
||||||
|
/**
|
||||||
|
* 合格/通过数量
|
||||||
|
*/
|
||||||
|
@TableField("QLFD_CNT")
|
||||||
|
private BigDecimal qualifiedCount;
|
||||||
|
/**
|
||||||
|
* 不合格/拒绝数量
|
||||||
|
*/
|
||||||
|
@TableField("UNQ_CNT")
|
||||||
|
private BigDecimal unqualifiedCount;
|
||||||
/**
|
/**
|
||||||
* 明细操作类型,【字典】【jy_material_lifecycle_detail_bsn_type】
|
* 明细操作类型,【字典】【jy_material_lifecycle_detail_bsn_type】
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import com.zt.plat.module.qms.resource.material.enums.MaterialOutboundType;
|
|||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -64,6 +65,8 @@ public interface MaterialInventoryOutboundMapper extends BaseMapperX<MaterialInv
|
|||||||
.groupBy(MaterialInfomationDO::getProductId)
|
.groupBy(MaterialInfomationDO::getProductId)
|
||||||
.groupBy(MaterialInventoryOutboundDO::getApplyDepartmentId)
|
.groupBy(MaterialInventoryOutboundDO::getApplyDepartmentId)
|
||||||
;
|
;
|
||||||
|
if (reqVO.getApplyTime() != null && reqVO.getApplyTime().length == 2)
|
||||||
|
wrapper.between(MaterialInventoryOutboundDO::getApplyTime, reqVO.getApplyTime()[0], reqVO.getApplyTime()[1]);
|
||||||
List<Map<String, Object>> statisticsMaps = selectJoinMaps(wrapper);
|
List<Map<String, Object>> statisticsMaps = selectJoinMaps(wrapper);
|
||||||
if (CollUtil.isEmpty(statisticsMaps)) return List.of();
|
if (CollUtil.isEmpty(statisticsMaps)) return List.of();
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,10 @@ public enum MaterialFlowType {
|
|||||||
|
|
||||||
exchange_material("换货"),
|
exchange_material("换货"),
|
||||||
|
|
||||||
make_apply("配置申请");
|
make_apply("配置申请"),
|
||||||
|
|
||||||
|
verify_calibrate("检定校准")
|
||||||
|
;
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.zt.plat.module.qms.resource.material.job;
|
package com.zt.plat.module.qms.resource.material.job;
|
||||||
|
|
||||||
|
import com.xxl.job.core.context.XxlJobHelper;
|
||||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||||
import com.zt.plat.framework.tenant.core.job.TenantJob;
|
import com.zt.plat.framework.tenant.core.job.TenantJob;
|
||||||
import com.zt.plat.module.qms.resource.material.service.MaterialInfomationService;
|
import com.zt.plat.module.qms.resource.material.service.MaterialInfomationService;
|
||||||
@@ -20,15 +21,16 @@ public class MaterialJob {
|
|||||||
/**
|
/**
|
||||||
* 更新物料过期状态定时任务
|
* 更新物料过期状态定时任务
|
||||||
* 每天执行一次,检查并更新已过期的物料状态
|
* 每天执行一次,检查并更新已过期的物料状态
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@XxlJob("updateMaterialExpiredStatusJob")
|
@XxlJob("updateMaterialExpiredStatusJob")
|
||||||
@TenantJob
|
|
||||||
public void updateMaterialExpiredStatusJob() {
|
public void updateMaterialExpiredStatusJob() {
|
||||||
log.info("[updateMaterialExpiredStatusJob] 开始执行物料过期状态更新任务");
|
log.info("[updateMaterialExpiredStatusJob] 开始执行物料过期状态更新任务");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Integer updateCount = materialInfomationService.updateExpiredMaterialStatus();
|
Integer updateCount = materialInfomationService.updateExpiredMaterialStatus();
|
||||||
log.info("[updateMaterialExpiredStatusJob] 任务执行成功,共更新 {} 个物料", updateCount);
|
log.info("[updateMaterialExpiredStatusJob] 任务执行成功,共更新 {} 个物料", updateCount);
|
||||||
|
XxlJobHelper.handleSuccess(String.format("任务执行成功,共更新 %d 个物料", updateCount));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("[updateMaterialExpiredStatusJob] 任务执行失败:{}", e.getMessage(), e);
|
log.error("[updateMaterialExpiredStatusJob] 任务执行失败:{}", e.getMessage(), e);
|
||||||
throw e;
|
throw e;
|
||||||
|
|||||||
@@ -166,4 +166,12 @@ public interface MaterialBatchService {
|
|||||||
* @return 分页数据
|
* @return 分页数据
|
||||||
*/
|
*/
|
||||||
PageResult<MaterialBatchRespVO> getBatchGongPageWithPdtInfo(@Valid MaterialBatchPageReqVO pageReqVO);
|
PageResult<MaterialBatchRespVO> getBatchGongPageWithPdtInfo(@Valid MaterialBatchPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 锁定批次校准数量
|
||||||
|
*
|
||||||
|
* @param batches 批次信息
|
||||||
|
* @param lockType 锁定类型
|
||||||
|
*/
|
||||||
|
void lockBatchVerifyCalibrateCount(List<MaterialLifecycleDetailDO> batches, LockType lockType);
|
||||||
}
|
}
|
||||||
@@ -384,6 +384,27 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
|
|||||||
return pageResult;
|
return pageResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void lockBatchVerifyCalibrateCount(List<MaterialLifecycleDetailDO> batches, LockType lockType) {
|
||||||
|
List<Long> batIds = batches.stream().map(MaterialLifecycleDetailDO::getBatchId).toList();
|
||||||
|
List<MaterialBatchDO> batchDOS = getBatchListByBatchIds(batIds);
|
||||||
|
Map<Long, MaterialLifecycleDetailDO> lifecycleDetailDOMapByBatchId = batches.stream().collect(Collectors.toMap(MaterialLifecycleDetailDO::getBatchId, Function.identity()));
|
||||||
|
for (MaterialBatchDO batchDO : batchDOS) {
|
||||||
|
MaterialLifecycleDetailDO detailDO = lifecycleDetailDOMapByBatchId.get(batchDO.getId());
|
||||||
|
BigDecimal influenceCount = detailDO.getInfluenceCount();
|
||||||
|
switch (lockType) {
|
||||||
|
case lock -> {
|
||||||
|
BigDecimal lockQuantity = batchDO.getLockQuantity().add(influenceCount);
|
||||||
|
if (lockQuantity.compareTo(batchDO.getInboundQuantity()) > 0)
|
||||||
|
throw new ServiceException(1_032_160_000, "检定数量大于可用数量");
|
||||||
|
batchDO.setLockQuantity(lockQuantity);
|
||||||
|
}
|
||||||
|
case unlock -> batchDO.setLockQuantity(batchDO.getLockQuantity().subtract(influenceCount));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
materialBatchMapper.updateBatch(batchDOS);
|
||||||
|
}
|
||||||
|
|
||||||
private void lockBatchOrGongReturnExchangeCount(LockType lockType, List<MaterialBatchDO> batchOrGongDOS, Map<Long, MaterialLifecycleDetailDO> lifecycleDetailDOMapByBatOrGongId) {
|
private void lockBatchOrGongReturnExchangeCount(LockType lockType, List<MaterialBatchDO> batchOrGongDOS, Map<Long, MaterialLifecycleDetailDO> lifecycleDetailDOMapByBatOrGongId) {
|
||||||
for (MaterialBatchDO batOrGong : batchOrGongDOS) {
|
for (MaterialBatchDO batOrGong : batchOrGongDOS) {
|
||||||
MaterialLifecycleDetailDO detailDO = lifecycleDetailDOMapByBatOrGongId.get(batOrGong.getId());
|
MaterialLifecycleDetailDO detailDO = lifecycleDetailDOMapByBatOrGongId.get(batOrGong.getId());
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user