Merge remote-tracking branch 'origin/feature/DM/nflg-bom' into feature/DM/nflg-bom
This commit is contained in:
commit
9ff66011b7
|
|
@ -1,3 +1,5 @@
|
|||
target
|
||||
.idea
|
||||
logs
|
||||
/ABAP_AS_WITH_POOL.jcoDestination
|
||||
/dev_jco_rfc.trc
|
||||
|
|
|
|||
|
|
@ -2,13 +2,17 @@ package com.nflg.product.bomnew.api.user;
|
|||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.nflg.product.bomnew.client.MaterialMainClient;
|
||||
import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO;
|
||||
import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1DTO;
|
||||
import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.SystemInfoVO;
|
||||
import com.nflg.product.bomnew.service.SapOpUtilService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import nflg.product.common.vo.ResultVO;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
|
@ -17,9 +21,18 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.nio.file.attribute.FileTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author 曹鹏飞
|
||||
|
|
@ -27,12 +40,21 @@ import java.util.List;
|
|||
*/
|
||||
@Api(tags = "测试功能用的接口")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("test")
|
||||
public class TestApi {
|
||||
|
||||
@Resource
|
||||
SapOpUtilService sapOpUtilService;
|
||||
|
||||
@Resource
|
||||
private MaterialMainClient materialMainClient;
|
||||
|
||||
@Resource
|
||||
private Environment environment;
|
||||
|
||||
private static SystemInfoVO SYSTEM_INFO_VO;
|
||||
|
||||
/**
|
||||
* sap接口测试
|
||||
* @return
|
||||
|
|
@ -74,4 +96,53 @@ public class TestApi {
|
|||
}
|
||||
return ResultVO.success(msgs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取系统信息
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getSystemInfo")
|
||||
@ApiOperation("获取系统信息")
|
||||
public ResultVO<SystemInfoVO> getSystemInfo() {
|
||||
if (Objects.isNull(SYSTEM_INFO_VO)) {
|
||||
log.debug("spring.profiles.active:" + environment.getProperty("spring.profiles.active"));
|
||||
switch (environment.getProperty("spring.profiles.active")) {
|
||||
case "dev":
|
||||
SYSTEM_INFO_VO = new SystemInfoVO();
|
||||
SYSTEM_INFO_VO.setActive("开 发 机");
|
||||
SYSTEM_INFO_VO.setVersion(getVersion());
|
||||
break;
|
||||
case "test":
|
||||
SYSTEM_INFO_VO = new SystemInfoVO();
|
||||
SYSTEM_INFO_VO.setActive("测 试 机");
|
||||
SYSTEM_INFO_VO.setVersion(getVersion());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ResultVO.success(SYSTEM_INFO_VO);
|
||||
}
|
||||
|
||||
private String getVersion() {
|
||||
try {
|
||||
// 获取当前 JAR 文件的路径
|
||||
// String jarPath = TestApi.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath();
|
||||
String jarPath = TestApi.class.getClassLoader().getResource("").toURI().getPath();
|
||||
log.debug("当前jar路径:" + jarPath);
|
||||
// 转换为 Path 对象
|
||||
Path path = Paths.get(jarPath.substring(1));
|
||||
// 获取文件属性
|
||||
BasicFileAttributes attr = Files.readAttributes(path, BasicFileAttributes.class);
|
||||
// 获取创建时间
|
||||
FileTime creationTime = attr.creationTime();
|
||||
// 将 FileTime 转换为 LocalDateTime
|
||||
LocalDateTime localDateTime = LocalDateTime.ofInstant(creationTime.toInstant(), ZoneId.systemDefault());
|
||||
// 定义日期格式
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
return localDateTime.format(formatter);
|
||||
} catch (Exception e) {
|
||||
log.error("获取jar信息失败", e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public enum SapStatusEnum implements ValueEnum<Integer> {
|
|||
|
||||
UNPUB_SAP(1, "未导入"),
|
||||
PUB_RUNNING(2, "导入中"),
|
||||
PUB_SAP(3, "已导入"),
|
||||
PUB_SUCCESS(3, "全部导入成功"),
|
||||
PUB_ERROR(4, "部分导入失败"),
|
||||
PUB_ERROR_ALL(5, "全部导入失败");
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
|
|||
|
||||
List<BomNewEbomParentEntity> getEBomParentByMaterialNos(@Param("job") Integer job, @Param("createdBy")String createdBy, @Param("materialNos") List<String> materialNos);
|
||||
|
||||
Page<BomNewEbomParentVO> workDetailsListByPageNew(Page<Object> objectPage, BomNewEbomParentQuery query, Integer userJob, String userCode);
|
||||
Page<BomNewEbomParentVO> workDetailsListByPageNew(Page<Object> objectPage, BomNewEbomParentQuery query, Integer userJob, String userCode, Long deptRowId);
|
||||
|
||||
List<BomNewEbomParentVO> getChildren(Long bomRowId, int type);
|
||||
|
||||
|
|
@ -102,4 +102,8 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
|
|||
void insertEBomFormalChild(@Param("parentRowIds") List<Long> parentRowIds);
|
||||
|
||||
void delEBomHistory(@Param("parentRowIds") List<Long> parentRowIds);
|
||||
|
||||
Page<BomNewEbomParentVO> getSapErrorWorksheet(Page<Object> objectPage, String userCode);
|
||||
|
||||
Integer getSapErrorNum(String userCode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,7 @@ import com.nflg.product.bomnew.pojo.vo.BomNewPbomWorkExcelVO;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* t_bom_new_pbom_parent 表数据库访问层
|
||||
|
|
@ -23,7 +21,7 @@ import java.util.Set;
|
|||
*/
|
||||
public interface BomNewPbomParentMapper extends BaseMapper<BomNewPbomParentEntity> {
|
||||
|
||||
Page<BomNewPbomParentVO> workDetailsListByPage(Page<BomNewPbomParentQuery> page, @Param("query") BomNewPbomParentQuery query , @Param("userFac") String userFac);
|
||||
Page<BomNewPbomParentVO> workDetailsListByPage(Page<BomNewPbomParentQuery> page, @Param("query") BomNewPbomParentQuery query, @Param("userFac") String userFac, Long deptRowId);
|
||||
|
||||
|
||||
List<BomNewPbomWorkExcelVO> workDetailsExcel(@Param("userFac") String userFac);
|
||||
|
|
|
|||
|
|
@ -385,5 +385,12 @@ public class BomNewEbomParentEntity implements Serializable {
|
|||
@ApiModelProperty(value = "导入SAP时间")
|
||||
private LocalDateTime sapTime;
|
||||
|
||||
/**
|
||||
* 创建人所属部门rowId
|
||||
*/
|
||||
@TableField(value = "dept_row_id")
|
||||
@ApiModelProperty(value = "创建人所属部门rowId")
|
||||
private Long deptRowId;
|
||||
|
||||
private static final long serialVersionUID = 265246823929418418L;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -355,6 +355,13 @@ public class BomNewPbomParentEntity implements Serializable {
|
|||
@ApiModelProperty(value = "导入SAP时间")
|
||||
private LocalDateTime sapTime;
|
||||
|
||||
/**
|
||||
* 创建人所属部门rowId
|
||||
*/
|
||||
@TableField(value = "dept_row_id")
|
||||
@ApiModelProperty(value = "创建人所属部门rowId")
|
||||
private Long deptRowId;
|
||||
|
||||
private static final long serialVersionUID = -31999878274445137L;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,11 +124,5 @@ public class BomNewEbomChildVO extends BaseMaterialVO implements Serializable {
|
|||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* SAP排序字符串
|
||||
*/
|
||||
@ApiModelProperty(value = "SAP排序字符串")
|
||||
private String sapOrderNum;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -341,12 +341,6 @@ public class BomNewEbomParentVO extends BaseMaterialVO implements Serializable {
|
|||
@ApiModelProperty(value = "导入SAP状态")
|
||||
private Integer sapState;
|
||||
|
||||
/**
|
||||
* SAP排序字符串
|
||||
*/
|
||||
@ApiModelProperty(value = "SAP排序字符串")
|
||||
private String sapOrderNum = "0040";
|
||||
|
||||
private List<BomNewEbomParentVO> childNodes = Collections.emptyList();
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
|||
|
|
@ -273,8 +273,8 @@ public class BomNewMbomMiddleVO extends BaseMaterialVO implements Serializable {
|
|||
|
||||
public String getStatusName(){
|
||||
if(materialBackStatus==null || materialBackStatus.equals(MBomConstantEnum.MaterialBackStatusEnum.APPLY_0.getValue())){
|
||||
if (SapStatusEnum.PUB_SAP.getValue().equals(status)) {
|
||||
return SapStatusEnum.PUB_SAP.getDescription();
|
||||
if (SapStatusEnum.PUB_SUCCESS.getValue().equals(status)) {
|
||||
return SapStatusEnum.PUB_SUCCESS.getDescription();
|
||||
}
|
||||
return MBomConstantEnum.MaterialBackStatusEnum.APPLY_0.getDescription();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
package com.nflg.product.bomnew.pojo.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* t_bom_new_pbom_child
|
||||
|
|
@ -177,6 +176,12 @@ public class BomNewPbomChildVO implements Serializable {
|
|||
*/
|
||||
@ApiModelProperty(value = "来源行-父项物料编码")
|
||||
private String sourceParentMaterialNo;
|
||||
|
||||
/**
|
||||
* SAP排序字符串
|
||||
*/
|
||||
@ApiModelProperty(value = "SAP排序字符串")
|
||||
private String sapOrderNum;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -267,6 +267,12 @@ public class BomNewPbomParentVO extends BaseMaterialVO implements Serializable {
|
|||
@ApiModelProperty(value = "导入SAP状态")
|
||||
private Integer sapState;
|
||||
|
||||
/**
|
||||
* SAP排序字符串
|
||||
*/
|
||||
@ApiModelProperty(value = "SAP排序字符串")
|
||||
private String sapOrderNum = "0040";
|
||||
|
||||
private String levelNo;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
package com.nflg.product.bomnew.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author 曹鹏飞
|
||||
* @date 2024/5/29 11:46:12
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "com-nflg-product-material-pojo-vo-SystemInfoVO")
|
||||
public class SystemInfoVO {
|
||||
|
||||
@ApiModelProperty("环境信息,开发机;测试机")
|
||||
private String active;
|
||||
|
||||
@ApiModelProperty("版本号")
|
||||
private String version;
|
||||
}
|
||||
|
|
@ -309,9 +309,12 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
* @return
|
||||
*/
|
||||
public Page<BomNewEbomParentVO> formalWorksheet(BomNewEbomParentQuery query) {
|
||||
Page<BomNewEbomParentVO> result = this.getBaseMapper().formalWorksheet(new Page<>(query.getPage(), query.getPageSize()), query, SessionUtil.getUserCode());
|
||||
|
||||
|
||||
Page<BomNewEbomParentVO> result = new Page<>();
|
||||
if (StrUtil.equals(query.getMaterialNo(), "0")) {
|
||||
result = this.getBaseMapper().getSapErrorWorksheet(new Page<>(query.getPage(), query.getPageSize()), SessionUtil.getUserCode());
|
||||
} else {
|
||||
result = this.getBaseMapper().formalWorksheet(new Page<>(query.getPage(), query.getPageSize()), query, SessionUtil.getUserCode());
|
||||
}
|
||||
if (CollUtil.isNotEmpty(result.getRecords())) {
|
||||
materialMainService.intiMaterialInfo(result.getRecords());
|
||||
}
|
||||
|
|
@ -414,8 +417,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
}
|
||||
}
|
||||
child.setChildBomRowId(child.getRowId());
|
||||
child.setSapOrderNum(BomUtil.generateSapOrderNum(child.getProjectType(), child.getMaterialCategoryCode()
|
||||
, "1010", child.getMaterialNo(), child.getBomExist()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -972,28 +973,32 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
updateSapState(rootBomRowId, SapStatusEnum.PUB_RUNNING);
|
||||
liErrMsg = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(sapDto, null);
|
||||
if (CollUtil.isEmpty(liErrMsg)) {
|
||||
state = SapStatusEnum.PUB_SAP;
|
||||
state = SapStatusEnum.PUB_SUCCESS;
|
||||
} else if (sapDto.getT1().size() != liErrMsg.size()) {
|
||||
state = SapStatusEnum.PUB_ERROR;
|
||||
}
|
||||
if (CollUtil.isNotEmpty(liErrMsg)) {
|
||||
bomNewSapErrorMsgService.getBaseMapper().delete(Wrappers.lambdaQuery(BomNewSapErrorMsgEntity.class)
|
||||
.eq(BomNewSapErrorMsgEntity::getTargetRowId, rootBomRowId));
|
||||
} else {
|
||||
BomNewSapErrorMsgEntity sapErrorMsgEntity = new BomNewSapErrorMsgEntity();
|
||||
sapErrorMsgEntity.setTargetRowId(rootBomRowId);
|
||||
sapErrorMsgEntity.setType(0);
|
||||
sapErrorMsgEntity.setData(JSON.toJSONString(liErrMsg));
|
||||
sapErrorMsgEntity.setCreatedName(SessionUtil.getRealName());
|
||||
sapErrorMsgEntity.setCreatedTime(LocalDateTime.now());
|
||||
bomNewSapErrorMsgService.saveOrUpdate(sapErrorMsgEntity);
|
||||
}
|
||||
saveSapErrorMsg(rootBomRowId, liErrMsg);
|
||||
} finally {
|
||||
updateSapState(rootBomRowId, state);
|
||||
}
|
||||
return liErrMsg;
|
||||
}
|
||||
|
||||
private void saveSapErrorMsg(Long rootBomRowId, List<OperationErrorMsgVO> liErrMsg) {
|
||||
bomNewSapErrorMsgService.getBaseMapper().delete(Wrappers.lambdaQuery(BomNewSapErrorMsgEntity.class)
|
||||
.eq(BomNewSapErrorMsgEntity::getTargetRowId, rootBomRowId));
|
||||
|
||||
if (CollUtil.isNotEmpty(liErrMsg)) {
|
||||
BomNewSapErrorMsgEntity sapErrorMsgEntity = new BomNewSapErrorMsgEntity();
|
||||
sapErrorMsgEntity.setTargetRowId(rootBomRowId);
|
||||
sapErrorMsgEntity.setType(0);
|
||||
sapErrorMsgEntity.setData(JSON.toJSONString(liErrMsg));
|
||||
sapErrorMsgEntity.setCreatedName(SessionUtil.getRealName());
|
||||
sapErrorMsgEntity.setCreatedTime(LocalDateTime.now());
|
||||
bomNewSapErrorMsgService.saveOrUpdate(sapErrorMsgEntity);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSapState(Long rootBomRowId, SapStatusEnum sapState) {
|
||||
lambdaUpdate().eq(BomNewEbomParentEntity::getRowId, rootBomRowId)
|
||||
.set(BomNewEbomParentEntity::getSapTime, LocalDateTime.now())
|
||||
|
|
@ -2217,7 +2222,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
query.setPage(1L);
|
||||
query.setPageSize(20L);
|
||||
}
|
||||
Page<BomNewEbomParentVO> result = this.getBaseMapper().workDetailsListByPageNew(new Page<>(query.getPage(), query.getPageSize()), query, userRoleService.getUserJob(), SessionUtil.getUserCode());
|
||||
Page<BomNewEbomParentVO> result = this.getBaseMapper().workDetailsListByPageNew(new Page<>(query.getPage()
|
||||
, query.getPageSize()), query, userRoleService.getUserJob(), SessionUtil.getUserCode(), SessionUtil.getDepartRowId());
|
||||
if (StrUtil.isBlank(query.getMaterialNo()) && StrUtil.isBlank(query.getDrawingNo())) {
|
||||
//列表搜索
|
||||
materialMainService.intiMaterialInfo(result.getRecords(), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
|
|
@ -2420,7 +2426,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
}
|
||||
|
||||
public Integer getSapErrorNum() {
|
||||
return bomNewSapErrorMsgService.lambdaQuery().eq(BomNewSapErrorMsgEntity::getType, 0).count();
|
||||
//return bomNewSapErrorMsgService.lambdaQuery().eq(BomNewSapErrorMsgEntity::getType, 0).count();
|
||||
return this.getBaseMapper().getSapErrorNum(SessionUtil.getUserCode());
|
||||
}
|
||||
|
||||
public List<OperationErrorMsgVO> getSapError(Long rowId) {
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class BomNewMbomDetailService extends ServiceImpl<BomNewMbomDetailMapper,
|
|||
throw new NflgBusinessException(STATE.Error, "顶层数据不存在");
|
||||
}
|
||||
|
||||
if (Objects.equals(SapStatusEnum.PUB_SAP.getValue(), parentEntity.getStatus())) {
|
||||
if (Objects.equals(SapStatusEnum.PUB_SUCCESS.getValue(), parentEntity.getStatus())) {
|
||||
throw new NflgBusinessException(STATE.Error, "已发布数据不能操作");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ public class BomNewMbomParentService extends ServiceImpl<BomNewMbomParentMapper,
|
|||
|
||||
|
||||
public Page<BomNewMbomMiddleVO> formalListPage(BomNewMbomParentQuery query) {
|
||||
query.setStatus(SapStatusEnum.PUB_SAP.getValue());
|
||||
query.setStatus(SapStatusEnum.PUB_SUCCESS.getValue());
|
||||
List<String> facCode= SpringUtil.getBean(UserRoleService.class).getUserOfFactory();
|
||||
String code= StrUtil.join(",",facCode);
|
||||
query.setFacCode(code);
|
||||
|
|
@ -306,7 +306,7 @@ public class BomNewMbomParentService extends ServiceImpl<BomNewMbomParentMapper,
|
|||
updateSapState(parentVO.getRowId(), SapStatusEnum.PUB_RUNNING);
|
||||
liErrMsg = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(result, null);
|
||||
if (CollUtil.isEmpty(liErrMsg)) {
|
||||
state = SapStatusEnum.PUB_SAP;
|
||||
state = SapStatusEnum.PUB_SUCCESS;
|
||||
} else if (result.getT1().size() != liErrMsg.size()) {
|
||||
state = SapStatusEnum.PUB_ERROR;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,8 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
}
|
||||
return new Page<>();
|
||||
} else {
|
||||
Page<BomNewPbomParentVO> result = this.getBaseMapper().workDetailsListByPage(new Page<>(query.getPage(), query.getPageSize()), query, userRoleService.getUserFactory());
|
||||
Page<BomNewPbomParentVO> result = this.getBaseMapper().workDetailsListByPage(new Page<>(query.getPage()
|
||||
, query.getPageSize()), query, userRoleService.getUserFactory(), SessionUtil.getDepartRowId());
|
||||
materialMainService.intiMaterialInfo(result.getRecords(), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -321,6 +322,8 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
child.setCurrentVersion(OriginalConstant.DEFAULT_BOM_VERSION);
|
||||
}
|
||||
}
|
||||
child.setSapOrderNum(BomUtil.generateSapOrderNum(child.getProjectType(), child.getMaterialCategoryCode()
|
||||
, child.getFacCode(), child.getMaterialNo(), child.getBomExist()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -568,7 +571,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
private void checkCopyBomParam(Long sourceBomRowId, String targetFacCode) {
|
||||
BomNewPbomParentEntity parent = this.getById(sourceBomRowId);
|
||||
VUtils.isTure(Objects.isNull(parent)).throwMessage("参数错误,复制源BOM不存在");
|
||||
VUtils.isTure(!PBomStatusEnum.PUBLISH.equalsValue(parent.getStatus())).throwMessage("只有已发布版本,才能复制");
|
||||
VUtils.isTure(PBomStatusEnum.PUBLISH.getValue() > parent.getStatus()).throwMessage("只有已发布版本,才能复制");
|
||||
VUtils.isTure(parent.getFacCode().equals(targetFacCode)).throwMessage("源工厂和目标工厂一致,无需复制");
|
||||
VUtils.isTure(parent.getMaterialNo().startsWith("31")).throwMessage("31物料不能进行复制");
|
||||
}
|
||||
|
|
@ -1117,7 +1120,11 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
|
||||
ImportSapParamDTO sapDto = new ImportSapParamDTO();
|
||||
sapDto.setZID(RandomUtil.randomNumbers(5));
|
||||
sapDto.setI_WERKS("1");
|
||||
if (StrUtil.equals(root.getFacCode(), EBomConstant.MAIN_FACTORY_CODE_1010)) {
|
||||
sapDto.setI_WERKS("1");
|
||||
} else if (StrUtil.equals(root.getFacCode(), EBomConstant.XIAN_TAO_FACTORY_CODE_1020)) {
|
||||
sapDto.setI_WERKS("2");
|
||||
}
|
||||
sapDto.setI_STLAN("1");
|
||||
sapDto.setI_EMPNO(root.getCreatedBy());
|
||||
List<T1DTO> t1s = new ArrayList<>();
|
||||
|
|
@ -1129,7 +1136,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
updateSapState(rootRowId, SapStatusEnum.PUB_RUNNING);
|
||||
liErrMsg = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(sapDto, null);
|
||||
if (CollUtil.isEmpty(liErrMsg)) {
|
||||
state = SapStatusEnum.PUB_SAP;
|
||||
state = SapStatusEnum.PUB_SUCCESS;
|
||||
} else if (sapDto.getT1().size() != liErrMsg.size()) {
|
||||
state = SapStatusEnum.PUB_ERROR;
|
||||
}
|
||||
|
|
@ -1155,7 +1162,8 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
for (BomNewPbomChildEntity c : children) {
|
||||
BomNewPbomParentEntity cp = lambdaQuery()
|
||||
.eq(BomNewPbomParentEntity::getMaterialNo, c.getMaterialNo())
|
||||
.eq(BomNewPbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
|
||||
.eq(BomNewPbomParentEntity::getFacCode, parent.getFacCode())
|
||||
.eq(BomNewPbomParentEntity::getStatus, PBomStatusEnum.FACTORY_CONFIRM.getValue())
|
||||
.orderByDesc(BomNewPbomParentEntity::getRowId)
|
||||
.last(" limit 1")
|
||||
.one();
|
||||
|
|
|
|||
|
|
@ -435,7 +435,7 @@ public class DQBomService {
|
|||
liErrMsg = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(sapDto, null);
|
||||
log.debug("本次导入到sap数量共{}个,其中{}个有错误", sapDto.getT1().size(), liErrMsg.size());
|
||||
if (CollUtil.isEmpty(liErrMsg)) {
|
||||
state = SapStatusEnum.PUB_SAP;
|
||||
state = SapStatusEnum.PUB_SUCCESS;
|
||||
} else if (sapDto.getT1().size() != liErrMsg.size()) {
|
||||
state = SapStatusEnum.PUB_ERROR;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ public class OptionalMbomMaterialService extends ServiceImpl<OptionalMbomMateria
|
|||
updateSapState(entity.getRootRowId(), SapStatusEnum.PUB_RUNNING);
|
||||
liErrMsg = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(result, null);
|
||||
if (CollUtil.isEmpty(liErrMsg)) {
|
||||
state = SapStatusEnum.PUB_SAP;
|
||||
state = SapStatusEnum.PUB_SUCCESS;
|
||||
} else if (result.getT1().size() != liErrMsg.size()) {
|
||||
state = SapStatusEnum.PUB_ERROR;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,6 +131,7 @@ public class EBomEdit {
|
|||
parentEntity.setEditStatus(createDTO.getOpType());
|
||||
parentEntity.setRootIs(parentEntity.getMaterialNo().startsWith("31") ? 1 : 0);
|
||||
parentEntity.setUserRootIs(1);
|
||||
parentEntity.setDeptRowId(SessionUtil.getDepartRowId());
|
||||
|
||||
createDTO.getDatas().forEach(k -> {
|
||||
k.setParentRowId(parentEntity.getRowId());
|
||||
|
|
|
|||
|
|
@ -387,6 +387,7 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
|
|||
this.eBomParentResult.add(ebom);
|
||||
}
|
||||
eBomParent.setMaterialOriginalUnit(eBomParent.getMaterialUnit());
|
||||
eBomParent.setDeptRowId(SessionUtil.getDepartRowId());
|
||||
this.eBomParentResult.add(eBomParent);
|
||||
|
||||
return eBomParent.getRowId();
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public class ConvertToMBomBase {
|
|||
BomNewMbomParentEntity oldParent = SpringUtil.getBean(BomNewMbomParentService.class).lambdaQuery().eq(BomNewMbomParentEntity::getMaterialNo, parent.getMaterialNo()).eq(BomNewMbomParentEntity::getFacCode, facCode)
|
||||
.last(" order by current_version desc limit 1").one();
|
||||
if (Objects.nonNull(oldParent)) {
|
||||
if (SapStatusEnum.PUB_SAP.equalsValue(oldParent.getStatus())) {
|
||||
if (SapStatusEnum.PUB_SUCCESS.equalsValue(oldParent.getStatus())) {
|
||||
//将数据迁移到历史表
|
||||
SpringUtil.getBean(BomNewMbomParentService.class).getBaseMapper().insertMBomIntoHistory(oldParent.getRowId());
|
||||
|
||||
|
|
|
|||
|
|
@ -393,11 +393,13 @@
|
|||
<select id="workDetailsListByPageNew" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
|
||||
SELECT *,row_id as bomRowId
|
||||
FROM t_bom_new_ebom_parent
|
||||
<!-- WHERE (root_is=1 OR ((user_root_is=1 OR root_is_for_wait_review=1) AND created_by=#{userCode}))-->
|
||||
<where>
|
||||
<if test="query.showMySelfOnly == 1">
|
||||
AND created_by = #{userCode}
|
||||
</if>
|
||||
<if test="query.showMySelfOnly == 0">
|
||||
AND dept_row_id = #{deptRowId}
|
||||
</if>
|
||||
<if test="userJob==0">
|
||||
AND status IN (1,3) AND (root_is=1 OR user_root_is=1 OR root_is_for_wait_review=1) AND
|
||||
created_by=#{userCode}
|
||||
|
|
@ -480,6 +482,20 @@
|
|||
LEFT JOIN t_bom_new_ebom_child b ON a.material_no = b.material_no
|
||||
WHERE a.row_id = #{parentRowId}
|
||||
</select>
|
||||
<select id="getSapErrorWorksheet" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
|
||||
SELECT *, row_id AS bomRowId
|
||||
FROM t_bom_new_ebom_parent
|
||||
WHERE status = 4
|
||||
AND (root_is = 1 OR user_root_is = 1)
|
||||
AND sap_state > 3
|
||||
AND created_by = #{userCode}
|
||||
</select>
|
||||
<select id="getSapErrorNum" resultType="java.lang.Integer">
|
||||
SELECT COUNT(1)
|
||||
FROM t_bom_new_ebom_parent p
|
||||
INNER JOIN t_bom_new_sap_error_msg e ON p.row_id = e.target_row_id AND e.type = 0
|
||||
WHERE p.created_by = #{userCode}
|
||||
</select>
|
||||
|
||||
<insert id="insertEBomFormalParent">
|
||||
INSERT INTO `t_bom_new_ebom_parent_formal` (`row_id`, `batch_no`, `drawing_no`, `material_no`, `order_number`, `material_name`, `material_desc`, `material_texture`, `material_unit`, `material_original_unit`, `unit_weight`, `total_weight`, `current_version`, `num`, `source`, `root_is`, `should_bom_exist`, `super_material_status`, `bom_exist`, `last_version_is`, `edit_status`, `status`, `user_root_is`, `virtrual_package_enum`, `exception_status`, `virtual_package_is`, `source_row_id`, `devise_user_code`, `devise_name`, `created_by`, `created_time`, `created_job`, `audit_time`, `audit_user_name`, `release_time`, `release_user_name`, `revert_time`, `revert_user_name`, `expire_end_time`, `convert_to_ebom_time`, `remark`, `dept_name`, `level_num`, `change_desc`, `notice_nums`, `modify_time`, `sap_state`, `sap_time`)
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@
|
|||
<!--获取工作列表-->
|
||||
<select id="workDetailsListByPage" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO">
|
||||
select * , row_id as bomRowId
|
||||
from t_bom_new_pbom_parent where (root_is=1 or root_state=1 ) and status < 4
|
||||
from t_bom_new_pbom_parent where (root_is=1 or root_state=1 ) and status < 4 and dept_row_id = #{deptRowId}
|
||||
<if test="userFac!=null and userFac!=''">
|
||||
and fac_code=#{userFac}
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -106,6 +106,10 @@ public class SessionUtil {
|
|||
return getUser().getSessionKey();
|
||||
}
|
||||
|
||||
public static Long getDepartRowId() {
|
||||
return getUser().getDepartRowId();
|
||||
}
|
||||
|
||||
public static LoginUserInfoDTO getUser() {
|
||||
return Optional.ofNullable(BaseApi.loginUser.get())
|
||||
.orElseThrow(() -> new NflgBusinessException(STATE.LoginError, "请登录"));
|
||||
|
|
|
|||
Loading…
Reference in New Issue