Browse Source

1.按库位盘点接口完成

2.盘点任务公用 批量上架  批量盘点  批量上架
training
zhenghaoyu 1 year ago
parent
commit
b5f08648c0
  1. 7
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/QuestDetailEntity.java
  2. 23
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/TaskStripApiVO.java
  3. 297
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseTaskApiController.java
  4. 16
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/QuestDetailDTO.java
  5. 24
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/TaskSearchDTO.java
  6. 7
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.java
  7. 100
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.xml
  8. 1
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IQuestDetailService.java
  9. 18
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/ITaskQuestService.java
  10. 9
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/QuestDetailServiceImpl.java
  11. 325
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java

7
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/QuestDetailEntity.java

@ -148,11 +148,16 @@ public class QuestDetailEntity extends TenantEntity {
@ApiModelProperty(value = "货位id")
private Long allocationId;
/**
* 是否是新增数据
*/
@ApiModelProperty(value = "是否是新增数据")
private Integer isNew;
/**
* 货位
*/
@ApiModelProperty(value = "上架后的完整库位")
private String groundingPositionCode;
}

23
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/TaskStripApiVO.java

@ -31,6 +31,12 @@ import lombok.Data;
public class TaskStripApiVO {
private static final long serialVersionUID = 1L;
/**
* 明细详情id
*/
@ApiModelProperty(value = "明细详情id")
private Long questDetailId;
/**
* 包条id
*/
@ -61,5 +67,22 @@ public class TaskStripApiVO {
@ApiModelProperty(value = "状态")
private String state;
/**
* 货物类型 1订制品 2零担 3库存品
*/
private Integer goodsType;
/**
* 数量
*/
private Integer num;
private String materialCode;
private String materialName;
private String waybillNo;
private Integer isNew;
}

297
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseTaskApiController.java

@ -3,21 +3,26 @@ package com.logpm.warehouse.api;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.warehouse.dto.QuestDetailDTO;
import com.logpm.warehouse.dto.TaskSearchDTO;
import com.logpm.warehouse.entity.QuestDetailEntity;
import com.logpm.warehouse.service.ITaskQuestService;
import com.logpm.warehouse.vo.*;
import com.logpm.warehouse.wrapper.TaskQuestVOWrapper;
import com.logpm.warehouse.vo.TaskContractVO;
import com.logpm.warehouse.vo.TaskQuestApiVO;
import com.logpm.warehouse.vo.TaskallocationVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Optional;
import java.util.*;
@Log4j2
@ -28,6 +33,7 @@ import java.util.Optional;
public class WarehouseTaskApiController {
private final ITaskQuestService taskQuestService;
private final IBasicdataWarehouseClient warehouseClient;
/**
* 盘点任务列表
@ -87,11 +93,286 @@ public class WarehouseTaskApiController {
/**
* 库位明细(定制品)
*/
@GetMapping("/allocationDetailByStrip")
@GetMapping("/allocationDetailByPackage")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "库位明细(定制品)", notes = "code,type")
public R<IPage<TaskStripApiVO>> allocationDetailByStrip(TaskSearchDTO taskSearchDTO, Query query) {
IPage<TaskStripApiVO> taskStripApiVOList = taskQuestService.selectallocationDetailByStrip(Condition.getPage(query), taskSearchDTO);
return R.data(taskStripApiVOList);
public R allocationDetailByPackage(TaskSearchDTO taskSearchDTO) {
String method = "###########allocationDetailByPackage: ";
log.info(method+"库位明细(定制品) 参数:{}",taskSearchDTO);
Long questId = taskSearchDTO.getQuestId();//任务id
Long allocationId = taskSearchDTO.getAllocationId();//库位id
try{
//当前登录人选择的仓库
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse);
return R.fail(403,"仓库信息为空");
}
taskSearchDTO.setWarehouseId(myCurrentWarehouse.getId());
if(Objects.isNull(questId)){
log.warn(method+"任务id为空 questId={}",questId);
return R.fail(403,"任务id为空");
}
if(Objects.isNull(allocationId)){
log.warn(method+"库位id为空 allocationId={}",allocationId);
return R.fail(403,"库位id为空");
}
List<QuestDetailEntity> list = taskQuestService.allocationDetailByPackage(taskSearchDTO);
String allocationCode = "";
Integer allNUm = 0;
Integer finishNUm = 0;
for (QuestDetailEntity entity:list){
Integer stockNum = entity.getStockNum();
Integer questStatus = entity.getQuestStatus();
String positionCode = entity.getPositionCode();
allNUm = allNUm + stockNum;
allocationCode = positionCode;
if(questStatus == 1){
finishNUm = finishNUm + stockNum;
}
}
Map<String,Object> map = new HashMap<>();
map.put("allocationCode",allocationCode);
map.put("allNUm",allNUm);
map.put("finishNUm",finishNUm);
map.put("list",list);
return R.data(map);
}catch (CustomerException e){
log.warn(e.message);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error(method+"系统异常,联系管理员",e);
return R.fail(500,"系统异常,联系管理员");
}
}
/**
* 库位明细(零担)
*/
@GetMapping("/allocationDetailByZero")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "库位明细(零担)", notes = "code,type")
public R allocationDetailByZero(TaskSearchDTO taskSearchDTO) {
String method = "###########allocationDetailByZero: ";
log.info(method+"库位明细(零担) 参数:{}",taskSearchDTO);
Long questId = taskSearchDTO.getQuestId();//任务id
Long allocationId = taskSearchDTO.getAllocationId();//库位id
try{
//当前登录人选择的仓库
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse);
return R.fail(403,"仓库信息为空");
}
taskSearchDTO.setWarehouseId(myCurrentWarehouse.getId());
if(Objects.isNull(questId)){
log.warn(method+"任务id为空 questId={}",questId);
return R.fail(403,"任务id为空");
}
if(Objects.isNull(allocationId)){
log.warn(method+"库位id为空 allocationId={}",allocationId);
return R.fail(403,"库位id为空");
}
List<QuestDetailEntity> list = taskQuestService.allocationDetailByZero(taskSearchDTO);
String allocationCode = "";
Integer allNUm = 0;
Integer finishNUm = 0;
for (QuestDetailEntity entity:list){
Integer stockNum = entity.getStockNum();
Integer questStatus = entity.getQuestStatus();
String positionCode = entity.getPositionCode();
allNUm = allNUm + stockNum;
allocationCode = positionCode;
if(questStatus == 1){
finishNUm = finishNUm + stockNum;
}
}
Map<String,Object> map = new HashMap<>();
map.put("allocationCode",allocationCode);
map.put("allNUm",allNUm);
map.put("finishNUm",finishNUm);
map.put("list",list);
return R.data(map);
}catch (CustomerException e){
log.warn(e.message);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error(method+"系统异常,联系管理员",e);
return R.fail(500,"系统异常,联系管理员");
}
}
/**
* 库位明细(库存品)
*/
@GetMapping("/allocationDetailByStock")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "库位明细(库存品)", notes = "code,type")
public R allocationDetailByStock(TaskSearchDTO taskSearchDTO) {
String method = "###########allocationDetailByStock: ";
log.info(method+"库位明细(库存品) 参数:{}",taskSearchDTO);
Long questId = taskSearchDTO.getQuestId();//任务id
Long allocationId = taskSearchDTO.getAllocationId();//库位id
try{
//当前登录人选择的仓库
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse);
return R.fail(403,"仓库信息为空");
}
taskSearchDTO.setWarehouseId(myCurrentWarehouse.getId());
if(Objects.isNull(questId)){
log.warn(method+"任务id为空 questId={}",questId);
return R.fail(403,"任务id为空");
}
if(Objects.isNull(allocationId)){
log.warn(method+"库位id为空 allocationId={}",allocationId);
return R.fail(403,"库位id为空");
}
List<QuestDetailEntity> list = taskQuestService.allocationDetailByStock(taskSearchDTO);
String allocationCode = "";
Integer allNUm = 0;
Integer finishNUm = 0;
for (QuestDetailEntity entity:list){
Integer stockNum = entity.getStockNum();
Integer questStatus = entity.getQuestStatus();
String positionCode = entity.getPositionCode();
allNUm = allNUm + stockNum;
allocationCode = positionCode;
if(questStatus == 1){
finishNUm = finishNUm + stockNum;
}
}
Map<String,Object> map = new HashMap<>();
map.put("allocationCode",allocationCode);
map.put("allNUm",allNUm);
map.put("finishNUm",finishNUm);
map.put("list",list);
return R.data(map);
}catch (CustomerException e){
log.warn(e.message);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error(method+"系统异常,联系管理员",e);
return R.fail(500,"系统异常,联系管理员");
}
}
@PostMapping("/updateQuestDetail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "更新盘点数据(处理)", notes = "code,type")
public R updateQuestDetail(@RequestBody TaskSearchDTO taskSearchDTO) {
String method = "###########updateQuestDetail: ";
log.info(method+"更新盘点数据(处理) 参数:{}",taskSearchDTO);
List<QuestDetailDTO> questDetailList = taskSearchDTO.getQuestDetailList();
try{
//当前登录人选择的仓库
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse);
return R.fail(403,"仓库信息为空");
}
taskSearchDTO.setWarehouseId(myCurrentWarehouse.getId());
int size = questDetailList.size();
if(size == 0){
log.warn(method+"请选择正确的数量 questDetailList={}",questDetailList);
return R.fail(403,"请选择正确的数量");
}
taskQuestService.updateQuestSetail(taskSearchDTO);
return R.success("更新成功");
}catch (CustomerException e){
log.warn(e.message);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error(method+"系统异常,联系管理员",e);
return R.fail(500,"系统异常,联系管理员");
}
}
@PostMapping("/updateQuestDetailAllocation")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "更新盘点数据(库位)", notes = "code,type")
public R updateQuestDetailAllocation(@RequestBody TaskSearchDTO taskSearchDTO) {
String method = "###########updateQuestDetailAllocation: ";
log.info(method+"更新盘点数据(库位) 参数:{}",taskSearchDTO);
List<QuestDetailDTO> questDetailList = taskSearchDTO.getQuestDetailList();
try{
//当前登录人选择的仓库
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse);
return R.fail(403,"仓库信息为空");
}
taskSearchDTO.setWarehouseId(myCurrentWarehouse.getId());
int size = questDetailList.size();
if(size == 0){
log.warn(method+"请选择正确的数量 questDetailList={}",questDetailList);
return R.fail(403,"请选择正确的数量");
}
taskQuestService.updateQuestDetailAllocation(taskSearchDTO);
return R.success("更新成功");
}catch (CustomerException e){
log.warn(e.message);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error(method+"系统异常,联系管理员",e);
return R.fail(500,"系统异常,联系管理员");
}
}
@PostMapping("/deleteQuestDetail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "排除盘点数据", notes = "code,type")
public R deleteQuestDetail(@RequestBody TaskSearchDTO taskSearchDTO) {
String method = "###########deleteQuestDetail: ";
log.info(method+"更新盘点数据 参数:{}",taskSearchDTO);
List<QuestDetailDTO> questDetailList = taskSearchDTO.getQuestDetailList();
try{
//当前登录人选择的仓库
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse);
return R.fail(403,"仓库信息为空");
}
taskSearchDTO.setWarehouseId(myCurrentWarehouse.getId());
int size = questDetailList.size();
if(size == 0){
log.warn(method+"请选择正确的数量 questDetailList={}",questDetailList);
return R.fail(403,"请选择正确的数量");
}
taskQuestService.deleteQuestDetail(taskSearchDTO);
return R.success("更新成功");
}catch (CustomerException e){
log.warn(e.message);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error(method+"系统异常,联系管理员",e);
return R.fail(500,"系统异常,联系管理员");
}
}
}

