提交日志业务流程优化
This commit is contained in:
parent
9c110e5b8c
commit
d0a0a10568
|
@ -466,11 +466,15 @@ public class ConsignmachiningIn extends PluginBaseEntity {
|
||||||
List<ConsignmachiningInSonDto> consignmachiningInSonDtoArrayList = new ArrayList<>();
|
List<ConsignmachiningInSonDto> consignmachiningInSonDtoArrayList = new ArrayList<>();
|
||||||
|
|
||||||
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) {
|
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) {
|
||||||
try {
|
for (int i = 0; i < returnGoodHeaderDetailsDataDtoList.size(); i++) {
|
||||||
for (int i = 0; i < returnGoodHeaderDetailsDataDtoList.size(); i++) {
|
StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoList.get(i);
|
||||||
StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoList.get(i);
|
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
|
||||||
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
|
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = stockinOrder.getDetails();
|
||||||
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = stockinOrder.getDetails();
|
|
||||||
|
String generateBusinessDate = null;
|
||||||
|
try {
|
||||||
|
//生成业务日期
|
||||||
|
generateBusinessDate = createGenerateBusinessDateV2(header);
|
||||||
|
|
||||||
//2024年8月25日 09:54:31 查询OFS采购订单
|
//2024年8月25日 09:54:31 查询OFS采购订单
|
||||||
OfsPoOrderData ofsPoOrderData = ofsStandardUtil.queryOfsPoOrder(header.getRefOrderCode());
|
OfsPoOrderData ofsPoOrderData = ofsStandardUtil.queryOfsPoOrder(header.getRefOrderCode());
|
||||||
|
@ -605,11 +609,26 @@ public class ConsignmachiningIn extends PluginBaseEntity {
|
||||||
|
|
||||||
BeanUtil.copyPropertiesV2(header, consignmachiningInSonDto);
|
BeanUtil.copyPropertiesV2(header, consignmachiningInSonDto);
|
||||||
consignmachiningInSonDtoArrayList.add(consignmachiningInSonDto);
|
consignmachiningInSonDtoArrayList.add(consignmachiningInSonDto);
|
||||||
|
//成功,交给下一个业务流程处理环节
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("采购入库单OFS档案转换错误", e);
|
||||||
|
|
||||||
|
String message = e.getMessage();
|
||||||
|
if (message == null) {
|
||||||
|
message = "未知错误";
|
||||||
|
}
|
||||||
|
//失败
|
||||||
|
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
|
||||||
|
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N);
|
||||||
|
integrationTaskLivingDetailsEntity.setRootAppNewData(JSON.toJSONString(stockinOrder));//原始数据json
|
||||||
|
integrationTaskLivingDetailsEntity.setNewTransmitInfo(JSON.toJSONString(message));//返回结果
|
||||||
|
integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
|
||||||
|
integrationTaskLivingDetailsEntity.setBusinessDate(generateBusinessDate);
|
||||||
|
integrationTaskLivingDetailsEntity.setRootAppPk(header.getId());
|
||||||
|
integrationTaskLivingDetailsEntity.setRootAppBill(header.getCode());
|
||||||
|
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
|
||||||
|
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
|
||||||
}
|
}
|
||||||
//成功
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("委外入库单OFS档案转换错误", e);
|
|
||||||
//失败
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.info("queryBasicArchives对应returnGoodHeaderDetailsDataDtoList.size为0");
|
logger.info("queryBasicArchives对应returnGoodHeaderDetailsDataDtoList.size为0");
|
||||||
|
@ -684,10 +703,33 @@ public class ConsignmachiningIn extends PluginBaseEntity {
|
||||||
* @author liuyang
|
* @author liuyang
|
||||||
*/
|
*/
|
||||||
private String createGenerateBusinessDate(ConsignmachiningInSonDto consignmachiningInSonDto) {
|
private String createGenerateBusinessDate(ConsignmachiningInSonDto consignmachiningInSonDto) {
|
||||||
//TODO 测试
|
if (consignmachiningInSonDto != null && consignmachiningInSonDto.getCheckInFrom() != null) {
|
||||||
consignmachiningInSonDto.setShipAt("2024-08-19");
|
String checkInFrom = consignmachiningInSonDto.getCheckInFrom();
|
||||||
if (consignmachiningInSonDto != null && consignmachiningInSonDto.getShipAt() != null) {
|
|
||||||
String shipAt = consignmachiningInSonDto.getShipAt();
|
String businessFormat = null;
|
||||||
|
try {
|
||||||
|
Date dbill = DateUtil.parse(checkInFrom);
|
||||||
|
businessFormat = DateUtil.format(dbill, "yyyy-MM-dd");
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("业务日期生成失败", e);
|
||||||
|
}
|
||||||
|
return businessFormat;
|
||||||
|
} else {
|
||||||
|
logger.error("生成采购订单入库日期失败,或者checkInFrom为空! json:{}", JSON.toJSON(consignmachiningInSonDto));
|
||||||
|
Assert.state(false, "生成采购订单入库日期失败,或者checkInFrom为空! json:{}", JSON.toJSON(consignmachiningInSonDto));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2024年8月20日 15:46:10
|
||||||
|
* 生成业务日期,以发货时间作为业务日期
|
||||||
|
*
|
||||||
|
* @author liuyang
|
||||||
|
*/
|
||||||
|
private String createGenerateBusinessDateV2(StockinOrderSearchResponse.StockinOrder.StockinH header) {
|
||||||
|
if (header != null) {
|
||||||
|
String shipAt = header.getShipAt();
|
||||||
String businessFormat = null;
|
String businessFormat = null;
|
||||||
try {
|
try {
|
||||||
Date dbill = DateUtil.parse(shipAt);
|
Date dbill = DateUtil.parse(shipAt);
|
||||||
|
@ -697,8 +739,8 @@ public class ConsignmachiningIn extends PluginBaseEntity {
|
||||||
}
|
}
|
||||||
return businessFormat;
|
return businessFormat;
|
||||||
} else {
|
} else {
|
||||||
logger.error("生成采购订单入库日期失败,或者shipAt为空! json:{}", JSON.toJSON(consignmachiningInSonDto));
|
logger.error("生成业务日期失败,或者shipAt为空! json:{}", JSON.toJSON(header));
|
||||||
Assert.state(false, "生成采购订单入库日期失败,或者shipAt为空! json:{}", JSON.toJSON(consignmachiningInSonDto));
|
Assert.state(false, "生成业务日期失败,或者shipAt为空! json:{}", JSON.toJSON(header));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -454,84 +454,107 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
|
||||||
HeaderDto header = headerDetailsDto.getHeader();
|
HeaderDto header = headerDetailsDto.getHeader();
|
||||||
List<DetailsDto> details = headerDetailsDto.getDetails();
|
List<DetailsDto> details = headerDetailsDto.getDetails();
|
||||||
|
|
||||||
//2024年8月27日 17:14:47 查询OFS采退订单
|
String generateBusinessDate = null;
|
||||||
PurchaseReturnOrder purchaseReturnOrder = queryPurchaseReturnOrder(header.getRefOrderCode());
|
try {
|
||||||
Assert.notNull(purchaseReturnOrder, "无法查询到采退订单 refOrderCode:{}", header.getRefOrderCode());
|
generateBusinessDate = createGenerateBusinessDatev2(header);
|
||||||
PurchaseReturnOrderHeader ofsWithdrawalHead = purchaseReturnOrder.getHeader();
|
|
||||||
List<PurchaseReturnOrderDetails> ofsWithdrawalDetails = purchaseReturnOrder.getDetails();
|
|
||||||
|
|
||||||
//如果该O采购订单对应的类型为:委外加工,则继续代码逻辑,否则就跳过代码逻辑
|
//2024年8月27日 17:14:47 查询OFS采退订单
|
||||||
boolean checkResult = onlyImplementProxyOrder.onlyImplementProxyOrder(purchaseReturnOrder, "WWJG");
|
PurchaseReturnOrder purchaseReturnOrder = queryPurchaseReturnOrder(header.getRefOrderCode());
|
||||||
if (!checkResult) {
|
Assert.notNull(purchaseReturnOrder, "无法查询到采退订单 refOrderCode:{}", header.getRefOrderCode());
|
||||||
continue;
|
PurchaseReturnOrderHeader ofsWithdrawalHead = purchaseReturnOrder.getHeader();
|
||||||
}
|
List<PurchaseReturnOrderDetails> ofsWithdrawalDetails = purchaseReturnOrder.getDetails();
|
||||||
|
|
||||||
//2024年8月30日 13:28:46 查询原委外订单(取的是钉钉推送到U8C的委外订单),查询逻辑:OFS采退出库单 -> OFS采退订单 -> OFS采购订单
|
//如果该O采购订单对应的类型为:委外加工,则继续代码逻辑,否则就跳过代码逻辑
|
||||||
OfsPoOrderData ofsPoOrder = queryOfsPoOrder(purchaseReturnOrder);
|
boolean checkResult = onlyImplementProxyOrder.onlyImplementProxyOrder(purchaseReturnOrder, "WWJG");
|
||||||
|
if (!checkResult) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//2024年8月30日 13:35:16 根据OFS采购订单,查询OFS委外订单
|
//2024年8月30日 13:28:46 查询原委外订单(取的是钉钉推送到U8C的委外订单),查询逻辑:OFS采退出库单 -> OFS采退订单 -> OFS采购订单
|
||||||
ScOrderEntity scOrderEntity = queryScOrder(ofsPoOrder.getHeader().getId());
|
OfsPoOrderData ofsPoOrder = queryOfsPoOrder(purchaseReturnOrder);
|
||||||
|
|
||||||
//2024年8月27日 17:14:51 查询U8C委外订单,如果这一步报错,后续的逻辑就没有必要执行了
|
//2024年8月30日 13:35:16 根据OFS采购订单,查询OFS委外订单
|
||||||
|
ScOrderEntity scOrderEntity = queryScOrder(ofsPoOrder.getHeader().getId());
|
||||||
|
|
||||||
|
//2024年8月27日 17:14:51 查询U8C委外订单,如果这一步报错,后续的逻辑就没有必要执行了
|
||||||
// String ofsId = ofsWithdrawalHead.getId();
|
// String ofsId = ofsWithdrawalHead.getId();
|
||||||
// Assert.notNull(ofsId, "通过接口查询到OFS采退订单,但是没有采退订单主键(id),业务逻辑无法完成");
|
// Assert.notNull(ofsId, "通过接口查询到OFS采退订单,但是没有采退订单主键(id),业务逻辑无法完成");
|
||||||
// ScOrderEntity scOrderEntity = queryScOrder(ofsId);
|
// ScOrderEntity scOrderEntity = queryScOrder(ofsId);
|
||||||
|
|
||||||
//2024年8月27日 17:14:57 根据U8C委外订单id,查询U8C委外订单表体明细行
|
//2024年8月27日 17:14:57 根据U8C委外订单id,查询U8C委外订单表体明细行
|
||||||
List<ScOrderBEntity> scOrderBEntityList = queryScOrderDetail(scOrderEntity.getCorderid());
|
List<ScOrderBEntity> scOrderBEntityList = queryScOrderDetail(scOrderEntity.getCorderid());
|
||||||
|
|
||||||
//2024年8月27日 17:15:02 委外入库公司,取委外订单上的公司,已经和妮姐确认,没有必要通过O的公司转换,因为不存在跨组织的问题
|
//2024年8月27日 17:15:02 委外入库公司,取委外订单上的公司,已经和妮姐确认,没有必要通过O的公司转换,因为不存在跨组织的问题
|
||||||
Assert.notNull(scOrderEntity.getPkCorp(), "O表头公司不能为空");
|
Assert.notNull(scOrderEntity.getPkCorp(), "O表头公司不能为空");
|
||||||
BdCorpEntity bdCorpEntity = new BdCorpEntity();
|
BdCorpEntity bdCorpEntity = new BdCorpEntity();
|
||||||
bdCorpEntity.setDr(0);
|
bdCorpEntity.setDr(0);
|
||||||
bdCorpEntity.setDataSourceCode("lets_u8c");
|
bdCorpEntity.setDataSourceCode("lets_u8c");
|
||||||
bdCorpEntity.setPkCorp(scOrderEntity.getPkCorp());
|
bdCorpEntity.setPkCorp(scOrderEntity.getPkCorp());
|
||||||
List<BdCorpEntity> bdCorpEntityList = iBdCorpDao.query(bdCorpEntity);
|
List<BdCorpEntity> bdCorpEntityList = iBdCorpDao.query(bdCorpEntity);
|
||||||
if (bdCorpEntityList.size() == 0) {
|
if (bdCorpEntityList.size() == 0) {
|
||||||
Assert.state(false, "根据委外订单公司主键:{},无法匹配到委外入库单", scOrderEntity.getPkCorp());
|
Assert.state(false, "根据委外订单公司主键:{},无法匹配到委外入库单", scOrderEntity.getPkCorp());
|
||||||
} else if (bdCorpEntityList.size() >= 2) {
|
} else if (bdCorpEntityList.size() >= 2) {
|
||||||
Assert.state(false, "根据委外订单公司主键:{},匹配到{}个委外入库单", scOrderEntity.getPkCorp(), bdCorpEntityList.size());
|
Assert.state(false, "根据委外订单公司主键:{},匹配到{}个委外入库单", scOrderEntity.getPkCorp(), bdCorpEntityList.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2024年8月27日 17:15:09 收货库存组织,应该是通过收货公司查询得出收货库存组织,目前收货公司和采购公司保持一致,那么就以采购公司带出!这个逻辑已经和佳妮确认
|
||||||
|
BdCalbodyEntity bdCalbodyEntity = new BdCalbodyEntity();
|
||||||
|
bdCalbodyEntity.setDr(0);
|
||||||
|
bdCalbodyEntity.setDataSourceCode("lets_u8c");
|
||||||
|
bdCalbodyEntity.setPkCorp(bdCorpEntityList.get(0).getPkCorp());
|
||||||
|
List<BdCalbodyEntity> bdCalbodyEntities = iBdCalbodyDao.query(bdCalbodyEntity);
|
||||||
|
if (bdCalbodyEntities.size() == 0) {
|
||||||
|
Assert.state(false, "根据U8C采购公司{},无法匹配到U8C发货库存组织", bdCorpEntityList.get(0).getPkCorp());
|
||||||
|
} else if (bdCalbodyEntities.size() >= 2) {
|
||||||
|
Assert.state(false, "根据U8C采购公司{},匹配到U8C发货库存组织{}个", bdCorpEntityList.get(0).getPkCorp(), bdCalbodyEntities.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
//入库仓库
|
||||||
|
String facilityCode = header.getFacilityCode();
|
||||||
|
Assert.notNull(facilityCode, "O售后入库单仓库facilityCode字段不能为空");
|
||||||
|
BdStordocEntity bdStordocEntity = new BdStordocEntity();
|
||||||
|
bdStordocEntity.setDr(0L);
|
||||||
|
bdStordocEntity.setDataSourceCode("lets_u8c");
|
||||||
|
bdStordocEntity.setPkCalbody(bdCalbodyEntities.get(0).getPkCalbody());
|
||||||
|
bdStordocEntity.setStorcode(facilityCode);
|
||||||
|
List<BdStordocEntity> bdStordocEntityList = iBdStordocDao.query(bdStordocEntity);
|
||||||
|
if (bdStordocEntityList.size() == 0) {
|
||||||
|
Assert.state(false, "根据O仓库编码+U8C收货库存组织主键,无法匹配到U8C仓库", facilityCode, bdCalbodyEntities.get(0).getPkCalbody());
|
||||||
|
} else if (bdStordocEntityList.size() >= 2) {
|
||||||
|
Assert.state(false, "根据O仓库编码+U8C收货库存组织主键,匹配到U8C仓库多个", facilityCode, bdCalbodyEntities.get(0).getPkCalbody());
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnOrderHeaderDto returnOrderHeaderDto = new ReturnOrderHeaderDto();
|
||||||
|
returnOrderHeaderDto.setPurchaseReturnOrder(purchaseReturnOrder);
|
||||||
|
returnOrderHeaderDto.setScOrderEntity(scOrderEntity);
|
||||||
|
returnOrderHeaderDto.setScOrderBEntityList(scOrderBEntityList);
|
||||||
|
returnOrderHeaderDto.setBdCorpEntity(bdCorpEntityList.get(0));
|
||||||
|
returnOrderHeaderDto.setBdCalbodyEntity(bdCalbodyEntities.get(0));
|
||||||
|
returnOrderHeaderDto.setBdStordocEntity(bdStordocEntityList.get(0));
|
||||||
|
returnOrderHeaderDto.setDetails(details);
|
||||||
|
returnOrderHeaderDto.setOfsPoOrder(ofsPoOrder);
|
||||||
|
|
||||||
|
BeanUtil.copyPropertiesV2(header, returnOrderHeaderDto);
|
||||||
|
consignmachiningInSonDtoArrayList.add(returnOrderHeaderDto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("采购入库单OFS档案转换错误", e);
|
||||||
|
|
||||||
|
String message = e.getMessage();
|
||||||
|
if (message == null) {
|
||||||
|
message = "未知错误";
|
||||||
|
}
|
||||||
|
//失败
|
||||||
|
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
|
||||||
|
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N);
|
||||||
|
integrationTaskLivingDetailsEntity.setRootAppNewData(JSON.toJSONString(headerDetailsDto));//原始数据json
|
||||||
|
integrationTaskLivingDetailsEntity.setNewTransmitInfo(JSON.toJSONString(message));//返回结果
|
||||||
|
integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
|
||||||
|
integrationTaskLivingDetailsEntity.setBusinessDate(generateBusinessDate);
|
||||||
|
integrationTaskLivingDetailsEntity.setRootAppPk(header.getId());
|
||||||
|
integrationTaskLivingDetailsEntity.setRootAppBill(header.getCode());
|
||||||
|
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
|
||||||
|
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2024年8月27日 17:15:09 收货库存组织,应该是通过收货公司查询得出收货库存组织,目前收货公司和采购公司保持一致,那么就以采购公司带出!这个逻辑已经和佳妮确认
|
|
||||||
BdCalbodyEntity bdCalbodyEntity = new BdCalbodyEntity();
|
|
||||||
bdCalbodyEntity.setDr(0);
|
|
||||||
bdCalbodyEntity.setDataSourceCode("lets_u8c");
|
|
||||||
bdCalbodyEntity.setPkCorp(bdCorpEntityList.get(0).getPkCorp());
|
|
||||||
List<BdCalbodyEntity> bdCalbodyEntities = iBdCalbodyDao.query(bdCalbodyEntity);
|
|
||||||
if (bdCalbodyEntities.size() == 0) {
|
|
||||||
Assert.state(false, "根据U8C采购公司{},无法匹配到U8C发货库存组织", bdCorpEntityList.get(0).getPkCorp());
|
|
||||||
} else if (bdCalbodyEntities.size() >= 2) {
|
|
||||||
Assert.state(false, "根据U8C采购公司{},匹配到U8C发货库存组织{}个", bdCorpEntityList.get(0).getPkCorp(), bdCalbodyEntities.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
//入库仓库
|
|
||||||
String facilityCode = header.getFacilityCode();
|
|
||||||
Assert.notNull(facilityCode, "O售后入库单仓库facilityCode字段不能为空");
|
|
||||||
BdStordocEntity bdStordocEntity = new BdStordocEntity();
|
|
||||||
bdStordocEntity.setDr(0L);
|
|
||||||
bdStordocEntity.setDataSourceCode("lets_u8c");
|
|
||||||
bdStordocEntity.setPkCalbody(bdCalbodyEntities.get(0).getPkCalbody());
|
|
||||||
bdStordocEntity.setStorcode(facilityCode);
|
|
||||||
List<BdStordocEntity> bdStordocEntityList = iBdStordocDao.query(bdStordocEntity);
|
|
||||||
if (bdStordocEntityList.size() == 0) {
|
|
||||||
Assert.state(false, "根据O仓库编码+U8C收货库存组织主键,无法匹配到U8C仓库", facilityCode, bdCalbodyEntities.get(0).getPkCalbody());
|
|
||||||
} else if (bdStordocEntityList.size() >= 2) {
|
|
||||||
Assert.state(false, "根据O仓库编码+U8C收货库存组织主键,匹配到U8C仓库多个", facilityCode, bdCalbodyEntities.get(0).getPkCalbody());
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnOrderHeaderDto returnOrderHeaderDto = new ReturnOrderHeaderDto();
|
|
||||||
returnOrderHeaderDto.setPurchaseReturnOrder(purchaseReturnOrder);
|
|
||||||
returnOrderHeaderDto.setScOrderEntity(scOrderEntity);
|
|
||||||
returnOrderHeaderDto.setScOrderBEntityList(scOrderBEntityList);
|
|
||||||
returnOrderHeaderDto.setBdCorpEntity(bdCorpEntityList.get(0));
|
|
||||||
returnOrderHeaderDto.setBdCalbodyEntity(bdCalbodyEntities.get(0));
|
|
||||||
returnOrderHeaderDto.setBdStordocEntity(bdStordocEntityList.get(0));
|
|
||||||
returnOrderHeaderDto.setDetails(details);
|
|
||||||
returnOrderHeaderDto.setOfsPoOrder(ofsPoOrder);
|
|
||||||
|
|
||||||
BeanUtil.copyPropertiesV2(header, returnOrderHeaderDto);
|
|
||||||
consignmachiningInSonDtoArrayList.add(returnOrderHeaderDto);
|
|
||||||
}
|
}
|
||||||
//成功
|
//成功
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -784,6 +807,30 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2024年8月20日 15:46:10
|
||||||
|
* 生成业务日期,以发货时间作为业务日期
|
||||||
|
*
|
||||||
|
* @author liuyang
|
||||||
|
*/
|
||||||
|
private String createGenerateBusinessDatev2(HeaderDto header) throws Exception {
|
||||||
|
if (header != null) {
|
||||||
|
String shipAt = header.getShipAt();
|
||||||
|
String businessFormat = null;
|
||||||
|
try {
|
||||||
|
Date dbill = DateUtil.parse(shipAt);
|
||||||
|
businessFormat = DateUtil.format(dbill, "yyyy-MM-dd");
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("业务日期生成失败!", e);
|
||||||
|
}
|
||||||
|
return businessFormat;
|
||||||
|
} else {
|
||||||
|
logger.error("生成采退出库日期失败,或者shipAt为空! json:{}", JSON.toJSON(header));
|
||||||
|
Assert.state(false, "生成采退出库日期失败,或者shipAt为空! json:{}", JSON.toJSON(header));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 2024年8月7日 14:58:34
|
* 2024年8月7日 14:58:34
|
||||||
* 查询税目档案
|
* 查询税目档案
|
||||||
|
|
|
@ -503,11 +503,14 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
|
||||||
List<PoOrderRerturnSonDto> poOrderSonDtoArrayList = new ArrayList<>();
|
List<PoOrderRerturnSonDto> poOrderSonDtoArrayList = new ArrayList<>();
|
||||||
|
|
||||||
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) {
|
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) {
|
||||||
try {
|
for (int i = 0; i < returnGoodHeaderDetailsDataDtoList.size(); i++) {
|
||||||
for (int i = 0; i < returnGoodHeaderDetailsDataDtoList.size(); i++) {
|
HeaderDetailsDto headerDetailsDto = returnGoodHeaderDetailsDataDtoList.get(i);
|
||||||
HeaderDetailsDto headerDetailsDto = returnGoodHeaderDetailsDataDtoList.get(i);
|
HeaderDto header = headerDetailsDto.getHeader();
|
||||||
HeaderDto header = headerDetailsDto.getHeader();
|
List<DetailsDto> details = headerDetailsDto.getDetails();
|
||||||
List<DetailsDto> details = headerDetailsDto.getDetails();
|
|
||||||
|
String generateBusinessDate = null;
|
||||||
|
try {
|
||||||
|
generateBusinessDate = createGenerateBusinessDate(header);
|
||||||
|
|
||||||
//2024年8月22日 15:30:09 如果purchaseReturnOrder为null,那么在queryPurchaseReturnOrder会抛出异常,此处不需要验证purchaseReturnOrder是否为null
|
//2024年8月22日 15:30:09 如果purchaseReturnOrder为null,那么在queryPurchaseReturnOrder会抛出异常,此处不需要验证purchaseReturnOrder是否为null
|
||||||
PurchaseReturnOrder purchaseReturnOrder = queryPurchaseReturnOrder(header.getRefOrderCode());
|
PurchaseReturnOrder purchaseReturnOrder = queryPurchaseReturnOrder(header.getRefOrderCode());
|
||||||
|
@ -629,11 +632,25 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
|
||||||
|
|
||||||
BeanUtil.copyPropertiesV2(header, poOrderRerturnSonDto);
|
BeanUtil.copyPropertiesV2(header, poOrderRerturnSonDto);
|
||||||
poOrderSonDtoArrayList.add(poOrderRerturnSonDto);
|
poOrderSonDtoArrayList.add(poOrderRerturnSonDto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("档案转换失败", e);
|
||||||
|
|
||||||
|
String message = e.getMessage();
|
||||||
|
if (message == null) {
|
||||||
|
message = "未知错误";
|
||||||
|
}
|
||||||
|
//失败
|
||||||
|
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
|
||||||
|
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N);
|
||||||
|
integrationTaskLivingDetailsEntity.setRootAppNewData(JSON.toJSONString(headerDetailsDto));//原始数据json
|
||||||
|
integrationTaskLivingDetailsEntity.setNewTransmitInfo(JSON.toJSONString(message));//返回结果
|
||||||
|
integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
|
||||||
|
integrationTaskLivingDetailsEntity.setBusinessDate(generateBusinessDate);
|
||||||
|
integrationTaskLivingDetailsEntity.setRootAppPk(header.getId());
|
||||||
|
integrationTaskLivingDetailsEntity.setRootAppBill(header.getCode());
|
||||||
|
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
|
||||||
|
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
|
||||||
}
|
}
|
||||||
//成功
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("代理品牌采购入库单档案转换失败", e);
|
|
||||||
//失败
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.info("queryBasicArchives对应returnGoodHeaderDetailsDataDtoList.size为0");
|
logger.info("queryBasicArchives对应returnGoodHeaderDetailsDataDtoList.size为0");
|
||||||
|
@ -662,8 +679,6 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
|
||||||
* @author liuyang
|
* @author liuyang
|
||||||
*/
|
*/
|
||||||
private String createGenerateBusinessDate(PoOrderRerturnSonDto poOrderSonDto) {
|
private String createGenerateBusinessDate(PoOrderRerturnSonDto poOrderSonDto) {
|
||||||
//TODO 测试
|
|
||||||
poOrderSonDto.setShipAt("2024-08-19");
|
|
||||||
if (poOrderSonDto != null && poOrderSonDto.getShipAt() != null) {
|
if (poOrderSonDto != null && poOrderSonDto.getShipAt() != null) {
|
||||||
String shipAt = poOrderSonDto.getShipAt();
|
String shipAt = poOrderSonDto.getShipAt();
|
||||||
String businessFormat = null;
|
String businessFormat = null;
|
||||||
|
@ -681,6 +696,30 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2024年8月20日 15:46:10
|
||||||
|
* 生成业务日期,以发货时间作为业务日期
|
||||||
|
*
|
||||||
|
* @author liuyang
|
||||||
|
*/
|
||||||
|
private String createGenerateBusinessDate(HeaderDto header) {
|
||||||
|
if (header != null) {
|
||||||
|
String shipAt = header.getShipAt();
|
||||||
|
String businessFormat = null;
|
||||||
|
try {
|
||||||
|
Date dbill = DateUtil.parse(shipAt);
|
||||||
|
businessFormat = DateUtil.format(dbill, "yyyy-MM-dd");
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("业务日期生成失败", e);
|
||||||
|
}
|
||||||
|
return businessFormat;
|
||||||
|
} else {
|
||||||
|
logger.error("生成采退出库日期失败,或者shipAt为空! json:{}", JSON.toJSON(header));
|
||||||
|
Assert.state(false, "生成采退出库日期失败,或者shipAt为空! json:{}", JSON.toJSON(header));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询存货管理档案
|
* 查询存货管理档案
|
||||||
*
|
*
|
||||||
|
|
|
@ -499,125 +499,148 @@ public class ProxyPurchaseWarehous extends PluginBaseEntity {
|
||||||
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
|
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
|
||||||
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = stockinOrder.getDetails();
|
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = stockinOrder.getDetails();
|
||||||
|
|
||||||
//查询OFS采购订单
|
String generateBusinessDate = null;
|
||||||
OfsPoOrderData ofsPoOrderData = ofsStandardUtil.queryOfsPoOrder(header.getRefOrderCode());
|
try {
|
||||||
Assert.notNull(ofsPoOrderData, "根据O表头编码{},无法匹配到OFS采购订单", header.getRefOrderCode());
|
generateBusinessDate = createGenerateBusinessDate(stockinOrder);
|
||||||
boolean checkResult = onlyImplementProxyOrder.onlyImplementProxyOrder(ofsPoOrderData, "DLCG");
|
|
||||||
if (!checkResult) {
|
//查询OFS采购订单
|
||||||
continue;
|
OfsPoOrderData ofsPoOrderData = ofsStandardUtil.queryOfsPoOrder(header.getRefOrderCode());
|
||||||
|
Assert.notNull(ofsPoOrderData, "根据O表头编码{},无法匹配到OFS采购订单", header.getRefOrderCode());
|
||||||
|
boolean checkResult = onlyImplementProxyOrder.onlyImplementProxyOrder(ofsPoOrderData, "DLCG");
|
||||||
|
if (!checkResult) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//采购公司
|
||||||
|
String companyCode = header.getCompanyCode();
|
||||||
|
Assert.notNull(companyCode, "O表头公司不能为空");
|
||||||
|
BdCorpEntity bdCorpEntity = new BdCorpEntity();
|
||||||
|
bdCorpEntity.setDr(0);
|
||||||
|
bdCorpEntity.setDataSourceCode("lets_u8c");
|
||||||
|
bdCorpEntity.setUnitcode(companyCode);
|
||||||
|
List<BdCorpEntity> bdCorpEntityList = iBdCorpDao.query(bdCorpEntity);
|
||||||
|
if (bdCorpEntityList.size() == 0) {
|
||||||
|
Assert.state(false, "根据O货主编码{},无法匹配到U8C销售公司", companyCode);
|
||||||
|
} else if (bdCorpEntityList.size() >= 2) {
|
||||||
|
Assert.state(false, "根据O货主编码{},匹配到U8C销售公司{}个", companyCode, bdCorpEntityList.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
//采购部门:其他
|
||||||
|
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.size() == 0) {
|
||||||
|
Assert.state(false, "根据部门名称:{} 公司id:{},无法匹配到U8C销售组织", deptName, bdCorpEntityList.get(0).getPkCorp());
|
||||||
|
} else if (bdDeptdocEntityList.size() >= 2) {
|
||||||
|
Assert.state(false, "根据部门名称:{} 公司id:{},匹配到U8C销售组织{}个", deptName, bdCorpEntityList.get(0).getPkCorp());
|
||||||
|
}
|
||||||
|
|
||||||
|
//采购组织
|
||||||
|
BdPurorgEntity bdPurorgEntity = new BdPurorgEntity();
|
||||||
|
bdPurorgEntity.setDr("0");
|
||||||
|
bdPurorgEntity.setDataSourceCode("lets_u8c");
|
||||||
|
bdPurorgEntity.setOwnercorp(bdCorpEntityList.get(0).getPkCorp());
|
||||||
|
List<BdPurorgEntity> bdPurorgEntityList = iBdPurorgDao.query(bdPurorgEntity);
|
||||||
|
if (bdPurorgEntityList.size() == 0) {
|
||||||
|
Assert.state(false, "根据采购公司主键:{} 无法匹配到采购组织", bdCorpEntityList.get(0).getPkCorp());
|
||||||
|
} else if (bdPurorgEntityList.size() >= 2) {
|
||||||
|
Assert.state(false, "根据采购公司主键:{} 匹配到多个采购组织", bdCorpEntityList.get(0).getPkCorp());
|
||||||
|
}
|
||||||
|
|
||||||
|
//客商基本档案(供应商类型)
|
||||||
|
//2024年8月20日 14:47:55 丽知商城、OFS 供应商客商档案、传递到U8C的客商,
|
||||||
|
//其中自定义项1作为原系统编码,因此统一传到自定义项一,已经和大家确认好了,没有关系的,放心大胆传吧,宝贝
|
||||||
|
String shipFromCode = header.getShipFromCode();
|
||||||
|
Assert.notNull(shipFromCode, "O供应商编码不能为空,没有办法完成业务逻辑,请配置供应商编码(采购)");
|
||||||
|
Assert.state(!"".equals(shipFromCode.trim()), "O供应商编码不能为空,没有办法完成业务逻辑,请配置供应商编码(采购)!");
|
||||||
|
BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity();
|
||||||
|
bdCubasdocEntity.setDataSourceCode("lets_u8c");
|
||||||
|
bdCubasdocEntity.setDr(0L);
|
||||||
|
bdCubasdocEntity.setDef1(shipFromCode);
|
||||||
|
List<BdCubasdocEntity> bdCubasdocEntityList = iBdCubasdocDao.query(bdCubasdocEntity);
|
||||||
|
if (bdCubasdocEntityList == null || bdCubasdocEntityList.size() == 0) {
|
||||||
|
Assert.state(false, "根据OFS供应商业务编码{},无法查询到U8C客商档案信息(供应商)", shipFromCode);
|
||||||
|
} else if (bdCubasdocEntityList.size() >= 2) {
|
||||||
|
Assert.state(false, "根据OFS供应商业务编码{},查询到多个U8C客商档案信息(供应商)", shipFromCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
//客商管理档案
|
||||||
|
BdCumandocEntity bdCumandocEntity1 = new BdCumandocEntity();
|
||||||
|
bdCumandocEntity1.setDataSourceCode("lets_u8c");
|
||||||
|
bdCumandocEntity1.setDr(0L);
|
||||||
|
bdCumandocEntity1.setPkCorp(bdCorpEntityList.get(0).getPkCorp());
|
||||||
|
bdCumandocEntity1.setCustflags(ProfilesActiveConstant.SUPPLIER);
|
||||||
|
bdCumandocEntity1.setPkCubasdoc(bdCubasdocEntityList.get(0).getPkCubasdoc());
|
||||||
|
List<BdCumandocEntity> bdCumandocEntityList = iBdCumandocDao.query(bdCumandocEntity1);
|
||||||
|
if (bdCumandocEntityList == null || bdCumandocEntityList.size() == 0) {
|
||||||
|
Assert.state(false, "根据客商基本档案主键{},无法匹配到客商管理档案", bdCubasdocEntityList.get(0).getPkCubasdoc());
|
||||||
|
} else if (bdCumandocEntityList.size() >= 2) {
|
||||||
|
Assert.state(false, "根据客商基本档案主键{},匹配到多个客商管理档案", bdCubasdocEntityList.get(0).getPkCubasdoc());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2024年8月20日 23:51:56 收货库存组织,应该是通过收货公司查询得出收货库存组织,目前收货公司和采购公司保持一致,那么就以采购公司带出!这个逻辑已经和佳妮确认
|
||||||
|
BdCalbodyEntity bdCalbodyEntity = new BdCalbodyEntity();
|
||||||
|
bdCalbodyEntity.setDr(0);
|
||||||
|
bdCalbodyEntity.setDataSourceCode("lets_u8c");
|
||||||
|
bdCalbodyEntity.setPkCorp(bdCorpEntityList.get(0).getPkCorp());
|
||||||
|
List<BdCalbodyEntity> bdCalbodyEntities = iBdCalbodyDao.query(bdCalbodyEntity);
|
||||||
|
if (bdCalbodyEntities.size() == 0) {
|
||||||
|
Assert.state(false, "根据U8C采购公司{},无法匹配到U8C发货库存组织", bdCorpEntityList.get(0).getPkCorp());
|
||||||
|
} else if (bdCalbodyEntities.size() >= 2) {
|
||||||
|
Assert.state(false, "根据U8C采购公司{},匹配到U8C发货库存组织{}个", bdCorpEntityList.get(0).getPkCorp(), bdCalbodyEntities.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
//收货仓库
|
||||||
|
String facilityCode = header.getFacilityCode();
|
||||||
|
Assert.notNull(facilityCode, "O售后入库单仓库facilityCode字段不能为空");
|
||||||
|
BdStordocEntity bdStordocEntity = new BdStordocEntity();
|
||||||
|
bdStordocEntity.setDr(0L);
|
||||||
|
bdStordocEntity.setDataSourceCode("lets_u8c");
|
||||||
|
bdStordocEntity.setPkCalbody(bdCalbodyEntities.get(0).getPkCalbody());
|
||||||
|
bdStordocEntity.setStorcode(facilityCode);
|
||||||
|
List<BdStordocEntity> bdStordocEntityList = iBdStordocDao.query(bdStordocEntity);
|
||||||
|
if (bdStordocEntityList.size() == 0) {
|
||||||
|
Assert.state(false, "根据O仓库编码+U8C收货库存组织主键,无法匹配到U8C仓库", facilityCode, bdCalbodyEntities.get(0).getPkCalbody());
|
||||||
|
} else if (bdStordocEntityList.size() >= 2) {
|
||||||
|
Assert.state(false, "根据O仓库编码+U8C收货库存组织主键,匹配到U8C仓库多个", facilityCode, bdCalbodyEntities.get(0).getPkCalbody());
|
||||||
|
}
|
||||||
|
|
||||||
|
PoOrderSonDto poOrderSonDto = new PoOrderSonDto();
|
||||||
|
poOrderSonDto.setBdCorpEntity(bdCorpEntityList.get(0));
|
||||||
|
poOrderSonDto.setBdDeptdocEntity(bdDeptdocEntityList.get(0));
|
||||||
|
poOrderSonDto.setBdPurorgEntity(bdPurorgEntityList.get(0));
|
||||||
|
poOrderSonDto.setBdCubasdocEntity(bdCubasdocEntityList.get(0));
|
||||||
|
poOrderSonDto.setBdCumandocEntity(bdCumandocEntityList.get(0));
|
||||||
|
poOrderSonDto.setOfsPoOrderData(ofsPoOrderData);
|
||||||
|
poOrderSonDto.setBdCalbodyEntity(bdCalbodyEntities.get(0));
|
||||||
|
poOrderSonDto.setBdStordocEntity(bdStordocEntityList.get(0));
|
||||||
|
poOrderSonDto.setDetails(details);
|
||||||
|
|
||||||
|
BeanUtil.copyPropertiesV2(header, poOrderSonDto);
|
||||||
|
poOrderSonDtoArrayList.add(poOrderSonDto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("档案转换失败", e);
|
||||||
|
|
||||||
|
String message = e.getMessage();
|
||||||
|
if (message == null) {
|
||||||
|
message = "未知错误";
|
||||||
|
}
|
||||||
|
//失败
|
||||||
|
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
|
||||||
|
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N);
|
||||||
|
integrationTaskLivingDetailsEntity.setRootAppNewData(JSON.toJSONString(stockinOrder));//原始数据json
|
||||||
|
integrationTaskLivingDetailsEntity.setNewTransmitInfo(JSON.toJSONString(message));//返回结果
|
||||||
|
integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
|
||||||
|
integrationTaskLivingDetailsEntity.setBusinessDate(generateBusinessDate);
|
||||||
|
integrationTaskLivingDetailsEntity.setRootAppPk(header.getId());
|
||||||
|
integrationTaskLivingDetailsEntity.setRootAppBill(header.getCode());
|
||||||
|
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
|
||||||
|
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
//采购公司
|
|
||||||
String companyCode = header.getCompanyCode();
|
|
||||||
Assert.notNull(companyCode, "O表头公司不能为空");
|
|
||||||
BdCorpEntity bdCorpEntity = new BdCorpEntity();
|
|
||||||
bdCorpEntity.setDr(0);
|
|
||||||
bdCorpEntity.setDataSourceCode("lets_u8c");
|
|
||||||
bdCorpEntity.setUnitcode(companyCode);
|
|
||||||
List<BdCorpEntity> bdCorpEntityList = iBdCorpDao.query(bdCorpEntity);
|
|
||||||
if (bdCorpEntityList.size() == 0) {
|
|
||||||
Assert.state(false, "根据O货主编码{},无法匹配到U8C销售公司", companyCode);
|
|
||||||
} else if (bdCorpEntityList.size() >= 2) {
|
|
||||||
Assert.state(false, "根据O货主编码{},匹配到U8C销售公司{}个", companyCode, bdCorpEntityList.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
//采购部门:其他
|
|
||||||
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.size() == 0) {
|
|
||||||
Assert.state(false, "根据部门名称:{} 公司id:{},无法匹配到U8C销售组织", deptName, bdCorpEntityList.get(0).getPkCorp());
|
|
||||||
} else if (bdDeptdocEntityList.size() >= 2) {
|
|
||||||
Assert.state(false, "根据部门名称:{} 公司id:{},匹配到U8C销售组织{}个", deptName, bdCorpEntityList.get(0).getPkCorp());
|
|
||||||
}
|
|
||||||
|
|
||||||
//采购组织
|
|
||||||
BdPurorgEntity bdPurorgEntity = new BdPurorgEntity();
|
|
||||||
bdPurorgEntity.setDr("0");
|
|
||||||
bdPurorgEntity.setDataSourceCode("lets_u8c");
|
|
||||||
bdPurorgEntity.setOwnercorp(bdCorpEntityList.get(0).getPkCorp());
|
|
||||||
List<BdPurorgEntity> bdPurorgEntityList = iBdPurorgDao.query(bdPurorgEntity);
|
|
||||||
if (bdPurorgEntityList.size() == 0) {
|
|
||||||
Assert.state(false, "根据采购公司主键:{} 无法匹配到采购组织", bdCorpEntityList.get(0).getPkCorp());
|
|
||||||
} else if (bdPurorgEntityList.size() >= 2) {
|
|
||||||
Assert.state(false, "根据采购公司主键:{} 匹配到多个采购组织", bdCorpEntityList.get(0).getPkCorp());
|
|
||||||
}
|
|
||||||
|
|
||||||
//客商基本档案(供应商类型)
|
|
||||||
//2024年8月20日 14:47:55 丽知商城、OFS 供应商客商档案、传递到U8C的客商,
|
|
||||||
//其中自定义项1作为原系统编码,因此统一传到自定义项一,已经和大家确认好了,没有关系的,放心大胆传吧,宝贝
|
|
||||||
String shipFromCode = header.getShipFromCode();
|
|
||||||
Assert.notNull(shipFromCode, "O供应商编码不能为空,没有办法完成业务逻辑,请配置供应商编码(采购)");
|
|
||||||
Assert.state(!"".equals(shipFromCode.trim()), "O供应商编码不能为空,没有办法完成业务逻辑,请配置供应商编码(采购)!");
|
|
||||||
BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity();
|
|
||||||
bdCubasdocEntity.setDataSourceCode("lets_u8c");
|
|
||||||
bdCubasdocEntity.setDr(0L);
|
|
||||||
bdCubasdocEntity.setDef1(shipFromCode);
|
|
||||||
List<BdCubasdocEntity> bdCubasdocEntityList = iBdCubasdocDao.query(bdCubasdocEntity);
|
|
||||||
if (bdCubasdocEntityList == null || bdCubasdocEntityList.size() == 0) {
|
|
||||||
Assert.state(false, "根据OFS供应商业务编码{},无法查询到U8C客商档案信息(供应商)", shipFromCode);
|
|
||||||
} else if (bdCubasdocEntityList.size() >= 2) {
|
|
||||||
Assert.state(false, "根据OFS供应商业务编码{},查询到多个U8C客商档案信息(供应商)", shipFromCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
//客商管理档案
|
|
||||||
BdCumandocEntity bdCumandocEntity1 = new BdCumandocEntity();
|
|
||||||
bdCumandocEntity1.setDataSourceCode("lets_u8c");
|
|
||||||
bdCumandocEntity1.setDr(0L);
|
|
||||||
bdCumandocEntity1.setPkCorp(bdCorpEntityList.get(0).getPkCorp());
|
|
||||||
bdCumandocEntity1.setCustflags(ProfilesActiveConstant.SUPPLIER);
|
|
||||||
bdCumandocEntity1.setPkCubasdoc(bdCubasdocEntityList.get(0).getPkCubasdoc());
|
|
||||||
List<BdCumandocEntity> bdCumandocEntityList = iBdCumandocDao.query(bdCumandocEntity1);
|
|
||||||
if (bdCumandocEntityList == null || bdCumandocEntityList.size() == 0) {
|
|
||||||
Assert.state(false, "根据客商基本档案主键{},无法匹配到客商管理档案", bdCubasdocEntityList.get(0).getPkCubasdoc());
|
|
||||||
} else if (bdCumandocEntityList.size() >= 2) {
|
|
||||||
Assert.state(false, "根据客商基本档案主键{},匹配到多个客商管理档案", bdCubasdocEntityList.get(0).getPkCubasdoc());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2024年8月20日 23:51:56 收货库存组织,应该是通过收货公司查询得出收货库存组织,目前收货公司和采购公司保持一致,那么就以采购公司带出!这个逻辑已经和佳妮确认
|
|
||||||
BdCalbodyEntity bdCalbodyEntity = new BdCalbodyEntity();
|
|
||||||
bdCalbodyEntity.setDr(0);
|
|
||||||
bdCalbodyEntity.setDataSourceCode("lets_u8c");
|
|
||||||
bdCalbodyEntity.setPkCorp(bdCorpEntityList.get(0).getPkCorp());
|
|
||||||
List<BdCalbodyEntity> bdCalbodyEntities = iBdCalbodyDao.query(bdCalbodyEntity);
|
|
||||||
if (bdCalbodyEntities.size() == 0) {
|
|
||||||
Assert.state(false, "根据U8C采购公司{},无法匹配到U8C发货库存组织", bdCorpEntityList.get(0).getPkCorp());
|
|
||||||
} else if (bdCalbodyEntities.size() >= 2) {
|
|
||||||
Assert.state(false, "根据U8C采购公司{},匹配到U8C发货库存组织{}个", bdCorpEntityList.get(0).getPkCorp(), bdCalbodyEntities.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
//收货仓库
|
|
||||||
String facilityCode = header.getFacilityCode();
|
|
||||||
Assert.notNull(facilityCode, "O售后入库单仓库facilityCode字段不能为空");
|
|
||||||
BdStordocEntity bdStordocEntity = new BdStordocEntity();
|
|
||||||
bdStordocEntity.setDr(0L);
|
|
||||||
bdStordocEntity.setDataSourceCode("lets_u8c");
|
|
||||||
bdStordocEntity.setPkCalbody(bdCalbodyEntities.get(0).getPkCalbody());
|
|
||||||
bdStordocEntity.setStorcode(facilityCode);
|
|
||||||
List<BdStordocEntity> bdStordocEntityList = iBdStordocDao.query(bdStordocEntity);
|
|
||||||
if (bdStordocEntityList.size() == 0) {
|
|
||||||
Assert.state(false, "根据O仓库编码+U8C收货库存组织主键,无法匹配到U8C仓库", facilityCode, bdCalbodyEntities.get(0).getPkCalbody());
|
|
||||||
} else if (bdStordocEntityList.size() >= 2) {
|
|
||||||
Assert.state(false, "根据O仓库编码+U8C收货库存组织主键,匹配到U8C仓库多个", facilityCode, bdCalbodyEntities.get(0).getPkCalbody());
|
|
||||||
}
|
|
||||||
|
|
||||||
PoOrderSonDto poOrderSonDto = new PoOrderSonDto();
|
|
||||||
poOrderSonDto.setBdCorpEntity(bdCorpEntityList.get(0));
|
|
||||||
poOrderSonDto.setBdDeptdocEntity(bdDeptdocEntityList.get(0));
|
|
||||||
poOrderSonDto.setBdPurorgEntity(bdPurorgEntityList.get(0));
|
|
||||||
poOrderSonDto.setBdCubasdocEntity(bdCubasdocEntityList.get(0));
|
|
||||||
poOrderSonDto.setBdCumandocEntity(bdCumandocEntityList.get(0));
|
|
||||||
poOrderSonDto.setOfsPoOrderData(ofsPoOrderData);
|
|
||||||
poOrderSonDto.setBdCalbodyEntity(bdCalbodyEntities.get(0));
|
|
||||||
poOrderSonDto.setBdStordocEntity(bdStordocEntityList.get(0));
|
|
||||||
poOrderSonDto.setDetails(details);
|
|
||||||
|
|
||||||
BeanUtil.copyPropertiesV2(header, poOrderSonDto);
|
|
||||||
poOrderSonDtoArrayList.add(poOrderSonDto);
|
|
||||||
}
|
}
|
||||||
//成功
|
//成功
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -668,6 +691,31 @@ public class ProxyPurchaseWarehous extends PluginBaseEntity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2024年8月20日 15:46:10
|
||||||
|
* 生成业务日期,以发货时间作为业务日期
|
||||||
|
*
|
||||||
|
* @author liuyang
|
||||||
|
*/
|
||||||
|
private String createGenerateBusinessDate(StockinOrderSearchResponse.StockinOrder stockinOrder) {
|
||||||
|
if (stockinOrder != null) {
|
||||||
|
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
|
||||||
|
String checkInFrom = header.getCheckInFrom();
|
||||||
|
String businessFormat = null;
|
||||||
|
try {
|
||||||
|
Date dbill = DateUtil.parse(checkInFrom);
|
||||||
|
businessFormat = DateUtil.format(dbill, "yyyy-MM-dd");
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("业务日期生成失败", e);
|
||||||
|
}
|
||||||
|
return businessFormat;
|
||||||
|
} else {
|
||||||
|
logger.error("生成采购订单入库日期失败,或者shipAt为空! json:{}", JSON.toJSON(stockinOrder));
|
||||||
|
Assert.state(false, "生成采购订单入库日期失败,或者shipAt为空! json:{}", JSON.toJSON(stockinOrder));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询存货管理档案
|
* 查询存货管理档案
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue