|
@@ -1,15 +1,22 @@
|
|
|
package com.jsh.erp.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.jsh.erp.datasource.dto.TaskStocktakingDTO;
|
|
|
-import com.jsh.erp.datasource.entities.MaterialExtend;
|
|
|
-import com.jsh.erp.datasource.entities.TaskStocktaking;
|
|
|
+import com.jsh.erp.datasource.entities.*;
|
|
|
import com.jsh.erp.datasource.mappers.MaterialExtendMapper;
|
|
|
+import com.jsh.erp.datasource.mappers.TaskStocktakingItemMapper;
|
|
|
import com.jsh.erp.datasource.mappers.TaskStocktakingMapper;
|
|
|
+import com.jsh.erp.datasource.mappers.UserMapper;
|
|
|
+import com.jsh.erp.datasource.vo.TaskStocktakingItemVO;
|
|
|
+import com.jsh.erp.datasource.vo.TaskStocktakingVO;
|
|
|
+import com.jsh.erp.query.LambdaQueryWrapperX;
|
|
|
+import com.jsh.erp.service.DepotService;
|
|
|
import com.jsh.erp.service.TaskStocktakingService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
@@ -26,6 +33,17 @@ public class TaskStocktakingServiceImpl extends ServiceImpl<TaskStocktakingMappe
|
|
|
|
|
|
private final MaterialExtendMapper materialExtendMapper;
|
|
|
|
|
|
+ private final UserMapper userMapper;
|
|
|
+
|
|
|
+ private final DepotService depotService;
|
|
|
+
|
|
|
+ private final TaskStocktakingItemMapper taskStocktakingItemMapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建盘点任务
|
|
|
+ * @param taskStocktakingDTO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@Override
|
|
|
public boolean add(TaskStocktakingDTO taskStocktakingDTO) {
|
|
|
//商品库位范围处理
|
|
@@ -37,9 +55,41 @@ public class TaskStocktakingServiceImpl extends ServiceImpl<TaskStocktakingMappe
|
|
|
}
|
|
|
String positionRange = extractRangePair(collect);
|
|
|
this.save(taskStocktakingDTO);
|
|
|
-
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
- return false;
|
|
|
+ /**
|
|
|
+ * 任务-详情
|
|
|
+ * @param id 任务ID
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public TaskStocktakingVO detail(Long id) throws Exception{
|
|
|
+ TaskStocktaking one = getOne(new LambdaQueryWrapperX<TaskStocktaking>().eq(TaskStocktaking::getId, id));
|
|
|
+ TaskStocktakingVO taskStocktakingVO = new TaskStocktakingVO();
|
|
|
+ BeanUtils.copyProperties(one, taskStocktakingVO);
|
|
|
+ //获取负责人名称
|
|
|
+ User user = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getId, one.getCreator()));
|
|
|
+ taskStocktakingVO.setCreatorName(user.getLoginName());
|
|
|
+ //获取创建人名称
|
|
|
+ User user1 = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getId, one.getCreateBy()));
|
|
|
+ taskStocktakingVO.setCreateByName(user1.getLoginName());
|
|
|
+ //获取仓库名称
|
|
|
+ Depot depot = depotService.getDepot(one.getDepotId());
|
|
|
+ taskStocktakingVO.setDepotName(depot.getName());
|
|
|
+ //当任务类型是抽盘时,返回商品盘点信息
|
|
|
+ return taskStocktakingVO;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 任务详情-商品明细
|
|
|
+ * @param taskStocktakingId 盘点任务ID
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<TaskStocktakingItemVO> listByTaskStocktakingId(Long taskStocktakingId) {
|
|
|
+ return taskStocktakingItemMapper.listByTaskStocktakingId(taskStocktakingId);
|
|
|
}
|
|
|
|
|
|
/**
|