优化代码流程

This commit is contained in:
liuy 2024-08-16 14:59:54 +08:00
parent aeeee1335b
commit 1f296c2ed5
12 changed files with 259 additions and 633 deletions

View File

@ -1,6 +1,8 @@
package com.hzya.frame.plugin.lets.ofs.entity; package com.hzya.frame.plugin.lets.ofs.entity;
import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchHeaderDto;
import com.hzya.frame.web.entity.BaseEntity; import com.hzya.frame.web.entity.BaseEntity;
import lombok.Data;
/** /**
* root(TocofsReturngoodsDetailed)实体类 * root(TocofsReturngoodsDetailed)实体类
@ -8,6 +10,7 @@ import com.hzya.frame.web.entity.BaseEntity;
* @author makejava * @author makejava
* @since 2024-08-09 13:45:47 * @since 2024-08-09 13:45:47
*/ */
@Data
public class TocofsReturngoodsDetailedEntity extends BaseEntity { public class TocofsReturngoodsDetailedEntity extends BaseEntity {
/** /**
* 81159 * 81159
@ -156,301 +159,4 @@ public class TocofsReturngoodsDetailedEntity extends BaseEntity {
// private String returngoodsId; // private String returngoodsId;
private String businessType; private String businessType;
public String getBusinessType() {
return businessType;
}
public void setBusinessType(String businessType) {
this.businessType = businessType;
}
public String getReceiptId() {
return receiptId;
}
public void setReceiptId(String receiptId) {
this.receiptId = receiptId;
}
public String getReceiptCode() {
return receiptCode;
}
public void setReceiptCode(String receiptCode) {
this.receiptCode = receiptCode;
}
public String getRefOrderId() {
return refOrderId;
}
public void setRefOrderId(String refOrderId) {
this.refOrderId = refOrderId;
}
public String getRefOrderDetailId() {
return refOrderDetailId;
}
public void setRefOrderDetailId(String refOrderDetailId) {
this.refOrderDetailId = refOrderDetailId;
}
public String getSourceOrderCode() {
return sourceOrderCode;
}
public void setSourceOrderCode(String sourceOrderCode) {
this.sourceOrderCode = sourceOrderCode;
}
public String getClientCode() {
return clientCode;
}
public void setClientCode(String clientCode) {
this.clientCode = clientCode;
}
public String getCompanyCode() {
return companyCode;
}
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
public String getFacilityCode() {
return facilityCode;
}
public void setFacilityCode(String facilityCode) {
this.facilityCode = facilityCode;
}
public String getSkuCode() {
return skuCode;
}
public void setSkuCode(String skuCode) {
this.skuCode = skuCode;
}
public String getSkuName() {
return skuName;
}
public void setSkuName(String skuName) {
this.skuName = skuName;
}
public String getRequestQty() {
return requestQty;
}
public void setRequestQty(String requestQty) {
this.requestQty = requestQty;
}
public String getReceivedQty() {
return receivedQty;
}
public void setReceivedQty(String receivedQty) {
this.receivedQty = receivedQty;
}
public String getOpenQty() {
return openQty;
}
public void setOpenQty(String openQty) {
this.openQty = openQty;
}
public String getQuantityUM() {
return quantityUM;
}
public void setQuantityUM(String quantityUM) {
this.quantityUM = quantityUM;
}
public String getTotalWeight() {
return totalWeight;
}
public void setTotalWeight(String totalWeight) {
this.totalWeight = totalWeight;
}
public String getTotalVolume() {
return totalVolume;
}
public void setTotalVolume(String totalVolume) {
this.totalVolume = totalVolume;
}
public String getTotalVolumeWeight() {
return totalVolumeWeight;
}
public void setTotalVolumeWeight(String totalVolumeWeight) {
this.totalVolumeWeight = totalVolumeWeight;
}
public String getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(String totalAmount) {
this.totalAmount = totalAmount;
}
public String getWeightUM() {
return weightUM;
}
public void setWeightUM(String weightUM) {
this.weightUM = weightUM;
}
public String getVolumeUM() {
return volumeUM;
}
public void setVolumeUM(String volumeUM) {
this.volumeUM = volumeUM;
}
public String getInventorySts() {
return inventorySts;
}
public void setInventorySts(String inventorySts) {
this.inventorySts = inventorySts;
}
public String getInTransInvId() {
return inTransInvId;
}
public void setInTransInvId(String inTransInvId) {
this.inTransInvId = inTransInvId;
}
public String getClosed() {
return closed;
}
public void setClosed(String closed) {
this.closed = closed;
}
public String getCreated() {
return created;
}
public void setCreated(String created) {
this.created = created;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public String getLastUpdated() {
return lastUpdated;
}
public void setLastUpdated(String lastUpdated) {
this.lastUpdated = lastUpdated;
}
public String getLastUpdatedBy() {
return lastUpdatedBy;
}
public void setLastUpdatedBy(String lastUpdatedBy) {
this.lastUpdatedBy = lastUpdatedBy;
}
public String getDiscountPrice() {
return discountPrice;
}
public void setDiscountPrice(String discountPrice) {
this.discountPrice = discountPrice;
}
public String getNewTransmitinfo() {
return newTransmitinfo;
}
public void setNewTransmitinfo(String newTransmitinfo) {
this.newTransmitinfo = newTransmitinfo;
}
public String getNewPushdate() {
return newPushdate;
}
public void setNewPushdate(String newPushdate) {
this.newPushdate = newPushdate;
}
public String getNewState() {
return newState;
}
public void setNewState(String newState) {
this.newState = newState;
}
public String getNewSystemNumber() {
return newSystemNumber;
}
public void setNewSystemNumber(String newSystemNumber) {
this.newSystemNumber = newSystemNumber;
}
public String getNewSystemPrimary() {
return newSystemPrimary;
}
public void setNewSystemPrimary(String newSystemPrimary) {
this.newSystemPrimary = newSystemPrimary;
}
public String getPrimaryKey() {
return primaryKey;
}
public void setPrimaryKey(String primaryKey) {
this.primaryKey = primaryKey;
}
public String getBusinessDate() {
return businessDate;
}
public void setBusinessDate(String businessDate) {
this.businessDate = businessDate;
}
// public String getReturngoodsId() {
// return returngoodsId;
// }
//
// public void setReturngoodsId(String returngoodsId) {
// this.returngoodsId = returngoodsId;
// }
} }

View File

@ -34,4 +34,8 @@ public class QueryOfsSoSaleOutVo {
private String shipAt_start; private String shipAt_start;
private String shipAt_end; private String shipAt_end;
private String closedAt_start;
private String closedAt_end;
} }

View File

@ -255,8 +255,9 @@ public class AdjustInPluginInitializer extends PluginBaseEntity {
//vnote--备注 //vnote--备注
parentvo.setVnote(ofsHeader.getNote()); parentvo.setVnote(ofsHeader.getNote());
//dbilldate--单据日期--oms入库时间 //dbilldate--单据日期--oms入库时间
Date created = ofsHeader.getCreated(); String created = ofsHeader.getCreated();
format = DateUtil.format(created, "yyyy-MM-dd HH:mm:ss"); // format = DateUtil.format(created, "yyyy-MM-dd HH:mm:ss");
format = created;
parentvo.setDbilldate(format); parentvo.setDbilldate(format);
//coperatorid--制单人 //coperatorid--制单人
String createdBy = ofsHeader.getCreatedBy(); String createdBy = ofsHeader.getCreatedBy();

View File

@ -211,12 +211,17 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
HeaderDto header = index.getHeader();// 主表 HeaderDto header = index.getHeader();// 主表
List<DetailsDto> details = index.getDetails();//明细表 List<DetailsDto> details = index.getDetails();//明细表
for (int i = 0; i < details.size(); i++) {
DetailsDto detailsDto = details.get(i);
detailsDto.setHeaderDto(header);
}
headerDetailsDtoList1.add(header); headerDetailsDtoList1.add(header);
headerDetailsDtoList2.addAll(details); headerDetailsDtoList2.addAll(details);
} }
//每250作为一个批次插入主表根据主键id判断是否重复如果重复的则不进行插入 //每250作为一个批次插入主表根据主键id判断是否重复如果重复的则不进行插入
List<List<HeaderDto>> ofssaleorderoutsearchList = SplitListByCountUtil.splitListByCount(headerDetailsDtoList1, 250); List<List<HeaderDto>> ofssaleorderoutsearchList = SplitListByCountUtil.splitListByCount(headerDetailsDtoList1, 100);
for (int i = 0; i < ofssaleorderoutsearchList.size(); i++) { for (int i = 0; i < ofssaleorderoutsearchList.size(); i++) {
List<HeaderDto> headerDtoList = ofssaleorderoutsearchList.get(i); List<HeaderDto> headerDtoList = ofssaleorderoutsearchList.get(i);
List<TocofsSaleoutEntity> tocofsSaleoutEntityList = copyHeaderDto(headerDtoList); List<TocofsSaleoutEntity> tocofsSaleoutEntityList = copyHeaderDto(headerDtoList);
@ -229,7 +234,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
} }
//插入明细表 //插入明细表
List<List<DetailsDto>> detailsDtoList = SplitListByCountUtil.splitListByCount(headerDetailsDtoList2, 250); List<List<DetailsDto>> detailsDtoList = SplitListByCountUtil.splitListByCount(headerDetailsDtoList2, 100);
for (int i = 0; i < detailsDtoList.size(); i++) { for (int i = 0; i < detailsDtoList.size(); i++) {
List<DetailsDto> detailsDtos = detailsDtoList.get(i); List<DetailsDto> detailsDtos = detailsDtoList.get(i);
List<TocofsSaleoutDetailedEntity> tocofsSaleoutDetailedEntities = copyDetailsDto(detailsDtos); List<TocofsSaleoutDetailedEntity> tocofsSaleoutDetailedEntities = copyDetailsDto(detailsDtos);
@ -679,9 +684,10 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
for (int i = 0; i < detailsDtos.size(); i++) { for (int i = 0; i < detailsDtos.size(); i++) {
DetailsDto detailsDto = detailsDtos.get(i); DetailsDto detailsDto = detailsDtos.get(i);
TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = new TocofsSaleoutDetailedEntity(); TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = new TocofsSaleoutDetailedEntity();
tocofsSaleoutDetailedEntity.setBusinessType("TOB_ORDER"); // tocofsSaleoutDetailedEntity.setBusinessType("TOB_ORDER");
// BeanUtils.copyProperties(detailsDto, tocofsSaleoutDetailedEntity); // BeanUtils.copyProperties(detailsDto, tocofsSaleoutDetailedEntity);
BeanUtil.copyPropertiesV2(detailsDto, tocofsSaleoutDetailedEntity); BeanUtil.copyPropertiesV2(detailsDto, tocofsSaleoutDetailedEntity);
createPrimaryKeyAndBusinessDateAndBusinessType(tocofsSaleoutDetailedEntity, detailsDto);
tocofsSaleoutDetailedEntityArrayList.add(tocofsSaleoutDetailedEntity); tocofsSaleoutDetailedEntityArrayList.add(tocofsSaleoutDetailedEntity);
} }
} }
@ -843,4 +849,20 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
SaleOrderMessageDto saleOrderMessageDto = (SaleOrderMessageDto) ofsUnifiedService.unified(interfaceParamDto); SaleOrderMessageDto saleOrderMessageDto = (SaleOrderMessageDto) ofsUnifiedService.unified(interfaceParamDto);
return saleOrderMessageDto; return saleOrderMessageDto;
} }
/**
* 2024年8月15日 17:08:42
* 填充主表主键业务日期业务类型
*/
private void createPrimaryKeyAndBusinessDateAndBusinessType(TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity, DetailsDto detailsDto) {
if (tocofsSaleoutDetailedEntity != null && detailsDto != null && detailsDto.getHeaderDto() != null) {
HeaderDto headerDto = detailsDto.getHeaderDto();
tocofsSaleoutDetailedEntity.setPrimaryKey(headerDto.getId());//主表主键
tocofsSaleoutDetailedEntity.setBusinessDate(headerDto.getShipAt());//业务日期
tocofsSaleoutDetailedEntity.setBusinessType("TOB_ORDER");//业务类型
} else {
logger.info("createPrimaryKeyAndBusinessDateAndBusinessType方法存在false");
}
}
} }

