This commit is contained in:
parent
9236606439
commit
44c4d568be
|
|
@ -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, "综合查询--保有设备总量查询");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue