Merge remote-tracking branch 'origin/dev' into test

This commit is contained in:
qianshijiang
2025-12-31 08:52:26 +08:00
11 changed files with 408 additions and 46 deletions

View File

@@ -90,6 +90,12 @@
<logger name="com.zt.plat.module.base.dal.mysql" level="DEBUG" additivity="false"> <logger name="com.zt.plat.module.base.dal.mysql" level="DEBUG" additivity="false">
<appender-ref ref="STDOUT"/> <appender-ref ref="STDOUT"/>
</logger> </logger>
<logger name="com.zt.plat.module.contractorder.dal.mysql" level="DEBUG" additivity="false">
<appender-ref ref="STDOUT"/>
</logger>
<logger name="com.zt.plat.module.erp.dal.mysql" level="DEBUG" additivity="false">
<appender-ref ref="STDOUT"/>
</logger>
</springProfile> </springProfile>
<!-- 其它环境 --> <!-- 其它环境 -->

View File

@@ -55,4 +55,6 @@ public interface ErrorCodeConstants {
ErrorCode ERP_CONTRACT_NOT_EXISTS = new ErrorCode(1_016_000_001, "ERP合同数据不存在"); 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 ERP_PRODUCTIVE_ORDER_NOT_EXISTS = new ErrorCode(1_017_000_001, "ERP生产订单数据不存在");
ErrorCode MATERIAL_ERROR = new ErrorCode( 1_017_000_009, "主物料信息错误");
} }

View File