16
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/QuestDetailDTO.java

@ -31,4 +31,20 @@ import lombok.EqualsAndHashCode;
public class QuestDetailDTO extends QuestDetailEntity {
private static final long serialVersionUID = 1L;
private Integer stockNum;//在库数量
private Integer lossNum;//丢失数量
private Integer deliveNum;//配送数量
private Integer wornNum;//破损数量
private Integer noRepairNum;//不可修复数量
private Integer noReceivedNum;//未入库数量
private Long allocationId;//上架后的库位id
}

24
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/TaskSearchDTO.java

@ -20,6 +20,9 @@ package com.logpm.warehouse.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* 盘点任务 搜索
@ -31,8 +34,13 @@ import lombok.Data;
public class TaskSearchDTO {
private static final long serialVersionUID = 1L;
/**
* 搜索code
* 库位id
*/
@ApiModelProperty(value = "库位id")
private Long allocationId;
@ApiModelProperty(value = "任务id")
private Long questId;
@ApiModelProperty(value = "搜索code")
private String trayCode;
@ -47,4 +55,18 @@ public class TaskSearchDTO {
*/
@ApiModelProperty(value = "盘点任务Id")
private Long taskId;
/**
* 商场名称
*/
private List<String> marketNames;
/**
* 当前仓库id
*/
private Long warehouseId;
private List<QuestDetailDTO> questDetailList = new ArrayList<>();
}

7
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.java

@ -20,6 +20,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.warehouse.dto.TaskSearchDTO;
import com.logpm.warehouse.entity.QuestDetailEntity;
import com.logpm.warehouse.entity.WarehouseUpdownGoodsEntity;
import com.logpm.warehouse.excel.WarehouseUpdownGoodsExcel;
import com.logpm.warehouse.vo.*;
@ -96,7 +97,11 @@ public interface WarehouseUpdownGoodsMapper extends BaseMapper<WarehouseUpdownGo
Integer selectCountSumByallocation(@Param("id") Long allocationId);
List<TaskStripApiVO> selectListByTaskStrip(IPage<TaskStripApiVO> page,@Param("param") TaskSearchDTO taskSearchDTO);
List<QuestDetailEntity> allocationDetailByPackage(@Param("param") TaskSearchDTO taskSearchDTO);
List<QuestDetailEntity> allocationDetailByZero(@Param("param") TaskSearchDTO taskSearchDTO);
List<QuestDetailEntity> allocationDetailByStock(@Param("param") TaskSearchDTO taskSearchDTO);
// /**

100
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.xml

@ -297,17 +297,99 @@
<select id="selectCountSumByallocation" resultType="java.lang.Integer">
select COALESCE (sum(lwug.num),0) from logpm_warehouse_updown_goods lwug where lwug.is_deleted =0 and lwug.allocation_id =#{id}
</select>
<select id="selectListByTaskStrip" resultType="com.logpm.warehouse.vo.TaskStripApiVO">
<select id="allocationDetailByPackage" resultType="com.logpm.warehouse.vo.TaskStripApiVO">
select ldpl.order_code orderCode,
ldpl.stock_article_id orderId,
2 questType,
1 questTarget,
ldpl.order_package_code orderPackageCode,
ldpl.id orderPackageId,
0 questStatus,
ldpl.quantity stockNum,
ldpl.warehouse_id warehouseId,
lwug.position_code positionCode,
lwta.tray_id trayId,
lwt.tray_code trayCode,
lwug.allocation_id allocationId,
0 isNew
from logpm_warehouse_updown_goods lwug
left join logpm_warehouse_tary_allocation lwta on lwta.allocation_id = lwug.allocation_id and lwta.is_deleted = 0
left join logpm_warehouse_tray lwt on lwta.tray_id = lwt.id and lwt.is_deleted = 0
left join logpm_distribution_parcel_list ldpl on ldpl.order_package_code = lwug.association_value and ldpl.is_deleted = 0
left join logpm_distribution_stock_article ldsa on ldsa.id = ldpl.stock_article_id and ldsa.is_deleted = 0
where lwug.association_type = 3
and lwug.allocation_id = #{param.allocationId}
and lwug.warehouse_id = #{param.warehouseId}
and ldpl.warehouse_id = #{param.warehouseId}
<if test="param.marketNames != null">
and ldsa.dealer_name in
<foreach collection="param.marketNames" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="allocationDetailByZero" resultType="com.logpm.warehouse.vo.TaskStripApiVO">
select ldsa.order_code orderCode,
ldsa.id orderId,
2 questType,
1 questTarget,
0 questStatus,
lwug.num stockNum,
ldsa.warehouse_id warehouseId,
lwug.position_code positionCode,
lwta.tray_id trayId,
lwt.tray_code trayCode,
lwug.allocation_id allocationId,
0 isNew
from logpm_warehouse_updown_goods lwug
left join logpm_warehouse_tary_allocation lwta on lwta.allocation_id = lwug.allocation_id and lwta.is_deleted = 0
left join logpm_warehouse_tray lwt on lwta.tray_id = lwt.id and lwt.is_deleted = 0
left join logpm_distribution_stock_article ldsa on ldsa.id = lwug.association_id and ldsa.is_deleted = 0
where lwug.association_type = 1
and lwug.allocation_id = #{param.allocationId}
and lwug.warehouse_id = #{param.warehouseId}
and ldsa.warehouse_id = #{param.warehouseId}
<if test="param.marketNames != null">
and ldsa.dealer_name in
<foreach collection="param.marketNames" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="allocationDetailByStock" resultType="com.logpm.warehouse.vo.TaskStripApiVO">
SELECT
ldpl.id orderPackageId,
ldpl.order_package_code orderPackageCode,
ldpl.order_code orderCode,
lwug.position_code positionCode
ldsl.order_code orderCode,
ldsl.id stockId,
2 questType,
1 questTarget,
0 questStatus,
lwug.num stockNum,
ldsl.warehouse_id warehouseId,
lwug.position_code positionCode,
lwta.tray_id trayId,
lwt.tray_code trayCode,
lwug.allocation_id allocationId,
0 isNew
FROM
logpm_distribution_parcel_list ldpl
JOIN logpm_warehouse_updown_goods lwug ON ldpl.id = lwug.association_id
AND ldpl.conditions = 1
AND lwug.association_type =3 and lwug.allocation_id = #{param.code}
logpm_warehouse_updown_goods lwug
LEFT JOIN logpm_warehouse_tary_allocation lwta ON lwta.allocation_id = lwug.allocation_id
AND lwta.is_deleted = 0
LEFT JOIN logpm_warehouse_tray lwt ON lwta.tray_id = lwt.id
AND lwt.is_deleted = 0
LEFT JOIN logpm_distribution_stock_list ldsl on ldsl.cargo_number = lwug.association_value and ldsl.incoming_batch = lwug.incoming_batch and ldsl.market_id = lwug.market_id and ldsl.is_deleted = 0
where lwug.association_type = 4
and lwug.allocation_id = #{param.allocationId}
and lwug.warehouse_id = #{param.warehouseId}
and ldsl.warehouse_id = #{param.warehouseId}
<if test="param.marketNames != null">
and ldsl.market_name in
<foreach collection="param.marketNames" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper>

1
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IQuestDetailService.java

@ -49,4 +49,5 @@ public interface IQuestDetailService extends BaseService<QuestDetailEntity> {
*/
List<QuestDetailExcel> exportQuestDetail(Wrapper<QuestDetailEntity> queryWrapper);
void saveList(List<QuestDetailEntity> list, Long questId);
}

18
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/ITaskQuestService.java

@ -17,12 +17,13 @@
package com.logpm.warehouse.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.warehouse.dto.TaskQuestDTO;
import com.logpm.warehouse.dto.TaskSearchDTO;
import com.logpm.warehouse.entity.QuestDetailEntity;
import com.logpm.warehouse.entity.TaskQuestEntity;
import com.logpm.warehouse.vo.*;
import com.logpm.warehouse.excel.TaskQuestExcel;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.warehouse.vo.*;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R;
@ -75,5 +76,16 @@ public interface ITaskQuestService extends BaseService<TaskQuestEntity> {
*/
R selecttrayList(IPage<TaskTrayVO> page, TaskSearchDTO taskSearchDTO);
IPage<TaskStripApiVO> selectallocationDetailByStrip(IPage<TaskStripApiVO> page, TaskSearchDTO taskSearchDTO);
List<QuestDetailEntity> allocationDetailByPackage(TaskSearchDTO taskSearchDTO);
List<QuestDetailEntity> allocationDetailByZero(TaskSearchDTO taskSearchDTO);
List<QuestDetailEntity> allocationDetailByStock(TaskSearchDTO taskSearchDTO);
void updateQuestSetail(TaskSearchDTO taskSearchDTO);
void updateQuestDetailAllocation(TaskSearchDTO taskSearchDTO);
void deleteQuestDetail(TaskSearchDTO taskSearchDTO);
}

9
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/QuestDetailServiceImpl.java

@ -51,4 +51,13 @@ public class QuestDetailServiceImpl extends BaseServiceImpl<QuestDetailMapper, Q
return questDetailList;
}
@Override
public void saveList(List<QuestDetailEntity> list, Long questId) {
for (QuestDetailEntity entity:list){
entity.setQuestId(questId);
}
saveBatch(list);
}
}

