refactor(purchase): 重构代理采购仓库单处理逻辑

-移除不必要的注释代码
- 优化采购订单处理流程
- 新增根据采购订单类型查询U8C业务流程和收发类别的方法
- 调整采购退货和非退货业务的处理逻辑
This commit is contained in:
liuy 2025-01-12 14:48:02 +08:00
parent a23f3cfdae
commit fc1b121bd3
3 changed files with 63 additions and 18 deletions

View File

@ -452,9 +452,9 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
// 查询基本档案 // 查询基本档案
List<PoOrderSonDtoV2> poOrderSonDtoV2s = queryBasicArchives(returnGoodHeaderDetailsDataDtoList); List<PoOrderSonDtoV2> poOrderSonDtoV2s = queryBasicArchives(returnGoodHeaderDetailsDataDtoList);
// 代理品牌采购业务流程 // 代理品牌采购业务流程
BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow(); // BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow();
// 查询采购收发类别 // 查询采购收发类别
BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("102"); // BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("102");
if (poOrderSonDtoV2s != null && poOrderSonDtoV2s.size() > 0) { if (poOrderSonDtoV2s != null && poOrderSonDtoV2s.size() > 0) {
for (int i = 0; i < poOrderSonDtoV2s.size(); i++) { for (int i = 0; i < poOrderSonDtoV2s.size(); i++) {
@ -478,6 +478,11 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
// OfsPoOrderHeader ofsPoOrderDataHeader = ofsPoOrderData.getHeader(); // OfsPoOrderHeader ofsPoOrderDataHeader = ofsPoOrderData.getHeader();
// List<OfsPoOrderDetails> ofsPoOrderDataDetails = ofsPoOrderData.getDetails(); // List<OfsPoOrderDetails> ofsPoOrderDataDetails = ofsPoOrderData.getDetails();
//查询对应的U8C业务流程
BdBusitypeEntity bdBusitypeEntity = queryU8CEntityUtil.queryU8cPoOrderOperationFlow(poOrderSonDtoV2.getPurchaseOrderType());
//查询对应的U8C收发类别
BdRdclEntity bdRdclEntity = queryU8CEntityUtil.queryU8cPoOrderRertunSendingReceivCategory(poOrderSonDtoV2.getPurchaseOrderType());
//采购订单表头 //采购订单表头
PoOrderParentDto poOrderParentDto = new PoOrderParentDto(); PoOrderParentDto poOrderParentDto = new PoOrderParentDto();
poOrderParentDto.setCbiztype(bdBusitypeEntity.getPkBusitype());//业务流程 poOrderParentDto.setCbiztype(bdBusitypeEntity.getPkBusitype());//业务流程

View File

@ -623,6 +623,9 @@ public class QueryU8CEntityUtil {
@Autowired @Autowired
private QueryBdBusitypeUtil queryBdBusitypeUtil; private QueryBdBusitypeUtil queryBdBusitypeUtil;
@Autowired
private IBdBusitypeDao iBdBusitypeDao;
/** /**
* 根据O采购类型查询U8C采退业务流程 * 根据O采购类型查询U8C采退业务流程
* *
@ -631,43 +634,49 @@ public class QueryU8CEntityUtil {
public BdBusitypeEntity queryU8cPoOrderRertunOperationFlow(String purchaseOrderType) throws Exception { public BdBusitypeEntity queryU8cPoOrderRertunOperationFlow(String purchaseOrderType) throws Exception {
Assert.notNull(purchaseOrderType, "purchaseOrderType不能为空"); Assert.notNull(purchaseOrderType, "purchaseOrderType不能为空");
String processName = null; String busicode = null;
if ("DLCG".equals(purchaseOrderType)) { if ("DLCG".equals(purchaseOrderType)) {
//O 代理采购 //O 代理采购 -> 渠道品牌退货
processName = "渠道品牌退货"; busicode = "QDTH";
} else if ("CPCG".equals(purchaseOrderType)) { } else if ("CPCG".equals(purchaseOrderType)) {
//O 成品采购 //O 成品采购 -> 自主品牌退货
processName = "自主品牌退货"; busicode = "ZZTH";
} else { } else {
Assert.state(false, "无法识别的O采购类型{}", purchaseOrderType); Assert.state(false, "无法识别的O采购类型{}", purchaseOrderType);
} }
BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName); String pkGroup = "@@@@";
Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName); BdBusitypeEntity bdBusitypeEntity = new BdBusitypeEntity();
bdBusitypeEntity.setDataSourceCode("lets_u8c");
return bdBusitypeEntity; bdBusitypeEntity.setBusicode(busicode);
bdBusitypeEntity.setPkCorp(pkGroup);
bdBusitypeEntity.setDr(0);
List<BdBusitypeEntity> bdBusitypeEntityList = iBdBusitypeDao.query(bdBusitypeEntity);
if (bdBusitypeEntityList == null || bdBusitypeEntityList.size() == 0) {
Assert.notNull(bdBusitypeEntity, "根据业务流程编码({})没有查询到业务流程!", busicode);
}
return bdBusitypeEntityList.get(0);
} }
@Autowired @Autowired
private IBdRdclDao iBdRdclDao; private IBdRdclDao iBdRdclDao;
/** /**
* 根据O采购类型查询U8C对应的收发类别 * 根据O采购类型查询U8C采退收发类别
* *
* @author liuyang * @author liuyang
*/ */
public BdRdclEntity queryU8cPoOrderRertunSendingReceivCategory(String purchaseOrderType) throws Exception { public BdRdclEntity queryU8cPoOrderRertunSendingReceivCategory(String purchaseOrderType) throws Exception {
Assert.notNull(purchaseOrderType, "purchaseOrderType不能为空"); Assert.notNull(purchaseOrderType, "purchaseOrderType不能为空");
BdRdclEntity bdRdclEntity = new BdRdclEntity(); BdRdclEntity bdRdclEntity = new BdRdclEntity();
bdRdclEntity.setDr(0); bdRdclEntity.setDr(0);
bdRdclEntity.setDataSourceCode("lets_u8c"); bdRdclEntity.setDataSourceCode("lets_u8c");
if ("DLCG".equals(purchaseOrderType)) { if ("DLCG".equals(purchaseOrderType)) {
//O 代理采购 //O 代理采购
bdRdclEntity.setRdcode("0101"); bdRdclEntity.setRdcode("102");
} else if ("CPCG".equals(purchaseOrderType)) { } else if ("CPCG".equals(purchaseOrderType)) {
//O 成品采购 //O 成品采购
bdRdclEntity.setRdcode("102"); bdRdclEntity.setRdcode("0101");
} else { } else {
Assert.state(false, "无法识别的O采购类型{}", purchaseOrderType); Assert.state(false, "无法识别的O采购类型{}", purchaseOrderType);
} }
@ -680,4 +689,35 @@ public class QueryU8CEntityUtil {
} }
return bdRdclEntityList.get(0); return bdRdclEntityList.get(0);
} }
/**
* 根据O采购类型查询U8C采购业务流程非采购退货
*
* @author liuyang
*/
public BdBusitypeEntity queryU8cPoOrderOperationFlow(String purchaseOrderType) throws Exception {
Assert.notNull(purchaseOrderType, "purchaseOrderType不能为空");
String busicode = null;
if ("DLCG".equals(purchaseOrderType)) {
//O 代理采购 -> 渠道品牌采购
busicode = "DLCG";
} else if ("CPCG".equals(purchaseOrderType)) {
//O 成品采购 -> 自主品牌采购
busicode = "ZZCG";
} else {
Assert.state(false, "无法识别的O采购类型{}", purchaseOrderType);
}
String pkGroup = "@@@@";
BdBusitypeEntity bdBusitypeEntity = new BdBusitypeEntity();
bdBusitypeEntity.setDataSourceCode("lets_u8c");
bdBusitypeEntity.setBusicode(busicode);
bdBusitypeEntity.setPkCorp(pkGroup);
bdBusitypeEntity.setDr(0);
List<BdBusitypeEntity> bdBusitypeEntityList = iBdBusitypeDao.query(bdBusitypeEntity);
if (bdBusitypeEntityList == null || bdBusitypeEntityList.size() == 0) {
Assert.notNull(bdBusitypeEntity, "根据业务流程编码({})没有查询到业务流程!", busicode);
}
return bdBusitypeEntityList.get(0);
}
} }

View File

@ -27,9 +27,9 @@ public class ProxyPurchaseWarehousOrderTest {
@Test @Test
public void startImplementByCode() { public void startImplementByCode() {
try { try {
// proxyPurchaseWarehousOrder.startImplementByCode("LETS-PO2024122300000003"); proxyPurchaseWarehousOrder.startImplementByCode("LETS-PO2025010200000001");
proxyPurchaseWarehousOrder.startImplementByTime("2024-12-23 15:32:39", "2024-12-23 15:32:39"); // proxyPurchaseWarehousOrder.startImplementByTime("2024-12-23 15:32:39", "2024-12-23 15:32:39");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }