代码更新:

1. 修改叫料逻辑
This commit is contained in:
梁州 2024-10-23 18:36:57 +08:00
parent dcf4a87204
commit ff41e06716
3 changed files with 27 additions and 8 deletions

View File

@ -15,15 +15,12 @@ import com.wms.service.WorkFlowService;
import com.wms.service.WorkSummaryService; import com.wms.service.WorkSummaryService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
@ -166,7 +163,7 @@ public class MonitorController {
List<WorkFlow> allWorkFlows = workFlowService.list(); List<WorkFlow> allWorkFlows = workFlowService.list();
List<Stand> stands = standService.list(new LambdaQueryWrapper<Stand>() List<Stand> stands = standService.list(new LambdaQueryWrapper<Stand>()
.eq(Stand::getStandType, 2) .eq(Stand::getStandType, 2)
.orderByAsc(Stand::getStandId)); .orderByDesc(Stand::getStandId));
for (Stand workStation : stands) { for (Stand workStation : stands) {
// 查询到当前的工作量 // 查询到当前的工作量
List<WorkFlow> currentStationWorkFlowList = allWorkFlows.stream().filter(workFlow -> Objects.equals(workFlow.getWorkStation(), workStation.getStandId())).toList(); List<WorkFlow> currentStationWorkFlowList = allWorkFlows.stream().filter(workFlow -> Objects.equals(workFlow.getWorkStation(), workStation.getStandId())).toList();
@ -177,7 +174,7 @@ public class MonitorController {
} }
} }
total.add(currentStationWorkFlowList.size()); total.add(currentStationWorkFlowList.size());
complete.add(finishingRows); complete.add(finishingRows/currentStationWorkFlowList.size());
} }
} catch (Exception e) { } catch (Exception e) {
total = Collections.emptyList(); total = Collections.emptyList();

View File

@ -370,6 +370,13 @@ public class WmsTaskServiceImplements implements IWmsTaskService {
public BigDecimal callStocks(String goodsId, BigDecimal needNum, String workStation) { public BigDecimal callStocks(String goodsId, BigDecimal needNum, String workStation) {
BigDecimal originNum = needNum;// 原始数量 BigDecimal originNum = needNum;// 原始数量
try { try {
// 判断当前这个料是否已经有outsideVehicles
List<OutsideVehicles> outsideVehiclesList = outsideVehiclesService.list(new LambdaQueryWrapper<OutsideVehicles>()
.eq(OutsideVehicles::getGoodsId, goodsId)
.ne(OutsideVehicles::getOutStatus, 2));
if (!outsideVehiclesList.isEmpty()) {
return needNum;
}
// 查询库存判断数量是否充足 // 查询库存判断数量是否充足
List<Stock> stockList = stockService.list(new LambdaQueryWrapper<Stock>() List<Stock> stockList = stockService.list(new LambdaQueryWrapper<Stock>()
.eq(Stock::getStockStatus, StockStatus.OK.getCode()) .eq(Stock::getStockStatus, StockStatus.OK.getCode())
@ -390,8 +397,6 @@ public class WmsTaskServiceImplements implements IWmsTaskService {
StockDetailInfo goodsRelated = tempStock.getGoodsRelated(); StockDetailInfo goodsRelated = tempStock.getGoodsRelated();
goodsRelated.setRemainNum(goodsRelated.getRemainNum().subtract(needNum)); goodsRelated.setRemainNum(goodsRelated.getRemainNum().subtract(needNum));
tempStock.setGoodsRelated(goodsRelated); tempStock.setGoodsRelated(goodsRelated);
waitForOutStockList.add(tempStock);
break;
} else { } else {
// 当前箱子物料剩余数量少于需求数量 // 当前箱子物料剩余数量少于需求数量
needNum = needNum.subtract(tempStock.getGoodsRelated().getRemainNum()); needNum = needNum.subtract(tempStock.getGoodsRelated().getRemainNum());
@ -399,8 +404,9 @@ public class WmsTaskServiceImplements implements IWmsTaskService {
StockDetailInfo goodsRelated = tempStock.getGoodsRelated(); StockDetailInfo goodsRelated = tempStock.getGoodsRelated();
goodsRelated.setRemainNum(BigDecimal.ZERO); goodsRelated.setRemainNum(BigDecimal.ZERO);
tempStock.setGoodsRelated(goodsRelated); tempStock.setGoodsRelated(goodsRelated);
waitForOutStockList.add(tempStock);
} }
waitForOutStockList.add(tempStock);
break;
} }
createVehicleOutTaskAndPickTask(waitForOutStockList, workStation); createVehicleOutTaskAndPickTask(waitForOutStockList, workStation);
} }

View File

@ -53,6 +53,11 @@ public class WorkServiceImplements implements IWorkService {
private final List<String> workDoingStations = new ArrayList<>();// 当前正在执行任务的站台 private final List<String> workDoingStations = new ArrayList<>();// 当前正在执行任务的站台
private final List<String> workFinishingStations = new ArrayList<>();// 当前正在完成任务的站台 private final List<String> workFinishingStations = new ArrayList<>();// 当前正在完成任务的站台
// /**
// * 新版创建工作
// * @param workStation 工作站台
// * @throws Exception 异常
// */
// @Override // @Override
// @Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED) // @Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
// public void createWork(String workStation) throws Exception { // public void createWork(String workStation) throws Exception {
@ -294,6 +299,11 @@ public class WorkServiceImplements implements IWorkService {
} }
} }
// /**
// * 新版开始工作
// * @param workStation 工作站台
// * @throws Exception 异常
// */
// @Override // @Override
// @Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED) // @Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
// public void doWork(String workStation) throws Exception { // public void doWork(String workStation) throws Exception {
@ -572,6 +582,12 @@ public class WorkServiceImplements implements IWorkService {
} }
} }
// /**
// * 新版完成工作
// * @param workStation 工作站台
// * @return 结果
// * @throws Exception 异常
// */
// @Override // @Override
// public String finishWork(String workStation) throws Exception { // public String finishWork(String workStation) throws Exception {
// if (workFinishingStations.contains(workStation)) { // if (workFinishingStations.contains(workStation)) {