物料拓展功能实现
This commit is contained in:
@@ -55,4 +55,6 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode ERP_CONTRACT_NOT_EXISTS = new ErrorCode(1_016_000_001, "ERP合同数据不存在");
|
||||
|
||||
ErrorCode ERP_PRODUCTIVE_ORDER_NOT_EXISTS = new ErrorCode(1_017_000_001, "ERP生产订单数据不存在");
|
||||
|
||||
ErrorCode MATERIAL_ERROR = new ErrorCode( 1_017_000_009, "主物料信息错误");
|
||||
}
|
||||
@@ -38,7 +38,6 @@ public class ErpMaterialController {
|
||||
|
||||
@Resource
|
||||
private ErpMaterialService erpMaterialService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建ERP物料数据")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-material:create')")
|
||||
@@ -121,8 +120,8 @@ public class ErpMaterialController {
|
||||
@PostMapping("/createErpMaterialCorr")
|
||||
@Operation(summary = "创建ERP物料关系")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-material:create')")
|
||||
public CommonResult<List<ErpMaterialRespVO>> createErpMaterialCorr(@Valid @RequestBody List<ErpMaterialCorrSaveReqVO> erpMaterialCorrSaveReqVOS) {
|
||||
return success(erpMaterialService.createErpMaterialCorr(erpMaterialCorrSaveReqVOS));
|
||||
public CommonResult<List<ErpMaterialRespVO>> createErpMaterialCorr(@Valid @RequestBody ErpMaterialCorrSaveReqVO erpMaterialCorrSaveReqVO) {
|
||||
return success(erpMaterialService.createErpMaterialCorr(erpMaterialCorrSaveReqVO));
|
||||
}
|
||||
//删除物料关系
|
||||
@DeleteMapping("/deleteErpMaterialCorr")
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package com.zt.plat.module.erp.controller.admin.erp.vo;
|
||||
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 物料拓展关系 Request VO")
|
||||
@Data
|
||||
public class ErpMaterialCorrSaveReqVO {
|
||||
@@ -22,19 +23,25 @@ public class ErpMaterialCorrSaveReqVO {
|
||||
@NotNull(message = "拓展关系主物料不能为空")
|
||||
private Long materialParentId;
|
||||
|
||||
/**
|
||||
* 物料ID
|
||||
*/
|
||||
@Schema(description = "物料ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long materialId;
|
||||
/**
|
||||
* 拓展关系主物料编号
|
||||
*/
|
||||
@Schema(description = "拓展关系主物料编号")
|
||||
private String materialParentCode;
|
||||
private String materialParentCode;
|
||||
/**
|
||||
* 物料编码
|
||||
* 拓展关系物料
|
||||
*/
|
||||
@Schema(description = "拓展关系物料编号")
|
||||
private String materialCode;
|
||||
@Schema(description = "拓展关系物料")
|
||||
private List<Materials> materials;
|
||||
|
||||
@Data
|
||||
@Schema(description = "拓展关系物料")
|
||||
public static class Materials {
|
||||
@Schema(description = "物料ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long materialId;
|
||||
@Schema(description = "物料编码")
|
||||
private String materialCode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,16 @@
|
||||
package com.zt.plat.module.erp.framework.rpc.config;
|
||||
|
||||
import com.zt.plat.module.base.api.materialinfomation.MaterialInfomationApi;
|
||||
import com.zt.plat.module.infra.api.businessfile.BusinessFileApi;
|
||||
import com.zt.plat.module.infra.api.file.FileApi;
|
||||
|
||||
import com.zt.plat.module.system.api.dept.DeptApi;
|
||||
import com.zt.plat.module.system.api.sequence.SequenceApi;
|
||||
import com.zt.plat.module.system.api.user.AdminUserApi;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(value = "erpRpcConfiguration", proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {DeptApi.class, SequenceApi.class, AdminUserApi.class, BusinessFileApi.class, FileApi.class, MaterialInfomationApi.class})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
@@ -13,6 +13,6 @@ import java.util.List;
|
||||
* @author 后台管理
|
||||
*/
|
||||
public interface ErpErpMaterialCorrService {
|
||||
List<ErpMaterialCorrRspVO> create(@Valid List<ErpMaterialCorrSaveReqVO> reqVO);
|
||||
List<ErpMaterialCorrRspVO> create(@Valid ErpMaterialCorrSaveReqVO reqVO);
|
||||
void deleteBatch(BatchDeleteReqVO reqVO);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@@ -19,10 +20,18 @@ public class ErpErpMaterialCorrServiceImpl implements ErpErpMaterialCorrService{
|
||||
private ErpErpMaterialCorrMapper erpErpMaterialCorrMapper;
|
||||
|
||||
@Override
|
||||
public List<ErpMaterialCorrRspVO> create(List<ErpMaterialCorrSaveReqVO> reqVO) {
|
||||
List<ErpMaterialCorrDO> bean = BeanUtils.toBean(reqVO, ErpMaterialCorrDO.class);
|
||||
erpErpMaterialCorrMapper.insertBatch(bean);
|
||||
return BeanUtils.toBean(bean, ErpMaterialCorrRspVO.class);
|
||||
public List<ErpMaterialCorrRspVO> create(ErpMaterialCorrSaveReqVO reqVO) {
|
||||
List<ErpMaterialCorrDO> erpMaterialCorrDOS=new ArrayList<>();
|
||||
reqVO.getMaterials().forEach(materials -> {
|
||||
erpMaterialCorrDOS.add(ErpMaterialCorrDO.builder()
|
||||
.materialParentId(reqVO.getMaterialParentId())
|
||||
.materialParentCode(reqVO.getMaterialParentCode())
|
||||
.materialId(materials.getMaterialId())
|
||||
.materialCode(materials.getMaterialCode())
|
||||
.build());
|
||||
});
|
||||
erpErpMaterialCorrMapper.insertBatch(erpMaterialCorrDOS);
|
||||
return BeanUtils.toBean(erpMaterialCorrDOS, ErpMaterialCorrRspVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -269,6 +269,11 @@ public class ErpFactoryServiceImpl implements ErpFactoryService {
|
||||
private void saveData(ProcessingResult result) {
|
||||
// 批量新增和更新
|
||||
if (!result.toInsert.isEmpty()) {
|
||||
//自动绑定工厂
|
||||
result.toInsert.forEach(r->{
|
||||
r.setRelName(r.getName());
|
||||
r.setRelnumber(r.getNumber());
|
||||
});
|
||||
erpFactoryMapper.insertBatch(result.toInsert);
|
||||
// 批量查询刚插入数据的id,提升效率
|
||||
List<String> insertedNumbers = result.toInsert.stream()
|
||||
|
||||
@@ -70,7 +70,7 @@ public interface ErpMaterialService {
|
||||
|
||||
String getMaterialUnit(String materialNumber);
|
||||
|
||||
List<ErpMaterialRespVO> createErpMaterialCorr(List<ErpMaterialCorrSaveReqVO> erpMaterialCorrSaveReqVOS);
|
||||
List<ErpMaterialRespVO> createErpMaterialCorr(ErpMaterialCorrSaveReqVO erpMaterialCorrSaveReqVO);
|
||||
|
||||
void deleteErpMaterialCorr(BatchDeleteReqVO reqVO);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user