9 changed files with 212 additions and 1 deletions
-
29src/main/java/com/spring/modules/part/controller/ManufacturingStructuresController.java
-
9src/main/java/com/spring/modules/part/dto/CompleteWhereUsedQueryDto.java
-
15src/main/java/com/spring/modules/part/dto/ManufacturingStructuresBatchSaveDto.java
-
2src/main/java/com/spring/modules/part/service/BomManagementService.java
-
11src/main/java/com/spring/modules/part/service/ManufacturingStructuresService.java
-
73src/main/java/com/spring/modules/part/service/impl/BomManagementServiceImpl.java
-
16src/main/java/com/spring/modules/part/service/impl/CompleteWhereUsedServiceImpl.java
-
46src/main/java/com/spring/modules/part/service/impl/ManufacturingStructuresServiceImpl.java
-
12src/main/resources/mapper/part/CompleteWhereUsedMapper.xml
@ -0,0 +1,29 @@ |
|||
package com.spring.modules.part.controller; |
|||
|
|||
import com.spring.common.utils.R; |
|||
import com.spring.modules.part.dto.ManufacturingStructuresBatchSaveDto; |
|||
import com.spring.modules.part.service.ManufacturingStructuresService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.ResponseBody; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* 制造结构维护:批量保存(内部逐条调用 {@link com.spring.modules.part.service.BomManagementService#updateBomComponent}) |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("plm/manufacturingStructures") |
|||
public class ManufacturingStructuresController { |
|||
|
|||
@Autowired |
|||
private ManufacturingStructuresService manufacturingStructuresService; |
|||
|
|||
@PostMapping("/batchSave") |
|||
@ResponseBody |
|||
public R batchSave(@RequestBody ManufacturingStructuresBatchSaveDto dto) { |
|||
manufacturingStructuresService.batchSave(dto); |
|||
return R.ok(); |
|||
} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
package com.spring.modules.part.dto; |
|||
|
|||
import com.spring.modules.part.entity.BomComponentEntity; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 制造结构维护:批量保存修改的 BOM 子件行(逐条调用与单条修改相同的业务逻辑,含正式替代时同步 IFS)。 |
|||
*/ |
|||
@Data |
|||
public class ManufacturingStructuresBatchSaveDto { |
|||
|
|||
private List<BomComponentEntity> items; |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
package com.spring.modules.part.service; |
|||
|
|||
import com.spring.modules.part.dto.ManufacturingStructuresBatchSaveDto; |
|||
|
|||
/** |
|||
* 制造结构维护(查询复用 completeWhereUsed,保存为批量封装) |
|||
*/ |
|||
public interface ManufacturingStructuresService { |
|||
|
|||
void batchSave(ManufacturingStructuresBatchSaveDto dto); |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
package com.spring.modules.part.service.impl; |
|||
|
|||
import com.spring.modules.part.dto.ManufacturingStructuresBatchSaveDto; |
|||
import com.spring.modules.part.entity.BomComponentEntity; |
|||
import com.spring.modules.part.service.BomManagementService; |
|||
import com.spring.modules.part.service.ManufacturingStructuresService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.util.CollectionUtils; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Service |
|||
public class ManufacturingStructuresServiceImpl implements ManufacturingStructuresService { |
|||
|
|||
@Autowired |
|||
private BomManagementService bomManagementService; |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void batchSave(ManufacturingStructuresBatchSaveDto dto) { |
|||
if (dto == null || CollectionUtils.isEmpty(dto.getItems())) { |
|||
throw new RuntimeException("没有需要保存的数据"); |
|||
} |
|||
List<BomComponentEntity> items = dto.getItems(); |
|||
for (BomComponentEntity item : items) { |
|||
if (StringUtils.isAnyBlank(item.getSite(), item.getPartNo(), item.getBomType(), item.getComponentPart()) |
|||
|| item.getEngChgLevel() == null |
|||
|| item.getLineItemNo() == null) { |
|||
throw new RuntimeException("保存数据不完整:工厂、父件、BOM版本、制造类型、行号、子件编码不能为空"); |
|||
} |
|||
if (item.getAlternativeNo() == null) { |
|||
item.setAlternativeNo(""); |
|||
} |
|||
if (StringUtils.isBlank(item.getUpdateBy())) { |
|||
throw new RuntimeException("更新人不能为空"); |
|||
} |
|||
if (StringUtils.isBlank(item.getProductFlag())) { |
|||
item.setProductFlag("component"); |
|||
} |
|||
} |
|||
bomManagementService.batchUpdateBomComponent(items); |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue