出库相关接口

This commit is contained in:
李广豪 2021-12-17 14:40:43 +08:00
parent fd11d890ec
commit f3b97b9559
5 changed files with 113 additions and 1 deletions

View File

@ -3,8 +3,11 @@ 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.validator.groups.PageGroup;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.OutStockParam;
import com.mt.wms.empty.params.StockInfoQueryParam;
import com.mt.wms.empty.service.OutStockService;
import com.mt.wms.empty.service.StockInfoService;
import com.mt.wms.empty.vo.CurrTaskDetVo;
import com.mt.wms.empty.vo.StockInfoVo;
@ -33,6 +36,8 @@ import java.util.List;
public class OutStockController extends BaseController {
@Autowired
private StockInfoService stockInfoService;
@Autowired
private OutStockService outStockService;
@PostMapping(value = "get")
@ApiOperation(value = "获取库位详细信息")
private R<List<CurrTaskDetVo>> get(@Validated @RequestBody IdParam idParam) {
@ -44,4 +49,9 @@ public class OutStockController extends BaseController {
private R<List<StockInfoVo>> list() {
return stockInfoService.list();
}
@PostMapping(value = "runOutTask")
@ApiOperation(value = "执行出库操作")
private R<String> runOutTask(@Validated({PageGroup.class, Default.class}) @RequestBody OutStockParam outStockParam) {
return outStockService.outTask(outStockParam);
}
}

View File

@ -0,0 +1,38 @@
package com.mt.wms.empty.params;
import com.mt.wms.core.base.BaseParam;
import com.mt.wms.core.validator.groups.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
/**
* @Author: liguanghao
* @Date: 2021/12/17 11:29
* @Version 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "出库操作参数对象", description = "用于出库操作")
public class OutStockParam extends BaseParam {
private static final long serialVersionUID = 1L;
/**
* 库位id
*/
@ApiModelProperty(value = "库位id",required = true, example = "1")
@NotNull(message = "库位id不能为空", groups = {UpdateGroup.class})
private Long localtionId;
/**
* 提升台
*/
@ApiModelProperty(value = "提升台",required = true, example = "1")
@NotNull(message = "提升台不能为空")
private Integer code;
}

View File

@ -1,9 +1,19 @@
package com.mt.wms.empty.service;
import com.mt.wms.core.vo.PageVo;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.OutStockParam;
/**
* @Author: liguanghao
* @Date: 2021/12/17 8:53
* @Version 1.0
*/
public interface OutStockService {
/**
* 执行出库操作
*
* @param outStockParam xx查询参数
*/
R<String> outTask(OutStockParam outStockParam);
}

View File

@ -1,9 +1,23 @@
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.InStockInfo;
import com.mt.wms.core.dal.entity.VehicleInfo;
import com.mt.wms.core.dal.service.InStockInfoServiceBiz;
import com.mt.wms.core.dal.service.VehicleInfoServiceBiz;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.OutStockParam;
import com.mt.wms.empty.service.OutStockService;
import com.mt.wms.empty.task.AsynRunTaskService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.List;
/**
* @Author: liguanghao
* @Date: 2021/12/17 8:52
@ -11,5 +25,41 @@ import org.springframework.transaction.annotation.Transactional;
*/
@Service
@Transactional
public class OutStockServiceImpl extends BaseService {
public class OutStockServiceImpl extends BaseService implements OutStockService {
@Resource
private VehicleInfoServiceBiz vehicleInfoServiceBiz;
@Resource
private AsynRunTaskService asynRunTaskService;
@Resource
private InStockInfoServiceBiz inStockInfoServiceBiz;
@Override
public R<String> outTask(OutStockParam outStockParam) {
// TODO: 2021/12/17 出库
Long localtionId = outStockParam.getLocaltionId();
//提升台
Integer code = outStockParam.getCode();
//查询是否有空闲车辆若有占用车辆若无返回暂无可用车辆
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>()
.eq(VehicleInfo.STATUS, 0)
.eq(VehicleInfo.VALID, 1));
if (vehicleInfoList.size()>0){
VehicleInfo vehicleInfo = vehicleInfoList.get(0);
vehicleInfo.setStatus(1);
vehicleInfo.setUpdateTime(LocalDateTime.now());
vehicleInfoServiceBiz.updateById(vehicleInfo);
}else {
return R.failed("暂无可用车辆!请稍后重试!");
}
//异步调用车辆
asynRunTaskService.asynRunOutStock();
//修改库位状态
InStockInfo inStockInfo = inStockInfoServiceBiz
.getOne(new QueryWrapper<InStockInfo>().eq("Location_id", localtionId));
inStockInfo.setStatus(1);
inStockInfoServiceBiz.updateById(inStockInfo);
return R.ok("操作成功");
}
}

View File

@ -138,5 +138,9 @@ public class AsynRunTaskService extends BaseService {
public void asynRunTaskForKilnToWarehouse(Long kilnId,Long vehicleId){
}
//出库起点为缓存区库位终点为提升台
@Async("asyncServiceExecutor")
public void asynRunOutStock(){
}
}