feat(outsourc):增加采购部门字段并优化相关功能

- 在 ConsignmachiningIn 和 ConsignmachiningInReturn 类中添加采购部门相关逻辑- 在 ConsignmachiningInSonDto 和 ReturnOrderHeaderDto 中增加采购部门实体字段
- 在 ConsignmachiningInHeadDto 中添加采购部门 ID 字段
-优化查询采购部门逻辑,确保正确获取采购部门信息
This commit is contained in:
liuy 2025-02-21 12:34:16 +08:00
parent 42375eaa7e
commit 0cb2c76736
5 changed files with 47 additions and 0 deletions

View File

@ -115,6 +115,9 @@ public class ConsignmachiningIn extends PluginBaseEntity {
@Autowired
private QueryU8CEntityUtil queryU8CEntityUtil;
@Autowired
private IBdDeptdocDao iBdDeptdocDao;
@Override
public void initialize() {
logger.info(getPluginLabel() + "執行初始化方法initialize()");
@ -446,6 +449,7 @@ public class ConsignmachiningIn extends PluginBaseEntity {
BdCubasdocEntity bdCubasdocEntity = consignmachiningInSonDto.getBdCubasdocEntity();//客商基本档案
BdCumandocEntity bdCumandocEntity = consignmachiningInSonDto.getBdCumandocEntity();//客商管理档案
BdStordocEntity bdStordocEntity = consignmachiningInSonDto.getBdStordocEntity();//表体仓库
BdDeptdocEntity bdDeptdocEntity = consignmachiningInSonDto.getBdDeptdocEntity();//采购部门
//委外订单表头
ScorderHeadDto poOrderParentDto = new ScorderHeadDto();
@ -457,6 +461,7 @@ public class ConsignmachiningIn extends PluginBaseEntity {
poOrderParentDto.setCvendormangid(bdCumandocEntity.getPkCumandoc());
poOrderParentDto.setDorderdate(generateBusinessDate);
poOrderParentDto.setCwareid(bdCalbodyEntity.getPkCalbody());//库存组织
poOrderParentDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//采购部门
poOrderParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl());//收发类别
poOrderParentDto.setVdef3(bdRdclEntity.getRdname());
@ -711,6 +716,18 @@ public class ConsignmachiningIn extends PluginBaseEntity {
Assert.state(false, "根据O仓库编码+U8C收货库存组织主键匹配到U8C仓库多个", facilityCode, bdCalbodyEntities.get(0).getPkCalbody());
}
//查询采购部门
String deptName = "业务部门";
BdDeptdocEntity bdDeptdocEntity = new BdDeptdocEntity();
bdDeptdocEntity.setDataSourceCode("lets_u8c");
bdDeptdocEntity.setDr(0);
bdDeptdocEntity.setDeptname(deptName);
bdDeptdocEntity.setPkCorp(bdCorpEntityList.get(0).getPkCorp());
List<BdDeptdocEntity> bdDeptdocEntityList = iBdDeptdocDao.query(bdDeptdocEntity);
if (bdDeptdocEntityList == null || bdDeptdocEntityList.size() == 0) {
Assert.state(false, "没有匹配到采购部门,或者没有分配,公司名称:{} 部门名称:{}", bdCorpEntityList.get(0).getUnitname(), deptName);
}
ConsignmachiningInSonDto consignmachiningInSonDto = new ConsignmachiningInSonDto();
consignmachiningInSonDto.setOfsPoOrderData(ofsPoOrderData);
// consignmachiningInSonDto.setScOrderEntity(scOrderEntity);
@ -724,6 +741,7 @@ public class ConsignmachiningIn extends PluginBaseEntity {
// consignmachiningInSonDto.setScOrderBEntityList(scOrderBEntityList);
consignmachiningInSonDto.setDetails(details);
consignmachiningInSonDto.setBdStordocEntity(bdStordocEntityList.get(0));
consignmachiningInSonDto.setBdDeptdocEntity(bdDeptdocEntityList.get(0));
BeanUtil.copyPropertiesV2(header, consignmachiningInSonDto);
consignmachiningInSonDtoArrayList.add(consignmachiningInSonDto);

View File

@ -113,6 +113,9 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
@Autowired
private IBdBomDao iBdBomDao;
@Autowired
private IBdDeptdocDao iBdDeptdocDao;
private static final String PROD_FILED = "prod";
@Override
@ -415,6 +418,7 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
BdCalbodyEntity bdCalbodyEntity = returnOrderHeaderDto.getBdCalbodyEntity();//库存组织
BdStordocEntity bdStordocEntity = returnOrderHeaderDto.getBdStordocEntity();//仓库
OfsPoOrderData ofsPoOrder = returnOrderHeaderDto.getOfsPoOrder();//OFS原正向的采购订单
BdDeptdocEntity bdDeptdocEntity = returnOrderHeaderDto.getBdDeptdocEntity();//采购部门
//委外入库表头
ConsignmachiningInHeadDto poOrderParentDto = new ConsignmachiningInHeadDto();
@ -426,6 +430,7 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
poOrderParentDto.setCdispatcherid(bdRdclEntity.getPkRdcl());//收发类别
poOrderParentDto.setDbilldate(generateBusinessDate);//入库日期
poOrderParentDto.setFreplenishflag(true);//是否退货
poOrderParentDto.setCdptid(bdDeptdocEntity.getPkDeptdoc());//采购部门
poOrderParentDto.setVuserdef17(ProfilesActiveConstant.sourceSystem1);//来源系统
poOrderParentDto.setVuserdef19(returnOrderHeaderDto.getCode());//原单单号
@ -645,6 +650,18 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
Assert.state(false, "根据O仓库编码+U8C收货库存组织主键匹配到U8C仓库多个", facilityCode, bdCalbodyEntities.get(0).getPkCalbody());
}
//查询采购部门
String deptName = "业务部门";
BdDeptdocEntity bdDeptdocEntity = new BdDeptdocEntity();
bdDeptdocEntity.setDataSourceCode("lets_u8c");
bdDeptdocEntity.setDr(0);
bdDeptdocEntity.setDeptname(deptName);
bdDeptdocEntity.setPkCorp(bdCorpEntityList.get(0).getPkCorp());
List<BdDeptdocEntity> bdDeptdocEntityList = iBdDeptdocDao.query(bdDeptdocEntity);
if (bdDeptdocEntityList == null || bdDeptdocEntityList.size() == 0) {
Assert.state(false, "没有匹配到采购部门,或者没有分配,公司名称:{} 部门名称:{}", bdCorpEntityList.get(0).getUnitname(), deptName);
}
ReturnOrderHeaderDto returnOrderHeaderDto = new ReturnOrderHeaderDto();
returnOrderHeaderDto.setPurchaseReturnOrder(purchaseReturnOrder);
returnOrderHeaderDto.setScOrderEntity(scOrderEntity);
@ -654,6 +671,7 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
returnOrderHeaderDto.setBdStordocEntity(bdStordocEntityList.get(0));
returnOrderHeaderDto.setDetails(details);
returnOrderHeaderDto.setOfsPoOrder(ofsPoOrder);
returnOrderHeaderDto.setBdDeptdocEntity(bdDeptdocEntityList.get(0));
BeanUtil.copyPropertiesV2(header, returnOrderHeaderDto);
consignmachiningInSonDtoArrayList.add(returnOrderHeaderDto);

View File

@ -24,4 +24,5 @@ public class ConsignmachiningInHeadDto {
private String vuserdef18;
private String vuserdef19;
private String vuserdef20;
private String cdptid;
}

View File

@ -72,4 +72,9 @@ public class ConsignmachiningInSonDto extends StockinOrderSearchResponse.Stockin
* 客商管理档案
*/
private BdCumandocEntity bdCumandocEntity;
/**
* 采购部门
*/
private BdDeptdocEntity bdDeptdocEntity;
}

View File

@ -59,4 +59,9 @@ public class ReturnOrderHeaderDto extends HeaderDto {
* 查询OFS原正向的采购订单
*/
private OfsPoOrderData ofsPoOrder;
/**
* 采购部门
*/
private BdDeptdocEntity bdDeptdocEntity;
}