refactor(lets): 重构委外加工入库逻辑
- 添加加工单位和供应商信息 - 优化采购部门查询逻辑 - 移除不必要的代码注释 -增加供应商编码校验和查询 - 更新相关DTO结构
This commit is contained in:
parent
4dc423f5b1
commit
f8bce54427
|
@ -461,6 +461,7 @@ public class ConsignmachiningCinfurmIn extends PluginBaseEntity {
|
|||
poOrderParentDto.setDbilldate(generateBusinessDate);//入库确认日期
|
||||
poOrderParentDto.setFreplenishflag(false);//是否退货
|
||||
poOrderParentDto.setCdptid(bdDeptdocEntity.getPkDeptdoc());//采购部门
|
||||
poOrderParentDto.setCproviderid(bdCumandocEntity.getPkCumandoc());//加工单位
|
||||
poOrderParentDto.setVuserdef17(ProfilesActiveConstant.sourceSystem1);//来源系统
|
||||
poOrderParentDto.setVuserdef19(purchaseReceiptConfirmationSonDto.getCode());//原单单号=OFS 采购入库单确认单-单号
|
||||
poOrderParentDto.setVuserdef20(purchaseReceiptConfirmationSonDto.getId());//原单主键=OFS 采购入库单确认单-主键
|
||||
|
@ -612,10 +613,10 @@ public class ConsignmachiningCinfurmIn extends PluginBaseEntity {
|
|||
generateBusinessDate = createGenerateBusinessDateV2(header);
|
||||
|
||||
//2025 年 3 月 10 日 10:58:59 查询 ofs 采购入库单
|
||||
String outBizCode = header.getCode();
|
||||
Assert.notNull(outBizCode, "采购入库确定单对应的采购入库单号不能为空 outBizCode字段:{}", outBizCode);
|
||||
Assert.state(!"".equals(outBizCode), "采购入库确定单对应的采购入库单号不能为空 outBizCode字段;{}", outBizCode);
|
||||
outBizCode = outBizCode.replace("-confirm", "");
|
||||
// String outBizCode = header.getCode();
|
||||
// Assert.notNull(outBizCode, "采购入库确定单对应的采购入库单号不能为空 outBizCode字段:{}", outBizCode);
|
||||
// Assert.state(!"".equals(outBizCode), "采购入库确定单对应的采购入库单号不能为空 outBizCode字段;{}", outBizCode);
|
||||
// outBizCode = outBizCode.replace("-confirm", "");
|
||||
|
||||
// List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>();
|
||||
// QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
|
||||
|
|
|
@ -462,7 +462,7 @@ public class ConsignmachiningIn extends PluginBaseEntity {
|
|||
poOrderParentDto.setCoperator(OverallConstant.getOverAllValue("u8cApiZdrPK"));
|
||||
poOrderParentDto.setCpurorganization(bdPurorgEntity.getPkPurorg());
|
||||
poOrderParentDto.setCgiveinvoicevendor(bdCumandocEntity.getPkCumandoc());
|
||||
poOrderParentDto.setCvendormangid(bdCumandocEntity.getPkCumandoc());
|
||||
poOrderParentDto.setCvendormangid(bdCumandocEntity.getPkCumandoc());//供应商
|
||||
poOrderParentDto.setDorderdate(generateBusinessDate);
|
||||
poOrderParentDto.setCwareid(bdCalbodyEntity.getPkCalbody());//库存组织
|
||||
poOrderParentDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//采购部门
|
||||
|
|
|
@ -419,6 +419,8 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
|
|||
BdStordocEntity bdStordocEntity = returnOrderHeaderDto.getBdStordocEntity();//仓库
|
||||
OfsPoOrderData ofsPoOrder = returnOrderHeaderDto.getOfsPoOrder();//OFS原正向的采购订单
|
||||
BdDeptdocEntity bdDeptdocEntity = returnOrderHeaderDto.getBdDeptdocEntity();//采购部门
|
||||
BdCubasdocEntity bdCubasdocEntity = returnOrderHeaderDto.getBdCubasdocEntity();//客商基本档案
|
||||
BdCumandocEntity bdCumandocEntity = returnOrderHeaderDto.getBdCumandocEntity();//客商管理档案
|
||||
|
||||
//委外入库表头
|
||||
ConsignmachiningInHeadDto poOrderParentDto = new ConsignmachiningInHeadDto();
|
||||
|
@ -431,6 +433,7 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
|
|||
poOrderParentDto.setDbilldate(generateBusinessDate);//入库日期
|
||||
poOrderParentDto.setFreplenishflag(true);//是否退货
|
||||
poOrderParentDto.setCdptid(bdDeptdocEntity.getPkDeptdoc());//采购部门
|
||||
poOrderParentDto.setCproviderid(bdCumandocEntity.getPkCumandoc());//加工单位
|
||||
|
||||
poOrderParentDto.setVuserdef17(ProfilesActiveConstant.sourceSystem1);//来源系统
|
||||
poOrderParentDto.setVuserdef19(returnOrderHeaderDto.getCode());//原单单号
|
||||
|
@ -662,6 +665,26 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
|
|||
Assert.state(false, "没有匹配到采购部门,或者没有分配,公司名称:{} 部门名称:{}", bdCorpEntityList.get(0).getUnitname(), deptName);
|
||||
}
|
||||
|
||||
String shipFromCode = ofsPoOrder.getHeader().getVendorCode();
|
||||
Assert.notNull(shipFromCode, "O供应商编码不能为空,没有办法完成业务逻辑,请配置供应商编码(采购入库)");
|
||||
Assert.state(!"".equals(shipFromCode.trim()), "O供应商编码不能为空,没有办法完成业务逻辑,请配置供应商编码!");
|
||||
BdCubasdocEntity fuzzyQueryCustomers = queryU8CEntityUtil.getFuzzyQueryCustomers(shipFromCode.trim());
|
||||
Assert.notNull(fuzzyQueryCustomers, "根据O供应商编码:{},无法查询到U8C客商基本档案 def1", shipFromCode.trim());
|
||||
|
||||
//客商管理档案
|
||||
BdCumandocEntity bdCumandocEntity1 = new BdCumandocEntity();
|
||||
bdCumandocEntity1.setDataSourceCode("lets_u8c");
|
||||
bdCumandocEntity1.setDr(0L);
|
||||
bdCumandocEntity1.setPkCorp(bdCorpEntityList.get(0).getPkCorp());
|
||||
bdCumandocEntity1.setCustflags(ProfilesActiveConstant.SUPPLIER);
|
||||
bdCumandocEntity1.setPkCubasdoc(fuzzyQueryCustomers.getPkCubasdoc());
|
||||
List<BdCumandocEntity> bdCumandocEntityList = iBdCumandocDao.query(bdCumandocEntity1);
|
||||
if (bdCumandocEntityList == null || bdCumandocEntityList.size() == 0) {
|
||||
Assert.state(false, "客商:{} 没有分配给:{},或者客商属性为客户,不满足客商或者供应商的要求!", fuzzyQueryCustomers.getCustshortname(), bdCorpEntityList.get(0).getUnitname());
|
||||
} else if (bdCumandocEntityList.size() >= 2) {
|
||||
Assert.state(false, "客商:{} 公司:{} 存在多个对应关系!", fuzzyQueryCustomers.getCustshortname(), bdCorpEntityList.get(0).getUnitname());
|
||||
}
|
||||
|
||||
ReturnOrderHeaderDto returnOrderHeaderDto = new ReturnOrderHeaderDto();
|
||||
returnOrderHeaderDto.setPurchaseReturnOrder(purchaseReturnOrder);
|
||||
returnOrderHeaderDto.setScOrderEntity(scOrderEntity);
|
||||
|
@ -672,6 +695,8 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
|
|||
returnOrderHeaderDto.setDetails(details);
|
||||
returnOrderHeaderDto.setOfsPoOrder(ofsPoOrder);
|
||||
returnOrderHeaderDto.setBdDeptdocEntity(bdDeptdocEntityList.get(0));
|
||||
returnOrderHeaderDto.setBdCubasdocEntity(fuzzyQueryCustomers);
|
||||
returnOrderHeaderDto.setBdCumandocEntity(bdCumandocEntityList.get(0));
|
||||
|
||||
BeanUtil.copyPropertiesV2(header, returnOrderHeaderDto);
|
||||
consignmachiningInSonDtoArrayList.add(returnOrderHeaderDto);
|
||||
|
|
|
@ -25,4 +25,5 @@ public class ConsignmachiningInHeadDto {
|
|||
private String vuserdef19;
|
||||
private String vuserdef20;
|
||||
private String cdptid;
|
||||
private String cproviderid;
|
||||
}
|
|
@ -64,4 +64,14 @@ public class ReturnOrderHeaderDto extends HeaderDto {
|
|||
* 采购部门
|
||||
*/
|
||||
private BdDeptdocEntity bdDeptdocEntity;
|
||||
|
||||
/**
|
||||
* 客商基本档案
|
||||
*/
|
||||
private BdCubasdocEntity bdCubasdocEntity;
|
||||
|
||||
/**
|
||||
* 客商管理档案
|
||||
*/
|
||||
private BdCumandocEntity bdCumandocEntity;
|
||||
}
|
|
@ -30,7 +30,7 @@ public class ConsignmachiningCinfurmInTest {
|
|||
// consignmachiningCinfurmIn.startImplementByTime("2024-01-02 00:00:00", "2024-01-02 23:59:59");
|
||||
|
||||
// String code = "LETS-RE2024111400002771-confirm";
|
||||
String code = "LETS-RE2025022800002706-confirm";
|
||||
String code = "LETS-RE2025031700001761-confirm";
|
||||
consignmachiningCinfurmIn.startImplementByCode(code);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
Loading…
Reference in New Issue