出库相关接口

This commit is contained in:
李广豪 2021-12-17 11:12:59 +08:00
parent 8e49c0be65
commit fd11d890ec
7 changed files with 251 additions and 0 deletions

View File

@ -0,0 +1,47 @@
package com.mt.wms.empty.controller;
import com.mt.wms.core.base.BaseController;
import com.mt.wms.core.constants.CommonConstant;
import com.mt.wms.core.params.IdParam;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.StockInfoQueryParam;
import com.mt.wms.empty.service.StockInfoService;
import com.mt.wms.empty.vo.CurrTaskDetVo;
import com.mt.wms.empty.vo.StockInfoVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.groups.Default;
import java.util.List;
/**
* @Author: liguanghao
* @Date: 2021/12/17 8:48
* @Version 1.0
*/
@RestController
@RequestMapping(CommonConstant.API_MODULE_BASE + "outStock")
@Slf4j
@Api(value = "出库相关接口", tags = "出库相关接口", hidden = false)
public class OutStockController extends BaseController {
@Autowired
private StockInfoService stockInfoService;
@PostMapping(value = "get")
@ApiOperation(value = "获取库位详细信息")
private R<List<CurrTaskDetVo>> get(@Validated @RequestBody IdParam idParam) {
return stockInfoService.get(idParam);
}
@PostMapping(value = "list")
@ApiOperation(value = "获取库位信息列表")
private R<List<StockInfoVo>> list() {
return stockInfoService.list();
}
}

View File

@ -0,0 +1,24 @@
package com.mt.wms.empty.params;
import com.mt.wms.core.params.BasePageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Author: liguanghao
* @Date: 2021/12/17 9:05
* @Version 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "库位信息查询参数", description = "库位信息查询参数")
public class StockInfoQueryParam extends BasePageParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "库位", required = false)
private Long id;
}

View File

@ -0,0 +1,9 @@
package com.mt.wms.empty.service;
/**
* @Author: liguanghao
* @Date: 2021/12/17 8:53
* @Version 1.0
*/
public interface OutStockService {
}

View File

@ -0,0 +1,32 @@
package com.mt.wms.empty.service;
import com.mt.wms.core.dal.entity.CurrTaskDet;
import com.mt.wms.core.params.IdParam;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.StockInfoQueryParam;
import com.mt.wms.empty.vo.CurrTaskDetVo;
import com.mt.wms.empty.vo.StockInfoVo;
import java.util.List;
/**
* @Author: liguanghao
* @Date: 2021/12/17 9:12
* @Version 1.0
*/
public interface StockInfoService {
/**
* 获取xx
*
* @param idParam 主键参数
* @return xx
*/
R<List<CurrTaskDetVo>> get(IdParam idParam);
/**
* 获取xx列表
*
* @return xx列表
*/
R<List<StockInfoVo>> list();
}

View File

@ -0,0 +1,15 @@
package com.mt.wms.empty.service.impl;
import com.mt.wms.core.base.BaseService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* @Author: liguanghao
* @Date: 2021/12/17 8:52
* @Version 1.0
*/
@Service
@Transactional
public class OutStockServiceImpl extends BaseService {
}

View File

@ -0,0 +1,68 @@
package com.mt.wms.empty.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mt.wms.core.base.BaseService;
import com.mt.wms.core.dal.entity.CurrTaskDet;
import com.mt.wms.core.dal.entity.InStockInfo;
import com.mt.wms.core.dal.entity.Location;
import com.mt.wms.core.dal.service.CurrTaskDetServiceBiz;
import com.mt.wms.core.dal.service.InStockInfoServiceBiz;
import com.mt.wms.core.dal.service.LocationServiceBiz;
import com.mt.wms.core.params.IdParam;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.StockInfoQueryParam;
import com.mt.wms.empty.service.StockInfoService;
import com.mt.wms.empty.vo.CurrTaskDetVo;
import com.mt.wms.empty.vo.StockInfoVo;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* @Author: liguanghao
* @Date: 2021/12/17 10:24
* @Version 1.0
*/
@Service
@Transactional
public class StockInfoServiceImpl extends BaseService implements StockInfoService {
@Resource
private InStockInfoServiceBiz inStockInfoServiceBiz;
@Resource
private LocationServiceBiz locationServiceBiz;
@Resource
private CurrTaskDetServiceBiz currTaskDetServiceBiz;
@Override
public R<List<CurrTaskDetVo>> get(IdParam idParam) {
Long taskId = inStockInfoServiceBiz.getById(idParam).getTaskId();
List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq("curr_task_id", taskId));
List<CurrTaskDetVo> currTaskDetVoList = com.mt.wms.core.utils.BeanUtils.copyList(currTaskDetList, CurrTaskDetVo.class);
return successful(currTaskDetVoList);
}
@Override
public R<List<StockInfoVo>> list() {
//获取全部库位
List<Location> locationList = locationServiceBiz.list();
List<StockInfoVo> stockInfoVoList=new ArrayList<>();
for (Location location:locationList
) {
StockInfoVo stockInfoVo=StockInfoVo.builder().build();
//库位为空
if (location.getStatus()!=1){
stockInfoVo.setEmpty(1);
stockInfoVo.setLocaltionId(location.getId());
}else {
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>()
.eq("localtion_id", location.getId()));
BeanUtils.copyProperties(inStockInfo,stockInfoVo);
}
stockInfoVoList.add(stockInfoVo);
}
return successful(stockInfoVoList);
}
}

View File

@ -0,0 +1,56 @@
package com.mt.wms.empty.vo;
import com.mt.wms.core.base.BaseVo;
import com.mt.wms.core.vo.PageVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
/**
* @Author: liguanghao
* @Date: 2021/12/17 9:06
* @Version 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Builder
@ApiModel(value = "库位信息视图对象", description = "用于查询库位信息")
public class StockInfoVo extends BaseVo implements PageVo.ConvertVo{
/**
* 主键自增
*/
@ApiModelProperty(value = "主键", example = "1")
private Long id;
/**
* 货物类型
*/
@ApiModelProperty(value = "货物类型", example = "0")
private Integer type;
/**
* 库位id
*/
@ApiModelProperty(value = "库位id",example = "0")
private Long localtionId;
/**
* 库位名称
*/
@ApiModelProperty(value = "库位名称",example = "0")
private String localtionName;
/**
* 任务id
*/
@ApiModelProperty(value = "任务id",example = "0")
private Long taskId;
/**
* 是否为空
*/
@ApiModelProperty(value = "是否为空:0否1是",example = "0")
private Integer empty;
}