Compare commits
2 Commits
f09bb8f904
...
9244510903
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9244510903 | ||
|
|
4fa4371f0c |
@@ -54,7 +54,7 @@ public interface MaterialInventoryCheckDetailMapper extends BaseMapperX<Material
|
||||
.eqIfPresent(MaterialInventoryCheckDetailDO::getDisposalMethod, reqVO.getDisposalMethod())
|
||||
.eqIfPresent(MaterialInventoryCheckDetailDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
|
||||
.betweenIfPresent(MaterialInventoryCheckDetailDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByAsc(MaterialInventoryCheckDetailDO::getPresent)
|
||||
.orderByDesc(MaterialInventoryCheckDetailDO::getPresent)
|
||||
.orderByDesc(MaterialInventoryCheckDetailDO::getId);
|
||||
|
||||
return selectJoinPage(reqVO, MaterialInventoryCheckDetailRespVO.class, wrapper);
|
||||
|
||||
@@ -9,6 +9,8 @@ import lombok.Getter;
|
||||
public enum MaterialInboundType {
|
||||
acceptance_inbound("验收入库"),
|
||||
|
||||
hzrd_make_inbound("危化品配置入库"),
|
||||
|
||||
check_inbound("盘点入库");
|
||||
|
||||
private final String name;
|
||||
@@ -17,8 +19,8 @@ public enum MaterialInboundType {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static MaterialFlowType fromName(String name) {
|
||||
for (MaterialFlowType type : MaterialFlowType.values()) {
|
||||
public static MaterialInboundType fromName(String name) {
|
||||
for (MaterialInboundType type : MaterialInboundType.values()) {
|
||||
if (type.getName().equals(name)) {
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -149,10 +149,9 @@ public interface MaterialInfomationService {
|
||||
*
|
||||
* @param product 大类信息
|
||||
* @param totalOperationQuantity 总操作数量
|
||||
* @param productId 大类id
|
||||
* @return 物料信息
|
||||
*/
|
||||
MaterialInfomationDO saveMaterialInfomationByHzrdMtrlMake(MaterialProductDO product, BigDecimal totalOperationQuantity, Long productId);
|
||||
MaterialInfomationDO saveMaterialInfomationByHzrdMtrlMake(MaterialProductDO product, BigDecimal totalOperationQuantity);
|
||||
|
||||
/**
|
||||
* 批量保存物料信息 - 标准溶液配置生成生成
|
||||
|
||||
@@ -232,13 +232,13 @@ public class MaterialInfomationServiceImpl implements MaterialInfomationService
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialInfomationDO saveMaterialInfomationByHzrdMtrlMake(MaterialProductDO product, BigDecimal totalOperationQuantity, Long productId) {
|
||||
public MaterialInfomationDO saveMaterialInfomationByHzrdMtrlMake(MaterialProductDO product, BigDecimal totalOperationQuantity) {
|
||||
MaterialInfomationDO infomationDO = BeanUtils.toBean(product, MaterialInfomationDO.class);
|
||||
infomationDO
|
||||
.setId(null)
|
||||
.setInitialVolume(totalOperationQuantity)
|
||||
.setRemainingVolume(totalOperationQuantity)
|
||||
.setProductId(productId)
|
||||
.setProductId(product.getId())
|
||||
.setCode(this.getInfomationCode(product.getCustomConfig()))
|
||||
.setManufacturerDate(LocalDate.now())
|
||||
.setExpirationDate(LocalDate.now().plusDays(product.getDue()))
|
||||
|
||||
@@ -4,8 +4,9 @@ import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundPageReqVO;
|
||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundRespVO;
|
||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundSaveReqVO;
|
||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInfomationDO;
|
||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryInboundDO;
|
||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDO;
|
||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -77,4 +78,15 @@ public interface MaterialInventoryInboundService {
|
||||
* @param inbounds 入库
|
||||
*/
|
||||
void saveBatch(List<MaterialInventoryInboundDO> inbounds);
|
||||
|
||||
/**
|
||||
* 入库物料实例
|
||||
*
|
||||
* @param inbound 入库信息
|
||||
* @param product 需要入库的大类
|
||||
* @param totalQuantity 实例的总量
|
||||
* @param infomations 需要入库的物料实例
|
||||
* @return 物料实例
|
||||
*/
|
||||
List<MaterialInfomationDO> inboundInfomation(MaterialInventoryInboundDO inbound, MaterialProductDO product, BigDecimal totalQuantity, List<MaterialInfomationDO> infomations);
|
||||
}
|
||||
@@ -20,24 +20,16 @@ import com.zt.plat.module.qms.resource.material.dal.dataobject.*;
|
||||
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialInventoryInboundMapper;
|
||||
import com.zt.plat.module.qms.resource.material.enums.MaterialAcceptStatus;
|
||||
import com.zt.plat.module.qms.resource.material.enums.MaterialInboundType;
|
||||
import com.zt.plat.module.system.api.dept.DeptApi;
|
||||
import com.zt.plat.module.system.api.dept.dto.DeptRespDTO;
|
||||
import com.zt.plat.module.system.api.user.AdminUserApi;
|
||||
import com.zt.plat.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.*;
|
||||
@@ -146,6 +138,46 @@ public class MaterialInventoryInboundServiceImpl implements MaterialInventoryInb
|
||||
materialInventoryInboundMapper.insertBatch(inbounds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MaterialInfomationDO> inboundInfomation(MaterialInventoryInboundDO inboundInfo, MaterialProductDO product, BigDecimal totalOperationQuantity, List<MaterialInfomationDO> infomations) {
|
||||
MaterialInboundType inboundType = MaterialInboundType.fromName(inboundInfo.getBusinessType());
|
||||
// 1. 保存入库单
|
||||
materialInventoryInboundMapper.insert(inboundInfo);
|
||||
if (inboundType == MaterialInboundType.hzrd_make_inbound) {
|
||||
MaterialInfomationDO infomation = materialInfomationService.saveMaterialInfomationByHzrdMtrlMake(product, totalOperationQuantity);
|
||||
MaterialInventoryInboundDetailDO detailDO = new MaterialInventoryInboundDetailDO()
|
||||
.setInboundId(inboundInfo.getId())
|
||||
.setMaterialInfomationId(infomation.getId())
|
||||
.setInboundUserName(inboundInfo.getApplyUser())
|
||||
.setInboundUserId(inboundInfo.getApplyUserId())
|
||||
.setInboundDepartmentName(inboundInfo.getApplyDepartment())
|
||||
.setInboundDepartmentId(inboundInfo.getApplyDepartmentId())
|
||||
.setInboundTime(LocalDateTime.now())
|
||||
.setRemark(inboundInfo.getRemark());
|
||||
materialInventoryInboundDetailService.saveBatch(List.of(detailDO));
|
||||
return List.of(infomation);
|
||||
} else if (inboundType == MaterialInboundType.check_inbound) {
|
||||
// 保存入库明细
|
||||
List<MaterialInventoryInboundDetailDO> inboundDetails = infomations.stream()
|
||||
.map(inf -> new MaterialInventoryInboundDetailDO()
|
||||
.setInboundId(inboundInfo.getId())
|
||||
.setMaterialInfomationId(inf.getId())
|
||||
.setInboundUserName(inboundInfo.getApplyUser())
|
||||
.setInboundUserId(inboundInfo.getApplyUserId())
|
||||
.setInboundDepartmentName(inboundInfo.getApplyDepartment())
|
||||
.setInboundDepartmentId(inboundInfo.getApplyDepartmentId())
|
||||
.setInboundTime(LocalDateTime.now())
|
||||
.setRemark(inboundInfo.getRemark()))
|
||||
.toList();
|
||||
materialInventoryInboundDetailService.saveBatch(inboundDetails);
|
||||
|
||||
// 更新物料在库状态
|
||||
List<Long> infIds = infomations.stream().map(MaterialInfomationDO::getId).toList();
|
||||
materialInfomationService.updateByIds(infIds, new MaterialInfomationDO().setUsageStatus(0));
|
||||
}
|
||||
return List.of();
|
||||
}
|
||||
|
||||
private MaterialInventoryInboundDO getInbound(MaterialInventoryInboundSaveReqVO createReqVO, MaterialBatchDO gongDO) {
|
||||
MaterialInventoryInboundDO inbound = BeanUtils.toBean(createReqVO, MaterialInventoryInboundDO.class);
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
|
||||
@@ -106,8 +106,6 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService ,
|
||||
private MaterialInventoryCheckDetailService materialInventoryCheckDetailService;
|
||||
@Autowired
|
||||
private MaterialInventoryInboundService materialInventoryInboundService;
|
||||
@Autowired
|
||||
private MaterialInventoryInboundDetailService materialInventoryInboundDetailService;
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
@@ -1127,7 +1125,8 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService ,
|
||||
.setApplyTime(lifecycleDO.getApplyTime())
|
||||
.setLocationId(locationId).setQuantity(BigDecimal.valueOf(infList.size()))
|
||||
.setRemark("盘点后不在库的入库");
|
||||
inbounds.add(inbound);
|
||||
materialInventoryInboundService.inboundInfomation(inbound, null, null, infList);
|
||||
/*inbounds.add(inbound);
|
||||
List<MaterialInventoryInboundDetailDO> detailDOS = infList.stream().map(inf -> new MaterialInventoryInboundDetailDO()
|
||||
.setInboundId(inbound.getId())
|
||||
.setMaterialInfomationId(inf.getId())
|
||||
@@ -1137,13 +1136,13 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService ,
|
||||
.setInboundDepartmentId(inbound.getApplyDepartmentId())
|
||||
.setInboundTime(LocalDateTime.now())
|
||||
.setRemark("盘点后入库")).toList();
|
||||
inboundDetails.addAll(detailDOS);
|
||||
inboundDetails.addAll(detailDOS);*/
|
||||
}
|
||||
});
|
||||
materialInventoryInboundService.saveBatch(inbounds);
|
||||
/*materialInventoryInboundService.saveBatch(inbounds);
|
||||
materialInventoryInboundDetailService.saveBatch(inboundDetails);
|
||||
// 更新物料在库状态
|
||||
List<Long> infIds = infs.stream().map(MaterialInfomationDO::getId).toList();
|
||||
materialInfomationService.updateByIds(infIds, new MaterialInfomationDO().setUsageStatus(0));
|
||||
materialInfomationService.updateByIds(infIds, new MaterialInfomationDO().setUsageStatus(0));*/
|
||||
}
|
||||
}
|
||||
@@ -6,15 +6,14 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.zt.plat.framework.common.exception.ServiceException;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import com.zt.plat.framework.security.core.LoginUser;
|
||||
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.zt.plat.module.qms.resource.material.controller.vo.*;
|
||||
import com.zt.plat.module.qms.resource.material.controller.vo.query.MaterialUseRecordWithMakeInfoQueryVO;
|
||||
import com.zt.plat.module.qms.resource.material.controller.vo.resp.MaterialUseRecordWithMakeInfoRespVO;
|
||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInfomationDO;
|
||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
|
||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialUseRecordDO;
|
||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialUseRecordDetailDO;
|
||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.*;
|
||||
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialUseRecordDetailMapper;
|
||||
import com.zt.plat.module.qms.resource.material.enums.MaterialInboundType;
|
||||
import com.zt.plat.module.qms.resource.material.enums.MaterialOutboundType;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -46,12 +45,12 @@ public class MaterialUseRecordDetailServiceImpl implements MaterialUseRecordDeta
|
||||
private MaterialInfomationService materialInfomationService;
|
||||
@Autowired
|
||||
private MaterialUseRecordService materialUseRecordService;
|
||||
|
||||
@Autowired
|
||||
private MaterialProductService materialProductService;
|
||||
|
||||
@Autowired
|
||||
private MaterialInventoryOutboundService materialInventoryOutboundService;
|
||||
@Autowired
|
||||
private MaterialInventoryInboundService materialInventoryInboundService;
|
||||
|
||||
@Override
|
||||
public MaterialUseRecordDetailRespVO createMaterialUseRecordDetail(MaterialUseRecordDetailSaveReqVO createReqVO) {
|
||||
@@ -214,14 +213,24 @@ public class MaterialUseRecordDetailServiceImpl implements MaterialUseRecordDeta
|
||||
updateInfomationsRemainingVolume(recordDOS, infomations);
|
||||
|
||||
// 生成物料实例
|
||||
MaterialInfomationDO infomationDO = materialInfomationService.saveMaterialInfomationByHzrdMtrlMake(product, totalOperationQuantity, productId);
|
||||
// 入库
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
assert loginUser != null;
|
||||
String userNickname = SecurityFrameworkUtils.getLoginUserNickname();
|
||||
MaterialInventoryInboundDO inbound = new MaterialInventoryInboundDO()
|
||||
.setTitle("危化品配置后入库")
|
||||
.setBusinessType(MaterialInboundType.hzrd_make_inbound.getName())
|
||||
.setApplyUser(userNickname).setApplyUserId(loginUser.getId())
|
||||
.setApplyDepartment(loginUser.getVisitDeptName()).setApplyDepartmentId(loginUser.getVisitDeptId())
|
||||
.setApplyTime(LocalDateTime.now());
|
||||
MaterialInfomationDO infomationDO = materialInventoryInboundService.inboundInfomation(inbound, product, totalOperationQuantity, null).get(0);
|
||||
// 保存配置明细
|
||||
List<MaterialUseRecordDetailDO> recordDetailDOS = recordDOS.stream().map(record -> new MaterialUseRecordDetailDO()
|
||||
.setRecordId(record.getId()).setInfomationId(record.getInfomationId())
|
||||
.setTargetInfomationId(infomationDO.getId())).toList();
|
||||
this.saveBatch(recordDetailDOS);
|
||||
|
||||
// 保存领用记录
|
||||
// 保存领用记录 - 出库
|
||||
MaterialInventoryOutboundSaveReqVO outboundSaveReqVO = new MaterialInventoryOutboundSaveReqVO()
|
||||
.setBusinessType(MaterialOutboundType.receive_outbound.getName())
|
||||
.setInfomationIds(Collections.singletonList(infomationDO.getId()))
|
||||
|
||||
Reference in New Issue
Block a user