View File

@ -196,33 +196,38 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto header = index.getHeader();// 主表 com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto header = index.getHeader();// 主表
List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto> details = index.getDetails();//明细表 List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto> details = index.getDetails();//明细表
for (int i = 0; i < details.size(); i++) {
DetailsDto detailsDto = details.get(i);
detailsDto.setHeaderDto(header);
}
headerDetailsDtoList1.add(header); headerDetailsDtoList1.add(header);
headerDetailsDtoList2.addAll(details); headerDetailsDtoList2.addAll(details);
} }
//每250作为一个批次插入主表根据主键id判断是否重复如果重复的则不进行插入 //每250作为一个批次插入主表根据主键id判断是否重复如果重复的则不进行插入
List<List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto>> ofssaleorderoutsearchList = SplitListByCountUtil.splitListByCount(headerDetailsDtoList1, 250); List<List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto>> ofssaleorderoutsearchList = SplitListByCountUtil.splitListByCount(headerDetailsDtoList1, 100);
for (int i = 0; i < ofssaleorderoutsearchList.size(); i++) { for (int i = 0; i < ofssaleorderoutsearchList.size(); i++) {
List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto> headerDtoList = ofssaleorderoutsearchList.get(i); List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto> headerDtoList = ofssaleorderoutsearchList.get(i);
List<TocofsSaleoutEntity> tocofsSaleoutEntityList = copyHeaderDto(headerDtoList); List<TocofsSaleoutEntity> tocofsSaleoutEntityList = copyHeaderDto(headerDtoList);
if (tocofsSaleoutEntityList.size() > 0) { if (tocofsSaleoutEntityList.size() > 0) {
logger.info("tocofsSaleoutDetailedEntities:插入底表{}个对象(表头)", tocofsSaleoutEntityList.size()); logger.info("TocofsSaleoutEntity:插入底表{}个对象(表头)", tocofsSaleoutEntityList.size());
iTocofsSaleoutDao.entityInsertBatchV2(tocofsSaleoutEntityList); iTocofsSaleoutDao.entityInsertBatchV2(tocofsSaleoutEntityList);
} else { } else {
logger.info("tocofsSaleoutEntityList:没有对象被插入表头底表"); logger.info("TocofsSaleoutEntity:没有对象被插入表头底表");
} }
} }
//插入明细表 //插入明细表
List<List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto>> detailsDtoList = SplitListByCountUtil.splitListByCount(headerDetailsDtoList2, 250); List<List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto>> detailsDtoList = SplitListByCountUtil.splitListByCount(headerDetailsDtoList2, 100);
for (int i = 0; i < detailsDtoList.size(); i++) { for (int i = 0; i < detailsDtoList.size(); i++) {
List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto> detailsDtos = detailsDtoList.get(i); List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto> detailsDtos = detailsDtoList.get(i);
List<TocofsSaleoutDetailedEntity> tocofsSaleoutDetailedEntities = copyDetailsDto(detailsDtos); List<TocofsSaleoutDetailedEntity> tocofsSaleoutDetailedEntities = copyDetailsDto(detailsDtos);
if (tocofsSaleoutDetailedEntities.size() > 0) { if (tocofsSaleoutDetailedEntities.size() > 0) {
logger.info("tocofsSaleoutDetailedEntities:插入底表{}个对象(表体)", tocofsSaleoutDetailedEntities.size()); logger.info("TocofsSaleoutDetailedEntity:插入底表{}个对象(表体)", tocofsSaleoutDetailedEntities.size());
iTocofsSaleoutDetailedDao.entityInsertBatchV2(tocofsSaleoutDetailedEntities); iTocofsSaleoutDetailedDao.entityInsertBatchV2(tocofsSaleoutDetailedEntities);
} else { } else {
logger.info("tocofsSaleoutDetailedEntities:没有对象被插入表头底表"); logger.info("TocofsSaleoutDetailedEntity:没有对象被插入表头底表");
} }
} }
} }
@ -604,9 +609,11 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
for (int i = 0; i < detailsDtos.size(); i++) { for (int i = 0; i < detailsDtos.size(); i++) {
com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto detailsDto = detailsDtos.get(i); com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto detailsDto = detailsDtos.get(i);
TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = new TocofsSaleoutDetailedEntity(); TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = new TocofsSaleoutDetailedEntity();
tocofsSaleoutDetailedEntity.setBusinessType("TOC_ORDER"); // tocofsSaleoutDetailedEntity.setBusinessType("TOC_ORDER");
// BeanUtils.copyProperties(detailsDto, tocofsSaleoutDetailedEntity); // BeanUtils.copyProperties(detailsDto, tocofsSaleoutDetailedEntity);
BeanUtil.copyPropertiesV2(detailsDto, tocofsSaleoutDetailedEntity); BeanUtil.copyPropertiesV2(detailsDto, tocofsSaleoutDetailedEntity);
createPrimaryKeyAndBusinessDateAndBusinessType(tocofsSaleoutDetailedEntity, detailsDto);
tocofsSaleoutDetailedEntityArrayList.add(tocofsSaleoutDetailedEntity); tocofsSaleoutDetailedEntityArrayList.add(tocofsSaleoutDetailedEntity);
} }
} }
@ -849,4 +856,20 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
} }
return null; return null;
} }
/**
* 2024年8月15日 17:08:42
* 填充主表主键业务日期业务类型
*/
private void createPrimaryKeyAndBusinessDateAndBusinessType(TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity, DetailsDto detailsDto) {
if (tocofsSaleoutDetailedEntity != null && detailsDto != null && detailsDto.getHeaderDto() != null) {
HeaderDto headerDto = detailsDto.getHeaderDto();
tocofsSaleoutDetailedEntity.setPrimaryKey(headerDto.getId());//主表主键
tocofsSaleoutDetailedEntity.setBusinessDate(headerDto.getShipAt());//业务日期
tocofsSaleoutDetailedEntity.setBusinessType("TOC_ORDER");//业务类型
} else {
logger.info("createPrimaryKeyAndBusinessDateAndBusinessType方法存在false");
}
}
} }

