优化
This commit is contained in:
@ -18,6 +18,7 @@ import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueQueryReq;
|
||||
import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueUpdateReq;
|
||||
import org.dromara.materials.domain.vo.materialissue.MatMaterialIssueVo;
|
||||
import org.dromara.materials.domain.vo.materialreceiveitem.MatMaterialReceiveItemVo;
|
||||
import org.dromara.materials.domain.vo.materialsinventory.MatMaterialsInventoryListVo;
|
||||
import org.dromara.materials.domain.vo.materialsinventory.MatMaterialsInventoryVo;
|
||||
import org.dromara.materials.service.IMatMaterialIssueService;
|
||||
import org.dromara.materials.service.IMatMaterialsInventoryService;
|
||||
@ -113,7 +114,7 @@ public class MatMaterialIssueController extends BaseController {
|
||||
* 查询出库记录列表
|
||||
*/
|
||||
@GetMapping("/inventory/list/{projectId}")
|
||||
public R<List<MatMaterialsInventory>> inventoryList(@NotEmpty(message = "项目不能为空")
|
||||
public R<List<MatMaterialsInventoryListVo>> inventoryList(@NotNull(message = "项目不能为空")
|
||||
@PathVariable Long projectId) {
|
||||
return R.ok(matMaterialIssueService.inventoryList(projectId));
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
package org.dromara.materials.domain.vo.materialsinventory;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.materials.domain.MatMaterialsInventory;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 材料出/入库视图对象 mat_materials_inventory
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-03-06
|
||||
*/
|
||||
@Data
|
||||
@AutoMapper(target = MatMaterialsInventory.class)
|
||||
public class MatMaterialsInventoryListVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 材料id
|
||||
*/
|
||||
private Long materialsId;
|
||||
/**
|
||||
* 材料名称
|
||||
*/
|
||||
private String materialsName;
|
||||
|
||||
/**
|
||||
* 出/入库的数量
|
||||
*/
|
||||
private Long number;
|
||||
|
||||
/**
|
||||
* 计量单位
|
||||
*/
|
||||
private String weightId;
|
||||
|
||||
|
||||
/**
|
||||
* 规格型号名称
|
||||
*/
|
||||
private String typeSpecificationName;
|
||||
|
||||
}
|
@ -12,6 +12,7 @@ import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueCreateReq;
|
||||
import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueQueryReq;
|
||||
import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueUpdateReq;
|
||||
import org.dromara.materials.domain.vo.materialissue.MatMaterialIssueVo;
|
||||
import org.dromara.materials.domain.vo.materialsinventory.MatMaterialsInventoryListVo;
|
||||
import org.dromara.materials.domain.vo.materialsinventory.MatMaterialsInventoryVo;
|
||||
|
||||
import java.util.Collection;
|
||||
@ -110,5 +111,5 @@ public interface IMatMaterialIssueService extends IService<MatMaterialIssue> {
|
||||
/**
|
||||
* 查询出库记录列表
|
||||
*/
|
||||
List<MatMaterialsInventory> inventoryList(Long projectId);
|
||||
List<MatMaterialsInventoryListVo> inventoryList(Long projectId);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.dromara.materials.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -22,11 +23,11 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.oss.core.OssClient;
|
||||
import org.dromara.common.oss.exception.OssException;
|
||||
import org.dromara.common.oss.factory.OssFactory;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.common.utils.DocumentUtil;
|
||||
import org.dromara.materials.constants.MatMaterialsConstant;
|
||||
import org.dromara.materials.domain.MatMaterialIssue;
|
||||
import org.dromara.materials.domain.MatMaterialIssueItem;
|
||||
import org.dromara.materials.domain.MatMaterials;
|
||||
import org.dromara.materials.domain.MatMaterialsInventory;
|
||||
import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueCreateReq;
|
||||
import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueQueryReq;
|
||||
@ -34,13 +35,13 @@ import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueUpdateReq;
|
||||
import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueWordDto;
|
||||
import org.dromara.materials.domain.dto.materialissueitem.MatMaterialIssueItemDto;
|
||||
import org.dromara.materials.domain.dto.materialissueitem.MatMaterialIssueItemWordDto;
|
||||
import org.dromara.materials.domain.enums.MatMaterialsInventoryOutPutEnum;
|
||||
import org.dromara.materials.domain.vo.materialissue.MatMaterialIssueVo;
|
||||
import org.dromara.materials.domain.vo.materialsinventory.MatMaterialsInventoryVo;
|
||||
import org.dromara.materials.domain.vo.materialsinventory.MatMaterialsInventoryListVo;
|
||||
import org.dromara.materials.mapper.MatMaterialIssueMapper;
|
||||
import org.dromara.materials.service.IMatMaterialIssueItemService;
|
||||
import org.dromara.materials.service.IMatMaterialIssueService;
|
||||
import org.dromara.materials.service.IMatMaterialsInventoryService;
|
||||
import org.dromara.materials.service.IMatMaterialsService;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.system.domain.vo.SysOssVo;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
@ -82,6 +83,9 @@ public class MatMaterialIssueServiceImpl extends ServiceImpl<MatMaterialIssueMap
|
||||
@Resource
|
||||
private IMatMaterialsInventoryService materialsInventoryService;
|
||||
|
||||
@Resource
|
||||
private IMatMaterialsService matMaterialsService;
|
||||
|
||||
/**
|
||||
* 查询物料领料单
|
||||
*
|
||||
@ -260,7 +264,7 @@ public class MatMaterialIssueServiceImpl extends ServiceImpl<MatMaterialIssueMap
|
||||
throw new ServiceException("物料领料单明细项新增失败", HttpStatus.ERROR);
|
||||
}
|
||||
// 创建设备材料出库记录
|
||||
List<MatMaterialsInventory> inventoryList = itemList.stream().map(item -> {
|
||||
/*List<MatMaterialsInventory> inventoryList = itemList.stream().map(item -> {
|
||||
MatMaterialsInventory inventory = new MatMaterialsInventory();
|
||||
inventory.setNumber(item.getIssuedQuantity().longValue());
|
||||
inventory.setOutPutTime(new Date());
|
||||
@ -277,7 +281,7 @@ public class MatMaterialIssueServiceImpl extends ServiceImpl<MatMaterialIssueMap
|
||||
boolean saved = materialsInventoryService.saveBatch(inventoryList);
|
||||
if (!saved) {
|
||||
throw new ServiceException("物料出库记录新增失败", HttpStatus.ERROR);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -474,16 +478,23 @@ public class MatMaterialIssueServiceImpl extends ServiceImpl<MatMaterialIssueMap
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MatMaterialsInventory> inventoryList(Long projectId) {
|
||||
public List<MatMaterialsInventoryListVo> inventoryList(Long projectId) {
|
||||
|
||||
List<MatMaterialIssueItem> list = materialIssueItemService.list(Wrappers.lambdaQuery(MatMaterialIssueItem.class)
|
||||
.eq(MatMaterialIssueItem::getProjectId, 1));
|
||||
List<Long> list1 = list.stream().map(MatMaterialIssueItem::getInventoryId).toList();
|
||||
return materialsInventoryService.list(Wrappers.lambdaQuery(MatMaterialsInventory.class)
|
||||
List<MatMaterialsInventory> list2 = materialsInventoryService.list(Wrappers.lambdaQuery(MatMaterialsInventory.class)
|
||||
.notIn(CollectionUtil.isNotEmpty(list1), MatMaterialsInventory::getId, list1)
|
||||
.eq(MatMaterialsInventory::getProjectId, projectId)
|
||||
.eq(MatMaterialsInventory::getOutPut, "1")
|
||||
);
|
||||
.eq(MatMaterialsInventory::getOutPut, "1"));
|
||||
List<MatMaterialsInventoryListVo> matMaterialsInventoryListVos = BeanUtil.copyToList(list2, MatMaterialsInventoryListVo.class);
|
||||
for (MatMaterialsInventoryListVo matMaterialsInventoryListVo : matMaterialsInventoryListVos) {
|
||||
MatMaterials byId = matMaterialsService.getById(matMaterialsInventoryListVo.getMaterialsId());
|
||||
BeanUtil.copyProperties(byId, matMaterialsInventoryListVo, "id");
|
||||
}
|
||||
|
||||
return matMaterialsInventoryListVos;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user