代码更新
This commit is contained in:
parent
b7e40c73ef
commit
3c9eab36e7
|
|
@ -3,12 +3,23 @@ package com.wms.controller;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.wms.annotation.MyLog;
|
||||||
import com.wms.constants.enums.ResponseCode;
|
import com.wms.constants.enums.ResponseCode;
|
||||||
import com.wms.entity.app.ResponseEntity;
|
import com.wms.entity.app.ResponseEntity;
|
||||||
import com.wms.entity.app.dto.PageDto;
|
import com.wms.entity.app.dto.PageDto;
|
||||||
|
import com.wms.entity.app.request.InventoryQuery;
|
||||||
import com.wms.entity.app.request.TaskRecordQuery;
|
import com.wms.entity.app.request.TaskRecordQuery;
|
||||||
|
import com.wms.entity.app.request.WorkSummaryQuery;
|
||||||
|
import com.wms.entity.app.vo.InventoryRecordVo;
|
||||||
|
import com.wms.entity.app.vo.InventoryVo;
|
||||||
import com.wms.entity.app.vo.TaskRecordVO;
|
import com.wms.entity.app.vo.TaskRecordVO;
|
||||||
|
import com.wms.entity.app.vo.WorkSummaryVo;
|
||||||
|
import com.wms.entity.table.InventoryHistory;
|
||||||
|
import com.wms.entity.table.InventoryList;
|
||||||
import com.wms.entity.table.TaskRecord;
|
import com.wms.entity.table.TaskRecord;
|
||||||
|
import com.wms.entity.table.WorkSummary;
|
||||||
|
import com.wms.service.InventoryHistoryService;
|
||||||
|
import com.wms.service.InventoryListService;
|
||||||
import com.wms.service.TaskRecordService;
|
import com.wms.service.TaskRecordService;
|
||||||
import com.wms.utils.HttpUtils;
|
import com.wms.utils.HttpUtils;
|
||||||
import com.wms.utils.StringUtils;
|
import com.wms.utils.StringUtils;
|
||||||
|
|
@ -46,6 +57,8 @@ public class RecordController {
|
||||||
* 请求头部信息
|
* 请求头部信息
|
||||||
*/
|
*/
|
||||||
private final HttpServletRequest servletRequest;
|
private final HttpServletRequest servletRequest;
|
||||||
|
private final InventoryListService inventoryService;// 盘点服务
|
||||||
|
private final InventoryHistoryService inventoryHistoryService;// 盘点记录服务
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查找所有物料
|
* 查找所有物料
|
||||||
|
|
@ -86,4 +99,65 @@ public class RecordController {
|
||||||
return convertJsonString(response);
|
return convertJsonString(response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询盘点信息
|
||||||
|
*/
|
||||||
|
@PostMapping("/getInventoryRecord")
|
||||||
|
@ResponseBody
|
||||||
|
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||||
|
@MyLog(logTitle = "查询盘点信息", logMethod = "getInventoryRecord")
|
||||||
|
public String getInventoryRecord(@RequestBody InventoryQuery inventoryQuery) {
|
||||||
|
logger.info("查询盘点信息:{},请求ip:{}", convertJsonString(inventoryQuery), HttpUtils.getIpAddr(servletRequest));
|
||||||
|
ResponseEntity response = new ResponseEntity();
|
||||||
|
try {
|
||||||
|
// 判断请求信息需要查询的是哪一个
|
||||||
|
if (inventoryQuery.getQueryType() == null) {
|
||||||
|
logger.error("未选择查询类别");
|
||||||
|
response.setCode(ResponseCode.ERROR.getCode());
|
||||||
|
response.setMessage("未选择查询类别");
|
||||||
|
return convertJsonString(response);
|
||||||
|
}
|
||||||
|
// 查询盘点信息
|
||||||
|
if (inventoryQuery.getQueryType() == 1) {
|
||||||
|
Page<InventoryList> page = inventoryQuery.toMpPage();
|
||||||
|
Page<InventoryList> inventoryPage = inventoryService.page(page, new LambdaQueryWrapper<InventoryList>()
|
||||||
|
.eq(inventoryQuery.getInventoryDate() != null, InventoryList::getInventoryDate, inventoryQuery.getInventoryDate())
|
||||||
|
.like(StringUtils.isNotEmpty(inventoryQuery.getVehicleId()), InventoryList::getVehicleId, inventoryQuery.getVehicleId())
|
||||||
|
.like(StringUtils.isNotEmpty(inventoryQuery.getGoodsId()), InventoryList::getGoodsId, inventoryQuery.getGoodsId()));
|
||||||
|
PageDto<InventoryRecordVo> pageDto = PageDto.of(inventoryPage, inventory -> BeanUtil.copyProperties(inventory, InventoryRecordVo.class));
|
||||||
|
logger.info("查询盘点信息成功。");
|
||||||
|
response.setCode(ResponseCode.OK.getCode());
|
||||||
|
response.setMessage("查询盘点信息成功。");
|
||||||
|
response.setReturnData(pageDto);
|
||||||
|
return convertJsonString(response);
|
||||||
|
}
|
||||||
|
// 查询盘点记录
|
||||||
|
if (inventoryQuery.getQueryType() == 2) {
|
||||||
|
Page<InventoryHistory> page = inventoryQuery.toMpPage();
|
||||||
|
Page<InventoryHistory> inventoryRecordPage = inventoryHistoryService.page(page, new LambdaQueryWrapper<InventoryHistory>()
|
||||||
|
.eq(inventoryQuery.getInventoryResult() != null, InventoryHistory::getInventoryResult, inventoryQuery.getInventoryResult())
|
||||||
|
.eq(inventoryQuery.getInventoryDate() != null, InventoryHistory::getInventoryDate, inventoryQuery.getInventoryDate())
|
||||||
|
.like(StringUtils.isNotEmpty(inventoryQuery.getVehicleId()), InventoryHistory::getVehicleId, inventoryQuery.getVehicleId())
|
||||||
|
.like(StringUtils.isNotEmpty(inventoryQuery.getGoodsId()), InventoryHistory::getGoodsId, inventoryQuery.getGoodsId()));
|
||||||
|
PageDto<InventoryRecordVo> pageDto = PageDto.of(inventoryRecordPage, inventory -> BeanUtil.copyProperties(inventory, InventoryRecordVo.class));
|
||||||
|
logger.info("查询盘点信息成功。");
|
||||||
|
response.setCode(ResponseCode.OK.getCode());
|
||||||
|
response.setMessage("查询盘点信息成功。");
|
||||||
|
response.setReturnData(pageDto);
|
||||||
|
return convertJsonString(response);
|
||||||
|
}
|
||||||
|
logger.error("查询类别选择错误。");
|
||||||
|
response.setCode(ResponseCode.ERROR.getCode());
|
||||||
|
response.setMessage("查询类别选择错误");
|
||||||
|
return convertJsonString(response);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 回滚事务
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
logger.error("查询盘点信息异常:{}", convertJsonString(e));
|
||||||
|
response.setCode(ResponseCode.ERROR.getCode());
|
||||||
|
response.setMessage("查询盘点信息异常");
|
||||||
|
return convertJsonString(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -531,8 +531,6 @@ public class TaskController {
|
||||||
stockUpdateRecordService.addStockUpdateRecord(stock, null, StockUpdateReasonEnum.FULL_OUT.getReason(), outTask.getUserName(), stock.getGoodsRelated().getRemainNum());
|
stockUpdateRecordService.addStockUpdateRecord(stock, null, StockUpdateReasonEnum.FULL_OUT.getReason(), outTask.getUserName(), stock.getGoodsRelated().getRemainNum());
|
||||||
}
|
}
|
||||||
stockService.remove(new LambdaQueryWrapper<Stock>().eq(Stock::getVehicleId, outTask.getVehicleId()));
|
stockService.remove(new LambdaQueryWrapper<Stock>().eq(Stock::getVehicleId, outTask.getVehicleId()));
|
||||||
// 删除载具
|
|
||||||
vehicleService.remove(new LambdaQueryWrapper<Vehicle>().eq(Vehicle::getVehicleId, outTask.getVehicleId()));
|
|
||||||
// 删除当前载具的所有拣选任务
|
// 删除当前载具的所有拣选任务
|
||||||
pickTaskService.remove(new LambdaQueryWrapper<PickTask>().eq(PickTask::getVehicleId, outTask.getVehicleId()));
|
pickTaskService.remove(new LambdaQueryWrapper<PickTask>().eq(PickTask::getVehicleId, outTask.getVehicleId()));
|
||||||
}
|
}
|
||||||
|
|
@ -3502,7 +3500,13 @@ public class TaskController {
|
||||||
tempHistory.setStockNum(existStock == null ? BigDecimal.ZERO : existStock.getGoodsRelated().getRemainNum());
|
tempHistory.setStockNum(existStock == null ? BigDecimal.ZERO : existStock.getGoodsRelated().getRemainNum());
|
||||||
tempHistory.setRealNum(confirmRequest.getConfirmNum());
|
tempHistory.setRealNum(confirmRequest.getConfirmNum());
|
||||||
tempHistory.setInventoryStatus(1);
|
tempHistory.setInventoryStatus(1);
|
||||||
tempHistory.setInventoryResult(tempHistory.getRealNum().compareTo(tempHistory.getStockNum()) == 0 ? 0 : 1);
|
int invResult = 0;
|
||||||
|
if (tempHistory.getRealNum().compareTo(tempHistory.getStockNum()) > 0) {
|
||||||
|
invResult = 1;
|
||||||
|
} else if (tempHistory.getRealNum().compareTo(tempHistory.getStockNum()) < 0) {
|
||||||
|
invResult = -1;
|
||||||
|
}
|
||||||
|
tempHistory.setInventoryResult(invResult);
|
||||||
tempHistory.setInventoryUser(confirmRequest.getUserName());
|
tempHistory.setInventoryUser(confirmRequest.getUserName());
|
||||||
tempHistory.setInventoryDate(LocalDateTime.now());
|
tempHistory.setInventoryDate(LocalDateTime.now());
|
||||||
historyList.add(tempHistory);
|
historyList.add(tempHistory);
|
||||||
|
|
|
||||||
72
src/main/java/com/wms/entity/app/request/InventoryQuery.java
Normal file
72
src/main/java/com/wms/entity/app/request/InventoryQuery.java
Normal file
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.wms.entity.app.request;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 盘点查询
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class InventoryQuery extends PageQuery{
|
||||||
|
/**
|
||||||
|
* 盘点id
|
||||||
|
*/
|
||||||
|
@JsonProperty("inventoryId")
|
||||||
|
private String inventoryId;
|
||||||
|
/**
|
||||||
|
* 料号
|
||||||
|
*/
|
||||||
|
@JsonProperty("goodsId")
|
||||||
|
private String goodsId;
|
||||||
|
/**
|
||||||
|
* 库存数量
|
||||||
|
*/
|
||||||
|
@JsonProperty("stockNum")
|
||||||
|
private BigDecimal stockNum;
|
||||||
|
/**
|
||||||
|
* 实际数量
|
||||||
|
*/
|
||||||
|
@JsonProperty("realNum")
|
||||||
|
private BigDecimal realNum;
|
||||||
|
/**
|
||||||
|
* 盘点状态
|
||||||
|
*/
|
||||||
|
@JsonProperty("inventoryStatus")
|
||||||
|
private Integer inventoryStatus;
|
||||||
|
/**
|
||||||
|
* 盘点用户
|
||||||
|
*/
|
||||||
|
@JsonProperty("inventoryUser")
|
||||||
|
private String inventoryUser;
|
||||||
|
/**
|
||||||
|
* 盘点日期
|
||||||
|
*/
|
||||||
|
@JsonProperty("inventoryDate")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime inventoryDate;
|
||||||
|
/**
|
||||||
|
* 箱号
|
||||||
|
*/
|
||||||
|
@JsonProperty("vehicleId")
|
||||||
|
private String vehicleId;
|
||||||
|
/**
|
||||||
|
* 盘点结果
|
||||||
|
*/
|
||||||
|
@JsonProperty("inventoryResult")
|
||||||
|
private Integer inventoryResult;
|
||||||
|
/**
|
||||||
|
* 查询类别
|
||||||
|
* 1:盘点清单
|
||||||
|
* 2:盘点记录清单
|
||||||
|
*/
|
||||||
|
@JsonProperty("queryType")
|
||||||
|
private Integer queryType;
|
||||||
|
}
|
||||||
60
src/main/java/com/wms/entity/app/vo/InventoryRecordVo.java
Normal file
60
src/main/java/com/wms/entity/app/vo/InventoryRecordVo.java
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
package com.wms.entity.app.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class InventoryRecordVo {
|
||||||
|
/**
|
||||||
|
* 盘点id
|
||||||
|
*/
|
||||||
|
@JsonProperty("inventoryId")
|
||||||
|
private String inventoryId;
|
||||||
|
/**
|
||||||
|
* 料号
|
||||||
|
*/
|
||||||
|
@JsonProperty("goodsId")
|
||||||
|
private String goodsId;
|
||||||
|
/**
|
||||||
|
* 库存数量
|
||||||
|
*/
|
||||||
|
@JsonProperty("stockNum")
|
||||||
|
private BigDecimal stockNum;
|
||||||
|
/**
|
||||||
|
* 实际数量
|
||||||
|
*/
|
||||||
|
@JsonProperty("realNum")
|
||||||
|
private BigDecimal realNum;
|
||||||
|
/**
|
||||||
|
* 盘点状态
|
||||||
|
*/
|
||||||
|
@JsonProperty("inventoryStatus")
|
||||||
|
private Integer inventoryStatus;
|
||||||
|
/**
|
||||||
|
* 盘点用户
|
||||||
|
*/
|
||||||
|
@JsonProperty("inventoryUser")
|
||||||
|
private String inventoryUser;
|
||||||
|
/**
|
||||||
|
* 盘点日期
|
||||||
|
*/
|
||||||
|
@JsonProperty("inventoryDate")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime inventoryDate;
|
||||||
|
/**
|
||||||
|
* 箱号
|
||||||
|
*/
|
||||||
|
@JsonProperty("vehicleId")
|
||||||
|
private String vehicleId;
|
||||||
|
/**
|
||||||
|
* 盘点结果
|
||||||
|
*/
|
||||||
|
@JsonProperty("inventoryResult")
|
||||||
|
private Integer inventoryResult;
|
||||||
|
}
|
||||||
|
|
@ -161,15 +161,38 @@ public class LocationServiceImplements extends ServiceImpl<LocationMapper, Locat
|
||||||
.eq(Vehicle::getVehicleId, vehicleId).last("limit 1"));
|
.eq(Vehicle::getVehicleId, vehicleId).last("limit 1"));
|
||||||
if (exsitVehicle != null) {
|
if (exsitVehicle != null) {
|
||||||
if (Objects.equals(exsitVehicle.getVehicleType(), "间接物料")) {
|
if (Objects.equals(exsitVehicle.getVehicleType(), "间接物料")) {
|
||||||
LambdaQueryWrapper<Location> locationQueryWrapper = new LambdaQueryWrapper<Location>().eq(Location::getLocationId, exsitVehicle.getCurrentLocation());
|
LambdaQueryWrapper<Location> locationQueryWrapper;
|
||||||
List<Location> availableLocations = locationMapper.selectList(locationQueryWrapper);
|
if (StringUtils.isEmpty(exsitVehicle.getCurrentLocation())) {
|
||||||
for (Location oneAvailableLocation : availableLocations) {
|
// 没有指定库位时,需要分配间接物料的库位
|
||||||
resultMap.put("nextLocationId", oneAvailableLocation.getLocationId());
|
locationQueryWrapper = new LambdaQueryWrapper<Location>()
|
||||||
standMapper.update(new LambdaUpdateWrapper<Stand>()
|
.eq(Location::getGoodsType, "间接物料")
|
||||||
.set(Stand::getLastUseTime, LocalDateTime.now())
|
.eq(Location::getAreaId, 1)
|
||||||
.eq(Stand::getEquipmentId, equipmentId)
|
.eq(Location::getLocationStatus, 0)
|
||||||
.eq(Stand::getStandType, 3));
|
.eq(Location::getLocationType, 1)
|
||||||
break;
|
.eq(Location::getIsLock, 0)
|
||||||
|
.eq(Location::getEquipmentId, equipmentId)
|
||||||
|
.orderByDesc(Location::getWDepth)
|
||||||
|
.orderByAsc(List.of(Location::getWCol, Location::getWLayer, Location::getWRow));
|
||||||
|
List<Location> availableLocations = locationMapper.selectList(locationQueryWrapper);
|
||||||
|
for (Location oneAvailableLocation : availableLocations) {
|
||||||
|
resultMap.put("nextLocationId", oneAvailableLocation.getLocationId());
|
||||||
|
standMapper.update(new LambdaUpdateWrapper<Stand>()
|
||||||
|
.set(Stand::getLastUseTime, LocalDateTime.now())
|
||||||
|
.eq(Stand::getEquipmentId, equipmentId)
|
||||||
|
.eq(Stand::getStandType, 3));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
locationQueryWrapper = new LambdaQueryWrapper<Location>().eq(Location::getLocationId, exsitVehicle.getCurrentLocation());
|
||||||
|
List<Location> availableLocations = locationMapper.selectList(locationQueryWrapper);
|
||||||
|
for (Location oneAvailableLocation : availableLocations) {
|
||||||
|
resultMap.put("nextLocationId", oneAvailableLocation.getLocationId());
|
||||||
|
standMapper.update(new LambdaUpdateWrapper<Stand>()
|
||||||
|
.set(Stand::getLastUseTime, LocalDateTime.now())
|
||||||
|
.eq(Stand::getEquipmentId, equipmentId)
|
||||||
|
.eq(Stand::getStandType, 3));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return resultMap;
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user