@@ -66,7 +66,7 @@ public class ErpMaterialController {
@DeleteMapping("/delete-list") @DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true) @Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除ERP物料数据") @Operation(summary = "批量删除ERP物料数据")
@PreAuthorize("@ss.hasPermission('sply:erp-material:delete')") @PreAuthorize("@ss.hasPermission('sply:erp-material:delete')")
public CommonResult<Boolean> deleteErpMaterialList(@RequestBody BatchDeleteReqVO req) { public CommonResult<Boolean> deleteErpMaterialList(@RequestBody BatchDeleteReqVO req) {
erpMaterialService.deleteErpMaterialListByIds(req.getIds()); erpMaterialService.deleteErpMaterialListByIds(req.getIds());
return success(true); return success(true);
@@ -94,12 +94,12 @@ public class ErpMaterialController {
@PreAuthorize("@ss.hasPermission('sply:erp-material:export')") @PreAuthorize("@ss.hasPermission('sply:erp-material:export')")
@ApiAccessLog(operateType = EXPORT) @ApiAccessLog(operateType = EXPORT)
public void exportErpMaterialExcel(@Valid ErpMaterialPageReqVO pageReqVO, public void exportErpMaterialExcel(@Valid ErpMaterialPageReqVO pageReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpMaterialDO> list = erpMaterialService.getErpMaterialPage(pageReqVO).getList(); List<ErpMaterialDO> list = erpMaterialService.getErpMaterialPage(pageReqVO).getList();
// 导出 Excel // 导出 Excel
ExcelUtils.write(response, "ERP物料数据.xls", "数据", ErpMaterialRespVO.class, ExcelUtils.write(response, "ERP物料数据.xls", "数据", ErpMaterialRespVO.class,
BeanUtils.toBean(list, ErpMaterialRespVO.class)); BeanUtils.toBean(list, ErpMaterialRespVO.class));
} }
@PostMapping("/getErpMaterialTask") @PostMapping("/getErpMaterialTask")
@@ -117,20 +117,38 @@ public class ErpMaterialController {
PageResult<ErpMaterialRespVO> pageResult = erpMaterialService.getErpMaterialPageAndOther(pageReqVO); PageResult<ErpMaterialRespVO> pageResult = erpMaterialService.getErpMaterialPageAndOther(pageReqVO);
return success(BeanUtils.toBean(pageResult, ErpMaterialRespVO.class)); return success(BeanUtils.toBean(pageResult, ErpMaterialRespVO.class));
} }
//创建物料拓展关系
@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));
}
//删除物料关系
@DeleteMapping("/deleteErpMaterialCorr")
@Operation(summary = "删除ERP物料关系")
@PreAuthorize("@ss.hasPermission('sply:erp-material:delete')")
public CommonResult<Boolean> deleteErpMaterialCorr(@RequestBody BatchDeleteReqVO req) {
erpMaterialService.deleteErpMaterialCorr(req);
return success(true);
}
//创建物料拓展关系
@PostMapping("/createErpMaterialCorr")
@Operation(summary = "创建ERP物料关系")
@PreAuthorize("@ss.hasPermission('sply:erp-material:create')")
public CommonResult<List<ErpMaterialRespVO>> createErpMaterialCorr(@Valid @RequestBody ErpMaterialCorrSaveReqVO erpMaterialCorrSaveReqVO) {
return success(erpMaterialService.createErpMaterialCorr(erpMaterialCorrSaveReqVO));
}
//删除物料关系
@DeleteMapping("/deleteErpMaterialCorr")
@Operation(summary = "删除ERP物料关系")
@PreAuthorize("@ss.hasPermission('sply:erp-material:delete')")
public CommonResult<Boolean> deleteErpMaterialCorr(@RequestBody BatchDeleteReqVO req) {
erpMaterialService.deleteErpMaterialCorr(req);
return success(true);
}
//通过物料id查询物料详情
@GetMapping("/getErpMaterialById")
@Operation(summary = "通过物料id查询物料详情")
@PreAuthorize("@ss.hasPermission('sply:erp-material:query')")
public CommonResult<ErpMaterialRespVO> getErpMaterialById(@RequestParam("id") Long id) {
ErpMaterialDO erpMaterial = erpMaterialService.getErpMaterialById(id);
return success(BeanUtils.toBean(erpMaterial, ErpMaterialRespVO.class));
}
//通过主物料查询子物料信息
@GetMapping("/getErpMaterialByMainMaterialById")
@Operation(summary = "通过主物料查询子物料信息")
@PreAuthorize("@ss.hasPermission('sply:erp-material:query')")
public CommonResult<List<ErpMaterialRespVO>> getErpMaterialByMainMaterial(@RequestParam("id") Long mainMaterialId) {
List<ErpMaterialDO> erpMaterial = erpMaterialService.getErpMaterialByMainMaterial(mainMaterialId);
return success(BeanUtils.toBean(erpMaterial, ErpMaterialRespVO.class));
}
} }

View File

@@ -1,11 +1,12 @@
package com.zt.plat.module.erp.controller.admin.erp.vo; package com.zt.plat.module.erp.controller.admin.erp.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import java.util.List;
@Schema(description = "管理后台 - 物料拓展关系 Request VO") @Schema(description = "管理后台 - 物料拓展关系 Request VO")
@Data @Data
public class ErpMaterialCorrSaveReqVO { public class ErpMaterialCorrSaveReqVO {
@@ -22,19 +23,25 @@ public class ErpMaterialCorrSaveReqVO {
@NotNull(message = "拓展关系主物料不能为空") @NotNull(message = "拓展关系主物料不能为空")
private Long materialParentId; private Long materialParentId;
/**
* 物料ID
*/
@Schema(description = "物料ID", requiredMode = Schema.RequiredMode.REQUIRED)
private Long materialId;
/** /**
* 拓展关系主物料编号 * 拓展关系主物料编号
*/ */
@Schema(description = "拓展关系主物料编号") @Schema(description = "拓展关系主物料编号")
private String materialParentCode; private String materialParentCode;
/** /**
* 物料编码 * 拓展关系物料
*/ */
@Schema(description = "拓展关系物料编号") @Schema(description = "拓展关系物料")
private String materialCode; 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;
}
} }

View File

@@ -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 {
}

View File