View File

@ -28,6 +28,7 @@ import com.hzya.frame.ttxofs.dto.returngoodsearch.RertunGoodsRootBean;
import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodHeaderDetailsDataDto; import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodHeaderDetailsDataDto;
import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchDetailsDto; import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchDetailsDto;
import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchHeaderDto; import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchHeaderDto;
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
import com.hzya.frame.ttxofs.service.OfsUnifiedService; import com.hzya.frame.ttxofs.service.OfsUnifiedService;
import com.hzya.frame.web.entity.JsonResultEntity; import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -150,26 +151,26 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
// TODO 注意过滤TOB店铺 // TODO 注意过滤TOB店铺
CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr); CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr);
List<ReturnGoodHeaderDetailsDataDto> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setCreated_start("2024-07-16 15:35:35"); queryOfsSoSaleOutVo.setClosedAt_start("2024-07-16 16:44:00");
queryOfsSoSaleOutVo.setCreated_end("2024-07-16 15:35:37"); queryOfsSoSaleOutVo.setClosedAt_end("2024-07-16 16:44:02");
queryOfsSoSaleOutVo.setClientCode("LETS"); queryOfsSoSaleOutVo.setClientCode("LETS");
// queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); // queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
queryOfsSoSaleOutVo.setCompanyCode("SHLZ"); queryOfsSoSaleOutVo.setCompanyCode("SHLZ");
// queryOfsSoSaleOutVo.setStatus(900L); // queryOfsSoSaleOutVo.setStatus(900L);
queryOfsSoSaleOutVo.setPageNo(1L); queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L); queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setCode("LETS-RE2024071600000001"); // queryOfsSoSaleOutVo.setCode("LETS-RE2024071600000001");
queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L); queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L);
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size());
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
//保存到mysql //保存到mysql
batchInsert(returnGoodHeaderDetailsDataDtoArrayList); batchInsert(returnGoodHeaderDetailsDataDtoArrayList);
//过滤成功的数据 //过滤成功的数据
List<ReturnGoodHeaderDetailsDataDto> returnGoodHeaderDetailsDataDtoList = filterData(returnGoodHeaderDetailsDataDtoArrayList); List<StockinOrderSearchResponse.StockinOrder> stockinOrderList = filterData(returnGoodHeaderDetailsDataDtoArrayList);
//执行推送主逻辑 //执行推送主逻辑
implement(returnGoodHeaderDetailsDataDtoList); implement(stockinOrderList);
} else { } else {
logger.info("没有查询到任何数据!不需要同步"); logger.info("没有查询到任何数据!不需要同步");
} }
@ -191,11 +192,11 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
* *
* @author liuyang * @author liuyang
*/ */
private List<ReturnGoodHeaderDetailsDataDto> filterData(List<ReturnGoodHeaderDetailsDataDto> headerDetailsDtoList) { private List<StockinOrderSearchResponse.StockinOrder> filterData(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList) {
List<ReturnGoodHeaderDetailsDataDto> headerDetailsDtoList1 = new ArrayList<>(); List<StockinOrderSearchResponse.StockinOrder> headerDetailsDtoList1 = new ArrayList<>();
if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
//TODO 出库单明细主键需要O返回目前没有已经提需求 //TODO 出库单明细主键需要O返回目前没有已经提需求
headerDetailsDtoList1.addAll(headerDetailsDtoList); headerDetailsDtoList1.addAll(returnGoodHeaderDetailsDataDtoArrayList);
} }
return headerDetailsDtoList1; return headerDetailsDtoList1;
} }
@ -205,24 +206,29 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
* *
* @param returnGoodHeaderDetailsDataDtoArrayList 数据行 * @param returnGoodHeaderDetailsDataDtoArrayList 数据行
*/ */
private void batchInsert(List<ReturnGoodHeaderDetailsDataDto> returnGoodHeaderDetailsDataDtoArrayList) throws Exception { private void batchInsert(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList) throws Exception {
if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
List<ReturnGoodSearchHeaderDto> headerDetailsDtoList1 = new ArrayList<>(); List<StockinOrderSearchResponse.StockinOrder.StockinH> headerDetailsDtoList1 = new ArrayList<>();
List<ReturnGoodSearchDetailsDto> headerDetailsDtoList2 = new ArrayList<>(); List<StockinOrderSearchResponse.StockinOrder.StockinB> headerDetailsDtoList2 = new ArrayList<>();
for (ReturnGoodHeaderDetailsDataDto index : returnGoodHeaderDetailsDataDtoArrayList) { for (StockinOrderSearchResponse.StockinOrder index : returnGoodHeaderDetailsDataDtoArrayList) {
ReturnGoodSearchHeaderDto header = index.getHeader();// 主表 StockinOrderSearchResponse.StockinOrder.StockinH header = index.getHeader();// 主表
List<ReturnGoodSearchDetailsDto> details = index.getDetails();//明细表 List<StockinOrderSearchResponse.StockinOrder.StockinB> details = index.getDetails();//明细表
for (int i = 0; i < details.size(); i++) {
StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(i);
stockinB.setReturnGoodSearchHeaderDto(header);
}
headerDetailsDtoList1.add(header); headerDetailsDtoList1.add(header);
headerDetailsDtoList2.addAll(details); headerDetailsDtoList2.addAll(details);
} }
//每100作为一个批次插入主表根据主键id判断是否重复如果重复的则不进行插入 //每100作为一个批次插入主表根据主键id判断是否重复如果重复的则不进行插入
List<List<ReturnGoodSearchHeaderDto>> lists = SplitListByCountUtil.splitListByCount(headerDetailsDtoList1, 100); List<List<StockinOrderSearchResponse.StockinOrder.StockinH>> lists = SplitListByCountUtil.splitListByCount(headerDetailsDtoList1, 100);
for (int i = 0; i < lists.size(); i++) { for (int i = 0; i < lists.size(); i++) {
List<ReturnGoodSearchHeaderDto> returnGoodSearchHeaderDtos = lists.get(i); List<StockinOrderSearchResponse.StockinOrder.StockinH> stockinHS = lists.get(i);
List<TocofsReturngoodsEntity> tocofsReturngoodsEntities = copyHeaderDto(returnGoodSearchHeaderDtos); List<TocofsReturngoodsEntity> tocofsReturngoodsEntities = copyHeaderDto(stockinHS);
if (tocofsReturngoodsEntities.size() > 0) { if (tocofsReturngoodsEntities.size() > 0) {
logger.info("TocofsReturngoodsEntity插入底表{}个对象(表头)", tocofsReturngoodsEntities.size()); logger.info("TocofsReturngoodsEntity插入底表{}个对象(表头)", tocofsReturngoodsEntities.size());
iTocofsReturngoodsDao.entityInsertBatchV2(tocofsReturngoodsEntities); iTocofsReturngoodsDao.entityInsertBatchV2(tocofsReturngoodsEntities);
@ -232,10 +238,10 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
} }
//插入明细表 //插入明细表
List<List<ReturnGoodSearchDetailsDto>> lists1 = SplitListByCountUtil.splitListByCount(headerDetailsDtoList2, 100); List<List<StockinOrderSearchResponse.StockinOrder.StockinB>> lists1 = SplitListByCountUtil.splitListByCount(headerDetailsDtoList2, 100);
for (int i = 0; i < lists1.size(); i++) { for (int i = 0; i < lists1.size(); i++) {
List<ReturnGoodSearchDetailsDto> returnGoodSearchDetailsDtos = lists1.get(i); List<StockinOrderSearchResponse.StockinOrder.StockinB> stockinBS = lists1.get(i);
List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntities = copyDetailsDto(returnGoodSearchDetailsDtos); List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntities = copyDetailsDto(stockinBS);
if (tocofsReturngoodsDetailedEntities.size() > 0) { if (tocofsReturngoodsDetailedEntities.size() > 0) {
logger.info("TocofsReturngoodsDetailedEntity插入底表{}个对象(表体)", tocofsReturngoodsDetailedEntities.size()); logger.info("TocofsReturngoodsDetailedEntity插入底表{}个对象(表体)", tocofsReturngoodsDetailedEntities.size());
iTocofsReturngoodsDetailedDao.entityInsertBatchV2(tocofsReturngoodsDetailedEntities); iTocofsReturngoodsDetailedDao.entityInsertBatchV2(tocofsReturngoodsDetailedEntities);
@ -253,7 +259,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
* @param headerDetailsDtoList 查询结果集 * @param headerDetailsDtoList 查询结果集
* @param pageNo 从第pageNo页开始查询 * @param pageNo 从第pageNo页开始查询
*/ */
private void queryOfsReturnGoods(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List<ReturnGoodHeaderDetailsDataDto> headerDetailsDtoList, Long pageNo) throws Exception { private void queryOfsReturnGoods(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List<StockinOrderSearchResponse.StockinOrder> headerDetailsDtoList, Long pageNo) throws Exception {
Long pageSize = 200L; Long pageSize = 200L;
queryOfsSoSaleOutVo.setPageNo(pageNo); queryOfsSoSaleOutVo.setPageNo(pageNo);
queryOfsSoSaleOutVo.setPageSize(pageSize); queryOfsSoSaleOutVo.setPageSize(pageSize);
@ -261,12 +267,12 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); InterfaceParamDto interfaceParamDto = new InterfaceParamDto();
interfaceParamDto.setApi("ofs.receipt.search"); interfaceParamDto.setApi("ofs.receipt.search");
interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo)); interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo));
RertunGoodsRootBean rertunGoodsRootBean = (RertunGoodsRootBean) ofsUnifiedService.unified(interfaceParamDto); StockinOrderSearchResponse rertunGoodsRootBean = (StockinOrderSearchResponse) ofsUnifiedService.unified(interfaceParamDto);
if (rertunGoodsRootBean != null) { if (rertunGoodsRootBean != null) {
if ("false".equals(rertunGoodsRootBean.getError()) && "0".equals(rertunGoodsRootBean.getCode()) && "Success".equals(rertunGoodsRootBean.getMsg())) { if ("false".equals(rertunGoodsRootBean.getError()) && "0".equals(rertunGoodsRootBean.getCode()) && "Success".equals(rertunGoodsRootBean.getMsg())) {
List<ReturnGoodHeaderDetailsDataDto> returnGoodHeaderDetailsDataDtoList = rertunGoodsRootBean.getData(); List<StockinOrderSearchResponse.StockinOrder> stockinOrderList = rertunGoodsRootBean.getData();
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { if (stockinOrderList != null && stockinOrderList.size() > 0) {
headerDetailsDtoList.addAll(returnGoodHeaderDetailsDataDtoList); headerDetailsDtoList.addAll(stockinOrderList);
//TODO OFS没有提供分页字段等待开发 //TODO OFS没有提供分页字段等待开发
} }
@ -284,7 +290,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
* @param returnGoodHeaderDetailsDataDtoList 查询得到的O出库单对象 * @param returnGoodHeaderDetailsDataDtoList 查询得到的O出库单对象
* @author liuyang * @author liuyang
*/ */
private void implement(List<ReturnGoodHeaderDetailsDataDto> returnGoodHeaderDetailsDataDtoList) throws Exception { private void implement(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList) throws Exception {
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) {
try { try {
// 查询基本档案 // 查询基本档案
@ -295,8 +301,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
try { try {
for (int i = 0; i < orderToBHeaderDtos.size(); i++) { for (int i = 0; i < orderToBHeaderDtos.size(); i++) {
OrderToBHeaderDto orderOutTobHeaderDto = orderToBHeaderDtos.get(i); OrderToBHeaderDto orderOutTobHeaderDto = orderToBHeaderDtos.get(i);
ReturnGoodSearchHeaderDto header = orderOutTobHeaderDto.getHeader(); StockinOrderSearchResponse.StockinOrder.StockinH header = orderOutTobHeaderDto.getHeader();
List<ReturnGoodSearchDetailsDto> details = orderOutTobHeaderDto.getDetails(); List<StockinOrderSearchResponse.StockinOrder.StockinB> details = orderOutTobHeaderDto.getDetails();
//销售公司发货公司 //销售公司发货公司
BdCorpEntity bdCorpEntity = orderOutTobHeaderDto.getBdCorpEntity(); BdCorpEntity bdCorpEntity = orderOutTobHeaderDto.getBdCorpEntity();
@ -354,9 +360,9 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
//把汇总好的出库单明细行合并成一行 //把汇总好的出库单明细行合并成一行
for (int j = 0; j < details.size(); j++) { for (int j = 0; j < details.size(); j++) {
ReturnGoodSearchDetailsDto returnGoodSearchDetailsDto = details.get(j); StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j);
//存货管理档案取发货公司的存货管理档案 //存货管理档案取发货公司的存货管理档案
BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(returnGoodSearchDetailsDto, bdCalbodyEntity.getPkCorp()); BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(stockinB, bdCalbodyEntity.getPkCorp());
//存货基础档案 //存货基础档案
BdInvbasdocEntity bdInvbasdocEntity = queryStockBasicArchives(bdInvmandocEntity.getPkInvmandoc(), deliverGoodsCorp.getPkCorp()); BdInvbasdocEntity bdInvbasdocEntity = queryStockBasicArchives(bdInvmandocEntity.getPkInvmandoc(), deliverGoodsCorp.getPkCorp());
//根据存货基础档案编码查询当前存货的税率 //根据存货基础档案编码查询当前存货的税率
@ -376,13 +382,13 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
BigDecimal noriginalcursummny = null;//价税合计 BigDecimal noriginalcursummny = null;//价税合计
BigDecimal noriginalcurtaxmny = null;//税额 BigDecimal noriginalcurtaxmny = null;//税额
try { try {
Assert.notNull(returnGoodSearchDetailsDto.getTotalAmount(), "退货入库单总金额不能为空 明细行对象:{}", JSON.toJSONString(returnGoodSearchDetailsDto)); Assert.notNull(stockinB.getTotalAmount(), "退货入库单总金额不能为空 明细行对象:{}", JSON.toJSONString(stockinB));
Assert.notNull(returnGoodSearchDetailsDto.getReceivedQty(), "实收数量不能为空 明细行对象:{}", JSON.toJSONString(returnGoodSearchDetailsDto)); Assert.notNull(stockinB.getReceivedQty(), "实收数量不能为空 明细行对象:{}", JSON.toJSONString(stockinB));
noriginalcurtaxprice = new BigDecimal(returnGoodSearchDetailsDto.getTotalAmount()).divide(new BigDecimal(returnGoodSearchDetailsDto.getReceivedQty()), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); noriginalcurtaxprice = new BigDecimal(stockinB.getTotalAmount()).divide(new BigDecimal(stockinB.getReceivedQty()), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
noriginalcurprice = noriginalcurtaxprice.divide(new BigDecimal(1).add(new BigDecimal(tax)), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); noriginalcurprice = noriginalcurtaxprice.divide(new BigDecimal(1).add(new BigDecimal(tax)), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
noriginalcurmny = noriginalcurprice.multiply(new BigDecimal(returnGoodSearchDetailsDto.getReceivedQty())).setScale(2, BigDecimal.ROUND_HALF_UP); noriginalcurmny = noriginalcurprice.multiply(new BigDecimal(stockinB.getReceivedQty())).setScale(2, BigDecimal.ROUND_HALF_UP);
noriginalcursummny = noriginalcurtaxprice.multiply(new BigDecimal(returnGoodSearchDetailsDto.getReceivedQty())).setScale(2, BigDecimal.ROUND_HALF_UP); noriginalcursummny = noriginalcurtaxprice.multiply(new BigDecimal(stockinB.getReceivedQty())).setScale(2, BigDecimal.ROUND_HALF_UP);
noriginalcurtaxmny = noriginalcursummny.subtract(noriginalcurmny).setScale(2, BigDecimal.ROUND_HALF_UP); noriginalcurtaxmny = noriginalcursummny.subtract(noriginalcurmny).setScale(2, BigDecimal.ROUND_HALF_UP);
} catch (Exception e) { } catch (Exception e) {
logger.error("TOB金额计算错误", e); logger.error("TOB金额计算错误", e);
@ -407,7 +413,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
saleorderRequestChildrenDto.setDdeliverdate(generateBusinessDate);// 要求收货日期 saleorderRequestChildrenDto.setDdeliverdate(generateBusinessDate);// 要求收货日期
saleorderRequestChildrenDto.setNexchangeotobrate("1.00000000");//折本汇率 saleorderRequestChildrenDto.setNexchangeotobrate("1.00000000");//折本汇率
saleorderRequestChildrenDto.setNitemdiscountrate("100.000000");//单品折扣 saleorderRequestChildrenDto.setNitemdiscountrate("100.000000");//单品折扣
saleorderRequestChildrenDto.setNnumber("-" + returnGoodSearchDetailsDto.getReceivedQty());//数量 saleorderRequestChildrenDto.setNnumber("-" + stockinB.getReceivedQty());//数量
saleorderRequestChildrenDto.setNoriginalcurdiscountmny("0");//折扣额 saleorderRequestChildrenDto.setNoriginalcurdiscountmny("0");//折扣额
saleorderRequestChildrenDto.setNoriginalcurmny("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//无税金额 saleorderRequestChildrenDto.setNoriginalcurmny("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//无税金额
// saleorderRequestChildrenDto.setNoriginalcurnetprice(noriginalcurprice.stripTrailingZeros().toPlainString());//无税净价 // saleorderRequestChildrenDto.setNoriginalcurnetprice(noriginalcurprice.stripTrailingZeros().toPlainString());//无税净价
@ -448,7 +454,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
*/ */
private String createGenerateBusinessDate(OrderToBHeaderDto orderOutTobHeaderDto) { private String createGenerateBusinessDate(OrderToBHeaderDto orderOutTobHeaderDto) {
if (orderOutTobHeaderDto != null && orderOutTobHeaderDto.getHeader() != null && orderOutTobHeaderDto.getHeader().getCheckInFrom() != null) { if (orderOutTobHeaderDto != null && orderOutTobHeaderDto.getHeader() != null && orderOutTobHeaderDto.getHeader().getCheckInFrom() != null) {
ReturnGoodSearchHeaderDto header = orderOutTobHeaderDto.getHeader(); StockinOrderSearchResponse.StockinOrder.StockinH header = orderOutTobHeaderDto.getHeader();
String checkInFrom = header.getCheckInFrom(); String checkInFrom = header.getCheckInFrom();
String businessFormat = null; String businessFormat = null;
try { try {
@ -470,15 +476,15 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
* *
* @author liuyang * @author liuyang
*/ */
private List<OrderToBHeaderDto> queryBasicArchives(List<ReturnGoodHeaderDetailsDataDto> returnGoodHeaderDetailsDataDtoList) { private List<OrderToBHeaderDto> queryBasicArchives(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList) {
List<OrderToBHeaderDto> orderToBHeaderDtoArrayList = new ArrayList<>(); List<OrderToBHeaderDto> orderToBHeaderDtoArrayList = new ArrayList<>();
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) {
try { try {
for (int i = 0; i < returnGoodHeaderDetailsDataDtoList.size(); i++) { for (int i = 0; i < returnGoodHeaderDetailsDataDtoList.size(); i++) {
ReturnGoodHeaderDetailsDataDto returnGoodHeaderDetailsDataDto = returnGoodHeaderDetailsDataDtoList.get(i); StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoList.get(i);
ReturnGoodSearchHeaderDto header = returnGoodHeaderDetailsDataDto.getHeader(); StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
List<ReturnGoodSearchDetailsDto> details = returnGoodHeaderDetailsDataDto.getDetails(); List<StockinOrderSearchResponse.StockinOrder.StockinB> details = stockinOrder.getDetails();
// 销售公司发货公司 // 销售公司发货公司
String companyCode = header.getCompanyCode(); String companyCode = header.getCompanyCode();
@ -627,18 +633,18 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
* bean copy * bean copy
* 2024年8月15日 14:19:36 * 2024年8月15日 14:19:36
*/ */
private List<TocofsReturngoodsEntity> copyHeaderDto(List<ReturnGoodSearchHeaderDto> returnGoodSearchHeaderDtos) { private List<TocofsReturngoodsEntity> copyHeaderDto(List<StockinOrderSearchResponse.StockinOrder.StockinH> stockinHS) {
List<TocofsReturngoodsEntity> tocofsReturngoodsEntityArrayList = new ArrayList<>(); List<TocofsReturngoodsEntity> tocofsReturngoodsEntityArrayList = new ArrayList<>();
if (returnGoodSearchHeaderDtos != null && returnGoodSearchHeaderDtos.size() > 0) { if (stockinHS != null && stockinHS.size() > 0) {
for (int i = 0; i < returnGoodSearchHeaderDtos.size(); i++) { for (int i = 0; i < stockinHS.size(); i++) {
ReturnGoodSearchHeaderDto headerDto = returnGoodSearchHeaderDtos.get(i); StockinOrderSearchResponse.StockinOrder.StockinH stockinH = stockinHS.get(i);
TocofsReturngoodsEntity tocofsReturngoodsEntity = new TocofsReturngoodsEntity(); TocofsReturngoodsEntity tocofsReturngoodsEntity = new TocofsReturngoodsEntity();
BeanUtil.copyPropertiesV2(headerDto, tocofsReturngoodsEntity); BeanUtil.copyPropertiesV2(stockinH, tocofsReturngoodsEntity);
tocofsReturngoodsEntityArrayList.add(tocofsReturngoodsEntity); tocofsReturngoodsEntityArrayList.add(tocofsReturngoodsEntity);
} }
} else { } else {
logger.info("需要复制{}个bean对象(O表头)", returnGoodSearchHeaderDtos.size()); logger.info("需要复制{}个bean对象(O表头)", stockinHS.size());
} }
return tocofsReturngoodsEntityArrayList; return tocofsReturngoodsEntityArrayList;
} }
@ -647,15 +653,20 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
* bean copy * bean copy
* 2024年8月15日 14:24:38 * 2024年8月15日 14:24:38
*/ */
private List<TocofsReturngoodsDetailedEntity> copyDetailsDto(List<ReturnGoodSearchDetailsDto> headerDetailsDtoList2) { private List<TocofsReturngoodsDetailedEntity> copyDetailsDto(List<StockinOrderSearchResponse.StockinOrder.StockinB> stockinBS) {
List<TocofsReturngoodsDetailedEntity> tocofsSaleoutDetailedEntityArrayList = new ArrayList<>(); List<TocofsReturngoodsDetailedEntity> tocofsSaleoutDetailedEntityArrayList = new ArrayList<>();
if (headerDetailsDtoList2 != null && headerDetailsDtoList2.size() > 0) { if (stockinBS != null && stockinBS.size() > 0) {
for (int i = 0; i < headerDetailsDtoList2.size(); i++) { for (int i = 0; i < stockinBS.size(); i++) {
ReturnGoodSearchDetailsDto returnGoodSearchDetailsDto = headerDetailsDtoList2.get(i); StockinOrderSearchResponse.StockinOrder.StockinB stockinB = stockinBS.get(i);
//明细行中引用的表头
StockinOrderSearchResponse.StockinOrder.StockinH returnGoodSearchHeaderDto = stockinB.getReturnGoodSearchHeaderDto();
TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = new TocofsReturngoodsDetailedEntity(); TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = new TocofsReturngoodsDetailedEntity();
tocofsReturngoodsDetailedEntity.setBusinessType("TOB_RETURN"); // tocofsReturngoodsDetailedEntity.setBusinessType("TOB_RETURN");
BeanUtil.copyPropertiesV2(returnGoodSearchDetailsDto, tocofsReturngoodsDetailedEntity); BeanUtil.copyPropertiesV2(returnGoodSearchHeaderDto, tocofsReturngoodsDetailedEntity);
createPrimaryKeyAndBusinessDateAndBusinessType(tocofsReturngoodsDetailedEntity, returnGoodSearchHeaderDto);
tocofsSaleoutDetailedEntityArrayList.add(tocofsReturngoodsDetailedEntity); tocofsSaleoutDetailedEntityArrayList.add(tocofsReturngoodsDetailedEntity);
} }
} else { } else {
@ -685,7 +696,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
* @param detailsDto 出库单存货明细行 * @param detailsDto 出库单存货明细行
* @author liuyang * @author liuyang
*/ */
private BdInvmandocEntity queryInventoryMan(ReturnGoodSearchDetailsDto detailsDto, String pkCorp) throws Exception { private BdInvmandocEntity queryInventoryMan(StockinOrderSearchResponse.StockinOrder.StockinB detailsDto, String pkCorp) throws Exception {
Assert.notNull(detailsDto, "sonDetailsDto不能为空"); Assert.notNull(detailsDto, "sonDetailsDto不能为空");
Assert.notNull(detailsDto.getSkuCode(), "O存货商家编码不能为空"); Assert.notNull(detailsDto.getSkuCode(), "O存货商家编码不能为空");
Assert.notNull(pkCorp, "发货公司主键不能为空"); Assert.notNull(pkCorp, "发货公司主键不能为空");
@ -802,4 +813,16 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
} }
return null; return null;
} }
/**
* 填充主表主键业务日期业务类型
* 2024年8月15日 17:31:54
*/
private void createPrimaryKeyAndBusinessDateAndBusinessType(TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity, StockinOrderSearchResponse.StockinOrder.StockinH returnGoodSearchHeaderDto) {
if (tocofsReturngoodsDetailedEntity != null && returnGoodSearchHeaderDto != null) {
tocofsReturngoodsDetailedEntity.setPrimaryKey(returnGoodSearchHeaderDto.getId());//主表主键
tocofsReturngoodsDetailedEntity.setBusinessDate(returnGoodSearchHeaderDto.getCheckInFrom());//业务日期
tocofsReturngoodsDetailedEntity.setBusinessType("TOC_RETURN");//业务类型
}
}
} }

View File

@ -191,6 +191,12 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
for (ReturnGoodHeaderDetailsDataDto index : returnGoodHeaderDetailsDataDtoList) { for (ReturnGoodHeaderDetailsDataDto index : returnGoodHeaderDetailsDataDtoList) {
ReturnGoodSearchHeaderDto header = index.getHeader();// 主表 ReturnGoodSearchHeaderDto header = index.getHeader();// 主表
List<ReturnGoodSearchDetailsDto> details = index.getDetails();//明细表 List<ReturnGoodSearchDetailsDto> details = index.getDetails();//明细表
for (int i = 0; i < details.size(); i++) {
ReturnGoodSearchDetailsDto returnGoodSearchDetailsDto = details.get(i);
returnGoodSearchDetailsDto.setReturnGoodSearchHeaderDto(header);
}
headerDetailsDtoList1.add(header); headerDetailsDtoList1.add(header);
headerDetailsDtoList2.addAll(details); headerDetailsDtoList2.addAll(details);
} }
@ -594,9 +600,13 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
for (int i = 0; i < headerDetailsDtoList2.size(); i++) { for (int i = 0; i < headerDetailsDtoList2.size(); i++) {
ReturnGoodSearchDetailsDto returnGoodSearchDetailsDto = headerDetailsDtoList2.get(i); ReturnGoodSearchDetailsDto returnGoodSearchDetailsDto = headerDetailsDtoList2.get(i);
//表头
ReturnGoodSearchHeaderDto returnGoodSearchHeaderDto = returnGoodSearchDetailsDto.getReturnGoodSearchHeaderDto();
TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = new TocofsReturngoodsDetailedEntity(); TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = new TocofsReturngoodsDetailedEntity();
tocofsReturngoodsDetailedEntity.setBusinessType("TOC_RETURN"); // tocofsReturngoodsDetailedEntity.setBusinessType("TOC_RETURN");
BeanUtil.copyPropertiesV2(returnGoodSearchDetailsDto, tocofsReturngoodsDetailedEntity); BeanUtil.copyPropertiesV2(returnGoodSearchDetailsDto, tocofsReturngoodsDetailedEntity);
createPrimaryKeyAndBusinessDateAndBusinessType(tocofsReturngoodsDetailedEntity, returnGoodSearchHeaderDto);
tocofsSaleoutDetailedEntityArrayList.add(tocofsReturngoodsDetailedEntity); tocofsSaleoutDetailedEntityArrayList.add(tocofsReturngoodsDetailedEntity);
} }
} else { } else {
@ -843,4 +853,15 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
return null; return null;
} }
} /**
* 填充主表主键业务日期业务类型
* 2024年8月15日 17:31:54
*/
private void createPrimaryKeyAndBusinessDateAndBusinessType(TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity, ReturnGoodSearchHeaderDto returnGoodSearchHeaderDto) {
if (tocofsReturngoodsDetailedEntity != null && returnGoodSearchHeaderDto != null) {
tocofsReturngoodsDetailedEntity.setPrimaryKey(tocofsReturngoodsDetailedEntity.getId());//主表主键
tocofsReturngoodsDetailedEntity.setBusinessDate(returnGoodSearchHeaderDto.getCheckInFrom());//业务日期
tocofsReturngoodsDetailedEntity.setBusinessType("TOC_RETURN");//业务类型
}
}
}

View File

@ -5,6 +5,7 @@ import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto;
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto; import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto;
import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchDetailsDto; import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchDetailsDto;
import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchHeaderDto; import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchHeaderDto;
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
@ -84,10 +85,10 @@ public class OrderToBHeaderDto {
/** /**
* TOB售后入库单表头 * TOB售后入库单表头
*/ */
private ReturnGoodSearchHeaderDto header; private StockinOrderSearchResponse.StockinOrder.StockinH header;
/** /**
* TOB售后入库单表体 * TOB售后入库单表体
*/ */
private List<ReturnGoodSearchDetailsDto> details; private List<StockinOrderSearchResponse.StockinOrder.StockinB> details;
} }

View File

@ -0,0 +1,35 @@
package com.hzya.frame.plugin.lets.plugin.sales;
import com.hzya.frame.WebappApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.*;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.plugin.sales
* @ProjectkangarooDataCenterV3
* @nameSoSaleReturnPluginInitializerToBTest
* @Date2024/8/16 13:56
* @FilenameSoSaleReturnPluginInitializerToBTest
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = WebappApplication.class)
public class SoSaleReturnPluginInitializerToBTest {
@Autowired
private SoSaleReturnPluginInitializerToB soSaleReturnPluginInitializerToB;
@Test
public void startImplement() {
try {
soSaleReturnPluginInitializerToB.startImplement(null, null);
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -1,5 +1,8 @@
package com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch; package com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch;
import lombok.Data;
@Data
public class DetailsDto { public class DetailsDto {
private String clientCode; private String clientCode;
@ -31,227 +34,8 @@ public class DetailsDto {
private String lastUpdated; private String lastUpdated;
private String lastUpdatedBy; private String lastUpdatedBy;
public String getClientCode() { /**
return clientCode; * 表头对象
} */
private HeaderDto headerDto;
public void setClientCode(String clientCode) {
this.clientCode = clientCode;
}
public String getCompanyCode() {
return companyCode;
}
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
public String getFacilityCode() {
return facilityCode;
}
public void setFacilityCode(String facilityCode) {
this.facilityCode = facilityCode;
}
public String getShipmentCode() {
return shipmentCode;
}
public void setShipmentCode(String shipmentCode) {
this.shipmentCode = shipmentCode;
}
public String getRefOrderId() {
return refOrderId;
}
public void setRefOrderId(String refOrderId) {
this.refOrderId = refOrderId;
}
public String getRefOrderDetailId() {
return refOrderDetailId;
}
public void setRefOrderDetailId(String refOrderDetailId) {
this.refOrderDetailId = refOrderDetailId;
}
public String getRefOrderCode() {
return refOrderCode;
}
public void setRefOrderCode(String refOrderCode) {
this.refOrderCode = refOrderCode;
}
public String getAllocInvId() {
return allocInvId;
}
public void setAllocInvId(String allocInvId) {
this.allocInvId = allocInvId;
}
public String getSkuCode() {
return skuCode;
}
public void setSkuCode(String skuCode) {
this.skuCode = skuCode;
}
public String getSkuName() {
return skuName;
}
public void setSkuName(String skuName) {
this.skuName = skuName;
}
public String getSourceOrderCode() {
return sourceOrderCode;
}
public void setSourceOrderCode(String sourceOrderCode) {
this.sourceOrderCode = sourceOrderCode;
}
public String getInventorySts() {
return inventorySts;
}
public void setInventorySts(String inventorySts) {
this.inventorySts = inventorySts;
}
public String getIsGift() {
return isGift;
}
public void setIsGift(String isGift) {
this.isGift = isGift;
}
public String getRequestQty() {
return requestQty;
}
public void setRequestQty(String requestQty) {
this.requestQty = requestQty;
}
public String getShipQty() {
return shipQty;
}
public void setShipQty(String shipQty) {
this.shipQty = shipQty;
}
public String getQuantityUM() {
return quantityUM;
}
public void setQuantityUM(String quantityUM) {
this.quantityUM = quantityUM;
}
public String getListPrice() {
return listPrice;
}
public void setListPrice(String listPrice) {
this.listPrice = listPrice;
}
public String getItemTotalAmount() {
return itemTotalAmount;
}
public void setItemTotalAmount(String itemTotalAmount) {
this.itemTotalAmount = itemTotalAmount;
}
public String getTotalPayAmount() {
return totalPayAmount;
}
public void setTotalPayAmount(String totalPayAmount) {
this.totalPayAmount = totalPayAmount;
}
public String getTotalWeight() {
return totalWeight;
}
public void setTotalWeight(String totalWeight) {
this.totalWeight = totalWeight;
}
public String getTotalVolume() {
return totalVolume;
}
public void setTotalVolume(String totalVolume) {
this.totalVolume = totalVolume;
}
public String getTotalVolumeWeight() {
return totalVolumeWeight;
}
public void setTotalVolumeWeight(String totalVolumeWeight) {
this.totalVolumeWeight = totalVolumeWeight;
}
public String getWeightUM() {
return weightUM;
}
public void setWeightUM(String weightUM) {
this.weightUM = weightUM;
}
public String getVolumeUM() {
return volumeUM;
}
public void setVolumeUM(String volumeUM) {
this.volumeUM = volumeUM;
}
public String getCreated() {
return created;
}
public void setCreated(String created) {
this.created = created;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public String getLastUpdated() {
return lastUpdated;
}
public void setLastUpdated(String lastUpdated) {
this.lastUpdated = lastUpdated;
}
public String getLastUpdatedBy() {
return lastUpdatedBy;
}
public void setLastUpdatedBy(String lastUpdatedBy) {
this.lastUpdatedBy = lastUpdatedBy;
}
} }

View File

@ -43,4 +43,6 @@ public class ReturnGoodSearchDetailsDto {
private String lastUpdated; private String lastUpdated;
private String lastUpdatedBy; private String lastUpdatedBy;
private String discountPrice; private String discountPrice;
private ReturnGoodSearchHeaderDto returnGoodSearchHeaderDto;
} }

View File

@ -3,7 +3,6 @@ package com.hzya.frame.ttxofs.dto.stock;
import com.hzya.frame.ttxofs.basics.ReturnMessageBasics; import com.hzya.frame.ttxofs.basics.ReturnMessageBasics;
import lombok.Data; import lombok.Data;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -21,79 +20,84 @@ public class StockinOrderSearchResponse extends ReturnMessageBasics {
@Data @Data
public class StockinH { public class StockinH {
private Integer id; private String id;
private String clientCode; private String clientCode;
private String companyCode; private String companyCode;
private String facilityCode; private String facilityCode;
private String code; private String code;
private String internalInstructionType; private String internalInstructionType;
private String bizChannel; private String bizChannel;
private Integer refOrderId; private String refOrderId;
private String refOrderCode; private String refOrderCode;
private String refOrderType; private String refOrderType;
private Integer closed; private String closed;
private String closedBy; private String closedBy;
private Integer status; private String status;
private Integer allowOverReceive; private String allowOverReceive;
private Integer totalLines; private String totalLines;
private Integer totalQty; private String totalQty;
private Integer totalAmount; private String totalAmount;
private Integer totalWeight; private String totalWeight;
private Integer totalVolume; private String totalVolume;
private Integer totalVolumeWeight; private String totalVolumeWeight;
private Integer totalFulfillAmount; private String totalFulfillAmount;
private Integer totalFulfillWeight; private String totalFulfillWeight;
private Integer totalFulfillVolume; private String totalFulfillVolume;
private Integer totalFulfillVolumeWeight; private String totalFulfillVolumeWeight;
private Integer totalFulfillQty; private String totalFulfillQty;
private Integer totalCases; private String totalCases;
private Integer totalContainers; private String totalContainers;
private Integer closeAtQty; private String closeAtQty;
private String quantityUM; private String quantityUM;
private String weightUM; private String weightUM;
private String volumeUM; private String volumeUM;
private Date checkInFrom; private String checkInFrom;
private Date checkInTo; private String checkInTo;
private Date closedAt; private String closedAt;
private String note; private String note;
private String sourceOrderCode; private String sourceOrderCode;
private Date created; private String created;
private String createdBy; private String createdBy;
private Date lastUpdated; private String lastUpdated;
private String lastUpdatedBy; private String lastUpdatedBy;
private String sourcePlatformCode;
private String storeCode;
} }
@Data @Data
public class StockinB { public class StockinB {
private Integer id; private String id;
private Integer receiptId; private String receiptId;
private String receiptCode; private String receiptCode;
private Integer refOrderId; private String refOrderId;
private Integer refOrderDetailId; private String refOrderDetailId;
private String clientCode; private String clientCode;
private String companyCode; private String companyCode;
private String facilityCode; private String facilityCode;
private String skuCode; private String skuCode;
private String skuName; private String skuName;
private Integer requestQty; private String requestQty;
private Integer receivedQty; private String receivedQty;
private Integer openQty; private String openQty;
private String quantityUM; private String quantityUM;
private Integer totalWeight; private String totalWeight;
private Integer totalVolume; private String totalVolume;
private Integer totalVolumeWeight; private String totalVolumeWeight;
private Integer totalAmount; private String totalAmount;
private String weightUM; private String weightUM;
private String volumeUM; private String volumeUM;
private String inventorySts; private String inventorySts;
private Integer inTransInvId; private String inTransInvId;
private Integer closed; private String closed;
private Date created; private String created;
private String createdBy; private String createdBy;
private Date lastUpdated; private String lastUpdated;
private String lastUpdatedBy; private String lastUpdatedBy;
private Integer discountPrice; private String discountPrice;
//表头对象
private StockinH returnGoodSearchHeaderDto;
} }
} }