代码更新:

1.增加CLC需求看板相关
This commit is contained in:
梁州 2024-08-24 15:18:47 +08:00
parent 759fc3a91e
commit 91d224b18c
4 changed files with 105 additions and 22 deletions

View File

@ -10,6 +10,8 @@ import com.wms.annotation.MyLog;
import com.wms.constants.enums.*;
import com.wms.entity.app.ResponseEntity;
import com.wms.entity.app.dto.PageDto;
import com.wms.entity.app.dto.StockOfGoodsDto;
import com.wms.entity.app.dto.extend.KanbanEntity;
import com.wms.entity.app.request.*;
import com.wms.entity.app.vo.FileVo;
import com.wms.entity.app.vo.LocationVo;
@ -36,10 +38,14 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import static com.wms.utils.HttpUtils.getIpAddr;
import static com.wms.utils.StringUtils.convertJsonString;
@ -309,7 +315,41 @@ public class ExcelController {
// 获取导出结果
List<ClcKanbanRequirementExcelVo> clcKanbanRequirementExcelVoList = new ArrayList<>();
// TODO 需要处理获得数据
EasyExcel.write(response.getOutputStream(), StockExcelVo.class)
// 查询物料库存信息
List<StockOfGoodsDto> stockOfGoodsDtoList = stockService.selectSumOfGoods("");
if (stockOfGoodsDtoList == null || stockOfGoodsDtoList.isEmpty()) {
clcKanbanRequirementExcelVoList = Collections.emptyList();
} else {
for (StockOfGoodsDto stockOfGoodsDto : stockOfGoodsDtoList) {
if (Objects.equals(stockOfGoodsDto.getFeedType(), "PULL")) {
// 剩余数量少于补货点时需要补货
if (stockOfGoodsDto.getRemainNumSum().compareTo(stockOfGoodsDto.getFeedPoint()) <= 0) {
ClcKanbanRequirementExcelVo tempClcKanbanRequirementExcelVo = new ClcKanbanRequirementExcelVo();
// 目标数量
BigDecimal targetNum = stockOfGoodsDto.getNumOfKanban().multiply(stockOfGoodsDto.getNumOfPerKanban());
// 计算需要多少个看板
BigDecimal needKanbanQuantity = targetNum.subtract(stockOfGoodsDto.getRemainNumSum()).divide(stockOfGoodsDto.getNumOfPerKanban(), 2, RoundingMode.CEILING);
// 设定物流数据
tempClcKanbanRequirementExcelVo.setGoodsId(stockOfGoodsDto.getGoodsId());
tempClcKanbanRequirementExcelVo.setRequireNum(needKanbanQuantity.multiply(stockOfGoodsDto.getNumOfPerKanban()));
// 设定看板
List<KanbanEntity> needKanbanList = new ArrayList<>();
for (KanbanEntity kanbanEntity : stockOfGoodsDto.getKanbanList()) {
if (needKanbanQuantity.compareTo(BigDecimal.ZERO) <= 0) {
break;
}
needKanbanList.add(kanbanEntity);
}
if (!needKanbanList.isEmpty()) {
tempClcKanbanRequirementExcelVo.setKanban(needKanbanList);
}
clcKanbanRequirementExcelVoList.add(tempClcKanbanRequirementExcelVo);
}
}
}
}
EasyExcel.write(response.getOutputStream(), ClcKanbanRequirementExcelVo.class)
.excelType(ExcelTypeEnum.XLSX)
.registerWriteHandler(horizontalCellStyleStrategy)
.sheet("CLC看板需求")

View File

@ -1,22 +1,18 @@
package com.wms.controller;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.wms.annotation.MyLog;
import com.wms.constants.enums.ResponseCode;
import com.wms.entity.app.ResponseEntity;
import com.wms.entity.app.dto.PageDto;
import com.wms.entity.app.dto.StockDto;
import com.wms.entity.app.dto.StockOfGoodsDto;
import com.wms.entity.app.request.*;
import com.wms.entity.app.vo.*;
import com.wms.entity.table.KateDBS;
import com.wms.entity.table.KateOrders;
import com.wms.entity.table.Stock;
import com.wms.entity.table.WorkStationConfig;
import com.wms.service.KateDBSService;
import com.wms.service.KateOrdersService;
@ -24,7 +20,6 @@ import com.wms.service.StockService;
import com.wms.service.WorkStationConfigService;
import com.wms.utils.HttpUtils;
import com.wms.utils.StringUtils;
import com.wms.utils.WmsUtils;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
@ -39,9 +34,7 @@ import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Objects;
@ -498,29 +491,44 @@ public class KateWorkQueryController {
TotalNumOfPc = TotalNumOfPc.add(needKanbanQuantity.multiply(stockOfGoodsDto.getNumOfPerKanban()));
TotalNumOfBox = TotalNumOfBox.add(needKanbanQuantity);
if (stockOfGoodsDto.getBoxType().contains("810")) {
} else if (stockOfGoodsDto.getBoxType().contains("811")) {
} else if (stockOfGoodsDto.getBoxType().contains("911")) {
} else if (stockOfGoodsDto.getBoxType().contains("822")) {
}
}
switch (stockOfGoodsDto.getBoxType()) {
case "810":
NumOfTypeOf810 = NumOfTypeOf810.add(BigDecimal.ONE);
NumOfPcOf810 = NumOfPcOf810.add(needKanbanQuantity.multiply(stockOfGoodsDto.getNumOfPerKanban()));
NumOfBoxOf810 = NumOfBoxOf810.add(needKanbanQuantity);
break;
} else if (stockOfGoodsDto.getBoxType().contains("811")) {
NumOfTypeOf811 = NumOfTypeOf811.add(BigDecimal.ONE);
NumOfPcOf811 = NumOfPcOf811.add(needKanbanQuantity.multiply(stockOfGoodsDto.getNumOfPerKanban()));
NumOfBoxOf811 = NumOfBoxOf811.add(needKanbanQuantity);
} else if (stockOfGoodsDto.getBoxType().contains("911")) {
NumOfTypeOf911 = NumOfTypeOf911.add(BigDecimal.ONE);
NumOfPcOf911 = NumOfPcOf911.add(needKanbanQuantity.multiply(stockOfGoodsDto.getNumOfPerKanban()));
NumOfBoxOf911 = NumOfBoxOf911.add(needKanbanQuantity);
} else if (stockOfGoodsDto.getBoxType().contains("822")) {
NumOfTypeOf822 = NumOfTypeOf822.add(BigDecimal.ONE);
NumOfPcOf822 = NumOfPcOf822.add(needKanbanQuantity.multiply(stockOfGoodsDto.getNumOfPerKanban()));
NumOfBoxOf822 = NumOfBoxOf822.add(needKanbanQuantity);
}
}
}
}
// 设定Vo实体
clcKanbanVo.setTotalNumOfType(TotalNumOfType);
clcKanbanVo.setTotalNumOfPc(TotalNumOfPc);
clcKanbanVo.setTotalNumOfBox(TotalNumOfBox);
clcKanbanVo.setNumOfBoxOf811(NumOfBoxOf811);
clcKanbanVo.setNumOfBoxOf810(NumOfBoxOf810);
clcKanbanVo.setNumOfBoxOf911(NumOfBoxOf911);
clcKanbanVo.setNumOfBoxOf822(NumOfBoxOf822);
clcKanbanVo.setNumOfPcOf811(NumOfPcOf811);
clcKanbanVo.setNumOfPcOf810(NumOfPcOf810);
clcKanbanVo.setNumOfPcOf911(NumOfPcOf911);
clcKanbanVo.setNumOfPcOf822(NumOfPcOf822);
clcKanbanVo.setNumOfTypeOf811(NumOfTypeOf811);
clcKanbanVo.setNumOfTypeOf810(NumOfTypeOf810);
clcKanbanVo.setNumOfTypeOf911(NumOfTypeOf911);
clcKanbanVo.setNumOfTypeOf822(NumOfTypeOf822);
}
logger.info("获取CLC看板需求成功。");
response.setCode(ResponseCode.OK.getCode());
response.setMessage("获取CLC看板需求成功。");
response.setReturnData(clcKanbanVo);

View File

@ -1,6 +1,7 @@
package com.wms.utils.excel.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.wms.entity.app.dto.extend.KanbanEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

View File

@ -1,8 +1,13 @@
package com.wms.utils.excel.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.wms.entity.app.dto.extend.KanbanEntity;
import lombok.Data;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.List;
/**
* 看板导入
*/
@ -108,4 +113,33 @@ public class KanbanExcelVo {
private String KANBAN49;
@ExcelProperty("KANBAN#50")
private String KANBAN50;
/**
* 设定看板
* @param kanbanList 看板列表
*/
public void setKanban(List<KanbanEntity> kanbanList) {
for (Field field : this.getClass().getDeclaredFields()) {
if (field.getName().startsWith("KANBAN")) {
int sortNum = -1;
try {
// 获取id排序
sortNum = Integer.parseInt(field.getName().split("#")[1]);
} catch (Exception e) {
continue;
}
if (sortNum != -1) {
try {
if (kanbanList.size() >= sortNum) {
field.setAccessible(true);
field.set(this, kanbanList.get(sortNum - 1).getKanbanId());
}
} catch (IllegalAccessException e) {
// 捕捉异常
System.out.println("设置看板发生异常:" + e.getMessage());
}
}
}
}
}
}