优化委外业务流程、调整红字销售发票
This commit is contained in:
parent
e89ce86954
commit
91e6db987c
|
@ -492,7 +492,7 @@ public class ConsignmachiningIn extends PluginBaseEntity {
|
|||
//查询业务流程
|
||||
//2024年8月6日 11:33:07 具体的业务流程名称,还需要实施提供
|
||||
String processName = "委外加工";
|
||||
BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName, pkCorp);
|
||||
BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName);
|
||||
Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName);
|
||||
return bdBusitypeEntity;
|
||||
}
|
||||
|
@ -563,7 +563,6 @@ public class ConsignmachiningIn extends PluginBaseEntity {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 匹配U8C采购订单明细行
|
||||
* 通过O采购入库单明细行,得到采购订单明细行,最后查找到U8C采购订单明细行
|
||||
|
@ -613,7 +612,7 @@ public class ConsignmachiningIn extends PluginBaseEntity {
|
|||
|
||||
/**
|
||||
* 2024年8月25日 15:12:22
|
||||
* 推送U8C委外订单
|
||||
* 推送U8C委外入库单
|
||||
*
|
||||
* @param param 原数据json
|
||||
* @author liuyang
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -560,7 +560,7 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
|
|||
//查询业务流程
|
||||
//2024年8月6日 11:33:07 具体的业务流程名称,还需要实施提供
|
||||
String processName = "代理品牌采购";
|
||||
BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName, null);
|
||||
BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName);
|
||||
Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName);
|
||||
return bdBusitypeEntity;
|
||||
}
|
||||
|
|
|
@ -551,7 +551,7 @@ public class ProxyPurchaseWarehous extends PluginBaseEntity {
|
|||
//查询业务流程
|
||||
//2024年8月6日 11:33:07 具体的业务流程名称,还需要实施提供
|
||||
String processName = "代理品牌采购";
|
||||
BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName, null);
|
||||
BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName);
|
||||
Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName);
|
||||
return bdBusitypeEntity;
|
||||
}
|
||||
|
|
|
@ -155,6 +155,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
* @author liuyang
|
||||
*/
|
||||
public void startImplementByStockTime(String startTime, String endTime) {
|
||||
long startMillis = System.currentTimeMillis();
|
||||
String threadNameStr = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单开始 同步日期:{} 汇总维度:{}", startTime, endTime);
|
||||
logger.info(threadNameStr);
|
||||
|
||||
|
@ -198,7 +199,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
} catch (Exception e) {
|
||||
logger.error("thread.join()异常", e);
|
||||
}
|
||||
String threadNameEnd = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单结束 同步日期:{} 汇总维度:{}", startTime, endTime);
|
||||
long endMillis = System.currentTimeMillis();
|
||||
String threadNameEnd = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单结束 同步日期:{} 汇总维度:{} 耗时:{}", startTime, endTime, (endMillis - startMillis));
|
||||
logger.info(threadNameEnd);
|
||||
}
|
||||
|
||||
|
@ -208,7 +210,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
* @author liuyang
|
||||
*/
|
||||
public void startImplementByTranTime(String startTime, String endTime) {
|
||||
String threadNameStrStart = StrUtil.format("OFS销售出库(TOB交易成功)同步U8C销售发票 开始 开始时间:{} 结束时间:{}", startTime, endTime);
|
||||
long startMillis = System.currentTimeMillis();
|
||||
String threadNameStrStart = StrUtil.format("OFS销售出库(TOB交易成功)同步U8C销售发票开始 开始时间:{} 结束时间:{}", startTime, endTime);
|
||||
logger.info(threadNameStrStart);
|
||||
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
|
@ -252,7 +255,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
} catch (Exception e) {
|
||||
logger.error("thread.join()异常", e);
|
||||
}
|
||||
String threadNameStrEnd = StrUtil.format("OFS销售出库(TOB交易成功)同步U8C销售发票 结束 开始时间:{} 结束时间:{}", startTime, endTime);
|
||||
long endMillis = System.currentTimeMillis();
|
||||
String threadNameStrEnd = StrUtil.format("OFS销售出库(TOB交易成功)同步U8C销售发票结束 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis));
|
||||
logger.info(threadNameStrEnd);
|
||||
}
|
||||
|
||||
|
@ -262,7 +266,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
* @author liuyang
|
||||
*/
|
||||
public void startImplementByCode(String code) {
|
||||
String threadNameStrStart = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单 出库单单号:{}", code);
|
||||
long startMillis = System.currentTimeMillis();
|
||||
String threadNameStrStart = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单开始 出库单单号:{}", code);
|
||||
logger.info(threadNameStrStart);
|
||||
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
|
@ -276,6 +281,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
|
||||
queryOfsSoSaleOutVo.setClientCode("LETS");
|
||||
queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
|
||||
//2024年8月30日 10:41:55 如果按编码查询,是否应该考虑仅查询已发货的数据?
|
||||
queryOfsSoSaleOutVo.setStatus(900L);
|
||||
queryOfsSoSaleOutVo.setPageNo(1L);
|
||||
queryOfsSoSaleOutVo.setPageSize(50L);
|
||||
|
@ -299,7 +305,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
} catch (Exception e) {
|
||||
logger.error("thread.join()异常", e);
|
||||
}
|
||||
String threadNameStrEnd = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单 出库单单号:{}", code);
|
||||
long endMillis = System.currentTimeMillis();
|
||||
String threadNameStrEnd = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单结束 出库单单号:{} 耗时:{}", code, (endMillis - startMillis));
|
||||
logger.info(threadNameStrEnd);
|
||||
}
|
||||
|
||||
|
@ -567,6 +574,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
// saleorderRequestChildrenDto.setNoriginalcurtaxnetprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税净价
|
||||
saleorderRequestChildrenDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价
|
||||
saleorderRequestChildrenDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率
|
||||
//TODO 2024年8月30日 10:52:55 抛出异常pk_defxxx长度不够的问题,已经提交给总部
|
||||
// saleorderRequestChildrenDto.setVdef19(header.getCode());//原单单号
|
||||
saleorderRequestChildrenDto.setVdef20(detailsDto.getId());//原单明细主键
|
||||
saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto);
|
||||
|
@ -599,7 +607,6 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
* @author liuyang
|
||||
*/
|
||||
private String createGenerateBusinessDate(OrderOutTobHeaderDto orderOutTobHeaderDto) {
|
||||
orderOutTobHeaderDto.getHeader().setShipAt("2024-08-22");
|
||||
if (orderOutTobHeaderDto != null && orderOutTobHeaderDto.getHeader() != null && orderOutTobHeaderDto.getHeader().getShipAt() != null) {
|
||||
HeaderDto header = orderOutTobHeaderDto.getHeader();
|
||||
String shipAt = header.getShipAt();
|
||||
|
@ -609,7 +616,9 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
businessFormat = DateUtil.format(dbill, "yyyy-MM-dd");
|
||||
} catch (Exception e) {
|
||||
logger.error("业务日期生成失败", e);
|
||||
Assert.state(false, "业务日期生成失败,抛出异常:" + e.getMessage());
|
||||
}
|
||||
logger.info("TOB库存同步业务,生成的业务日期:{}", businessFormat);
|
||||
return businessFormat;
|
||||
} else {
|
||||
logger.error("生成出库日期失败,或者shipAt为空! json:{}", JSON.toJSON(orderOutTobHeaderDto));
|
||||
|
@ -634,7 +643,9 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
businessFormat = DateUtil.format(dbill, "yyyy-MM-dd");
|
||||
} catch (Exception e) {
|
||||
logger.error("tradeSuccessAt业务日期生成失败", e);
|
||||
Assert.state(false, "业务日期生成失败,抛出异常:" + e.getMessage());
|
||||
}
|
||||
logger.info("TOB销售发票业务,生成的的业务日期为:{}", businessFormat);
|
||||
return businessFormat;
|
||||
} else {
|
||||
logger.error("生成发票业务日期失败,或者tradeSuccessAt为空! json:{}", JSON.toJSON(orderOutTobHeaderDto));
|
||||
|
@ -649,8 +660,10 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
* @author liuyang
|
||||
*/
|
||||
private List<OrderOutTobHeaderDto> queryBasicArchives(List<HeaderDetailsDto> headerDetailsDtoList) {
|
||||
if (headerDetailsDtoList != null) {
|
||||
logger.info("库存同步:需要把OFS档案转换为U8C档案的O数据条数:{}", headerDetailsDtoList.size());
|
||||
}
|
||||
List<OrderOutTobHeaderDto> orderOutTobHeaderDtoArrayList = new ArrayList<>();
|
||||
|
||||
if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) {
|
||||
try {
|
||||
for (int i = 0; i < headerDetailsDtoList.size(); i++) {
|
||||
|
@ -882,7 +895,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
//查询业务流程
|
||||
//2024年8月6日 11:33:07 具体的业务流程名称,还需要实施提供
|
||||
String processName = "TOB销售";
|
||||
BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName, null);
|
||||
BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName);
|
||||
Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName);
|
||||
return bdBusitypeEntity;
|
||||
}
|
||||
|
@ -1309,10 +1322,10 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
BeanUtil.copyPropertiesV2(header, orderOutTobHeaderDto);
|
||||
orderOutTobHeaderDtoArrayList.add(orderOutTobHeaderDto);
|
||||
}
|
||||
//成功
|
||||
//成功,记录到日志表
|
||||
} catch (Exception e) {
|
||||
logger.error("OFS销售出库单关联查询U8C档案失败", e);
|
||||
//失败
|
||||
//失败,记录到日子表
|
||||
}
|
||||
} else {
|
||||
logger.info("queryBasicArchives方法对应的headerDetailsDtoList.size为0");
|
||||
|
@ -1330,11 +1343,11 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
logger.info("TOB销售业务交易成功同步:{}行需要进行数据转换", headerDetailsDtoList.size());
|
||||
}
|
||||
if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) {
|
||||
//查询基本档案
|
||||
//转换基本档案
|
||||
List<OrderOutTobHeaderDto> orderOutTobHeaderDtos = queryBasicArchivesSaleinvoice(headerDetailsDtoList);
|
||||
//查询U8C业务流程
|
||||
BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow();
|
||||
// 查询销售收发类别
|
||||
//查询销售收发类别
|
||||
BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("201");
|
||||
|
||||
logger.info("TOB销售业务交易成功同步,档案转换成功对应的数量:{}行需要进行数据转换", orderOutTobHeaderDtos.size());
|
||||
|
@ -1378,6 +1391,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
//U8C销售订单执行情况明细表
|
||||
List<ExtIntegrationTaskLivingDetailsQueryVo> extIntegrationTaskLivingDetailsQueryVos = orderOutTobHeaderDto.getExtIntegrationTaskLivingDetailsQueryVos();
|
||||
|
||||
//销售发票表头
|
||||
SalesInvoiceHeadDto salesInvoiceHeadDto = new SalesInvoiceHeadDto();
|
||||
salesInvoiceHeadDto.setCbiztype(bdBusitypeEntity.getPkBusitype());
|
||||
salesInvoiceHeadDto.setCcalbodyid(bdCalbodyEntity.getPkCalbody());
|
||||
|
@ -1393,7 +1407,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
salesInvoiceHeadDto.setCreceiptcustomerid(bdCumandocEntity.getPkCumandoc());//收货单位
|
||||
salesInvoiceHeadDto.setCreceipttype("32");//单据类型
|
||||
salesInvoiceHeadDto.setDmakedate(successfulTradeDate);//制单日期
|
||||
salesInvoiceHeadDto.setNdiscountrate("100");
|
||||
salesInvoiceHeadDto.setNdiscountrate("100");//整单折扣
|
||||
salesInvoiceHeadDto.setDapprovedate(successfulTradeDate);//审批日期
|
||||
salesInvoiceHeadDto.setVdef17(ProfilesActiveConstant.sourceSystem1);
|
||||
salesInvoiceHeadDto.setVdef19(header.getCode());
|
||||
|
@ -1424,6 +1438,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
noriginalcurtaxprice = new BigDecimal(detailsDto.getTotalPayAmount()).divide(new BigDecimal(detailsDto.getShipQty()), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
|
||||
} catch (Exception e) {
|
||||
logger.error("含税单价金额计算失败!", e);
|
||||
Assert.state(false, "含税单价金额计算失败 原因:{}", e.getMessage());
|
||||
}
|
||||
|
||||
Boolean isblargessflag = false;
|
||||
|
|
|
@ -767,7 +767,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
//查询业务流程
|
||||
//2024年8月6日 11:33:07 具体的业务流程名称,还需要实施提供
|
||||
String processName = "TOC销售";
|
||||
BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName, null);
|
||||
BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName);
|
||||
Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName);
|
||||
return bdBusitypeEntity;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.hzya.frame.plugin.lets.ofs.dao.ITocofsReturngoodsDetailedDao;
|
|||
import com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsDetailedEntity;
|
||||
import com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsEntity;
|
||||
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
|
||||
import com.hzya.frame.plugin.lets.queryvo.ExtIntegrationTaskLivingDetailsQueryVo;
|
||||
import com.hzya.frame.plugin.lets.queryvo.StartAndEndVo;
|
||||
import com.hzya.frame.plugin.lets.resultvo.CalculateDateVo;
|
||||
import com.hzya.frame.plugin.lets.u8cdto.*;
|
||||
|
@ -137,6 +138,12 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
@Autowired
|
||||
private OffsetTimeTime offsetTimeTime;
|
||||
|
||||
@Autowired
|
||||
private IIcGeneralHDao iIcGeneralHDao;
|
||||
|
||||
@Autowired
|
||||
private IIcGeneralBDao iIcGeneralBDao;
|
||||
|
||||
@Autowired
|
||||
private OfsStandardUtil ofsStandardUtil;
|
||||
|
||||
|
@ -146,12 +153,16 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
@Autowired
|
||||
private ISoSaleDao iSoSaleDao;
|
||||
|
||||
@Autowired
|
||||
private ISoSaleorderBDao iSoSaleorderBDao;
|
||||
|
||||
/**
|
||||
* 库存同步,按指定时间拉取
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
public void startImplementByStockTime(String startTime, String endTime) {
|
||||
long startMillis = System.currentTimeMillis();
|
||||
String threadNameStrStart = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{}", startTime, endTime);
|
||||
logger.info(threadNameStrStart);
|
||||
|
||||
|
@ -192,7 +203,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
} catch (Exception e) {
|
||||
logger.error("thread.join()异常", e);
|
||||
}
|
||||
String threadNameStrEnd = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{}", startTime, endTime);
|
||||
long endMillis = System.currentTimeMillis();
|
||||
String threadNameStrEnd = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis));
|
||||
logger.info(threadNameStrEnd);
|
||||
}
|
||||
|
||||
|
@ -201,7 +213,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
public void startImplement(String code) {
|
||||
public void startImplementByCode(String code) {
|
||||
long startMillis = System.currentTimeMillis();
|
||||
String threadNameStrStart = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 售后入库单号:{}", code);
|
||||
logger.info(threadNameStrStart);
|
||||
|
||||
|
@ -242,7 +255,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
} catch (Exception e) {
|
||||
logger.error("thread.join()异常", e);
|
||||
}
|
||||
String threadNameStrEnd = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 售后入库单号:{}", code);
|
||||
long endMillis = System.currentTimeMillis();
|
||||
String threadNameStrEnd = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 售后入库单号:{} 耗时:{}", code, (endMillis - startMillis));
|
||||
logger.info(threadNameStrEnd);
|
||||
}
|
||||
|
||||
|
@ -478,6 +492,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
saleorderRequestChildrenDto.setNoriginalcurtaxnetprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税净价
|
||||
saleorderRequestChildrenDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价
|
||||
saleorderRequestChildrenDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率
|
||||
saleorderRequestChildrenDto.setVdef20(stockinB.getId());//原单明细主键
|
||||
saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto);
|
||||
}
|
||||
//记录成功
|
||||
|
@ -730,7 +745,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
|
||||
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = stockinOrder.getDetails();
|
||||
|
||||
//查询售后订单
|
||||
//查询OFS售后订单
|
||||
SaleOrderMessageDto saleOrderMessageDto = null;
|
||||
try {
|
||||
saleOrderMessageDto = afterSalesOrderUtil.queryAfterSalesOrder(header);
|
||||
|
@ -747,6 +762,63 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
Assert.notNull(memberId, "TOB销售订单(OFS)表头会员id不能为空,否则无法匹配U8C客商档案!");
|
||||
Assert.state(!"".equals(memberId.trim()), "TOB销售订单(OFS)表头会员id不能为空,否则无法匹配U8C客商档案!");
|
||||
|
||||
//2024年8月30日 10:57:29 查询对应的U8C销售订单,注意要把编码和主键一起查询,O主键导入到U8C中,对于U8C来说可能会重复
|
||||
SoSaleEntity soSaleEntity = new SoSaleEntity();
|
||||
soSaleEntity.setDr(0L);
|
||||
soSaleEntity.setDataSourceCode("lets_u8c");
|
||||
soSaleEntity.setVdef19(header.getCode());
|
||||
soSaleEntity.setVdef20(header.getId());
|
||||
List<SoSaleEntity> soSaleEntityList = iSoSaleDao.query(soSaleEntity);
|
||||
if (soSaleEntityList == null || soSaleEntityList.size() == 0) {
|
||||
Assert.state(false, "根据O售后入库单主键:{} 单号:{} 无法匹配到U8C销售订单(传到U8C可能失败了!)", header.getId(), header.getCode());
|
||||
}
|
||||
//TODO 测试
|
||||
// else if (soSaleEntityList.size() >= 2) {
|
||||
// Assert.state(false, "根据O出库单主键:{} 单号:{} 匹配到{}个U8C销售订单", header.getId(), header.getCode(), soSaleEntityList.size());
|
||||
// }
|
||||
|
||||
//查询销售订单明细行表体
|
||||
SoSaleorderBEntity soSaleorderBEntity = new SoSaleorderBEntity();
|
||||
soSaleorderBEntity.setDr(0L);
|
||||
soSaleorderBEntity.setCsaleid(soSaleEntityList.get(soSaleEntityList.size() - 1).getCsaleid());
|
||||
soSaleorderBEntity.setDataSourceCode("lets_u8c");
|
||||
List<SoSaleorderBEntity> soSaleorderBEntityList = iSoSaleorderBDao.query(soSaleorderBEntity);
|
||||
if (soSaleorderBEntityList == null || soSaleorderBEntityList.size() == 0) {
|
||||
Assert.state(false, "根据O销售订单主键:{},无法匹配到U8C销售订单明细行(传到U8C可能失败了!)", soSaleEntityList.get(soSaleEntityList.size() - 1).getCsaleid());
|
||||
} else if (soSaleorderBEntityList.size() >= 2) {
|
||||
Assert.state(false, "根据O销售订单主键:{},无法匹配到U8C销售订单明细行(传到U8C可能失败了!)", soSaleEntityList.get(soSaleEntityList.size() - 1).getCsaleid());
|
||||
}
|
||||
|
||||
//查询U8C销售订单对应的销售出库单表头
|
||||
IcGeneralHEntity icGeneralHEntity = new IcGeneralHEntity();
|
||||
icGeneralHEntity.setCsourcebillhid(soSaleEntityList.get(soSaleEntityList.size() - 1).getCsaleid());
|
||||
icGeneralHEntity.setDr(0);
|
||||
icGeneralHEntity.setDataSourceCode("lets_u8c");
|
||||
List<IcGeneralHEntity> icGeneralHEntityList = iIcGeneralHDao.query(icGeneralHEntity);
|
||||
if (icGeneralHEntityList == null || icGeneralHEntityList.size() == 0) {
|
||||
Assert.state(false, "根据U8C销售订单表头id:{},无法查询到销售出库单", soSaleEntityList.get(soSaleEntityList.size() - 1).getCsaleid());
|
||||
} else if (icGeneralHEntityList.size() >= 2) {
|
||||
Assert.state(false, "根据U8C销售订单表头id:{},查询到{}个销售出库单", soSaleEntityList.get(soSaleEntityList.size() - 1).getCsaleid(), icGeneralHEntityList.size());
|
||||
}
|
||||
|
||||
//查询U8C销售订单对应的销售出库单表体
|
||||
IcGeneralBEntity icGeneralBEntity = new IcGeneralBEntity();
|
||||
icGeneralBEntity.setCsourcebillhid(soSaleEntityList.get(soSaleEntityList.size() - 1).getCsaleid());
|
||||
icGeneralBEntity.setDr(0);
|
||||
icGeneralBEntity.setDataSourceCode("lets_u8c");
|
||||
List<IcGeneralBEntity> icGeneralBEntityList = iIcGeneralBDao.query(icGeneralBEntity);
|
||||
if (icGeneralBEntityList == null || icGeneralBEntityList.size() == 0) {
|
||||
Assert.state(false, "根据U8C销售订单表头id:{},无法查询到销售出库单明细行", soSaleEntityList.get(soSaleEntityList.size() - 1).getCsaleid());
|
||||
}
|
||||
|
||||
//2024年8月30日 11:09:32 查询U8C销售订单执行情况明细表,主要是带出U8C销售订单表体的自定义项
|
||||
SoSaleorderBEntity soSaleorderBEntity1 = new SoSaleorderBEntity();
|
||||
soSaleorderBEntity1.setCsaleid(soSaleEntityList.get(soSaleEntityList.size() - 1).getCsaleid());
|
||||
List<ExtIntegrationTaskLivingDetailsQueryVo> extIntegrationTaskLivingDetailsQueryVos = iSoSaleorderBDao.queryErrorDetailsId(soSaleorderBEntity1);
|
||||
if (extIntegrationTaskLivingDetailsQueryVos == null || extIntegrationTaskLivingDetailsQueryVos.size() == 0) {
|
||||
Assert.state(false, "根据销售订单主键:{},无法匹配到销售订单执行情况明细");
|
||||
}
|
||||
|
||||
// 销售公司、发货公司
|
||||
String companyCode = header.getCompanyCode();
|
||||
Assert.notNull(companyCode, "O表头公司不能为空");
|
||||
|
@ -871,17 +943,17 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
|
||||
//2024年8月28日 11:01:07 查询对应的U8C销售订单
|
||||
SoSaleEntity soSaleEntity = new SoSaleEntity();
|
||||
soSaleEntity.setDr(0L);
|
||||
soSaleEntity.setDataSourceCode("lets_u8c");
|
||||
soSaleEntity.setVdef19(header.getCode());
|
||||
soSaleEntity.setVdef20(header.getId());
|
||||
List<SoSaleEntity> soSaleEntityList = iSoSaleDao.query(soSaleEntity);
|
||||
if (soSaleEntityList == null || soSaleEntityList.size() == 0) {
|
||||
Assert.state(false, "根据O出库单主键:{} 单号:{} 无法匹配到U8C销售订单(传到U8C可能失败了!)", header.getId(), header.getCode());
|
||||
} else if (soSaleEntityList.size() >= 2) {
|
||||
Assert.state(false, "根据O出库单主键:{} 单号:{} 匹配到{}个U8C销售订单", header.getId(), header.getCode(), soSaleEntityList.size());
|
||||
}
|
||||
// SoSaleEntity soSaleEntity = new SoSaleEntity();
|
||||
// soSaleEntity.setDr(0L);
|
||||
// soSaleEntity.setDataSourceCode("lets_u8c");
|
||||
// soSaleEntity.setVdef19(header.getCode());
|
||||
// soSaleEntity.setVdef20(header.getId());
|
||||
// List<SoSaleEntity> soSaleEntityList = iSoSaleDao.query(soSaleEntity);
|
||||
// if (soSaleEntityList == null || soSaleEntityList.size() == 0) {
|
||||
// Assert.state(false, "根据O出库单主键:{} 单号:{} 无法匹配到U8C销售订单(传到U8C可能失败了!)", header.getId(), header.getCode());
|
||||
// } else if (soSaleEntityList.size() >= 2) {
|
||||
// Assert.state(false, "根据O出库单主键:{} 单号:{} 匹配到{}个U8C销售订单", header.getId(), header.getCode(), soSaleEntityList.size());
|
||||
// }
|
||||
|
||||
OrderToBHeaderDto orderOutTobHeaderDto = new OrderToBHeaderDto();
|
||||
orderOutTobHeaderDto.setBdCorpEntity(bdCorpEntityList.get(0));
|
||||
|
@ -896,16 +968,21 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
orderOutTobHeaderDto.setShopArchives(bdDefdocEntityList2.get(0));
|
||||
orderOutTobHeaderDto.setSaleOrderMessageDto(saleOrderMessageDto);
|
||||
orderOutTobHeaderDto.setSoSaleEntity(soSaleEntityList.get(0));
|
||||
orderOutTobHeaderDto.setIcGeneralHEntity(icGeneralHEntityList.get(0));
|
||||
orderOutTobHeaderDto.setIcGeneralBEntityList(icGeneralBEntityList);
|
||||
orderOutTobHeaderDto.setSoSaleorderBEntityList(soSaleorderBEntityList);
|
||||
orderOutTobHeaderDto.setExtIntegrationTaskLivingDetailsQueryVos(extIntegrationTaskLivingDetailsQueryVos);
|
||||
|
||||
orderOutTobHeaderDto.setHeader(header);
|
||||
orderOutTobHeaderDto.setDetails(details);
|
||||
|
||||
BeanUtil.copyPropertiesV2(header, orderOutTobHeaderDto);
|
||||
orderToBHeaderDtoArrayList.add(orderOutTobHeaderDto);
|
||||
}
|
||||
//成功
|
||||
//成功,记录到日志表
|
||||
} catch (Exception e) {
|
||||
logger.error("OFS销售出库单关联查询U8C档案失败", e);
|
||||
//失败
|
||||
//失败,记录到日志表
|
||||
}
|
||||
} else {
|
||||
logger.info("queryBasicArchives方法对应的returnGoodHeaderDetailsDataDtoList.size为0");
|
||||
|
@ -968,7 +1045,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
//查询业务流程
|
||||
//2024年8月6日 11:33:07 具体的业务流程名称,还需要实施提供
|
||||
String processName = "TOB销售";
|
||||
BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName, null);
|
||||
BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName);
|
||||
Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName);
|
||||
return bdBusitypeEntity;
|
||||
}
|
||||
|
@ -1098,6 +1175,27 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回结果解析处理,在确认了success后调用
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
private SaleinvoiceDto resultDataHandleV2(String resultData) {
|
||||
try {
|
||||
if (resultData != null && !"".equals(resultData)) {
|
||||
if (resultData.contains("[")) {
|
||||
resultData = resultData.substring(1, resultData.length() - 1);
|
||||
}
|
||||
return JSON.parseObject(resultData, SaleinvoiceDto.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
logger.error("解析返回参数失败的错误", e);
|
||||
//如果解析失败,记录原因,但是不能影响结果的记录
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充主表主键、业务日期、业务类型
|
||||
* 2024年8月15日 17:31:54
|
||||
|
@ -1122,13 +1220,15 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) {
|
||||
try {
|
||||
// 查询基本档案
|
||||
//转换基本档案
|
||||
List<OrderToBHeaderDto> orderToBHeaderDtos = queryBasicArchivesTran(returnGoodHeaderDetailsDataDtoList);
|
||||
// 查询U8C业务流程
|
||||
//查询U8C业务流程
|
||||
BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow();
|
||||
// 查询销售收发类别
|
||||
//查询销售收发类别
|
||||
BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("201");
|
||||
|
||||
logger.info("TOB销售业务退货到账成功同步,档案转换成功对应的数量:{}行需要进行数据转换", orderToBHeaderDtos.size());
|
||||
logger.info("TOB销售发票业务流程编码:{}", bdBusitypeEntity.getBusicode());
|
||||
for (int i = 0; i < orderToBHeaderDtos.size(); i++) {
|
||||
OrderToBHeaderDto orderOutTobHeaderDto = orderToBHeaderDtos.get(i);
|
||||
StockinOrderSearchResponse.StockinOrder.StockinH header = orderOutTobHeaderDto.getHeader();
|
||||
|
@ -1138,7 +1238,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
BdCorpEntity bdCorpEntity = orderOutTobHeaderDto.getBdCorpEntity();
|
||||
//发货库存组织
|
||||
BdCalbodyEntity bdCalbodyEntity = orderOutTobHeaderDto.getBdCalbodyEntity();
|
||||
//入库参数
|
||||
//入库仓库
|
||||
BdStordocEntity bdStordocEntity = orderOutTobHeaderDto.getBdStordocEntity();
|
||||
//销售组织
|
||||
BdSalestruEntity bdSalestruEntity = orderOutTobHeaderDto.getBdSalestruEntity();
|
||||
|
@ -1158,9 +1258,18 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
BdDefdocEntity shopArchives = orderOutTobHeaderDto.getShopArchives();
|
||||
//U8C销售订单
|
||||
SoSaleEntity soSaleEntity = orderOutTobHeaderDto.getSoSaleEntity();
|
||||
//OFS售后订单
|
||||
//U8C销售订单明细行
|
||||
List<SoSaleorderBEntity> soSaleorderBEntityList = orderOutTobHeaderDto.getSoSaleorderBEntityList();
|
||||
//U8C销售出库单
|
||||
IcGeneralHEntity icGeneralHEntity = orderOutTobHeaderDto.getIcGeneralHEntity();
|
||||
//U8C销售出库单明细行
|
||||
List<IcGeneralBEntity> icGeneralBEntityList = orderOutTobHeaderDto.getIcGeneralBEntityList();
|
||||
//U8C销售订单执行情况明细表
|
||||
List<ExtIntegrationTaskLivingDetailsQueryVo> extIntegrationTaskLivingDetailsQueryVos = orderOutTobHeaderDto.getExtIntegrationTaskLivingDetailsQueryVos();
|
||||
//售后订单
|
||||
SaleOrderMessageDto saleOrderMessageDto = orderOutTobHeaderDto.getSaleOrderMessageDto();
|
||||
|
||||
//红字销售发票表头
|
||||
SalesInvoiceHeadDto salesInvoiceHeadDto = new SalesInvoiceHeadDto();
|
||||
salesInvoiceHeadDto.setCbiztype(bdBusitypeEntity.getPkBusitype());
|
||||
salesInvoiceHeadDto.setCcalbodyid(bdCalbodyEntity.getPkCalbody());
|
||||
|
@ -1170,9 +1279,23 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
salesInvoiceHeadDto.setPk_corp(bdCorpEntity.getPkCorp());
|
||||
salesInvoiceHeadDto.setDbilldate(successfulTradeDate);
|
||||
salesInvoiceHeadDto.setFinvoicetype("1");//不传默认为1
|
||||
salesInvoiceHeadDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//部门
|
||||
salesInvoiceHeadDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//仓库
|
||||
salesInvoiceHeadDto.setCdispatcherid(bdRdclEntity.getPkRdcl());//收发类别
|
||||
salesInvoiceHeadDto.setCreceiptcustomerid(bdCumandocEntity.getPkCumandoc());//收货单位
|
||||
salesInvoiceHeadDto.setCreceipttype("32");//单据类型
|
||||
salesInvoiceHeadDto.setDmakedate(successfulTradeDate);//制单日期
|
||||
salesInvoiceHeadDto.setNdiscountrate("100");//整单折扣
|
||||
salesInvoiceHeadDto.setDapprovedate(successfulTradeDate);//审批日期
|
||||
salesInvoiceHeadDto.setVdef17(ProfilesActiveConstant.sourceSystem1);
|
||||
salesInvoiceHeadDto.setVdef19(header.getCode());
|
||||
salesInvoiceHeadDto.setVdef20(header.getId());
|
||||
//平台
|
||||
salesInvoiceHeadDto.setPk_defdoc2(platformArchives.getPkDefdoc());
|
||||
salesInvoiceHeadDto.setVdef2(platformArchives.getDocname());
|
||||
//店铺
|
||||
salesInvoiceHeadDto.setPk_defdoc1(shopArchives.getPkDefdoc());
|
||||
salesInvoiceHeadDto.setVdef1(shopArchives.getDocname());
|
||||
|
||||
List<SalesInvoiceBodyDto> salesInvoiceBodyDtoList = new ArrayList<>();
|
||||
for (int j = 0; j < details.size(); j++) {
|
||||
|
@ -1183,14 +1306,19 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
BdInvbasdocEntity bdInvbasdocEntity = queryStockBasicArchives(bdInvmandocEntity.getPkInvmandoc(), deliverGoodsCorp.getPkCorp());
|
||||
//根据存货基础档案编码,查询当前存货的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity1 = queryBdTaxitems(bdInvbasdocEntity.getInvcode());
|
||||
//对应的售后入库单,主要是取这个价格
|
||||
//2024年8月30日 11:20:08 查找对应的售后订单的明细行,主要取价格
|
||||
DetailsDto afterSalesOrder = findAfterSalesOrder(stockinB, saleOrderMessageDto);
|
||||
//查找来源单据,销售发票的来源单据为销售出库单
|
||||
IcGeneralBEntity sourceDocuments = findSourceDocuments(header, stockinB, soSaleorderBEntityList, icGeneralBEntityList, extIntegrationTaskLivingDetailsQueryVos);
|
||||
//查找来源销售订单明细行
|
||||
SoSaleorderBEntity sourceDocumentsV2 = findSourceDocumentsV2(header, stockinB, soSaleorderBEntityList, extIntegrationTaskLivingDetailsQueryVos);
|
||||
|
||||
BigDecimal noriginalcurtaxprice = null;//含税单价
|
||||
try {
|
||||
noriginalcurtaxprice = new BigDecimal(afterSalesOrder.getTotalAmount()).divide(new BigDecimal(stockinB.getReceivedQty()), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
|
||||
} catch (Exception e) {
|
||||
logger.error("含税单价金额计算失败!", e);
|
||||
Assert.state(false, "含税单价金额计算失败 原因:{}", e.getMessage());
|
||||
}
|
||||
|
||||
Boolean isblargessflag = false;
|
||||
|
@ -1206,6 +1334,12 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
salesInvoiceBodyDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价
|
||||
salesInvoiceBodyDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率
|
||||
salesInvoiceBodyDto.setBlargessflag(isblargessflag);
|
||||
salesInvoiceBodyDto.setCoriginalbillcode(soSaleEntity.getVreceiptcode());//源头单据号
|
||||
salesInvoiceBodyDto.setCsourcebillbodyid(sourceDocumentsV2.getCorderBid());//源头单据明细行主键 (数据字典上是来源单据明细行主键,实际上是源头)
|
||||
salesInvoiceBodyDto.setCsourcebillid(soSaleEntity.getCsaleid());//源头单据主表主键(数据字典上是来源单据主表主键,实际上是源头)
|
||||
salesInvoiceBodyDto.setCupsourcebillbodyid(sourceDocuments.getCgeneralbid());//上层来源明细行主键
|
||||
salesInvoiceBodyDto.setCupsourcebillcode(icGeneralHEntity.getVbillcode());//直接来源单据号
|
||||
salesInvoiceBodyDto.setCupsourcebillid(icGeneralHEntity.getCgeneralhid());//来源主表主键
|
||||
salesInvoiceBodyDtoList.add(salesInvoiceBodyDto);
|
||||
}
|
||||
SalesInvoiceDto salesInvoiceDto = new SalesInvoiceDto();
|
||||
|
@ -1219,8 +1353,13 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
stringListMap.put("billvos", salesInvoiceDtoList);
|
||||
|
||||
//推送到U8C生成销售发票
|
||||
SoSaleResultRootDto soSaleResultRootDto = sendU8CTOCSoSaleinvoiceB(JSON.toJSONString(stringListMap));
|
||||
SaleinvoiceDto saleinvoiceDto = sendU8CTOCSoSaleinvoiceB(JSON.toJSONString(stringListMap));
|
||||
//成功
|
||||
if (saleinvoiceDto != null && saleinvoiceDto.getParentvo() != null && saleinvoiceDto.getChildrenvo() != null) {
|
||||
SaleinvoiceHeadDto parentvo = saleinvoiceDto.getParentvo();
|
||||
List<SaleinvoiceBodyDto> childrenvo = saleinvoiceDto.getChildrenvo();
|
||||
logger.info("TOB销售发票(红字)生成成功 编码:{} 发票公司:{}", parentvo.getVreceiptcode(), parentvo.getPk_corp());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("TOB外层转换逻辑抛出异常", e);
|
||||
|
@ -1255,12 +1394,12 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
|
||||
/**
|
||||
* 2024年8月28日 11:57:58
|
||||
* 2024年8月30日 11:29:24
|
||||
* 推送U8C销售发票
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
public SoSaleResultRootDto sendU8CTOCSoSaleinvoiceB(String param) throws Exception {
|
||||
public SaleinvoiceDto sendU8CTOCSoSaleinvoiceB(String param) throws Exception {
|
||||
long startLong = System.currentTimeMillis();
|
||||
logger.info("TOB销售发票推送开始,推送参数:" + param + ",U8C_URL:" + ProfilesActiveConstant.U8C_URL);
|
||||
String result = HttpRequest.post(ProfilesActiveConstant.U8C_URL).header("appId", "800037")//头信息,多个头信息多次调用此方法即可
|
||||
|
@ -1270,7 +1409,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
.body(param)//表单内容
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute().body();
|
||||
logger.info("TOB销售发票结束,返回参数:" + result);
|
||||
//2024年8月29日 17:56:50 如果http请求超时,则会抛给上层方法,上层方法会完成异常的捕捉
|
||||
logger.info("TOB销售发票推送结束,返回参数:" + result);
|
||||
long endLong = System.currentTimeMillis();
|
||||
logger.info("TOB销售发票接口请求耗时:" + (endLong - startLong));
|
||||
|
||||
|
@ -1278,11 +1418,11 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
result = String.valueOf(jsonObject.get("attribute"));
|
||||
|
||||
boolean isSuccess = false;
|
||||
SoSaleResultRootDto soSaleResultRootDto = null;
|
||||
SaleinvoiceDto soSaleResultRootDto = null;
|
||||
if (result != null && !"".equals(result)) {
|
||||
ReusltStrDto reusltStrDto = JSON.parseObject(result, ReusltStrDto.class);
|
||||
if ("success".equals(reusltStrDto.getStatus())) {
|
||||
soSaleResultRootDto = resultDataHandle(reusltStrDto.getData());
|
||||
soSaleResultRootDto = resultDataHandleV2(reusltStrDto.getData());
|
||||
isSuccess = true;
|
||||
}
|
||||
}
|
||||
|
@ -1323,4 +1463,84 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
Assert.state(false, "通过售后入库单号({})无法匹配到售后订单", stockinB.getId());
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找来源单据,销售发票的来源单据为销售出库单,生成TOB销售订单时,明细行传O的明细行主键,查找逻辑
|
||||
* O明细行主键 -> 定位到U8C销售订单明细行 -> 销售出库单明细行
|
||||
*
|
||||
* @param header O表头明细行
|
||||
* @param stockinB O明细行
|
||||
* @param soSaleorderBEntityList U8C销售订单明细集合
|
||||
* @param icGeneralBEntityList U8C销售出库单明细集合
|
||||
* @param extIntegrationTaskLivingDetailsQueryVos U8C销售订单执行情况明细表
|
||||
* @author liuyang
|
||||
*/
|
||||
private IcGeneralBEntity findSourceDocuments(StockinOrderSearchResponse.StockinOrder.StockinH header, StockinOrderSearchResponse.StockinOrder.StockinB stockinB, List<SoSaleorderBEntity> soSaleorderBEntityList, List<IcGeneralBEntity> icGeneralBEntityList, List<ExtIntegrationTaskLivingDetailsQueryVo> extIntegrationTaskLivingDetailsQueryVos) {
|
||||
Assert.notNull(header, "header不能为空");
|
||||
Assert.notNull(stockinB, "detailsDto不能为空");
|
||||
Assert.notNull(soSaleorderBEntityList, "soSaleorderBEntityList不能为空");
|
||||
Assert.notNull(icGeneralBEntityList, "icGeneralBEntityList不能为空");
|
||||
Assert.notNull(extIntegrationTaskLivingDetailsQueryVos, "extIntegrationTaskLivingDetailsQueryVos不能为空");
|
||||
|
||||
ExtIntegrationTaskLivingDetailsQueryVo targetExtIntegrationTaskLivingDetailsQueryVo = null;
|
||||
for (int i = 0; i < extIntegrationTaskLivingDetailsQueryVos.size(); i++) {
|
||||
ExtIntegrationTaskLivingDetailsQueryVo extIntegrationTaskLivingDetailsQueryVo = extIntegrationTaskLivingDetailsQueryVos.get(i);
|
||||
if (extIntegrationTaskLivingDetailsQueryVo.getVdef20().equals(stockinB.getId())) {
|
||||
targetExtIntegrationTaskLivingDetailsQueryVo = extIntegrationTaskLivingDetailsQueryVo;
|
||||
}
|
||||
}
|
||||
Assert.notNull(targetExtIntegrationTaskLivingDetailsQueryVo, "无法匹配到销售订单执行情况明细行,O明细行主键", stockinB.getId());
|
||||
|
||||
SoSaleorderBEntity targetSoSaleorderBEntity = null;
|
||||
for (int i = 0; i < soSaleorderBEntityList.size(); i++) {
|
||||
SoSaleorderBEntity soSaleorderBEntity = soSaleorderBEntityList.get(i);
|
||||
if (targetExtIntegrationTaskLivingDetailsQueryVo.getCsale_bid().equals(soSaleorderBEntity.getCorderBid())) {
|
||||
targetSoSaleorderBEntity = soSaleorderBEntity;
|
||||
}
|
||||
}
|
||||
Assert.notNull(targetSoSaleorderBEntity, "根据O出库单明细主键:{},无法匹配到U8C销售订单明细行");
|
||||
|
||||
for (int i = 0; i < icGeneralBEntityList.size(); i++) {
|
||||
IcGeneralBEntity icGeneralBEntity = icGeneralBEntityList.get(i);
|
||||
if (icGeneralBEntity.getCsourcebillbid().equals(targetSoSaleorderBEntity.getCorderBid())) {
|
||||
return icGeneralBEntity;
|
||||
}
|
||||
}
|
||||
Assert.state(false, "根据销售订单明细行主键:{} 无法匹配到销售出库单明细行", targetSoSaleorderBEntity.getCorderBid());
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找销售订单明细行
|
||||
*
|
||||
* @param header O表头明细行
|
||||
* @param stockinB O明细行
|
||||
* @param soSaleorderBEntityList U8C销售订单明细集合
|
||||
* @author liuyang
|
||||
*/
|
||||
private SoSaleorderBEntity findSourceDocumentsV2(StockinOrderSearchResponse.StockinOrder.StockinH header, StockinOrderSearchResponse.StockinOrder.StockinB stockinB, List<SoSaleorderBEntity> soSaleorderBEntityList, List<ExtIntegrationTaskLivingDetailsQueryVo> extIntegrationTaskLivingDetailsQueryVos) {
|
||||
Assert.notNull(header, "header不能为空");
|
||||
Assert.notNull(stockinB, "stockinB不能为空");
|
||||
Assert.notNull(soSaleorderBEntityList, "soSaleorderBEntityList不能为空");
|
||||
Assert.notNull(extIntegrationTaskLivingDetailsQueryVos, "extIntegrationTaskLivingDetailsQueryVos不能为空!");
|
||||
|
||||
ExtIntegrationTaskLivingDetailsQueryVo targetExtIntegrationTaskLivingDetailsQueryVo = null;
|
||||
for (int i = 0; i < extIntegrationTaskLivingDetailsQueryVos.size(); i++) {
|
||||
ExtIntegrationTaskLivingDetailsQueryVo extIntegrationTaskLivingDetailsQueryVo = extIntegrationTaskLivingDetailsQueryVos.get(i);
|
||||
if (extIntegrationTaskLivingDetailsQueryVo.getVdef20().equals(stockinB.getId())) {
|
||||
targetExtIntegrationTaskLivingDetailsQueryVo = extIntegrationTaskLivingDetailsQueryVo;
|
||||
}
|
||||
}
|
||||
Assert.notNull(targetExtIntegrationTaskLivingDetailsQueryVo, "无法匹配到销售订单执行情况明细行,O明细行主键", stockinB.getId());
|
||||
|
||||
SoSaleorderBEntity targetSoSaleorderBEntity = null;
|
||||
for (int i = 0; i < soSaleorderBEntityList.size(); i++) {
|
||||
SoSaleorderBEntity soSaleorderBEntity = soSaleorderBEntityList.get(i);
|
||||
if (targetExtIntegrationTaskLivingDetailsQueryVo.getCsale_bid().equals(soSaleorderBEntity.getCorderBid())) {
|
||||
targetSoSaleorderBEntity = soSaleorderBEntity;
|
||||
}
|
||||
}
|
||||
Assert.notNull(targetSoSaleorderBEntity, "根据O出库单明细主键:{},无法匹配到U8C销售订单明细行");
|
||||
return targetSoSaleorderBEntity;
|
||||
}
|
||||
}
|
|
@ -766,7 +766,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
//查询业务流程
|
||||
//2024年8月6日 11:33:07 具体的业务流程名称,还需要实施提供
|
||||
String processName = "TOC销售";
|
||||
BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName, null);
|
||||
BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName);
|
||||
Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName);
|
||||
return bdBusitypeEntity;
|
||||
}
|
||||
|
|
|
@ -19,4 +19,5 @@ public class ConsignmachiningInBodyDto {
|
|||
private String vsourcerowno;
|
||||
private String vsourcebillcode;
|
||||
private String writeofftype;//核销方式
|
||||
private String dbizdate;
|
||||
}
|
||||
|
|
|
@ -19,4 +19,5 @@ public class ConsignmachiningInHeadDto {
|
|||
private String cbiztype;
|
||||
private String cdispatcherid;
|
||||
private String dbilldate;
|
||||
private Boolean freplenishflag;
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.hzya.frame.plugin.lets.u8cdto;
|
||||
|
||||
import com.hzya.frame.plugin.lets.entity.*;
|
||||
import com.hzya.frame.plugin.lets.queryvo.ExtIntegrationTaskLivingDetailsQueryVo;
|
||||
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto;
|
||||
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto;
|
||||
import com.hzya.frame.ttxofs.dto.ofssalesordersearch.SaleOrderMessageDto;
|
||||
|
@ -20,7 +21,7 @@ import java.util.List;
|
|||
* @Filename:OrderToBHeaderDto
|
||||
*/
|
||||
@Data
|
||||
public class OrderToBHeaderDto {
|
||||
public class OrderToBHeaderDto extends StockinOrderSearchResponse.StockinOrder.StockinH {
|
||||
|
||||
/**
|
||||
* 表头公司(销售公司)、视为发货公司
|
||||
|
@ -102,4 +103,24 @@ public class OrderToBHeaderDto {
|
|||
* U8C销售订单
|
||||
*/
|
||||
private SoSaleEntity soSaleEntity;
|
||||
|
||||
/**
|
||||
* U8C销售出库单表头
|
||||
*/
|
||||
private IcGeneralHEntity icGeneralHEntity;
|
||||
|
||||
/**
|
||||
* U8C销售出库单明细行
|
||||
*/
|
||||
private List<IcGeneralBEntity> icGeneralBEntityList;
|
||||
|
||||
/**
|
||||
* U8C销售订单明细行
|
||||
*/
|
||||
private List<SoSaleorderBEntity> soSaleorderBEntityList;
|
||||
|
||||
/**
|
||||
* 执行情况自定义项
|
||||
*/
|
||||
private List<ExtIntegrationTaskLivingDetailsQueryVo> extIntegrationTaskLivingDetailsQueryVos;
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.hzya.frame.plugin.lets.u8cdto;
|
||||
|
||||
import com.hzya.frame.plugin.lets.entity.*;
|
||||
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData;
|
||||
import com.hzya.frame.ttxofs.dto.ofspurchasereturnorder.PurchaseReturnOrder;
|
||||
import com.hzya.frame.ttxofs.dto.ofspurchasereturnorder.PurchaseReturnOrderDetails;
|
||||
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto;
|
||||
|
@ -53,4 +54,9 @@ public class ReturnOrderHeaderDto extends HeaderDto {
|
|||
* OFS采退出库单明细行
|
||||
*/
|
||||
private List<DetailsDto> details;
|
||||
|
||||
/**
|
||||
* 查询OFS原正向的采购订单
|
||||
*/
|
||||
private OfsPoOrderData ofsPoOrder;
|
||||
}
|
|
@ -24,19 +24,22 @@ public class QueryBdBusitypeUtil {
|
|||
@Autowired
|
||||
private IBdBusitypeDao iBdBusitypeDao;
|
||||
|
||||
public BdBusitypeEntity queryBdBusitype(String businame, String pkCorp) {
|
||||
public BdBusitypeEntity queryBdBusitype(String businame) {
|
||||
String pkGroup = "0001";
|
||||
//查询业务流程
|
||||
BdBusitypeEntity bdBusitypeEntity = new BdBusitypeEntity();
|
||||
bdBusitypeEntity.setDataSourceCode("lets_u8c");
|
||||
bdBusitypeEntity.setBusiname(businame);
|
||||
//2024年8月26日 11:03:06 和浪哥沟通取pkCorp为4个@的业务流程!
|
||||
bdBusitypeEntity.setPkCorp(pkCorp);
|
||||
//2024年8月30日 13:49:54 @@@@为U8C预设的业务流程,和妮姐沟通后,所有流程,取集团对应的业务流程
|
||||
// bdBusitypeEntity.setPkCorp(pkCorp);
|
||||
bdBusitypeEntity.setPkCorp(pkGroup);
|
||||
bdBusitypeEntity.setDr(0);
|
||||
List<BdBusitypeEntity> bdBusitypeEntityList = iBdBusitypeDao.query(bdBusitypeEntity);
|
||||
if (bdBusitypeEntityList.size() == 0) {
|
||||
Assert.state(false, "没有查询到业务流程,业务流程名称:{}", bdBusitypeEntity.getBusiname());
|
||||
Assert.state(false, "没有查询到业务流程,业务流程名称:{} 公司主键:{}", bdBusitypeEntity.getBusiname(), pkGroup);
|
||||
} else if (bdBusitypeEntityList.size() > 1) {
|
||||
Assert.state(false, "查询到多个业务流程,业务流程名称:{}", bdBusitypeEntity.getBusiname());
|
||||
Assert.state(false, "查询到多个业务流程,业务流程名称:{} 公司主键:{}", bdBusitypeEntity.getBusiname(), pkGroup);
|
||||
}
|
||||
return bdBusitypeEntityList.get(0);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public class SoSaleReturnPluginInitializerToBTest {
|
|||
public void startImplement() {
|
||||
try {
|
||||
// soSaleReturnPluginInitializerToB.startImplement(null, null);
|
||||
soSaleReturnPluginInitializerToB.startImplement("LETS-RE2024081900000001");
|
||||
// soSaleReturnPluginInitializerToB.startImplement("LETS-RE2024081900000001");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue