diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/OutStockController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/OutStockController.java new file mode 100644 index 0000000..ed2558e --- /dev/null +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/OutStockController.java @@ -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> get(@Validated @RequestBody IdParam idParam) { + return stockInfoService.get(idParam); + } + + @PostMapping(value = "list") + @ApiOperation(value = "获取库位信息列表") + private R> list() { + return stockInfoService.list(); + } +} diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/StockInfoQueryParam.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/StockInfoQueryParam.java new file mode 100644 index 0000000..4217efe --- /dev/null +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/StockInfoQueryParam.java @@ -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; +} diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/OutStockService.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/OutStockService.java new file mode 100644 index 0000000..2f09473 --- /dev/null +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/OutStockService.java @@ -0,0 +1,9 @@ +package com.mt.wms.empty.service; + +/** + * @Author: liguanghao + * @Date: 2021/12/17 8:53 + * @Version 1.0 + */ +public interface OutStockService { +} diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/StockInfoService.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/StockInfoService.java new file mode 100644 index 0000000..11127c7 --- /dev/null +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/StockInfoService.java @@ -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> get(IdParam idParam); + + /** + * 获取xx列表 + * + * @return xx列表 + */ + R> list(); +} diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OutStockServiceImpl.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OutStockServiceImpl.java new file mode 100644 index 0000000..1d180eb --- /dev/null +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OutStockServiceImpl.java @@ -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 { +} diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/StockInfoServiceImpl.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/StockInfoServiceImpl.java new file mode 100644 index 0000000..b1c3797 --- /dev/null +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/StockInfoServiceImpl.java @@ -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> get(IdParam idParam) { + Long taskId = inStockInfoServiceBiz.getById(idParam).getTaskId(); + List currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper().eq("curr_task_id", taskId)); + List currTaskDetVoList = com.mt.wms.core.utils.BeanUtils.copyList(currTaskDetList, CurrTaskDetVo.class); + return successful(currTaskDetVoList); + } + + @Override + public R> list() { + //获取全部库位 + List locationList = locationServiceBiz.list(); + List 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() + .eq("localtion_id", location.getId())); + BeanUtils.copyProperties(inStockInfo,stockInfoVo); + } + stockInfoVoList.add(stockInfoVo); + } + return successful(stockInfoVoList); + } +} diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/StockInfoVo.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/StockInfoVo.java new file mode 100644 index 0000000..c51829e --- /dev/null +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/StockInfoVo.java @@ -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; +}