This commit is contained in:
hayu 2025-09-24 16:49:39 +08:00
parent 9236606439
commit 44c4d568be
3 changed files with 28 additions and 1 deletions

View File

@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Collectors;
@ -94,6 +95,23 @@ public class MaterialMachineController extends BaseController {
@PostMapping("/exportRetainedEquipmentList")
public void exportRetainedEquipmentList(HttpServletResponse response, MaterialRetainedEquipmentInfo bean) {
List<MaterialRetainedEquipmentInfo> list = materialMachineService.getRetainedEquipmentList(bean);
if (list.size()>0){
for (MaterialRetainedEquipmentInfo item : list) {
// 根据 unitValue 决定 allNumStr 的格式
if (item.getAllNum() != null) {
if ("1".equals(item.getUnitValue())) {
// 显示小数例如保留2位
item.setAllNumStr(item.getAllNum().setScale(3, BigDecimal.ROUND_HALF_UP).toString());
} else {
// 不显示小数转为整数
item.setAllNumStr(item.getAllNum().setScale(0, BigDecimal.ROUND_HALF_UP).toString());
}
} else {
// 处理 null 情况
item.setAllNumStr("");
}
}
}
ExcelUtil<MaterialRetainedEquipmentInfo> util = new ExcelUtil<>(MaterialRetainedEquipmentInfo.class);
util.exportExcel(response, list, "综合查询--保有设备总量查询");
}

View File

@ -84,9 +84,11 @@ public class MaterialRetainedEquipmentInfo {
private BigDecimal usNum;
@ApiModelProperty(value = "数量")
@Excel(name = "数量",align = HorizontalAlignment.RIGHT)
private BigDecimal allNum;
@Excel(name = "数量",align = HorizontalAlignment.RIGHT)
private String allNumStr;
@ApiModelProperty(value = "购置单价")
private BigDecimal buyPrice;

View File

@ -992,7 +992,14 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
* @return
*/
private int updateSlt4Bean(MaterialBackApplyInfo record, List<MaterialBackApplyInfo> allList) {
//先根据外层id查询上层信息
MaterialBackApplyInfo backApplyInfo = materialBackInfoMapper.selectBackApplyInfoById(record.getId());
//根据退料任务查询班组id和工程id然后查询协议集合
MaterialBackApplyInfo agreement = materialBackInfoMapper.getAgreementInfo(backApplyInfo);
List<String> list = materialBackInfoMapper.getAgreementList(agreement);
for (MaterialBackApplyInfo bean : allList) {
bean.setAgreementIds(list);
List<SltAgreementInfo> infoList = materialBackInfoMapper.getStlInfo(bean);
if (infoList.size() > 0) {
BigDecimal backNum = bean.getBackNum();