325
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java

@ -16,45 +16,42 @@
*/
package com.logpm.warehouse.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.basicdata.entity.BasicdataTrayEntity;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataTrayClient;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.basicdata.vo.BasicdataClientVO;
import com.logpm.basicdata.entity.*;
import com.logpm.basicdata.feign.*;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.entity.DistributionStockListEntity;
import com.logpm.distribution.feign.IDistributionParcelListClient;
import com.logpm.distribution.feign.IDistributionStockArticleClient;
import com.logpm.distribution.feign.IDistributionStockClient;
import com.logpm.distribution.feign.IDistributionStockListClient;
import com.logpm.distribution.vo.DistributionStockListVO;
import com.logpm.oldproject.feign.IWarehouseClient;
import com.logpm.warehouse.bean.Resp;
import com.logpm.warehouse.dto.QuestDetailDTO;
import com.logpm.warehouse.dto.TaskQuestDTO;
import com.logpm.warehouse.dto.TaskSearchDTO;
import com.logpm.warehouse.entity.*;
import com.logpm.warehouse.mapper.QuestDetailMapper;
import com.logpm.warehouse.excel.TaskQuestExcel;
import com.logpm.warehouse.mapper.TaskQuestMapper;
import com.logpm.warehouse.mapper.WarehouseTrayGoodsMapper;
import com.logpm.warehouse.mapper.WarehouseUpdownGoodsMapper;
import com.logpm.warehouse.service.IQuestDetailChildService;
import com.logpm.warehouse.service.IQuestDetailService;
import com.logpm.warehouse.service.ITaskQuestChildService;
import com.logpm.warehouse.vo.*;
import com.logpm.warehouse.excel.TaskQuestExcel;
import com.logpm.warehouse.mapper.TaskQuestMapper;
import com.logpm.warehouse.service.ITaskQuestService;
import com.logpm.warehouse.vo.*;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.common.exception.CustomerException;
import org.springblade.common.utils.CommonUtil;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.w3c.dom.css.Rect;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
@ -87,6 +84,13 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
private final IDistributionParcelListClient distributionParcelListClient;
private final IQuestDetailChildService questDetailChildService;
private final IBasicdataGoodsAllocationClient basicdataGoodsAllocationClient;
private final IBasicdataGoodsShelfClient basicdataGoodsShelfClient;
private final IBasicdataGoodsAreaClient basicdataGoodsAreaClient;
@Override
public IPage<TaskQuestVO> selectTaskQuestPage(IPage<TaskQuestVO> page, TaskQuestVO taskQuest) {
@ -359,18 +363,299 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
@Override
public IPage<TaskStripApiVO> selectallocationDetailByStrip(IPage<TaskStripApiVO> page, TaskSearchDTO taskSearchDTO) {
public List<QuestDetailEntity> allocationDetailByPackage(TaskSearchDTO taskSearchDTO) {
Long allocationId = taskSearchDTO.getAllocationId();
Long warehouseId = taskSearchDTO.getWarehouseId();
Long questId = taskSearchDTO.getQuestId();
//先判定盘点任务是否已结束
verifyTask(questId,warehouseId);
//先查询任务的过滤商场
QueryWrapper<TaskQuestChildEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("quest_id",questId)
.eq("is_deleted",0);
List<TaskQuestChildEntity> questChildEntitys = taskQuestChildService.list(queryWrapper);
List<String> marketNames = null;
for (TaskQuestChildEntity childEntity:questChildEntitys) {
if(Objects.isNull(marketNames)){
marketNames = new ArrayList<>();
}
marketNames.add(childEntity.getRefName());
}
taskSearchDTO.setMarketNames(marketNames);
//判断是否有明细数据存入
QueryWrapper<QuestDetailEntity> questDetailEntityQueryWrapper = new QueryWrapper<>();
questDetailEntityQueryWrapper.eq("quest_id",questId)
.eq("quest_type",2)
.eq("quest_target",1)
.eq("warehouse_id",warehouseId)
.eq("allocation_id",allocationId)
.eq("is_deleted",0);
List<QuestDetailEntity> questDetailEntities = questDetailService.list(questDetailEntityQueryWrapper);
if(!questDetailEntities.isEmpty()){
return questDetailEntities;
}
//如果还没有存入
//查询货位上的所有包条
List<TaskStripApiVO> list = warehouseUpdownGoodsMapper.selectListByTaskStrip(page, taskSearchDTO);
for (TaskStripApiVO taskStripApiVO : list) {
//然后存入detail表
List<QuestDetailEntity> list = warehouseUpdownGoodsMapper.allocationDetailByPackage(taskSearchDTO);
if(list.isEmpty()){
log.warn("###########allocationDetailByPackage: 未有数据在盘点计划中 questId={}",questId);
throw new CustomerException(403,"未有数据在盘点计划中");
}
questDetailService.saveList(list,questId);
return list;
}
@Override
public List<QuestDetailEntity> allocationDetailByZero(TaskSearchDTO taskSearchDTO) {
Long questId = taskSearchDTO.getQuestId();
Long allocationId = taskSearchDTO.getAllocationId();
Long warehouseId = taskSearchDTO.getWarehouseId();
//先判定盘点任务是否已结束
verifyTask(questId,warehouseId);
//先查询任务的过滤商场
QueryWrapper<TaskQuestChildEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("quest_id",questId)
.eq("is_deleted",0);
List<TaskQuestChildEntity> questChildEntitys = taskQuestChildService.list(queryWrapper);
List<String> marketNames = null;
for (TaskQuestChildEntity childEntity:questChildEntitys) {
if(Objects.isNull(marketNames)){
marketNames = new ArrayList<>();
}
marketNames.add(childEntity.getRefName());
}
return page.setRecords(list);
taskSearchDTO.setMarketNames(marketNames);
//判断是否有明细数据存入
QueryWrapper<QuestDetailEntity> questDetailEntityQueryWrapper = new QueryWrapper<>();
questDetailEntityQueryWrapper.eq("quest_id",questId)
.eq("quest_type",2)
.eq("quest_target",2)
.eq("warehouse_id",warehouseId)
.eq("allocation_id",allocationId)
.eq("is_deleted",0);
List<QuestDetailEntity> questDetailEntities = questDetailService.list(questDetailEntityQueryWrapper);
if(!questDetailEntities.isEmpty()){
return questDetailEntities;
}
//如果还没有存入
//查询货位上的所有包条
//然后存入detail表
List<QuestDetailEntity> list = warehouseUpdownGoodsMapper.allocationDetailByZero(taskSearchDTO);
if(list.isEmpty()){
log.warn("###########allocationDetailByZero: 未有数据在盘点计划中 questId={}",questId);
throw new CustomerException(403,"未有数据在盘点计划中");
}
questDetailService.saveList(list,questId);
return list;
}
@Override
public List<QuestDetailEntity> allocationDetailByStock(TaskSearchDTO taskSearchDTO) {
Long questId = taskSearchDTO.getQuestId();
Long allocationId = taskSearchDTO.getAllocationId();
Long warehouseId = taskSearchDTO.getWarehouseId();
//先判定盘点任务是否已结束
verifyTask(questId,warehouseId);
//先查询任务的过滤商场
QueryWrapper<TaskQuestChildEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("quest_id",questId)
.eq("is_deleted",0);
List<TaskQuestChildEntity> questChildEntitys = taskQuestChildService.list(queryWrapper);
List<String> marketNames = null;
for (TaskQuestChildEntity childEntity:questChildEntitys) {
if(Objects.isNull(marketNames)){
marketNames = new ArrayList<>();
}
marketNames.add(childEntity.getRefName());
}
taskSearchDTO.setMarketNames(marketNames);
//判断是否有明细数据存入
QueryWrapper<QuestDetailEntity> questDetailEntityQueryWrapper = new QueryWrapper<>();
questDetailEntityQueryWrapper.eq("quest_id",questId)
.eq("quest_type",2)
.eq("quest_target",3)
.eq("warehouse_id",warehouseId)
.eq("allocation_id",allocationId)
.eq("is_deleted",0);
List<QuestDetailEntity> questDetailEntities = questDetailService.list(questDetailEntityQueryWrapper);
if(!questDetailEntities.isEmpty()){
return questDetailEntities;
}
//如果还没有存入
//查询货位上的所有包条
//然后存入detail表
List<QuestDetailEntity> list = warehouseUpdownGoodsMapper.allocationDetailByStock(taskSearchDTO);
if(list.isEmpty()){
log.warn("###########allocationDetailByStock: 未有数据在盘点计划中 questId={}",questId);
throw new CustomerException(403,"未有数据在盘点计划中");
}
questDetailService.saveList(list,questId);
return list;
}
@Transactional
@Override
public void updateQuestSetail(TaskSearchDTO taskSearchDTO) {
Long warehouseId = taskSearchDTO.getWarehouseId();
Long questId = taskSearchDTO.getQuestId();
//先判定盘点任务是否已结束
verifyTask(questId,warehouseId);
List<QuestDetailDTO> questDetailList = taskSearchDTO.getQuestDetailList();
for (QuestDetailDTO questDetailDTO:questDetailList){
Long questDetaiId = questDetailDTO.getId();//明细id
QuestDetailEntity detailEntity = questDetailService.getById(questDetaiId);
if(Objects.isNull(detailEntity)){
log.warn("###########updateQuestSetail: 存在不在盘点计划中的数据 questDetaiId={}",questDetaiId);
throw new CustomerException(403,"存在不在盘点计划中的数据");
}
Integer stockNum = questDetailDTO.getStockNum();
Integer lossNum = questDetailDTO.getLossNum();
Integer deliveNum = questDetailDTO.getDeliveNum();
Integer wornNum = questDetailDTO.getWornNum();
Integer noReceivedNum = questDetailDTO.getNoReceivedNum();
Integer noRepairNum = questDetailDTO.getNoRepairNum();
List<QuestDetailChildEntity> childList = new ArrayList<>();
childList.add(addQuestDetailChild(stockNum,"10",questDetaiId,warehouseId));
childList.add(addQuestDetailChild(wornNum,"20",questDetaiId,warehouseId));
childList.add(addQuestDetailChild(lossNum,"30",questDetaiId,warehouseId));
childList.add(addQuestDetailChild(noRepairNum,"40",questDetaiId,warehouseId));
childList.add(addQuestDetailChild(deliveNum,"50",questDetaiId,warehouseId));
childList.add(addQuestDetailChild(noReceivedNum,"60",questDetaiId,warehouseId));
questDetailChildService.saveBatch(childList);
detailEntity.setQuestStatus(1);
questDetailService.updateById(detailEntity);
}
}
@Transactional
@Override
public void updateQuestDetailAllocation(TaskSearchDTO taskSearchDTO) {
Long warehouseId = taskSearchDTO.getWarehouseId();
Long allocationId = taskSearchDTO.getAllocationId();
Long questId = taskSearchDTO.getQuestId();
//先判定盘点任务是否已结束
verifyTask(questId,warehouseId);
BasicdataGoodsAllocationEntity goodsAllocationEntity = basicdataGoodsAllocationClient.getEntityByAllocationId(allocationId);
if(Objects.isNull(goodsAllocationEntity)){
log.warn("###########updateQuestDetailAllocation: 库位信息不存在 allocationId={}",allocationId);
throw new CustomerException(403,"库位信息不存在");
}
Long wid = goodsAllocationEntity.getWarehouseId();
if(!wid.equals(warehouseId)){
log.warn("###########updateQuestDetailAllocation: 库位不在当前仓 allocationId={}",allocationId);
throw new CustomerException(403,"库位不在当前仓");
}
Long goodsShelfId = goodsAllocationEntity.getGoodsShelfId();
BasicdataGoodsShelfEntity basicdataGoodsShelfEntity = basicdataGoodsShelfClient.getEntityByGoodsShelfId(goodsShelfId);
if(Objects.isNull(basicdataGoodsShelfEntity)){
log.warn("###########updateQuestDetailAllocation: 货架信息不存在 goodsShelfId={}",goodsShelfId);
throw new CustomerException(403,"货架信息不存在");
}
Long goodsAreaId = basicdataGoodsShelfEntity.getGoodsAreaId();
BasicdataGoodsAreaEntity goodsAreaEntity = basicdataGoodsAreaClient.getEntityByGoodsAreaId(goodsAreaId);
if(Objects.isNull(goodsAreaEntity)){
log.warn("###########updateQuestDetailAllocation: 货区信息不存在 goodsAreaId={}",goodsAreaId);
throw new CustomerException(403,"货区信息不存在");
}
List<QuestDetailDTO> questDetailList = taskSearchDTO.getQuestDetailList();
List<QuestDetailEntity> ls = new ArrayList<>();
for (QuestDetailDTO questDetailDTO:questDetailList){
Long questDetaiId = questDetailDTO.getId();//明细id
QuestDetailEntity detailEntity = questDetailService.getById(questDetaiId);
if(Objects.isNull(detailEntity)){
log.warn("###########updateQuestSetail: 存在不在盘点计划中的数据 questDetaiId={}",questDetaiId);
throw new CustomerException(403,"存在不在盘点计划中的数据");
}
detailEntity.setGroundingAllocationId(allocationId);
detailEntity.setGroundingPositionCode(goodsAreaEntity.getHeadline()+"-"+basicdataGoodsShelfEntity.getGoodsShelfName()+"-"+goodsAllocationEntity.getGoodsAllocationName());
ls.add(detailEntity);
}
questDetailService.updateBatchById(ls);
}
@Transactional
@Override
public void deleteQuestDetail(TaskSearchDTO taskSearchDTO) {
Long warehouseId = taskSearchDTO.getWarehouseId();
Long questId = taskSearchDTO.getQuestId();
//先判定盘点任务是否已结束
verifyTask(questId,warehouseId);
List<QuestDetailDTO> questDetailList = taskSearchDTO.getQuestDetailList();
List<QuestDetailEntity> ls = new ArrayList<>();
for (QuestDetailDTO questDetailDTO:questDetailList){
Long questDetaiId = questDetailDTO.getId();//明细id
QuestDetailEntity detailEntity = questDetailService.getById(questDetaiId);
if(Objects.isNull(detailEntity)){
log.warn("###########deleteQuestDetail: 存在不在盘点计划中的数据 questDetaiId={}",questDetaiId);
throw new CustomerException(403,"存在不在盘点计划中的数据");
}
detailEntity.setQuestStatus(3);
ls.add(detailEntity);
}
questDetailService.updateBatchById(ls);
}
private QuestDetailChildEntity addQuestDetailChild(Integer num,String cargoName,Long questDetaiId,Long warehouseId){
QuestDetailChildEntity questDetailChildEntity = new QuestDetailChildEntity();
questDetailChildEntity.setQuestDetailId(questDetaiId);
questDetailChildEntity.setCargoName(cargoName);
questDetailChildEntity.setQuestNum(num);
questDetailChildEntity.setWarehouseId(warehouseId);
return questDetailChildEntity;
}
private String getQuestNum(String warehouseCode) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
return "PDRW-" + warehouseCode + "-" + simpleDateFormat.format(new Date()) + new Random().nextInt(900) + 100;
}
private void verifyTask(Long taskId,Long warehouseId){
TaskQuestEntity questEntity = getById(taskId);
if(Objects.isNull(questEntity)){
log.warn("###########verifyTask: 盘点任务不存在 taskId={}",taskId);
throw new CustomerException(403,"盘点任务不存在");
}
Long wid = questEntity.getWarehouseId();
if(!wid.equals(warehouseId)){
log.warn("###########verifyTask: 盘点任务不属于当前仓 taskId={}",taskId);
throw new CustomerException(403,"盘点任务不属于当前仓");
}
Long now = new Date().getTime();
String endTime = questEntity.getEndTime();
Long end = CommonUtil.StringToDate(endTime).getTime();
if(now > end){
log.warn("###########verifyTask: 盘点任务已结束 taskId={}",taskId);
throw new CustomerException(403,"盘点任务已结束");
}
}
}

Loading…
Cancel
Save