@@ -13,6 +13,8 @@ import java.util.List;
* @author 后台管理 * @author 后台管理
*/ */
public interface ErpErpMaterialCorrService { public interface ErpErpMaterialCorrService {
List<ErpMaterialCorrRspVO> create(@Valid List<ErpMaterialCorrSaveReqVO> reqVO); List<ErpMaterialCorrRspVO> create(@Valid ErpMaterialCorrSaveReqVO reqVO);
void deleteBatch(BatchDeleteReqVO reqVO); void deleteBatch(BatchDeleteReqVO reqVO);
List<ErpMaterialCorrRspVO> getErpMaterialByMainMaterial(Long mainMaterialId);
} }

View File

@@ -10,6 +10,7 @@ import jakarta.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Service @Service
@@ -19,14 +20,27 @@ public class ErpErpMaterialCorrServiceImpl implements ErpErpMaterialCorrService{
private ErpErpMaterialCorrMapper erpErpMaterialCorrMapper; private ErpErpMaterialCorrMapper erpErpMaterialCorrMapper;
@Override @Override
public List<ErpMaterialCorrRspVO> create(List<ErpMaterialCorrSaveReqVO> reqVO) { public List<ErpMaterialCorrRspVO> create(ErpMaterialCorrSaveReqVO reqVO) {
List<ErpMaterialCorrDO> bean = BeanUtils.toBean(reqVO, ErpMaterialCorrDO.class); List<ErpMaterialCorrDO> erpMaterialCorrDOS=new ArrayList<>();
erpErpMaterialCorrMapper.insertBatch(bean); reqVO.getMaterials().forEach(materials -> {
return BeanUtils.toBean(bean, ErpMaterialCorrRspVO.class); 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 @Override
public void deleteBatch(BatchDeleteReqVO reqVO) { public void deleteBatch(BatchDeleteReqVO reqVO) {
erpErpMaterialCorrMapper.deleteByIds(reqVO.getIds()); erpErpMaterialCorrMapper.deleteByIds(reqVO.getIds());
} }
@Override
public List<ErpMaterialCorrRspVO> getErpMaterialByMainMaterial(Long mainMaterialId) {
return BeanUtils.toBean( erpErpMaterialCorrMapper.selectList(ErpMaterialCorrDO::getMaterialParentId, mainMaterialId), ErpMaterialCorrRspVO.class);
}
} }

View File

@@ -269,6 +269,11 @@ public class ErpFactoryServiceImpl implements ErpFactoryService {
private void saveData(ProcessingResult result) { private void saveData(ProcessingResult result) {
// 批量新增和更新 // 批量新增和更新
if (!result.toInsert.isEmpty()) { if (!result.toInsert.isEmpty()) {
//自动绑定工厂
result.toInsert.forEach(r->{
r.setRelName(r.getName());
r.setRelnumber(r.getNumber());
});
erpFactoryMapper.insertBatch(result.toInsert); erpFactoryMapper.insertBatch(result.toInsert);
// 批量查询刚插入数据的id提升效率 // 批量查询刚插入数据的id提升效率
List<String> insertedNumbers = result.toInsert.stream() List<String> insertedNumbers = result.toInsert.stream()

View File

@@ -70,7 +70,11 @@ public interface ErpMaterialService {
String getMaterialUnit(String materialNumber); String getMaterialUnit(String materialNumber);
List<ErpMaterialRespVO> createErpMaterialCorr(List<ErpMaterialCorrSaveReqVO> erpMaterialCorrSaveReqVOS); List<ErpMaterialRespVO> createErpMaterialCorr(ErpMaterialCorrSaveReqVO erpMaterialCorrSaveReqVO);
void deleteErpMaterialCorr(BatchDeleteReqVO reqVO); void deleteErpMaterialCorr(BatchDeleteReqVO reqVO);
ErpMaterialDO getErpMaterialById(Long id);
List<ErpMaterialDO> getErpMaterialByMainMaterial(Long mainMaterialId);
} }

Some files were not shown because too many files have changed in this diff Show More