Merge branch 'feature/DM/nflg-bom' of http://112.74.186.154:3000/nflj/nflg_project into feature/DM/nflg-bom
This commit is contained in:
commit
95443fc3f0
|
|
@ -9,7 +9,6 @@ import com.nflg.product.bomnew.constant.EBomConstant;
|
|||
import com.nflg.product.bomnew.constant.PBomEditStatusEnum;
|
||||
import com.nflg.product.bomnew.constant.PBomStatusEnum;
|
||||
import com.nflg.product.bomnew.pojo.dto.*;
|
||||
import com.nflg.product.bomnew.pojo.dto.sap.ImportToSapDTO;
|
||||
import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewTechnologyPackageTypeEntity;
|
||||
|
|
@ -17,12 +16,10 @@ import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery;
|
|||
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomCopyCheckResultVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewTechnologyPackageTypeVO;
|
||||
import com.nflg.product.bomnew.service.*;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import nflg.product.common.constant.STATE;
|
||||
import nflg.product.common.vo.ResultVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
|
@ -30,10 +27,8 @@ import javax.annotation.Resource;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
/**
|
||||
|
|
@ -83,7 +78,7 @@ public class PBomApi extends BaseApi {
|
|||
@ApiOperation("导出工作列表--导出")
|
||||
@LogRecord(success = "PBom-导出工作列表,操作结果:{{#_ret}}", bizNo = "",type = "PBom-导出工作列表")
|
||||
public void exportWorkDownLoad(@RequestBody BomNewPbomParentQuery query ,HttpServletResponse response) throws IOException {
|
||||
bomNewPbomParentService.workDetailsExcel(query,response);
|
||||
bomNewPbomParentService.workDetailsExcel(query,response);
|
||||
}
|
||||
|
||||
@PostMapping("releaseListDownLoad")
|
||||
|
|
@ -93,6 +88,23 @@ public class PBomApi extends BaseApi {
|
|||
bomNewPbomParentService.releaseListExcel(query,response);
|
||||
}
|
||||
|
||||
// @PostMapping("exportWorkDetailsListByPage")
|
||||
// @ApiOperation("导出工作列表--导出")
|
||||
// @LogRecord(success = "PBom-导出工作列表,操作结果:{{#_ret}}", bizNo = "",type = "PBom-导出工作列表")
|
||||
// public void exportWorkDownLoad(@RequestBody List<Long> bomRowIds, HttpServletResponse response) throws IOException {
|
||||
// List<BomNewPbomWorkExcelVO> data = bomNewPbomParentService.exportExcel(bomRowIds);
|
||||
// //new Workbook().addSheet(new ListSheet<>(data)).writeTo(response.getOutputStream());
|
||||
// EecExcelUtil.export(response, data, BomNewPbomWorkExcelVO.class, "pbom明细列表");
|
||||
// }
|
||||
//
|
||||
// @PostMapping("releaseListDownLoad")
|
||||
// @ApiOperation("PBom已发布工作列表--导出")
|
||||
// @LogRecord(success = "PBom-导出已发布工作列表,操作结果:{{#_ret}}", bizNo = "",type = "PBom-已发布工作列表")
|
||||
// public void releaseListDownLoad(@RequestBody List<Long> bomRowIds, HttpServletResponse response) throws IOException {
|
||||
// List<BomNewPbomWorkExcelVO> data = bomNewPbomParentService.exportExcel(bomRowIds);
|
||||
// EecExcelUtil.export(response, data, BomNewPbomWorkExcelVO.class, "pbom已发布明细列表");
|
||||
// }
|
||||
|
||||
@GetMapping("getChild")
|
||||
@ApiOperation("获取子级")
|
||||
public ResultVO<List<BomNewPbomParentVO>> getChild(@RequestParam("bomRowId") Long bomRowId){
|
||||
|
|
@ -102,9 +114,8 @@ public class PBomApi extends BaseApi {
|
|||
@PostMapping("editStaging")
|
||||
@ApiOperation("编辑-暂存")
|
||||
@LogRecord(success = "PBom-编辑-暂存,物料编码:{{#bom.materialNo}}-版本:{{#bom.currentVersion}},操作结果:{{#_ret}}", bizNo = "{{#param.bomRowId}}",type = "PBom-编辑-暂存")
|
||||
public ResultVO<Boolean> editStaging(@Valid @RequestBody EditPBomParamDTO param){
|
||||
bomNewPbomParentService.editSave(param,PBomEditStatusEnum.HANDLER_TEMP);
|
||||
return ResultVO.success(true);
|
||||
public ResultVO<List<BomNewPbomParentVO>> editStaging(@Valid @RequestBody EditPBomParamDTO param){
|
||||
return ResultVO.success(bomNewPbomParentService.editSave(param,PBomEditStatusEnum.HANDLER_TEMP));
|
||||
}
|
||||
|
||||
@PostMapping("editSubmit")
|
||||
|
|
|
|||
|
|
@ -49,4 +49,6 @@ public interface BomNewPbomParentMapper extends BaseMapper<BomNewPbomParentEntit
|
|||
Integer checkIsRoot(@Param("materialNo")String materialNo);
|
||||
|
||||
Integer checkIsUserRoot(@Param("materialNo") String materialNo, @Param("jobNo") String jobNo);
|
||||
|
||||
List<BomNewPbomWorkExcelVO> exportExcel(List<Long> bomRowIds);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,8 +144,14 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
}
|
||||
} else {
|
||||
Page<BomNewEbomParentVO> result = this.getBaseMapper().getEBomListPage(new Page<>(query.getPage(), query.getPageSize()), query, userRoleService.getUserJob(), SessionUtil.getUserCode());
|
||||
|
||||
materialMainService.intiMaterialInfo(result.getRecords(), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
if (!result.getRecords().isEmpty()) {
|
||||
//如果是自己创建的根节点且异常状态为“项目类别为空”时,异常状态改为正常
|
||||
result.getRecords().stream()
|
||||
.filter(f -> f.getCreatedBy().equals(SessionUtil.getUserCode())
|
||||
&& Objects.equals(f.getExceptionStatus(), EBomExceptionStatusEnum.EXCEPT_NO_8.getValue()))
|
||||
.forEach(f -> f.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue()));
|
||||
materialMainService.intiMaterialInfo(result.getRecords(), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
}
|
||||
returnResult = result;
|
||||
}
|
||||
//动态判断异常
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import cn.hutool.core.convert.Convert;
|
|||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.excel.enums.BooleanEnum;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
|
|
@ -20,9 +19,6 @@ import com.nflg.product.base.core.exception.NflgBusinessException;
|
|||
import com.nflg.product.bomnew.constant.*;
|
||||
import com.nflg.product.bomnew.mapper.master.BomNewPbomParentMapper;
|
||||
import com.nflg.product.bomnew.pojo.dto.*;
|
||||
import com.nflg.product.bomnew.pojo.dto.sap.ImportToSapChildDTO;
|
||||
import com.nflg.product.bomnew.pojo.dto.sap.ImportToSapDTO;
|
||||
import com.nflg.product.bomnew.pojo.dto.sap.ImportToSapParentDTO;
|
||||
import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.*;
|
||||
import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery;
|
||||
|
|
@ -30,7 +26,6 @@ import com.nflg.product.bomnew.pojo.vo.*;
|
|||
import com.nflg.product.bomnew.service.domain.PBom.*;
|
||||
import com.nflg.product.bomnew.service.domain.Sap;
|
||||
import com.nflg.product.bomnew.util.*;
|
||||
import com.nflg.product.bomnew.util.LevelNumUtil;
|
||||
import nflg.product.common.constant.STATE;
|
||||
import nflg.product.common.vo.ResultVO;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
|
|
@ -43,9 +38,7 @@ import javax.annotation.Resource;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
|
|
@ -227,6 +220,12 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
new Workbook().addSheet(new ListSheet<>(result)).writeTo(response.getOutputStream());
|
||||
}
|
||||
|
||||
public List<BomNewPbomWorkExcelVO> exportExcel(List<Long> bomRowIds) {
|
||||
List<BomNewPbomWorkExcelVO> result = this.getBaseMapper().exportExcel(bomRowIds);
|
||||
materialMainService.intiMaterialInfo(result, BomNewPbomWorkExcelVO::getMaterialNo, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出正式工作表
|
||||
*
|
||||
|
|
@ -310,7 +309,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
* @param paramDTO
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void editSave(EditPBomParamDTO paramDTO, PBomEditStatusEnum editStatus) {
|
||||
public List<BomNewPbomParentVO> editSave(EditPBomParamDTO paramDTO, PBomEditStatusEnum editStatus) {
|
||||
BomNewPbomParentEntity parent = this.getById(paramDTO.getBomRowId());
|
||||
VUtils.isTure(Objects.isNull(parent)).throwMessage("参数错误,该BOM不存在");
|
||||
LogRecordContext.putVariable("bom",parent);
|
||||
|
|
@ -321,8 +320,11 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
pbomChildService.saveOrUpdateBatch(childList);
|
||||
parent.setEditStatus(editStatus.getValue());
|
||||
this.updateById(parent);
|
||||
|
||||
|
||||
if (editStatus == PBomEditStatusEnum.HANDLER_TEMP) {
|
||||
return getChild(paramDTO.getBomRowId());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.nflg.product.bomnew.util;
|
|||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
import com.nflg.product.bomnew.pojo.dto.BaseImportExcelDTO;
|
||||
import nflg.product.common.constant.STATE;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.ttzero.excel.entity.ListSheet;
|
||||
import org.ttzero.excel.entity.Workbook;
|
||||
import org.ttzero.excel.reader.ExcelReader;
|
||||
|
|
@ -172,4 +174,15 @@ public class EecExcelUtil {
|
|||
public static String StringTrim(String str) {
|
||||
return str.replaceAll("[\\s\\u00A0]+", "").trim();
|
||||
}
|
||||
|
||||
public static <T> void export(HttpServletResponse response, List<T> data,Class<?> clazz,String name) throws IOException {
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + URLEncoder.encode(name, "utf-8") + ".xlsx\"");
|
||||
new Workbook().addSheet(new ListSheet<T>() {
|
||||
@Override
|
||||
protected Class<?> getTClass() {
|
||||
return clazz; // 指定类型
|
||||
}
|
||||
}.setData(data)).writeTo(response.getOutputStream());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -213,6 +213,12 @@
|
|||
and b.material_no=#{materialNo} and b.created_by=#{jobNo}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="exportExcel" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomWorkExcelVO">
|
||||
select *
|
||||
from t_bom_new_pbom_parent where row_id in
|
||||
<foreach collection="bomRowIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
order by created_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue