Merge remote-tracking branch 'origin/dev' into test
This commit is contained in:
@@ -0,0 +1,34 @@
|
|||||||
|
package com.zt.plat.module.contractorder.api.dto.contract;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Schema(description = "金额分配响应DTO")
|
||||||
|
@Data
|
||||||
|
public class AmountSplitRespDTO {
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "17357")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "物料名称", example = "赵六")
|
||||||
|
private String materialName;
|
||||||
|
|
||||||
|
@Schema(description = "物料编码")
|
||||||
|
private String materialCode;
|
||||||
|
|
||||||
|
@Schema(description = "元素缩写")
|
||||||
|
private String elementAbbreviation;
|
||||||
|
|
||||||
|
@Schema(description = "元素名称", example = "张三")
|
||||||
|
private String elementName;
|
||||||
|
|
||||||
|
@Schema(description = "元素编码")
|
||||||
|
private String elementCode;
|
||||||
|
|
||||||
|
@Schema(description = "占比")
|
||||||
|
private BigDecimal ratio;
|
||||||
|
|
||||||
|
@Schema(description = "合同id", example = "3781")
|
||||||
|
private Long contractId;
|
||||||
|
}
|
||||||
@@ -286,4 +286,7 @@ public class ContractRespDTO {
|
|||||||
|
|
||||||
@Schema(description = "收发货规则")
|
@Schema(description = "收发货规则")
|
||||||
private List<ContractReceiveSendRespDTO> contractReceiveSends;
|
private List<ContractReceiveSendRespDTO> contractReceiveSends;
|
||||||
|
|
||||||
|
@Schema(description = "金额拆分")
|
||||||
|
private List<AmountSplitRespDTO> amountSplits;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,11 +125,13 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
private ContractReceiveSendService contractReceiveSendService;
|
private ContractReceiveSendService contractReceiveSendService;
|
||||||
@Resource
|
@Resource
|
||||||
private AmountDismantleService amountDismantleService;
|
private AmountDismantleService amountDismantleService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ContractMainDO> getContractPage(ContractPageReqVO pageReqVO) {
|
public PageResult<ContractMainDO> getContractPage(ContractPageReqVO pageReqVO) {
|
||||||
return contractMainMapper.selectContractPage(pageReqVO);
|
return contractMainMapper.selectContractPage(pageReqVO);
|
||||||
}
|
}
|
||||||
boolean isContractReceiveSendValid(List<ContractReceiveSendSaveReqVO> contractReceiveSends){
|
|
||||||
|
boolean isContractReceiveSendValid(List<ContractReceiveSendSaveReqVO> contractReceiveSends) {
|
||||||
if (CollectionUtils.isEmpty(contractReceiveSends)) {
|
if (CollectionUtils.isEmpty(contractReceiveSends)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -320,7 +322,7 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
//插入资金拆分表
|
//插入资金拆分表
|
||||||
if(reqVO.getAmountSplit() != null && !reqVO.getAmountSplit().isEmpty()){
|
if (reqVO.getAmountSplit() != null && !reqVO.getAmountSplit().isEmpty()) {
|
||||||
reqVO.getAmountSplit().forEach(amountDismantle -> {
|
reqVO.getAmountSplit().forEach(amountDismantle -> {
|
||||||
amountDismantle.setContractId(contractId);
|
amountDismantle.setContractId(contractId);
|
||||||
amountDismantleService.createAmountDismantle(amountDismantle);
|
amountDismantleService.createAmountDismantle(amountDismantle);
|
||||||
@@ -961,22 +963,22 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
submitErp(newContractMainDO.getId());
|
submitErp(newContractMainDO.getId());
|
||||||
}
|
}
|
||||||
//更新收发货规则
|
//更新收发货规则
|
||||||
if (reqVO.getContractReceiveSends() != null && !reqVO.getContractReceiveSends().isEmpty()){
|
if (reqVO.getContractReceiveSends() != null && !reqVO.getContractReceiveSends().isEmpty()) {
|
||||||
//通过合同id删除收发货规则
|
//通过合同id删除收发货规则
|
||||||
List<ContractReceiveSendRespVO> contractReceiveSendListByContract = contractReceiveSendService.getContractReceiveSendListByContractId(id);
|
List<ContractReceiveSendRespVO> contractReceiveSendListByContract = contractReceiveSendService.getContractReceiveSendListByContractId(id);
|
||||||
contractReceiveSendService.deleteContractReceiveSendListByIds(contractReceiveSendListByContract.stream().map(ContractReceiveSendRespVO::getId).toList());
|
contractReceiveSendService.deleteContractReceiveSendListByIds(contractReceiveSendListByContract.stream().map(ContractReceiveSendRespVO::getId).toList());
|
||||||
//重新插入收发货规则
|
//重新插入收发货规则
|
||||||
reqVO.getContractReceiveSends().forEach(item->{
|
reqVO.getContractReceiveSends().forEach(item -> {
|
||||||
item.setContractId(id);
|
item.setContractId(id);
|
||||||
item.setId(null);
|
item.setId(null);
|
||||||
contractReceiveSendService.createContractReceiveSend(item);
|
contractReceiveSendService.createContractReceiveSend(item);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//更新资金拆分表(直接先删除后面再插入)
|
//更新资金拆分表(直接先删除后面再插入)
|
||||||
if (reqVO.getAmountSplit()!=null &&!reqVO.getAmountSplit().isEmpty()){
|
if (reqVO.getAmountSplit() != null && !reqVO.getAmountSplit().isEmpty()) {
|
||||||
List<AmountDismantleDO> amountDismantleList = amountDismantleService.getAmountDismantleListByContractId(id);
|
List<AmountDismantleDO> amountDismantleList = amountDismantleService.getAmountDismantleListByContractId(id);
|
||||||
amountDismantleService.deleteAmountDismantleListByIds(amountDismantleList.stream().map(AmountDismantleDO::getId).toList());
|
amountDismantleService.deleteAmountDismantleListByIds(amountDismantleList.stream().map(AmountDismantleDO::getId).toList());
|
||||||
reqVO.getAmountSplit().forEach(item->{
|
reqVO.getAmountSplit().forEach(item -> {
|
||||||
item.setContractId(id);
|
item.setContractId(id);
|
||||||
item.setId(null);
|
item.setId(null);
|
||||||
amountDismantleService.createAmountDismantle(item);
|
amountDismantleService.createAmountDismantle(item);
|
||||||
@@ -1420,10 +1422,14 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
}
|
}
|
||||||
//收发货
|
//收发货
|
||||||
List<ContractReceiveSendRespVO> contractReceiveSendListByContractId = contractReceiveSendService.getContractReceiveSendListByContractId(contractMainDO.getId());
|
List<ContractReceiveSendRespVO> contractReceiveSendListByContractId = contractReceiveSendService.getContractReceiveSendListByContractId(contractMainDO.getId());
|
||||||
if (contractReceiveSendListByContractId!=null&&!contractReceiveSendListByContractId.isEmpty()){
|
if (contractReceiveSendListByContractId != null && !contractReceiveSendListByContractId.isEmpty()) {
|
||||||
respDTO.setContractReceiveSends(BeanUtils.toBean(contractReceiveSendListByContractId, ContractReceiveSendRespDTO.class));
|
respDTO.setContractReceiveSends(BeanUtils.toBean(contractReceiveSendListByContractId, ContractReceiveSendRespDTO.class));
|
||||||
}
|
}
|
||||||
|
//金额拆分
|
||||||
|
List<AmountDismantleDO> amountDismantleListByContractId = amountDismantleService.getAmountDismantleListByContractId(contractMainDO.getId());
|
||||||
|
if (amountDismantleListByContractId != null && !amountDismantleListByContractId.isEmpty()) {
|
||||||
|
respDTO.setAmountSplits(BeanUtils.toBean(amountDismantleListByContractId,AmountSplitRespDTO.class));
|
||||||
|
}
|
||||||
return respDTO;
|
return respDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1513,16 +1519,19 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
}
|
}
|
||||||
//收发货
|
//收发货
|
||||||
List<ContractReceiveSendRespVO> contractReceiveSendListByContractId = contractReceiveSendService.getContractReceiveSendListByContractId(contractMainDO.getId());
|
List<ContractReceiveSendRespVO> contractReceiveSendListByContractId = contractReceiveSendService.getContractReceiveSendListByContractId(contractMainDO.getId());
|
||||||
if (contractReceiveSendListByContractId!=null&&!contractReceiveSendListByContractId.isEmpty()){
|
if (contractReceiveSendListByContractId != null && !contractReceiveSendListByContractId.isEmpty()) {
|
||||||
respDTO.setContractReceiveSends(BeanUtils.toBean(contractReceiveSendListByContractId, ContractReceiveSendRespDTO.class));
|
respDTO.setContractReceiveSends(BeanUtils.toBean(contractReceiveSendListByContractId, ContractReceiveSendRespDTO.class));
|
||||||
}
|
}
|
||||||
|
//金额拆分
|
||||||
|
List<AmountDismantleDO> amountDismantleListByContractId = amountDismantleService.getAmountDismantleListByContractId(contractMainDO.getId());
|
||||||
|
if (amountDismantleListByContractId != null && !amountDismantleListByContractId.isEmpty()) {
|
||||||
|
respDTO.setAmountSplits(BeanUtils.toBean(amountDismantleListByContractId,AmountSplitRespDTO.class));
|
||||||
|
}
|
||||||
|
|
||||||
return respDTO;
|
return respDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject submitErp(Long id) {
|
public JSONObject submitErp(Long id) {
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public interface ErrorCodeConstants {
|
|||||||
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, "主物料信息错误");
|
ErrorCode MATERIAL_ERROR = new ErrorCode( 1_017_000_009, "主物料信息错误");
|
||||||
|
ErrorCode CUSTOM_ERROR = new ErrorCode(1_017_000_010, "{}");
|
||||||
ErrorCode INTERNAL_WAREHOUSE_NOT_EXISTS= new ErrorCode(1_017_000_011,"内部仓库不存在");
|
ErrorCode INTERNAL_WAREHOUSE_NOT_EXISTS= new ErrorCode(1_017_000_011,"内部仓库不存在");
|
||||||
ErrorCode INTERNAL_WAREHOUSE_EXISTS=new ErrorCode(1_017_000_012,"内部仓库已存在");
|
ErrorCode INTERNAL_WAREHOUSE_EXISTS=new ErrorCode(1_017_000_012,"内部仓库已存在");
|
||||||
ErrorCode WAREHOUSE_FACTORY_NOT_EXISTS=new ErrorCode(1_017_000_010,"库位与工厂信息不存在");
|
ErrorCode WAREHOUSE_FACTORY_NOT_EXISTS=new ErrorCode(1_017_000_010,"库位与工厂信息不存在");
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ public class ErpMaterialController implements BusinessControllerMarker {
|
|||||||
@DeleteMapping("/deleteErpMaterialCorr")
|
@DeleteMapping("/deleteErpMaterialCorr")
|
||||||
@Operation(summary = "删除ERP物料关系")
|
@Operation(summary = "删除ERP物料关系")
|
||||||
@PreAuthorize("@ss.hasAnyPermissions({'sply:erp-material:delete','basic:material-config:delete'})")
|
@PreAuthorize("@ss.hasAnyPermissions({'sply:erp-material:delete','basic:material-config:delete'})")
|
||||||
public CommonResult<Boolean> deleteErpMaterialCorr(@RequestBody BatchDeleteReqVO req) {
|
public CommonResult<Boolean> deleteErpMaterialCorr(@RequestBody DeleteErpMaterialCorrVO req) {
|
||||||
erpMaterialService.deleteErpMaterialCorr(req);
|
erpMaterialService.deleteErpMaterialCorr(req);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
@@ -148,8 +148,8 @@ public class ErpMaterialController implements BusinessControllerMarker {
|
|||||||
@GetMapping("/getErpMaterialByMainMaterialById")
|
@GetMapping("/getErpMaterialByMainMaterialById")
|
||||||
@Operation(summary = "通过主物料查询子物料信息")
|
@Operation(summary = "通过主物料查询子物料信息")
|
||||||
@PreAuthorize("@ss.hasAnyPermissions({'sply:erp-material:query','basic:material-config:query'})")
|
@PreAuthorize("@ss.hasAnyPermissions({'sply:erp-material:query','basic:material-config:query'})")
|
||||||
public CommonResult<List<ErpMaterialRespVO>> getErpMaterialByMainMaterial(@RequestParam("id") Long mainMaterialId) {
|
public CommonResult<List<ErpMaterialRespVO>> getErpMaterialByMainMaterial(@RequestParam("id") Long mainMaterialId, @RequestParam(value = "deptId",required = false) String companyCode) {
|
||||||
List<ErpMaterialRespVO> erpMaterial = erpMaterialService.getErpMaterialByMainMaterial(mainMaterialId);
|
List<ErpMaterialRespVO> erpMaterial = erpMaterialService.getErpMaterialByMainMaterial(mainMaterialId, companyCode);
|
||||||
return success(BeanUtils.toBean(erpMaterial, ErpMaterialRespVO.class));
|
return success(BeanUtils.toBean(erpMaterial, ErpMaterialRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,13 +158,8 @@ public class ErpMaterialController implements BusinessControllerMarker {
|
|||||||
@Operation(summary = "通过接口查询物料")
|
@Operation(summary = "通过接口查询物料")
|
||||||
@PreAuthorize("@ss.hasAnyPermissions({'sply:erp-material:query','basic:material-config:query'})")
|
@PreAuthorize("@ss.hasAnyPermissions({'sply:erp-material:query','basic:material-config:query'})")
|
||||||
public CommonResult<PageResult<ErpMaterialRespVO>> getErpMaterialByApi(@RequestBody MaterialInfomationApiVO vo) {
|
public CommonResult<PageResult<ErpMaterialRespVO>> getErpMaterialByApi(@RequestBody MaterialInfomationApiVO vo) {
|
||||||
DepartmentMaterialPageReqDTO material = new DepartmentMaterialPageReqDTO();
|
PageResult<ErpMaterialDO> erpMaterialByApi = erpMaterialService.getErpMaterialByApi(vo);
|
||||||
material.setMaterialNumber(vo.getMaterialNumber());
|
|
||||||
material.setMaterialName(vo.getMaterialName());
|
|
||||||
material.setPageSize(vo.getPageSize());
|
|
||||||
material.setPageNo(vo.getPageNo());
|
|
||||||
material.setDeptId(Long.valueOf(vo.getDeptId()));
|
|
||||||
PageResult<ErpMaterialDO> erpMaterialByApi = erpMaterialService.getErpMaterialByApi(material);
|
|
||||||
return success(BeanUtils.toBean(erpMaterialByApi, ErpMaterialRespVO.class));
|
return success(BeanUtils.toBean(erpMaterialByApi, ErpMaterialRespVO.class));
|
||||||
}
|
}
|
||||||
//通过主物料查询子物料信息
|
//通过主物料查询子物料信息
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.zt.plat.module.erp.controller.admin.erp.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(description = "删除ErpMaterialCorr请求参数")
|
||||||
|
public class DeleteErpMaterialCorrVO {
|
||||||
|
@Schema(description = "materialIds")
|
||||||
|
private List<Long> materialIds;
|
||||||
|
@Schema(description = "主物料Id")
|
||||||
|
private Long materialParentId;
|
||||||
|
}
|
||||||
@@ -35,4 +35,26 @@ public class ErpMaterialCorrRspVO {
|
|||||||
*/
|
*/
|
||||||
@Schema(description = "拓展关系物料编号")
|
@Schema(description = "拓展关系物料编号")
|
||||||
private String materialCode;
|
private String materialCode;
|
||||||
|
/**
|
||||||
|
* 公司编码
|
||||||
|
*/
|
||||||
|
@Schema(description = "公司编码")
|
||||||
|
@NotNull(message = "公司编码不能为空")
|
||||||
|
private String companyId;
|
||||||
|
/**
|
||||||
|
* 公司编码
|
||||||
|
*/
|
||||||
|
@Schema(description = "公司编码")
|
||||||
|
private String companyCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "部门ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private Long deptId;
|
||||||
|
/**
|
||||||
|
* 部门编码
|
||||||
|
*/
|
||||||
|
@Schema(description = "部门编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String deptCode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.zt.plat.module.erp.controller.admin.erp.vo;
|
package com.zt.plat.module.erp.controller.admin.erp.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
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;
|
||||||
@@ -28,6 +29,22 @@ public class ErpMaterialCorrSaveReqVO {
|
|||||||
*/
|
*/
|
||||||
@Schema(description = "拓展关系主物料编号")
|
@Schema(description = "拓展关系主物料编号")
|
||||||
private String materialParentCode;
|
private String materialParentCode;
|
||||||
|
/**
|
||||||
|
* 公司编码
|
||||||
|
*/
|
||||||
|
@Schema(description = "公司编码")
|
||||||
|
private String companyCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "部门ID")
|
||||||
|
private Long deptId;
|
||||||
|
/**
|
||||||
|
* 部门编码
|
||||||
|
*/
|
||||||
|
@Schema(description = "部门编码")
|
||||||
|
private String deptCode;
|
||||||
/**
|
/**
|
||||||
* 拓展关系物料
|
* 拓展关系物料
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class WarehouseFactoryPageReqVO extends PageParam {
|
|||||||
private String operationType;
|
private String operationType;
|
||||||
|
|
||||||
@Schema(description = "业务类型", example = "2")
|
@Schema(description = "业务类型", example = "2")
|
||||||
private String mMSIType;
|
private String mmsiType;
|
||||||
|
|
||||||
@Schema(description = "erp源工厂名称", example = "赵六")
|
@Schema(description = "erp源工厂名称", example = "赵六")
|
||||||
private String erpSourceFactoryName;
|
private String erpSourceFactoryName;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class WarehouseFactoryRespVO {
|
|||||||
|
|
||||||
@Schema(description = "业务类型", example = "2")
|
@Schema(description = "业务类型", example = "2")
|
||||||
@ExcelProperty("业务类型")
|
@ExcelProperty("业务类型")
|
||||||
private String mMSIType;
|
private String mmsiType;
|
||||||
|
|
||||||
@Schema(description = "erp源工厂名称", example = "赵六")
|
@Schema(description = "erp源工厂名称", example = "赵六")
|
||||||
@ExcelProperty("erp源工厂名称")
|
@ExcelProperty("erp源工厂名称")
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class WarehouseFactorySaveReqVO {
|
|||||||
private String operationType;
|
private String operationType;
|
||||||
|
|
||||||
@Schema(description = "业务类型", example = "2")
|
@Schema(description = "业务类型", example = "2")
|
||||||
private String mMSIType;
|
private String mmsiType;
|
||||||
|
|
||||||
@Schema(description = "erp源工厂名称", example = "赵六")
|
@Schema(description = "erp源工厂名称", example = "赵六")
|
||||||
private String erpSourceFactoryName;
|
private String erpSourceFactoryName;
|
||||||
|
|||||||
@@ -50,4 +50,30 @@ public class ErpMaterialCorrDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
@TableField("MTRL_CODE")
|
@TableField("MTRL_CODE")
|
||||||
private String materialCode;
|
private String materialCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司ID
|
||||||
|
*/
|
||||||
|
|
||||||
|
@TableField("COMPANY_ID")
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司编码
|
||||||
|
*/
|
||||||
|
|
||||||
|
@TableField("COMPANY_CODE")
|
||||||
|
private String companyCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门ID
|
||||||
|
*/
|
||||||
|
@TableField("DEPT_ID")
|
||||||
|
private Long deptId;
|
||||||
|
/**
|
||||||
|
* 部门编码
|
||||||
|
*/
|
||||||
|
@TableField("DEPT_CODE")
|
||||||
|
private String deptCode;
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ public class WarehouseFactoryDO extends BusinessBaseDO {
|
|||||||
* 业务类型
|
* 业务类型
|
||||||
*/
|
*/
|
||||||
@TableField("MMSI_TP")
|
@TableField("MMSI_TP")
|
||||||
private String mMSIType;
|
private String mmsiType;
|
||||||
/**
|
/**
|
||||||
* erp源工厂名称
|
* erp源工厂名称
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public interface WarehouseFactoryMapper extends BaseMapperX<WarehouseFactoryDO>
|
|||||||
.eqIfPresent(WarehouseFactoryDO::getCompanyNameCustom, reqVO.getCompanyNameCustom())
|
.eqIfPresent(WarehouseFactoryDO::getCompanyNameCustom, reqVO.getCompanyNameCustom())
|
||||||
.eqIfPresent(WarehouseFactoryDO::getCompanyIdCustom, reqVO.getCompanyIdCustom())
|
.eqIfPresent(WarehouseFactoryDO::getCompanyIdCustom, reqVO.getCompanyIdCustom())
|
||||||
.eqIfPresent(WarehouseFactoryDO::getOperationType, reqVO.getOperationType())
|
.eqIfPresent(WarehouseFactoryDO::getOperationType, reqVO.getOperationType())
|
||||||
.eqIfPresent(WarehouseFactoryDO::getMMSIType, reqVO.getMMSIType())
|
.eqIfPresent(WarehouseFactoryDO::getMmsiType, reqVO.getMmsiType())
|
||||||
.likeIfPresent(WarehouseFactoryDO::getErpSourceFactoryName, reqVO.getErpSourceFactoryName())
|
.likeIfPresent(WarehouseFactoryDO::getErpSourceFactoryName, reqVO.getErpSourceFactoryName())
|
||||||
.eqIfPresent(WarehouseFactoryDO::getErpSourceFactoryNumber, reqVO.getErpSourceFactoryNumber())
|
.eqIfPresent(WarehouseFactoryDO::getErpSourceFactoryNumber, reqVO.getErpSourceFactoryNumber())
|
||||||
.likeIfPresent(WarehouseFactoryDO::getErpSourceWarehouseName, reqVO.getErpSourceWarehouseName())
|
.likeIfPresent(WarehouseFactoryDO::getErpSourceWarehouseName, reqVO.getErpSourceWarehouseName())
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.zt.plat.module.erp.service.erp;
|
package com.zt.plat.module.erp.service.erp;
|
||||||
|
|
||||||
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
|
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
|
||||||
|
import com.zt.plat.module.erp.controller.admin.erp.vo.DeleteErpMaterialCorrVO;
|
||||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialCorrRspVO;
|
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialCorrRspVO;
|
||||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialCorrSaveReqVO;
|
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialCorrSaveReqVO;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
@@ -14,9 +15,11 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface ErpErpMaterialCorrService {
|
public interface ErpErpMaterialCorrService {
|
||||||
List<ErpMaterialCorrRspVO> create(@Valid ErpMaterialCorrSaveReqVO reqVO);
|
List<ErpMaterialCorrRspVO> create(@Valid ErpMaterialCorrSaveReqVO reqVO);
|
||||||
void deleteBatch(BatchDeleteReqVO reqVO);
|
void deleteBatch(DeleteErpMaterialCorrVO reqVO);
|
||||||
|
|
||||||
List<ErpMaterialCorrRspVO> getErpMaterialByMainMaterial(List<Long> mainMaterialIds);
|
List<ErpMaterialCorrRspVO> getErpMaterialByMainMaterial(List<Long> mainMaterialIds, String companyCode);
|
||||||
|
|
||||||
List<ErpMaterialCorrRspVO> getErpMaterialByMainMaterialByCode(String code);
|
List<ErpMaterialCorrRspVO> getErpMaterialByMainMaterialByCode(String code,String companyCode);
|
||||||
|
|
||||||
|
List<ErpMaterialCorrRspVO> getErpMaterialByCompanyCode(String CompanyCode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package com.zt.plat.module.erp.service.erp;
|
|||||||
|
|
||||||
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
|
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
|
||||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||||
|
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.zt.plat.module.erp.controller.admin.erp.vo.DeleteErpMaterialCorrVO;
|
||||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialCorrRspVO;
|
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialCorrRspVO;
|
||||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialCorrSaveReqVO;
|
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialCorrSaveReqVO;
|
||||||
import com.zt.plat.module.erp.dal.dataobject.erp.ErpMaterialCorrDO;
|
import com.zt.plat.module.erp.dal.dataobject.erp.ErpMaterialCorrDO;
|
||||||
@@ -23,6 +25,10 @@ public class ErpErpMaterialCorrServiceImpl implements ErpErpMaterialCorrService{
|
|||||||
public List<ErpMaterialCorrRspVO> create(ErpMaterialCorrSaveReqVO reqVO) {
|
public List<ErpMaterialCorrRspVO> create(ErpMaterialCorrSaveReqVO reqVO) {
|
||||||
List<ErpMaterialCorrDO> erpMaterialCorrDOS=new ArrayList<>();
|
List<ErpMaterialCorrDO> erpMaterialCorrDOS=new ArrayList<>();
|
||||||
reqVO.getMaterials().forEach(materials -> {
|
reqVO.getMaterials().forEach(materials -> {
|
||||||
|
//判断是否存在
|
||||||
|
if (erpErpMaterialCorrMapper.selectOne(ErpMaterialCorrDO::getMaterialParentId,reqVO.getMaterialParentId(), ErpMaterialCorrDO::getMaterialId,materials.getMaterialId()) != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
erpMaterialCorrDOS.add(ErpMaterialCorrDO.builder()
|
erpMaterialCorrDOS.add(ErpMaterialCorrDO.builder()
|
||||||
.materialParentId(reqVO.getMaterialParentId())
|
.materialParentId(reqVO.getMaterialParentId())
|
||||||
.materialParentCode(reqVO.getMaterialParentCode())
|
.materialParentCode(reqVO.getMaterialParentCode())
|
||||||
@@ -35,17 +41,30 @@ public class ErpErpMaterialCorrServiceImpl implements ErpErpMaterialCorrService{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteBatch(BatchDeleteReqVO reqVO) {
|
public void deleteBatch(DeleteErpMaterialCorrVO reqVO) {
|
||||||
erpErpMaterialCorrMapper.deleteByIds(reqVO.getIds());
|
erpErpMaterialCorrMapper.delete(new LambdaQueryWrapperX<ErpMaterialCorrDO>()
|
||||||
|
.eq(ErpMaterialCorrDO::getMaterialParentId, reqVO.getMaterialParentId())
|
||||||
|
.in(ErpMaterialCorrDO::getMaterialId, reqVO.getMaterialIds()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ErpMaterialCorrRspVO> getErpMaterialByMainMaterial(List<Long> mainMaterialIds) {
|
public List<ErpMaterialCorrRspVO> getErpMaterialByMainMaterial(List<Long> mainMaterialIds, String companyCode) {
|
||||||
return BeanUtils.toBean( erpErpMaterialCorrMapper.selectList(ErpMaterialCorrDO::getMaterialParentId, mainMaterialIds), ErpMaterialCorrRspVO.class);
|
LambdaQueryWrapperX<ErpMaterialCorrDO> erpMaterialCorrDOLambdaQueryWrapperX = new LambdaQueryWrapperX<>();
|
||||||
|
erpMaterialCorrDOLambdaQueryWrapperX.in(ErpMaterialCorrDO::getMaterialParentId, mainMaterialIds);
|
||||||
|
erpMaterialCorrDOLambdaQueryWrapperX.eqIfPresent(ErpMaterialCorrDO::getCompanyCode, companyCode);
|
||||||
|
return BeanUtils.toBean( erpErpMaterialCorrMapper.selectList(erpMaterialCorrDOLambdaQueryWrapperX), ErpMaterialCorrRspVO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ErpMaterialCorrRspVO> getErpMaterialByMainMaterialByCode(String code) {
|
public List<ErpMaterialCorrRspVO> getErpMaterialByMainMaterialByCode(String code, String companyCode) {
|
||||||
return BeanUtils.toBean(erpErpMaterialCorrMapper.selectList(ErpMaterialCorrDO::getMaterialParentCode, code), ErpMaterialCorrRspVO.class);
|
LambdaQueryWrapperX<ErpMaterialCorrDO> erpMaterialCorrDOLambdaQueryWrapperX = new LambdaQueryWrapperX<>();
|
||||||
|
erpMaterialCorrDOLambdaQueryWrapperX.eq(ErpMaterialCorrDO::getMaterialParentCode, code);
|
||||||
|
erpMaterialCorrDOLambdaQueryWrapperX.eqIfPresent(ErpMaterialCorrDO::getCompanyCode, companyCode);
|
||||||
|
return BeanUtils.toBean(erpErpMaterialCorrMapper.selectList(erpMaterialCorrDOLambdaQueryWrapperX), ErpMaterialCorrRspVO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ErpMaterialCorrRspVO> getErpMaterialByCompanyCode(String CompanyCode) {
|
||||||
|
return BeanUtils.toBean(erpErpMaterialCorrMapper.selectList(ErpMaterialCorrDO::getCompanyCode, CompanyCode), ErpMaterialCorrRspVO.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,7 @@ import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
|
|||||||
import com.zt.plat.module.base.api.departmentmaterial.dto.DepartmentMaterialPageReqDTO;
|
import com.zt.plat.module.base.api.departmentmaterial.dto.DepartmentMaterialPageReqDTO;
|
||||||
import com.zt.plat.module.base.api.materialinfomation.dto.MaterialInfomationPageReqDTO;
|
import com.zt.plat.module.base.api.materialinfomation.dto.MaterialInfomationPageReqDTO;
|
||||||
import com.zt.plat.module.erp.api.dto.ErpMaterialDTO;
|
import com.zt.plat.module.erp.api.dto.ErpMaterialDTO;
|
||||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialCorrSaveReqVO;
|
import com.zt.plat.module.erp.controller.admin.erp.vo.*;
|
||||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialPageReqVO;
|
|
||||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialRespVO;
|
|
||||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialSaveReqVO;
|
|
||||||
import com.zt.plat.module.erp.dal.dataobject.erp.ErpMaterialDO;
|
import com.zt.plat.module.erp.dal.dataobject.erp.ErpMaterialDO;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
@@ -74,13 +71,13 @@ public interface ErpMaterialService {
|
|||||||
|
|
||||||
List<ErpMaterialRespVO> createErpMaterialCorr(ErpMaterialCorrSaveReqVO erpMaterialCorrSaveReqVO);
|
List<ErpMaterialRespVO> createErpMaterialCorr(ErpMaterialCorrSaveReqVO erpMaterialCorrSaveReqVO);
|
||||||
|
|
||||||
void deleteErpMaterialCorr(BatchDeleteReqVO reqVO);
|
void deleteErpMaterialCorr(DeleteErpMaterialCorrVO reqVO);
|
||||||
|
|
||||||
ErpMaterialDO getErpMaterialById(Long id);
|
ErpMaterialDO getErpMaterialById(Long id);
|
||||||
|
|
||||||
List<ErpMaterialRespVO> getErpMaterialByMainMaterial(Long mainMaterialId);
|
List<ErpMaterialRespVO> getErpMaterialByMainMaterial(Long mainMaterialId, String companyCode);
|
||||||
|
|
||||||
PageResult<ErpMaterialDO> getErpMaterialByApi( DepartmentMaterialPageReqDTO material);
|
PageResult<ErpMaterialDO> getErpMaterialByApi( MaterialInfomationApiVO vo);
|
||||||
|
|
||||||
List<ErpMaterialDO> getErpMaterialByMainMaterialByCode(String code,String deptId);
|
List<ErpMaterialDO> getErpMaterialByMainMaterialByCode(String code,String deptId);
|
||||||
|
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ public class ErpMaterialServiceImpl implements ErpMaterialService {
|
|||||||
private ErpMaterialRespVO buildErpMaterialRespDataById(Long id) {
|
private ErpMaterialRespVO buildErpMaterialRespDataById(Long id) {
|
||||||
DepartmentMaterialPageReqDTO departmentMaterialPageReqDTO = new DepartmentMaterialPageReqDTO();
|
DepartmentMaterialPageReqDTO departmentMaterialPageReqDTO = new DepartmentMaterialPageReqDTO();
|
||||||
departmentMaterialPageReqDTO.setInfomationId(id);
|
departmentMaterialPageReqDTO.setInfomationId(id);
|
||||||
departmentMaterialPageReqDTO.setPageSize(PAGE_SIZE_NONE);
|
departmentMaterialPageReqDTO.setPageSize(10000);
|
||||||
PageResult<DepartmentMaterialRespDTO> data = departmentMaterialApi.getDepartmentMaterialPage(departmentMaterialPageReqDTO).getData();
|
PageResult<DepartmentMaterialRespDTO> data = departmentMaterialApi.getDepartmentMaterialPage(departmentMaterialPageReqDTO).getData();
|
||||||
if (data == null || data.getList().isEmpty()) {
|
if (data == null || data.getList().isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
@@ -255,7 +255,7 @@ public class ErpMaterialServiceImpl implements ErpMaterialService {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteErpMaterialCorr(BatchDeleteReqVO reqVO) {
|
public void deleteErpMaterialCorr(DeleteErpMaterialCorrVO reqVO) {
|
||||||
erpMaterialCorrService.deleteBatch(reqVO);
|
erpMaterialCorrService.deleteBatch(reqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,8 +272,8 @@ public class ErpMaterialServiceImpl implements ErpMaterialService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ErpMaterialRespVO> getErpMaterialByMainMaterial(Long mainMaterial) {
|
public List<ErpMaterialRespVO> getErpMaterialByMainMaterial(Long mainMaterial, String companyCode) {
|
||||||
List<ErpMaterialCorrRspVO> erpMaterialByMainMaterial = erpMaterialCorrService.getErpMaterialByMainMaterial(List.of(mainMaterial));
|
List<ErpMaterialCorrRspVO> erpMaterialByMainMaterial = erpMaterialCorrService.getErpMaterialByMainMaterial(List.of(mainMaterial), companyCode);
|
||||||
List<ErpMaterialDO> erpMaterialDOList = new ArrayList<>();
|
List<ErpMaterialDO> erpMaterialDOList = new ArrayList<>();
|
||||||
List<ErpMaterialRespVO> erpMaterialRespVOS = new ArrayList<>();
|
List<ErpMaterialRespVO> erpMaterialRespVOS = new ArrayList<>();
|
||||||
if (erpMaterialByMainMaterial.isEmpty()) {
|
if (erpMaterialByMainMaterial.isEmpty()) {
|
||||||
@@ -284,6 +284,7 @@ public class ErpMaterialServiceImpl implements ErpMaterialService {
|
|||||||
DepartmentMaterialPageReqDTO departmentMaterialPageReqDTO = new DepartmentMaterialPageReqDTO();
|
DepartmentMaterialPageReqDTO departmentMaterialPageReqDTO = new DepartmentMaterialPageReqDTO();
|
||||||
departmentMaterialPageReqDTO.setInfomationIds(mIds);
|
departmentMaterialPageReqDTO.setInfomationIds(mIds);
|
||||||
departmentMaterialPageReqDTO.setPageSize(10000);
|
departmentMaterialPageReqDTO.setPageSize(10000);
|
||||||
|
departmentMaterialPageReqDTO.setDeptId(erpMaterialByMainMaterial.get(0).getDeptId());
|
||||||
PageResult<DepartmentMaterialRespDTO> departmentMaterialPage = departmentMaterialApi.getDepartmentMaterialPage(departmentMaterialPageReqDTO).getData();
|
PageResult<DepartmentMaterialRespDTO> departmentMaterialPage = departmentMaterialApi.getDepartmentMaterialPage(departmentMaterialPageReqDTO).getData();
|
||||||
if (departmentMaterialPage == null || departmentMaterialPage.getList() == null || departmentMaterialPage.getList().isEmpty()) {
|
if (departmentMaterialPage == null || departmentMaterialPage.getList() == null || departmentMaterialPage.getList().isEmpty()) {
|
||||||
return erpMaterialRespVOS;
|
return erpMaterialRespVOS;
|
||||||
@@ -294,24 +295,26 @@ public class ErpMaterialServiceImpl implements ErpMaterialService {
|
|||||||
erpMaterialDOList.add(erpMaterialDO);
|
erpMaterialDOList.add(erpMaterialDO);
|
||||||
});
|
});
|
||||||
erpMaterialRespVOS = BeanUtils.toBean(erpMaterialDOList, ErpMaterialRespVO.class);
|
erpMaterialRespVOS = BeanUtils.toBean(erpMaterialDOList, ErpMaterialRespVO.class);
|
||||||
erpMaterialRespVOS.forEach(
|
|
||||||
m -> {
|
|
||||||
erpMaterialByMainMaterial.forEach(
|
|
||||||
i -> {
|
|
||||||
if (Objects.equals(m.getId(), i.getMaterialId())) {
|
|
||||||
m.setCorrId(i.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return erpMaterialRespVOS;
|
return erpMaterialRespVOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ErpMaterialDO> getErpMaterialByApi(DepartmentMaterialPageReqDTO material) {
|
public PageResult<ErpMaterialDO> getErpMaterialByApi(MaterialInfomationApiVO vo) {
|
||||||
|
//通过部门编码查询数据库,获取到部门ID
|
||||||
|
List<ErpMaterialCorrRspVO> erpMaterialByCompanyCode = erpMaterialCorrService.getErpMaterialByMainMaterialByCode(vo.getDeptId(), vo.getDeptId());
|
||||||
|
if (erpMaterialByCompanyCode.isEmpty()) {
|
||||||
|
return new PageResult<>();
|
||||||
|
}
|
||||||
|
Set<Long> collect = erpMaterialByCompanyCode.stream().map(ErpMaterialCorrRspVO::getDeptId).collect(Collectors.toSet());
|
||||||
|
DepartmentMaterialPageReqDTO material = new DepartmentMaterialPageReqDTO();
|
||||||
|
material.setMaterialNumber(vo.getMaterialNumber());
|
||||||
|
material.setMaterialName(vo.getMaterialName());
|
||||||
|
material.setPageSize(vo.getPageSize());
|
||||||
|
material.setPageNo(vo.getPageNo());
|
||||||
|
material.setDeptId(collect.iterator().next());
|
||||||
CommonResult<PageResult<DepartmentMaterialRespDTO>> departmentMaterialPage = departmentMaterialApi.getDepartmentMaterialPage(material);
|
CommonResult<PageResult<DepartmentMaterialRespDTO>> departmentMaterialPage = departmentMaterialApi.getDepartmentMaterialPage(material);
|
||||||
List<ErpMaterialDO> erpMaterialDOList = new ArrayList<>();
|
List<ErpMaterialDO> erpMaterialDOList = new ArrayList<>();
|
||||||
|
//开始时间
|
||||||
if (departmentMaterialPage.getData() != null && departmentMaterialPage.getData().getList() != null && !departmentMaterialPage.getData().getList().isEmpty()) {
|
if (departmentMaterialPage.getData() != null && departmentMaterialPage.getData().getList() != null && !departmentMaterialPage.getData().getList().isEmpty()) {
|
||||||
departmentMaterialPage.getData().getList().forEach(materialInfomation -> {
|
departmentMaterialPage.getData().getList().forEach(materialInfomation -> {
|
||||||
ErpMaterialDO erpMaterialDO = buildErpMaterialDOData(CommonResult.success(materialInfomation));
|
ErpMaterialDO erpMaterialDO = buildErpMaterialDOData(CommonResult.success(materialInfomation));
|
||||||
@@ -322,13 +325,22 @@ public class ErpMaterialServiceImpl implements ErpMaterialService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ErpMaterialDO> getErpMaterialByMainMaterialByCode(String code, String deptId) {
|
public List<ErpMaterialDO> getErpMaterialByMainMaterialByCode(String code, String companyCode) {
|
||||||
|
List<ErpMaterialDO> erpMaterialDOList = new ArrayList<>();
|
||||||
DepartmentMaterialPageReqDTO material = new DepartmentMaterialPageReqDTO();
|
DepartmentMaterialPageReqDTO material = new DepartmentMaterialPageReqDTO();
|
||||||
material.setMaterialNumber(code);
|
material.setMaterialNumber(code);
|
||||||
material.setPageSize(10000);
|
material.setPageSize(10000);
|
||||||
material.setDeptId(Long.valueOf(deptId));
|
List<ErpMaterialCorrRspVO> erpMaterialByCompanyCode = erpMaterialCorrService.getErpMaterialByCompanyCode(companyCode);
|
||||||
|
if (erpMaterialByCompanyCode.isEmpty()) {
|
||||||
|
return erpMaterialDOList;
|
||||||
|
}
|
||||||
|
Set<Long> collect = erpMaterialByCompanyCode.stream().map(ErpMaterialCorrRspVO::getDeptId).collect(Collectors.toSet());
|
||||||
|
if (collect.size() != 1) {
|
||||||
|
throw exception(CUSTOM_ERROR, "部门编码不唯一或部门编码不存在");
|
||||||
|
}
|
||||||
|
material.setDeptId(collect.iterator().next());
|
||||||
CommonResult<PageResult<DepartmentMaterialRespDTO>> departmentMaterialPage = departmentMaterialApi.getDepartmentMaterialPage(material);
|
CommonResult<PageResult<DepartmentMaterialRespDTO>> departmentMaterialPage = departmentMaterialApi.getDepartmentMaterialPage(material);
|
||||||
List<ErpMaterialDO> erpMaterialDOList = new ArrayList<>();
|
|
||||||
if (departmentMaterialPage.isSuccess() && departmentMaterialPage.getData() != null && !departmentMaterialPage.getData().getList().isEmpty()) {
|
if (departmentMaterialPage.isSuccess() && departmentMaterialPage.getData() != null && !departmentMaterialPage.getData().getList().isEmpty()) {
|
||||||
departmentMaterialPage.getData().getList().forEach(materialInfomation -> {
|
departmentMaterialPage.getData().getList().forEach(materialInfomation -> {
|
||||||
ErpMaterialDO erpMaterialDO = buildErpMaterialDOData(CommonResult.success(materialInfomation));
|
ErpMaterialDO erpMaterialDO = buildErpMaterialDOData(CommonResult.success(materialInfomation));
|
||||||
@@ -340,21 +352,39 @@ public class ErpMaterialServiceImpl implements ErpMaterialService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ErpMaterialDO> getErpMaterialByApiByCode(String code, String deptId) {
|
public List<ErpMaterialDO> getErpMaterialByApiByCode(String code, String companyCode) {
|
||||||
List<ErpMaterialDO> erpMaterialDOList = new ArrayList<>();
|
List<ErpMaterialDO> erpMaterialDOList = new ArrayList<>();
|
||||||
//获取该物料编码下的所有物料id,并根据这个ID查询子物料
|
//获取该物料编码下的所有物料id,并根据这个ID查询子物料
|
||||||
List<ErpMaterialCorrRspVO> erpMaterialByMainMaterialByCode = erpMaterialCorrService.getErpMaterialByMainMaterialByCode(code);
|
List<ErpMaterialCorrRspVO> erpMaterialByMainMaterialByCode = erpMaterialCorrService.getErpMaterialByMainMaterialByCode(code, companyCode);
|
||||||
if (erpMaterialByMainMaterialByCode.isEmpty()) {
|
if (erpMaterialByMainMaterialByCode.isEmpty()) {
|
||||||
return erpMaterialDOList;
|
return erpMaterialDOList;
|
||||||
}
|
}
|
||||||
List<Long> mIds = erpMaterialByMainMaterialByCode.stream().map(ErpMaterialCorrRspVO::getId).toList();
|
List<Long> mIds = erpMaterialByMainMaterialByCode.stream().map(ErpMaterialCorrRspVO::getMaterialId).toList();
|
||||||
DepartmentMaterialPageReqDTO departmentMaterialPageReqDTO = new DepartmentMaterialPageReqDTO();
|
CommonResult<List<MaterialInfomationRespDTO>> materialInfomationListByIds = materialInfomationApi.getMaterialInfomationListByIds(mIds);
|
||||||
departmentMaterialPageReqDTO.setInfomationIds(mIds);
|
if (materialInfomationListByIds == null || materialInfomationListByIds.getData() == null || materialInfomationListByIds.getData().isEmpty()) {
|
||||||
departmentMaterialPageReqDTO.setPageSize(10000);
|
|
||||||
PageResult<DepartmentMaterialRespDTO> departmentMaterialPage = departmentMaterialApi.getDepartmentMaterialPage(departmentMaterialPageReqDTO).getData();
|
|
||||||
if (departmentMaterialPage == null || departmentMaterialPage.getList() == null || departmentMaterialPage.getList().isEmpty()) {
|
|
||||||
return erpMaterialDOList;
|
return erpMaterialDOList;
|
||||||
}
|
}
|
||||||
|
List<MaterialInfomationRespDTO> data = materialInfomationListByIds.getData();
|
||||||
|
PageResult<DepartmentMaterialRespDTO> departmentMaterialPage =new PageResult<>();
|
||||||
|
List<DepartmentMaterialRespDTO> dtos=new ArrayList<>();
|
||||||
|
data.forEach(item->{
|
||||||
|
DepartmentMaterialRespDTO departmentMaterialRespDTO = new DepartmentMaterialRespDTO();
|
||||||
|
departmentMaterialRespDTO.setId(item.getId());
|
||||||
|
departmentMaterialRespDTO.setMaterialNumber(item.getCode());
|
||||||
|
departmentMaterialRespDTO.setMaterialName(item.getName());
|
||||||
|
departmentMaterialRespDTO.setClassesId(item.getClassesId());
|
||||||
|
departmentMaterialRespDTO.setRemark(item.getRemark());
|
||||||
|
departmentMaterialRespDTO.setCreateTime(item.getCreateTime());
|
||||||
|
departmentMaterialRespDTO.setFlatAttributes(item.getFlatAttributes());
|
||||||
|
dtos.add(departmentMaterialRespDTO);
|
||||||
|
});
|
||||||
|
departmentMaterialPage.setList(dtos);
|
||||||
|
departmentMaterialPage.setTotal((long) data.size());
|
||||||
|
//// departmentMaterialPageReqDTO.setDeptId(collect.iterator().next());
|
||||||
|
// PageResult<DepartmentMaterialRespDTO> departmentMaterialPage = departmentMaterialApi.getDepartmentMaterialPage(departmentMaterialPageReqDTO).getData();
|
||||||
|
// if (departmentMaterialPage == null || departmentMaterialPage.getList() == null || departmentMaterialPage.getList().isEmpty()) {
|
||||||
|
// return erpMaterialDOList;
|
||||||
|
// }
|
||||||
departmentMaterialPage.getList().forEach(item -> {
|
departmentMaterialPage.getList().forEach(item -> {
|
||||||
ErpMaterialDO erpMaterialDO = buildErpMaterialDOData(CommonResult.success(item));
|
ErpMaterialDO erpMaterialDO = buildErpMaterialDOData(CommonResult.success(item));
|
||||||
erpMaterialDOList.add(erpMaterialDO);
|
erpMaterialDOList.add(erpMaterialDO);
|
||||||
|
|||||||
Reference in New Issue
Block a user