feat:领用出库、同意出库
This commit is contained in:
@@ -136,5 +136,16 @@ public class MaterialInventoryController extends AbstractFileUploadController im
|
|||||||
return success(BeanUtils.toBean(pageResult, MaterialInventoryRespVO.class));
|
return success(BeanUtils.toBean(pageResult, MaterialInventoryRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/agree-out")
|
||||||
|
@Operation(summary = "同意出库")
|
||||||
|
@Parameter(name = "id", description = "出库单id", required = true)
|
||||||
|
public CommonResult<Boolean> agreeOut(@RequestParam("outId") Long outId) {
|
||||||
|
|
||||||
|
// PageResult<MaterialInventoryDO> pageResult = mterialInventoryService.getMaterialInventoryPage(pageReqVO);
|
||||||
|
// return success(BeanUtils.toBean(pageResult, MaterialInventoryRespVO.class));
|
||||||
|
mterialInventoryService.agreeMaterialInventoryOutbound(outId);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -37,7 +37,7 @@ import com.zt.plat.module.qms.resource.material.service.MaterialInventoryOutboun
|
|||||||
|
|
||||||
@Tag(name = "管理后台 - 出库")
|
@Tag(name = "管理后台 - 出库")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/qms/material-inventory-outbound")
|
@RequestMapping("/qms/resource/material-inventory-outbound")
|
||||||
@Validated
|
@Validated
|
||||||
@FileUploadController(source = "qms.materialinventoryoutbound")
|
@FileUploadController(source = "qms.materialinventoryoutbound")
|
||||||
public class MaterialInventoryOutboundController extends AbstractFileUploadController implements BusinessControllerMarker{
|
public class MaterialInventoryOutboundController extends AbstractFileUploadController implements BusinessControllerMarker{
|
||||||
@@ -115,4 +115,12 @@ public class MaterialInventoryOutboundController extends AbstractFileUploadContr
|
|||||||
BeanUtils.toBean(list, MaterialInventoryOutboundRespVO.class));
|
BeanUtils.toBean(list, MaterialInventoryOutboundRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/create-all")
|
||||||
|
@Operation(summary = "创建出库")
|
||||||
|
@PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound:create')")
|
||||||
|
public CommonResult<MaterialInventoryOutboundRespVO> createMaterialInventoryOutboundAll(@Valid @RequestBody MaterialInventoryOutboundSaveReqVO createReqVO) {
|
||||||
|
return success(materialInventoryOutboundService.createMaterialInventoryOutboundAll(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.*;
|
import com.alibaba.excel.annotation.*;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 出库 Response VO")
|
@Schema(description = "管理后台 - 出库 Response VO")
|
||||||
@@ -79,4 +81,7 @@ public class MaterialInventoryOutboundRespVO {
|
|||||||
@ExcelProperty("创建时间")
|
@ExcelProperty("创建时间")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "出库明细")
|
||||||
|
private List<MaterialInventoryOutboundDetailRespVO> detailReqVoList;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 出库新增/修改 Request VO")
|
@Schema(description = "管理后台 - 出库新增/修改 Request VO")
|
||||||
@Data
|
@Data
|
||||||
@@ -57,4 +58,7 @@ public class MaterialInventoryOutboundSaveReqVO {
|
|||||||
@Schema(description = "备注")
|
@Schema(description = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "出库明细")
|
||||||
|
private List<MaterialInventoryOutboundDetailSaveReqVO> detailSaveReqVoList;
|
||||||
}
|
}
|
||||||
@@ -61,4 +61,14 @@ public interface MaterialInventoryOutboundService {
|
|||||||
*/
|
*/
|
||||||
PageResult<MaterialInventoryOutboundDO> getMaterialInventoryOutboundPage(MaterialInventoryOutboundPageReqVO pageReqVO);
|
PageResult<MaterialInventoryOutboundDO> getMaterialInventoryOutboundPage(MaterialInventoryOutboundPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建出库
|
||||||
|
*
|
||||||
|
* 连带出库明细一起创建
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
MaterialInventoryOutboundRespVO createMaterialInventoryOutboundAll(@Valid MaterialInventoryOutboundSaveReqVO createReqVO);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,13 @@
|
|||||||
package com.zt.plat.module.qms.resource.material.service;
|
package com.zt.plat.module.qms.resource.material.service;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundPageReqVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.*;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundRespVO;
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryOutboundDetailDO;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundSaveReqVO;
|
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialInventoryOutboundDetailMapper;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -32,6 +34,9 @@ public class MaterialInventoryOutboundServiceImpl implements MaterialInventoryOu
|
|||||||
@Resource
|
@Resource
|
||||||
private MaterialInventoryOutboundMapper materialInventoryOutboundMapper;
|
private MaterialInventoryOutboundMapper materialInventoryOutboundMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MaterialInventoryOutboundDetailMapper materialInventoryOutboundDetailMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MaterialInventoryOutboundRespVO createMaterialInventoryOutbound(MaterialInventoryOutboundSaveReqVO createReqVO) {
|
public MaterialInventoryOutboundRespVO createMaterialInventoryOutbound(MaterialInventoryOutboundSaveReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
@@ -59,12 +64,12 @@ public class MaterialInventoryOutboundServiceImpl implements MaterialInventoryOu
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteMaterialInventoryOutboundListByIds(List<Long> ids) {
|
public void deleteMaterialInventoryOutboundListByIds(List<Long> ids) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
validateMaterialInventoryOutboundExists(ids);
|
validateMaterialInventoryOutboundExists(ids);
|
||||||
// 删除
|
// 删除
|
||||||
materialInventoryOutboundMapper.deleteByIds(ids);
|
materialInventoryOutboundMapper.deleteByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateMaterialInventoryOutboundExists(List<Long> ids) {
|
private void validateMaterialInventoryOutboundExists(List<Long> ids) {
|
||||||
List<MaterialInventoryOutboundDO> list = materialInventoryOutboundMapper.selectByIds(ids);
|
List<MaterialInventoryOutboundDO> list = materialInventoryOutboundMapper.selectByIds(ids);
|
||||||
@@ -89,4 +94,39 @@ public class MaterialInventoryOutboundServiceImpl implements MaterialInventoryOu
|
|||||||
return materialInventoryOutboundMapper.selectPage(pageReqVO);
|
return materialInventoryOutboundMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public MaterialInventoryOutboundRespVO createMaterialInventoryOutboundAll(@Valid MaterialInventoryOutboundSaveReqVO createReqVO) {
|
||||||
|
|
||||||
|
|
||||||
|
/** 创建出库头 */
|
||||||
|
// 插入
|
||||||
|
MaterialInventoryOutboundDO materialInventoryOutbound = BeanUtils.toBean(createReqVO, MaterialInventoryOutboundDO.class);
|
||||||
|
materialInventoryOutboundMapper.insert(materialInventoryOutbound);
|
||||||
|
|
||||||
|
MaterialInventoryOutboundRespVO respVO = BeanUtils.toBean(materialInventoryOutbound, MaterialInventoryOutboundRespVO.class);
|
||||||
|
|
||||||
|
/** 创建出出库明细 */
|
||||||
|
// 校验存在
|
||||||
|
if (createReqVO.getDetailSaveReqVoList() == null || createReqVO.getDetailSaveReqVoList().size() == 0)
|
||||||
|
throw exception(MATERIAL_INVENTORY_OUTBOUND_DETAIL_NOT_EXISTS);
|
||||||
|
|
||||||
|
List<MaterialInventoryOutboundDetailRespVO> detailReqVoList = new ArrayList<>();
|
||||||
|
|
||||||
|
for (MaterialInventoryOutboundDetailSaveReqVO itemVo : createReqVO.getDetailSaveReqVoList()) {
|
||||||
|
MaterialInventoryOutboundDetailDO materialInventoryOutboundDetail = BeanUtils.toBean(itemVo, MaterialInventoryOutboundDetailDO.class);
|
||||||
|
|
||||||
|
// 设置出库单id
|
||||||
|
materialInventoryOutboundDetail.setParentId(materialInventoryOutbound.getId());
|
||||||
|
|
||||||
|
materialInventoryOutboundDetailMapper.insert(materialInventoryOutboundDetail);
|
||||||
|
detailReqVoList.add(BeanUtils.toBean(materialInventoryOutboundDetail, MaterialInventoryOutboundDetailRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
respVO.setDetailReqVoList(detailReqVoList);
|
||||||
|
|
||||||
|
|
||||||
|
// 返回
|
||||||
|
return respVO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -22,5 +22,10 @@ public interface MaterialInventoryService {
|
|||||||
*/
|
*/
|
||||||
PageResult<MaterialInventoryDO> getMaterialInventoryPage(MaterialInventoryRespVO pageReqVO);
|
PageResult<MaterialInventoryDO> getMaterialInventoryPage(MaterialInventoryRespVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同意出库
|
||||||
|
*/
|
||||||
|
|
||||||
|
void agreeMaterialInventoryOutbound(Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -7,19 +7,37 @@ import com.zt.plat.framework.common.util.object.BeanUtils;
|
|||||||
import com.zt.plat.module.qms.business.bus.controller.vo.BusinessSampleEntrustRegistrationExtendRespVO;
|
import com.zt.plat.module.qms.business.bus.controller.vo.BusinessSampleEntrustRegistrationExtendRespVO;
|
||||||
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSampleEntrustRegistrationDO;
|
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSampleEntrustRegistrationDO;
|
||||||
import com.zt.plat.module.qms.enums.QmsCommonConstant;
|
import com.zt.plat.module.qms.enums.QmsCommonConstant;
|
||||||
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundDetailPageReqVO;
|
||||||
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundPageReqVO;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryRespVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryRespVO;
|
||||||
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInfomationDO;
|
||||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryDO;
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryDO;
|
||||||
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryOutboundDetailDO;
|
||||||
|
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialInfomationMapper;
|
||||||
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialInventoryMapper;
|
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialInventoryMapper;
|
||||||
|
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialInventoryOutboundDetailMapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
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.MATERIAL_INFOMATION_NOT_EXISTS;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class MaterialInventoryServiceImpl implements MaterialInventoryService{
|
public class MaterialInventoryServiceImpl implements MaterialInventoryService {
|
||||||
@Resource
|
@Resource
|
||||||
private MaterialInventoryMapper materialInventoryMapper;
|
private MaterialInventoryMapper materialInventoryMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MaterialInventoryOutboundDetailMapper materialInventoryOutboundDetailMapper;//出库明细
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MaterialInfomationMapper materialInfomationMapper;//物料实例
|
||||||
@Override
|
@Override
|
||||||
public PageResult<MaterialInventoryDO> getMaterialInventoryPage(MaterialInventoryRespVO pageReqVO){
|
public PageResult<MaterialInventoryDO> getMaterialInventoryPage(MaterialInventoryRespVO pageReqVO) {
|
||||||
IPage<MaterialInventoryDO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
IPage<MaterialInventoryDO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||||
|
|
||||||
IPage<MaterialInventoryDO> pageList = materialInventoryMapper.selectPageList(page, pageReqVO);
|
IPage<MaterialInventoryDO> pageList = materialInventoryMapper.selectPageList(page, pageReqVO);
|
||||||
@@ -27,4 +45,32 @@ public class MaterialInventoryServiceImpl implements MaterialInventoryService{
|
|||||||
return BeanUtils.toBean(pageResult, MaterialInventoryDO.class);
|
return BeanUtils.toBean(pageResult, MaterialInventoryDO.class);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void agreeMaterialInventoryOutbound(Long outId) {
|
||||||
|
MaterialInventoryOutboundDetailPageReqVO pageReqVO = new MaterialInventoryOutboundDetailPageReqVO();
|
||||||
|
pageReqVO.setParentId(outId);
|
||||||
|
pageReqVO.setPageSize(-1);//不分页
|
||||||
|
PageResult<MaterialInventoryOutboundDetailDO> materialInventoryOutboundDetailDOPageResult = materialInventoryOutboundDetailMapper.selectPage(pageReqVO);
|
||||||
|
|
||||||
|
List<MaterialInventoryOutboundDetailDO> list = materialInventoryOutboundDetailDOPageResult.getList();
|
||||||
|
for (MaterialInventoryOutboundDetailDO item : list) {
|
||||||
|
// 校验存在
|
||||||
|
validateMaterialInfomationExists(item.getInfomationId());
|
||||||
|
// 更新
|
||||||
|
MaterialInfomationDO updateObj = new MaterialInfomationDO();
|
||||||
|
updateObj.setId(item.getInfomationId());
|
||||||
|
updateObj.setUsageStatus("1");
|
||||||
|
materialInfomationMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateMaterialInfomationExists(Long id) {
|
||||||
|
if (materialInfomationMapper.selectById(id) == null) {
|
||||||
|
throw exception(MATERIAL_INFOMATION_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user